From patchwork Mon Feb 28 07:09:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 108389 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CAFEDA0350; Mon, 28 Feb 2022 08:10:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 585314068C; Mon, 28 Feb 2022 08:10:11 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2071.outbound.protection.outlook.com [40.107.243.71]) by mails.dpdk.org (Postfix) with ESMTP id 36D644068A; Mon, 28 Feb 2022 08:10:10 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUTrg+Q/E8Ymg9nE5G5D5Lj0glqvBTS1HkeG/7QFMdOkMHLNrlvF65kE06NkGTUwDghHr6y6fqp9qisHExPK/jnx4ZKrMdBaH9AaZkbdAT8PicJEhGmv/jmohIzvMiBne7HbsV7L2H2uaJzhT7i7ZWRJy2yuB3tH9nPyk4unIfeuSa9AUL/Ht9qUsKZSeuL3eGBAJcODVNghjlHROMQw6elwPvpGgC4xhGFMM1c7gj7IRph/hk0Dz3p8lm/yAYKmTMgy3X1k223NIBM/WJtEzV8zPIheKeMEFKfbgbidKS4pUMFtpsph4iu1jgCbiM0tMfMc7IEZYFklNq/OjxjwGA== 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=ZllyKGnFgeXo8l3Oa9kS/c5Ez7e/FhZ6xblT3Yt/QnE=; b=Qg226bd+3i1w6sy4Q52R23XgoWp+kvkAf6gVmNpYKlrTahBzwrtwOG6dgTS0CQfmx4GcYy4ayRkyk1M2U/a9Lkoei+Cn/IBYw3Dd/13pGPctLt3UDKZFWEM+Y9PRjmHXKkEU4iCxhFgedE7NTME/1WfCrfS59jbqqT59Dc32OhiImhA+o6NckF+UENPGQ8MlLBTHS5MGhqrX9/te7dpxHBVMNVhg+s1emTbR47fMGkPr9LfcSeljzTEkoFoqTsTiQ8PznI70NO9OPRQMXcrrJaMnj/yoF46sZ9FcvzSZxMeOtnPA9MUxut4ZQhOZM5yvzLzd95ONxD2zUYyGGu1VMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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 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=ZllyKGnFgeXo8l3Oa9kS/c5Ez7e/FhZ6xblT3Yt/QnE=; b=UDuyP7jjMTNba76uxesHCSm0uyf/dOHdsHXqAHe6RG3XKRXI8m21BOjKfRhtN+EkL3B7IFvKZ+EzWvChZuEJr5ypKoBBbixXsAAKLV5GR6hqSv8+omXHTJwfV9rOKuas8moMO/mWGtiQzDcPiAp1R6AvyzRwA627J4etMozYrsPvPI/sgY/zybXXk865InSnNen7vdtWjN+fpmmgwcgoMTksBZ3NO9ZzdV3Pq8MsLTfT5vPKXnHiD7YoWK/6WDrfpOEB9hHzHW94FyB2vvdvy1uziIlFnrxu6g5hwR/WROE2yzhtz+TwR5zENAFpMKkoMrbB08qUbrlAxNZ/Y9l8uA== Received: from BN8PR15CA0067.namprd15.prod.outlook.com (2603:10b6:408:80::44) by MWHPR12MB1360.namprd12.prod.outlook.com (2603:10b6:300:12::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25; Mon, 28 Feb 2022 07:10:08 +0000 Received: from BN8NAM11FT007.eop-nam11.prod.protection.outlook.com (2603:10b6:408:80:cafe::3) by BN8PR15CA0067.outlook.office365.com (2603:10b6:408:80::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26 via Frontend Transport; Mon, 28 Feb 2022 07:10:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT007.mail.protection.outlook.com (10.13.177.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 07:10:07 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 28 Feb 2022 07:10:04 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Sun, 27 Feb 2022 23:10:03 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Sun, 27 Feb 2022 23:10:01 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Subject: [PATCH 1/2] net/mlx5: fix overridden flag in flow validation Date: Mon, 28 Feb 2022 09:09:53 +0200 Message-ID: <20220228070954.3813602-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220228070954.3813602-1-michaelba@nvidia.com> References: <20220228070954.3813602-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1e0039e-2533-43fd-1aed-08d9fa8959d9 X-MS-TrafficTypeDiagnostic: MWHPR12MB1360:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uUudlmfLrVSq3xvTTDxIZlTRUQ+gXMJXN/8XBZ+lFgQx/+DVGcJb5BNuSP3k6nY848h/2RhoTDZbZHRm3C/cWL72glFujArXZpBs5jgAiVgbXP++p6fW9wdmoZ19ugbX7U8CI+6vS8vvCV6p1X33N+M2H+6Hnwhdm004AyuksecYg/cL6sBEseJeQLHJgkewFzF1YKKU0Ncx6Qf3MZiosoax22UjNSqTUyhsQxsUakcTeG8cMibh8kIsidTYGsr8MX9WDjrrQtJ1VJlr2XbaE9j/go3RgMBTf96uw3OpcPdcR/G0uTWuXxKP1jDRs9FeT+jWn/nB66RMXwnCAL+efoDLWFN3kR8ktZhx8a+qliXlGY9vbdsCBUMapM6mrQGBJ9bUobrEKvYHK9wv1K5Q/gWuDsRa4f10teQfukXS4Agh8NJp5aKecWRSr0xPoSY9+W0yBBlatwt1urne36dB5UfW07YkPKnLncjEjIaK8eSTXx4iUeALm4PyvroeKFoMubOtffMYpBjinMz1/EhyTDyAyKiPTkFKwMxfUlSHkkJ+zbr8y6YVZ/0RTt54fs8U9iXATQqliaETuK1rqUpiY9Gf7toYSDC0buXBjBNT/l0jBLS16PyHienbO2P4RRCvf8MxaUbse5qn5zRXtMpDU2frWW383AnwbnjIhpXcfW9Dl8xVLJrgdTYLFrP6BrQvBSJtlaGV/pc2B/GP/DQAew== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(6666004)(36860700001)(8676002)(450100002)(7696005)(47076005)(4326008)(83380400001)(426003)(2616005)(336012)(186003)(26005)(1076003)(6286002)(54906003)(6916009)(316002)(86362001)(36756003)(70586007)(508600001)(70206006)(5660300002)(2906002)(55016003)(8936002)(356005)(40460700003)(81166007)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 07:10:07.1531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1e0039e-2533-43fd-1aed-08d9fa8959d9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT007.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1360 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 The AGE action can be implemented by either counters or ASO mechanism. When user ask count action in the flow rule, AGE action is implemented by the same counter. However, if user ask indirect count action, it cannot be used for AGE. The flow_dv_validate() function has a flag named "shared_count" which indicates whether AGE action validate is depend on ASO support or not. This flag is initialized to false and is updated if there is indirect count action in the action list. This flag is mistakenly set within the loop that reads the action list and in each iteration it is reinitialized to false, regardless of the existence of an indirect count action in the list. This patch moves the flag initialization out of the loop. Fixes: f3191849f2c2 ("net/mlx5: support flow count action handle") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2191ce6e58..de6bf8c660 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -6907,6 +6907,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item *integrity_items[2] = {NULL, NULL}; const struct rte_flow_item *port_id_item = NULL; bool def_policy = false; + bool shared_count = false; uint16_t udp_dport = 0; if (items == NULL) @@ -7284,7 +7285,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, } for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { int type = actions->type; - bool shared_count = false; if (!mlx5_flow_os_action_supported(type)) return rte_flow_error_set(error, ENOTSUP, From patchwork Mon Feb 28 07:09:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 108391 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06424A0350; Mon, 28 Feb 2022 08:10:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D58E04115F; Mon, 28 Feb 2022 08:10:15 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2074.outbound.protection.outlook.com [40.107.93.74]) by mails.dpdk.org (Postfix) with ESMTP id 0F5C44115D; Mon, 28 Feb 2022 08:10:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwPoQhv/+nrO1YOoyY4kCqZ+CfT/s3wrTBbTtiB3jFMTX7bg+6xYdhwAX4tA+VDUWpMeIhsTeLc/4GWPzgV6v7u44yCgYKy+FNIxyRY4vxzGFixZ4DuaxPVIqt+zePchvXfvc7DrP221/Z0PA1tY3zjrQfSSjn2QfG+tWwHlkr8ZEZbhPTY4JH5SNehTHityJgvTuIIN/TpDZrtgWJPAUbuHrIjyRPz1hhD8mZQd+i1xPfvyhOTl6kD7x78HX0TI4JB0q6Cg47z/dpdSIb3dd/sOf5NIasXHv48cijk47YDbl+4bl8kv3Zk2vyi8ijgLIcaE917G2/+CMJxO4PMJPw== 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=V6OOoimpfg2CER1P5z6Fz2Z2PgsePdLcRMNBPQqSt28=; b=C+KmIjilABx7c/wdX6W4yL8TmQ7pq/kESOTlqPe826JVIf1zqs4c5TjlDPJPfXrsOrBCVw/GaaK/2i0Fz8U99S5PEHCjpSyXVtvL4ySrSDhgMqqhamOELy0bIQDmeFEDp/hiUr9XTkPfQ7MLR4BF5Oks+iUNx01ApAHSHLGBb7UTRYaze9iIUcTlb67TNM7drkywY/Ul8GJutMKTY98dcst5VbbLDPssi7i9+mqlag2qKavW/SywTCCZd9LJ5/s2z/qziJy0/yqwNzxvGv5uX7+b9ng3NLn02MVaQIgfqiGbuZrGh6aoRUGU3rNPDLypH/nhwyfOKu6FVb1FAbSPUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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 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=V6OOoimpfg2CER1P5z6Fz2Z2PgsePdLcRMNBPQqSt28=; b=bep28tboBySVxxSxe/PhWuPMXF9Ya9w6D3ffE/R+OEosJLowfdWoZxYBrt3vtI7QGYjeMRlH5DYH3OgQMVF4U2aJO+2X+N82Zsf7V3KS1qcQhEociEzw6qGntvuYOvTLJq+G+py4F/lP3Gdnvdf7j8KJNk9CW7DMFCcyINwxp/81yCxSZiViHyEgIVsNwanwb8IZM8ZX05tAe1QN+MNJJr+mNLWmbf4ITujZY0Fwi9S/YrH6yGeHmvWBE1TEmr95HPnUKZvNjMxQU60vfF2TEBE/0kKqOK+uPnpNPNHh1Zzlq2iMvJWySMSnZRdwVmXShehCXGLoyZ6pDZQFHrzF4w== Received: from BN6PR13CA0053.namprd13.prod.outlook.com (2603:10b6:404:11::15) by BY5PR12MB5527.namprd12.prod.outlook.com (2603:10b6:a03:1d5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Mon, 28 Feb 2022 07:10:12 +0000 Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:404:11:cafe::11) by BN6PR13CA0053.outlook.office365.com (2603:10b6:404:11::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.10 via Frontend Transport; Mon, 28 Feb 2022 07:10:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT045.mail.protection.outlook.com (10.13.177.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 07:10:12 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 28 Feb 2022 07:10:06 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Sun, 27 Feb 2022 23:10:05 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Sun, 27 Feb 2022 23:10:03 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Subject: [PATCH 2/2] net/mlx5: fix insufficient check in count action validation Date: Mon, 28 Feb 2022 09:09:54 +0200 Message-ID: <20220228070954.3813602-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220228070954.3813602-1-michaelba@nvidia.com> References: <20220228070954.3813602-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15c5ccc5-bac4-4431-dfdf-08d9fa895cc6 X-MS-TrafficTypeDiagnostic: BY5PR12MB5527:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fc9JD1ntvuyEYRavDqWIAT87bx9qlJQakIszjcXi4k8hilUlQ+YWIhGOdeQkR+Ic/+bmRQ0LS6ojNbh3+2dLjQ55MjG1/sisDFmq9pHkpcdSAuzXWM0CyXpF8aOCRApapshUkDyHsPta+YJcC39C7bYdHku+VsqEaL9R0+LXyGQKrzwHS6+rfiS0wrwcJ08z16QcPRbrmoPTcWDlIWo0YmqNryZJ3YfTfYOwTytxhSz7Vzn0GV5bj+szhWweYyLfySAMt5G3FRjSGEoEIwyG/RkLFa7GgCExofX7WXWhIwLLoPHPrrGfu89brysVMB0JWpuhBpE1d85WrX+df0e2nSYKE65Wa4cQt4yOE7YNjir1ukyBwvxWo21YN0jsfv0myv6APrMi+KP3rtIzBuDy9rcdgNA8x0OFUJpyfc87EcN/Q6rp50IgO8IylkXFHV3ex//iwL4GkmZdbz1SRqjTwUvpki2MeLEdseOTybSIao1gfGkN32Cq3sIPHrtLiV8kSaJS1l6q5zaWCFQ59PZrboVk/aa0p/Tfk/+kOayrXbuf09QMxnZL3wCkOMKPfIGaqtrpGRWf2mAatJ1sKxeUto+2Ysxzb7Zsp8dmsnlvspJ8AumNDkMzHLhZOKEZ0AGSwIzqaH8D7+pB6MNo0upMsI8VS7VrYIHv5WLPVfDlTZIx7XCzbuykPFZheDnduhQTfQfguFGyMJyuWvj1gPbpzQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(81166007)(356005)(2906002)(86362001)(55016003)(36756003)(82310400004)(40460700003)(6286002)(2616005)(186003)(26005)(426003)(508600001)(336012)(1076003)(36860700001)(6666004)(7696005)(8676002)(6916009)(4326008)(47076005)(8936002)(5660300002)(83380400001)(316002)(70206006)(70586007)(54906003)(450100002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 07:10:12.1136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15c5ccc5-bac4-4431-dfdf-08d9fa895cc6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5527 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 The AGE action can be implemented by either counters or ASO mechanism. ASO is more efficient than generating counters just for the purpose of aging, so when ASO is supported its use is preferable. On the other hand, when there is count in the list of actions, the counter is already generated, and it is best to use it for aging even if ASO is supported. On the other hand, when the count action is "indirect", it cannot be used for aging since it may be updated from other flow rules in which it participates. Checking whether ASO is supported depends on both the capability of the device and the flow rule group number, ASO is not supported for group 0. However, the flow_dv_validate() function only checks the capability and ignores the group, allowing inadmissible flow rules. For example, when the device supports ASO and a flow rule is set that combines an indirect counter with aging for group 0, the rule should be rejected, but it is created and does not function properly. This patch updates the counter validation which will also consider the group number when deciding if there is ASO support. Fixes: daed4b6e3db2 ("net/mlx5: use aging by counter when counter exists") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 41 +++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index de6bf8c660..e5be435e32 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3277,6 +3277,25 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, return 0; } +/** + * Indicates whether ASO aging is supported. + * + * @param[in] sh + * Pointer to shared device context structure. + * @param[in] attr + * Attributes of flow that includes AGE action. + * + * @return + * True when ASO aging is supported, false otherwise. + */ +static inline bool +flow_hit_aso_supported(const struct mlx5_dev_ctx_shared *sh, + const struct rte_flow_attr *attr) +{ + MLX5_ASSERT(sh && attr); + return (sh->flow_hit_aso_en && (attr->transfer || attr->group)); +} + /** * Validate count action. * @@ -3286,6 +3305,8 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, * Indicator if action is shared. * @param[in] action_flags * Holds the actions detected until now. + * @param[in] attr + * Attributes of flow that includes this action. * @param[out] error * Pointer to error structure. * @@ -3295,6 +3316,7 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, static int flow_dv_validate_action_count(struct rte_eth_dev *dev, bool shared, uint64_t action_flags, + const struct rte_flow_attr *attr, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; @@ -3306,10 +3328,10 @@ flow_dv_validate_action_count(struct rte_eth_dev *dev, bool shared, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "duplicate count actions set"); if (shared && (action_flags & MLX5_FLOW_ACTION_AGE) && - !priv->sh->flow_hit_aso_en) + !flow_hit_aso_supported(priv->sh, attr)) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "old age and shared count combination is not supported"); + "old age and indirect count combination is not supported"); #ifdef HAVE_IBV_FLOW_DEVX_COUNTERS return 0; #endif @@ -5679,7 +5701,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags, case RTE_FLOW_ACTION_TYPE_COUNT: ret = flow_dv_validate_action_count (dev, false, *action_flags | sub_action_flags, - error); + attr, error); if (ret < 0) return ret; *count = act->conf; @@ -7441,7 +7463,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, case RTE_FLOW_ACTION_TYPE_COUNT: ret = flow_dv_validate_action_count(dev, shared_count, action_flags, - error); + attr, error); if (ret < 0) return ret; action_flags |= MLX5_FLOW_ACTION_COUNT; @@ -7756,15 +7778,15 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; /* * Validate the regular AGE action (using counter) - * mutual exclusion with share counter actions. + * mutual exclusion with indirect counter actions. */ - if (!priv->sh->flow_hit_aso_en) { + if (!flow_hit_aso_supported(priv->sh, attr)) { if (shared_count) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "old age and shared count combination is not supported"); + "old age and indirect count combination is not supported"); if (sample_count) return rte_flow_error_set (error, EINVAL, @@ -13415,8 +13437,7 @@ flow_dv_translate(struct rte_eth_dev *dev, */ if (action_flags & MLX5_FLOW_ACTION_AGE) { if ((non_shared_age && count) || - !(priv->sh->flow_hit_aso_en && - (attr->group || attr->transfer))) { + !flow_hit_aso_supported(priv->sh, attr)) { /* Creates age by counters. */ cnt_act = flow_dv_prepare_counter (dev, dev_flow, @@ -17709,7 +17730,7 @@ flow_dv_action_validate(struct rte_eth_dev *dev, "Indirect age action not supported"); return flow_dv_validate_action_age(0, action, dev, err); case RTE_FLOW_ACTION_TYPE_COUNT: - return flow_dv_validate_action_count(dev, true, 0, err); + return flow_dv_validate_action_count(dev, true, 0, NULL, err); case RTE_FLOW_ACTION_TYPE_CONNTRACK: if (!priv->sh->ct_aso_en) return rte_flow_error_set(err, ENOTSUP,