net: hns3: Support two vlan header when setting mtu
authorYunsheng Lin <linyunsheng@huawei.com>
Sun, 18 Nov 2018 03:19:10 +0000 (03:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Nov 2018 05:57:29 +0000 (21:57 -0800)
This patch adds supports for two vlan header when setting mtu.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

index 22220af92aa9bc31edb54bfd24d7a46d9fc44deb..c944090d3adf00ced94f323768248319e245ab11 100644 (file)
@@ -3609,8 +3609,9 @@ static int hns3_client_init(struct hnae3_handle *handle)
 
        hns3_dcbnl_setup(handle);
 
-       /* MTU range: (ETH_MIN_MTU(kernel default) - 9706) */
-       netdev->max_mtu = HNS3_MAX_MTU - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
+       /* MTU range: (ETH_MIN_MTU(kernel default) - 9702) */
+       netdev->max_mtu =
+               HNS3_MAX_MTU - (ETH_HLEN + ETH_FCS_LEN + 2 * VLAN_HLEN);
 
        set_bit(HNS3_NIC_STATE_INITED, &priv->state);
 
index 33885a7529fc26bc98fc9f87193f9f52ec0383e8..019f747e486ac971ede2439354c858070f49e2aa 100644 (file)
@@ -6364,7 +6364,7 @@ static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mtu)
        int max_frm_size;
        int ret;
 
-       max_frm_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
+       max_frm_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + 2 * VLAN_HLEN;
 
        if (max_frm_size < HCLGE_MAC_MIN_FRAME ||
            max_frm_size > HCLGE_MAC_MAX_FRAME)
index ca90b662e33bebffbe6d850ddf98a35390c6ded8..2796617649103536e890d920dd9995619f1af54e 100644 (file)
@@ -120,7 +120,7 @@ enum HLCGE_PORT_TYPE {
 #define HCLGE_VECTOR0_IMP_RESET_INT_B  1
 
 #define HCLGE_MAC_DEFAULT_FRAME \
-       (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN + ETH_DATA_LEN)
+       (ETH_HLEN + ETH_FCS_LEN + 2 * VLAN_HLEN + ETH_DATA_LEN)
 #define HCLGE_MAC_MIN_FRAME            64
 #define HCLGE_MAC_MAX_FRAME            9728