summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_rxq.c
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro <nelio.laranjeiro@6wind.com>2018-03-05 13:21:05 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2018-03-30 14:08:44 +0200
commit925061b58b487fba57f55847b1447417fed715fb (patch)
treec7b075f870f6378697376d372fb85d490d08553e /drivers/net/mlx5/mlx5_rxq.c
parentaf4f09f28294fac762ff413fbf14b48c42c128fd (diff)
downloaddpdk-925061b58b487fba57f55847b1447417fed715fb.zip
dpdk-925061b58b487fba57f55847b1447417fed715fb.tar.gz
dpdk-925061b58b487fba57f55847b1447417fed715fb.tar.xz
net/mlx5: change non failing function return values
These functions return int although they are not supposed to fail, resulting in unnecessary checks in their callers. Some are returning error where is should be a boolean. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_rxq.c')
-rw-r--r--drivers/net/mlx5/mlx5_rxq.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index a3b08a1..8e7693d 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -840,7 +840,7 @@ mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx)
* Verbs Rx queue object.
*
* @return
- * 0 on success, errno value on failure.
+ * 1 while a reference on it exists, 0 when freed.
*/
int
mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv)
@@ -867,7 +867,7 @@ mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv)
rte_free(rxq_ibv);
return 0;
}
- return EBUSY;
+ return 1;
}
/**
@@ -1074,7 +1074,7 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx)
* TX queue index.
*
* @return
- * 0 on success, errno value on failure.
+ * 1 while a reference on it exists, 0 when freed.
*/
int
mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
@@ -1086,13 +1086,8 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
return 0;
rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq);
assert(rxq_ctrl->priv);
- if (rxq_ctrl->ibv) {
- int ret;
-
- ret = mlx5_rxq_ibv_release(rxq_ctrl->ibv);
- if (!ret)
- rxq_ctrl->ibv = NULL;
- }
+ if (rxq_ctrl->ibv && !mlx5_rxq_ibv_release(rxq_ctrl->ibv))
+ rxq_ctrl->ibv = NULL;
DEBUG("%p: Rx queue %p: refcnt %d", (void *)dev,
(void *)rxq_ctrl, rte_atomic32_read(&rxq_ctrl->refcnt));
if (rte_atomic32_dec_and_test(&rxq_ctrl->refcnt)) {
@@ -1101,7 +1096,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
(*priv->rxqs)[idx] = NULL;
return 0;
}
- return EBUSY;
+ return 1;
}
/**
@@ -1261,7 +1256,7 @@ mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, uint16_t queues[],
* Indirection table to release.
*
* @return
- * 0 on success, errno value on failure.
+ * 1 while a reference on it exists, 0 when freed.
*/
int
mlx5_ind_table_ibv_release(struct rte_eth_dev *dev,
@@ -1281,7 +1276,7 @@ mlx5_ind_table_ibv_release(struct rte_eth_dev *dev,
rte_free(ind_tbl);
return 0;
}
- return EBUSY;
+ return 1;
}
/**
@@ -1439,7 +1434,7 @@ mlx5_hrxq_get(struct rte_eth_dev *dev, uint8_t *rss_key, uint8_t rss_key_len,
* Pointer to Hash Rx queue to release.
*
* @return
- * 0 on success, errno value on failure.
+ * 1 while a reference on it exists, 0 when freed.
*/
int
mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)
@@ -1454,7 +1449,7 @@ mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)
return 0;
}
claim_nonzero(mlx5_ind_table_ibv_release(dev, hrxq->ind_table));
- return EBUSY;
+ return 1;
}
/**