summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2019-07-22 14:52:14 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-07-23 14:31:36 +0200
commit84537d3c3517fd9ef6617948b8224624934a07ec (patch)
treed046d61c4cca93f976f7f8f2a6e3b54ab67d58f4
parent23820a79891b3b087b25e3d7eb0fda2ab9104598 (diff)
downloaddpdk-84537d3c3517fd9ef6617948b8224624934a07ec.zip
dpdk-84537d3c3517fd9ef6617948b8224624934a07ec.tar.gz
dpdk-84537d3c3517fd9ef6617948b8224624934a07ec.tar.xz
net/mlx5: update queue state modify for DevX
Function mlx5_queue_state_modify_primary() was implemented to handle state change for queues created using Verbs API. This patch update function mlx5_queue_state_modify_primary() to support state change of RQ object created using DevX API. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5_rxtx.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index b255c55..0626d93 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -788,7 +788,7 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq)
}
/**
- * Modify a Verbs queue state.
+ * Modify a Verbs/DevX queue state.
* This must be called from the primary process.
*
* @param dev
@@ -807,15 +807,34 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
struct mlx5_priv *priv = dev->data->dev_private;
if (sm->is_wq) {
- struct ibv_wq_attr mod = {
- .attr_mask = IBV_WQ_ATTR_STATE,
- .wq_state = sm->state,
- };
struct mlx5_rxq_data *rxq = (*priv->rxqs)[sm->queue_id];
struct mlx5_rxq_ctrl *rxq_ctrl =
container_of(rxq, struct mlx5_rxq_ctrl, rxq);
- ret = mlx5_glue->modify_wq(rxq_ctrl->obj->wq, &mod);
+ if (rxq_ctrl->obj->type == MLX5_RXQ_OBJ_TYPE_IBV) {
+ struct ibv_wq_attr mod = {
+ .attr_mask = IBV_WQ_ATTR_STATE,
+ .wq_state = sm->state,
+ };
+
+ ret = mlx5_glue->modify_wq(rxq_ctrl->obj->wq, &mod);
+ } else { /* rxq_ctrl->obj->type == MLX5_RXQ_OBJ_TYPE_DEVX_RQ. */
+ struct mlx5_devx_modify_rq_attr rq_attr;
+
+ memset(&rq_attr, 0, sizeof(rq_attr));
+ if (sm->state == IBV_WQS_RESET) {
+ rq_attr.rq_state = MLX5_RQC_STATE_ERR;
+ rq_attr.state = MLX5_RQC_STATE_RST;
+ } else if (sm->state == IBV_WQS_RDY) {
+ rq_attr.rq_state = MLX5_RQC_STATE_RST;
+ rq_attr.state = MLX5_RQC_STATE_RDY;
+ } else if (sm->state == IBV_WQS_ERR) {
+ rq_attr.rq_state = MLX5_RQC_STATE_RDY;
+ rq_attr.state = MLX5_RQC_STATE_ERR;
+ }
+ ret = mlx5_devx_cmd_modify_rq(rxq_ctrl->obj->rq,
+ &rq_attr);
+ }
if (ret) {
DRV_LOG(ERR, "Cannot change Rx WQ state to %u - %s\n",
sm->state, strerror(errno));