DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/8] net/bnxt: fix vnic cleanup
Date: Wed, 19 Jul 2017 23:48:21 -0500	[thread overview]
Message-ID: <20170720044826.44103-5-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170720044826.44103-1-ajit.khaparde@broadcom.com>

Check if the vnic_id and rss_rule is not invalid before passing it
to the firmware to cleanup the VNIC. Log a message if the vnic_id
is invalid.

Fixes: db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3583ec7..2c66092 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -980,6 +980,7 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	HWRM_CHECK_RESULT;
 
 	vnic->fw_vnic_id = rte_le_to_cpu_16(resp->vnic_id);
+	RTE_LOG(DEBUG, PMD, "VNIC ID %x\n", vnic->fw_vnic_id);
 	return rc;
 }
 
@@ -1045,6 +1046,11 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	uint32_t ctx_enable_flag = HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE;
 	struct bnxt_plcmodes_cfg pmodes;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		RTE_LOG(DEBUG, PMD, "VNIC ID %x\n", vnic->fw_vnic_id);
+		return rc;
+	}
+
 	rc = bnxt_hwrm_vnic_plcmodes_qcfg(bp, vnic, &pmodes);
 	if (rc)
 		return rc;
@@ -1103,6 +1109,10 @@ int bnxt_hwrm_vnic_qcfg(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 	struct hwrm_vnic_qcfg_input req = {.req_type = 0 };
 	struct hwrm_vnic_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		RTE_LOG(DEBUG, PMD, "VNIC QCFG ID %d\n", vnic->fw_vnic_id);
+		return rc;
+	}
 	HWRM_PREP(req, VNIC_QCFG, -1, resp);
 
 	req.enables =
@@ -1149,6 +1159,7 @@ int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	HWRM_CHECK_RESULT;
 
 	vnic->rss_rule = rte_le_to_cpu_16(resp->rss_cos_lb_ctx_id);
+	RTE_LOG(DEBUG, PMD, "VNIC RSS Rule %x\n", vnic->rss_rule);
 
 	return rc;
 }
@@ -1160,6 +1171,10 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	struct hwrm_vnic_rss_cos_lb_ctx_free_output *resp =
 						bp->hwrm_cmd_resp_addr;
 
+	if (vnic->rss_rule == 0xffff) {
+		RTE_LOG(DEBUG, PMD, "VNIC RSS Rule %x\n", vnic->rss_rule);
+		return rc;
+	}
 	HWRM_PREP(req, VNIC_RSS_COS_LB_CTX_FREE, -1, resp);
 
 	req.rss_cos_lb_ctx_id = rte_cpu_to_le_16(vnic->rss_rule);
@@ -1179,8 +1194,10 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	struct hwrm_vnic_free_input req = {.req_type = 0 };
 	struct hwrm_vnic_free_output *resp = bp->hwrm_cmd_resp_addr;
 
-	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		RTE_LOG(DEBUG, PMD, "VNIC FREE ID %x\n", vnic->fw_vnic_id);
 		return rc;
+	}
 
 	HWRM_PREP(req, VNIC_FREE, -1, resp);
 
-- 
2.10.1 (Apple Git-78)

  parent reply	other threads:[~2017-07-20  4:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20  4:48 [dpdk-dev] [PATCH 0/8] bnxt patchset Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 1/8] net/bnxt: fix log levels for non error conditions Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 2/8] net/bnxt: fix to avoid a segfault Ajit Khaparde
2017-07-20  9:56   ` Ferruh Yigit
2017-07-20  4:48 ` Ajit Khaparde [this message]
2017-07-20  4:48 ` [dpdk-dev] [PATCH 4/8] net/bnxt: fix set link config Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 5/8] net/bnxt: reset VF stats during initialization Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 6/8] net/bnxt: fix VLAN antispoof configuration code Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 7/8] net/bnxt: check invalid l2_filter_id Ajit Khaparde
2017-07-20  4:48 ` [dpdk-dev] [PATCH 8/8] net/bnxt: fix to free a filter before reusing it Ajit Khaparde
2017-07-20 10:02 ` [dpdk-dev] [PATCH 0/8] bnxt patchset Ferruh Yigit
2017-07-21  3:22   ` [dpdk-dev] [PATCH v2 " Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 1/8] net/bnxt: fix log levels for non error conditions Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 2/8] net/bnxt: fix to avoid a segfault Ajit Khaparde
2017-07-21 19:09       ` Stephen Hurd
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 3/8] net/bnxt: fix vnic cleanup Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 4/8] net/bnxt: fix set link config Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 5/8] net/bnxt: reset VF stats during initialization Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 6/8] net/bnxt: fix VLAN antispoof configuration code Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 7/8] net/bnxt: check invalid l2_filter_id Ajit Khaparde
2017-07-21  3:22     ` [dpdk-dev] [PATCH v2 8/8] net/bnxt: fix to free a filter before reusing it Ajit Khaparde
2017-07-21  9:31     ` [dpdk-dev] [PATCH v2 0/8] 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=20170720044826.44103-5-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).