aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKejian Yan <yankejian@huawei.com>2016-03-22 04:06:30 -0400
committerDavid S. Miller <davem@davemloft.net>2016-03-22 15:45:58 -0400
commit211b1384030d3b94f962573f9bc5e5726bf79197 (patch)
treeaa321cca404e81c2f9deb8236fb06cb4d25ce4a7
parentda3488bbde50c274a327afa67a141c86c065e0fa (diff)
net: hns: adds limitation for debug port mtu
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>
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c3
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 50237fbe3090..a38084a22bf2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -470,6 +470,9 @@ int hns_mac_set_mtu(struct hns_mac_cb *mac_cb, u32 new_mtu)
470 u32 max_frm = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver) ? 470 u32 max_frm = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver) ?
471 MAC_MAX_MTU : MAC_MAX_MTU_V2; 471 MAC_MAX_MTU : MAC_MAX_MTU_V2;
472 472
473 if (mac_cb->mac_type == HNAE_PORT_DEBUG)
474 max_frm = MAC_MAX_MTU_DBG;
475
473 if ((new_mtu < MAC_MIN_MTU) || (new_frm > max_frm) || 476 if ((new_mtu < MAC_MIN_MTU) || (new_frm > max_frm) ||
474 (new_frm > HNS_RCB_RING_MAX_BD_PER_PKT * buf_size)) 477 (new_frm > HNS_RCB_RING_MAX_BD_PER_PKT * buf_size))
475 return -EINVAL; 478 return -EINVAL;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
index 7b47701daeca..823b6e78c8aa 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
@@ -28,6 +28,7 @@ struct dsaf_device;
28#define MAC_MAX_MTU 9600 28#define MAC_MAX_MTU 9600
29#define MAC_MAX_MTU_V2 9728 29#define MAC_MAX_MTU_V2 9728
30#define MAC_MIN_MTU 68 30#define MAC_MIN_MTU 68
31#define MAC_MAX_MTU_DBG MAC_DEFAULT_MTU
31 32
32#define MAC_DEFAULT_PAUSE_TIME 0xff 33#define MAC_DEFAULT_PAUSE_TIME 0xff
33 34