From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D171A09E4 for ; Fri, 5 Feb 2021 02:33:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 042BC40682; Fri, 5 Feb 2021 02:33:17 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 37DE940682 for ; Fri, 5 Feb 2021 02:33:14 +0100 (CET) IronPort-SDR: qNRjFFmMD9FUyju72Y+Y8ZDabGnc9TkjF5cCgdh4PTNGr0fpdqdtl4UtZ4CrkxRXYONDyM0BUQ 4nBuGWsQKk0A== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="168477483" X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="168477483" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 17:33:13 -0800 IronPort-SDR: Sttq++Flp2IjoWcGTxefTcRAyRfBkB+WDuBg8gch5lQeu2QlrUYp/bF+oFOrPASX4JRGJLTVo3 24Lp/iJYix6w== X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="415593245" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 17:33:03 -0800 From: Steve Yang To: stable@dpdk.org Cc: Steve Yang Date: Fri, 5 Feb 2021 01:29:15 +0000 Message-Id: <20210205012915.5101-1-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH 19.11] net/ice: fix jumbo frame flag condition X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 14801aa3fb3587347c739d6e55afdbe130f319be ] The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but the Ether overhead is larger than 18 when it supports dual VLAN tags. That will cause the jumbo flag rx offload is wrong when MTU size is 'RTE_ETHER_MTU'. This fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead, that perhaps impacts the cases of the jumbo frame related. Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine") Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF") Fixes: ae2bdd0219cb ("net/ice: support MTU setting") Fixes: 50370662b727 ("net/ice: support device and queue ops") Cc: stable@dpdk.org Reviewed-by: Ferruh Yigit Signed-off-by: Steve Yang --- drivers/net/ice/ice_ethdev.c | 2 +- drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_rxtx.c | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 8acfce00aa..4e685f7726 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3239,7 +3239,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > RTE_ETHER_MAX_LEN) + if (frame_size > ICE_ETH_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 070c3ae306..cce0b5f2d6 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -123,6 +123,7 @@ */ #define ICE_ETH_OVERHEAD \ (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) +#define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD) #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK) #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 3030550bdc..fd59f3f1c2 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -85,23 +85,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) dev->data->dev_conf.rxmode.max_rx_pkt_len); if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || + if (rxq->max_pkt_len <= ICE_ETH_MAX_LEN || rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must " "be larger than %u and smaller than %u," "as jumbo frame is enabled", - (uint32_t)RTE_ETHER_MAX_LEN, + (uint32_t)ICE_ETH_MAX_LEN, (uint32_t)ICE_FRAME_SIZE_MAX); return -EINVAL; } } else { if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || - rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { + rxq->max_pkt_len > ICE_ETH_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", (uint32_t)RTE_ETHER_MIN_LEN, - (uint32_t)RTE_ETHER_MAX_LEN); + (uint32_t)ICE_ETH_MAX_LEN); return -EINVAL; } } @@ -530,7 +530,7 @@ ice_fdir_program_hw_rx_queue(struct ice_rx_queue *rxq) rx_ctx.hbuf = rxq->rx_hdr_len >> ICE_RLAN_CTX_HBUF_S; rx_ctx.dtype = 0; /* No Header Split mode */ rx_ctx.dsize = 1; /* 32B descriptors */ - rx_ctx.rxmax = RTE_ETHER_MAX_LEN; + rx_ctx.rxmax = ICE_ETH_MAX_LEN; /* TPH: Transaction Layer Packet (TLP) processing hints */ rx_ctx.tphrdesc_ena = 1; rx_ctx.tphwdesc_ena = 1; -- 2.17.1