net: hns3: fix for setting MTU
authorFuyun Liang <liangfuyun1@huawei.com>
Fri, 5 Jan 2018 10:18:19 +0000 (18:18 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jan 2018 19:06:19 +0000 (14:06 -0500)
commit2866ccb2b8f8df48c73f2fcc76454cac6c7cc557
tree700d87a17dfffebf89be6fa2a075b7e18ed1fee2
parent40173a2ec70c6386f5b342dfd612c26453a3f6b4
net: hns3: fix for setting MTU

When setting MTU, actually what we do is configuring the max frame size
for the hardware. ETH_HLEN、ETH_FCS_LEN and VLAN_HLEN must need to be
considered. And the frame size which is less than the default value
should not be set to the hardware. Because in the hardware, the the max
frame size not only controls the RX packet size, but also controls the
TX packet size. the RX packets whose size are greater than the setting
value will be dropped.

This patch fixes the bug setting a error max frame size to hardware.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h