From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AED42A0524; Mon, 31 May 2021 09:05:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5926340E50; Mon, 31 May 2021 09:05:23 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvacalvio01.broadcom.com [192.19.229.182]) by mails.dpdk.org (Postfix) with ESMTP id 989BA40040 for ; Mon, 31 May 2021 09:05:20 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id A755422591; Mon, 31 May 2021 00:05:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com A755422591 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1622444719; bh=yMJYusSgvbpR+xQwlOL1cs6wkSSgbUXnw6yH+K7bbJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBmqMTsHIES+qGV/HooV9IXHsCfrx1yxfV4+l0iuK0LNBuKdyc5g/8xpsXXc+XGfv aPdS4EdCsdm4Ak3lWiwdv7oYvhy0UimcwMaBFFFOajWnz+o6rmp8e9fLRcj86Do9qt +djzZnm5c+gLyQ+TRrZvf/Mn+QsHfS+ODoRXmkI8= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Mon, 31 May 2021 12:56:36 +0530 Message-Id: <20210531072644.24656-2-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20210531072644.24656-1-kalesh-anakkur.purayil@broadcom.com> References: <20210531072644.24656-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-dev] [PATCH 1/9] net/bnxt: fix error message when VNIC prepare fails 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 Sender: "dev" From: Kalesh AP The bnxt_vnic_prep() can fail due to multiple reasons. But when bnxt_vnic_prep() fails, PMD is not returning the actual error/string to the application. Fix it by moving the "rte_flow_error_set" to bnxt_vnic_prep() to set the actual error code. Fixes: d24610f7bfda ("net/bnxt: allow flow creation when RSS is enabled") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde Reviewed-by: Venkat Duvvuru --- drivers/net/bnxt/bnxt_flow.c | 66 +++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 73fd24c..66012b8 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -919,32 +919,46 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, return l2_filter; } -static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic) +static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic, + const struct rte_flow_action *act, + struct rte_flow_error *error) { struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf; uint64_t rx_offloads = dev_conf->rxmode.offloads; int rc; if (bp->nr_vnics > bp->max_vnics - 1) - return -ENOMEM; + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ATTR_GROUP, + NULL, + "Group id is invalid"); rc = bnxt_vnic_grp_alloc(bp, vnic); if (rc) - goto ret; + return rte_flow_error_set(error, -rc, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Failed to alloc VNIC group"); rc = bnxt_hwrm_vnic_alloc(bp, vnic); if (rc) { - PMD_DRV_LOG(ERR, "HWRM vnic alloc failure rc: %x\n", rc); + rte_flow_error_set(error, -rc, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Failed to alloc VNIC"); goto ret; } + bp->nr_vnics++; /* RSS context is required only when there is more than one RSS ring */ if (vnic->rx_queue_cnt > 1) { rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0 /* ctx_idx 0 */); if (rc) { - PMD_DRV_LOG(ERR, - "HWRM vnic ctx alloc failure: %x\n", rc); + rte_flow_error_set(error, -rc, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Failed to alloc VNIC context"); goto ret; } } else { @@ -957,10 +971,24 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic) vnic->vlan_strip = false; rc = bnxt_hwrm_vnic_cfg(bp, vnic); - if (rc) + if (rc) { + rte_flow_error_set(error, -rc, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Failed to configure VNIC"); goto ret; + } - bnxt_hwrm_vnic_plcmode_cfg(bp, vnic); + rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic); + if (rc) { + rte_flow_error_set(error, -rc, + RTE_FLOW_ERROR_TYPE_ACTION, + act, + "Failed to configure VNIC plcmode"); + goto ret; + } + + return 0; ret: return rc; @@ -1142,16 +1170,9 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, PMD_DRV_LOG(DEBUG, "VNIC found\n"); - rc = bnxt_vnic_prep(bp, vnic); - if (rc) { - rte_flow_error_set(error, - EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, - "VNIC prep fail"); - rc = -rte_errno; + rc = bnxt_vnic_prep(bp, vnic, act, error); + if (rc) goto ret; - } PMD_DRV_LOG(DEBUG, "vnic[%d] = %p vnic->fw_grp_ids = %p\n", @@ -1362,16 +1383,9 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, vnic->end_grp_id = rss->queue[rss->queue_num - 1]; vnic->func_default = 0; //This is not a default VNIC. - rc = bnxt_vnic_prep(bp, vnic); - if (rc) { - rte_flow_error_set(error, - EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, - "VNIC prep fail"); - rc = -rte_errno; + rc = bnxt_vnic_prep(bp, vnic, act, error); + if (rc) goto ret; - } PMD_DRV_LOG(DEBUG, "vnic[%d] = %p vnic->fw_grp_ids = %p\n", -- 2.10.1