From patchwork Fri Mar 29 17:52:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51934 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF2642BF4; Fri, 29 Mar 2019 18:52:27 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id B457E2965 for ; Fri, 29 Mar 2019 18:52:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138396966" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:22 -0700 From: Ferruh Yigit To: Neil Horman , John McNamara , Marko Kovacevic , Thomas Monjalon , Andrew Rybchenko Cc: dev@dpdk.org, Stephen Hemminger , Ian Stokes Date: Fri, 29 Mar 2019 17:52:13 +0000 Message-Id: <20190329175219.23831-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 1/7] ethdev: add min/max MTU to device info 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" From: Stephen Hemminger This addresses the usability issue raised by OVS at DPDK Userspace summit. It adds general min/max mtu into device info. For compatiablity, and to save space, it fits in a hole in existing structure. The initial version sets max mtu to normal Ethernet, it is up to PMD to set larger value if it supports Jumbo frames. Also remove the deprecation notice introduced in 18.11 regarding this change and bump ethdev ABI version. Signed-off-by: Stephen Hemminger Signed-off-by: Ian Stokes Acked-by: Andrew Rybchenko Reviewed-by: Ferruh Yigit Reviewed-by: Ferruh Yigit --- doc/guides/rel_notes/deprecation.rst | 12 ---------- doc/guides/rel_notes/release_19_05.rst | 9 ++++++- lib/librte_ethdev/Makefile | 2 +- lib/librte_ethdev/meson.build | 2 +- lib/librte_ethdev/rte_ethdev.c | 15 ++++++++++++ lib/librte_ethdev/rte_ethdev.h | 33 +++++++++++++++++++++++++- 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 73bfa9d4a..6f55c4740 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -52,18 +52,6 @@ Deprecation Notices Target release for removal of the legacy API will be defined once most PMDs have switched to rte_flow. -* ethdev: Maximum and minimum MTU values vary between hardware devices. In - hardware agnostic DPDK applications access to such information would allow - a more accurate way of validating and setting supported MTU values on a per - device basis rather than using a defined default for all devices. To - resolve this, the following members will be added to ``rte_eth_dev_info``. - Note: these can be added to fit a hole in the existing structure for amd64 - but not for 32-bit, as such ABI change will occur as size of the structure - will increase. - - - Member ``uint16_t min_mtu`` the minimum MTU allowed. - - Member ``uint16_t max_mtu`` the maximum MTU allowed. - * kni: remove KNI ethtool support. To clarify, this is not to remove the KNI, but only to remove ethtool support of it that is disabled by default and can be enabled via ``CONFIG_RTE_KNI_KMOD_ETHTOOL`` config option. diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index cddd800e4..8d2d8a7e9 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -164,6 +164,13 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* ethdev: Additional fields in rte_eth_dev_info. + + The ``rte_eth_dev_info`` structure has had two extra fields + added: ``min_mtu`` and ``max_mtu``. Each of these are of type ``uint16_t``. + The values of these fields can be set specifically by the PMD drivers as + supported values can vary from device to device. + * cryptodev: in 18.08 new structure ``rte_crypto_asym_op`` was introduced and included into ``rte_crypto_op``. As ``rte_crypto_asym_op`` structure was defined as cache-line aligned that caused unintended changes in @@ -206,7 +213,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_distributor.so.1 + librte_eal.so.10 librte_efd.so.1 - librte_ethdev.so.11 + + librte_ethdev.so.12 librte_eventdev.so.6 librte_flow_classify.so.1 librte_gro.so.1 diff --git a/lib/librte_ethdev/Makefile b/lib/librte_ethdev/Makefile index e09c4263a..8d4a02630 100644 --- a/lib/librte_ethdev/Makefile +++ b/lib/librte_ethdev/Makefile @@ -16,7 +16,7 @@ LDLIBS += -lrte_mbuf -lrte_kvargs -lrte_cmdline -lrte_meter EXPORT_MAP := rte_ethdev_version.map -LIBABIVER := 11 +LIBABIVER := 12 SRCS-y += ethdev_private.c SRCS-y += rte_ethdev.c diff --git a/lib/librte_ethdev/meson.build b/lib/librte_ethdev/meson.build index e98942ff8..8d6165b2a 100644 --- a/lib/librte_ethdev/meson.build +++ b/lib/librte_ethdev/meson.build @@ -2,7 +2,7 @@ # Copyright(c) 2017 Intel Corporation name = 'ethdev' -version = 11 +version = 12 allow_experimental_apis = true sources = files('ethdev_private.c', 'ethdev_profile.c', diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 12b66b68c..10bdfb37e 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2532,6 +2532,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = lim; dev_info->tx_desc_lim = lim; dev_info->device = dev->device; + dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->max_mtu = UINT16_MAX; RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); @@ -2595,12 +2597,25 @@ int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu) { int ret; + struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP); + /* + * Check if the device supports dev_infos_get, if it does not + * skip min_mtu/max_mtu validation here as this requires values + * that are populated within the call to rte_eth_dev_info_get() + * which relies on dev->dev_ops->dev_infos_get. + */ + if (*dev->dev_ops->dev_infos_get != NULL) { + rte_eth_dev_info_get(port_id, &dev_info); + if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu) + return -EINVAL; + } + ret = (*dev->dev_ops->mtu_set)(dev, mtu); if (!ret) dev->data->mtu = mtu; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 2be9b4ba1..b6023c050 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1088,6 +1088,8 @@ struct rte_eth_dev_info { const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. Use if_indextoname() to translate into an interface name. */ + uint16_t min_mtu; /**< Minimum MTU allowed */ + uint16_t max_mtu; /**< Maximum MTU allowed */ const uint32_t *dev_flags; /**< Device flags */ uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */ uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */ @@ -2204,6 +2206,33 @@ void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. * + * As part of this function, a number of of fields in dev_info will be + * initialized as follows: + * + * rx_desc_lim = lim + * tx_desc_lim = lim + * + * Where lim is defined within the rte_eth_dev_info_get as + * + * const struct rte_eth_desc_lim lim = { + * .nb_max = UINT16_MAX, + * .nb_min = 0, + * .nb_align = 1, + * }; + * + * device = dev->device + * min_mtu = ETHER_MIN_MTU + * max_mtu = UINT16_MAX + * + * The following fields will be populated if support for dev_infos_get() + * exists for the device and the rte_eth_dev 'dev' has been populated + * successfully with a call to it: + * + * driver_name = dev->device->driver->name + * nb_rx_queues = dev->data->nb_rx_queues + * nb_tx_queues = dev->data->nb_tx_queues + * dev_flags = &dev->data->dev_flags + * * @param port_id * The port identifier of the Ethernet device. * @param dev_info @@ -2300,7 +2329,9 @@ int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu); * - (-ENOTSUP) if operation is not supported. * - (-ENODEV) if *port_id* invalid. * - (-EIO) if device is removed. - * - (-EINVAL) if *mtu* invalid. + * - (-EINVAL) if *mtu* invalid, validation of mtu can occur within + * rte_eth_dev_set_mtu if dev_infos_get is supported by the device or + * when the mtu is set using dev->dev_ops->mtu_set. * - (-EBUSY) if operation is not allowed when the port is running */ int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu); From patchwork Fri Mar 29 17:52:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51935 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 36FAE4C9D; Fri, 29 Mar 2019 18:52:32 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E7D8B2965 for ; Fri, 29 Mar 2019 18:52:26 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138396985" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:25 -0700 From: Ferruh Yigit To: Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:14 +0000 Message-Id: <20190329175219.23831-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 2/7] net/i40e: set min and max MTU for i40e devices 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" From: Ian Stokes This commit sets the min and max supported MTU values for i40e devices via the i40e_dev_info_get() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. Signed-off-by: Ian Stokes --- drivers/net/i40e/i40e_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 3815aef6c..891bdc061 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -3499,6 +3499,8 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX; dev_info->max_mac_addrs = vsi->max_macaddrs; dev_info->max_vfs = pci_dev->max_vfs; + dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; dev_info->rx_queue_offload_capa = 0; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | From patchwork Fri Mar 29 17:52:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51936 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0EFDF4C9C; Fri, 29 Mar 2019 18:52:37 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 5BC7E4C88 for ; Fri, 29 Mar 2019 18:52:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138396999" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:27 -0700 From: Ferruh Yigit To: Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:15 +0000 Message-Id: <20190329175219.23831-3-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 3/7] net/i40e: set min and max MTU for i40e VF devices 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" From: Ian Stokes This commit sets the min and max supported MTU values for i40e VF devices via the i40evf_dev_info_get() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. Signed-off-by: Ian Stokes --- drivers/net/i40e/i40e_ethdev_vf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 7e4bd7314..add7b2223 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -2216,6 +2216,8 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_tx_queues = I40E_MAX_QP_NUM_PER_VF; dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN; dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX; + dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t); dev_info->reta_size = ETH_RSS_RETA_SIZE_64; dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask; From patchwork Fri Mar 29 17:52:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51937 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1E1A74CB5; Fri, 29 Mar 2019 18:52:42 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 541164C8D for ; Fri, 29 Mar 2019 18:52:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138397012" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:29 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Konstantin Ananyev Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:16 +0000 Message-Id: <20190329175219.23831-4-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 4/7] net/ixgbe: set min and max MTU for ixgbe devices 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" From: Ian Stokes This commit sets the min and max supported MTU values for ixgbe devices via the ixgbe_dev_info_get() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. To aid in these calculations a new MACRO 'IXGBE_ETH_OVERHEAD' has been introduced to consolidate overhead calculation and avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++- drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 97e10217d..60da3508c 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3748,6 +3748,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vmdq_pools = ETH_16_POOLS; else dev_info->max_vmdq_pools = ETH_64_POOLS; + dev_info->max_mtu = dev_info->max_rx_pktlen - IXGBE_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; dev_info->vmdq_queue_num = dev_info->max_rx_queues; dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | @@ -4939,7 +4941,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t maxfrs; struct ixgbe_hw *hw; struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_size = mtu + IXGBE_ETH_OVERHEAD; struct rte_eth_dev_data *dev_data = dev->data; ixgbe_dev_info_get(dev, &dev_info); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 3fec61352..d1f61e85e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -101,6 +101,9 @@ #define IXGBE_5TUPLE_MAX_PRI 7 #define IXGBE_5TUPLE_MIN_PRI 1 +/* The overhead from MTU to max frame size. */ +#define IXGBE_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN) + /* bit of VXLAN tunnel type | 7 bits of zeros | 8 bits of zeros*/ #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE 0x8000 /* bit of NVGRE tunnel type | 7 bits of zeros | 8 bits of zeros*/ From patchwork Fri Mar 29 17:52:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51938 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2584C4CC7; Fri, 29 Mar 2019 18:52:45 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 51E214CA6 for ; Fri, 29 Mar 2019 18:52:33 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138397024" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:31 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Konstantin Ananyev Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:17 +0000 Message-Id: <20190329175219.23831-5-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 5/7] net/ixgbe: set min and max MTU for ixgbe VF devices 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" From: Ian Stokes This commit sets the min and max supported MTU values for ixgbe VF devices via the ixgbevf_dev_set_mtu() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. As transport overhead is the same for VF and PF ixgbe devices, reuse MACRO 'IXGBE_ETH_OVERHEAD' to avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 60da3508c..feec85634 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3857,6 +3857,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues; dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL reg */ dev_info->max_rx_pktlen = 9728; /* includes CRC, cf MAXFRS reg */ + dev_info->max_mtu = dev_info->max_rx_pktlen - IXGBE_ETH_OVERHEAD; dev_info->max_mac_addrs = hw->mac.num_rar_entries; dev_info->max_hash_mac_addrs = IXGBE_VMDQ_NUM_UC_MAC; dev_info->max_vfs = pci_dev->max_vfs; @@ -6344,7 +6345,7 @@ static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct ixgbe_hw *hw; - uint32_t max_frame = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = mtu + IXGBE_ETH_OVERHEAD; struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); From patchwork Fri Mar 29 17:52:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51939 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D1884F94; Fri, 29 Mar 2019 18:52:48 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 13EFB4C91 for ; Fri, 29 Mar 2019 18:52:34 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138397037" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:33 -0700 From: Ferruh Yigit To: Wenzhuo Lu Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:18 +0000 Message-Id: <20190329175219.23831-6-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 6/7] net/e1000: set min and max MTU for igb devices 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" From: Ian Stokes This commit sets the min and max supported MTU values for igb devices via the eth_igb_info_get() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. To aid in these calculations a new MACRO 'E1000_ETH_OVERHEAD' has been introduced to consolidate overhead calculation and avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/e1000/e1000_ethdev.h | 6 ++++++ drivers/net/e1000/igb_ethdev.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 94edff08e..3e74cd8fe 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -88,6 +88,12 @@ ETH_RSS_IPV6_TCP_EX | \ ETH_RSS_IPV6_UDP_EX) +/* + * The overhead from MTU to max frame size. + * Considering VLAN so a tag needs to be counted. + */ +#define E1000_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE) + /* * Maximum number of Ring Descriptors. * diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 87c9aedf2..b897e8ad4 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2283,6 +2283,10 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G; + + dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; + } static const uint32_t * @@ -4466,8 +4470,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; struct e1000_hw *hw; struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + - VLAN_TAG_SIZE); + uint32_t frame_size = mtu + E1000_ETH_OVERHEAD; hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); From patchwork Fri Mar 29 17:52:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 51940 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 87B714F93; Fri, 29 Mar 2019 18:52:51 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 325154CA6 for ; Fri, 29 Mar 2019 18:52:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138397051" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:35 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:19 +0000 Message-Id: <20190329175219.23831-7-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 7/7] app/testpmd: verify MTU with device provided limits 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" From: Ian Stokes This commit uses the mtu fields populated in rte_eth_dev_info_get() to validate the mtu value being passed in port_mtu_set(). Signed-off-by: Ian Stokes --- app/test-pmd/config.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b9e5dd923..cadcb512f 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1063,9 +1063,16 @@ void port_mtu_set(portid_t port_id, uint16_t mtu) { int diag; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + rte_eth_dev_info_get(port_id, &dev_info); + if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu) { + printf("Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n", + mtu, dev_info.min_mtu, dev_info.max_mtu); + return; + } diag = rte_eth_dev_set_mtu(port_id, mtu); if (diag == 0) return;