]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
qlcnic: Optimize MAC learning code
authorShahed Shaikh <shahed.shaikh@qlogic.com>
Fri, 25 Apr 2014 21:43:56 +0000 (17:43 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Apr 2014 03:20:53 +0000 (23:20 -0400)
* Use rx_mac_learn instead of mac_learn and eSwitch flag check in Rx path of
  82xx adapter.
* Check for MAC filter overrun only after driver scans through cached MAC address list.
  This will help to update the time stamp of cached MAC addresses even if
  adapter runs out of MAC address filter limit.
* Remove expensive log thrown by driver when MAC address filters are exhausted

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

index 173b3d12991f55a62751d5e6a213d20ee02c3174..deb2278b48d530759b45f9b1963de3b8e9b224d0 100644 (file)
@@ -305,7 +305,6 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
 {
        struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data);
        struct ethhdr *phdr = (struct ethhdr *)(skb->data);
-       struct net_device *netdev = adapter->netdev;
        u16 protocol = ntohs(skb->protocol);
        struct qlcnic_filter *fil, *tmp_fil;
        struct hlist_head *head;
@@ -330,13 +329,6 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
                        return;
        }
 
-       if (adapter->fhash.fnum >= adapter->fhash.fmax) {
-               adapter->stats.mac_filter_limit_overrun++;
-               netdev_info(netdev, "Can not add more than %d mac-vlan filters, configured %d\n",
-                           adapter->fhash.fmax, adapter->fhash.fnum);
-               return;
-       }
-
        memcpy(&src_addr, phdr->h_source, ETH_ALEN);
        hval = qlcnic_mac_hash(src_addr, vlan_id);
        hindex = hval & (adapter->fhash.fbucket_size - 1);
@@ -353,6 +345,11 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
                }
        }
 
+       if (unlikely(adapter->fhash.fnum >= adapter->fhash.fmax)) {
+               adapter->stats.mac_filter_limit_overrun++;
+               return;
+       }
+
        fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC);
        if (!fil)
                return;
@@ -1216,8 +1213,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
        if (!skb)
                return buffer;
 
-       if (adapter->drv_mac_learn &&
-           (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
+       if (adapter->rx_mac_learn) {
                t_vid = 0;
                is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0);
                qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
@@ -1293,8 +1289,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
        if (!skb)
                return buffer;
 
-       if (adapter->drv_mac_learn &&
-           (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
+       if (adapter->rx_mac_learn) {
                t_vid = 0;
                is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0);
                qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);