]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2net: Fix VLAN/multicast packet reception
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Fri, 4 May 2012 10:39:09 +0000 (16:09 +0530)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Mon, 7 May 2012 21:44:26 +0000 (14:44 -0700)
VLAN and multicast hardware filters are limited and can get
exhausted in adapters with many PCI functions. If setting
a VLAN or multicast filter fails due to lack of sufficient
hardware resources, these packets get dropped. Fix this by
switching to VLAN or multicast promiscous mode so that these
packets are not dropped.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/benet/be_main.c

index 810d9731930dffd16ae100b8a03b201719923d9f..70d8b9eb3e8f3f597a86e5812c0afbaaae77ff58 100644 (file)
@@ -793,22 +793,30 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num)
        if (adapter->promiscuous)
                return 0;
 
-       if (adapter->vlans_added <= adapter->max_vlans)  {
-               /* Construct VLAN Table to give to HW */
-               for (i = 0; i < VLAN_N_VID; i++) {
-                       if (adapter->vlan_tag[i]) {
-                               vtag[ntags] = cpu_to_le16(i);
-                               ntags++;
-                       }
-               }
-               status = be_cmd_vlan_config(adapter, adapter->if_handle,
-                                       vtag, ntags, 1, 0);
-       } else {
-               status = be_cmd_vlan_config(adapter, adapter->if_handle,
-                                       NULL, 0, 1, 1);
+       if (adapter->vlans_added > adapter->max_vlans)
+               goto set_vlan_promisc;
+
+       /* Construct VLAN Table to give to HW */
+       for (i = 0; i < VLAN_N_VID; i++)
+               if (adapter->vlan_tag[i])
+                       vtag[ntags++] = cpu_to_le16(i);
+
+       status = be_cmd_vlan_config(adapter, adapter->if_handle,
+                                   vtag, ntags, 1, 0);
+
+       /* Set to VLAN promisc mode as setting VLAN filter failed */
+       if (status) {
+               dev_info(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n");
+               dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering.\n");
+               goto set_vlan_promisc;
        }
 
        return status;
+
+set_vlan_promisc:
+       status = be_cmd_vlan_config(adapter, adapter->if_handle,
+                                   NULL, 0, 1, 1);
+       return status;
 }
 
 static int be_vlan_add_vid(struct net_device *netdev, u16 vid)
@@ -858,6 +866,7 @@ ret:
 static void be_set_rx_mode(struct net_device *netdev)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
+       int status;
 
        if (netdev->flags & IFF_PROMISC) {
                be_cmd_rx_filter(adapter, IFF_PROMISC, ON);
@@ -881,7 +890,14 @@ static void be_set_rx_mode(struct net_device *netdev)
                goto done;
        }
 
-       be_cmd_rx_filter(adapter, IFF_MULTICAST, ON);
+       status = be_cmd_rx_filter(adapter, IFF_MULTICAST, ON);
+
+       /* Set to MCAST promisc mode if setting MULTICAST address fails */
+       if (status) {
+               dev_info(&adapter->pdev->dev, "Exhausted multicast HW filters.\n");
+               dev_info(&adapter->pdev->dev, "Disabling HW multicast filtering.\n");
+               be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON);
+       }
 done:
        return;
 }