Skip to content

Commit

Permalink
net/mlx5: fix MPRQ stride size check
Browse files Browse the repository at this point in the history
[ upstream commit fdee0f1b30ae8dfc431465878aae5295372cca6f ]

We should only check that MPRQ stride size is bigger than the mbuf size
in case no devarg configuration has been provided. Headroom check was
indtroduced recently and removed this condition inadvertently.
Restore this condition and only check if mprq_log_stride_size is not set.

Fixes: e6479f009fbd ("net/mlx5: fix MPRQ stride size for headroom")

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
aleks-kozyrev authored and bluca committed Nov 15, 2023
1 parent 205f034 commit 10bc79a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion drivers/net/mlx5/linux/mlx5_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +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;
config->mprq.log_stride_size = MLX5_ARG_UNSET;
if (config->devx) {
config->mprq.log_min_stride_wqe_size =
config->hca_attr.log_min_stride_wqe_sz;
Expand Down
25 changes: 14 additions & 11 deletions drivers/net/mlx5/mlx5_rxq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,18 +1447,19 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
*actual_log_stride_num = config->mprq.log_stride_num;
}
/* 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));
if (config->mprq.log_stride_size != (uint32_t)MLX5_ARG_UNSET) {
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;
}
} 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) {
/* Make the stride fit the mbuf size by default. */
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 adjusted to match the mbuf size (%u)",
Expand Down Expand Up @@ -1517,6 +1518,8 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
" min_stride_sz = %u, max_stride_sz = %u).\n"
"Rx segment is %senabled. External mempool is %sused.",
dev->data->port_id, min_mbuf_size, desc, priv->rxqs_n,
config->mprq.log_stride_size == (uint32_t)MLX5_ARG_UNSET ?
RTE_BIT32(MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) :
RTE_BIT32(config->mprq.log_stride_size),
RTE_BIT32(config->mprq.log_stride_num),
config->mprq.min_rxqs_num,
Expand Down

0 comments on commit 10bc79a

Please sign in to comment.