summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2019-07-29 11:53:23 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-07-29 16:54:27 +0200
commitb7d1e5d4d1ab318ade8e3acd1b2bb68ae6e92120 (patch)
tree6b4330cfdb72f5955d502cb33d9100cc859e9e95
parentbe39124e5b708bbf6ffe9c870ea3a6a6156e15b0 (diff)
downloaddpdk-next-eventdev-b7d1e5d4d1ab318ade8e3acd1b2bb68ae6e92120.zip
dpdk-next-eventdev-b7d1e5d4d1ab318ade8e3acd1b2bb68ae6e92120.tar.gz
dpdk-next-eventdev-b7d1e5d4d1ab318ade8e3acd1b2bb68ae6e92120.tar.xz
net/mlx5: fix DevX scattered Rx queue size
The WQ size configuration via DevX didn't take into account the maximum number of segments per packet what wrongly caused to configure bigger WQE size than the size expected by the PMD in other places. The scatter mode stride size should be the size of segment multiplied by the number of maximum segments per packet. The number of WQEs per WQ should be the number of descriptors divided by the number of the maximum segments per packet. Fix the size calculations to the above rule. Fixes: dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX") Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5_rxq.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index d10c5c1..c95627e 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1090,7 +1090,7 @@ mlx5_devx_rq_new(struct rte_eth_dev *dev, uint16_t idx, uint32_t cqn)
struct mlx5_rxq_ctrl *rxq_ctrl =
container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
struct mlx5_devx_create_rq_attr rq_attr;
- uint32_t wqe_n = 1 << rxq_data->elts_n;
+ uint32_t wqe_n = 1 << (rxq_data->elts_n - rxq_data->sges_n);
uint32_t wq_size = 0;
uint32_t wqe_size = 0;
uint32_t log_wqe_size = 0;
@@ -1118,17 +1118,11 @@ mlx5_devx_rq_new(struct rte_eth_dev *dev, uint16_t idx, uint32_t cqn)
MLX5_MIN_SINGLE_STRIDE_LOG_NUM_BYTES;
wqe_size = sizeof(struct mlx5_wqe_mprq);
} else {
- int max_sge = 0;
- int num_scatter = 0;
-
- rq_attr.wq_attr.wq_type = MLX5_WQ_TYPE_CYCLIC;
- max_sge = 1 << rxq_data->sges_n;
- num_scatter = RTE_MAX(max_sge, 1);
- wqe_size = sizeof(struct mlx5_wqe_data_seg) * num_scatter;
+ wqe_size = sizeof(struct mlx5_wqe_data_seg);
}
- log_wqe_size = log2above(wqe_size);
+ log_wqe_size = log2above(wqe_size) + rxq_data->sges_n;
rq_attr.wq_attr.log_wq_stride = log_wqe_size;
- rq_attr.wq_attr.log_wq_sz = rxq_data->elts_n;
+ rq_attr.wq_attr.log_wq_sz = rxq_data->elts_n - rxq_data->sges_n;
/* Calculate and allocate WQ memory space. */
wqe_size = 1 << log_wqe_size; /* round up power of two.*/
wq_size = wqe_n * wqe_size;