summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
diff options
context:
space:
mode:
authorYuval Mintz <Yuval.Mintz@qlogic.com>2016-08-24 13:27:19 +0300
committerDavid S. Miller <davem@davemloft.net>2016-08-24 09:45:20 -0700
commitc7b7b483ccc9d64ae577a04d490aa9a975afe891 (patch)
treea0e669ab9cc7d9814bbdbdecc4847818895a9670 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
parent6546c78ea671b3ea1dfbdc39744b58f451885ac7 (diff)
bnx2x: Don't flush multicast MACs
When ndo_set_rx_mode() is called for bnx2x, as part of process of configuring the new MAC address filters [both unicast & multicast] driver begins by flushing the existing configuration and then iterating over the network device's list of addresses and configures those instead. This has the side-effect of creating a short gap where traffic wouldn't be properly classified, as no filters are configured in HW. While for unicasts this is rather insignificant [as unicast MACs don't frequently change while interface is actually running], for multicast traffic it does pose an issue as there are multicast-based networks where new multicast groups would constantly be removed and added. This patch tries to remedy this [at least for the newer adapters] - Instead of flushing & reconfiguring all existing multicast filters, the driver would instead create the approximate hash match that would result from the required filters. It would then compare it against the currently configured approximate hash match, and only add and remove the delta between those. Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 97e892511666..de2d32690394 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12560,8 +12560,10 @@ static int bnx2x_init_mcast_macs_list(struct bnx2x *bp,
kcalloc(mc_count, sizeof(*mc_mac), GFP_ATOMIC);
struct netdev_hw_addr *ha;
- if (!mc_mac)
+ if (!mc_mac) {
+ BNX2X_ERR("Failed to allocate mc MAC list\n");
return -ENOMEM;
+ }
INIT_LIST_HEAD(&p->mcast_list);
@@ -12632,7 +12634,7 @@ static int bnx2x_set_uc_list(struct bnx2x *bp)
BNX2X_UC_LIST_MAC, &ramrod_flags);
}
-static int bnx2x_set_mc_list(struct bnx2x *bp)
+static int bnx2x_set_mc_list_e1x(struct bnx2x *bp)
{
struct net_device *dev = bp->dev;
struct bnx2x_mcast_ramrod_params rparam = {NULL};
@@ -12650,11 +12652,8 @@ static int bnx2x_set_mc_list(struct bnx2x *bp)
/* then, configure a new MACs list */
if (netdev_mc_count(dev)) {
rc = bnx2x_init_mcast_macs_list(bp, &rparam);
- if (rc) {
- BNX2X_ERR("Failed to create multicast MACs list: %d\n",
- rc);
+ if (rc)
return rc;
- }
/* Now add the new MACs */
rc = bnx2x_config_mcast(bp, &rparam,
@@ -12669,6 +12668,42 @@ static int bnx2x_set_mc_list(struct bnx2x *bp)
return rc;
}
+static int bnx2x_set_mc_list(struct bnx2x *bp)
+{
+ struct bnx2x_mcast_ramrod_params rparam = {NULL};
+ struct net_device *dev = bp->dev;
+ int rc = 0;
+
+ /* On older adapters, we need to flush and re-add filters */
+ if (CHIP_IS_E1x(bp))
+ return bnx2x_set_mc_list_e1x(bp);
+
+ rparam.mcast_obj = &bp->mcast_obj;
+
+ if (netdev_mc_count(dev)) {
+ rc = bnx2x_init_mcast_macs_list(bp, &rparam);
+ if (rc)
+ return rc;
+
+ /* Override the curently configured set of mc filters */
+ rc = bnx2x_config_mcast(bp, &rparam,
+ BNX2X_MCAST_CMD_SET);
+ if (rc < 0)
+ BNX2X_ERR("Failed to set a new multicast configuration: %d\n",
+ rc);
+
+ bnx2x_free_mcast_macs_list(&rparam);
+ } else {
+ /* If no mc addresses are required, flush the configuration */
+ rc = bnx2x_config_mcast(bp, &rparam, BNX2X_MCAST_CMD_DEL);
+ if (rc)
+ BNX2X_ERR("Failed to clear multicast configuration %d\n",
+ rc);
+ }
+
+ return rc;
+}
+
/* If bp->state is OPEN, should be called with netif_addr_lock_bh() */
static void bnx2x_set_rx_mode(struct net_device *dev)
{