From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BC0CCA04B7;
	Wed, 14 Oct 2020 11:22:09 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 149251DD72;
	Wed, 14 Oct 2020 11:21:31 +0200 (CEST)
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 3BA7E1DD36
 for <dev@dpdk.org>; Wed, 14 Oct 2020 11:21:29 +0200 (CEST)
IronPort-SDR: hagoZvryUb3VCjwYuJyra4hQH4uGdmlkFDuYGTH/fivhRJd03Z2euL6BoMdUsY/gJUTcIv6ct0
 pZly9bKDIkVw==
X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585319"
X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585319"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2020 02:21:28 -0700
IronPort-SDR: YdsVgwn/esEa0wddY1o9rMATZM42s951QfCccP5L37E32GBVMPg05X6eeshhkE8+l3dJzxnhVA
 X+E6NYU2pzKA==
X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752296"
Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136])
 by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2020 02:21:26 -0700
From: SteveX Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com,
 jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com,
 SteveX Yang <stevex.yang@intel.com>
Date: Wed, 14 Oct 2020 09:19:42 +0000
Message-Id: <20201014091945.1934-3-stevex.yang@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com>
References: <20200928065541.7520-1-stevex.yang@intel.com>
 <20201014091945.1934-1-stevex.yang@intel.com>
Subject: [dpdk-dev] [PATCH v5 2/5] net/igc: fix max mtu size packets with
	vlan tag cannot be received by default
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

when application presets the max rx packet length and expected mtu at
the same time, driver need identify if the preset max frame size can
hold mtu data and Ether overhead completely.

if not, adjust the max frame size via mtu_set ops within dev_configure.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/igc/igc_ethdev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 7f5066df4..98e98b3e4 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -337,11 +337,22 @@ static int
 eth_igc_configure(struct rte_eth_dev *dev)
 {
 	struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
+	uint32_t frame_size = dev->data->mtu + IGC_ETH_OVERHEAD;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
-	ret  = igc_check_mq_mode(dev);
+	/**
+	 * Reset the max frame size via mtu_set ops if preset max frame
+	 * cannot hold MTU data and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		ret = eth_igc_mtu_set(dev, dev->data->mtu);
+		if (ret != 0)
+			return ret;
+	}
+
+	ret = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;
 
-- 
2.17.1