net/mlx5: remove unused calculation in RSS expansion
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_verbs.c
index 7d5ea37..540ce32 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <stddef.h>
 #include <errno.h>
-#include <stdbool.h>
 #include <string.h>
 #include <stdint.h>
 #include <unistd.h>
@@ -97,16 +96,18 @@ mlx5_rxq_obj_modify_wq_vlan_strip(struct mlx5_rxq_obj *rxq_obj, int on)
  *
  * @param rxq_obj
  *   Verbs Rx queue object.
+ * @param type
+ *   Type of change queue state.
  *
  * @return
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 static int
-mlx5_ibv_modify_wq(struct mlx5_rxq_obj *rxq_obj, bool is_start)
+mlx5_ibv_modify_wq(struct mlx5_rxq_obj *rxq_obj, uint8_t type)
 {
        struct ibv_wq_attr mod = {
                .attr_mask = IBV_WQ_ATTR_STATE,
-               .wq_state = is_start ? IBV_WQS_RDY : IBV_WQS_RESET,
+               .wq_state = (enum ibv_wq_state)type,
        };
 
        return mlx5_glue->modify_wq(rxq_obj->wq, &mod);
@@ -367,7 +368,6 @@ mlx5_rxq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
        MLX5_ASSERT(tmpl);
        priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_RX_QUEUE;
        priv->verbs_alloc_ctx.obj = rxq_ctrl;
-       tmpl->type = MLX5_RXQ_OBJ_TYPE_IBV;
        tmpl->rxq_ctrl = rxq_ctrl;
        if (rxq_ctrl->irq) {
                tmpl->ibv_channel =
@@ -418,7 +418,7 @@ mlx5_rxq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
                goto error;
        }
        /* Change queue state to ready. */
-       ret = mlx5_ibv_modify_wq(tmpl, true);
+       ret = mlx5_ibv_modify_wq(tmpl, IBV_WQS_RDY);
        if (ret) {
                DRV_LOG(ERR,
                        "Port %u Rx queue %u WQ state to IBV_WQS_RDY failed.",
@@ -922,7 +922,6 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
        struct mlx5_txq_ctrl *txq_ctrl =
                container_of(txq_data, struct mlx5_txq_ctrl, txq);
        struct mlx5_txq_obj *txq_obj = txq_ctrl->obj;
-       struct ibv_qp_attr mod;
        unsigned int cqe_n;
        struct mlx5dv_qp qp;
        struct mlx5dv_cq cq_info;
@@ -932,7 +931,6 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
 
        MLX5_ASSERT(txq_data);
        MLX5_ASSERT(txq_obj);
-       txq_obj->type = MLX5_TXQ_OBJ_TYPE_IBV;
        txq_obj->txq_ctrl = txq_ctrl;
        priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_TX_QUEUE;
        priv->verbs_alloc_ctx.obj = txq_ctrl;
@@ -956,37 +954,10 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
                rte_errno = errno;
                goto error;
        }
-       mod = (struct ibv_qp_attr){
-               /* Move the QP to this state. */
-               .qp_state = IBV_QPS_INIT,
-               /* IB device port number. */
-               .port_num = (uint8_t)priv->dev_port,
-       };
-       ret = mlx5_glue->modify_qp(txq_obj->qp, &mod,
-                                  (IBV_QP_STATE | IBV_QP_PORT));
-       if (ret) {
-               DRV_LOG(ERR,
-                       "Port %u Tx queue %u QP state to IBV_QPS_INIT failed.",
-                       dev->data->port_id, idx);
-               rte_errno = errno;
-               goto error;
-       }
-       mod = (struct ibv_qp_attr){
-               .qp_state = IBV_QPS_RTR
-       };
-       ret = mlx5_glue->modify_qp(txq_obj->qp, &mod, IBV_QP_STATE);
+       ret = mlx5_ibv_modify_qp(txq_obj, MLX5_TXQ_MOD_RST2RDY,
+                                (uint8_t)priv->dev_port);
        if (ret) {
-               DRV_LOG(ERR,
-                       "Port %u Tx queue %u QP state to IBV_QPS_RTR failed.",
-                       dev->data->port_id, idx);
-               rte_errno = errno;
-               goto error;
-       }
-       mod.qp_state = IBV_QPS_RTS;
-       ret = mlx5_glue->modify_qp(txq_obj->qp, &mod, IBV_QP_STATE);
-       if (ret) {
-               DRV_LOG(ERR,
-                       "Port %u Tx queue %u QP state to IBV_QPS_RTS failed.",
+               DRV_LOG(ERR, "Port %u Tx queue %u QP state modifying failed.",
                        dev->data->port_id, idx);
                rte_errno = errno;
                goto error;
@@ -1067,6 +1038,7 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
                goto error;
        }
        txq_uar_init(txq_ctrl);
+       dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED;
        priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
        return 0;
 error: