From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id 4E79D5F17 for ; Wed, 3 Apr 2019 03:18:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1961; q=dns/txt; s=iport; t=1554254318; x=1555463918; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GFZDsZrRaaI3CWeSH95lchxvOpDWV1TwjnaYEuR1Tco=; b=eQOhtMnZyoa+yFLaM/fpcIJtBgCE25G0jyEUpNagMFLe9iOeDtrK03Ff i1Yw4Ytszrlwl57Eyw3gz4AuOYboHl1BLUb9eUEssvbiH6UjDJ8g8uVy0 lR85hwuxYlx0zjnvGdW1HZaCnMyFIhPeOFXhhT11LBtALbJPyWMHIFhd0 Y=; X-IronPort-AV: E=Sophos;i="5.60,302,1549929600"; d="scan'208";a="256824346" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 03 Apr 2019 01:18:37 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by rcdn-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id x331Ib0V014704; Wed, 3 Apr 2019 01:18:37 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id CF01BA73; Tue, 2 Apr 2019 21:18:36 -0400 (EDT) From: David Harton To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, David Harton Date: Tue, 2 Apr 2019 21:18:33 -0400 Message-Id: <20190403011833.20428-1-dharton@cisco.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 172.18.5.114, cpp-rtpbld-31.cisco.com X-Outbound-Node: rcdn-core-6.cisco.com Subject: [dpdk-dev] [PATCH] net/ixgbevf: remove MTU setting limitation 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, 03 Apr 2019 01:18:38 -0000 Currently, if requested MTU is bigger than mbuf size and scattered receive is not enabled, setting MTU to that value fails. This patch allows setting this special MTU when device is stopped, because scattered_rx will be re-configured during next port start and driver may enable scattered receive according new MTU value. After this patch, driver may select different receive function automatically after MTU set, according MTU values selected. Signed-off-by: David Harton --- drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index feec85634..0b962c8db 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -6346,20 +6346,22 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct ixgbe_hw *hw; uint32_t max_frame = mtu + IXGBE_ETH_OVERHEAD; - struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode; + struct rte_eth_dev_data *dev_data = dev->data; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if ((mtu < ETHER_MIN_MTU) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) return -EINVAL; - /* refuse mtu that requires the support of scattered packets when this - * feature has not been enabled before. + /* If device is started, refuse mtu that requires the support of + * scattered packets when this feature has not been enabled before. */ - if (!(rx_conf->offloads & DEV_RX_OFFLOAD_SCATTER) && + if (dev_data->dev_started && !dev_data->scattered_rx && (max_frame + 2 * IXGBE_VLAN_TAG_SIZE > - dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) + dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) { + PMD_INIT_LOG(ERR, "Stop port first."); return -EINVAL; + } /* * When supported by the underlying PF driver, use the IXGBE_VF_SET_MTU -- 2.19.1 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 0F9D0A0679 for ; Wed, 3 Apr 2019 03:18:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 202C05F28; Wed, 3 Apr 2019 03:18:40 +0200 (CEST) Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id 4E79D5F17 for ; Wed, 3 Apr 2019 03:18:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1961; q=dns/txt; s=iport; t=1554254318; x=1555463918; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GFZDsZrRaaI3CWeSH95lchxvOpDWV1TwjnaYEuR1Tco=; b=eQOhtMnZyoa+yFLaM/fpcIJtBgCE25G0jyEUpNagMFLe9iOeDtrK03Ff i1Yw4Ytszrlwl57Eyw3gz4AuOYboHl1BLUb9eUEssvbiH6UjDJ8g8uVy0 lR85hwuxYlx0zjnvGdW1HZaCnMyFIhPeOFXhhT11LBtALbJPyWMHIFhd0 Y=; X-IronPort-AV: E=Sophos;i="5.60,302,1549929600"; d="scan'208";a="256824346" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 03 Apr 2019 01:18:37 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by rcdn-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id x331Ib0V014704; Wed, 3 Apr 2019 01:18:37 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id CF01BA73; Tue, 2 Apr 2019 21:18:36 -0400 (EDT) From: David Harton To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, David Harton Date: Tue, 2 Apr 2019 21:18:33 -0400 Message-Id: <20190403011833.20428-1-dharton@cisco.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 172.18.5.114, cpp-rtpbld-31.cisco.com X-Outbound-Node: rcdn-core-6.cisco.com Subject: [dpdk-dev] [PATCH] net/ixgbevf: remove MTU setting limitation 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: <20190403011833.qr_EFPyU7-ZvochRlrF3hFxM8SuOxlzo9B4Gn8CzPv4@z> Currently, if requested MTU is bigger than mbuf size and scattered receive is not enabled, setting MTU to that value fails. This patch allows setting this special MTU when device is stopped, because scattered_rx will be re-configured during next port start and driver may enable scattered receive according new MTU value. After this patch, driver may select different receive function automatically after MTU set, according MTU values selected. Signed-off-by: David Harton --- drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index feec85634..0b962c8db 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -6346,20 +6346,22 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct ixgbe_hw *hw; uint32_t max_frame = mtu + IXGBE_ETH_OVERHEAD; - struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode; + struct rte_eth_dev_data *dev_data = dev->data; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if ((mtu < ETHER_MIN_MTU) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) return -EINVAL; - /* refuse mtu that requires the support of scattered packets when this - * feature has not been enabled before. + /* If device is started, refuse mtu that requires the support of + * scattered packets when this feature has not been enabled before. */ - if (!(rx_conf->offloads & DEV_RX_OFFLOAD_SCATTER) && + if (dev_data->dev_started && !dev_data->scattered_rx && (max_frame + 2 * IXGBE_VLAN_TAG_SIZE > - dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) + dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) { + PMD_INIT_LOG(ERR, "Stop port first."); return -EINVAL; + } /* * When supported by the underlying PF driver, use the IXGBE_VF_SET_MTU -- 2.19.1