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 C0D8443E57 for ; Sat, 13 Apr 2024 14:59:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B607D40294; Sat, 13 Apr 2024 14:59:07 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by mails.dpdk.org (Postfix) with ESMTP id F2141400D6 for ; Sat, 13 Apr 2024 14:59:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A6k0scCo+8Y4LZtbnnddjy75cDCcF9WPVQdi8Ade0DzeBcP7oo850seQ44X1qu7GzY5mYzn9sbYQQqbMVNZUzD3l7NJ35z+PCPgEnbglIvxgsv77FIOy1zK4oFXdigamxoC064ljBfD5qj6RdV6vpDdw/wSnCkP2VAZQ78FdO2ABmIr7PYtyq59L7kirb4rTcGFw71Rwwxi0wFRH1Ns4bE7MbUAcZb/10X6FfZ4PjJk5EfP7dYMlB2xZmuyeCPjKl7fnKZkhG2cS+nAMqWTAOyFl9exRkSDZrqPow9CBMWcsU6wohHJLMV2KH3AoQ9s/bkCg429bdlN/WekgOrdheA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZtxekVmNI5OWQL5zSusjZX3mkj71CZvLf5D21AWtiQs=; b=BSh6MXE4+RPksMr3toGU7NFtkllolR8PGU65YSn6T3oC2Pdjy2KLrsZOwwy+CQXkqXBax4GmdKwztx5FO+Mr1bSg721lqBMMIbg5oqz6rMBVcN9ynFtW0fnFsgdzhYHl1twUXdM5Fm6yPN7my1VEbecOPbMlkS4E8XOQbqx4ap3nOPBCykUSq1wE+eikQJWHlcM0+1DbMw/slTgxR8LGedyFW0RGPqJZk1h86DGThujk3rH7ZGcUV6/xent1aEPQxhlHw5iaLfDUWxDJBl53WK3habKalR3M1EKm53+VxWxuq1kxg4w1UZDUS2spJ9N6YLGnh+8YlkC1NOB3Js/1Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZtxekVmNI5OWQL5zSusjZX3mkj71CZvLf5D21AWtiQs=; b=Zsem3+nywcc4+hoj5ZXnart3zbW31Wa9K9V+OJQyGihB1MEHXh7BgFT+i/SwXFmZZ82/ktDDO5rgamH0rNJUiVjUpjR0FWYMPpwrFcPX4YpdUFlul65hKdWt3rbgvYvfepKGKPqTFdYcIjQ9zVLcf++bt1bj3trtQ9ufyh6WakgvGL018tAK99hnSmfz3hAO06YmWICUjHXdNMMMCo4+DnifiX3ddxeoHmOcbndmVlsvepVq9IyPxAwWyg9IQdSKCIeDfBnVHehcfQaNy1qptZBwm+tEi8KTWWm1Wv7ezAyPwCJtYbvlAnJtU15g2q6eAqxEqKfr5Ux7n8CrUililw== Received: from SJ0PR03CA0198.namprd03.prod.outlook.com (2603:10b6:a03:2ef::23) by SA1PR12MB8597.namprd12.prod.outlook.com (2603:10b6:806:251::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Sat, 13 Apr 2024 12:59:02 +0000 Received: from MWH0EPF000989EB.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::18) by SJ0PR03CA0198.outlook.office365.com (2603:10b6:a03:2ef::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.25 via Frontend Transport; Sat, 13 Apr 2024 12:59:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by MWH0EPF000989EB.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 12:59:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 13 Apr 2024 05:58:57 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Sat, 13 Apr 2024 05:58:55 -0700 From: Xueming Li To: Shun Hao CC: Bing Zhao , Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix meter policy priority' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:49:38 +0800 Message-ID: <20240413125005.725659-98-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EB:EE_|SA1PR12MB8597:EE_ X-MS-Office365-Filtering-Correlation-Id: eeaddf76-51ae-4538-7bec-08dc5bb97e2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BkSf8zTwQ+vVPD0bmGVw0TcqNsQiPtXKmC3jZ2j2Eppf4truCFRgbuC/+elXs8kZY4oxXr2JLvOSCu+SfvmV3gg83QBhti71Zc4PsvZtLV3Kv+J3dg4z9dLPu9Uzr8U/n72W1ry4wqi2Wio6LpWvxyuhTnnqIhm7iL37lcW9HqWx/nO4NwKshMy0yVvF6VJ6hAn0Ti7iD4dOiiXXlKem9z9CZkLZQMHuKGy6YSfccgjiX0QUmGzJB1lgSZ9ZSr7nZ9mkml1/+3F5UnThIeX9G0wbXXO1DiuOP0B8xxhvPTC3XmPfRG+z9wWuyd/UwbpuIfcOvjwEuwmpxRDcSxLlGK4uYddR6TDhj/I4POSweLKM+LEJeEZbIE0a5r9vZQwA5ONkUl4AYoiHXO4VxeyYHzRAjNbmx259avYfSQkFu8gUdvtE/jLUKKTs2EAQGYXv8C7XnhoHERD7o8X642OoTEbnsnlnIRq++5McuZ/a3ee5lQMLlOMAZAvwb9vkObBcjoj31oDrQkoGjKY7WLXe7swy+ZWCYfBT5EKag2uuFb6bMj5+vxigwfny0RDMYYAHYXq5xHKueaLjo+rb4v+GuGodMq7WZdGpdVkHqSnC4hg0J5ByxC/hGeyGpY1KGqlIar0KIQCn6nlNP3WytRfKqMAB7oeQxHYLH5/A9Sb66KEH0n2zRj0EBNanQ+mXYUE42q4ODM+MorM512GRpwbeCNgfZoHGmQkpNSlufVdOfU/AOqWIfGr3smAgRSjVZtYK X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(1800799015)(36860700004)(82310400014)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 12:59:02.2530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeaddf76-51ae-4538-7bec-08dc5bb97e2b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8597 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 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/15/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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a8b06881d95287ac683eaaa536d368bcbc2ac397 Thanks. Xueming Li --- >From a8b06881d95287ac683eaaa536d368bcbc2ac397 Mon Sep 17 00:00:00 2001 From: Shun Hao Date: Fri, 1 Mar 2024 10:46:05 +0200 Subject: [PATCH] net/mlx5: fix meter policy priority Cc: Xueming Li [ upstream commit 1cfb78d2c40e3b3cf1bad061f21f306272fffd47 ] Currently a meter policy's flows are always using the same priority for all colors, so the red color flow might be before green/yellow ones. This will impact the performance cause green/yellow packets will check red flow first and got miss, then match green/yellow flows, introducing more hops. This patch fixes this by giving the same priority to flows for all colors. Fixes: 363db9b00f ("net/mlx5: handle yellow case in default meter policy") Signed-off-by: Shun Hao Acked-by: Bing Zhao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 41 +++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c0d9e4fb82..1c85331cb6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -17655,9 +17655,8 @@ __flow_dv_create_policy_matcher(struct rte_eth_dev *dev, } } tbl_data = container_of(tbl_rsc, struct mlx5_flow_tbl_data_entry, tbl); - if (priority < RTE_COLOR_RED) - flow_dv_match_meta_reg(matcher.mask.buf, - (enum modify_reg)color_reg_c_idx, color_mask, color_mask); + flow_dv_match_meta_reg(matcher.mask.buf, + (enum modify_reg)color_reg_c_idx, color_mask, color_mask); matcher.priority = priority; matcher.crc = rte_raw_cksum((const void *)matcher.mask.buf, matcher.mask.size); @@ -17708,7 +17707,6 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, int i; int ret = mlx5_flow_get_reg_id(dev, MLX5_MTR_COLOR, 0, &flow_err); struct mlx5_sub_policy_color_rule *color_rule; - bool svport_match; struct mlx5_sub_policy_color_rule *tmp_rules[RTE_COLORS] = {NULL}; if (ret < 0) @@ -17744,10 +17742,9 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, /* No use. */ attr.priority = i; /* Create matchers for colors. */ - svport_match = (i != RTE_COLOR_RED) ? match_src_port : false; if (__flow_dv_create_policy_matcher(dev, color_reg_c_idx, MLX5_MTR_POLICY_MATCHER_PRIO, sub_policy, - &attr, svport_match, NULL, + &attr, match_src_port, NULL, &color_rule->matcher, &flow_err)) { DRV_LOG(ERR, "Failed to create color%u matcher.", i); goto err_exit; @@ -17757,7 +17754,7 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, color_reg_c_idx, (enum rte_color)i, color_rule->matcher, acts[i].actions_n, acts[i].dv_actions, - svport_match, NULL, &color_rule->rule, + match_src_port, NULL, &color_rule->rule, &attr)) { DRV_LOG(ERR, "Failed to create color%u rule.", i); goto err_exit; @@ -18640,7 +18637,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, struct { struct mlx5_flow_meter_policy *fm_policy; struct mlx5_flow_meter_info *next_fm; - struct mlx5_sub_policy_color_rule *tag_rule[MLX5_MTR_RTE_COLORS]; + struct mlx5_sub_policy_color_rule *tag_rule[RTE_COLORS]; } fm_info[MLX5_MTR_CHAIN_MAX_NUM] = { {0} }; uint32_t fm_cnt = 0; uint32_t i, j; @@ -18674,14 +18671,22 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, mtr_policy = fm_info[i].fm_policy; rte_spinlock_lock(&mtr_policy->sl); sub_policy = mtr_policy->sub_policys[domain][0]; - for (j = 0; j < MLX5_MTR_RTE_COLORS; j++) { + for (j = 0; j < RTE_COLORS; j++) { uint8_t act_n = 0; - struct mlx5_flow_dv_modify_hdr_resource *modify_hdr; + struct mlx5_flow_dv_modify_hdr_resource *modify_hdr = NULL; struct mlx5_flow_dv_port_id_action_resource *port_action; + uint8_t fate_action; - if (mtr_policy->act_cnt[j].fate_action != MLX5_FLOW_FATE_MTR && - mtr_policy->act_cnt[j].fate_action != MLX5_FLOW_FATE_PORT_ID) - continue; + if (j == RTE_COLOR_RED) { + fate_action = MLX5_FLOW_FATE_DROP; + } else { + fate_action = mtr_policy->act_cnt[j].fate_action; + modify_hdr = mtr_policy->act_cnt[j].modify_hdr; + if (fate_action != MLX5_FLOW_FATE_MTR && + fate_action != MLX5_FLOW_FATE_PORT_ID && + fate_action != MLX5_FLOW_FATE_DROP) + continue; + } color_rule = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct mlx5_sub_policy_color_rule), 0, SOCKET_ID_ANY); @@ -18693,9 +18698,8 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, goto err_exit; } color_rule->src_port = src_port; - modify_hdr = mtr_policy->act_cnt[j].modify_hdr; /* Prepare to create color rule. */ - if (mtr_policy->act_cnt[j].fate_action == MLX5_FLOW_FATE_MTR) { + if (fate_action == MLX5_FLOW_FATE_MTR) { next_fm = fm_info[i].next_fm; if (mlx5_flow_meter_attach(priv, next_fm, &attr, error)) { mlx5_free(color_rule); @@ -18722,7 +18726,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, } acts.dv_actions[act_n++] = tbl_data->jump.action; acts.actions_n = act_n; - } else { + } else if (fate_action == MLX5_FLOW_FATE_PORT_ID) { port_action = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_PORT_ID], mtr_policy->act_cnt[j].rix_port_id_action); @@ -18735,6 +18739,9 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, acts.dv_actions[act_n++] = modify_hdr->action; acts.dv_actions[act_n++] = port_action->action; acts.actions_n = act_n; + } else { + acts.dv_actions[act_n++] = mtr_policy->dr_drop_action[domain]; + acts.actions_n = act_n; } fm_info[i].tag_rule[j] = color_rule; TAILQ_INSERT_TAIL(&sub_policy->color_rules[j], color_rule, next_port); @@ -18766,7 +18773,7 @@ err_exit: mtr_policy = fm_info[i].fm_policy; rte_spinlock_lock(&mtr_policy->sl); sub_policy = mtr_policy->sub_policys[domain][0]; - for (j = 0; j < MLX5_MTR_RTE_COLORS; j++) { + for (j = 0; j < RTE_COLORS; j++) { color_rule = fm_info[i].tag_rule[j]; if (!color_rule) continue; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-04-13 20:43:08.008132500 +0800 +++ 0098-net-mlx5-fix-meter-policy-priority.patch 2024-04-13 20:43:05.077753827 +0800 @@ -1 +1 @@ -From 1cfb78d2c40e3b3cf1bad061f21f306272fffd47 Mon Sep 17 00:00:00 2001 +From a8b06881d95287ac683eaaa536d368bcbc2ac397 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1cfb78d2c40e3b3cf1bad061f21f306272fffd47 ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +28 @@ -index 18f09b22be..f1584ed6e0 100644 +index c0d9e4fb82..1c85331cb6 100644 @@ -29 +31 @@ -@@ -17922,9 +17922,8 @@ __flow_dv_create_policy_matcher(struct rte_eth_dev *dev, +@@ -17655,9 +17655,8 @@ __flow_dv_create_policy_matcher(struct rte_eth_dev *dev, @@ -41 +43 @@ -@@ -17975,7 +17974,6 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, +@@ -17708,7 +17707,6 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, @@ -49 +51 @@ -@@ -18011,10 +18009,9 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, +@@ -17744,10 +17742,9 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, @@ -61 +63 @@ -@@ -18024,7 +18021,7 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, +@@ -17757,7 +17754,7 @@ __flow_dv_create_domain_policy_rules(struct rte_eth_dev *dev, @@ -70 +72 @@ -@@ -18907,7 +18904,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, +@@ -18640,7 +18637,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, @@ -79 +81 @@ -@@ -18941,14 +18938,22 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, +@@ -18674,14 +18671,22 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, @@ -107 +109 @@ -@@ -18960,9 +18965,8 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, +@@ -18693,9 +18698,8 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, @@ -118 +120 @@ -@@ -18989,7 +18993,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, +@@ -18722,7 +18726,7 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, @@ -127 +129 @@ -@@ -19002,6 +19006,9 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, +@@ -18735,6 +18739,9 @@ flow_dv_meter_hierarchy_rule_create(struct rte_eth_dev *dev, @@ -137 +139 @@ -@@ -19033,7 +19040,7 @@ err_exit: +@@ -18766,7 +18773,7 @@ err_exit: