From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E92F645E79; Wed, 11 Dec 2024 17:30:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAE5B4067A; Wed, 11 Dec 2024 17:29:27 +0100 (CET) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 398ED40652 for ; Wed, 11 Dec 2024 17:29:20 +0100 (CET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21670dce0a7so26238185ad.1 for ; Wed, 11 Dec 2024 08:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733934559; x=1734539359; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w7/RJMaUEfdZiZKloDh0Aa96sMGiaNLjwMmI3QlQn/U=; b=upM+05V5QOVnmIXUs/SjLivwOg4xMYbvOEerbjxFhBys2shzq/lGhbGYRVn0//juz5 niNglKI+U9UWOG0aug+c2hebFauOBRXDTKzxcV94ZKeILzj3z99pKcdqBR0Y+9/9tal/ +jd8gdpSoiH4/ReKeiEiBkS30lYbyx6YuiNXYRpeGj1CxkUYuTPHXotGQb64qzHVs3uF j4yWWdnx47z0gPDcSXjgZohXtHdD1CSISAyy8DUrriXhNlR75kYknuSzsjGKjX/ocrkf YWRylPlE9agvms+5rh++jeQH7DR++etXgAscbgLy3DkRKafk8990jRuy57Ex2c7RW6F5 EFAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934559; x=1734539359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w7/RJMaUEfdZiZKloDh0Aa96sMGiaNLjwMmI3QlQn/U=; b=U+44ZagjSO/jDGOt7jhQUmHZAe7+J3H4SVQENPYGhf3OtUcM8zn5aWMRIAxnBgj6GH WEuhUDYXJqxsZY85RlkCZ35Cu6qaBbAf2ah1b1tGMkxtTlmZVjJ9AN0Kvll1Yk9FYOja QSmIkStRCv+2QyN/zMnQaq9PamAXTdpmeXaMS2zlGgfq8qo+3UunjA8QpI7gOfirG9OK CMsKMWUqg4ONrSMaQ/NcH9wTNobIzuf5s3Oc3NiNA0rwiw+9omKQ+evPgn63c1Xyfmmp O4+Jt/4GvyvjY26RLbGDnFDCFmHl24QIYAi38TVw0dm1orfWpPLWK8Z7r8KLqduOzNpB NjTQ== X-Gm-Message-State: AOJu0Yw4VYfuNUCHtBdeoUBe13o/eMK9Jhe+F84lhtP03n8fhlfkhk9S /PbDIHsC4VbpwLCHOWi0xm60/P+yCl9okbcC3VTki7tJBscrnXONg1anrfyQv0M6GEYD0HxplVS j X-Gm-Gg: ASbGncua8dIZN6yyvnhoRwt08whBvXJdaheuzIKwB02OAKeWhtSJl5MVssUwBZYeX7a 9dOmzKCB4u0lEOw48mXjtoEuyXIvWEu+B2XrvH5HakzK1AhuaYqhLKagC07Jq57mDwtfIrq3tXb Fp6qTI3o2Y498CW7FZbA4KpugVl1YFqe8uWproRYi0yq7znot868liSSuxdnCnnhQSbrZcuDXSU iGqdfmbKd9swboMJapCagS1wstJMA/zR1J0AQbUoYntOH1i68bnj0N0cLlpUgmoxv8iuIITKbw1 xLIBVeNxjq8X9DwuR/+aQRDkmub4hh0= X-Google-Smtp-Source: AGHT+IHwVcDvaBC3D/juJ65DBXmSwGv2ai/VdDB+BBVaYDr0b3BMvjVWq7fJJMGREuzQqITkensBbg== X-Received: by 2002:a17:902:ec90:b0:216:52a5:dd41 with SMTP id d9443c01a7336-2177854ab38mr62913345ad.31.1733934559412; Wed, 11 Dec 2024 08:29:19 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21632c4fc62sm71989895ad.194.2024.12.11.08.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:29:19 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2 8/8] net/ioring: implement statistics Date: Wed, 11 Dec 2024 08:28:09 -0800 Message-ID: <20241211162904.121695-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241211162904.121695-1-stephen@networkplumber.org> References: <20241210212757.83490-1-stephen@networkplumber.org> <20241211162904.121695-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add support for basic statistics Signed-off-by: Stephen Hemminger --- doc/guides/nics/features/ioring.ini | 2 + drivers/net/ioring/rte_eth_ioring.c | 57 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/doc/guides/nics/features/ioring.ini b/doc/guides/nics/features/ioring.ini index da47062adb..c9a4582d0e 100644 --- a/doc/guides/nics/features/ioring.ini +++ b/doc/guides/nics/features/ioring.ini @@ -9,6 +9,8 @@ MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Multiprocess aware = Y +Basic stats = Y +Stats per queue = Y Linux = Y x86-64 = Y Usage doc = Y diff --git a/drivers/net/ioring/rte_eth_ioring.c b/drivers/net/ioring/rte_eth_ioring.c index a7f38e0d5c..97f7bc72d3 100644 --- a/drivers/net/ioring/rte_eth_ioring.c +++ b/drivers/net/ioring/rte_eth_ioring.c @@ -365,6 +365,61 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) return 0; } +static int +eth_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + const struct rx_queue *rxq = dev->data->rx_queues[i]; + + stats->ipackets += rxq->rx_packets; + stats->ibytes += rxq->rx_bytes; + stats->ierrors += rxq->rx_errors; + stats->rx_nombuf += rxq->rx_nombuf; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = rxq->rx_packets; + stats->q_ibytes[i] = rxq->rx_bytes; + } + } + + for (uint16_t i = 0; i < dev->data->nb_tx_queues; i++) { + const struct tx_queue *txq = dev->data->tx_queues[i]; + + stats->opackets += txq->tx_packets; + stats->obytes += txq->tx_bytes; + stats->oerrors += txq->tx_errors; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = txq->tx_packets; + stats->q_obytes[i] = txq->tx_bytes; + } + } + + return 0; +} + +static int +eth_dev_stats_reset(struct rte_eth_dev *dev) +{ + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + struct rx_queue *rxq = dev->data->rx_queues[i]; + + rxq->rx_packets = 0; + rxq->rx_bytes = 0; + rxq->rx_nombuf = 0; + rxq->rx_errors = 0; + } + + for (uint16_t i = 0; i < dev->data->nb_tx_queues; i++) { + struct tx_queue *txq = dev->data->tx_queues[i]; + + txq->tx_packets = 0; + txq->tx_bytes = 0; + txq->tx_errors = 0; + } + return 0; +} + static int eth_dev_close(struct rte_eth_dev *dev) { @@ -735,6 +790,8 @@ static const struct eth_dev_ops ops = { .promiscuous_disable = eth_dev_promiscuous_disable, .allmulticast_enable = eth_dev_allmulticast_enable, .allmulticast_disable = eth_dev_allmulticast_disable, + .stats_get = eth_dev_stats_get, + .stats_reset = eth_dev_stats_reset, .rx_queue_setup = eth_rx_queue_setup, .rx_queue_release = eth_rx_queue_release, .tx_queue_setup = eth_tx_queue_setup, -- 2.45.2