net/mlx5: fix release of jump to queue action
[dpdk.git] / drivers / net / mlx5 / mlx5_rxq.c
index 8a84b0a..836bec9 100644 (file)
@@ -1864,6 +1864,13 @@ mlx5_hrxq_new(struct rte_eth_dev *dev,
        hrxq->rss_key_len = rss_key_len;
        hrxq->hash_fields = hash_fields;
        memcpy(hrxq->rss_key, rss_key, rss_key_len);
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       hrxq->action = mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp);
+       if (!hrxq->action) {
+               rte_errno = errno;
+               goto error;
+       }
+#endif
        rte_atomic32_inc(&hrxq->refcnt);
        LIST_INSERT_HEAD(&priv->hrxqs, hrxq, next);
        return hrxq;
@@ -1941,6 +1948,9 @@ mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)
        if (rte_atomic32_dec_and_test(&hrxq->refcnt)) {
                claim_zero(mlx5_glue->destroy_qp(hrxq->qp));
                mlx5_ind_table_ibv_release(dev, hrxq->ind_table);
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+               mlx5_glue->destroy_flow_action(hrxq->action);
+#endif
                LIST_REMOVE(hrxq, next);
                rte_free(hrxq);
                return 0;
@@ -2178,6 +2188,13 @@ mlx5_hrxq_drop_new(struct rte_eth_dev *dev)
        }
        hrxq->ind_table = ind_tbl;
        hrxq->qp = qp;
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       hrxq->action = mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp);
+       if (!hrxq->action) {
+               rte_errno = errno;
+               goto error;
+       }
+#endif
        priv->drop_queue.hrxq = hrxq;
        rte_atomic32_set(&hrxq->refcnt, 1);
        return hrxq;
@@ -2202,6 +2219,9 @@ mlx5_hrxq_drop_release(struct rte_eth_dev *dev)
        if (rte_atomic32_dec_and_test(&hrxq->refcnt)) {
                claim_zero(mlx5_glue->destroy_qp(hrxq->qp));
                mlx5_ind_table_ibv_drop_release(dev);
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+               mlx5_glue->destroy_flow_action(hrxq->action);
+#endif
                rte_free(hrxq);
                priv->drop_queue.hrxq = NULL;
        }