net: hns: Modify GMAC init TX threshold value
authorlipeng <lipeng321@huawei.com>
Sat, 1 Apr 2017 11:03:32 +0000 (12:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Apr 2017 21:48:43 +0000 (14:48 -0700)
This patch reduces GMAC TX threshold value to avoid gmac
hang-up with speed 100M/duplex half.

Signed-off-by: lipeng <lipeng321@huawei.com>
Signed-off-by: JinchuanTian <tianjinchuan1@huawei.com>
Reviewed-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h

index 3382441fe7b51e84bb5e815ffc1e4fa192b09a91..a8dbe001725f9137e3a997ba109b8db6a04c4360 100644 (file)
@@ -325,6 +325,12 @@ static void hns_gmac_init(void *mac_drv)
        hns_gmac_tx_loop_pkt_dis(mac_drv);
        if (drv->mac_cb->mac_type == HNAE_PORT_DEBUG)
                hns_gmac_set_uc_match(mac_drv, 0);
+
+       /* reduce gmac tx water line to avoid gmac hang-up
+        * in speed 100M and duplex half.
+        */
+       dsaf_set_dev_field(drv, GMAC_TX_WATER_LINE_REG, GMAC_TX_WATER_LINE_MASK,
+                          GMAC_TX_WATER_LINE_SHIFT, 8);
 }
 
 void hns_gmac_update_stats(void *mac_drv)
index 8fa18fc17cd2e25f2e3458e608abe6f5a96b60d9..4b8af68af02e869a5585a75684e1056a40b73798 100644 (file)
 
 #define GMAC_DUPLEX_TYPE_REG                   0x0008UL
 #define GMAC_FD_FC_TYPE_REG                    0x000CUL
+#define GMAC_TX_WATER_LINE_REG                 0x0010UL
 #define GMAC_FC_TX_TIMER_REG                   0x001CUL
 #define GMAC_FD_FC_ADDR_LOW_REG                        0x0020UL
 #define GMAC_FD_FC_ADDR_HIGH_REG               0x0024UL
 
 #define GMAC_DUPLEX_TYPE_B 0
 
+#define GMAC_TX_WATER_LINE_MASK                ((1UL << 8) - 1)
+#define GMAC_TX_WATER_LINE_SHIFT       0
+
 #define GMAC_FC_TX_TIMER_S 0
 #define GMAC_FC_TX_TIMER_M 0xffff