Skip to content

Commit

Permalink
net/bnxt: fix handling of VF configuration change
Browse files Browse the repository at this point in the history
[ upstream commit 6c63f34 ]

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: 1221382 ("net/bnxt: register for more async events")

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>
  • Loading branch information
Kalesh AP authored and bluca committed Feb 14, 2022
1 parent ef80ca4 commit 766d770
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
3 changes: 3 additions & 0 deletions drivers/net/bnxt/bnxt.h
Expand Up @@ -1026,6 +1026,9 @@ void bnxt_flow_cnt_alarm_cb(void *arg);
int bnxt_flow_stats_req(struct bnxt *bp);
int bnxt_flow_stats_cnt(struct bnxt *bp);
uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
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);

int
bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
Expand Down
22 changes: 22 additions & 0 deletions drivers/net/bnxt/bnxt_cpr.c
Expand Up @@ -91,6 +91,26 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
bnxt_rep_dev_start_op(eth_dev);
}

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
*/
Expand Down Expand Up @@ -118,6 +138,8 @@ void bnxt_handle_async_event(struct bnxt *bp,
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
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");
Expand Down
13 changes: 7 additions & 6 deletions drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -964,7 +964,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
return rc;

/* MAC Specifics */
dev_info->max_mac_addrs = RTE_MIN(bp->max_l2_ctx, RTE_ETH_NUM_RECEIVE_MAC_ADDR);
dev_info->max_mac_addrs = RTE_MIN(bp->max_l2_ctx, ETH_NUM_RECEIVE_MAC_ADDR);
dev_info->max_hash_mac_addrs = 0;

/* PF/VF specifics */
Expand Down Expand Up @@ -1432,7 +1432,7 @@ static int bnxt_ptp_start(struct bnxt *bp)
}

/* 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;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
Expand Down Expand Up @@ -1504,7 +1504,7 @@ static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
return 0;
}

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;
Expand Down Expand Up @@ -1626,6 +1626,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_op(eth_dev);
Expand Down Expand Up @@ -4781,12 +4782,12 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
size_t max_mac_addr = RTE_MIN(bp->max_l2_ctx, RTE_ETH_NUM_RECEIVE_MAC_ADDR);
size_t max_mac_addr = RTE_MIN(bp->max_l2_ctx, ETH_NUM_RECEIVE_MAC_ADDR);
int rc = 0;

if (bp->max_l2_ctx > RTE_ETH_NUM_RECEIVE_MAC_ADDR)
if (bp->max_l2_ctx > ETH_NUM_RECEIVE_MAC_ADDR)
PMD_DRV_LOG(INFO, "Max number of MAC addrs supported is %d, but will be limited to %d\n",
bp->max_l2_ctx, RTE_ETH_NUM_RECEIVE_MAC_ADDR);
bp->max_l2_ctx, ETH_NUM_RECEIVE_MAC_ADDR);

eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl",
RTE_ETHER_ADDR_LEN * max_mac_addr,
Expand Down

0 comments on commit 766d770

Please sign in to comment.