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 E1E35A0093 for ; Tue, 10 May 2022 14:30:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD10B42835; Tue, 10 May 2022 14:30:44 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 48C844069D for ; Tue, 10 May 2022 14:30:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652185842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+ctC+tt4w+Vr9IBCOvgegLMtid4Zgr3YgKoMWLtjQS4=; b=RLN/xWFUsBSs+X56EAvwbBBxaSJ35s934/k/iAmauje2KkrJhbit/EAcEbMvs4QaWupD4T n+XowyeDT3yD0XWEt4Pii+4Ml9OD28V2o7a4gcAOBmxV/Abz7Q8n2iozpCLdCMKBmjoOd+ wETAQh2MtOWbNpRR71gdzG33jXmNITE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-J_wAuV-gO3ikYw67TDnF4g-1; Tue, 10 May 2022 08:30:39 -0400 X-MC-Unique: J_wAuV-gO3ikYw67TDnF4g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 230DC80B719; Tue, 10 May 2022 12:30:39 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24F03400E89C; Tue, 10 May 2022 12:30:38 +0000 (UTC) From: Kevin Traynor To: Shun Hao Cc: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix counter in non-termination meter' has been queued to stable release 21.11.2 Date: Tue, 10 May 2022 13:29:51 +0100 Message-Id: <20220510123010.159523-14-ktraynor@redhat.com> In-Reply-To: <20220510123010.159523-1-ktraynor@redhat.com> References: <20220510123010.159523-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. 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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/c08c6247f23e2147c8191741c42c2d3c6d240b83 Thanks. Kevin --- >From c08c6247f23e2147c8191741c42c2d3c6d240b83 Mon Sep 17 00:00:00 2001 From: Shun Hao Date: Wed, 6 Apr 2022 11:54:01 +0300 Subject: [PATCH] net/mlx5: fix counter in non-termination meter [ upstream commit 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 ] In rte_flow, if a counter action is before a meter which has non-termination policy, the counter value only includes packets not being dropped. This patch fixes this issue by differentiating the order of counter and non-termination meter: 1. counter + meter, counts all packets hitting this flow. 2. meter + counter, only counts packets not being dropped. Fixes: 51ec04dc7bcf ("net/mlx5: connect meter policy to created flows") Signed-off-by: Shun Hao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 1ea6d030f3..3574358c72 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5044,4 +5044,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, uint32_t flow_id_reversed = 0; uint8_t flow_id_bits = 0; + bool after_meter = false; int shift; @@ -5110,4 +5111,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, action_cur = actions_pre++; } + after_meter = true; break; case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: @@ -5138,4 +5140,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, } break; + case RTE_FLOW_ACTION_TYPE_COUNT: + if (fm->def_policy) + action_cur = after_meter ? + actions_sfx++ : actions_pre++; + break; default: break; @@ -6168,6 +6175,8 @@ flow_create_split_meter(struct rte_eth_dev *dev, (!has_modify || !fm->drop_cnt)) set_mtr_reg = false; - /* Prefix actions: meter, decap, encap, tag, jump, end. */ - act_size = sizeof(struct rte_flow_action) * (actions_n + 6) + + /* Prefix actions: meter, decap, encap, tag, jump, end, cnt. */ +#define METER_PREFIX_ACTION 7 + act_size = (sizeof(struct rte_flow_action) * + (actions_n + METER_PREFIX_ACTION)) + sizeof(struct mlx5_rte_flow_action_set_tag); /* Suffix items: tag, vlan, port id, end. */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.994006492 +0100 +++ 0014-net-mlx5-fix-counter-in-non-termination-meter.patch 2022-05-10 13:24:21.587646339 +0100 @@ -1 +1 @@ -From 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 Mon Sep 17 00:00:00 2001 +From c08c6247f23e2147c8191741c42c2d3c6d240b83 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 78cb38d42b..28afdfe011 100644 +index 1ea6d030f3..3574358c72 100644 @@ -28 +29 @@ -@@ -5272,4 +5272,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5044,4 +5044,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -34 +35 @@ -@@ -5338,4 +5339,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5110,4 +5111,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -40 +41 @@ -@@ -5366,4 +5368,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5138,4 +5140,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -50 +51 @@ -@@ -6394,6 +6401,8 @@ flow_create_split_meter(struct rte_eth_dev *dev, +@@ -6168,6 +6175,8 @@ flow_create_split_meter(struct rte_eth_dev *dev,