net/mlx5: improve Verbs flow priority discovery
[dpdk.git] / drivers / net / mlx5 / mlx5_rx.c
index 8d47637..6848d01 100644 (file)
 
 #include <mlx5_prm.h>
 #include <mlx5_common.h>
+#include <mlx5_common_mr.h>
 
 #include "mlx5_autoconf.h"
 #include "mlx5_defs.h"
 #include "mlx5.h"
-#include "mlx5_mr.h"
 #include "mlx5_utils.h"
 #include "mlx5_rxtx.h"
 #include "mlx5_rx.h"
@@ -240,32 +240,32 @@ mlx5_rx_burst_mode_get(struct rte_eth_dev *dev,
 /**
  * DPDK callback to get the number of used descriptors in a RX queue.
  *
- * @param dev
- *   Pointer to the device structure.
- *
- * @param rx_queue_id
- *   The Rx queue.
+ * @param rx_queue
+ *   The Rx queue pointer.
  *
  * @return
  *   The number of used rx descriptor.
  *   -EINVAL if the queue is invalid
  */
 uint32_t
-mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+mlx5_rx_queue_count(void *rx_queue)
 {
-       struct mlx5_priv *priv = dev->data->dev_private;
-       struct mlx5_rxq_data *rxq;
+       struct mlx5_rxq_data *rxq = rx_queue;
+       struct rte_eth_dev *dev;
+
+       if (!rxq) {
+               rte_errno = EINVAL;
+               return -rte_errno;
+       }
+
+       dev = &rte_eth_devices[rxq->port_id];
 
        if (dev->rx_pkt_burst == NULL ||
            dev->rx_pkt_burst == removed_rx_burst) {
                rte_errno = ENOTSUP;
                return -rte_errno;
        }
-       rxq = (*priv->rxqs)[rx_queue_id];
-       if (!rxq) {
-               rte_errno = EINVAL;
-               return -rte_errno;
-       }
+
        return rx_queue_count(rxq);
 }
 
@@ -753,8 +753,7 @@ rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt,
                }
        }
        if (rxq->dynf_meta) {
-               uint32_t meta = rte_be_to_cpu_32(cqe->flow_table_metadata >>
-                       __builtin_popcount(rxq->flow_meta_port_mask)) &
+               uint32_t meta = rte_be_to_cpu_32(cqe->flow_table_metadata) &
                        rxq->flow_meta_port_mask;
 
                if (meta) {
@@ -1029,20 +1028,6 @@ mlx5_lro_update_hdr(uint8_t *__rte_restrict padd,
        mlx5_lro_update_tcp_hdr(h.tcp, cqe, phcsum, l4_type);
 }
 
-void
-mlx5_mprq_buf_free_cb(void *addr __rte_unused, void *opaque)
-{
-       struct mlx5_mprq_buf *buf = opaque;
-
-       if (__atomic_load_n(&buf->refcnt, __ATOMIC_RELAXED) == 1) {
-               rte_mempool_put(buf->mp, buf);
-       } else if (unlikely(__atomic_sub_fetch(&buf->refcnt, 1,
-                                              __ATOMIC_RELAXED) == 0)) {
-               __atomic_store_n(&buf->refcnt, 1, __ATOMIC_RELAXED);
-               rte_mempool_put(buf->mp, buf);
-       }
-}
-
 void
 mlx5_mprq_buf_free(struct mlx5_mprq_buf *buf)
 {