From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
Raslan Darawsheh <rasland@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
<michaelba@nvidia.com>, <stable@dpdk.org>,
Gal Shalom <galshalom@nvidia.com>
Subject: [PATCH] net/mlx5: fix detection of LRO support
Date: Wed, 27 Jul 2022 15:24:06 +0300 [thread overview]
Message-ID: <20220727122406.1609242-1-michaelba@nvidia.com> (raw)
One of the conditions to allow LRO offload is the DV configuration.
The function incorrectly checks the DV configuration before initializing
it by the user devarg; hence, LRO cannot be allowed.
This patch moves this check to mlx5_shared_dev_ctx_args_config, where DV
configuration is initialized.
Fixes: c4b862013598 ("net/mlx5: refactor to detect operation by DevX")
Cc: michaelba@nvidia.com
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Reported-by: Gal Shalom <galshalom@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 9 ---------
drivers/net/mlx5/mlx5.c | 14 ++++++++++----
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_devx.c | 2 +-
drivers/net/mlx5/mlx5_rxq.c | 6 +++---
5 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 0741028dab..1bba89d3c0 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -369,15 +369,6 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh)
"DevX does not provide UAR offset, can't create queues for packet pacing.");
sh->dev_cap.txpp_en = 0;
#endif
- /* Check for LRO support. */
- if (mlx5_devx_obj_ops_en(sh) && hca_attr->lro_cap) {
- /* TBD check tunnel lro caps. */
- sh->dev_cap.lro_supported = 1;
- DRV_LOG(DEBUG, "Device supports LRO.");
- DRV_LOG(DEBUG,
- "LRO minimal size of TCP segment required for coalescing is %d bytes.",
- hca_attr->lro_min_mss_size);
- }
sh->dev_cap.scatter_fcs_w_decap_disable =
hca_attr->scatter_fcs_w_decap_disable;
sh->dev_cap.rq_delay_drop_en = hca_attr->rq_delay_drop;
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 998846adbe..5829b66b0b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1327,6 +1327,15 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh,
DRV_LOG(WARNING,
"\"tx_skew\" doesn't affect without \"tx_pp\".");
}
+ /* Check for LRO support. */
+ if (mlx5_devx_obj_ops_en(sh) && sh->cdev->config.hca_attr.lro_cap) {
+ /* TBD check tunnel lro caps. */
+ config->lro_allowed = 1;
+ DRV_LOG(DEBUG, "LRO is allowed.");
+ DRV_LOG(DEBUG,
+ "LRO minimal size of TCP segment required for coalescing is %d bytes.",
+ sh->cdev->config.hca_attr.lro_min_mss_size);
+ }
/*
* If HW has bug working with tunnel packet decapsulation and scatter
* FCS, and decapsulation is needed, clear the hw_fcs_strip bit.
@@ -2392,10 +2401,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist,
config->mps == MLX5_MPW_ENHANCED ? "enhanced " :
config->mps == MLX5_MPW ? "legacy " : "",
config->mps != MLX5_MPW_DISABLED ? "enabled" : "disabled");
- /* LRO is supported only when DV flow enabled. */
- if (dev_cap->lro_supported && !priv->sh->config.dv_flow_en)
- dev_cap->lro_supported = 0;
- if (dev_cap->lro_supported) {
+ if (priv->sh->config.lro_allowed) {
/*
* If LRO timeout is not configured by application,
* use the minimal supported value.
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 8af84aef50..a56ee83d99 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -151,7 +151,6 @@ struct mlx5_dev_cap {
/* HW has bug working with tunnel packet decap and scatter FCS. */
uint32_t hw_fcs_strip:1; /* FCS stripping is supported. */
uint32_t rt_timestamp:1; /* Realtime timestamp format. */
- uint32_t lro_supported:1; /* Whether LRO is supported. */
uint32_t rq_delay_drop_en:1; /* Enable RxQ delay drop. */
uint32_t tunnel_en:3;
/* Whether tunnel stateless offloads are supported. */
@@ -308,6 +307,7 @@ struct mlx5_sh_config {
uint32_t decap_en:1; /* Whether decap will be used or not. */
uint32_t hw_fcs_strip:1; /* FCS stripping is supported. */
uint32_t allow_duplicate_pattern:1;
+ uint32_t lro_allowed:1; /* Whether LRO is allowed. */
/* Allow/Prevent the duplicate rules pattern. */
};
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 6886ae1f22..943aa8ef57 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -835,7 +835,7 @@ mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key,
if (dev->data->dev_conf.lpbk_mode)
tir_attr->self_lb_block = MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST;
if (lro) {
- MLX5_ASSERT(priv->sh->dev_cap.lro_supported);
+ MLX5_ASSERT(priv->sh->config.lro_allowed);
tir_attr->lro_timeout_period_usecs = priv->config.lro_timeout;
tir_attr->lro_max_msg_sz = priv->max_lro_msg_size;
tir_attr->lro_enable_mask =
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index eaf23d0df4..b1543b480e 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -374,7 +374,7 @@ mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev)
RTE_ETH_RX_OFFLOAD_TCP_CKSUM);
if (priv->sh->dev_cap.hw_vlan_strip)
offloads |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
- if (priv->sh->dev_cap.lro_supported)
+ if (priv->sh->config.lro_allowed)
offloads |= RTE_ETH_RX_OFFLOAD_TCP_LRO;
return offloads;
}
@@ -843,9 +843,9 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
bool is_extmem = false;
if ((offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) &&
- !priv->sh->dev_cap.lro_supported) {
+ !priv->sh->config.lro_allowed) {
DRV_LOG(ERR,
- "Port %u queue %u LRO is configured but not supported.",
+ "Port %u queue %u LRO is configured but not allowed.",
dev->data->port_id, idx);
rte_errno = EINVAL;
return -rte_errno;
--
2.25.1
next reply other threads:[~2022-07-27 12:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 12:24 Michael Baum [this message]
2022-08-15 7:29 ` Raslan Darawsheh
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=20220727122406.1609242-1-michaelba@nvidia.com \
--to=michaelba@nvidia.com \
--cc=dev@dpdk.org \
--cc=galshalom@nvidia.com \
--cc=matan@nvidia.com \
--cc=rasland@nvidia.com \
--cc=stable@dpdk.org \
--cc=viacheslavo@nvidia.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).