ixgbe: Cleanup FDB handling code
This change makes it so that the behavior for FDB handling is consistent between both the SR-IOV and non-SR-IOV cases. The main change here is that we perform bounds checking on the number of SR-IOV addresses regardless of if SR-IOV is enabled or not as we can only support a certain number of addresses in the hardware. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
c24817b6ba
commit
bcfd3432d1
1 changed files with 4 additions and 30 deletions
|
@ -7741,39 +7741,13 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
|
||||||
const unsigned char *addr,
|
const unsigned char *addr,
|
||||||
u16 flags)
|
u16 flags)
|
||||||
{
|
{
|
||||||
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
/* guarantee we can provide a unique filter for the unicast address */
|
||||||
int err;
|
|
||||||
|
|
||||||
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
|
|
||||||
return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
|
|
||||||
|
|
||||||
/* Hardware does not support aging addresses so if a
|
|
||||||
* ndm_state is given only allow permanent addresses
|
|
||||||
*/
|
|
||||||
if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
|
|
||||||
pr_info("%s: FDB only supports static addresses\n",
|
|
||||||
ixgbe_driver_name);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
|
if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
|
||||||
u32 rar_uc_entries = IXGBE_MAX_PF_MACVLANS;
|
if (IXGBE_MAX_PF_MACVLANS <= netdev_uc_count(dev))
|
||||||
|
return -ENOMEM;
|
||||||
if (netdev_uc_count(dev) < rar_uc_entries)
|
|
||||||
err = dev_uc_add_excl(dev, addr);
|
|
||||||
else
|
|
||||||
err = -ENOMEM;
|
|
||||||
} else if (is_multicast_ether_addr(addr)) {
|
|
||||||
err = dev_mc_add_excl(dev, addr);
|
|
||||||
} else {
|
|
||||||
err = -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only return duplicate errors if NLM_F_EXCL is set */
|
return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
|
||||||
if (err == -EEXIST && !(flags & NLM_F_EXCL))
|
|
||||||
err = 0;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
|
static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
|
||||||
|
|
Loading…
Add table
Reference in a new issue