From patchwork Fri Jun 30 09:13:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129149 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 5B7C342D94; Fri, 30 Jun 2023 11:13:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33796406B6; Fri, 30 Jun 2023 11:13:45 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by mails.dpdk.org (Postfix) with ESMTP id 30131406B5; Fri, 30 Jun 2023 11:13:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hlRY5jJOal648Cc/hBcRk3h3LZFQLskIzXv1zLQDrOWLaOg7XPANXWAstLAQjtd47ly2FXwlAainrHTSxCe+uhs8TmzzRaCesWQouyEErUpVhpUcw7D6KZvJ2LLsEgKcxJGIJa3u/Gh8po0k562VjyfWFTGVLbYhbASjh4t2jFd5c+YTV/T9N3yG1qxHy5s/S6tfKHQXUJkghCuJiUUz+H7o7DMEzJzX2KzlZjzDuWS7UDU/fKo9seA8PVVwpkeK395nIj92NlhUsn5NmlNY0MsL/HZHRZn+bxLCekmRyHOdCX7+ZTPOZ1JVXdnW14Bfvdu/tuuSdLGPr65oI/nriA== 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=rm5sYW4JSBWGKJpmpi4VEncxHyuT+MuTieXBpbHR5N0=; b=RFqPb3MP2KaYyQBL/e6mYekp+onDH29Tam7rEYbAIFqa8oDAZKxJJVo3D0AtZy20CZDJIUHkxAxKjDuSv/2U4uBAYpEaXfHqYA932sFYrjS2rCIkmxO8efl3UDCS8sQDf/PJIXZmwC1WHfVjx2xlL/EkjWqZxq99D24y2TyPK/QivpVol4VXDgn2ucWHh+ocCavKXg2Mlcf15w/cS9ss8RtAhATUIcHllyaEUgaauFuItCPpvLb8MtDGCsanIR5wEg4/ks8WalnhRgxRZkKY4GuGXE28zEcl9jJmv3VFVYHSsbXzVj9W+8EOeDa36j9ktR3KjAYBQbNAO3kNxYssIA== 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 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=rm5sYW4JSBWGKJpmpi4VEncxHyuT+MuTieXBpbHR5N0=; b=Y1dVQCSC1z994rxreSoquEMVGtS1MjQSTTnrHbVyuUwAIYBEfub4C/js3u20x3wd8r28j8eRN78KH2lm/XEP7PGu2uB4HaXMOSCcVkZZTOACLbkdExGtfpf/Wnxs12vuiOvdwzIYD80YICAvTDd61BK3+cHDP/ydYzmKsSExPxm9CBCKVG9E/okEq9wZuNPLk+RINMKrO58vCq7yypJlQ4pRggbFyy73r4d8rfxCEeHWXlyGAjpaA9EJJrraCECYvkQ3pvGMEjxl6SwXhpvqhhIQpSa7OBlfrf7ZzwWHVbFcaDVRFkYIUikXDqgAR4LfUFHqTDW34aH/zjX/xrDKkw== Received: from MW3PR06CA0006.namprd06.prod.outlook.com (2603:10b6:303:2a::11) by PH7PR12MB5832.namprd12.prod.outlook.com (2603:10b6:510:1d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 30 Jun 2023 09:13:42 +0000 Received: from CO1NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::76) by MW3PR06CA0006.outlook.office365.com (2603:10b6:303:2a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 09:13:42 +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 CO1NAM11FT053.mail.protection.outlook.com (10.13.175.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.49 via Frontend Transport; Fri, 30 Jun 2023 09:13:41 +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.5; Fri, 30 Jun 2023 02:13:30 -0700 Received: from nvidia.com (10.126.230.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.986.37; Fri, 30 Jun 2023 02:13:28 -0700 From: Bing Zhao To: , , , , CC: , , Subject: [PATCH v2] net/mlx5: fix the error set in Tx representor tagging Date: Fri, 30 Jun 2023 12:13:14 +0300 Message-ID: <20230630091314.433902-1-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230630062847.432448-1-bingz@nvidia.com> References: <20230630062847.432448-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.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: CO1NAM11FT053:EE_|PH7PR12MB5832:EE_ X-MS-Office365-Filtering-Correlation-Id: e8750d33-9826-4248-0bc1-08db794a4c45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U5olBMnsc3fiQyWg/ykZXXqfNRBb6LyI2GsmJbuI3pZwmCr1Hd+MORM8/aYbaiKWOZRLZHnr9W4KezsX7/BCeowmWZt3PHOTMVzZnbwNd6sk8d4MeKqZxXaVbM7JI7WnX8NjtiuCbK4r9+5qi+IliixJFWbJtqXXjyxbn826MKs5SOzXc7NL9nykmhGFbbZnZO9Qk3foTnBY6IfsDVUdBteFNV5VlwHCTNX4xEctZ7B5Ao30sBWPHSrh3ni7WX20MEjSm4LKZNB1flH+PAvo5MRgu03sL8CEfyWTeVhMKD7/L0VGbRyziluHYTx5QHXdW/TN4yy+O6EpPx1gkPdU8eb+fMGe6ro7Xhd9B+3zABI+XdFqhSZbhNEPBQKyeYbfCRPcNFPqLXzGKvJgXrxcpxOQTtpiOtCKxfoGX9wpushZjIAk/j1DxMphLtDs0Ln9jbM7LrAW1NrjOw89l+yz6AxOguE+D2ibI9lyFR/QB29/w6HkKTDZLtaMFygfhm5GsVyygbpJ1mL2jIyCDwCqiiF2ZPOXhEdkYFmkZjODrFaBoxCyt0/wuTEIQR+phibc8tlc0JibX0y8tfidhRLsbtspIfr4HbX7VvcxgL6TdJhOCuAvZTeb4Dl7fDHd+Vr75jJK9hviCz9kj2CA0O0KObteYtFPFY49z80L/Oz3wRx93CbAV9GQo/yTSHZJwvvdtXomfL8ebgHqaPkWABXpTJ6w/bw0WvTiooyfN+rFulcPKR3JU956efNauTRq4c9q 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:(13230028)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(36756003)(82310400005)(36860700001)(47076005)(336012)(83380400001)(478600001)(26005)(54906003)(2616005)(6666004)(426003)(110136005)(7696005)(6286002)(186003)(2906002)(16526019)(1076003)(356005)(86362001)(316002)(5660300002)(7636003)(70206006)(82740400003)(40460700003)(40480700001)(6636002)(450100002)(70586007)(8676002)(41300700001)(4326008)(55016003)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 09:13:41.5628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8750d33-9826-4248-0bc1-08db794a4c45 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: CO1NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5832 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 In the previous implementation, the error information was not set when there was a failure during the initialization. The pointer from the user should be passed to the called functions to be set properly before returning. Fixes: 483181f7b6dd ("net/mlx5: support device control of representor matching") Cc: dsosnowski@nvidia.com Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Ori Kam --- v2: CC stable --- drivers/net/mlx5/mlx5_flow_hw.c | 44 +++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index ba2f1f7c92..6683bcbc7f 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -5961,12 +5961,14 @@ flow_hw_destroy_send_to_kernel_action(struct mlx5_priv *priv) * * @param dev * Pointer to Ethernet device. + * @param[out] error + * Pointer to error structure. * * @return * Pointer to pattern template on success. NULL otherwise, and rte_errno is set. */ static struct rte_flow_pattern_template * -flow_hw_create_tx_repr_sq_pattern_tmpl(struct rte_eth_dev *dev) +flow_hw_create_tx_repr_sq_pattern_tmpl(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct rte_flow_pattern_template_attr attr = { .relaxed_matching = 0, @@ -5985,7 +5987,7 @@ flow_hw_create_tx_repr_sq_pattern_tmpl(struct rte_eth_dev *dev) }, }; - return flow_hw_pattern_template_create(dev, &attr, items, NULL); + return flow_hw_pattern_template_create(dev, &attr, items, error); } static __rte_always_inline uint32_t @@ -6043,12 +6045,15 @@ flow_hw_update_action_mask(struct rte_flow_action *action, * * @param dev * Pointer to Ethernet device. + * @param[out] error + * Pointer to error structure. * * @return * Pointer to actions template on success. NULL otherwise, and rte_errno is set. */ static struct rte_flow_actions_template * -flow_hw_create_tx_repr_tag_jump_acts_tmpl(struct rte_eth_dev *dev) +flow_hw_create_tx_repr_tag_jump_acts_tmpl(struct rte_eth_dev *dev, + struct rte_flow_error *error) { uint32_t tag_mask = flow_hw_tx_tag_regc_mask(dev); uint32_t tag_value = flow_hw_tx_tag_regc_value(dev); @@ -6137,7 +6142,7 @@ flow_hw_create_tx_repr_tag_jump_acts_tmpl(struct rte_eth_dev *dev) NULL, NULL); idx++; MLX5_ASSERT(idx <= RTE_DIM(actions_v)); - return flow_hw_actions_template_create(dev, &attr, actions_v, actions_m, NULL); + return flow_hw_actions_template_create(dev, &attr, actions_v, actions_m, error); } static void @@ -6166,12 +6171,14 @@ flow_hw_cleanup_tx_repr_tagging(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param[out] error + * Pointer to error structure. * * @return * 0 on success, negative errno value otherwise. */ static int -flow_hw_setup_tx_repr_tagging(struct rte_eth_dev *dev) +flow_hw_setup_tx_repr_tagging(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; struct rte_flow_template_table_attr attr = { @@ -6189,20 +6196,22 @@ flow_hw_setup_tx_repr_tagging(struct rte_eth_dev *dev) MLX5_ASSERT(priv->sh->config.dv_esw_en); MLX5_ASSERT(priv->sh->config.repr_matching); - priv->hw_tx_repr_tagging_pt = flow_hw_create_tx_repr_sq_pattern_tmpl(dev); + priv->hw_tx_repr_tagging_pt = + flow_hw_create_tx_repr_sq_pattern_tmpl(dev, error); if (!priv->hw_tx_repr_tagging_pt) - goto error; - priv->hw_tx_repr_tagging_at = flow_hw_create_tx_repr_tag_jump_acts_tmpl(dev); + goto err; + priv->hw_tx_repr_tagging_at = + flow_hw_create_tx_repr_tag_jump_acts_tmpl(dev, error); if (!priv->hw_tx_repr_tagging_at) - goto error; + goto err; priv->hw_tx_repr_tagging_tbl = flow_hw_table_create(dev, &cfg, &priv->hw_tx_repr_tagging_pt, 1, &priv->hw_tx_repr_tagging_at, 1, - NULL); + error); if (!priv->hw_tx_repr_tagging_tbl) - goto error; + goto err; return 0; -error: +err: flow_hw_cleanup_tx_repr_tagging(dev); return -rte_errno; } @@ -7634,8 +7643,7 @@ flow_hw_configure(struct rte_eth_dev *dev, goto err; } - memcpy(_queue_attr, queue_attr, - sizeof(void *) * nb_queue); + memcpy(_queue_attr, queue_attr, sizeof(void *) * nb_queue); _queue_attr[nb_queue] = &ctrl_queue_attr; priv->acts_ipool = mlx5_ipool_create(&cfg); if (!priv->acts_ipool) @@ -7728,7 +7736,7 @@ flow_hw_configure(struct rte_eth_dev *dev, MLX5_ASSERT(rte_eth_dev_is_valid_port(port_attr->host_port_id)); if (is_proxy) { DRV_LOG(ERR, "cross vHCA shared mode not supported " - " for E-Switch confgiurations"); + "for E-Switch confgiurations"); rte_errno = ENOTSUP; goto err; } @@ -7815,11 +7823,9 @@ flow_hw_configure(struct rte_eth_dev *dev, goto err; } if (priv->sh->config.dv_esw_en && priv->sh->config.repr_matching) { - ret = flow_hw_setup_tx_repr_tagging(dev); - if (ret) { - rte_errno = -ret; + ret = flow_hw_setup_tx_repr_tagging(dev, error); + if (ret) goto err; - } } if (is_proxy) { ret = flow_hw_create_vport_actions(priv);