Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1207123imu; Sat, 17 Nov 2018 19:21:47 -0800 (PST) X-Google-Smtp-Source: AJdET5c2BwHMbeK23PnIktKISl1c/g1wmAdnHdgdlIXGqZ5e5KYSX3H7KWviZw9+VN8iq+fXoVdl X-Received: by 2002:a62:b9a:: with SMTP id 26mr5852315pfl.196.1542511307248; Sat, 17 Nov 2018 19:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542511307; cv=none; d=google.com; s=arc-20160816; b=e1dVCVQ9NunRZppo/rVDvAxicUKlERB3yAITGJTYMqwz3TKszdv+nGC0iW4mAA+rBj eyOsXK3OM4h9lvhHxM6W0SYFJtUhP/SxgDOQOojlWCKEkBPdL0x5jZ4YGp5Bnrx673vx LzTmy2pDf6uYjRh+IrsAB1qKvKXVgfJTJKvlpb27eRZAWea5lQXf4z1G/Nkd9u26b/Q9 wqRlFk/qkbiyErLPPnXwxcXAb8ihBbqzaNxmOHqIIcMmue1jiUUAHkWBhFxyTCFkcZYe r1jPl6ZylQQgW1llQrSmSDa7lGjFcJbG3i4OWDeYS5ZZ3rhzCdEjo4f9Rk/H1WtnzGry 4aIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=EnyNUhGlf3JDfCInw6kJfEJhnsIaCWVUB7Gk50h/Yw8=; b=S0epdheBtLc5v9dR11tFMyU16pqjOy0yZK1gJUHSIUM+3qyVJRQbyMtURByCFlNIlb TaBI98O2Una5huUEUmZMYzd/1qhCowP9D8yB1Kw464Co7p4YY4xD6mlOBz6mKqL23xOv 3iUtMSE+NhhOROYh1gjD4Y9op3UmbL4BAzWAXI3d5avVIgVM1S+vSpVEEzmIdKFIGB/a Xi1bXi8Joj6S7b6J0jWM1/Oqd2allcCdQy5nNLCSQ36384QgaixGoq5Tk6MTJGFrgR2t sSU9X5dkrEqmYOYEQuhideDQDxyHewyUpTEEoJvulRMoJXGoDw7Wp4htfZIzaBhIIDsV R2Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a93-v6si41382349pla.226.2018.11.17.19.21.25; Sat, 17 Nov 2018 19:21:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbeKRNj1 (ORCPT + 99 others); Sun, 18 Nov 2018 08:39:27 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:48617 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725831AbeKRNj1 (ORCPT ); Sun, 18 Nov 2018 08:39:27 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 694775BCD9977; Sun, 18 Nov 2018 11:20:33 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.88.178) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Sun, 18 Nov 2018 11:20:24 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin , Jian Shen Subject: [PATCH net-next 1/5] net: hns3: Support two vlan header when setting mtu Date: Sun, 18 Nov 2018 03:19:10 +0000 Message-ID: <20181118031914.23892-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181118031914.23892-1-salil.mehta@huawei.com> References: <20181118031914.23892-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.88.178] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin This patch adds supports for two vlan header when setting mtu. Signed-off-by: Yunsheng Lin Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 22220af92aa9..c944090d3adf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -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); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 33885a7529fc..019f747e486a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -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) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index ca90b662e33b..279661764910 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -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 -- 2.17.1