[6/9] net/bnxt: fix vlan add when port is stopped

Message ID 20200421091257.8089-7-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt patchset with fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Kalesh A P April 21, 2020, 9:12 a.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver destroys the vnic when the port is brought down.
When user tries to add a vlan when port is stopped, driver
issues HWRM command to FW with invalid vnic_id and it fails.

Fixed to return an error while setting vlan when port is
not started.

Fixes: b4e190d55c25 ("net/bnxt: fix MAC/VLAN filter allocation")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 206111d..589190b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2082,6 +2082,11 @@  static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (!eth_dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be started before setting vlan\n");
+		return -EINVAL;
+	}
+
 	/* These operations apply to ALL existing MAC/VLAN filters */
 	if (on)
 		return bnxt_add_vlan_filter(bp, vlan_id);