net: hns: fixed the bug about GMACs mac setting
authorSheng Li <lisheng011@huawei.com>
Tue, 22 Mar 2016 08:06:25 +0000 (16:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Mar 2016 19:45:58 +0000 (15:45 -0400)
When sending a pause frame out from GMACs, the packets' source MAC address
does not match the GMACs' MAC address. It causes by the condition before
the mac address setting routine for GMACs, the mac address cannot be set
into loacal mac table for service ports. It obviously the condition needs
to be deleted.

Signed-off-by: Sheng Li <lisheng011@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c

index b8cf0e480655ddd98ff77dd8b2b015e3c728fa5a..6e2b76ede0751048380820851bdd3f42879cb965 100644 (file)
@@ -422,19 +422,17 @@ static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr)
 {
        struct mac_driver *drv = (struct mac_driver *)mac_drv;
 
-       if (drv->mac_id >= DSAF_SERVICE_NW_NUM) {
-               u32 high_val = mac_addr[1] | (mac_addr[0] << 8);
+       u32 high_val = mac_addr[1] | (mac_addr[0] << 8);
 
-               u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
-                       | (mac_addr[3] << 16) | (mac_addr[2] << 24);
+       u32 low_val = mac_addr[5] | (mac_addr[4] << 8)
+               | (mac_addr[3] << 16) | (mac_addr[2] << 24);
 
-               u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
-               u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
+       u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG);
+       u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B);
 
-               dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
-               dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
-                              high_val | (sta_addr_en << GMAC_ADDR_EN_B));
-       }
+       dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val);
+       dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG,
+                      high_val | (sta_addr_en << GMAC_ADDR_EN_B));
 }
 
 static int hns_gmac_config_loopback(void *mac_drv, enum hnae_loop loop_mode,