enic: minimize pkt filter updates to firmware
authorScott Feldman <scofeldm@cisco.com>
Wed, 23 Dec 2009 13:27:43 +0000 (13:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Dec 2009 05:03:40 +0000 (21:03 -0800)
In set_multicast(), only push pkt filter changes down to firmware if
pkt filter actually changes.

Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enic/enic.h
drivers/net/enic/enic_main.c

index 8dd0105a8d9c5fc5c1a99cee9f4cad7f82316cfc..b090d65ad0c898250d4a61b7a776753a24cd7b22 100644 (file)
@@ -89,6 +89,7 @@ struct enic {
        spinlock_t devcmd_lock;
        u8 mac_addr[ETH_ALEN];
        u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN];
+       unsigned int flags;
        unsigned int mc_count;
        int csum_rx_enabled;
        u32 port_mtu;
index 452a6b747e3e7073cadb5a931b43851d3aac4e53..019b1480cc0c7b296151af9de03ae105ffd5aa58 100644 (file)
@@ -771,6 +771,7 @@ static void enic_set_multicast_list(struct net_device *netdev)
        int promisc = (netdev->flags & IFF_PROMISC) ? 1 : 0;
        int allmulti = (netdev->flags & IFF_ALLMULTI) ||
            (netdev->mc_count > ENIC_MULTICAST_PERFECT_FILTERS);
+       unsigned int flags = netdev->flags | (allmulti ? IFF_ALLMULTI : 0);
        u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN];
        unsigned int mc_count = netdev->mc_count;
        unsigned int i, j;
@@ -780,8 +781,11 @@ static void enic_set_multicast_list(struct net_device *netdev)
 
        spin_lock(&enic->devcmd_lock);
 
-       vnic_dev_packet_filter(enic->vdev, directed,
-               multicast, broadcast, promisc, allmulti);
+       if (enic->flags != flags) {
+               enic->flags = flags;
+               vnic_dev_packet_filter(enic->vdev, directed,
+                       multicast, broadcast, promisc, allmulti);
+       }
 
        /* Is there an easier way?  Trying to minimize to
         * calls to add/del multicast addrs.  We keep the