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 6AF36A0C43; Fri, 22 Oct 2021 14:57:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1903411E1; Fri, 22 Oct 2021 14:57:36 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 8141B411DF for ; Fri, 22 Oct 2021 14:57:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="229566449" X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="229566449" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2021 05:57:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="495666345" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by orsmga008.jf.intel.com with ESMTP; 22 Oct 2021 05:57:31 -0700 From: Ferruh Yigit To: Haiyue Wang , Beilei Xing , Jingjing Wu , Qiming Yang , Qi Zhang , Hyong Youb Kim , Michal Krawczyk , Andrew Rybchenko , Somnath Kotur Cc: Ferruh Yigit , dev@dpdk.org Date: Fri, 22 Oct 2021 13:57:15 +0100 Message-Id: <20211022125716.2706937-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211022125716.2706937-1-ferruh.yigit@intel.com> References: <20211022121708.1591089-1-ferruh.yigit@intel.com> <20211022125716.2706937-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/2] drivers/net: fix removing jumbo offload flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" After DEV_RX_OFFLOAD_JUMBO_FRAME flag removed, drivers give jumbo frame decisions based on MTU value checks, but some of the checks were wrong by mistake, causing device initialization to fail, fixing them. Fixes: b563c1421282 ("ethdev: remove jumbo offload flag") Signed-off-by: Ferruh Yigit --- Some of the check mistakes are residue of local changes, I remember fixing them, but it looks like something went wrong while sending patches. v2: * Split doc changes --- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 27 +++++++-------------------- drivers/net/iavf/iavf_ethdev.c | 31 ++++++++----------------------- drivers/net/ice/ice_dcf_ethdev.c | 31 ++++++++----------------------- drivers/net/ice/ice_rxtx.c | 27 +++++++-------------------- drivers/net/igc/igc_txrx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- 7 files changed, 33 insertions(+), 89 deletions(-) diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index a1d5eecc14a1..5ee65a563dd6 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -2331,7 +2331,7 @@ eth_igb_rx_init(struct rte_eth_dev *dev) * Configure support of jumbo frames, if any. */ max_len = dev->data->mtu + E1000_ETH_OVERHEAD; - if ((dev->data->mtu & RTE_ETHER_MTU) != 0) { + if (dev->data->mtu > RTE_ETHER_MTU) { rctl |= E1000_RCTL_LPE; /* diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 554b1142c136..fd066e8b236e 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2901,26 +2901,13 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) rxq->max_pkt_len = RTE_MIN(hw->func_caps.rx_buf_chain_len * rxq->rx_buf_len, data->mtu + I40E_ETH_OVERHEAD); - if (data->mtu > RTE_ETHER_MTU) { - if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN || - rxq->max_pkt_len > I40E_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)I40E_ETH_MAX_LEN, - (uint32_t)I40E_FRAME_SIZE_MAX); - return I40E_ERR_CONFIG; - } - } else { - if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || - rxq->max_pkt_len > I40E_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)I40E_ETH_MAX_LEN); - return I40E_ERR_CONFIG; - } + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { + PMD_DRV_LOG(ERR, "maximum packet length must be " + "larger than %u and smaller than %u", + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)I40E_FRAME_SIZE_MAX); + return I40E_ERR_CONFIG; } return 0; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 611f1f7722b0..74fc3c647710 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -585,29 +585,14 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq) rxq->rx_buf_len * IAVF_MAX_CHAINED_RX_BUFFERS, frame_size); - /* Check if the jumbo frame and maximum packet length are set - * correctly. - */ - if (dev->data->mtu & RTE_ETHER_MTU) { - if (max_pkt_len <= IAVF_ETH_MAX_LEN || - max_pkt_len > IAVF_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)IAVF_ETH_MAX_LEN, - (uint32_t)IAVF_FRAME_SIZE_MAX); - return -EINVAL; - } - } else { - if (max_pkt_len < RTE_ETHER_MIN_LEN || - max_pkt_len > IAVF_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)IAVF_ETH_MAX_LEN); - return -EINVAL; - } + /* Check if maximum packet length is set correctly. */ + if (max_pkt_len <= RTE_ETHER_MIN_LEN || + max_pkt_len > IAVF_FRAME_SIZE_MAX) { + PMD_DRV_LOG(ERR, "maximum packet length must be " + "larger than %u and smaller than %u", + (uint32_t)IAVF_ETH_MAX_LEN, + (uint32_t)IAVF_FRAME_SIZE_MAX); + return -EINVAL; } rxq->max_pkt_len = max_pkt_len; diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index ebd8ca57ef5f..a5904a7777ab 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -69,29 +69,14 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) max_pkt_len = RTE_MIN(ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, dev->data->mtu + ICE_ETH_OVERHEAD); - /* Check if the jumbo frame and maximum packet length are set - * correctly. - */ - if (dev_data->mtu > RTE_ETHER_MTU) { - if (max_pkt_len <= ICE_ETH_MAX_LEN || - 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)ICE_ETH_MAX_LEN, - (uint32_t)ICE_FRAME_SIZE_MAX); - return -EINVAL; - } - } else { - if (max_pkt_len < RTE_ETHER_MIN_LEN || - 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)ICE_ETH_MAX_LEN); - return -EINVAL; - } + /* Check maximum packet length is set correctly. */ + if (max_pkt_len <= RTE_ETHER_MIN_LEN || + max_pkt_len > ICE_FRAME_SIZE_MAX) { + PMD_DRV_LOG(ERR, "maximum packet length must be " + "larger than %u and smaller than %u", + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)ICE_FRAME_SIZE_MAX); + return -EINVAL; } rxq->max_pkt_len = max_pkt_len; diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index ff362c21d9f5..32f3a9342c20 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -281,26 +281,13 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) RTE_MIN((uint32_t)ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, frame_size); - if (dev_data->mtu > RTE_ETHER_MTU) { - 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)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 > 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)ICE_ETH_MAX_LEN); - return -EINVAL; - } + if (rxq->max_pkt_len <= RTE_ETHER_MIN_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", + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)ICE_FRAME_SIZE_MAX); + return -EINVAL; } if (rxq->offloads & DEV_RX_OFFLOAD_TIMESTAMP) { diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c index 56132e8c6cd6..4887e922e700 100644 --- a/drivers/net/igc/igc_txrx.c +++ b/drivers/net/igc/igc_txrx.c @@ -1080,7 +1080,7 @@ igc_rx_init(struct rte_eth_dev *dev) IGC_WRITE_REG(hw, IGC_RCTL, rctl & ~IGC_RCTL_EN); /* Configure support of jumbo frames, if any. */ - if (dev->data->mtu & RTE_ETHER_MTU) + if (dev->data->mtu > RTE_ETHER_MTU) rctl |= IGC_RCTL_LPE; else rctl &= ~IGC_RCTL_LPE; diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a51450fe5b82..ab4a261ca8f9 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -5078,7 +5078,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) /* * Configure jumbo frame support, if any. */ - if ((dev->data->mtu & RTE_ETHER_MTU) != 0) { + if (dev->data->mtu > RTE_ETHER_MTU) { hlreg0 |= IXGBE_HLREG0_JUMBOEN; maxfrs = IXGBE_READ_REG(hw, IXGBE_MAXFRS); maxfrs &= 0x0000FFFF; -- 2.31.1