From: Ian Stokes <ian.stokes@intel.com>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, Ian Stokes <ian.stokes@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/7] ethdev: add min/max MTU to device info
Date: Fri, 22 Mar 2019 13:01:12 +0000 [thread overview]
Message-ID: <1553259678-4515-2-git-send-email-ian.stokes@intel.com> (raw)
In-Reply-To: <1553259678-4515-1-git-send-email-ian.stokes@intel.com>
From: Stephen Hemminger <stephen@networkplumber.org>
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 <stephen@networkplumber.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
v1 -> v2
* Document default values set in rte_eth_dev_info_get() in doxygen
documentation.
* Document causes of EINVAL returns for rte_eth_dev_set_mtu() in doxygen
documentation.
* Check if dev_infos_get is supported before validating mtu values in
rte_eth_dev_mtu_set. If unsupported skip validation step.
RFC -> v1
* Removed RFC status.
* dev_info->max_mtu set to UINT16_MAX initially instead of ETHER_MTU to
avoid breaking jumbo frame support. ETHER_MTU to be re-introduced
when all PMD drivers modified to support min/max mtu support.
* Bump ethdev ABI version.
* Added ACK from Andrew Rybchenko.
---
doc/guides/rel_notes/deprecation.rst | 12 ------------
doc/guides/rel_notes/release_19_05.rst | 8 +++++++-
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, 56 insertions(+), 16 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 1b4fcb7e6..0e85c47f3 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -56,18 +56,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.
-
* meter: New ``rte_color`` definition will be added in 19.02 and that will
replace ``enum rte_meter_color`` in meter library in 19.05. This will help
to consolidate color definition, which is currently replicated in many places,
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 61a2c7383..6ba3fab9a 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -136,6 +136,12 @@ 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.
Shared Library Versions
-----------------------
@@ -171,7 +177,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_distributor.so.1
librte_eal.so.9
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 85c179496..fe72e88c2 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2524,6 +2524,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);
@@ -2587,12 +2589,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 a3c864a13..bea1bd2d4 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1086,6 +1086,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. */
@@ -2202,6 +2204,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
@@ -2298,7 +2327,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);
--
2.13.6
next prev parent reply other threads:[~2019-03-22 13:01 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 13:01 [dpdk-dev] [PATCH v2 0/7] " Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-22 13:01 ` Ian Stokes [this message]
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 1/7] " Ian Stokes
2019-03-25 14:26 ` Ferruh Yigit
2019-03-25 14:26 ` Ferruh Yigit
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 2/7] net/i40e: set min and max MTU for i40e devices Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 3/7] net/i40e: set min and max MTU for i40e VF devices Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 4/7] net/ixgbe: set min and max MTU for ixgbe devices Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 5/7] net/ixgbe: set min and max MTU for ixgbe VF devices Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 6/7] net/e1000: set min and max MTU for igb devices Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-25 14:25 ` Ferruh Yigit
2019-03-25 14:25 ` Ferruh Yigit
2019-03-26 13:58 ` Zhang, Qi Z
2019-03-26 13:58 ` Zhang, Qi Z
2019-03-26 14:02 ` Ananyev, Konstantin
2019-03-26 14:02 ` Ananyev, Konstantin
2019-03-26 14:09 ` Zhang, Qi Z
2019-03-26 14:09 ` Zhang, Qi Z
2019-03-26 14:18 ` Ananyev, Konstantin
2019-03-26 14:18 ` Ananyev, Konstantin
2019-03-27 1:13 ` Zhang, Qi Z
2019-03-27 1:13 ` Zhang, Qi Z
2019-03-27 7:02 ` Zhang, Qi Z
2019-03-27 7:02 ` Zhang, Qi Z
2019-03-22 13:01 ` [dpdk-dev] [PATCH v2 7/7] app/testpmd: verify mtu with rte_eth_dev_info_get() Ian Stokes
2019-03-22 13:01 ` Ian Stokes
2019-03-25 14:20 ` Ferruh Yigit
2019-03-25 14:20 ` Ferruh Yigit
2019-03-28 16:41 ` Ferruh Yigit
2019-03-28 16:41 ` Ferruh Yigit
2019-03-28 16:43 ` [dpdk-dev] [PATCH v2 0/7] ethdev: add min/max MTU to device info Ferruh Yigit
2019-03-28 16:43 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 1/7] " Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 2/7] net/i40e: set min and max MTU for i40e devices Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 3/7] net/i40e: set min and max MTU for i40e VF devices Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 4/7] net/ixgbe: set min and max MTU for ixgbe devices Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 5/7] net/ixgbe: set min and max MTU for ixgbe VF devices Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 6/7] net/e1000: set min and max MTU for igb devices Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:52 ` [dpdk-dev] [PATCH v3 7/7] app/testpmd: verify MTU with device provided limits Ferruh Yigit
2019-03-29 17:52 ` Ferruh Yigit
2019-03-29 17:56 ` [dpdk-dev] [PATCH v3 1/7] ethdev: add min/max MTU to device info Ferruh Yigit
2019-03-29 17:56 ` Ferruh Yigit
2019-03-29 18:05 ` Ferruh Yigit
2019-03-29 18:05 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553259678-4515-2-git-send-email-ian.stokes@intel.com \
--to=ian.stokes@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).