]> git.droids-corp.org - dpdk.git/commitdiff
net/bnxt: fix handling of VF configuration change
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Tue, 4 Jan 2022 08:38:19 +0000 (14:08 +0530)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 12 Jan 2022 01:59:22 +0000 (02:59 +0100)
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
drivers/net/bnxt/bnxt_cpr.c
drivers/net/bnxt/bnxt_ethdev.c

index 64866de319ae7a0a1915767cd96dd07f8907cd47..9c0dbc6af4159d56636bb6788e1f03dd2df6f15e 100644 (file)
@@ -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
index 593eebfb9ae2ca8e3ba157a0c696a54236306cfa..9b9285b799030d577b1df44b338bad6b354d3238 100644 (file)
@@ -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");
index cf3bd770353ae0f468f8f720bcfafa66c2c98c8a..999a9a51034278097d51b683c0c35f5bf4d4415e 100644 (file)
@@ -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);