* [dpdk-stable] [PATCH 19.11 1/3] net/bnxt: fix return code handling in VLAN config
2020-02-28 8:13 [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Kalesh A P
@ 2020-02-28 8:13 ` Kalesh A P
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 2/3] net/bnxt: handle HW filter setting when port is stopped Kalesh A P
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2020-02-28 8:13 UTC (permalink / raw)
To: stable; +Cc: luca.boccassi, ajit.khaparde
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
[ upstream commit 74f96ffdc1cfbff3464f87f9e6b280e52da794e2 ]
return value stored in "ret" but it has been overwritten before use.
Coverity issue: 353621
Fixes: 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f3107b6..e6515ff 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1924,9 +1924,15 @@ bnxt_config_vlan_hw_stripping(struct bnxt *bp, uint64_t rx_offloads)
if (bp->eth_dev->data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_VLAN_FILTER) {
rc = bnxt_add_vlan_filter(bp, 0);
- bnxt_restore_vlan_filters(bp);
+ if (rc)
+ return rc;
+ rc = bnxt_restore_vlan_filters(bp);
+ if (rc)
+ return rc;
} else {
rc = bnxt_add_mac_filter(bp, vnic, NULL, 0, 0);
+ if (rc)
+ return rc;
}
rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
@@ -3930,10 +3936,16 @@ static int bnxt_restore_filters(struct bnxt *bp)
struct rte_eth_dev *dev = bp->eth_dev;
int ret = 0;
- if (dev->data->all_multicast)
+ if (dev->data->all_multicast) {
ret = bnxt_allmulticast_enable_op(dev);
- if (dev->data->promiscuous)
+ if (ret)
+ return ret;
+ }
+ if (dev->data->promiscuous) {
ret = bnxt_promiscuous_enable_op(dev);
+ if (ret)
+ return ret;
+ }
ret = bnxt_restore_mac_filters(bp);
if (ret)
--
2.10.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-stable] [PATCH 19.11 2/3] net/bnxt: handle HW filter setting when port is stopped
2020-02-28 8:13 [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Kalesh A P
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 1/3] net/bnxt: fix return code handling in VLAN config Kalesh A P
@ 2020-02-28 8:13 ` Kalesh A P
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 3/3] net/bnxt: remove a redundant variable Kalesh A P
2020-02-28 11:12 ` [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Luca Boccassi
3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2020-02-28 8:13 UTC (permalink / raw)
To: stable; +Cc: luca.boccassi, ajit.khaparde
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
[ upstream commit 1c25103326f9e94c9adade33da09ac772a1e59a2 ]
Driver destroy the VNIC when the port is brought down.
Port HW filter setting such as promiscuos, allmulti and
VLAN filtering will be applied when port is started.
Fixed to return success silently for these callbacks
when port is stopped. Also fixed to clear "bp->dev_stopped"
before invoking bnxt_vlan_offload_set_op() in bnxt_dev_start_op().
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e6515ff..c21a05a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -862,6 +862,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev);
bnxt_link_update(eth_dev, 1, ETH_LINK_UP);
+ bp->dev_stopped = 0;
if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
vlan_mask |= ETH_VLAN_FILTER_MASK;
@@ -875,7 +876,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
eth_dev->data->dev_started = 1;
- bp->dev_stopped = 0;
pthread_mutex_lock(&bp->def_cp_lock);
bnxt_schedule_fw_health_check(bp);
pthread_mutex_unlock(&bp->def_cp_lock);
@@ -886,6 +886,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
bnxt_shutdown_nic(bp);
bnxt_free_tx_mbufs(bp);
bnxt_free_rx_mbufs(bp);
+ bp->dev_stopped = 1;
return rc;
}
@@ -1153,6 +1154,10 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
if (rc)
return rc;
+ /* Filter settings will get applied when port is started */
+ if (bp->dev_stopped == 1)
+ return 0;
+
if (bp->vnic_info == NULL)
return 0;
@@ -1178,6 +1183,10 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
if (rc)
return rc;
+ /* Filter settings will get applied when port is started */
+ if (bp->dev_stopped == 1)
+ return 0;
+
if (bp->vnic_info == NULL)
return 0;
@@ -1203,6 +1212,10 @@ static int bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
if (rc)
return rc;
+ /* Filter settings will get applied when port is started */
+ if (bp->dev_stopped == 1)
+ return 0;
+
if (bp->vnic_info == NULL)
return 0;
@@ -1228,6 +1241,10 @@ static int bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
if (rc)
return rc;
+ /* Filter settings will get applied when port is started */
+ if (bp->dev_stopped == 1)
+ return 0;
+
if (bp->vnic_info == NULL)
return 0;
@@ -1956,6 +1973,10 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
if (rc)
return rc;
+ /* Filter settings will get applied when port is started */
+ if (bp->dev_stopped == 1)
+ return 0;
+
if (mask & ETH_VLAN_FILTER_MASK) {
/* Enable or disable VLAN filtering */
rc = bnxt_config_vlan_hw_filter(bp, rx_offloads);
--
2.10.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-stable] [PATCH 19.11 3/3] net/bnxt: remove a redundant variable
2020-02-28 8:13 [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Kalesh A P
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 1/3] net/bnxt: fix return code handling in VLAN config Kalesh A P
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 2/3] net/bnxt: handle HW filter setting when port is stopped Kalesh A P
@ 2020-02-28 8:13 ` Kalesh A P
2020-02-28 11:12 ` [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Luca Boccassi
3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2020-02-28 8:13 UTC (permalink / raw)
To: stable; +Cc: luca.boccassi, ajit.khaparde
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
[ upstream commit 90c957ef3b11f361dd8e6519d9e195f01295b23e ]
Use "dev->data->dev_started" state, instead of local "dev_stopped"
to check whether port has been started or not.
Fixes: 316e412299fd ("net/bnxt: fix crash when closing")
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 -
drivers/net/bnxt/bnxt_ethdev.c | 24 ++++++++++--------------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 6422753..93735a2 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -649,7 +649,6 @@ struct bnxt {
#define BNXT_OUTER_TPID_BD_SHFT 16
uint32_t outer_tpid_bd;
struct bnxt_pf_info pf;
- uint8_t dev_stopped;
uint8_t vxlan_port_cnt;
uint8_t geneve_port_cnt;
uint16_t vxlan_port;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c21a05a..802045d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -860,9 +860,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
goto error;
eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev);
+ eth_dev->data->dev_started = 1;
bnxt_link_update(eth_dev, 1, ETH_LINK_UP);
- bp->dev_stopped = 0;
if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
vlan_mask |= ETH_VLAN_FILTER_MASK;
@@ -875,7 +875,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
- eth_dev->data->dev_started = 1;
pthread_mutex_lock(&bp->def_cp_lock);
bnxt_schedule_fw_health_check(bp);
pthread_mutex_unlock(&bp->def_cp_lock);
@@ -886,7 +885,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
bnxt_shutdown_nic(bp);
bnxt_free_tx_mbufs(bp);
bnxt_free_rx_mbufs(bp);
- bp->dev_stopped = 1;
+ eth_dev->data->dev_started = 0;
return rc;
}
@@ -957,7 +956,6 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
bnxt_int_handler(eth_dev);
bnxt_shutdown_nic(bp);
bnxt_hwrm_if_change(bp, 0);
- bp->dev_stopped = 1;
bp->rx_cosq_cnt = 0;
}
@@ -965,7 +963,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
- if (bp->dev_stopped == 0)
+ if (eth_dev->data->dev_started)
bnxt_dev_stop_op(eth_dev);
if (eth_dev->data->mac_addrs != NULL) {
@@ -1155,7 +1153,7 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
return rc;
/* Filter settings will get applied when port is started */
- if (bp->dev_stopped == 1)
+ if (!eth_dev->data->dev_started)
return 0;
if (bp->vnic_info == NULL)
@@ -1184,7 +1182,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
return rc;
/* Filter settings will get applied when port is started */
- if (bp->dev_stopped == 1)
+ if (!eth_dev->data->dev_started)
return 0;
if (bp->vnic_info == NULL)
@@ -1213,7 +1211,7 @@ static int bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
return rc;
/* Filter settings will get applied when port is started */
- if (bp->dev_stopped == 1)
+ if (!eth_dev->data->dev_started)
return 0;
if (bp->vnic_info == NULL)
@@ -1242,7 +1240,7 @@ static int bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
return rc;
/* Filter settings will get applied when port is started */
- if (bp->dev_stopped == 1)
+ if (!eth_dev->data->dev_started)
return 0;
if (bp->vnic_info == NULL)
@@ -1974,7 +1972,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
return rc;
/* Filter settings will get applied when port is started */
- if (bp->dev_stopped == 1)
+ if (!dev->data->dev_started)
return 0;
if (mask & ETH_VLAN_FILTER_MASK) {
@@ -3881,7 +3879,7 @@ static void bnxt_dev_cleanup(struct bnxt *bp)
{
bnxt_set_hwrm_link_config(bp, false);
bp->link_info.link_up = 0;
- if (bp->dev_stopped == 0)
+ if (bp->eth_dev->data->dev_started)
bnxt_dev_stop_op(bp->eth_dev);
bnxt_uninit_resources(bp, true);
@@ -4815,8 +4813,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
bp = eth_dev->data->dev_private;
- bp->dev_stopped = 1;
-
if (bnxt_vf_pciid(pci_dev->id.device_id))
bp->flags |= BNXT_FLAG_VF;
@@ -4918,7 +4914,7 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
bp->rx_mem_zone = NULL;
}
- if (bp->dev_stopped == 0)
+ if (eth_dev->data->dev_started)
bnxt_dev_close_op(eth_dev);
if (bp->pf.vf_info)
rte_free(bp->pf.vf_info);
--
2.10.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable
2020-02-28 8:13 [dpdk-stable] [PATCH 19.11 0/3] bnxt fixes for 19.11 stable Kalesh A P
` (2 preceding siblings ...)
2020-02-28 8:13 ` [dpdk-stable] [PATCH 19.11 3/3] net/bnxt: remove a redundant variable Kalesh A P
@ 2020-02-28 11:12 ` Luca Boccassi
3 siblings, 0 replies; 5+ messages in thread
From: Luca Boccassi @ 2020-02-28 11:12 UTC (permalink / raw)
To: Kalesh A P, stable; +Cc: ajit.khaparde
On Fri, 2020-02-28 at 13:43 +0530, Kalesh A P wrote:
> From: Kalesh AP <
> kalesh-anakkur.purayil@broadcom.com
> >
>
> Hi Luca,
>
> I have created patches for those commits from DPDK master branch
> which
> conflicts or caused build errors while merging to 19.11 stable
> branch.
>
> Please apply them to 19.11 stable branch.
>
> Kalesh AP (3):
> net/bnxt: fix return code handling in VLAN config
> net/bnxt: handle HW filter setting when port is stopped
> net/bnxt: remove a redundant variable
>
> drivers/net/bnxt/bnxt.h | 1 -
> drivers/net/bnxt/bnxt_ethdev.c | 51
> +++++++++++++++++++++++++++++++++---------
> 2 files changed, 40 insertions(+), 12 deletions(-)
Thank you very much, series applied.
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 5+ messages in thread