]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: hns: adds limitation for debug port mtu
authorKejian Yan <yankejian@huawei.com>
Tue, 22 Mar 2016 08:06:30 +0000 (16:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Mar 2016 19:45:58 +0000 (15:45 -0400)
If mtu for debug port is set more than 1500, it may cause that packets
are dropped by ppe. So maximum value for debug port should be 1500.

Signed-off-by: Kejian Yan <yankejian@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_mac.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h

index 50237fbe3090626b9ec0f7ac25314bf9e58b5c87..a38084a22bf28a527b051cc0351624aa50a28086 100644 (file)
@@ -470,6 +470,9 @@ int hns_mac_set_mtu(struct hns_mac_cb *mac_cb, u32 new_mtu)
        u32 max_frm = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver) ?
                        MAC_MAX_MTU : MAC_MAX_MTU_V2;
 
+       if (mac_cb->mac_type == HNAE_PORT_DEBUG)
+               max_frm = MAC_MAX_MTU_DBG;
+
        if ((new_mtu < MAC_MIN_MTU) || (new_frm > max_frm) ||
            (new_frm > HNS_RCB_RING_MAX_BD_PER_PKT * buf_size))
                return -EINVAL;
index 7b47701daecaef39210d779631c8ba4ca9f85b50..823b6e78c8aadc36b239fcde643ad34790130274 100644 (file)
@@ -28,6 +28,7 @@ struct dsaf_device;
 #define MAC_MAX_MTU            9600
 #define MAC_MAX_MTU_V2         9728
 #define MAC_MIN_MTU            68
+#define MAC_MAX_MTU_DBG                MAC_DEFAULT_MTU
 
 #define MAC_DEFAULT_PAUSE_TIME 0xff