From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5CF065681 for ; Wed, 27 Mar 2019 12:36:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 04:36:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="310809124" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga005.jf.intel.com with ESMTP; 27 Mar 2019 04:36:54 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, Qi Zhang Date: Wed, 27 Mar 2019 19:38:50 +0800 Message-Id: <20190327113850.30508-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] net/ice: fix max frame size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Mar 2019 11:36:56 -0000 Max frame size setup should consider double VLAN case. Fixes: ae2bdd0219cb ("net/ice: support MTU setting") Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 3 +-- drivers/net/ice/ice_ethdev.h | 7 +++++++ drivers/net/ice/ice_rxtx.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index cdb5502d1..b9b32fa97 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2043,8 +2043,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct rte_eth_dev_data *dev_data = pf->dev_data; - uint32_t frame_size = mtu + ETHER_HDR_LEN - + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; + uint32_t frame_size = mtu + ICE_ETH_OVERHEAD; /* check if mtu is within the allowed range */ if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 3cefa5b5b..655624c3c 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -115,6 +115,13 @@ ETH_RSS_NONFRAG_IPV6_OTHER | \ ETH_RSS_L2_PAYLOAD) +/** + * The overhead from MTU to max frame size. + * Considering QinQ packet, the VLAN tag needs to be counted twice. + */ +#define ICE_ETH_OVERHEAD \ + (ETHER_HDR_LEN + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) + struct ice_adapter; /** diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index c794ee861..b3ff14694 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -113,7 +113,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) RTE_PKTMBUF_HEADROOM); /* Check if scattered RX needs to be used. */ - if ((rxq->max_pkt_len + 2 * ICE_VLAN_TAG_SIZE) > buf_size) + if (rxq->max_pkt_len > buf_size) dev->data->scattered_rx = 1; rxq->qrx_tail = hw->hw_addr + QRX_TAIL(rxq->reg_idx); -- 2.13.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 395CCA05D3 for ; Wed, 27 Mar 2019 12:36:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DEA9F1B0FC; Wed, 27 Mar 2019 12:36:57 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5CF065681 for ; Wed, 27 Mar 2019 12:36:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 04:36:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="310809124" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga005.jf.intel.com with ESMTP; 27 Mar 2019 04:36:54 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, Qi Zhang Date: Wed, 27 Mar 2019 19:38:50 +0800 Message-Id: <20190327113850.30508-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] net/ice: fix max frame size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190327113850.ggGNiUzERKm_cLUYuFYQgqa1gCb8sYH88wOhA9ryJUM@z> Max frame size setup should consider double VLAN case. Fixes: ae2bdd0219cb ("net/ice: support MTU setting") Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 3 +-- drivers/net/ice/ice_ethdev.h | 7 +++++++ drivers/net/ice/ice_rxtx.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index cdb5502d1..b9b32fa97 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2043,8 +2043,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct rte_eth_dev_data *dev_data = pf->dev_data; - uint32_t frame_size = mtu + ETHER_HDR_LEN - + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; + uint32_t frame_size = mtu + ICE_ETH_OVERHEAD; /* check if mtu is within the allowed range */ if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 3cefa5b5b..655624c3c 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -115,6 +115,13 @@ ETH_RSS_NONFRAG_IPV6_OTHER | \ ETH_RSS_L2_PAYLOAD) +/** + * The overhead from MTU to max frame size. + * Considering QinQ packet, the VLAN tag needs to be counted twice. + */ +#define ICE_ETH_OVERHEAD \ + (ETHER_HDR_LEN + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) + struct ice_adapter; /** diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index c794ee861..b3ff14694 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -113,7 +113,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) RTE_PKTMBUF_HEADROOM); /* Check if scattered RX needs to be used. */ - if ((rxq->max_pkt_len + 2 * ICE_VLAN_TAG_SIZE) > buf_size) + if (rxq->max_pkt_len > buf_size) dev->data->scattered_rx = 1; rxq->qrx_tail = hw->hw_addr + QRX_TAIL(rxq->reg_idx); -- 2.13.6