All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [PATCH v3 2/3] net/bnxt: avoid invalid vnic id in set L2 Rx mask
Date: Fri, 20 Apr 2018 07:22:01 -0700	[thread overview]
Message-ID: <20180420142202.95545-3-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20180420142202.95545-1-ajit.khaparde@broadcom.com>

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 <ajit.khaparde@broadcom.com>
--
v1->v2: update commit message and commit log
v2->v3: fix commit log as suggested
---
 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)

  parent reply	other threads:[~2018-04-20 14:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20  4:08 [PATCH v2 0/3] bnxt patchset Ajit Khaparde
2018-04-20  4:08 ` [PATCH v2 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20  4:08 ` [PATCH v2 2/3] net/bnxt: fix set_rx_mask from using invalid vnic id Ajit Khaparde
2018-04-20  4:08 ` [PATCH v2 3/3] net/bnxt: fix mbuf data_off initialization Ajit Khaparde
2018-04-20 10:20 ` [PATCH v2 0/3] bnxt patchset Ferruh Yigit
2018-04-20 10:46   ` Thomas Monjalon
2018-04-20 14:21     ` [PATCH v3 " Ajit Khaparde
2018-04-20 14:22       ` [PATCH v3 1/3] net/bnxt: cache address of doorbell to subsequent access Ajit Khaparde
2018-04-20 14:22       ` Ajit Khaparde [this message]
2018-04-20 14:22       ` [PATCH v3 3/3] net/bnxt: fix mbuf data offset initialization Ajit Khaparde
2018-04-20 14:54       ` [PATCH v3 0/3] bnxt patchset Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180420142202.95545-3-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.