net/failsafe: fix VLAN stripping configuration
[dpdk.git] / drivers / net / mlx5 / mlx5_rxq.c
index e7ec1da..a1f382b 100644 (file)
@@ -396,6 +396,8 @@ priv_rx_intr_vec_disable(struct priv *priv)
 
        if (!priv->dev->data->dev_conf.intr_conf.rxq)
                return;
+       if (!intr_handle->intr_vec)
+               goto free;
        for (i = 0; i != n; ++i) {
                struct mlx5_rxq_ctrl *rxq_ctrl;
                struct mlx5_rxq_data *rxq_data;
@@ -411,8 +413,10 @@ priv_rx_intr_vec_disable(struct priv *priv)
                rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
                mlx5_priv_rxq_ibv_release(priv, rxq_ctrl->ibv);
        }
+free:
        rte_intr_free_epoll_fd(intr_handle);
-       free(intr_handle->intr_vec);
+       if (intr_handle->intr_vec)
+               free(intr_handle->intr_vec);
        intr_handle->nb_efd = 0;
        intr_handle->intr_vec = NULL;
 }
@@ -558,7 +562,10 @@ mlx5_priv_rxq_ibv_new(struct priv *priv, uint16_t idx)
                container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
        struct ibv_wq_attr mod;
        union {
-               struct ibv_cq_init_attr_ex cq;
+               struct {
+                       struct ibv_cq_init_attr_ex ibv;
+                       struct mlx5dv_cq_init_attr mlx5;
+               } cq;
                struct ibv_wq_init_attr wq;
                struct ibv_cq_ex cq_attr;
        } attr;
@@ -597,20 +604,29 @@ mlx5_priv_rxq_ibv_new(struct priv *priv, uint16_t idx)
                        goto error;
                }
        }
-       attr.cq = (struct ibv_cq_init_attr_ex){
+       attr.cq.ibv = (struct ibv_cq_init_attr_ex){
+               .cqe = cqe_n,
+               .channel = tmpl->channel,
                .comp_mask = 0,
        };
-       if (priv->cqe_comp) {
-               attr.cq.comp_mask |= IBV_CQ_INIT_ATTR_MASK_FLAGS;
-               attr.cq.flags |= MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE;
+       attr.cq.mlx5 = (struct mlx5dv_cq_init_attr){
+               .comp_mask = 0,
+       };
+       if (priv->cqe_comp && !rxq_data->hw_timestamp) {
+               attr.cq.mlx5.comp_mask |=
+                       MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE;
+               attr.cq.mlx5.cqe_comp_res_format = MLX5DV_CQE_RES_FORMAT_HASH;
                /*
                 * For vectorized Rx, it must not be doubled in order to
                 * make cq_ci and rq_ci aligned.
                 */
                if (rxq_check_vec_support(rxq_data) < 0)
-                       cqe_n *= 2;
+                       attr.cq.ibv.cqe *= 2;
+       } else if (priv->cqe_comp && rxq_data->hw_timestamp) {
+               DEBUG("Rx CQE compression is disabled for HW timestamp");
        }
-       tmpl->cq = ibv_create_cq(priv->ctx, cqe_n, NULL, tmpl->channel, 0);
+       tmpl->cq = ibv_cq_ex_to_cq(mlx5dv_create_cq(priv->ctx, &attr.cq.ibv,
+                                                   &attr.cq.mlx5));
        if (tmpl->cq == NULL) {
                ERROR("%p: CQ creation failure", (void *)rxq_ctrl);
                goto error;
@@ -714,6 +730,9 @@ mlx5_priv_rxq_ibv_new(struct priv *priv, uint16_t idx)
        };
        rxq_data->cq_db = cq_info.dbrec;
        rxq_data->cqes = (volatile struct mlx5_cqe (*)[])(uintptr_t)cq_info.buf;
+       rxq_data->cq_uar = cq_info.cq_uar;
+       rxq_data->cqn = cq_info.cqn;
+       rxq_data->cq_arm_sn = 0;
        /* Update doorbell counter. */
        rxq_data->rq_ci = (1 << rxq_data->elts_n) >> rxq_data->sges_n;
        rte_wmb();
@@ -929,6 +948,8 @@ mlx5_priv_rxq_new(struct priv *priv, uint16_t idx, uint16_t desc,
        if (priv->hw_csum_l2tun)
                tmpl->rxq.csum_l2tun =
                        !!dev->data->dev_conf.rxmode.hw_ip_checksum;
+       tmpl->rxq.hw_timestamp =
+                       !!dev->data->dev_conf.rxmode.hw_timestamp;
        /* Configure VLAN stripping. */
        tmpl->rxq.vlan_strip = (priv->hw_vlan_strip &&
                               !!dev->data->dev_conf.rxmode.hw_vlan_strip);
@@ -1099,7 +1120,7 @@ mlx5_priv_ind_table_ibv_new(struct priv *priv, uint16_t queues[],
        struct mlx5_ind_table_ibv *ind_tbl;
        const unsigned int wq_n = rte_is_power_of_2(queues_n) ?
                log2above(queues_n) :
-               priv->ind_table_max_size;
+               log2above(priv->ind_table_max_size);
        struct ibv_wq *wq[1 << wq_n];
        unsigned int i;
        unsigned int j;