From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 8605F8E7C; Fri, 20 Apr 2018 06:08:52 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 2BE9530C017; Thu, 19 Apr 2018 21:08:51 -0700 (PDT) Received: from C02VPB22HTD6.vpn.broadcom.net (unknown [10.10.117.56]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 3893BAC076E; Thu, 19 Apr 2018 21:08:50 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: stable@dpdk.org Date: Thu, 19 Apr 2018 21:08:44 -0700 Message-Id: <20180420040845.84616-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.15.1 (Apple Git-101) In-Reply-To: <20180420040845.84616-1-ajit.khaparde@broadcom.com> References: <20180420040845.84616-1-ajit.khaparde@broadcom.com> Subject: [dpdk-dev] [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Apr 2018 04:08:53 -0000 In some cases bnxt_hwrm_cfa_l2_set_rx_mask is being called before VNICs are allocated. The FW returns an error in such cases. Move bnxt_init_nic to bnxt_dev_init such that the ids are initialized to an invalid id. Prevent sending the command to the FW only with a valid vnic id. Fixes: 244bc98b0da7 ("net/bnxt: set L2 Rx mask") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde -- v1->v2: update commit message and commit log --- drivers/net/bnxt/bnxt_ethdev.c | 7 ++----- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index a133114a3..348129dad 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -395,10 +395,6 @@ static int bnxt_init_nic(struct bnxt *bp) bnxt_init_vnics(bp); bnxt_init_filters(bp); - rc = bnxt_init_chip(bp); - if (rc) - return rc; - return 0; } @@ -594,7 +590,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) } bp->dev_stopped = 0; - rc = bnxt_init_nic(bp); + rc = bnxt_init_chip(bp); if (rc) goto error; @@ -3398,6 +3394,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) goto error_free_int; bnxt_enable_int(bp); + bnxt_init_nic(bp); return 0; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 11204bf42..bc8773509 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -221,6 +221,9 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct hwrm_cfa_l2_set_rx_mask_output *resp = bp->hwrm_cmd_resp_addr; uint32_t mask = 0; + if (vnic->fw_vnic_id == INVALID_HW_RING_ID) + return rc; + HWRM_PREP(req, CFA_L2_SET_RX_MASK); req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id); -- 2.15.1 (Apple Git-101)