Skip to content

Commit 268f9d3

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
igb: Enable use of "bridge fdb add" to set unicast table entries
This change makes it so that we can use the bridge utility to add a FDB entry for the PF to an igb port. By doing this we can enable the VFs to talk to virtual ports residing on top of the PF. In addition this should also address issues with MACVLANs trying to reside on top of the PF as well as they would have had similar issues when added to the PF with SR-IOV enabled. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 9c2f186 commit 268f9d3

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,25 @@ static int igb_set_features(struct net_device *netdev,
20672067
return 0;
20682068
}
20692069

2070+
static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
2071+
struct net_device *dev,
2072+
const unsigned char *addr, u16 vid,
2073+
u16 flags)
2074+
{
2075+
/* guarantee we can provide a unique filter for the unicast address */
2076+
if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
2077+
struct igb_adapter *adapter = netdev_priv(dev);
2078+
struct e1000_hw *hw = &adapter->hw;
2079+
int vfn = adapter->vfs_allocated_count;
2080+
int rar_entries = hw->mac.rar_entry_count - (vfn + 1);
2081+
2082+
if (netdev_uc_count(dev) >= rar_entries)
2083+
return -ENOMEM;
2084+
}
2085+
2086+
return ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, flags);
2087+
}
2088+
20702089
static const struct net_device_ops igb_netdev_ops = {
20712090
.ndo_open = igb_open,
20722091
.ndo_stop = igb_close,
@@ -2090,6 +2109,7 @@ static const struct net_device_ops igb_netdev_ops = {
20902109
#endif
20912110
.ndo_fix_features = igb_fix_features,
20922111
.ndo_set_features = igb_set_features,
2112+
.ndo_fdb_add = igb_ndo_fdb_add,
20932113
.ndo_features_check = passthru_features_check,
20942114
};
20952115

@@ -4132,15 +4152,16 @@ static void igb_set_rx_mode(struct net_device *netdev)
41324152
vmolr |= E1000_VMOLR_ROMPE;
41334153
}
41344154
}
4135-
/* Write addresses to available RAR registers, if there is not
4136-
* sufficient space to store all the addresses then enable
4137-
* unicast promiscuous mode
4138-
*/
4139-
count = igb_write_uc_addr_list(netdev);
4140-
if (count < 0) {
4141-
rctl |= E1000_RCTL_UPE;
4142-
vmolr |= E1000_VMOLR_ROPE;
4143-
}
4155+
}
4156+
4157+
/* Write addresses to available RAR registers, if there is not
4158+
* sufficient space to store all the addresses then enable
4159+
* unicast promiscuous mode
4160+
*/
4161+
count = igb_write_uc_addr_list(netdev);
4162+
if (count < 0) {
4163+
rctl |= E1000_RCTL_UPE;
4164+
vmolr |= E1000_VMOLR_ROPE;
41444165
}
41454166

41464167
/* enable VLAN filtering by default */

0 commit comments

Comments
 (0)