mirror of https://gitee.com/openkylin/linux.git
Merge branch 'bnxt_en-fixes'
Michael Chan says: ==================== bnxt_en: set mac address and uc_list bug fixes. Fix ndo_set_mac_address() for PF and VF. Re-apply uc_list after chip reset. v2: Fix compile error if CONFIG_BNXT_SRIOV is not set. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
c5ba5c8ac8
|
@ -3625,6 +3625,7 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
|||
pf->fw_fid = le16_to_cpu(resp->fid);
|
||||
pf->port_id = le16_to_cpu(resp->port_id);
|
||||
memcpy(pf->mac_addr, resp->perm_mac_address, ETH_ALEN);
|
||||
memcpy(bp->dev->dev_addr, pf->mac_addr, ETH_ALEN);
|
||||
pf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
|
||||
pf->max_cp_rings = le16_to_cpu(resp->max_cmpl_rings);
|
||||
pf->max_tx_rings = le16_to_cpu(resp->max_tx_rings);
|
||||
|
@ -3648,8 +3649,11 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
|||
|
||||
vf->fw_fid = le16_to_cpu(resp->fid);
|
||||
memcpy(vf->mac_addr, resp->perm_mac_address, ETH_ALEN);
|
||||
if (!is_valid_ether_addr(vf->mac_addr))
|
||||
random_ether_addr(vf->mac_addr);
|
||||
if (is_valid_ether_addr(vf->mac_addr))
|
||||
/* overwrite netdev dev_adr with admin VF MAC */
|
||||
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
|
||||
else
|
||||
random_ether_addr(bp->dev->dev_addr);
|
||||
|
||||
vf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
|
||||
vf->max_cp_rings = le16_to_cpu(resp->max_cmpl_rings);
|
||||
|
@ -3880,6 +3884,8 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int bnxt_cfg_rx_mode(struct bnxt *);
|
||||
|
||||
static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -3946,11 +3952,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
|
|||
bp->vnic_info[0].rx_mask |=
|
||||
CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
|
||||
|
||||
rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0);
|
||||
if (rc) {
|
||||
netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %x\n", rc);
|
||||
rc = bnxt_cfg_rx_mode(bp);
|
||||
if (rc)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
rc = bnxt_hwrm_set_coal(bp);
|
||||
if (rc)
|
||||
|
@ -4865,7 +4869,7 @@ static void bnxt_set_rx_mode(struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void bnxt_cfg_rx_mode(struct bnxt *bp)
|
||||
static int bnxt_cfg_rx_mode(struct bnxt *bp)
|
||||
{
|
||||
struct net_device *dev = bp->dev;
|
||||
struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
|
||||
|
@ -4914,6 +4918,7 @@ static void bnxt_cfg_rx_mode(struct bnxt *bp)
|
|||
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n",
|
||||
rc);
|
||||
vnic->uc_filter_count = i;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4922,6 +4927,8 @@ static void bnxt_cfg_rx_mode(struct bnxt *bp)
|
|||
if (rc)
|
||||
netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %x\n",
|
||||
rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static netdev_features_t bnxt_fix_features(struct net_device *dev,
|
||||
|
@ -5212,13 +5219,27 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
|
|||
static int bnxt_change_mac_addr(struct net_device *dev, void *p)
|
||||
{
|
||||
struct sockaddr *addr = p;
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
int rc = 0;
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
#ifdef CONFIG_BNXT_SRIOV
|
||||
if (BNXT_VF(bp) && is_valid_ether_addr(bp->vf.mac_addr))
|
||||
return -EADDRNOTAVAIL;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
if (ether_addr_equal(addr->sa_data, dev->dev_addr))
|
||||
return 0;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
if (netif_running(dev)) {
|
||||
bnxt_close_nic(bp, false, false);
|
||||
rc = bnxt_open_nic(bp, false, false);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* rtnl_lock held */
|
||||
|
@ -5686,15 +5707,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
bnxt_set_tpa_flags(bp);
|
||||
bnxt_set_ring_params(bp);
|
||||
dflt_rings = netif_get_num_default_rss_queues();
|
||||
if (BNXT_PF(bp)) {
|
||||
memcpy(dev->dev_addr, bp->pf.mac_addr, ETH_ALEN);
|
||||
if (BNXT_PF(bp))
|
||||
bp->pf.max_irqs = max_irqs;
|
||||
} else {
|
||||
#if defined(CONFIG_BNXT_SRIOV)
|
||||
memcpy(dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
|
||||
else
|
||||
bp->vf.max_irqs = max_irqs;
|
||||
#endif
|
||||
}
|
||||
bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings);
|
||||
bp->rx_nr_rings = min_t(int, dflt_rings, max_rx_rings);
|
||||
bp->tx_nr_rings_per_tc = min_t(int, dflt_rings, max_tx_rings);
|
||||
|
|
|
@ -804,10 +804,9 @@ void bnxt_update_vf_mac(struct bnxt *bp)
|
|||
if (!is_valid_ether_addr(resp->perm_mac_address))
|
||||
goto update_vf_mac_exit;
|
||||
|
||||
if (ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr))
|
||||
goto update_vf_mac_exit;
|
||||
|
||||
memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN);
|
||||
if (!ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr))
|
||||
memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN);
|
||||
/* overwrite netdev dev_adr with admin VF MAC */
|
||||
memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
|
||||
update_vf_mac_exit:
|
||||
mutex_unlock(&bp->hwrm_cmd_lock);
|
||||
|
|
Loading…
Reference in New Issue