From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
When there is a change in the default VLAN of the VF,
FW sends the VF_CFG_CHANGE async event to the driver.
Upon receiving this async event, driver currently only queries
the FW using HWRM_FUNC_QCFG. But this is not enough.
Driver has to clean up the existing filter and recreate filters
so the FW can apply the default VLAN to the filter.
Fixes: 12213821a8a3 ("net/bnxt: register for more async events")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 3 +++
drivers/net/bnxt/bnxt_cpr.c | 25 ++++++++++++++++++++++++-
drivers/net/bnxt/bnxt_ethdev.c | 5 +++--
3 files changed, 30 insertions(+), 3 deletions(-)
@@ -1068,5 +1068,8 @@ int bnxt_flow_stats_cnt(struct bnxt *bp);
uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
int bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
const struct rte_flow_ops **ops);
+int bnxt_dev_start_op(struct rte_eth_dev *eth_dev);
+int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev);
+void bnxt_handle_vf_cfg_change(void *arg);
#endif
@@ -107,6 +107,26 @@ static void bnxt_handle_event_error_report(struct bnxt *bp,
}
}
+void bnxt_handle_vf_cfg_change(void *arg)
+{
+ struct bnxt *bp = arg;
+ struct rte_eth_dev *eth_dev = bp->eth_dev;
+ int rc;
+
+ /* Free and recreate filters with default VLAN */
+ if (eth_dev->data->dev_started) {
+ rc = bnxt_dev_stop_op(eth_dev);
+ if (rc != 0) {
+ PMD_DRV_LOG(ERR, "Failed to stop Port:%u\n", eth_dev->data->port_id);
+ return;
+ }
+
+ rc = bnxt_dev_start_op(eth_dev);
+ if (rc != 0)
+ PMD_DRV_LOG(ERR, "Failed to start Port:%u\n", eth_dev->data->port_id);
+ }
+}
+
/*
* Async event handling
*/
@@ -138,8 +158,11 @@ void bnxt_handle_async_event(struct bnxt *bp,
PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
break;
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
- PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
+ PMD_DRV_LOG(INFO, "Port %u: VF config change async event\n", port_id);
+ PMD_DRV_LOG(INFO, "event: data1 %#x data2 %#x\n", data1, data2);
bnxt_hwrm_func_qcfg(bp, NULL);
+ if (BNXT_VF(bp))
+ rte_eal_alarm_set(1, bnxt_handle_vf_cfg_change, (void *)bp);
break;
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:
PMD_DRV_LOG(INFO, "Port conn async event\n");
@@ -1530,7 +1530,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)
}
/* Unload the driver, release resources */
-static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
+int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
@@ -1546,7 +1546,7 @@ static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
return bnxt_dev_stop(eth_dev);
}
-static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
+int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
@@ -1678,6 +1678,7 @@ static int bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
rte_eal_alarm_cancel(bnxt_dev_reset_and_resume, (void *)bp);
rte_eal_alarm_cancel(bnxt_dev_recover, (void *)bp);
bnxt_cancel_fc_thread(bp);
+ rte_eal_alarm_cancel(bnxt_handle_vf_cfg_change, (void *)bp);
if (eth_dev->data->dev_started)
ret = bnxt_dev_stop(eth_dev);