From: Dekel Peled <dekelp@mellanox.com>
To: john.mcnamara@intel.com, marko.kovacevic@intel.com,
nhorman@tuxdriver.com, ajit.khaparde@broadcom.com,
somnath.kotur@broadcom.com, anatoly.burakov@intel.com,
xuanziyang2@huawei.com, cloud.wangxiaoyun@huawei.com,
zhouguoyang@huawei.com, wenzhuo.lu@intel.com,
konstantin.ananyev@intel.com, matan@mellanox.com,
shahafs@mellanox.com, viacheslavo@mellanox.com,
rmody@marvell.com, shshaikh@marvell.com,
maxime.coquelin@redhat.com, tiwei.bie@intel.com,
zhihong.wang@intel.com, yongwang@vmware.com, thomas@monjalon.net,
ferruh.yigit@intel.com, arybchenko@solarflare.com,
jingjing.wu@intel.com, bernard.iremonger@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v7 1/3] ethdev: support API to set max LRO packet size
Date: Mon, 11 Nov 2019 19:47:33 +0200 [thread overview]
Message-ID: <d914f3fe6d6b12cabc8efc035417ea6f9fa9058a.1573494112.git.dekelp@mellanox.com> (raw)
In-Reply-To: <cover.1573494112.git.dekelp@mellanox.com>
This patch implements [1], to support API for configuration and
validation of max size for LRO aggregated packet.
API change notice [2] is removed, and release notes for 19.11
are updated accordingly.
[1] http://patches.dpdk.org/patch/58217/
[2] http://patches.dpdk.org/patch/57492/
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
---
doc/guides/nics/features.rst | 2 ++
doc/guides/rel_notes/deprecation.rst | 4 ---
doc/guides/rel_notes/release_19_11.rst | 8 +++++
lib/librte_ethdev/rte_ethdev.c | 59 ++++++++++++++++++++++++++++++++++
lib/librte_ethdev/rte_ethdev.h | 4 +++
5 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 7a31cf7..2138ce3 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -193,10 +193,12 @@ LRO
Supports Large Receive Offload.
* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_TCP_LRO``.
+ ``dev_conf.rxmode.max_lro_pkt_size``.
* **[implements] datapath**: ``LRO functionality``.
* **[implements] rte_eth_dev_data**: ``lro``.
* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_LRO``, ``mbuf.tso_segsz``.
* **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_TCP_LRO``.
+* **[provides] rte_eth_dev_info**: ``max_lro_pkt_size``.
.. _nic_features_tso:
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index fad208b..dbfb059 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -83,10 +83,6 @@ Deprecation Notices
This scheme will allow PMDs to avoid lookup to internal ptype table on Rx and
thereby improve Rx performance if application wishes do so.
-* ethdev: New 32-bit fields may be added for maximum LRO session size, in
- struct ``rte_eth_dev_info`` for the port capability and in struct
- ``rte_eth_rxmode`` for the port configuration.
-
* cryptodev: support for using IV with all sizes is added, J0 still can
be used but only when IV length in following structs ``rte_crypto_auth_xform``,
``rte_crypto_aead_xform`` is set to zero. When IV length is greater or equal
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index da48051..d29acbe 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -444,6 +444,14 @@ ABI Changes
* ipsec: The field ``replay_win_sz`` has been removed from the structure
``rte_ipsec_sa_prm`` as it has been added to the security library.
+* ethdev: Added 32-bit fields for maximum LRO aggregated packet size, in
+ struct ``rte_eth_dev_info`` for the port capability and in struct
+ ``rte_eth_rxmode`` for the port configuration.
+ Application should use the new field in struct ``rte_eth_rxmode`` to configure
+ the requested size.
+ PMD should use the new field in struct ``rte_eth_dev_info`` to report the
+ supported port capability.
+
Shared Library Versions
-----------------------
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 652c369..55e0e0d 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1136,6 +1136,33 @@ struct rte_eth_dev *
return name;
}
+static inline int
+check_lro_pkt_size(uint16_t port_id, uint32_t config_size,
+ uint32_t max_rx_pkt_len, uint32_t dev_info_size)
+{
+ int ret = 0;
+
+ if (dev_info_size == 0) {
+ if (config_size != max_rx_pkt_len) {
+ RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%d max_lro_pkt_size"
+ " %u != %u is not allowed\n",
+ port_id, config_size, max_rx_pkt_len);
+ ret = -EINVAL;
+ }
+ } else if (config_size > dev_info_size) {
+ RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%d max_lro_pkt_size %u "
+ "> max allowed value %u\n", port_id, config_size,
+ dev_info_size);
+ ret = -EINVAL;
+ } else if (config_size < RTE_ETHER_MIN_LEN) {
+ RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%d max_lro_pkt_size %u "
+ "< min allowed value %u\n", port_id, config_size,
+ (unsigned int)RTE_ETHER_MIN_LEN);
+ ret = -EINVAL;
+ }
+ return ret;
+}
+
int
rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
const struct rte_eth_conf *dev_conf)
@@ -1266,6 +1293,22 @@ struct rte_eth_dev *
RTE_ETHER_MAX_LEN;
}
+ /*
+ * If LRO is enabled, check that the maximum aggregated packet
+ * size is supported by the configured device.
+ */
+ if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO) {
+ if (dev_conf->rxmode.max_lro_pkt_size == 0)
+ dev->data->dev_conf.rxmode.max_lro_pkt_size =
+ dev->data->dev_conf.rxmode.max_rx_pkt_len;
+ ret = check_lro_pkt_size(port_id,
+ dev->data->dev_conf.rxmode.max_lro_pkt_size,
+ dev->data->dev_conf.rxmode.max_rx_pkt_len,
+ dev_info.max_lro_pkt_size);
+ if (ret != 0)
+ goto rollback;
+ }
+
/* Any requested offloading must be within its device capabilities */
if ((dev_conf->rxmode.offloads & dev_info.rx_offload_capa) !=
dev_conf->rxmode.offloads) {
@@ -1770,6 +1813,22 @@ struct rte_eth_dev *
return -EINVAL;
}
+ /*
+ * If LRO is enabled, check that the maximum aggregated packet
+ * size is supported by the configured device.
+ */
+ if (local_conf.offloads & DEV_RX_OFFLOAD_TCP_LRO) {
+ if (dev->data->dev_conf.rxmode.max_lro_pkt_size == 0)
+ dev->data->dev_conf.rxmode.max_lro_pkt_size =
+ dev->data->dev_conf.rxmode.max_rx_pkt_len;
+ int ret = check_lro_pkt_size(port_id,
+ dev->data->dev_conf.rxmode.max_lro_pkt_size,
+ dev->data->dev_conf.rxmode.max_rx_pkt_len,
+ dev_info.max_lro_pkt_size);
+ if (ret != 0)
+ return ret;
+ }
+
ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc,
socket_id, &local_conf, mp);
if (!ret) {
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 44d77b3..1b76df5 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -395,6 +395,8 @@ struct rte_eth_rxmode {
/** The multi-queue packet distribution mode to be used, e.g. RSS. */
enum rte_eth_rx_mq_mode mq_mode;
uint32_t max_rx_pkt_len; /**< Only used if JUMBO_FRAME enabled. */
+ /** Maximum allowed size of LRO aggregated packet. */
+ uint32_t max_lro_pkt_size;
uint16_t split_hdr_size; /**< hdr buf size (header_split enabled).*/
/**
* Per-port Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
@@ -1218,6 +1220,8 @@ struct rte_eth_dev_info {
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. */
+ /** Maximum configurable size of LRO aggregated packet. */
+ uint32_t max_lro_pkt_size;
uint16_t max_rx_queues; /**< Maximum number of RX queues. */
uint16_t max_tx_queues; /**< Maximum number of TX queues. */
uint32_t max_mac_addrs; /**< Maximum number of MAC addresses. */
--
1.8.3.1
next prev parent reply other threads:[~2019-11-11 17:47 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 8:40 [dpdk-dev] [PATCH 0/3] " Dekel Peled
2019-11-05 8:40 ` [dpdk-dev] [PATCH 1/3] ethdev: " Dekel Peled
2019-11-05 12:39 ` Andrew Rybchenko
2019-11-05 13:09 ` Thomas Monjalon
2019-11-05 14:18 ` Dekel Peled
2019-11-05 14:27 ` Andrew Rybchenko
2019-11-05 14:51 ` Dekel Peled
2019-11-05 8:40 ` [dpdk-dev] [PATCH 2/3] net/mlx5: use " Dekel Peled
2019-11-05 8:40 ` [dpdk-dev] [PATCH 3/3] app/testpmd: " Dekel Peled
2019-11-05 9:35 ` [dpdk-dev] [PATCH 0/3] support " Matan Azrad
2019-11-06 11:34 ` [dpdk-dev] [PATCH v2 " Dekel Peled
2019-11-06 11:34 ` [dpdk-dev] [PATCH v2 1/3] ethdev: " Dekel Peled
2019-11-06 12:26 ` Thomas Monjalon
2019-11-06 12:39 ` Dekel Peled
2019-11-06 11:34 ` [dpdk-dev] [PATCH v2 2/3] net/mlx5: use " Dekel Peled
2019-11-06 11:34 ` [dpdk-dev] [PATCH v2 3/3] app/testpmd: " Dekel Peled
2019-11-06 12:35 ` Iremonger, Bernard
2019-11-06 13:14 ` Dekel Peled
2019-11-06 14:28 ` [dpdk-dev] [PATCH v3 0/3] support " Dekel Peled
2019-11-06 14:28 ` [dpdk-dev] [PATCH v3 1/3] ethdev: " Dekel Peled
2019-11-07 11:57 ` [dpdk-dev] [EXT] " Shahed Shaikh
2019-11-07 12:18 ` Dekel Peled
2019-11-06 14:28 ` [dpdk-dev] [PATCH v3 2/3] net/mlx5: use " Dekel Peled
2019-11-06 14:28 ` [dpdk-dev] [PATCH v3 3/3] app/testpmd: " Dekel Peled
2019-11-06 16:41 ` [dpdk-dev] [PATCH v3 0/3] support " Iremonger, Bernard
2019-11-07 6:10 ` Dekel Peled
2019-11-07 12:35 ` [dpdk-dev] [PATCH v4 " Dekel Peled
2019-11-07 12:35 ` [dpdk-dev] [PATCH v4 1/3] ethdev: " Dekel Peled
2019-11-07 20:15 ` Ferruh Yigit
2019-11-08 6:54 ` Matan Azrad
2019-11-08 9:19 ` Ferruh Yigit
2019-11-08 10:10 ` Matan Azrad
2019-11-08 11:37 ` Ferruh Yigit
2019-11-08 11:56 ` Matan Azrad
2019-11-08 12:51 ` Ferruh Yigit
2019-11-08 16:11 ` Dekel Peled
2019-11-08 16:53 ` Ferruh Yigit
2019-11-09 18:20 ` Matan Azrad
2019-11-10 23:40 ` Ananyev, Konstantin
2019-11-11 8:01 ` Matan Azrad
2019-11-12 18:31 ` Ananyev, Konstantin
2019-11-11 11:15 ` Ferruh Yigit
2019-11-11 11:33 ` Matan Azrad
2019-11-11 12:21 ` Ferruh Yigit
2019-11-11 13:32 ` Matan Azrad
2019-11-08 13:11 ` Ananyev, Konstantin
2019-11-08 14:10 ` Dekel Peled
2019-11-08 14:52 ` Ananyev, Konstantin
2019-11-08 16:08 ` Dekel Peled
2019-11-08 16:28 ` Ananyev, Konstantin
2019-11-09 18:26 ` Matan Azrad
2019-11-10 22:51 ` Ananyev, Konstantin
2019-11-11 6:53 ` Matan Azrad
2019-11-07 12:35 ` [dpdk-dev] [PATCH v4 2/3] net/mlx5: use " Dekel Peled
2019-11-08 9:12 ` Slava Ovsiienko
2019-11-08 9:23 ` Ferruh Yigit
2019-11-07 12:35 ` [dpdk-dev] [PATCH v4 3/3] app/testpmd: " Dekel Peled
2019-11-07 14:20 ` Iremonger, Bernard
2019-11-07 20:25 ` Ferruh Yigit
2019-11-08 6:56 ` Matan Azrad
2019-11-08 13:58 ` Dekel Peled
2019-11-08 6:28 ` [dpdk-dev] [PATCH v4 0/3] support " Matan Azrad
2019-11-08 16:42 ` [dpdk-dev] [PATCH v5 " Dekel Peled
2019-11-08 16:42 ` [dpdk-dev] [PATCH v5 1/3] ethdev: " Dekel Peled
2019-11-10 23:07 ` Ananyev, Konstantin
2019-11-11 7:40 ` Dekel Peled
2019-11-08 16:42 ` [dpdk-dev] [PATCH v5 2/3] net/mlx5: use " Dekel Peled
2019-11-08 16:42 ` [dpdk-dev] [PATCH v5 3/3] app/testpmd: " Dekel Peled
2019-11-10 23:11 ` Ananyev, Konstantin
2019-11-11 7:40 ` Dekel Peled
2019-11-08 23:07 ` [dpdk-dev] [PATCH v6] ethdev: add " Thomas Monjalon
2019-11-10 22:47 ` Ananyev, Konstantin
2019-11-11 17:47 ` [dpdk-dev] [PATCH v7 0/3] support API to set " Dekel Peled
2019-11-11 17:47 ` Dekel Peled [this message]
2019-11-12 0:46 ` [dpdk-dev] [PATCH v7 1/3] ethdev: " Ferruh Yigit
2019-11-11 17:47 ` [dpdk-dev] [PATCH v7 2/3] net/mlx5: use " Dekel Peled
2019-11-11 17:47 ` [dpdk-dev] [PATCH v7 3/3] app/testpmd: " Dekel Peled
2019-11-12 0:46 ` Ferruh Yigit
2019-11-12 0:47 ` [dpdk-dev] [PATCH v7 0/3] support " 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=d914f3fe6d6b12cabc8efc035417ea6f9fa9058a.1573494112.git.dekelp@mellanox.com \
--to=dekelp@mellanox.com \
--cc=ajit.khaparde@broadcom.com \
--cc=anatoly.burakov@intel.com \
--cc=arybchenko@solarflare.com \
--cc=bernard.iremonger@intel.com \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jingjing.wu@intel.com \
--cc=john.mcnamara@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=marko.kovacevic@intel.com \
--cc=matan@mellanox.com \
--cc=maxime.coquelin@redhat.com \
--cc=nhorman@tuxdriver.com \
--cc=rmody@marvell.com \
--cc=shahafs@mellanox.com \
--cc=shshaikh@marvell.com \
--cc=somnath.kotur@broadcom.com \
--cc=thomas@monjalon.net \
--cc=tiwei.bie@intel.com \
--cc=viacheslavo@mellanox.com \
--cc=wenzhuo.lu@intel.com \
--cc=xuanziyang2@huawei.com \
--cc=yongwang@vmware.com \
--cc=zhihong.wang@intel.com \
--cc=zhouguoyang@huawei.com \
/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).