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 06F05454E9 for ; Tue, 25 Jun 2024 02:00:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E65BF41143; Tue, 25 Jun 2024 02:00:13 +0200 (CEST) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id D2DE14026F for ; Tue, 25 Jun 2024 02:00:12 +0200 (CEST) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42138eadf64so42105095e9.3 for ; Mon, 24 Jun 2024 17:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273612; x=1719878412; 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=N6SA19XlOyBk9o9k/suOiYngqW2bcrl9aMwDeZUgpOI=; b=iYBM0tbSvait2074vuV/dNtVHnvHIo/p3V5rbQjV9CBwBuljjOhH+Phtyz0Z/ttXiv WzpZ9H9TxQ0+ha12m+Fb2BgyU7cGSfoeHHFqWOkGJZDOFKPhQJQZV0GLnD1e9UmAHaEa c9D2r+AxwUG69ncyr8Nkuk/+GUpvGfj2PonJKkYGxeYKp2HpGvY4yhcHQI1tjxGGdPy8 lx+bzRdQFDix+Z7EX5eQsfOkeJJoPFkRCVsFJVx67aNuM/j5fA/cfKFVQmfEW9+N5f1f F88GgQAfx+4k0ZWkHzdKO8+RTIYIAVwOI1OJOEt40B0T7Bd8mo2h8pb6T1cJE2GKyDAF LuWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273612; x=1719878412; 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=N6SA19XlOyBk9o9k/suOiYngqW2bcrl9aMwDeZUgpOI=; b=LBJ5e9242CwQ/DfxQGonWpd5+0ohbuPGg1mKWpPpvQcK63+pQMLMx9nhaF0Ikh5M62 ikP7jueir5ETGstUwh34FKuJxeZpb8KDNXWOxSKi1x8PgMOoDV5+/LXNg3YORyWouBVi CfZK50wIFL9kS1qRkYKZFv44qnEXYhnQZYGsXL4uUMTtMuHw0OMQx1Rmaqeqz31FJFnd E+JtzLmjLzWoHzgWx6utaKBtUYwowUzBtVJeUQGYXhv8+Mp9RmF5ETulAQKLG7WzIecN e3GX6P9E4kPkoxhExlmSVD+bYw7h4G3VBwIR672rtA1ilVKk2EEYVhdWDuoca7atlyL2 PFtw== X-Forwarded-Encrypted: i=1; AJvYcCV7Zdoc/SPr6PxgDMDvH73J9PDb/XSOD5qLyOHAB4JYf1M6JhLZxB6bo4kpZx/vNrWA/rmqMte9JuphoJ9CFaQ= X-Gm-Message-State: AOJu0Yy2sWUDazvXl93d2aWcoqTUCpe6fVLPKnk5i2ehLiS99r0l73pR 0W3Npin6UsOLA/waXXN3BSoBFTxOe4nHzhycd+3e7498IzuKlrcO X-Google-Smtp-Source: AGHT+IH0AaNIDFXqHPKEHaOQ4wBbNRUHQvITWEUD1u+LevVMCvAS7tG1Ms9mQcAzGbmNYc3QCBFbgQ== X-Received: by 2002:a7b:c308:0:b0:421:82ed:28eb with SMTP id 5b1f17b1804b1-4248cc343b2mr39110065e9.21.1719273612499; Mon, 24 Jun 2024 17:00:12 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-366388c4282sm11370604f8f.31.2024.06.24.17.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:00:12 -0700 (PDT) From: luca.boccassi@gmail.com To: Ciara Loftus Cc: Stephen Hemminger , Maryam Tahhan , dpdk stable Subject: patch 'net/af_xdp: fix stats reset' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:58:05 +0100 Message-Id: <20240624235907.885628-19-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/9e8bcd1f55c9ccde6ffcb82591538ea8230a96d5 Thanks. Luca Boccassi --- >From 9e8bcd1f55c9ccde6ffcb82591538ea8230a96d5 Mon Sep 17 00:00:00 2001 From: Ciara Loftus Date: Tue, 14 May 2024 08:41:54 +0000 Subject: [PATCH] net/af_xdp: fix stats reset [ upstream commit 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d ] The imissed statistic was not properly reset because it was read directly from the kernel statistics. To fix this, take note of the kernel statistic when the stats are reset and deduct this value from the kernel statistic read during statistics get. Bugzilla ID: 1430 Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") Reported-by: Stephen Hemminger Signed-off-by: Ciara Loftus Acked-by: Maryam Tahhan Acked-by: Stephen Hemminger --- drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 544ce40693..df6ac7a4f2 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -105,6 +105,7 @@ struct rx_stats { uint64_t rx_pkts; uint64_t rx_bytes; uint64_t rx_dropped; + uint64_t imissed_offset; }; struct pkt_rx_queue { @@ -862,7 +863,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n"); return -1; } - stats->imissed += xdp_stats.rx_dropped; + stats->imissed += xdp_stats.rx_dropped - rxq->stats.imissed_offset; stats->opackets += stats->q_opackets[i]; stats->obytes += stats->q_obytes[i]; @@ -875,13 +876,25 @@ static int eth_stats_reset(struct rte_eth_dev *dev) { struct pmd_internals *internals = dev->data->dev_private; - int i; + struct pmd_process_private *process_private = dev->process_private; + struct xdp_statistics xdp_stats; + socklen_t optlen; + int i, ret, fd; for (i = 0; i < internals->queue_cnt; i++) { memset(&internals->rx_queues[i].stats, 0, sizeof(struct rx_stats)); memset(&internals->tx_queues[i].stats, 0, sizeof(struct tx_stats)); + fd = process_private->rxq_xsk_fds[i]; + optlen = sizeof(struct xdp_statistics); + ret = fd >= 0 ? getsockopt(fd, SOL_XDP, XDP_STATISTICS, + &xdp_stats, &optlen) : -1; + if (ret != 0) { + AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n"); + return -1; + } + internals->rx_queues[i].stats.imissed_offset = xdp_stats.rx_dropped; } return 0; -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:14.742605431 +0100 +++ 0019-net-af_xdp-fix-stats-reset.patch 2024-06-25 00:22:13.101183937 +0100 @@ -1 +1 @@ -From 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d Mon Sep 17 00:00:00 2001 +From 9e8bcd1f55c9ccde6ffcb82591538ea8230a96d5 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3577b1ee97dcfe9ff1b9e050bed55f17c435a93d ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 0db761a204..25e67851f6 100644 +index 544ce40693..df6ac7a4f2 100644 @@ -27 +28 @@ -@@ -126,6 +126,7 @@ struct rx_stats { +@@ -105,6 +105,7 @@ struct rx_stats { @@ -35 +36 @@ -@@ -892,7 +893,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -862,7 +863,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -44 +45 @@ -@@ -905,13 +906,25 @@ static int +@@ -875,13 +876,25 @@ static int