* [PATCH 20.11] net/mlx5: fix MPRQ stride size to accommodate the headroom
@ 2023-07-21 14:47 Alexander Kozyrev
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Kozyrev @ 2023-07-21 14:47 UTC (permalink / raw)
To: stable; +Cc: viacheslavo, luca.boccassi, ktraynor
[ upstream commit e6479f009fbd9c8e873807cc928dcf91a151aba9 ]
The space for the headroom is reserved at the end of every MPRQ stride
for the next packet. The Rx burst logic is to copy any overlapping
packet data if there is an overlap with this reserved headroom space.
But it is not possible if the headroom size is bigger than the whole
stride. Adjust the stride size to make sure the stride size is greater
than the headroom size.
Fixes: 34776af600 ("net/mlx5: fix MPRQ stride devargs adjustment")
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 1 +
drivers/net/mlx5/mlx5_rxq.c | 41 ++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index e79b1a275c..ab69ee21ad 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1202,6 +1202,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
config->mprq.log_min_stride_wqe_size =
MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE;
config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM;
+ config->mprq.log_stride_size = MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE;
if (config->devx) {
config->mprq.log_min_stride_wqe_size =
config->hca_attr.log_min_stride_wqe_sz;
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 47db585042..4a8fc8721d 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1446,23 +1446,38 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
} else {
*actual_log_stride_num = config->mprq.log_stride_num;
}
- if (config->mprq.log_stride_size) {
- /* Checks if chosen size of stride is in supported range. */
- if (config->mprq.log_stride_size > log_max_stride_size ||
- config->mprq.log_stride_size < log_min_stride_size) {
- *actual_log_stride_size = log_def_stride_size;
+ /* Checks if chosen size of stride is in supported range. */
+ if (config->mprq.log_stride_size > log_max_stride_size ||
+ config->mprq.log_stride_size < log_min_stride_size) {
+ *actual_log_stride_size = log_def_stride_size;
+ DRV_LOG(WARNING,
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
+ dev->data->port_id, idx,
+ RTE_BIT32(log_def_stride_size));
+ } else {
+ *actual_log_stride_size = config->mprq.log_stride_size;
+ }
+ /* Make the stride fit the mbuf size by default. */
+ if (*actual_log_stride_size == MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) {
+ if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) {
DRV_LOG(WARNING,
- "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
- dev->data->port_id, idx,
- RTE_BIT32(log_def_stride_size));
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to match the mbuf size (%u)",
+ dev->data->port_id, idx, min_mbuf_size);
+ *actual_log_stride_size = log2above(min_mbuf_size);
} else {
- *actual_log_stride_size = config->mprq.log_stride_size;
+ goto unsupport;
}
- } else {
- if (min_mbuf_size <= RTE_BIT32(log_max_stride_size))
- *actual_log_stride_size = log2above(min_mbuf_size);
- else
+ }
+ /* Make sure the stride size is greater than the headroom. */
+ if (RTE_BIT32(*actual_log_stride_size) < RTE_PKTMBUF_HEADROOM) {
+ if (RTE_BIT32(log_max_stride_size) > RTE_PKTMBUF_HEADROOM) {
+ DRV_LOG(WARNING,
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to accommodate the headroom (%u)",
+ dev->data->port_id, idx, RTE_PKTMBUF_HEADROOM);
+ *actual_log_stride_size = log2above(RTE_PKTMBUF_HEADROOM);
+ } else {
goto unsupport;
+ }
}
log_stride_wqe_size = *actual_log_stride_num + *actual_log_stride_size;
/* Check if WQE buffer size is supported by hardware. */
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 20.11] net/mlx5: fix MPRQ stride size to accommodate the headroom
@ 2023-07-20 13:21 Alexander Kozyrev
2023-07-21 14:01 ` Kevin Traynor
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kozyrev @ 2023-07-20 13:21 UTC (permalink / raw)
To: stable; +Cc: viacheslavo, luca.boccassi
[ upstream commit 562944444959948e22516d3891afc026bcac03c0 ]
The space for the headroom is reserved at the end of every MPRQ stride
for the next packet. The Rx burst logic is to copy any overlapping
packet data if there is an overlap with this reserved headroom space.
But it is not possible if the headroom size is bigger than the whole
stride. Adjust the stride size to make sure the stride size is greater
than the headroom size.
Fixes: b6b775f223 ("net/mlx5: fix MPRQ stride devargs adjustment")
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 1 +
drivers/net/mlx5/mlx5_rxq.c | 41 ++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index e79b1a275c..ab69ee21ad 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1202,6 +1202,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
config->mprq.log_min_stride_wqe_size =
MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE;
config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM;
+ config->mprq.log_stride_size = MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE;
if (config->devx) {
config->mprq.log_min_stride_wqe_size =
config->hca_attr.log_min_stride_wqe_sz;
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 47db585042..4a8fc8721d 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1446,23 +1446,38 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
} else {
*actual_log_stride_num = config->mprq.log_stride_num;
}
- if (config->mprq.log_stride_size) {
- /* Checks if chosen size of stride is in supported range. */
- if (config->mprq.log_stride_size > log_max_stride_size ||
- config->mprq.log_stride_size < log_min_stride_size) {
- *actual_log_stride_size = log_def_stride_size;
+ /* Checks if chosen size of stride is in supported range. */
+ if (config->mprq.log_stride_size > log_max_stride_size ||
+ config->mprq.log_stride_size < log_min_stride_size) {
+ *actual_log_stride_size = log_def_stride_size;
+ DRV_LOG(WARNING,
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
+ dev->data->port_id, idx,
+ RTE_BIT32(log_def_stride_size));
+ } else {
+ *actual_log_stride_size = config->mprq.log_stride_size;
+ }
+ /* Make the stride fit the mbuf size by default. */
+ if (*actual_log_stride_size == MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) {
+ if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) {
DRV_LOG(WARNING,
- "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
- dev->data->port_id, idx,
- RTE_BIT32(log_def_stride_size));
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to match the mbuf size (%u)",
+ dev->data->port_id, idx, min_mbuf_size);
+ *actual_log_stride_size = log2above(min_mbuf_size);
} else {
- *actual_log_stride_size = config->mprq.log_stride_size;
+ goto unsupport;
}
- } else {
- if (min_mbuf_size <= RTE_BIT32(log_max_stride_size))
- *actual_log_stride_size = log2above(min_mbuf_size);
- else
+ }
+ /* Make sure the stride size is greater than the headroom. */
+ if (RTE_BIT32(*actual_log_stride_size) < RTE_PKTMBUF_HEADROOM) {
+ if (RTE_BIT32(log_max_stride_size) > RTE_PKTMBUF_HEADROOM) {
+ DRV_LOG(WARNING,
+ "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to accommodate the headroom (%u)",
+ dev->data->port_id, idx, RTE_PKTMBUF_HEADROOM);
+ *actual_log_stride_size = log2above(RTE_PKTMBUF_HEADROOM);
+ } else {
goto unsupport;
+ }
}
log_stride_wqe_size = *actual_log_stride_num + *actual_log_stride_size;
/* Check if WQE buffer size is supported by hardware. */
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 20.11] net/mlx5: fix MPRQ stride size to accommodate the headroom
2023-07-20 13:21 Alexander Kozyrev
@ 2023-07-21 14:01 ` Kevin Traynor
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Traynor @ 2023-07-21 14:01 UTC (permalink / raw)
To: Alexander Kozyrev, stable; +Cc: viacheslavo, luca.boccassi, Xueming(Steven) Li
Hi Alexander,
On 20/07/2023 14:21, Alexander Kozyrev wrote:
> [ upstream commit 562944444959948e22516d3891afc026bcac03c0 ]
>
This commit ^^^ is not on dpdk main branch? Shouldn't this be:
[ upstream commit e6479f009fbd9c8e873807cc928dcf91a151aba9 ]
> The space for the headroom is reserved at the end of every MPRQ stride
> for the next packet. The Rx burst logic is to copy any overlapping
> packet data if there is an overlap with this reserved headroom space.
> But it is not possible if the headroom size is bigger than the whole
> stride. Adjust the stride size to make sure the stride size is greater
> than the headroom size.
>
> Fixes: b6b775f223 ("net/mlx5: fix MPRQ stride devargs adjustment")
>
This ^^^ is the 20.11 branch commit id. As this series of fixes are
backported from dpdk main it is better to use dpdk main commit ids for
'Fixes:' so that we can trace history of fixes easier.
The only exception is if there was something committed to 20.11 but not
dpdk main which is very rare.
Probably Luca can update when he is merging.
For 21.11 branch, neither the dpdk main or 20.11 patches apply. If you
could send a backport for 21.11 that would be great. Not sure if it's
needed for 22.11, Xueming will let you know. Thanks.
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
> drivers/net/mlx5/linux/mlx5_os.c | 1 +
> drivers/net/mlx5/mlx5_rxq.c | 41 ++++++++++++++++++++++----------
> 2 files changed, 29 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
> index e79b1a275c..ab69ee21ad 100644
> --- a/drivers/net/mlx5/linux/mlx5_os.c
> +++ b/drivers/net/mlx5/linux/mlx5_os.c
> @@ -1202,6 +1202,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
> config->mprq.log_min_stride_wqe_size =
> MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE;
> config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM;
> + config->mprq.log_stride_size = MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE;
> if (config->devx) {
> config->mprq.log_min_stride_wqe_size =
> config->hca_attr.log_min_stride_wqe_sz;
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 47db585042..4a8fc8721d 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -1446,23 +1446,38 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
> } else {
> *actual_log_stride_num = config->mprq.log_stride_num;
> }
> - if (config->mprq.log_stride_size) {
> - /* Checks if chosen size of stride is in supported range. */
> - if (config->mprq.log_stride_size > log_max_stride_size ||
> - config->mprq.log_stride_size < log_min_stride_size) {
> - *actual_log_stride_size = log_def_stride_size;
> + /* Checks if chosen size of stride is in supported range. */
> + if (config->mprq.log_stride_size > log_max_stride_size ||
> + config->mprq.log_stride_size < log_min_stride_size) {
> + *actual_log_stride_size = log_def_stride_size;
> + DRV_LOG(WARNING,
> + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
> + dev->data->port_id, idx,
> + RTE_BIT32(log_def_stride_size));
> + } else {
> + *actual_log_stride_size = config->mprq.log_stride_size;
> + }
> + /* Make the stride fit the mbuf size by default. */
> + if (*actual_log_stride_size == MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) {
> + if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) {
> DRV_LOG(WARNING,
> - "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)",
> - dev->data->port_id, idx,
> - RTE_BIT32(log_def_stride_size));
> + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to match the mbuf size (%u)",
> + dev->data->port_id, idx, min_mbuf_size);
> + *actual_log_stride_size = log2above(min_mbuf_size);
> } else {
> - *actual_log_stride_size = config->mprq.log_stride_size;
> + goto unsupport;
> }
> - } else {
> - if (min_mbuf_size <= RTE_BIT32(log_max_stride_size))
> - *actual_log_stride_size = log2above(min_mbuf_size);
> - else
> + }
> + /* Make sure the stride size is greater than the headroom. */
> + if (RTE_BIT32(*actual_log_stride_size) < RTE_PKTMBUF_HEADROOM) {
> + if (RTE_BIT32(log_max_stride_size) > RTE_PKTMBUF_HEADROOM) {
> + DRV_LOG(WARNING,
> + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to accommodate the headroom (%u)",
> + dev->data->port_id, idx, RTE_PKTMBUF_HEADROOM);
> + *actual_log_stride_size = log2above(RTE_PKTMBUF_HEADROOM);
> + } else {
> goto unsupport;
> + }
> }
> log_stride_wqe_size = *actual_log_stride_num + *actual_log_stride_size;
> /* Check if WQE buffer size is supported by hardware. */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-21 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 14:47 [PATCH 20.11] net/mlx5: fix MPRQ stride size to accommodate the headroom Alexander Kozyrev
-- strict thread matches above, loose matches on Subject: below --
2023-07-20 13:21 Alexander Kozyrev
2023-07-21 14:01 ` Kevin Traynor
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).