be2net: change to call pmac_del only if necessary
authorAjit Khaparde <ajitk@serverengines.com>
Fri, 23 Jul 2010 01:49:04 +0000 (01:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Jul 2010 19:40:52 +0000 (12:40 -0700)
If a mac address has not been configured for a VF,
there is no need to call be_cmd_pmac_del.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/benet/be.h
drivers/net/benet/be_main.c

index f17428caecf1974a390e789a896056ad77ecdf2d..c730bd64628ad45ec931b1902990302176c80463 100644 (file)
@@ -221,6 +221,7 @@ struct be_rx_obj {
 };
 
 #define BE_NUM_MSIX_VECTORS            2       /* 1 each for Tx and Rx */
+#define BE_INVALID_PMAC_ID             0xffffffff
 struct be_adapter {
        struct pci_dev *pdev;
        struct net_device *netdev;
index e6ca92334d6d0bbb72de8ddc03930388986efaf5..899881b5aab924693fc5ddc876bb6c1014555a24 100644 (file)
@@ -656,8 +656,9 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
        if (!is_valid_ether_addr(mac) || (vf >= num_vfs))
                return -EINVAL;
 
-       status = be_cmd_pmac_del(adapter, adapter->vf_if_handle[vf],
-                               adapter->vf_pmac_id[vf]);
+       if (adapter->vf_pmac_id[vf] != BE_INVALID_PMAC_ID)
+               status = be_cmd_pmac_del(adapter, adapter->vf_if_handle[vf],
+                                       adapter->vf_pmac_id[vf]);
 
        status = be_cmd_pmac_add(adapter, mac, adapter->vf_if_handle[vf],
                                &adapter->vf_pmac_id[vf]);
@@ -1910,6 +1911,7 @@ static int be_setup(struct be_adapter *adapter)
                                "Interface Create failed for VF %d\n", vf);
                                goto if_destroy;
                        }
+                       adapter->vf_pmac_id[vf] = BE_INVALID_PMAC_ID;
                        vf++;
                }
        } else if (!be_physfn(adapter)) {