net/i40e/base: enable proxy command for X722
[dpdk.git] / drivers / net / mlx5 / mlx5_mr.c
index bb44041..0a36384 100644 (file)
 /* Verbs header. */
 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
 #ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-pedantic"
+#pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 #include <infiniband/verbs.h>
 #ifdef PEDANTIC
-#pragma GCC diagnostic error "-pedantic"
+#pragma GCC diagnostic error "-Wpedantic"
 #endif
 
 /* DPDK headers don't like -pedantic. */
 #ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-pedantic"
+#pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 #include <rte_mempool.h>
 #ifdef PEDANTIC
-#pragma GCC diagnostic error "-pedantic"
+#pragma GCC diagnostic error "-Wpedantic"
 #endif
 
 #include "mlx5.h"
@@ -184,33 +184,36 @@ mlx5_mp2mr(struct ibv_pd *pd, struct rte_mempool *mp)
 uint32_t
 txq_mp2mr_reg(struct txq *txq, struct rte_mempool *mp, unsigned int idx)
 {
+       struct txq_ctrl *txq_ctrl = container_of(txq, struct txq_ctrl, txq);
        struct ibv_mr *mr;
 
        /* Add a new entry, register MR first. */
        DEBUG("%p: discovered new memory pool \"%s\" (%p)",
-             (void *)txq, mp->name, (void *)mp);
-       mr = mlx5_mp2mr(txq->priv->pd, mp);
+             (void *)txq_ctrl, mp->name, (void *)mp);
+       mr = mlx5_mp2mr(txq_ctrl->priv->pd, mp);
        if (unlikely(mr == NULL)) {
                DEBUG("%p: unable to configure MR, ibv_reg_mr() failed.",
-                     (void *)txq);
+                     (void *)txq_ctrl);
                return (uint32_t)-1;
        }
-       if (unlikely(idx == RTE_DIM(txq->mp2mr))) {
+       if (unlikely(idx == RTE_DIM(txq_ctrl->txq.mp2mr))) {
                /* Table is full, remove oldest entry. */
                DEBUG("%p: MR <-> MP table full, dropping oldest entry.",
-                     (void *)txq);
+                     (void *)txq_ctrl);
                --idx;
-               claim_zero(ibv_dereg_mr(txq->mp2mr[0].mr));
-               memmove(&txq->mp2mr[0], &txq->mp2mr[1],
-                       (sizeof(txq->mp2mr) - sizeof(txq->mp2mr[0])));
+               claim_zero(ibv_dereg_mr(txq_ctrl->txq.mp2mr[0].mr));
+               memmove(&txq_ctrl->txq.mp2mr[0], &txq_ctrl->txq.mp2mr[1],
+                       (sizeof(txq_ctrl->txq.mp2mr) -
+                        sizeof(txq_ctrl->txq.mp2mr[0])));
        }
        /* Store the new entry. */
-       txq->mp2mr[idx].mp = mp;
-       txq->mp2mr[idx].mr = mr;
-       txq->mp2mr[idx].lkey = mr->lkey;
+       txq_ctrl->txq.mp2mr[idx].mp = mp;
+       txq_ctrl->txq.mp2mr[idx].mr = mr;
+       txq_ctrl->txq.mp2mr[idx].lkey = htonl(mr->lkey);
        DEBUG("%p: new MR lkey for MP \"%s\" (%p): 0x%08" PRIu32,
-             (void *)txq, mp->name, (void *)mp, txq->mp2mr[idx].lkey);
-       return txq->mp2mr[idx].lkey;
+             (void *)txq_ctrl, mp->name, (void *)mp,
+             txq_ctrl->txq.mp2mr[idx].lkey);
+       return txq_ctrl->txq.mp2mr[idx].lkey;
 }
 
 struct txq_mp2mr_mbuf_check_data {
@@ -258,7 +261,7 @@ txq_mp2mr_mbuf_check(struct rte_mempool *mp, void *arg, void *obj,
 void
 txq_mp2mr_iter(struct rte_mempool *mp, void *arg)
 {
-       struct txq *txq = arg;
+       struct txq_ctrl *txq_ctrl = arg;
        struct txq_mp2mr_mbuf_check_data data = {
                .ret = 0,
        };
@@ -268,13 +271,13 @@ txq_mp2mr_iter(struct rte_mempool *mp, void *arg)
        if (rte_mempool_obj_iter(mp, txq_mp2mr_mbuf_check, &data) == 0 ||
                        data.ret == -1)
                return;
-       for (i = 0; (i != RTE_DIM(txq->mp2mr)); ++i) {
-               if (unlikely(txq->mp2mr[i].mp == NULL)) {
+       for (i = 0; (i != RTE_DIM(txq_ctrl->txq.mp2mr)); ++i) {
+               if (unlikely(txq_ctrl->txq.mp2mr[i].mp == NULL)) {
                        /* Unknown MP, add a new MR for it. */
                        break;
                }
-               if (txq->mp2mr[i].mp == mp)
+               if (txq_ctrl->txq.mp2mr[i].mp == mp)
                        return;
        }
-       txq_mp2mr_reg(txq, mp, i);
+       txq_mp2mr_reg(&txq_ctrl->txq, mp, i);
 }