* [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files @ 2019-04-29 11:00 Dekel Peled 2019-04-29 11:00 ` Dekel Peled ` (6 more replies) 0 siblings, 7 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: add missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 157 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions Dekel Peled ` (5 subsequent siblings) 6 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: add missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 157 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-04-29 11:00 ` Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer Dekel Peled ` (4 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a10dc1e..49ac0df 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1116,19 +1098,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1bf90ed..81e4f82 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -313,7 +310,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 400f673..13d0447 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -664,19 +664,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions 2019-04-29 11:00 ` [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a10dc1e..49ac0df 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1116,19 +1098,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1bf90ed..81e4f82 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -313,7 +310,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 400f673..13d0447 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -664,19 +664,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value Dekel Peled ` (3 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the missing validation where it is missing. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 49ac0df..d4b94b5 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -602,7 +602,8 @@ */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer 2019-04-29 11:00 ` [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the missing validation where it is missing. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 49ac0df..d4b94b5 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -602,7 +602,8 @@ */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (2 preceding siblings ...) 2019-04-29 11:00 ` [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static Dekel Peled ` (2 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index d4b94b5..ffca777 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1531,8 +1531,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value 2019-04-29 11:00 ` [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index d4b94b5..ffca777 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1531,8 +1531,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (3 preceding siblings ...) 2019-04-29 11:00 ` [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-05-02 14:10 ` [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ffca777..50889ef 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -403,6 +403,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -490,6 +517,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1017,64 +1101,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1523,33 +1549,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1586,7 +1585,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1650,7 +1649,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1685,7 +1684,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1969,7 +1968,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2029,7 +2028,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2052,7 +2051,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2095,7 +2094,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 81e4f82..bcafeef 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static 2019-04-29 11:00 ` [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-04-29 11:00 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-04-29 11:00 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ffca777..50889ef 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -403,6 +403,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -490,6 +517,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1017,64 +1101,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1523,33 +1549,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1586,7 +1585,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1650,7 +1649,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1685,7 +1684,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1969,7 +1968,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2029,7 +2028,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2052,7 +2051,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2095,7 +2094,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 81e4f82..bcafeef 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (4 preceding siblings ...) 2019-04-29 11:00 ` [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-02 14:10 ` Shahaf Shuler 2019-05-02 14:10 ` Shahaf Shuler 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled 6 siblings, 1 reply; 53+ messages in thread From: Shahaf Shuler @ 2019-05-02 14:10 UTC (permalink / raw) To: Dekel Peled, Yongseok Koh; +Cc: dev Hi Dekel, Monday, April 29, 2019 2:01 PM, Dekel Peled: > Subject: [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files > > During work on Rx feature I did some cleanup actions. > This series includes those changes divided by their type. Good cleanup. I am basically OK w/ the series, you can add my Acked-by to next version. See small comment below. > > Dekel Peled (4): > net/mlx5: remove unused functions > net/mlx5: add missing validation of null pointer This one should be "fix ..." and not "add ..." + Cc for stable. Since you actually fix a possible segfault. > net/mlx5: fix description of function return value > net/mlx5: move locally used functions to static > > drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------- > ----- > drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 -- > - > 3 files changed, 94 insertions(+), 157 deletions(-) > > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-02 14:10 ` [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler @ 2019-05-02 14:10 ` Shahaf Shuler 0 siblings, 0 replies; 53+ messages in thread From: Shahaf Shuler @ 2019-05-02 14:10 UTC (permalink / raw) To: Dekel Peled, Yongseok Koh; +Cc: dev Hi Dekel, Monday, April 29, 2019 2:01 PM, Dekel Peled: > Subject: [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files > > During work on Rx feature I did some cleanup actions. > This series includes those changes divided by their type. Good cleanup. I am basically OK w/ the series, you can add my Acked-by to next version. See small comment below. > > Dekel Peled (4): > net/mlx5: remove unused functions > net/mlx5: add missing validation of null pointer This one should be "fix ..." and not "add ..." + Cc for stable. Since you actually fix a possible segfault. > net/mlx5: fix description of function return value > net/mlx5: move locally used functions to static > > drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------- > ----- > drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 -- > - > 3 files changed, 94 insertions(+), 157 deletions(-) > > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] net/mlx5: code cleanup in rx and tx files 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (5 preceding siblings ...) 2019-05-02 14:10 ` [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` Dekel Peled ` (5 more replies) 6 siblings, 6 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: change 2nd patch type to "fix" --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 157 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions Dekel Peled ` (4 subsequent siblings) 5 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: change 2nd patch type to "fix" --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 157 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled 2019-05-02 15:01 ` Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled ` (3 subsequent siblings) 5 siblings, 2 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 54438a4..db8c340 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -368,24 +368,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1131,19 +1113,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 0d88375..1732e32 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -314,7 +311,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 0b6c247..2cdb1d3 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -668,19 +668,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 1 sibling, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 54438a4..db8c340 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -368,24 +368,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1131,19 +1113,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 0d88375..1732e32 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -314,7 +311,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 0b6c247..2cdb1d3 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -668,19 +668,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions Dekel Peled 2019-05-02 15:01 ` Dekel Peled @ 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 18:13 ` Yongseok Koh 1 sibling, 1 reply; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:13 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Functions implemented but never called: > mlx5_rxq_ibv_releasable() > mlx5_rxq_cleanup() > mlx5_txq_ibv_releasable() > > Function declared but not implemented: > rxq_alloc_mprq_buf() > > This patch removes these functions from code and header file. > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- > drivers/net/mlx5/mlx5_rxtx.h | 4 ---- > drivers/net/mlx5/mlx5_txq.c | 13 ------------- > 3 files changed, 48 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index 54438a4..db8c340 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -368,24 +368,6 @@ > } > > /** > - * Clean up a RX queue. > - * > - * Destroy objects, free allocated memory and reset the structure for reuse. > - * > - * @param rxq_ctrl > - * Pointer to RX queue structure. > - */ > -void > -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) > -{ > - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", > - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); > - if (rxq_ctrl->ibv) > - mlx5_rxq_ibv_release(rxq_ctrl->ibv); > - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); > -} > - > -/** > * Returns the per-queue supported offloads. > * > * @param dev > @@ -1131,19 +1113,6 @@ struct mlx5_rxq_ibv * > } > > /** > - * Return true if a single reference exists on the object. > - * > - * @param rxq_ibv > - * Verbs Rx queue object. > - */ > -int > -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) > -{ > - assert(rxq_ibv); > - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); > -} > - > -/** > * Callback function to initialize mbufs for Multi-Packet RQ. > */ > static inline void > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index 0d88375..1732e32 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { > int mlx5_mprq_enabled(struct rte_eth_dev *dev); > int mlx5_mprq_free_mp(struct rte_eth_dev *dev); > int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); > -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); > int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > unsigned int socket, const struct rte_eth_rxconf *conf, > struct rte_mempool *mp); > @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); > -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); > void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); > int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); > @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_verify(struct rte_eth_dev *dev); > int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); > -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); > struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, > const uint16_t *queues, > uint32_t queues_n); > @@ -314,7 +311,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); > -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); > int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); > struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, > uint16_t desc, unsigned int socket, > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index 0b6c247..2cdb1d3 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -668,19 +668,6 @@ struct mlx5_txq_ibv * > } > > /** > - * Return true if a single reference exists on the object. > - * > - * @param txq_ibv > - * Verbs Tx queue object. > - */ > -int > -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) > -{ > - assert(txq_ibv); > - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); > -} > - > -/** > * Verify the Verbs Tx queue list is empty > * > * @param dev > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions 2019-05-02 18:13 ` Yongseok Koh @ 2019-05-02 18:13 ` Yongseok Koh 0 siblings, 0 replies; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:13 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Functions implemented but never called: > mlx5_rxq_ibv_releasable() > mlx5_rxq_cleanup() > mlx5_txq_ibv_releasable() > > Function declared but not implemented: > rxq_alloc_mprq_buf() > > This patch removes these functions from code and header file. > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- > drivers/net/mlx5/mlx5_rxtx.h | 4 ---- > drivers/net/mlx5/mlx5_txq.c | 13 ------------- > 3 files changed, 48 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index 54438a4..db8c340 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -368,24 +368,6 @@ > } > > /** > - * Clean up a RX queue. > - * > - * Destroy objects, free allocated memory and reset the structure for reuse. > - * > - * @param rxq_ctrl > - * Pointer to RX queue structure. > - */ > -void > -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) > -{ > - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", > - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); > - if (rxq_ctrl->ibv) > - mlx5_rxq_ibv_release(rxq_ctrl->ibv); > - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); > -} > - > -/** > * Returns the per-queue supported offloads. > * > * @param dev > @@ -1131,19 +1113,6 @@ struct mlx5_rxq_ibv * > } > > /** > - * Return true if a single reference exists on the object. > - * > - * @param rxq_ibv > - * Verbs Rx queue object. > - */ > -int > -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) > -{ > - assert(rxq_ibv); > - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); > -} > - > -/** > * Callback function to initialize mbufs for Multi-Packet RQ. > */ > static inline void > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index 0d88375..1732e32 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -251,7 +251,6 @@ struct mlx5_txq_ctrl { > int mlx5_mprq_enabled(struct rte_eth_dev *dev); > int mlx5_mprq_free_mp(struct rte_eth_dev *dev); > int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); > -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); > int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > unsigned int socket, const struct rte_eth_rxconf *conf, > struct rte_mempool *mp); > @@ -263,7 +262,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); > -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); > void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); > int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); > @@ -276,7 +274,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_verify(struct rte_eth_dev *dev); > int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); > -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); > struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, > const uint16_t *queues, > uint32_t queues_n); > @@ -314,7 +311,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); > -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); > int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); > struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, > uint16_t desc, unsigned int socket, > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index 0b6c247..2cdb1d3 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -668,19 +668,6 @@ struct mlx5_txq_ibv * > } > > /** > - * Return true if a single reference exists on the object. > - * > - * @param txq_ibv > - * Verbs Tx queue object. > - */ > -int > -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) > -{ > - assert(txq_ibv); > - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); > -} > - > -/** > * Verify the Verbs Tx queue list is empty > * > * @param dev > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:12 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value Dekel Peled ` (2 subsequent siblings) 5 siblings, 2 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the missing validation where it is missing. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index db8c340..c9c2a14 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -617,7 +617,8 @@ */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:12 ` Yongseok Koh 1 sibling, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the missing validation where it is missing. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index db8c340..c9c2a14 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -617,7 +617,8 @@ */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled 2019-05-02 15:01 ` Dekel Peled @ 2019-05-02 18:12 ` Yongseok Koh 2019-05-02 18:12 ` Yongseok Koh 1 sibling, 1 reply; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:12 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev, stable > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Function mlx5_rxq_ibv_release() is called in several places. > Before each call except one, the input parameter is validated to make > sure it is not null. > > This patch adds the missing validation where it is missing. > > Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") > Cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- > drivers/net/mlx5/mlx5_rxq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index db8c340..c9c2a14 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -617,7 +617,8 @@ > */ > rxq_data = (*priv->rxqs)[i]; > rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > - mlx5_rxq_ibv_release(rxq_ctrl->ibv); > + if (rxq_ctrl->ibv) > + mlx5_rxq_ibv_release(rxq_ctrl->ibv); Please take care of two more things. 1) In mlx5_rx_intr_disable(), mlx5_rxq_ibv_get() isn't paired with mlx5_rxq_ibv_release() This would need a separate patch. 2) In mlx5_rx_intr_vec_disable() Please fix the comment having the old name - priv_rx_intr_vec_enable(). This should be mlx5_rx_intr_vec_enable() No need to have a separate patch. You can fix it in this patch. With the change, Acked-by: Yongseok Koh <yskoh@mellanox.com> > } > free: > rte_intr_free_epoll_fd(intr_handle); > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer 2019-05-02 18:12 ` Yongseok Koh @ 2019-05-02 18:12 ` Yongseok Koh 0 siblings, 0 replies; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:12 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev, stable > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Function mlx5_rxq_ibv_release() is called in several places. > Before each call except one, the input parameter is validated to make > sure it is not null. > > This patch adds the missing validation where it is missing. > > Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") > Cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- > drivers/net/mlx5/mlx5_rxq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index db8c340..c9c2a14 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -617,7 +617,8 @@ > */ > rxq_data = (*priv->rxqs)[i]; > rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > - mlx5_rxq_ibv_release(rxq_ctrl->ibv); > + if (rxq_ctrl->ibv) > + mlx5_rxq_ibv_release(rxq_ctrl->ibv); Please take care of two more things. 1) In mlx5_rx_intr_disable(), mlx5_rxq_ibv_get() isn't paired with mlx5_rxq_ibv_release() This would need a separate patch. 2) In mlx5_rx_intr_vec_disable() Please fix the comment having the old name - priv_rx_intr_vec_enable(). This should be mlx5_rx_intr_vec_enable() No need to have a separate patch. You can fix it in this patch. With the change, Acked-by: Yongseok Koh <yskoh@mellanox.com> > } > free: > rte_intr_free_epoll_fd(intr_handle); > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled ` (2 preceding siblings ...) 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 5 siblings, 2 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index c9c2a14..a547f2a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1546,8 +1546,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 1 sibling, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index c9c2a14..a547f2a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1546,8 +1546,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value Dekel Peled 2019-05-02 15:01 ` Dekel Peled @ 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 18:13 ` Yongseok Koh 1 sibling, 1 reply; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:13 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev, stable > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Return value of function mlx5_rxq_releasable() was not described > correctly in function description. > > This patch updates the description to correctly describe the optional > return values. > > Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") > cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index c9c2a14..a547f2a 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -1546,8 +1546,9 @@ struct mlx5_rxq_ctrl * > * RX queue index. > * > * @return > - * 1 if the queue can be released, negative errno otherwise and rte_errno is > - * set. > + * 1 if the queue can be released > + * 0 if the queue can not be released, there are references to it. > + * Negative errno and rte_errno is set if queue doesn't exist. > */ > int > mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value 2019-05-02 18:13 ` Yongseok Koh @ 2019-05-02 18:13 ` Yongseok Koh 0 siblings, 0 replies; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:13 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev, stable > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Return value of function mlx5_rxq_releasable() was not described > correctly in function description. > > This patch updates the description to correctly describe the optional > return values. > > Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") > cc: stable@dpdk.org > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index c9c2a14..a547f2a 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -1546,8 +1546,9 @@ struct mlx5_rxq_ctrl * > * RX queue index. > * > * @return > - * 1 if the queue can be released, negative errno otherwise and rte_errno is > - * set. > + * 1 if the queue can be released > + * 0 if the queue can not be released, there are references to it. > + * Negative errno and rte_errno is set if queue doesn't exist. > */ > int > mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled ` (3 preceding siblings ...) 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:14 ` Yongseok Koh 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 5 siblings, 2 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a547f2a..36fd0b3 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -418,6 +418,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -505,6 +532,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1032,64 +1116,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1538,33 +1564,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1601,7 +1600,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1665,7 +1664,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1700,7 +1699,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1984,7 +1983,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2044,7 +2043,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2067,7 +2066,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2110,7 +2109,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1732e32..4512490 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:14 ` Yongseok Koh 1 sibling, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-02 15:01 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a547f2a..36fd0b3 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -418,6 +418,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -505,6 +532,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1032,64 +1116,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1538,33 +1564,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1601,7 +1600,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1665,7 +1664,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1700,7 +1699,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1984,7 +1983,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2044,7 +2043,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2067,7 +2066,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2110,7 +2109,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1732e32..4512490 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-02 15:01 ` Dekel Peled @ 2019-05-02 18:14 ` Yongseok Koh 2019-05-02 18:14 ` Yongseok Koh 1 sibling, 1 reply; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:14 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Multiple functions were declared in header file mlx5_rxtx.h, > inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. > > This patch moves all these functions declarations into mlx5_rxq.c, > as static functions. > Some functions implementation was copied higher in the file to > precede the functions calls. > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- > drivers/net/mlx5/mlx5_rxtx.h | 16 ---- > 2 files changed, 92 insertions(+), 109 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index a547f2a..36fd0b3 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -65,7 +65,7 @@ > * @return > * 1 if supported, negative errno value if not. > */ > -inline int > +static inline int > mlx5_check_mprq_support(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -418,6 +418,33 @@ > } > > /** > + * Verify if the queue can be released. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param idx > + * RX queue index. > + * > + * @return > + * 1 if the queue can be released > + * 0 if the queue can not be released, there are references to it. > + * Negative errno and rte_errno is set if queue doesn't exist. > + */ > +static int > +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > +{ > + struct mlx5_priv *priv = dev->data->dev_private; > + struct mlx5_rxq_ctrl *rxq_ctrl; > + > + if (!(*priv->rxqs)[idx]) { > + rte_errno = EINVAL; > + return -rte_errno; > + } > + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); > + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); > +} > + > +/** > * > * @param dev > * Pointer to Ethernet device structure. > @@ -505,6 +532,63 @@ > } > > /** > + * Get an Rx queue Verbs object. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param idx > + * Queue index in DPDK Rx queue array > + * > + * @return > + * The Verbs object if it exists. > + */ > +static struct mlx5_rxq_ibv * > +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) > +{ > + struct mlx5_priv *priv = dev->data->dev_private; > + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; > + struct mlx5_rxq_ctrl *rxq_ctrl; > + > + if (idx >= priv->rxqs_n) > + return NULL; > + if (!rxq_data) > + return NULL; > + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > + if (rxq_ctrl->ibv) > + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > + return rxq_ctrl->ibv; > +} > + > +/** > + * Release an Rx verbs queue object. > + * > + * @param rxq_ibv > + * Verbs Rx queue object. > + * > + * @return > + * 1 while a reference on it exists, 0 when freed. > + */ > +static int > +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) > +{ > + assert(rxq_ibv); > + assert(rxq_ibv->wq); > + assert(rxq_ibv->cq); > + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { > + rxq_free_elts(rxq_ibv->rxq_ctrl); > + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); > + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); > + if (rxq_ibv->channel) > + claim_zero(mlx5_glue->destroy_comp_channel > + (rxq_ibv->channel)); > + LIST_REMOVE(rxq_ibv, next); > + rte_free(rxq_ibv); > + return 0; > + } > + return 1; > +} > + > +/** > * Allocate queue vector and fill epoll fd list for Rx interrupts. > * > * @param dev > @@ -1032,64 +1116,6 @@ struct mlx5_rxq_ibv * > } > > /** > - * Get an Rx queue Verbs object. > - * > - * @param dev > - * Pointer to Ethernet device. > - * @param idx > - * Queue index in DPDK Rx queue array > - * > - * @return > - * The Verbs object if it exists. > - */ > -struct mlx5_rxq_ibv * > -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) > -{ > - struct mlx5_priv *priv = dev->data->dev_private; > - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; > - struct mlx5_rxq_ctrl *rxq_ctrl; > - > - if (idx >= priv->rxqs_n) > - return NULL; > - if (!rxq_data) > - return NULL; > - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > - if (rxq_ctrl->ibv) { > - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > - } > - return rxq_ctrl->ibv; > -} > - > -/** > - * Release an Rx verbs queue object. > - * > - * @param rxq_ibv > - * Verbs Rx queue object. > - * > - * @return > - * 1 while a reference on it exists, 0 when freed. > - */ > -int > -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) > -{ > - assert(rxq_ibv); > - assert(rxq_ibv->wq); > - assert(rxq_ibv->cq); > - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { > - rxq_free_elts(rxq_ibv->rxq_ctrl); > - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); > - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); > - if (rxq_ibv->channel) > - claim_zero(mlx5_glue->destroy_comp_channel > - (rxq_ibv->channel)); > - LIST_REMOVE(rxq_ibv, next); > - rte_free(rxq_ibv); > - return 0; > - } > - return 1; > -} > - > -/** > * Verify the Verbs Rx queue list is empty > * > * @param dev > @@ -1538,33 +1564,6 @@ struct mlx5_rxq_ctrl * > } > > /** > - * Verify if the queue can be released. > - * > - * @param dev > - * Pointer to Ethernet device. > - * @param idx > - * RX queue index. > - * > - * @return > - * 1 if the queue can be released > - * 0 if the queue can not be released, there are references to it. > - * Negative errno and rte_errno is set if queue doesn't exist. > - */ > -int > -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > -{ > - struct mlx5_priv *priv = dev->data->dev_private; > - struct mlx5_rxq_ctrl *rxq_ctrl; > - > - if (!(*priv->rxqs)[idx]) { > - rte_errno = EINVAL; > - return -rte_errno; > - } > - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); > - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); > -} > - > -/** > * Verify the Rx Queue list is empty > * > * @param dev > @@ -1601,7 +1600,7 @@ struct mlx5_rxq_ctrl * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, > uint32_t queues_n) > { > @@ -1665,7 +1664,7 @@ struct mlx5_ind_table_ibv * > * @return > * An indirection table if found. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, > uint32_t queues_n) > { > @@ -1700,7 +1699,7 @@ struct mlx5_ind_table_ibv * > * @return > * 1 while a reference on it exists, 0 when freed. > */ > -int > +static int > mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, > struct mlx5_ind_table_ibv *ind_tbl) > { > @@ -1984,7 +1983,7 @@ struct mlx5_hrxq * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_rxq_ibv * > +static struct mlx5_rxq_ibv * > mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2044,7 +2043,7 @@ struct mlx5_rxq_ibv * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -void > +static void > mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2067,7 +2066,7 @@ struct mlx5_rxq_ibv * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2110,7 +2109,7 @@ struct mlx5_ind_table_ibv * > * @param dev > * Pointer to Ethernet device. > */ > -void > +static void > mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index 1732e32..4512490 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { > > extern uint8_t rss_hash_default_key[]; > > -int mlx5_check_mprq_support(struct rte_eth_dev *dev); > int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); > int mlx5_mprq_enabled(struct rte_eth_dev *dev); > int mlx5_mprq_free_mp(struct rte_eth_dev *dev); > @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); > int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); > -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); > -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); > int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); > struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > uint16_t desc, unsigned int socket, > @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > struct rte_mempool *mp); > struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); > -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_verify(struct rte_eth_dev *dev); > int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, > - const uint16_t *queues, > - uint32_t queues_n); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, > - const uint16_t *queues, > - uint32_t queues_n); > -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, > - struct mlx5_ind_table_ibv *ind_tbl); > int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); > -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); > struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, > const uint8_t *rss_key, uint32_t rss_key_len, > uint64_t hash_fields, > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static 2019-05-02 18:14 ` Yongseok Koh @ 2019-05-02 18:14 ` Yongseok Koh 0 siblings, 0 replies; 53+ messages in thread From: Yongseok Koh @ 2019-05-02 18:14 UTC (permalink / raw) To: Dekel Peled; +Cc: Shahaf Shuler, dev > On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote: > > Multiple functions were declared in header file mlx5_rxtx.h, > inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. > > This patch moves all these functions declarations into mlx5_rxq.c, > as static functions. > Some functions implementation was copied higher in the file to > precede the functions calls. > > Signed-off-by: Dekel Peled <dekelp@mellanox.com> > --- Acked-by: Yongseok Koh <yskoh@mellanox.com> > drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- > drivers/net/mlx5/mlx5_rxtx.h | 16 ---- > 2 files changed, 92 insertions(+), 109 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index a547f2a..36fd0b3 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -65,7 +65,7 @@ > * @return > * 1 if supported, negative errno value if not. > */ > -inline int > +static inline int > mlx5_check_mprq_support(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -418,6 +418,33 @@ > } > > /** > + * Verify if the queue can be released. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param idx > + * RX queue index. > + * > + * @return > + * 1 if the queue can be released > + * 0 if the queue can not be released, there are references to it. > + * Negative errno and rte_errno is set if queue doesn't exist. > + */ > +static int > +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > +{ > + struct mlx5_priv *priv = dev->data->dev_private; > + struct mlx5_rxq_ctrl *rxq_ctrl; > + > + if (!(*priv->rxqs)[idx]) { > + rte_errno = EINVAL; > + return -rte_errno; > + } > + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); > + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); > +} > + > +/** > * > * @param dev > * Pointer to Ethernet device structure. > @@ -505,6 +532,63 @@ > } > > /** > + * Get an Rx queue Verbs object. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param idx > + * Queue index in DPDK Rx queue array > + * > + * @return > + * The Verbs object if it exists. > + */ > +static struct mlx5_rxq_ibv * > +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) > +{ > + struct mlx5_priv *priv = dev->data->dev_private; > + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; > + struct mlx5_rxq_ctrl *rxq_ctrl; > + > + if (idx >= priv->rxqs_n) > + return NULL; > + if (!rxq_data) > + return NULL; > + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > + if (rxq_ctrl->ibv) > + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > + return rxq_ctrl->ibv; > +} > + > +/** > + * Release an Rx verbs queue object. > + * > + * @param rxq_ibv > + * Verbs Rx queue object. > + * > + * @return > + * 1 while a reference on it exists, 0 when freed. > + */ > +static int > +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) > +{ > + assert(rxq_ibv); > + assert(rxq_ibv->wq); > + assert(rxq_ibv->cq); > + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { > + rxq_free_elts(rxq_ibv->rxq_ctrl); > + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); > + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); > + if (rxq_ibv->channel) > + claim_zero(mlx5_glue->destroy_comp_channel > + (rxq_ibv->channel)); > + LIST_REMOVE(rxq_ibv, next); > + rte_free(rxq_ibv); > + return 0; > + } > + return 1; > +} > + > +/** > * Allocate queue vector and fill epoll fd list for Rx interrupts. > * > * @param dev > @@ -1032,64 +1116,6 @@ struct mlx5_rxq_ibv * > } > > /** > - * Get an Rx queue Verbs object. > - * > - * @param dev > - * Pointer to Ethernet device. > - * @param idx > - * Queue index in DPDK Rx queue array > - * > - * @return > - * The Verbs object if it exists. > - */ > -struct mlx5_rxq_ibv * > -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) > -{ > - struct mlx5_priv *priv = dev->data->dev_private; > - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; > - struct mlx5_rxq_ctrl *rxq_ctrl; > - > - if (idx >= priv->rxqs_n) > - return NULL; > - if (!rxq_data) > - return NULL; > - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > - if (rxq_ctrl->ibv) { > - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > - } > - return rxq_ctrl->ibv; > -} > - > -/** > - * Release an Rx verbs queue object. > - * > - * @param rxq_ibv > - * Verbs Rx queue object. > - * > - * @return > - * 1 while a reference on it exists, 0 when freed. > - */ > -int > -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) > -{ > - assert(rxq_ibv); > - assert(rxq_ibv->wq); > - assert(rxq_ibv->cq); > - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { > - rxq_free_elts(rxq_ibv->rxq_ctrl); > - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); > - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); > - if (rxq_ibv->channel) > - claim_zero(mlx5_glue->destroy_comp_channel > - (rxq_ibv->channel)); > - LIST_REMOVE(rxq_ibv, next); > - rte_free(rxq_ibv); > - return 0; > - } > - return 1; > -} > - > -/** > * Verify the Verbs Rx queue list is empty > * > * @param dev > @@ -1538,33 +1564,6 @@ struct mlx5_rxq_ctrl * > } > > /** > - * Verify if the queue can be released. > - * > - * @param dev > - * Pointer to Ethernet device. > - * @param idx > - * RX queue index. > - * > - * @return > - * 1 if the queue can be released > - * 0 if the queue can not be released, there are references to it. > - * Negative errno and rte_errno is set if queue doesn't exist. > - */ > -int > -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > -{ > - struct mlx5_priv *priv = dev->data->dev_private; > - struct mlx5_rxq_ctrl *rxq_ctrl; > - > - if (!(*priv->rxqs)[idx]) { > - rte_errno = EINVAL; > - return -rte_errno; > - } > - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); > - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); > -} > - > -/** > * Verify the Rx Queue list is empty > * > * @param dev > @@ -1601,7 +1600,7 @@ struct mlx5_rxq_ctrl * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, > uint32_t queues_n) > { > @@ -1665,7 +1664,7 @@ struct mlx5_ind_table_ibv * > * @return > * An indirection table if found. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, > uint32_t queues_n) > { > @@ -1700,7 +1699,7 @@ struct mlx5_ind_table_ibv * > * @return > * 1 while a reference on it exists, 0 when freed. > */ > -int > +static int > mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, > struct mlx5_ind_table_ibv *ind_tbl) > { > @@ -1984,7 +1983,7 @@ struct mlx5_hrxq * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_rxq_ibv * > +static struct mlx5_rxq_ibv * > mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2044,7 +2043,7 @@ struct mlx5_rxq_ibv * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -void > +static void > mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2067,7 +2066,7 @@ struct mlx5_rxq_ibv * > * @return > * The Verbs object initialised, NULL otherwise and rte_errno is set. > */ > -struct mlx5_ind_table_ibv * > +static struct mlx5_ind_table_ibv * > mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > @@ -2110,7 +2109,7 @@ struct mlx5_ind_table_ibv * > * @param dev > * Pointer to Ethernet device. > */ > -void > +static void > mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) > { > struct mlx5_priv *priv = dev->data->dev_private; > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index 1732e32..4512490 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -246,7 +246,6 @@ struct mlx5_txq_ctrl { > > extern uint8_t rss_hash_default_key[]; > > -int mlx5_check_mprq_support(struct rte_eth_dev *dev); > int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); > int mlx5_mprq_enabled(struct rte_eth_dev *dev); > int mlx5_mprq_free_mp(struct rte_eth_dev *dev); > @@ -260,10 +259,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, > int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); > int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); > -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); > -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); > int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); > struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > uint16_t desc, unsigned int socket, > @@ -271,20 +266,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > struct rte_mempool *mp); > struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); > -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_verify(struct rte_eth_dev *dev); > int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, > - const uint16_t *queues, > - uint32_t queues_n); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, > - const uint16_t *queues, > - uint32_t queues_n); > -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, > - struct mlx5_ind_table_ibv *ind_tbl); > int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); > -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); > -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); > struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, > const uint8_t *rss_key, uint32_t rss_key_len, > uint64_t hash_fields, > -- > 1.8.3.1 > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled ` (4 preceding siblings ...) 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` Dekel Peled ` (6 more replies) 5 siblings, 7 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: Change 2nd patch type to "fix". v3: Apply minor code-review comment on 2nd patch. Add Acked-by in all patches. --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 220 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 95 insertions(+), 158 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions Dekel Peled ` (5 subsequent siblings) 6 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: Change 2nd patch type to "fix". v3: Apply minor code-review comment on 2nd patch. Add Acked-by in all patches. --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 220 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 95 insertions(+), 158 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-05-05 13:09 ` Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled ` (4 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 0a4c02e..222fe95 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1111,19 +1093,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 4339aaf..104ba7c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -249,7 +249,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -261,7 +260,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -274,7 +272,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -311,7 +308,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index b281c45..50b1f81 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -642,19 +642,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 0a4c02e..222fe95 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1111,19 +1093,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 4339aaf..104ba7c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -249,7 +249,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -261,7 +260,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -274,7 +272,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -311,7 +308,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index b281c45..50b1f81 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -642,19 +642,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value Dekel Peled ` (3 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the validation where it is missing. It also changes a priv_ prefix, left in a comment, to mlx5_ prefix. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 222fe95..0054096 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -593,11 +593,12 @@ continue; /** * Need to access directly the queue to release the reference - * kept in priv_rx_intr_vec_enable(). + * kept in mlx5_rx_intr_vec_enable(). */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the validation where it is missing. It also changes a priv_ prefix, left in a comment, to mlx5_ prefix. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 222fe95..0054096 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -593,11 +593,12 @@ continue; /** * Need to access directly the queue to release the reference - * kept in priv_rx_intr_vec_enable(). + * kept in mlx5_rx_intr_vec_enable(). */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (2 preceding siblings ...) 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static Dekel Peled ` (2 subsequent siblings) 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 0054096..a22ed91 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1526,8 +1526,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 0054096..a22ed91 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1526,8 +1526,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (3 preceding siblings ...) 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-08 4:43 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled 6 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a22ed91..e0ae068 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -398,6 +398,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -485,6 +512,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1012,64 +1096,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1518,33 +1544,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1581,7 +1580,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1645,7 +1644,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1680,7 +1679,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1964,7 +1963,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2024,7 +2023,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2047,7 +2046,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2090,7 +2089,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 104ba7c..8b0463e 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -244,7 +244,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -258,10 +257,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -269,20 +264,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-05 13:09 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-05 13:09 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 185 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 16 ---- 2 files changed, 92 insertions(+), 109 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a22ed91..e0ae068 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -65,7 +65,7 @@ * @return * 1 if supported, negative errno value if not. */ -inline int +static inline int mlx5_check_mprq_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -398,6 +398,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -485,6 +512,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1012,64 +1096,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1518,33 +1544,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1581,7 +1580,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1645,7 +1644,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1680,7 +1679,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1964,7 +1963,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2024,7 +2023,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2047,7 +2046,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2090,7 +2089,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 104ba7c..8b0463e 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -244,7 +244,6 @@ struct mlx5_txq_ctrl { extern uint8_t rss_hash_default_key[]; -int mlx5_check_mprq_support(struct rte_eth_dev *dev); int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq); int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); @@ -258,10 +257,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -269,20 +264,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (4 preceding siblings ...) 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-08 4:43 ` Shahaf Shuler 2019-05-08 4:43 ` Shahaf Shuler 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled 6 siblings, 1 reply; 53+ messages in thread From: Shahaf Shuler @ 2019-05-08 4:43 UTC (permalink / raw) To: Dekel Peled, Yongseok Koh; +Cc: dev Dekel, Sunday, May 5, 2019 4:09 PM, Dekel Peled: > Subject: [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files > > During work on Rx feature I did some cleanup actions. > This series includes those changes divided by their type. > > --- > v2: Change 2nd patch type to "fix". > v3: Apply minor code-review comment on 2nd patch. > Add Acked-by in all patches. > --- I was trying to apply your patch but hit clang compilation issue, please address: error: static function 'mlx5_check_mprq_support' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline] if (mlx5_check_mprq_support(dev) < 0) ^ /.autodirect/swgwork/shahafs/workspace/dpdk.org/drivers/net/mlx5/mlx5_rxtx.h:248:1: note: use 'static' to give inline function 'mlx5_mprq_enabled' internal linkage int mlx5_mprq_enabled(struct rte_eth_dev *dev); ^ static /.autodirect/swgwork/shahafs/workspace/dpdk.org/drivers/net/mlx5/mlx5_rxq.c:69:1: note: 'mlx5_check_mprq_support' declared here mlx5_check_mprq_support(struct rte_eth_dev *dev) > > Dekel Peled (4): > net/mlx5: remove unused functions > net/mlx5: fix missing validation of null pointer > net/mlx5: fix description of function return value > net/mlx5: move locally used functions to static > > drivers/net/mlx5/mlx5_rxq.c | 220 +++++++++++++++++++------------------- > ----- > drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 -- > - > 3 files changed, 95 insertions(+), 158 deletions(-) > > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-08 4:43 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler @ 2019-05-08 4:43 ` Shahaf Shuler 0 siblings, 0 replies; 53+ messages in thread From: Shahaf Shuler @ 2019-05-08 4:43 UTC (permalink / raw) To: Dekel Peled, Yongseok Koh; +Cc: dev Dekel, Sunday, May 5, 2019 4:09 PM, Dekel Peled: > Subject: [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files > > During work on Rx feature I did some cleanup actions. > This series includes those changes divided by their type. > > --- > v2: Change 2nd patch type to "fix". > v3: Apply minor code-review comment on 2nd patch. > Add Acked-by in all patches. > --- I was trying to apply your patch but hit clang compilation issue, please address: error: static function 'mlx5_check_mprq_support' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline] if (mlx5_check_mprq_support(dev) < 0) ^ /.autodirect/swgwork/shahafs/workspace/dpdk.org/drivers/net/mlx5/mlx5_rxtx.h:248:1: note: use 'static' to give inline function 'mlx5_mprq_enabled' internal linkage int mlx5_mprq_enabled(struct rte_eth_dev *dev); ^ static /.autodirect/swgwork/shahafs/workspace/dpdk.org/drivers/net/mlx5/mlx5_rxq.c:69:1: note: 'mlx5_check_mprq_support' declared here mlx5_check_mprq_support(struct rte_eth_dev *dev) > > Dekel Peled (4): > net/mlx5: remove unused functions > net/mlx5: fix missing validation of null pointer > net/mlx5: fix description of function return value > net/mlx5: move locally used functions to static > > drivers/net/mlx5/mlx5_rxq.c | 220 +++++++++++++++++++------------------- > ----- > drivers/net/mlx5/mlx5_rxtx.h | 20 ---- drivers/net/mlx5/mlx5_txq.c | 13 -- > - > 3 files changed, 95 insertions(+), 158 deletions(-) > > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled ` (5 preceding siblings ...) 2019-05-08 4:43 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` Dekel Peled ` (5 more replies) 6 siblings, 6 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: Change 2nd patch type to "fix". v3: Apply minor code-review comment on 2nd patch. Add Acked-by in all patches. v4: Fix compilaton issue in 4th patch. --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 19 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 156 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions Dekel Peled ` (4 subsequent siblings) 5 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev During work on Rx feature I did some cleanup actions. This series includes those changes divided by their type. --- v2: Change 2nd patch type to "fix". v3: Apply minor code-review comment on 2nd patch. Add Acked-by in all patches. v4: Fix compilaton issue in 4th patch. --- Dekel Peled (4): net/mlx5: remove unused functions net/mlx5: fix missing validation of null pointer net/mlx5: fix description of function return value net/mlx5: move locally used functions to static drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------------ drivers/net/mlx5/mlx5_rxtx.h | 19 ---- drivers/net/mlx5/mlx5_txq.c | 13 --- 3 files changed, 94 insertions(+), 156 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled 2019-05-08 8:29 ` Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled ` (3 subsequent siblings) 5 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a00cb12..83ba525 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1112,19 +1094,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 4339aaf..104ba7c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -249,7 +249,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -261,7 +260,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -274,7 +272,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -311,7 +308,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index b281c45..50b1f81 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -642,19 +642,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Functions implemented but never called: mlx5_rxq_ibv_releasable() mlx5_rxq_cleanup() mlx5_txq_ibv_releasable() Function declared but not implemented: rxq_alloc_mprq_buf() This patch removes these functions from code and header file. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 31 ------------------------------- drivers/net/mlx5/mlx5_rxtx.h | 4 ---- drivers/net/mlx5/mlx5_txq.c | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a00cb12..83ba525 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -353,24 +353,6 @@ } /** - * Clean up a RX queue. - * - * Destroy objects, free allocated memory and reset the structure for reuse. - * - * @param rxq_ctrl - * Pointer to RX queue structure. - */ -void -mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl) -{ - DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u", - PORT_ID(rxq_ctrl->priv), rxq_ctrl->rxq.idx); - if (rxq_ctrl->ibv) - mlx5_rxq_ibv_release(rxq_ctrl->ibv); - memset(rxq_ctrl, 0, sizeof(*rxq_ctrl)); -} - -/** * Returns the per-queue supported offloads. * * @param dev @@ -1112,19 +1094,6 @@ struct mlx5_rxq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param rxq_ibv - * Verbs Rx queue object. - */ -int -mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - return (rte_atomic32_read(&rxq_ibv->refcnt) == 1); -} - -/** * Callback function to initialize mbufs for Multi-Packet RQ. */ static inline void diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 4339aaf..104ba7c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -249,7 +249,6 @@ struct mlx5_txq_ctrl { int mlx5_mprq_enabled(struct rte_eth_dev *dev); int mlx5_mprq_free_mp(struct rte_eth_dev *dev); int mlx5_mprq_alloc_mp(struct rte_eth_dev *dev); -void mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl); int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp); @@ -261,7 +260,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); @@ -274,7 +272,6 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -int rxq_alloc_mprq_buf(struct mlx5_rxq_ctrl *rxq_ctrl); struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n); @@ -311,7 +308,6 @@ int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_txq_ibv *mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); struct mlx5_txq_ibv *mlx5_txq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv); -int mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv); int mlx5_txq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index b281c45..50b1f81 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -642,19 +642,6 @@ struct mlx5_txq_ibv * } /** - * Return true if a single reference exists on the object. - * - * @param txq_ibv - * Verbs Tx queue object. - */ -int -mlx5_txq_ibv_releasable(struct mlx5_txq_ibv *txq_ibv) -{ - assert(txq_ibv); - return (rte_atomic32_read(&txq_ibv->refcnt) == 1); -} - -/** * Verify the Verbs Tx queue list is empty * * @param dev -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value Dekel Peled ` (2 subsequent siblings) 5 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the validation where it is missing. It also changes a priv_ prefix, left in a comment, to mlx5_ prefix. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 83ba525..f595e7a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -593,11 +593,12 @@ continue; /** * Need to access directly the queue to release the reference - * kept in priv_rx_intr_vec_enable(). + * kept in mlx5_rx_intr_vec_enable(). */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Function mlx5_rxq_ibv_release() is called in several places. Before each call except one, the input parameter is validated to make sure it is not null. This patch adds the validation where it is missing. It also changes a priv_ prefix, left in a comment, to mlx5_ prefix. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 83ba525..f595e7a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -593,11 +593,12 @@ continue; /** * Need to access directly the queue to release the reference - * kept in priv_rx_intr_vec_enable(). + * kept in mlx5_rx_intr_vec_enable(). */ rxq_data = (*priv->rxqs)[i]; rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - mlx5_rxq_ibv_release(rxq_ctrl->ibv); + if (rxq_ctrl->ibv) + mlx5_rxq_ibv_release(rxq_ctrl->ibv); } free: rte_intr_free_epoll_fd(intr_handle); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled ` (2 preceding siblings ...) 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-22 20:35 ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 5 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f595e7a..f10e896 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1527,8 +1527,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev, stable Return value of function mlx5_rxq_releasable() was not described correctly in function description. This patch updates the description to correctly describe the optional return values. Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values") cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f595e7a..f10e896 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1527,8 +1527,9 @@ struct mlx5_rxq_ctrl * * RX queue index. * * @return - * 1 if the queue can be released, negative errno otherwise and rte_errno is - * set. + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. */ int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled ` (3 preceding siblings ...) 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-22 20:35 ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 5 siblings, 1 reply; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 183 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 15 ---- 2 files changed, 91 insertions(+), 107 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f10e896..3330057 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -398,6 +398,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -485,6 +512,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1013,64 +1097,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1519,33 +1545,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1582,7 +1581,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1646,7 +1645,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1681,7 +1680,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1965,7 +1964,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2025,7 +2024,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2048,7 +2047,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2091,7 +2090,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 104ba7c..0ff5508 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -258,10 +258,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -269,20 +265,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-08 8:29 ` Dekel Peled 0 siblings, 0 replies; 53+ messages in thread From: Dekel Peled @ 2019-05-08 8:29 UTC (permalink / raw) To: yskoh, shahafs; +Cc: dev Multiple functions were declared in header file mlx5_rxtx.h, inplemented in mlx5_rxq.c, and called only in mlx5_rxq.c. This patch moves all these functions declarations into mlx5_rxq.c, as static functions. Some functions implementation was copied higher in the file to precede the functions calls. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> --- drivers/net/mlx5/mlx5_rxq.c | 183 +++++++++++++++++++++---------------------- drivers/net/mlx5/mlx5_rxtx.h | 15 ---- 2 files changed, 91 insertions(+), 107 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f10e896..3330057 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -398,6 +398,33 @@ } /** + * Verify if the queue can be released. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * RX queue index. + * + * @return + * 1 if the queue can be released + * 0 if the queue can not be released, there are references to it. + * Negative errno and rte_errno is set if queue doesn't exist. + */ +static int +mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (!(*priv->rxqs)[idx]) { + rte_errno = EINVAL; + return -rte_errno; + } + rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); + return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); +} + +/** * * @param dev * Pointer to Ethernet device structure. @@ -485,6 +512,63 @@ } /** + * Get an Rx queue Verbs object. + * + * @param dev + * Pointer to Ethernet device. + * @param idx + * Queue index in DPDK Rx queue array + * + * @return + * The Verbs object if it exists. + */ +static struct mlx5_rxq_ibv * +mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (idx >= priv->rxqs_n) + return NULL; + if (!rxq_data) + return NULL; + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + if (rxq_ctrl->ibv) + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); + return rxq_ctrl->ibv; +} + +/** + * Release an Rx verbs queue object. + * + * @param rxq_ibv + * Verbs Rx queue object. + * + * @return + * 1 while a reference on it exists, 0 when freed. + */ +static int +mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) +{ + assert(rxq_ibv); + assert(rxq_ibv->wq); + assert(rxq_ibv->cq); + if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { + rxq_free_elts(rxq_ibv->rxq_ctrl); + claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); + claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); + if (rxq_ibv->channel) + claim_zero(mlx5_glue->destroy_comp_channel + (rxq_ibv->channel)); + LIST_REMOVE(rxq_ibv, next); + rte_free(rxq_ibv); + return 0; + } + return 1; +} + +/** * Allocate queue vector and fill epoll fd list for Rx interrupts. * * @param dev @@ -1013,64 +1097,6 @@ struct mlx5_rxq_ibv * } /** - * Get an Rx queue Verbs object. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array - * - * @return - * The Verbs object if it exists. - */ -struct mlx5_rxq_ibv * -mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (idx >= priv->rxqs_n) - return NULL; - if (!rxq_data) - return NULL; - rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - if (rxq_ctrl->ibv) { - rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); - } - return rxq_ctrl->ibv; -} - -/** - * Release an Rx verbs queue object. - * - * @param rxq_ibv - * Verbs Rx queue object. - * - * @return - * 1 while a reference on it exists, 0 when freed. - */ -int -mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv) -{ - assert(rxq_ibv); - assert(rxq_ibv->wq); - assert(rxq_ibv->cq); - if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { - rxq_free_elts(rxq_ibv->rxq_ctrl); - claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); - claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); - if (rxq_ibv->channel) - claim_zero(mlx5_glue->destroy_comp_channel - (rxq_ibv->channel)); - LIST_REMOVE(rxq_ibv, next); - rte_free(rxq_ibv); - return 0; - } - return 1; -} - -/** * Verify the Verbs Rx queue list is empty * * @param dev @@ -1519,33 +1545,6 @@ struct mlx5_rxq_ctrl * } /** - * Verify if the queue can be released. - * - * @param dev - * Pointer to Ethernet device. - * @param idx - * RX queue index. - * - * @return - * 1 if the queue can be released - * 0 if the queue can not be released, there are references to it. - * Negative errno and rte_errno is set if queue doesn't exist. - */ -int -mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) -{ - struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (!(*priv->rxqs)[idx]) { - rte_errno = EINVAL; - return -rte_errno; - } - rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); - return (rte_atomic32_read(&rxq_ctrl->refcnt) == 1); -} - -/** * Verify the Rx Queue list is empty * * @param dev @@ -1582,7 +1581,7 @@ struct mlx5_rxq_ctrl * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1646,7 +1645,7 @@ struct mlx5_ind_table_ibv * * @return * An indirection table if found. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, const uint16_t *queues, uint32_t queues_n) { @@ -1681,7 +1680,7 @@ struct mlx5_ind_table_ibv * * @return * 1 while a reference on it exists, 0 when freed. */ -int +static int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, struct mlx5_ind_table_ibv *ind_tbl) { @@ -1965,7 +1964,7 @@ struct mlx5_hrxq * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_rxq_ibv * +static struct mlx5_rxq_ibv * mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2025,7 +2024,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -void +static void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2048,7 +2047,7 @@ struct mlx5_rxq_ibv * * @return * The Verbs object initialised, NULL otherwise and rte_errno is set. */ -struct mlx5_ind_table_ibv * +static struct mlx5_ind_table_ibv * mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; @@ -2091,7 +2090,7 @@ struct mlx5_ind_table_ibv * * @param dev * Pointer to Ethernet device. */ -void +static void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 104ba7c..0ff5508 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -258,10 +258,6 @@ int mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); -struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev); int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, @@ -269,20 +265,9 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, struct rte_mempool *mp); struct mlx5_rxq_ctrl *mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx); -int mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx); int mlx5_rxq_verify(struct rte_eth_dev *dev); int rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, - const uint16_t *queues, - uint32_t queues_n); -int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, - struct mlx5_ind_table_ibv *ind_tbl); int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); -struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); -void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev); struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, const uint8_t *rss_key, uint32_t rss_key_len, uint64_t hash_fields, -- 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled ` (4 preceding siblings ...) 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static Dekel Peled @ 2019-05-22 20:35 ` Shahaf Shuler 5 siblings, 0 replies; 53+ messages in thread From: Shahaf Shuler @ 2019-05-22 20:35 UTC (permalink / raw) To: Dekel Peled, Yongseok Koh; +Cc: dev Wednesday, May 8, 2019 11:30 AM, Dekel Peled: > Subject: [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files > > During work on Rx feature I did some cleanup actions. > This series includes those changes divided by their type. > > --- > v2: Change 2nd patch type to "fix". > v3: Apply minor code-review comment on 2nd patch. > Add Acked-by in all patches. > v4: Fix compilaton issue in 4th patch. Series applied to next-net-mlx, thanks. > --- > > Dekel Peled (4): > net/mlx5: remove unused functions > net/mlx5: fix missing validation of null pointer > net/mlx5: fix description of function return value > net/mlx5: move locally used functions to static > > drivers/net/mlx5/mlx5_rxq.c | 218 +++++++++++++++++++------------------- > ----- > drivers/net/mlx5/mlx5_rxtx.h | 19 ---- drivers/net/mlx5/mlx5_txq.c | 13 -- > - > 3 files changed, 94 insertions(+), 156 deletions(-) > > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 53+ messages in thread
end of thread, other threads:[~2019-05-22 20:36 UTC | newest] Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-04-29 11:00 [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 1/4] net/mlx5: remove unused functions Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 2/4] net/mlx5: add missing validation of null pointer Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 3/4] net/mlx5: fix description of function return value Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-04-29 11:00 ` [dpdk-dev] [PATCH 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-04-29 11:00 ` Dekel Peled 2019-05-02 14:10 ` [dpdk-dev] [PATCH 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 2019-05-02 14:10 ` Shahaf Shuler 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 " Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: remove unused functions Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:12 ` Yongseok Koh 2019-05-02 18:12 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: fix description of function return value Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 18:13 ` Yongseok Koh 2019-05-02 15:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-02 15:01 ` Dekel Peled 2019-05-02 18:14 ` Yongseok Koh 2019-05-02 18:14 ` Yongseok Koh 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: remove unused functions Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: fix description of function return value Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-05 13:09 ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-05 13:09 ` Dekel Peled 2019-05-08 4:43 ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler 2019-05-08 4:43 ` Shahaf Shuler 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 " Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: remove unused functions Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: fix missing validation of null pointer Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: fix description of function return value Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-08 8:29 ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: move locally used functions to static Dekel Peled 2019-05-08 8:29 ` Dekel Peled 2019-05-22 20:35 ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: code cleanup in rx and tx files Shahaf Shuler
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).