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); From patchwork Fri Jun 30 06:33:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129134 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 778EC42D73; Fri, 30 Jun 2023 08:34:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF5F2406B5; Fri, 30 Jun 2023 08:34:02 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2085.outbound.protection.outlook.com [40.107.94.85]) by mails.dpdk.org (Postfix) with ESMTP id 52E994021F for ; Fri, 30 Jun 2023 08:34:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XnyM9wU40fphCFIHV7Ly8vIjcrQPSTEmb+ELdJ6dpj1OO+s+x85gYtjnQB27LLubgSL6458RtBV4FhTo61lC4gkAh/SF3FNfGaZ+r0mlNEeuypEwyft5AXoxEXuKQGypfbeYv6p7IQG2/jP31dSBhgDyeAi4xhwNylM1rkNlwOHFSE5OdrXEt9aB17xpKvNHDhHtyV7Ge8xi0IMD8K+HrUvifvAyS8ATQzjSm3RJtjmp4et7FvZnCJmbIFDDLtDSLfrSRMsxzTws8rLtpoCbOLB/GevoHJWwBGigPXsh2JTLFmnzFkmD45cOPye8+Ae9bf4wPNpEk+ph0v/lckFaHQ== 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=pEXpg7T/zvy8TAw7gjAPrMjLCw0zJ66aLKxNpTX1IYM=; b=dWBzF6IpQDZe6hluXfdzbEpQCkupYzUStbAbWSm+ltDDkFUuAxblWAT2sU74u0Gfd+XXa/VSgQF2FeuZVpI3/d2tv1wsuuO4XlHRC6aKyiXRMdDcezW/tbyzg29JyMW6Pmb3uqcDNugN6gGN8RhS5NUi4Os8Qs0Jm3tT9MynlVZTJROng5Q1wHUYBeDag7GifPoIQNqtS8qNdGsuwphwb+GlRMy6mcvKGxdHZOdOsWVlZVgZhOy8B4cCO/8A2Zh3NzAazpr/2IUdM4Lpr/ESWfuk0aMKxYlbc0ajcoGP8c3Quw/aTmMRg+6Bl7ToqEuhXjvYxPox2YvcUbL5TWLb1A== 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=pEXpg7T/zvy8TAw7gjAPrMjLCw0zJ66aLKxNpTX1IYM=; b=XKbu/rKrsyz8qKITEinhJZyD+8ugB+lXNxb1/e2w3EpE8C8hWjlliM8dLXkLaQPZaibfz3C8Qm9cLEyGaZSeYlIZka1OYvdLvUlc2pr1Ler+1eqAAV3rScr/Nfo2SXOK6wSGysih+TDKsn+jSxSwPMoAh59aCRW3oYUu1e7HCsrdDbCpsKr2ip6XnLdJCsxZx+rqqzx4eaS/Z9tPwlQHfyTOAVUk1IdDRvucacV6d/MwOsqhKgmKWpWepSYm8dvRyKrvV58iMVWFOAJIds0H1dRsMKWnWqcNYqNQu1BdX5mkKawhx0wAydRLLO/hFsk56pSYAfZneehYkTvw5Lhfmg== Received: from MW4PR03CA0126.namprd03.prod.outlook.com (2603:10b6:303:8c::11) by BY5PR12MB5014.namprd12.prod.outlook.com (2603:10b6:a03:1c4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 06:33:59 +0000 Received: from CO1NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8c:cafe::d2) by MW4PR03CA0126.outlook.office365.com (2603:10b6:303:8c::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 06:33:59 +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 CO1NAM11FT058.mail.protection.outlook.com (10.13.174.164) 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:33:59 +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:33:47 -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:33:45 -0700 From: Bing Zhao To: , , , , CC: , Subject: [PATCH 4/7] net/mlx5: fix the return value of vport action Date: Fri, 30 Jun 2023 09:33:29 +0300 Message-ID: <20230630063329.432508-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: CO1NAM11FT058:EE_|BY5PR12MB5014:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e03f03a-c614-4468-1453-08db7933fca4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5fYjO5v2pOlg4HcZk5mBXIGE5xnBCBa08Vh6hKOUZazETHK6G7tX/ct4PPpVJPGNSkly2Gh7h/fQYuAg8SGaAwPb5xmXobD7KadQ3nBRTfcq14rfMUZZG0ETiqzestUTxzXmUP6m42Bun2TgWndxVnE8UJuw+hVwq4d6YcR3VmA4NZJE7OTk3ahyHW1J8KCiP+Zmp1I1HzxFaDP2u3nIN6077uZlYoPt1h+eb+fxlXuqvvvJvqo6eRRyNGEi7GxfZ78AfD0pFPN3jgVL7I1U1UYrQq3RRWfTa+fCiPREhLyKs3TMlo2uujY68n/fT/OZ1HWFm4PmvAMR46rUknO885pWpGThvXhCBvQM3FzRq3BmzGDBeO4NS+DoPB/o/PMOd/dV9pWu8a9JAV4hcvxIn4nxcTZZrUFgJhNX4ZjgbOXKjeJbyedgQfM4/gMODk6dQnKg1xQTy+yyiLR/0lSeB+cBT7I/fkrOe/FpKsu3CX8IiNTADSkgvLBnIMvOn0hGcVMd3roR/ziXnMCM3ss8p1fHGWTTXQ9rmS6nJOBpwHuzhIUMrh+YBK7m4DOV/Uh7ameioUkaerzd1XAYFBJqwE3DfbF0zZxjxfrxP6m8+xraMmlLioum8khpAFqJWCLazC2fLruW9dVI8qFpRbCFeUZJDh6YLkk9uH1OX5ley/UkRJadw60GeTK6lBoKpI4ZGtQnFfHIfuIjSCGiGE7s5A6tbNBNzN0/MExU2VGrGFsgf2VgU9u/lu9Eo6dbud1U 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)(39860400002)(136003)(346002)(376002)(451199021)(40470700004)(46966006)(36840700001)(40460700003)(7636003)(6286002)(4744005)(7696005)(6666004)(2906002)(82310400005)(82740400003)(47076005)(83380400001)(16526019)(107886003)(356005)(1076003)(2616005)(426003)(336012)(86362001)(40480700001)(36860700001)(55016003)(41300700001)(110136005)(54906003)(186003)(478600001)(70206006)(6636002)(36756003)(70586007)(4326008)(316002)(26005)(5660300002)(8936002)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 06:33:59.1024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e03f03a-c614-4468-1453-08db7933fca4 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: CO1NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5014 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 "rte_flow_error" should be set in case a invalid pointer access to the message member. Fixes: 1939eb6f660c ("net/mlx5: support flow port action with HWS") Cc: dsosnowski@nvidia.com Signed-off-by: Bing Zhao Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 6683bcbc7f..87584c1e94 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7830,7 +7830,8 @@ flow_hw_configure(struct rte_eth_dev *dev, if (is_proxy) { ret = flow_hw_create_vport_actions(priv); if (ret) { - rte_errno = -ret; + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, "Failed to create vport actions."); goto err; } ret = flow_hw_create_ctrl_tables(dev); From patchwork Fri Jun 30 06:36:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129135 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 95C9942D73; Fri, 30 Jun 2023 08:37:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DF4A406B5; Fri, 30 Jun 2023 08:37:12 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by mails.dpdk.org (Postfix) with ESMTP id 55E474021F for ; Fri, 30 Jun 2023 08:37:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqCQ55Ij29oUdYHdRyKvzqeGaFAmSDolj95Vtjx+Fz8kQ5lBHEfX3LfJKczTev0p4d4cO+Fs3t44g3bPCavXX2urbcxh/p+o6WFkC/0N+7JfYhyMyy3ESc3ya4E0adpHKI449ynV3s8B0ve4G9vV4bAQArG4DgqNuMX0tZMEL6Js1Trj2rn19tQ3412XsQwAaAlU8CXDAOCC+ni33gm4T/l/Q49FiE0lt2RBVFSGxB7oRd/v/u8FP3AoMTCsqgESUDh9RZFPMr5tjTx9havtdilFlQw1AIFaORNOO3xNX7Un+5ahQYM2dlP8vYn84btQs70e8hdXinKd3U9lfYlD4g== 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=WBULf1JIj0d26rysnCr/rsHEgiJl1OQNtpC8JC8gIRQ=; b=idYehmEdMJgT57gDaIfHZ+f0eNDg+pKkuixVn9aEqrk32DB35j36XWKkzRpOi1Iaib+u73QLCPqk5dPc7FS+8bPb2vg0cwfKJexm54lby2gjZnephImmlB4kc1rS8eAWxBIZrVGTej75MiJw031zzJ7fTM6GqxnCvydIDQyUBotLmWUCiGuzNAQePUjWD3GfBoL4+PZmvpyN/c9JiDmWLHAAmcEb6TcnXmVRsGRuVy7PhcwOlRPK2wslqk/+N9oQO69C3ZbCwk/t5DTU0yfr7HlZ8w0bhUinV07tLRgyTqOBbAeX62w6wSHC8vRVEldbvdIwy9OMXdUSiWxhWz8vKw== 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=WBULf1JIj0d26rysnCr/rsHEgiJl1OQNtpC8JC8gIRQ=; b=MoNBn0VeUNQ8o265eAbPLnb66XrSYUm4fY/MyZ4AI6py1arrtWyrkMOrEy90b5KF6iozNcssnG2wRAGS4dVzn8mamjpnbf0+Nr0trvgDP3MJ4Co38ptIAi9IP/Gjce4vYzEQbCAVUMpCGgw8prkqKNDLkF+wdQlE4cLz1I412fFrg8ckizhtOAXj/WYkF2jjhVSYovAKhKSpPUJmvVUUV3k0YZ4SrcdFrh6xXIJgR9vwCzLcVLyjJN9cFFaeC6DzWCL+YsYtH37uu9MF8WqjF3lQSCuN/dw5FM7yuYm/4wWISxlBro3fJkNz8c2vaiFp0LtO6KyKd9fJqBWV+j4kYA== Received: from MW4PR04CA0349.namprd04.prod.outlook.com (2603:10b6:303:8a::24) by MN0PR12MB6056.namprd12.prod.outlook.com (2603:10b6:208:3cc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Fri, 30 Jun 2023 06:37:08 +0000 Received: from CO1NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::19) by MW4PR04CA0349.outlook.office365.com (2603:10b6:303:8a::24) 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:37:08 +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 CO1NAM11FT045.mail.protection.outlook.com (10.13.175.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.50 via Frontend Transport; Fri, 30 Jun 2023 06:37:08 +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; Thu, 29 Jun 2023 23:36:58 -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:36:55 -0700 From: Bing Zhao To: , , , , CC: , Subject: [PATCH 5/7] net/mlx5: fix the error set in control tables create Date: Fri, 30 Jun 2023 09:36:37 +0300 Message-ID: <20230630063637.432552-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: CO1NAM11FT045:EE_|MN0PR12MB6056:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cd531f3-189c-48b2-5ae1-08db79346d92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k6rb3yy4z7G3ntlNaKuKef6S0ckRwO7qmNS9FDk3DhyxWQqT6uphgaDDl8P18x1ViiwRFuBugHeVJ6NqjaOBv2O7vZ+XTh+ilT34eOfFYNPpoFeDvcGLuc96AnXxYomAnOYOfyGiWLkJww3T4n32Ex9GYxq03sbuRWZslX2TfYZdH1bc/Bh4VcN3gqDzlhJtz7c2QOBXdUvqJRracyI3gBXtXpwCiYe6cuD4peSc4KaFzE/bF1S50F0ZWs6hSbkNUJEuTtFJUXknupfUZWY42lDbCxBM8KE4oTg0P8nCti7zHrcbBubLEV61L1K8UsxR03oUnNHzgz/RekjSCM/lipCgTWYpe5E3IyMMnOs5xBahXolVdGpf10xa3TbXdhvxrHcTfHzIofTS2XpulF6Xrw2Oh1xjxJcDLYANZY4ByksiccsMQxuoTI7myPygZTr3CnwvMz8htz+XKwLjZUGQj5I8V3yYdTy9K76shxG+sVpsTNKaxFqDO59tZujp/sr41D5wJJFXym8ox5wyC4QFz4LM9B6obEvOK9Jcuu/v8cN8vJk1eyw1RVPjzgA0e/f6WDF/wq/0MJuHfL9gZ73ZiZuCUGte2bHMuSzTEwiRYA2ahMVKlJNjrwI3qK/K7Q3fuB80ltYA2XguXTrDo7HUna8uT8/j1NeiuZQrSx/RqieXG2SRvjZ//kEFVfgmzquGNrPAB450dwQp4TlPtn+1EyHWMn/Nsz4qehMU3KJTkFVOQEVuypPWDy8qjpGVRVgV 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)(39860400002)(396003)(376002)(346002)(136003)(451199021)(36840700001)(40470700004)(46966006)(70206006)(30864003)(5660300002)(26005)(2906002)(186003)(1076003)(426003)(47076005)(107886003)(2616005)(16526019)(40460700003)(6286002)(8936002)(83380400001)(356005)(40480700001)(36860700001)(70586007)(41300700001)(336012)(6636002)(36756003)(55016003)(7636003)(6666004)(7696005)(82740400003)(478600001)(54906003)(8676002)(86362001)(110136005)(4326008)(82310400005)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 06:37:08.5063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cd531f3-189c-48b2-5ae1-08db79346d92 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: CO1NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6056 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 When some failure occurrs in the flow_hw_create_ctrl_tables(), the "rte_flow_error" should be set properly with all needed information. Then the rte_errno and the "message" will reflect the actual failure. This will also solve the crash when trying to access the "message". Fixes: 1939eb6f660c ("net/mlx5: support flow port action with HWS") Fixes: 483181f7b6dd ("net/mlx5: support device control of representor matching") Fixes: ddb68e47331e ("net/mlx5: add extended metadata mode for HWS") Cc: dsosnowski@nvidia.com Signed-off-by: Bing Zhao Reviewed-by: Suanming Mou Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_hw.c | 176 +++++++++++++++++++------------- 1 file changed, 106 insertions(+), 70 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 87584c1e94..4163fe23e6 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -5421,7 +5421,7 @@ flow_hw_pattern_template_create(struct rte_eth_dev *dev, struct rte_flow_pattern_template *it; struct rte_flow_item *copied_items = NULL; const struct rte_flow_item *tmpl_items; - uint64_t orig_item_nb; + uint32_t orig_item_nb; struct rte_flow_item port = { .type = RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT, .mask = &rte_flow_item_ethdev_mask, @@ -6242,12 +6242,15 @@ flow_hw_esw_mgr_regc_marker(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow pattern template on success, NULL otherwise. */ static struct rte_flow_pattern_template * -flow_hw_create_ctrl_esw_mgr_pattern_template(struct rte_eth_dev *dev) +flow_hw_create_ctrl_esw_mgr_pattern_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_pattern_template_attr attr = { .relaxed_matching = 0, @@ -6277,7 +6280,7 @@ flow_hw_create_ctrl_esw_mgr_pattern_template(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); } /** @@ -6290,12 +6293,15 @@ flow_hw_create_ctrl_esw_mgr_pattern_template(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow pattern template on success, NULL otherwise. */ static struct rte_flow_pattern_template * -flow_hw_create_ctrl_regc_sq_pattern_template(struct rte_eth_dev *dev) +flow_hw_create_ctrl_regc_sq_pattern_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_pattern_template_attr attr = { .relaxed_matching = 0, @@ -6328,7 +6334,7 @@ flow_hw_create_ctrl_regc_sq_pattern_template(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); } /** @@ -6338,12 +6344,15 @@ flow_hw_create_ctrl_regc_sq_pattern_template(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow pattern template on success, NULL otherwise. */ static struct rte_flow_pattern_template * -flow_hw_create_ctrl_port_pattern_template(struct rte_eth_dev *dev) +flow_hw_create_ctrl_port_pattern_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_pattern_template_attr attr = { .relaxed_matching = 0, @@ -6362,7 +6371,7 @@ flow_hw_create_ctrl_port_pattern_template(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); } /* @@ -6372,12 +6381,15 @@ flow_hw_create_ctrl_port_pattern_template(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow pattern template on success, NULL otherwise. */ static struct rte_flow_pattern_template * -flow_hw_create_tx_default_mreg_copy_pattern_template(struct rte_eth_dev *dev) +flow_hw_create_tx_default_mreg_copy_pattern_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_pattern_template_attr tx_pa_attr = { .relaxed_matching = 0, @@ -6398,10 +6410,8 @@ flow_hw_create_tx_default_mreg_copy_pattern_template(struct rte_eth_dev *dev) .type = RTE_FLOW_ITEM_TYPE_END, }, }; - struct rte_flow_error drop_err; - RTE_SET_USED(drop_err); - return flow_hw_pattern_template_create(dev, &tx_pa_attr, eth_all, &drop_err); + return flow_hw_pattern_template_create(dev, &tx_pa_attr, eth_all, error); } /** @@ -6412,12 +6422,15 @@ flow_hw_create_tx_default_mreg_copy_pattern_template(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow actions template on success, NULL otherwise. */ static struct rte_flow_actions_template * -flow_hw_create_ctrl_regc_jump_actions_template(struct rte_eth_dev *dev) +flow_hw_create_ctrl_regc_jump_actions_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { uint32_t marker_mask = flow_hw_esw_mgr_regc_marker_mask(dev); uint32_t marker_bits = flow_hw_esw_mgr_regc_marker(dev); @@ -6484,7 +6497,7 @@ flow_hw_create_ctrl_regc_jump_actions_template(struct rte_eth_dev *dev) set_reg_v.dst.offset = rte_bsf32(marker_mask); rte_memcpy(set_reg_v.src.value, &marker_bits, sizeof(marker_bits)); rte_memcpy(set_reg_m.src.value, &marker_mask, sizeof(marker_mask)); - 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); } /** @@ -6496,13 +6509,16 @@ flow_hw_create_ctrl_regc_jump_actions_template(struct rte_eth_dev *dev) * Pointer to Ethernet device. * @param group * Destination group for this action template. + * @param error + * Pointer to error structure. * * @return * Pointer to flow actions template on success, NULL otherwise. */ static struct rte_flow_actions_template * flow_hw_create_ctrl_jump_actions_template(struct rte_eth_dev *dev, - uint32_t group) + uint32_t group, + struct rte_flow_error *error) { struct rte_flow_actions_template_attr attr = { .transfer = 1, @@ -6532,8 +6548,8 @@ flow_hw_create_ctrl_jump_actions_template(struct rte_eth_dev *dev, } }; - 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); } /** @@ -6542,12 +6558,15 @@ flow_hw_create_ctrl_jump_actions_template(struct rte_eth_dev *dev, * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow action template on success, NULL otherwise. */ static struct rte_flow_actions_template * -flow_hw_create_ctrl_port_actions_template(struct rte_eth_dev *dev) +flow_hw_create_ctrl_port_actions_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_actions_template_attr attr = { .transfer = 1, @@ -6577,8 +6596,7 @@ flow_hw_create_ctrl_port_actions_template(struct rte_eth_dev *dev) } }; - 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); } /* @@ -6587,12 +6605,15 @@ flow_hw_create_ctrl_port_actions_template(struct rte_eth_dev *dev) * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return * Pointer to flow actions template on success, NULL otherwise. */ static struct rte_flow_actions_template * -flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev *dev) +flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev *dev, + struct rte_flow_error *error) { struct rte_flow_actions_template_attr tx_act_attr = { .egress = 1, @@ -6657,11 +6678,9 @@ flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev *dev) .type = RTE_FLOW_ACTION_TYPE_END, }, }; - struct rte_flow_error drop_err; - RTE_SET_USED(drop_err); return flow_hw_actions_template_create(dev, &tx_act_attr, actions, - masks, &drop_err); + masks, error); } /** @@ -6674,6 +6693,8 @@ flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev *dev) * Pointer to flow pattern template. * @param at * Pointer to flow actions template. + * @param error + * Pointer to error structure. * * @return * Pointer to flow table on success, NULL otherwise. @@ -6681,7 +6702,8 @@ flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev *dev) static struct rte_flow_template_table* flow_hw_create_ctrl_sq_miss_root_table(struct rte_eth_dev *dev, struct rte_flow_pattern_template *it, - struct rte_flow_actions_template *at) + struct rte_flow_actions_template *at, + struct rte_flow_error *error) { struct rte_flow_template_table_attr attr = { .flow_attr = { @@ -6698,7 +6720,7 @@ flow_hw_create_ctrl_sq_miss_root_table(struct rte_eth_dev *dev, .external = false, }; - return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, NULL); + return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, error); } @@ -6712,6 +6734,8 @@ flow_hw_create_ctrl_sq_miss_root_table(struct rte_eth_dev *dev, * Pointer to flow pattern template. * @param at * Pointer to flow actions template. + * @param error + * Pointer to error structure. * * @return * Pointer to flow table on success, NULL otherwise. @@ -6719,7 +6743,8 @@ flow_hw_create_ctrl_sq_miss_root_table(struct rte_eth_dev *dev, static struct rte_flow_template_table* flow_hw_create_ctrl_sq_miss_table(struct rte_eth_dev *dev, struct rte_flow_pattern_template *it, - struct rte_flow_actions_template *at) + struct rte_flow_actions_template *at, + struct rte_flow_error *error) { struct rte_flow_template_table_attr attr = { .flow_attr = { @@ -6736,7 +6761,7 @@ flow_hw_create_ctrl_sq_miss_table(struct rte_eth_dev *dev, .external = false, }; - return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, NULL); + return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, error); } /* @@ -6748,6 +6773,8 @@ flow_hw_create_ctrl_sq_miss_table(struct rte_eth_dev *dev, * Pointer to flow pattern template. * @param at * Pointer to flow actions template. + * @param error + * Pointer to error structure. * * @return * Pointer to flow table on success, NULL otherwise. @@ -6755,7 +6782,8 @@ flow_hw_create_ctrl_sq_miss_table(struct rte_eth_dev *dev, static struct rte_flow_template_table* flow_hw_create_tx_default_mreg_copy_table(struct rte_eth_dev *dev, struct rte_flow_pattern_template *pt, - struct rte_flow_actions_template *at) + struct rte_flow_actions_template *at, + struct rte_flow_error *error) { struct rte_flow_template_table_attr tx_tbl_attr = { .flow_attr = { @@ -6769,14 +6797,8 @@ flow_hw_create_tx_default_mreg_copy_table(struct rte_eth_dev *dev, .attr = tx_tbl_attr, .external = false, }; - struct rte_flow_error drop_err = { - .type = RTE_FLOW_ERROR_TYPE_NONE, - .cause = NULL, - .message = NULL, - }; - RTE_SET_USED(drop_err); - return flow_hw_table_create(dev, &tx_tbl_cfg, &pt, 1, &at, 1, &drop_err); + return flow_hw_table_create(dev, &tx_tbl_cfg, &pt, 1, &at, 1, error); } /** @@ -6789,6 +6811,8 @@ flow_hw_create_tx_default_mreg_copy_table(struct rte_eth_dev *dev, * Pointer to flow pattern template. * @param at * Pointer to flow actions template. + * @param error + * Pointer to error structure. * * @return * Pointer to flow table on success, NULL otherwise. @@ -6796,7 +6820,8 @@ flow_hw_create_tx_default_mreg_copy_table(struct rte_eth_dev *dev, static struct rte_flow_template_table * flow_hw_create_ctrl_jump_table(struct rte_eth_dev *dev, struct rte_flow_pattern_template *it, - struct rte_flow_actions_template *at) + struct rte_flow_actions_template *at, + struct rte_flow_error *error) { struct rte_flow_template_table_attr attr = { .flow_attr = { @@ -6813,7 +6838,7 @@ flow_hw_create_ctrl_jump_table(struct rte_eth_dev *dev, .external = false, }; - return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, NULL); + return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, error); } /** @@ -6822,12 +6847,14 @@ flow_hw_create_ctrl_jump_table(struct rte_eth_dev *dev, * * @param dev * Pointer to Ethernet device. + * @param error + * Pointer to error structure. * * @return - * 0 on success, EINVAL otherwise + * 0 on success, negative values otherwise */ static __rte_unused int -flow_hw_create_ctrl_tables(struct rte_eth_dev *dev) +flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; struct rte_flow_pattern_template *esw_mgr_items_tmpl = NULL; @@ -6840,96 +6867,107 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev) struct rte_flow_actions_template *tx_meta_actions_tmpl = NULL; uint32_t xmeta = priv->sh->config.dv_xmeta_en; uint32_t repr_matching = priv->sh->config.repr_matching; + int ret; /* Create templates and table for default SQ miss flow rules - root table. */ - esw_mgr_items_tmpl = flow_hw_create_ctrl_esw_mgr_pattern_template(dev); + esw_mgr_items_tmpl = flow_hw_create_ctrl_esw_mgr_pattern_template(dev, error); if (!esw_mgr_items_tmpl) { DRV_LOG(ERR, "port %u failed to create E-Switch Manager item" " template for control flows", dev->data->port_id); - goto error; + goto err; } - regc_jump_actions_tmpl = flow_hw_create_ctrl_regc_jump_actions_template(dev); + regc_jump_actions_tmpl = flow_hw_create_ctrl_regc_jump_actions_template(dev, error); if (!regc_jump_actions_tmpl) { DRV_LOG(ERR, "port %u failed to create REG_C set and jump action template" " for control flows", dev->data->port_id); - goto error; + goto err; } MLX5_ASSERT(priv->hw_esw_sq_miss_root_tbl == NULL); priv->hw_esw_sq_miss_root_tbl = flow_hw_create_ctrl_sq_miss_root_table - (dev, esw_mgr_items_tmpl, regc_jump_actions_tmpl); + (dev, esw_mgr_items_tmpl, regc_jump_actions_tmpl, error); if (!priv->hw_esw_sq_miss_root_tbl) { DRV_LOG(ERR, "port %u failed to create table for default sq miss (root table)" " for control flows", dev->data->port_id); - goto error; + goto err; } /* Create templates and table for default SQ miss flow rules - non-root table. */ - regc_sq_items_tmpl = flow_hw_create_ctrl_regc_sq_pattern_template(dev); + regc_sq_items_tmpl = flow_hw_create_ctrl_regc_sq_pattern_template(dev, error); if (!regc_sq_items_tmpl) { DRV_LOG(ERR, "port %u failed to create SQ item template for" " control flows", dev->data->port_id); - goto error; + goto err; } - port_actions_tmpl = flow_hw_create_ctrl_port_actions_template(dev); + port_actions_tmpl = flow_hw_create_ctrl_port_actions_template(dev, error); if (!port_actions_tmpl) { DRV_LOG(ERR, "port %u failed to create port action template" " for control flows", dev->data->port_id); - goto error; + goto err; } MLX5_ASSERT(priv->hw_esw_sq_miss_tbl == NULL); priv->hw_esw_sq_miss_tbl = flow_hw_create_ctrl_sq_miss_table(dev, regc_sq_items_tmpl, - port_actions_tmpl); + port_actions_tmpl, error); if (!priv->hw_esw_sq_miss_tbl) { DRV_LOG(ERR, "port %u failed to create table for default sq miss (non-root table)" " for control flows", dev->data->port_id); - goto error; + goto err; } /* Create templates and table for default FDB jump flow rules. */ - port_items_tmpl = flow_hw_create_ctrl_port_pattern_template(dev); + port_items_tmpl = flow_hw_create_ctrl_port_pattern_template(dev, error); if (!port_items_tmpl) { DRV_LOG(ERR, "port %u failed to create SQ item template for" " control flows", dev->data->port_id); - goto error; + goto err; } jump_one_actions_tmpl = flow_hw_create_ctrl_jump_actions_template - (dev, MLX5_HW_LOWEST_USABLE_GROUP); + (dev, MLX5_HW_LOWEST_USABLE_GROUP, error); if (!jump_one_actions_tmpl) { DRV_LOG(ERR, "port %u failed to create jump action template" " for control flows", dev->data->port_id); - goto error; + goto err; } MLX5_ASSERT(priv->hw_esw_zero_tbl == NULL); priv->hw_esw_zero_tbl = flow_hw_create_ctrl_jump_table(dev, port_items_tmpl, - jump_one_actions_tmpl); + jump_one_actions_tmpl, + error); if (!priv->hw_esw_zero_tbl) { DRV_LOG(ERR, "port %u failed to create table for default jump to group 1" " for control flows", dev->data->port_id); - goto error; + goto err; } /* Create templates and table for default Tx metadata copy flow rule. */ if (!repr_matching && xmeta == MLX5_XMETA_MODE_META32_HWS) { - tx_meta_items_tmpl = flow_hw_create_tx_default_mreg_copy_pattern_template(dev); + tx_meta_items_tmpl = + flow_hw_create_tx_default_mreg_copy_pattern_template(dev, error); if (!tx_meta_items_tmpl) { DRV_LOG(ERR, "port %u failed to Tx metadata copy pattern" " template for control flows", dev->data->port_id); - goto error; + goto err; } - tx_meta_actions_tmpl = flow_hw_create_tx_default_mreg_copy_actions_template(dev); + tx_meta_actions_tmpl = + flow_hw_create_tx_default_mreg_copy_actions_template(dev, error); if (!tx_meta_actions_tmpl) { DRV_LOG(ERR, "port %u failed to Tx metadata copy actions" " template for control flows", dev->data->port_id); - goto error; + goto err; } MLX5_ASSERT(priv->hw_tx_meta_cpy_tbl == NULL); - priv->hw_tx_meta_cpy_tbl = flow_hw_create_tx_default_mreg_copy_table(dev, - tx_meta_items_tmpl, tx_meta_actions_tmpl); + priv->hw_tx_meta_cpy_tbl = + flow_hw_create_tx_default_mreg_copy_table(dev, tx_meta_items_tmpl, + tx_meta_actions_tmpl, error); if (!priv->hw_tx_meta_cpy_tbl) { DRV_LOG(ERR, "port %u failed to create table for default" " Tx metadata copy flow rule", dev->data->port_id); - goto error; + goto err; } } return 0; -error: +err: + /* Do not overwrite the rte_errno. */ + ret = -rte_errno; + if (ret == 0) + ret = rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "Failed to create control tables."); if (priv->hw_esw_zero_tbl) { flow_hw_table_destroy(dev, priv->hw_esw_zero_tbl, NULL); priv->hw_esw_zero_tbl = NULL; @@ -6958,7 +6996,7 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev) flow_hw_pattern_template_destroy(dev, regc_sq_items_tmpl, NULL); if (esw_mgr_items_tmpl) flow_hw_pattern_template_destroy(dev, esw_mgr_items_tmpl, NULL); - return -EINVAL; + return ret; } static void @@ -7834,11 +7872,9 @@ flow_hw_configure(struct rte_eth_dev *dev, NULL, "Failed to create vport actions."); goto err; } - ret = flow_hw_create_ctrl_tables(dev); - if (ret) { - rte_errno = -ret; + ret = flow_hw_create_ctrl_tables(dev, error); + if (ret) goto err; - } } if (!priv->shared_host) flow_hw_create_send_to_kernel_actions(priv); From patchwork Fri Jun 30 06:38:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129136 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 DD7C142D73; Fri, 30 Jun 2023 08:38:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBCF6406B5; Fri, 30 Jun 2023 08:38:49 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2064.outbound.protection.outlook.com [40.107.102.64]) by mails.dpdk.org (Postfix) with ESMTP id AD2504021F for ; Fri, 30 Jun 2023 08:38:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxEd4XuRCHuzlP+h4g1XMEMagfeDCJNGhGVKvTV2A2Xpz4topB175Jd7h8c7EbSah6Mo72tQRZB2Ao4jor7bE6cnIe0LM5LwD7FLijLfr25lJaBSz3/H+gVGff0XFue42gZXtdU2fky35pAIroMQwR3CNjZ8wn3wvBPNPX51seGz+W8c0Ie2uvy0VQNLdau424gxkoRDMqZ60rUE0wfZcEWeyrt4tsqj9gm6fprXE9uQLkXnUI/L5n+6yd1dAO2NjvjpWqQaKW/HPqrAceEyA2rNUFkwdzeoH0wv4DvgyODIsY1ar6li+wrpwX2OQhJfqrXWZiKTZwRgnxSe7HAE9A== 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=0essLS/eb9YKqz/61teiVHT+bzJpS5vhYSx+ycF+eg4=; b=LMM7PHd9Cf8UYboi1j8VoQKK2h7xDNYt5Ro/HTE8asASbHR/JcMHa5lXsX8r+A+8g9guT7lUg9Vbyt+2VLT/HBg5Kj4LsIMU353iiRZzoz8zQcmWfUInPNq2X5z5UovxdJRISwpNjvIKuyOrgMFJSNzusrUJwkSICh7GXRw64hCgCjD8hmF84yBTMJDAKw8RKoQbWm2iIQ6bYt3z3HBLzPkrcfqG/yEFoVVawbJQbMap1+CNNsTavlelU7aJn81J8EYaDxgqRI0TYiKKFQ9lS+ifDUfokSUllE8xLkH4raQ/BFh8+J2EloqprwL8q0iVDuZs7oZBKIxAI6L/E70l0Q== 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=0essLS/eb9YKqz/61teiVHT+bzJpS5vhYSx+ycF+eg4=; b=HO+4DTIPWvdbFWXWLtXqsNTywPOagMfUiTdJlsfHX7GufVVpHYV7aMEMuyhUxdWZgO40ccjLto3ouA5wpJlNepucwTeDS030QsbtYgjnJic76oR/Ts9j8G+Wl+yAFAwdQU1kMI5Aow+3F5zN0Q9HIbc3goxkmeLZztmFp6S7fX4cx91vrT5GijQWc21ceFvfmhcGMi3HlmFZaKIOp6O/DcCN8YUVUyZ/QwfFx9I4Fe7ZYKJ3wSehn/mHc2khtQ4LqrRGltYewCqrjKfSAUGkMVRgsVwPCkRI//7Brs7Qvkf2Sz7u/DMcWfnCdGoE0nyPlYZL4JiqcENvribK0qj89A== Received: from MW4PR04CA0177.namprd04.prod.outlook.com (2603:10b6:303:85::32) 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:38:47 +0000 Received: from CO1NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::7) by MW4PR04CA0177.outlook.office365.com (2603:10b6:303:85::32) 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:38:46 +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 CO1NAM11FT110.mail.protection.outlook.com (10.13.175.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.47 via Frontend Transport; Fri, 30 Jun 2023 06:38:46 +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:38:36 -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:38:33 -0700 From: Bing Zhao To: , , , , CC: , Subject: [PATCH 6/7] net/mlx5: fix the error set for age pool initialization Date: Fri, 30 Jun 2023 09:38:20 +0300 Message-ID: <20230630063820.432593-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: CO1NAM11FT110:EE_|SN7PR12MB7154:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ee8dee8-d7c1-45cc-f788-08db7934a7f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Mkdsebas22uRmIsfKoFw4o8NLfPVVAwLP+dzQr3r6B9K85tiwvVLnTbibXdYDDRv6KJVT8Un1gTs/O3lN20Ysjamw4yEDXjfcmUYbp18axGls3SpS7XfYIswF4dBiOUsnG1KZIB6nheQ2MoPW7gwNbNZYkhesN2AV+xCSaYBAO8AGdTfSMgCHHkpC3gTYwESugKxfofGBUx19KmLDM6AY58TppGvTKL/BB62U8+qez2Ut/UvYgg7wsE1XLrr6VECm05orehG5rIOZRjFFL3zsCaz3pjHEl1gxusdwYwE/5FMdu6Jy2RCBkr5pv7jNKl0/B7L1U2wAWUe1TsmK3ILtQxsDRggZb5ztYUVqEZ/qdsdJI6CGKGeXW5CDZjhTPxQ9g57xI5K745qWCA0m0IqH85pTC8KWGERJN0i+BBgSYRfrbMxeYc98ZStUHzrzPF4p9OkU+RmzvpuWNeF+oMxeR3Bhm28VddSH8YEd42/itCCPzoImZF15fn9WTaIZrogdXlNlaqK2GGp7JpH2Kt5vOzh8WmHFngUQz01Z0wRMCgZHV6trjWlF3VhZKybnIUyk7NBOHgPRvjj+5Locz6J5VGdlSDp7NH4TkyaiYgJec6M1SpXIOAFJGsCztERuHZGb6+8o12PnmU0SXeOJWTUAr2cOkRBTBRJzTVM/J5+f0KIFAzkhFBufu/4VgxCNyCIfvGd3rVu/2edyDk1I0W+P/PaUvCxdI2fGwap1XM91zFXVo0tmr9oJ+SwE6YHjvR 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)(4744005)(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:38:46.5032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ee8dee8-d7c1-45cc-f788-08db7934a7f1 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: CO1NAM11FT110.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 The rte_flow_error needs to be set when the age pool initialization has a failure. Or else the application will crash due to the access of the invalid "message" field. Fixes: 04a4de756e14 ("net/mlx5: support flow age action with HWS") Cc: michaelba@nvidia.com Signed-off-by: Bing Zhao Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_hw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 4163fe23e6..20941b4fc7 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7913,8 +7913,11 @@ flow_hw_configure(struct rte_eth_dev *dev, goto err; } ret = mlx5_hws_age_pool_init(dev, port_attr, nb_queue); - if (ret < 0) + if (ret < 0) { + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, "Failed to init age pool."); goto err; + } } ret = flow_hw_create_vlan(dev); if (ret) From patchwork Fri Jun 30 06:39:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 129137 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 3460E42D73; Fri, 30 Jun 2023 08:40:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22EA941133; Fri, 30 Jun 2023 08:40:25 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2075.outbound.protection.outlook.com [40.107.96.75]) by mails.dpdk.org (Postfix) with ESMTP id 8C913406B5 for ; Fri, 30 Jun 2023 08:40:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k95+h6igt0tvllBFM9/xtsSkpP7CIMkbqkUdhChDtq9oS5CpTiCk56TVpbXAfBFsx4oUI7HBgntIE04ECfZb1uLP01dc7yZBhqd4IwxqL/O0dinilKL1xKkm55rMJMBdAWw3fa3W/TdjuGvY2RU7VWuW0N3tQjuFhgkxbj5CQtbgKVlJo7m9ukBOaotBvtZFpFW2CBRqh18OH3hmJld/9lZWkZd1R3fmDzL7rZZeUUHHI/Intege8l3t8xdX3fvQ1yV0OHcjExAcQv5qcM7LKXGC73raGt/Uirlwm3LCayYOHSRWgCXn9c5prY5E3QUT9lKwS9BnjGSU9xcwGj0lIg== 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=7NZpJgbXKq/CpFiTFS6hvCUJvPh5vMTmbcoPaNznyMs=; b=WTf9kiwsYcK2Ub8GcyWqjH1qmHSk2H2n5OdO6WnJKyR/agE3S+otPRyC7041CFp9llNqOCmhduP0C+GY0qk1+Gm0ypAhVI8fsGRUAhyHdXeVnKDWfBnd+IkbVjxYaUrjOyd6LCzpBYWu6sbxn8KiL5yXSOgwVVJTIw6LwNzYMOweU4Jk6YAUbJfRoCju6hAYgoc8+gOsOTpQZDP8OfdlRm0Pe+mpk5N9EtEQ7CXKuT1myOttuH84NriJAGfVdokKRPhpnIhOCitR0iqhP5Suz/1spJ8MXHx11mPsKlbh4PbJH6rfG6wuvUPFzTvWSzj6YUKSOLoly9yIWXuEiBwjZQ== 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=7NZpJgbXKq/CpFiTFS6hvCUJvPh5vMTmbcoPaNznyMs=; b=oHEHDrJdhEf0tmbMHPHBCCcaB7W/Tiz7oGhvKBhIwMKzMmXUje55xFhyQiwvh/60Lmlt2lAb+4lhWRzWK9CbeJfPaL3WiqypeWS56O/1EygQPGmnbS4rXkbDUG73bHahWPo6+H5Vb04SxiMVNS9RFZsDTSjxyH+uuEjviTzudD6Hixrw8AbReFApHKgHO4g3jrwdng9CKUIrGbEXKMVZ4gLoQE0K+VvkR5QiHrotFUNQs6hMRYbCo3fj4uwFsmzCRFJ77oYCinjEFDGICwFjq6nM+CgkgGrWojB64peYfckWpu1/CcGzTh33gH+ph9vIfMzi3o35RA35lWJ9578Yeg== Received: from MW4P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::28) by MW6PR12MB7069.namprd12.prod.outlook.com (2603:10b6:303:238::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 06:40:21 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::3c) by MW4P220CA0023.outlook.office365.com (2603:10b6:303:115::28) 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:40:21 +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 CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.43 via Frontend Transport; Fri, 30 Jun 2023 06:40:19 +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; Thu, 29 Jun 2023 23:40:06 -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:40:04 -0700 From: Bing Zhao To: , , , , CC: , Subject: [PATCH 7/7] net/mlx5: fix the error in VLAN actions creation Date: Fri, 30 Jun 2023 09:39:50 +0300 Message-ID: <20230630063950.432641-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: CO1NAM11FT032:EE_|MW6PR12MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 8588115b-9794-407e-b551-08db7934df3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pyRG4PrlXTYnIZHwM99WzBBhbqQE8612QTBZs1smNJBdWIW2gCo0M5biTk+AOdJHXnjyCii6uwS1ITrFsR3X9tdoNrRl7qA30jzeYzPig98abdASuv9E2WzNgU8PL+L0PIZ8WheOxxeIccitRgXQkrmxJr66YBrEWdoKPkqrovvd7NppRKKF2Le5PvacZ9yxPymI76gamKiwD/92itjtuXqNiu4Jg+woa4CxdXfM9v7RIgoPWnQjEljAf8Erc7PDDIGNSmYKaE/8ASJvy8yHs7qsX/107pyIn3yaoqM2W/gv3khl16BOuiRgdzLk6HFf2Vb9Uzowug+QPT1O5X+UNjNvoNg4FoF02OgRgg1NxyKQTU5yQDPwxWDp54PdXuOboEmtTh0IKZXqVVFP+yuXoU0TGGYiC5kndKxSYtqR5+jJP1tOD6gy7jJdLwq9RYvCUVBogIzwwFieoCO2to9WKK8tgCcAMrBgXtfyUsIKVQCYYFJnqBAGeTmNdEo5xSQ8FlVJAAR/biIBIiio+GJ4fYV12P7odp5L85a7Mn9NebjKSErSAz6+YpqLzjAdt6GXPuha81EeLCuGUZjtCSK50ETuwR5n6+rl/pfBO0oHW8deGrPpEhv+WbppReISpTISVDnSeygIZD55ZRnluu293OeyIJLGldt+Ip18P7nkIxythvuATfRdlWrEZqJhS7GNL9reLtSW91ZLB4RbYyZlz8GNRgndwdrANenTn1v4jbkGJDpSo/PYYBsch6Re+INQ 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)(396003)(39860400002)(376002)(346002)(136003)(451199021)(46966006)(36840700001)(40470700004)(40460700003)(41300700001)(316002)(83380400001)(82310400005)(426003)(36860700001)(86362001)(336012)(16526019)(6286002)(186003)(1076003)(26005)(2616005)(2906002)(82740400003)(7636003)(356005)(40480700001)(55016003)(47076005)(5660300002)(36756003)(8676002)(8936002)(107886003)(478600001)(110136005)(54906003)(70206006)(70586007)(6636002)(4326008)(6666004)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 06:40:19.1987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8588115b-9794-407e-b551-08db7934df3b 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: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7069 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 When a failure occurs during the VLAN actions creating, the value of "rte_errno" is already set by the mlx5dr_action_create*. The value can be returned directly to reflect the actual reason. In the meanwhile, the "rte_flow_error" structure should also be set with explict message. Fixes: 773ca0e91ba1 ("net/mlx5: support VLAN push/pop/modify with HWS") Cc: getelson@nvidia.com Signed-off-by: Bing Zhao Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 20941b4fc7..36a7f0989c 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7125,27 +7125,28 @@ flow_hw_create_vlan(struct rte_eth_dev *dev) MLX5DR_ACTION_FLAG_HWS_FDB }; + /* rte_errno is set in the mlx5dr_action* functions. */ for (i = MLX5DR_TABLE_TYPE_NIC_RX; i <= MLX5DR_TABLE_TYPE_NIC_TX; i++) { priv->hw_pop_vlan[i] = mlx5dr_action_create_pop_vlan(priv->dr_ctx, flags[i]); if (!priv->hw_pop_vlan[i]) - return -ENOENT; + return -rte_errno; priv->hw_push_vlan[i] = mlx5dr_action_create_push_vlan(priv->dr_ctx, flags[i]); if (!priv->hw_pop_vlan[i]) - return -ENOENT; + return -rte_errno; } if (priv->sh->config.dv_esw_en && priv->master) { priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB] = mlx5dr_action_create_pop_vlan (priv->dr_ctx, MLX5DR_ACTION_FLAG_HWS_FDB); if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB]) - return -ENOENT; + return -rte_errno; priv->hw_push_vlan[MLX5DR_TABLE_TYPE_FDB] = mlx5dr_action_create_push_vlan (priv->dr_ctx, MLX5DR_ACTION_FLAG_HWS_FDB); if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB]) - return -ENOENT; + return -rte_errno; } return 0; } @@ -7920,8 +7921,11 @@ flow_hw_configure(struct rte_eth_dev *dev, } } ret = flow_hw_create_vlan(dev); - if (ret) + if (ret) { + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, "Failed to VLAN actions."); goto err; + } if (_queue_attr) mlx5_free(_queue_attr); if (port_attr->flags & RTE_FLOW_PORT_FLAG_STRICT_QUEUE)