summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2019-07-24 12:05:10 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2019-07-24 18:05:07 +0200
commita88209b04c774b2c72bfb6f288dff4bc01fc9a8b (patch)
tree1b78ab846ceeae1ccb9f24148d768ec6d19ee26e
parent94f00800d78b41c119f213a27ad4a8e1e3c78922 (diff)
downloaddpdk-a88209b04c774b2c72bfb6f288dff4bc01fc9a8b.zip
dpdk-a88209b04c774b2c72bfb6f288dff4bc01fc9a8b.tar.gz
dpdk-a88209b04c774b2c72bfb6f288dff4bc01fc9a8b.tar.xz
net/mlx5: fix doorbell release on Rx queue release
Function mlx5_rxq_release() calls mlx5_release_dbr() to release the doorbell allocated for this Rx queue. This call is relevant only for Rx queue objects created using DevX API. This patch adds the required check, to call mlx5_release_dbr() only when relevant. It also updates mlx5_release_dbr() to use the input offset correctly. Fixes: dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX") Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5.c1
-rw-r--r--drivers/net/mlx5/mlx5_rxq.c6
-rw-r--r--drivers/net/mlx5/mlx5_rxtx.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 617f5ee..ad0883d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1460,6 +1460,7 @@ mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id, uint64_t offset)
rte_free(page);
} else {
/* Mark in bitmap that this door-bell is not in use. */
+ offset /= MLX5_DBR_SIZE;
int i = offset / 64;
int j = offset % 64;
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index b225055..c9df8b0 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1242,6 +1242,7 @@ mlx5_rxq_obj_new(struct rte_eth_dev *dev, uint16_t idx,
goto error;
rxq_ctrl->dbr_offset = dbr_offset;
rxq_ctrl->dbr_umem_id = dbr_page->umem->umem_id;
+ rxq_ctrl->dbr_umem_id_valid = 1;
rxq_data->rq_db = (uint32_t *)((uintptr_t)dbr_page->dbrs +
(uintptr_t)rxq_ctrl->dbr_offset);
}
@@ -1829,8 +1830,9 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
if (rxq_ctrl->obj && !mlx5_rxq_obj_release(rxq_ctrl->obj))
rxq_ctrl->obj = NULL;
if (rte_atomic32_dec_and_test(&rxq_ctrl->refcnt)) {
- claim_zero(mlx5_release_dbr(dev, rxq_ctrl->dbr_umem_id,
- rxq_ctrl->dbr_offset));
+ if (rxq_ctrl->dbr_umem_id_valid)
+ claim_zero(mlx5_release_dbr(dev, rxq_ctrl->dbr_umem_id,
+ rxq_ctrl->dbr_offset));
mlx5_mr_btree_free(&rxq_ctrl->rxq.mr_ctrl.cache_bh);
LIST_REMOVE(rxq_ctrl, next);
rte_free(rxq_ctrl);
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 928d6c3..60d871c 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -184,6 +184,7 @@ struct mlx5_rxq_ctrl {
struct mlx5_priv *priv; /* Back pointer to private data. */
unsigned int socket; /* CPU socket ID for allocations. */
unsigned int irq:1; /* Whether IRQ is enabled. */
+ unsigned int dbr_umem_id_valid:1; /* dbr_umem_id holds a valid value. */
uint32_t flow_mark_n; /* Number of Mark/Flag flows using this Queue. */
uint32_t flow_tunnels_n[MLX5_FLOW_TUNNEL]; /* Tunnels counters. */
uint32_t wqn; /* WQ number. */