From patchwork Fri Jun 30 06:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129133 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 E0D6442D73; Fri, 30 Jun 2023 08:29:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A8C2406B5; Fri, 30 Jun 2023 08:29:28 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by mails.dpdk.org (Postfix) with ESMTP id EA6334021F for ; Fri, 30 Jun 2023 08:29:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nVH4oS9AZ7oTCBPkDCaKEbKutMChQNl18VsvH+r1mURP2/pKwSQiZdYoy2Urj284/qeBL3yTt3w5+WHS3M28ah7xebzyk9R7QWTSLOlBdb5mF8es2BAsauA6Q5gMwJ+iSBzMp3LplPslgIJVx171SPNZTUNhz9Azr7IM/wWHZ57PsDgTE5IZ23J8aw0pD5XJ6Us84ZzG/12r7YVi7qkrXZgmr2QOQKdhAx7W2mI02Z/oECLx7Y9p5hUTBTRG+D05O5dLW21YQgRtFzLAgyAQp6J2gJHXuoNX8Sqp8RYTr9t5fdBbgLV4ADRQv8qD+0ugOvVA3n40rddIp6wORtwqCg== 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=hHY4JhMM7akhduRdJ7LCVbV05V1jnRcpLOQH5VkdYDM=; b=OD+I4keWWgaOoBWFuOebd0QrMUkStopAuM3QhfoctNnK6+8gCGBRMM2NYBt2HiIeRaOkTZNkHkGO8XVwYqgA1tQsKWyYORnHKl3QNwUlzkvBRolHpPq+ckP30+RUvwgzJ4igSfeEec68nsuRgy/d9bLQbLbMccgTuByiRKmPTc25p68YcLjkT3xx9iDj7kS+wk4gfHRMX+4ZDul/F81Z4oVVBOLvVPp+LQZRIqCc7lz1QjNWD3SL/5RPAaPQeyNT9gTsXHz7j1NdyyneCGtQgA6kKfTywwQ8qfUz1Dq1mjqIE4MbZNCVFWSo28s3XeRvnFM8aW2PqcF95xjOagyDxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=hHY4JhMM7akhduRdJ7LCVbV05V1jnRcpLOQH5VkdYDM=; b=hwnNj530TTsttFpEufNVdPAgspPKy+F1nOUB+n4XWtxo+VYtbmj+nFp+Bf1zwc4tWv9m+gX1w3nSEPAzShzX11CaFkttDUZ/QYwht7ZlBr9sfkute5xZxLcQWljVbRzJwdOH7WVRrbCrjsT1YHLWVhr0ZGdyWQUREM0egawAk5KxN9WZ2e6gHDn1UOyBVNTAWHneMArxQnEQi5cjbA2/Tj6ek7I7ukxGyHoJbzPnLgAWqMMoQANc7Lwdw2JfABfdTgS0fKjw/wOyHgpnZAle9xxmZ1hzB2ILAqKoQvwujmaCD5ZGLUv8f0NS9ODbSRRUJBasbfqs+s0CZ+gYIst4zg== Received: from BN9P223CA0004.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::9) by SN7PR12MB7154.namprd12.prod.outlook.com (2603:10b6:806:2a5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Fri, 30 Jun 2023 06:29:24 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::6a) by BN9P223CA0004.outlook.office365.com (2603:10b6:408:10b::9) 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 06:29:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) 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 06:29:24 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 29 Jun 2023 23:29:09 -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; Thu, 29 Jun 2023 23:29:06 -0700 From: Bing Zhao To: , , , , CC: , Subject: [PATCH 3/7] net/mlx5: fix the error set in Tx representor tagging Date: Fri, 30 Jun 2023 09:28:47 +0300 Message-ID: <20230630062847.432448-1-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT038:EE_|SN7PR12MB7154:EE_ X-MS-Office365-Filtering-Correlation-Id: e4100f31-04f5-4c2f-9680-08db793358e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: apv13ve47u6+qm3YDNEaDocC0scnwYvZT6FFgUdbvTfMm2OWGlvfMxCqkpZl5c4u5gUSwwur+TChhuE5Lj6uqNa6MjyIFxhoemqUDx1NV9oGOAXKtJff+lU2+zdF9VzzbfcKyYweAC5nuB3mn7yr/hy7Y7jzm3EL7/RKq2Va5C/Td33+bwYjKpKgS/yZPYlBG8dN/+zIemE38r2mTZ0bYjBjNFA+4ak0WZSXjEwbSV1XxpSBNdPN1xI4m3dlUkwCnGWBpCYqi+XFw2VRaOf3FVeKyzFUaOjfQxv/clz1LlWgRRWD+lkRbiv5X/ja42d4PTqhtPBP6xKGBTXjza6mfQpmyCIr8ogp83hFtYpVetVsT+YSdhqona60nArOvnlv6xIS0g9nFo5Gvs+UPDQUtT1AcmKi61A7POQI88lzxbwsnMy8WtN7M6Wbb9ejZT8d9TFuzexPDcKaeXnK/TWL56Xptv6/zewW/2LzIKgknwP1cBJRfz0uvJ8v9ZZPkfeuEPPQ7dATYIXQooujoo+ZjCWz4WR2vIyaEOux+yJo94+nvMBXgVeDMxl/EXCX0JUD4CS86++HjCrhiIteIk40Uu4YUvA0DJWw9bkxDsEOhmG0xFZFiHOEr36Kn6jvz34GlyvzOiIpg7EZYPNRp70/4VyIH7+D9UceZrs8DG8leob22JLg3Pg2oQzIolJCLP/oK8Wgd1uwywvq7pLO6QKroYevAUEUcbR6x3AmDnqcY3ybjqSFd3UgAv7ONKXdTJ6s X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(36840700001)(40470700004)(46966006)(107886003)(5660300002)(8676002)(7696005)(8936002)(41300700001)(6286002)(186003)(2906002)(16526019)(40460700003)(2616005)(356005)(82310400005)(336012)(426003)(110136005)(36860700001)(54906003)(86362001)(478600001)(47076005)(83380400001)(40480700001)(6636002)(70206006)(316002)(70586007)(4326008)(1076003)(26005)(7636003)(82740400003)(6666004)(55016003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 06:29:24.2563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4100f31-04f5-4c2f-9680-08db793358e2 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7154 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 Signed-off-by: Bing Zhao Acked-by: Ori Kam --- 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);