Skip to content

Commit

Permalink
net/bnxt: restore MAC filters during reset recovery
Browse files Browse the repository at this point in the history
Older Firmware could have state information such as
MAC Filters, VLAN settings etc configured by user.
But new Firmware is unaware of this state information
and as a result driver should restore these settings
during reset recovery.

This patch restores the user configured mac addresses
prior to hot FW upgrade or FW error.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
  • Loading branch information
Kalesh AP authored and Ferruh Yigit committed Jan 17, 2020
1 parent 6801116 commit b02f157
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -3796,6 +3796,48 @@ static void bnxt_dev_cleanup(struct bnxt *bp)
bnxt_uninit_resources(bp, true);
}

static int bnxt_restore_mac_filters(struct bnxt *bp)
{
struct rte_eth_dev *dev = bp->eth_dev;
struct rte_eth_dev_info dev_info;
struct rte_ether_addr *addr;
uint64_t pool_mask;
uint32_t pool = 0;
uint16_t i;
int rc;

if (BNXT_VF(bp) & !BNXT_VF_IS_TRUSTED(bp))
return 0;

rc = bnxt_dev_info_get_op(dev, &dev_info);
if (rc)
return rc;

/* replay MAC address configuration */
for (i = 1; i < dev_info.max_mac_addrs; i++) {
addr = &dev->data->mac_addrs[i];

/* skip zero address */
if (rte_is_zero_ether_addr(addr))
continue;

pool = 0;
pool_mask = dev->data->mac_pool_sel[i];

do {
if (pool_mask & 1ULL) {
rc = bnxt_mac_addr_add_op(dev, addr, i, pool);
if (rc)
return rc;
}
pool_mask >>= 1;
pool++;
} while (pool_mask);
}

return 0;
}

static int bnxt_restore_filters(struct bnxt *bp)
{
struct rte_eth_dev *dev = bp->eth_dev;
Expand All @@ -3806,6 +3848,7 @@ static int bnxt_restore_filters(struct bnxt *bp)
if (dev->data->promiscuous)
ret = bnxt_promiscuous_enable_op(dev);

ret = bnxt_restore_mac_filters(bp);
/* TODO restore other filters as well */
return ret;
}
Expand Down

0 comments on commit b02f157

Please sign in to comment.