ethdev: replace bus specific struct with generic dev
[dpdk.git] / drivers / net / mlx5 / mlx5_rxq.c
index 477aa26..eda3ba3 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2015 6WIND S.A.
- * Copyright 2015 Mellanox.
+ * Copyright 2015 Mellanox Technologies, Ltd
  */
 
 #include <stddef.h>
@@ -77,7 +77,8 @@ rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl)
 
                buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
                if (buf == NULL) {
-                       ERROR("%p: empty mbuf pool", (void *)rxq_ctrl);
+                       DRV_LOG(ERR, "port %u empty mbuf pool",
+                               rxq_ctrl->priv->dev->data->port_id);
                        rte_errno = ENOMEM;
                        goto error;
                }
@@ -118,8 +119,11 @@ rxq_alloc_elts(struct mlx5_rxq_ctrl *rxq_ctrl)
                for (j = 0; j < MLX5_VPMD_DESCS_PER_LOOP; ++j)
                        (*rxq->elts)[elts_n + j] = &rxq->fake_mbuf;
        }
-       DEBUG("%p: allocated and configured %u segments (max %u packets)",
-             (void *)rxq_ctrl, elts_n, elts_n / (1 << rxq_ctrl->rxq.sges_n));
+       DRV_LOG(DEBUG,
+               "port %u Rx queue %u allocated and configured %u segments"
+               " (max %u packets)",
+               rxq_ctrl->priv->dev->data->port_id, rxq_ctrl->idx, elts_n,
+               elts_n / (1 << rxq_ctrl->rxq.sges_n));
        return 0;
 error:
        err = rte_errno; /* Save rte_errno before cleanup. */
@@ -129,7 +133,8 @@ error:
                        rte_pktmbuf_free_seg((*rxq_ctrl->rxq.elts)[i]);
                (*rxq_ctrl->rxq.elts)[i] = NULL;
        }
-       DEBUG("%p: failed, freed everything", (void *)rxq_ctrl);
+       DRV_LOG(DEBUG, "port %u Rx queue %u failed, freed everything",
+               rxq_ctrl->priv->dev->data->port_id, rxq_ctrl->idx);
        rte_errno = err; /* Restore rte_errno. */
        return -rte_errno;
 }
@@ -149,7 +154,8 @@ rxq_free_elts(struct mlx5_rxq_ctrl *rxq_ctrl)
        uint16_t used = q_n - (rxq->rq_ci - rxq->rq_pi);
        uint16_t i;
 
-       DEBUG("%p: freeing WRs", (void *)rxq_ctrl);
+       DRV_LOG(DEBUG, "port %u Rx queue %u freeing WRs",
+               rxq_ctrl->priv->dev->data->port_id, rxq_ctrl->idx);
        if (rxq->elts == NULL)
                return;
        /**
@@ -179,7 +185,8 @@ rxq_free_elts(struct mlx5_rxq_ctrl *rxq_ctrl)
 void
 mlx5_rxq_cleanup(struct mlx5_rxq_ctrl *rxq_ctrl)
 {
-       DEBUG("cleaning up %p", (void *)rxq_ctrl);
+       DRV_LOG(DEBUG, "port %u cleaning up Rx queue %u",
+               rxq_ctrl->priv->dev->data->port_id, rxq_ctrl->idx);
        if (rxq_ctrl->ibv)
                mlx5_rxq_ibv_release(rxq_ctrl->ibv);
        memset(rxq_ctrl, 0, sizeof(*rxq_ctrl));
@@ -285,44 +292,47 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 
        if (!rte_is_power_of_2(desc)) {
                desc = 1 << log2above(desc);
-               WARN("%p: increased number of descriptors in RX queue %u"
-                    " to the next power of two (%d)",
-                    (void *)dev, idx, desc);
+               DRV_LOG(WARNING,
+                       "port %u increased number of descriptors in Rx queue %u"
+                       " to the next power of two (%d)",
+                       dev->data->port_id, idx, desc);
        }
-       DEBUG("%p: configuring queue %u for %u descriptors",
-             (void *)dev, idx, desc);
+       DRV_LOG(DEBUG, "port %u configuring Rx queue %u for %u descriptors",
+               dev->data->port_id, idx, desc);
        if (idx >= priv->rxqs_n) {
-               ERROR("%p: queue index out of range (%u >= %u)",
-                     (void *)dev, idx, priv->rxqs_n);
+               DRV_LOG(ERR, "port %u Rx queue index out of range (%u >= %u)",
+                       dev->data->port_id, idx, priv->rxqs_n);
                rte_errno = EOVERFLOW;
                return -rte_errno;
        }
        if (!mlx5_is_rx_queue_offloads_allowed(dev, conf->offloads)) {
-               ERROR("%p: Rx queue offloads 0x%" PRIx64 " don't match port "
-                     "offloads 0x%" PRIx64 " or supported offloads 0x%" PRIx64,
-                     (void *)dev, conf->offloads,
-                     dev->data->dev_conf.rxmode.offloads,
-                     (mlx5_get_rx_port_offloads() |
-                      mlx5_get_rx_queue_offloads(dev)));
+               DRV_LOG(ERR,
+                       "port %u Rx queue offloads 0x%" PRIx64 " don't match"
+                       " port offloads 0x%" PRIx64 " or supported offloads 0x%"
+                       PRIx64,
+                       dev->data->port_id, conf->offloads,
+                       dev->data->dev_conf.rxmode.offloads,
+                       (mlx5_get_rx_port_offloads() |
+                        mlx5_get_rx_queue_offloads(dev)));
                rte_errno = ENOTSUP;
                return -rte_errno;
        }
        if (!mlx5_rxq_releasable(dev, idx)) {
-               ERROR("%p: unable to release queue index %u",
-                     (void *)dev, idx);
+               DRV_LOG(ERR, "port %u unable to release queue index %u",
+                       dev->data->port_id, idx);
                rte_errno = EBUSY;
                return -rte_errno;
        }
        mlx5_rxq_release(dev, idx);
        rxq_ctrl = mlx5_rxq_new(dev, idx, desc, socket, conf, mp);
        if (!rxq_ctrl) {
-               ERROR("%p: unable to allocate queue index %u",
-                     (void *)dev, idx);
+               DRV_LOG(ERR, "port %u unable to allocate queue index %u",
+                       dev->data->port_id, idx);
                rte_errno = ENOMEM;
                return -rte_errno;
        }
-       DEBUG("%p: adding RX queue %p to list",
-             (void *)dev, (void *)rxq_ctrl);
+       DRV_LOG(DEBUG, "port %u adding Rx queue %u to list",
+               dev->data->port_id, idx);
        (*priv->rxqs)[idx] = &rxq_ctrl->rxq;
        return 0;
 }
@@ -345,8 +355,9 @@ mlx5_rx_queue_release(void *dpdk_rxq)
        rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);
        priv = rxq_ctrl->priv;
        if (!mlx5_rxq_releasable(priv->dev, rxq_ctrl->rxq.stats.idx))
-               rte_panic("Rx queue %p is still used by a flow and cannot be"
-                         " removed\n", (void *)rxq_ctrl);
+               rte_panic("port %u Rx queue %u is still used by a flow and"
+                         " cannot be removed\n", priv->dev->data->port_id,
+                         rxq_ctrl->idx);
        mlx5_rxq_release(priv->dev, rxq_ctrl->rxq.stats.idx);
 }
 
@@ -374,8 +385,10 @@ mlx5_rx_intr_vec_enable(struct rte_eth_dev *dev)
        mlx5_rx_intr_vec_disable(dev);
        intr_handle->intr_vec = malloc(n * sizeof(intr_handle->intr_vec[0]));
        if (intr_handle->intr_vec == NULL) {
-               ERROR("failed to allocate memory for interrupt vector,"
-                     " Rx interrupts will not be supported");
+               DRV_LOG(ERR,
+                       "port %u failed to allocate memory for interrupt"
+                       " vector, Rx interrupts will not be supported",
+                       dev->data->port_id);
                rte_errno = ENOMEM;
                return -rte_errno;
        }
@@ -396,9 +409,11 @@ mlx5_rx_intr_vec_enable(struct rte_eth_dev *dev)
                        continue;
                }
                if (count >= RTE_MAX_RXTX_INTR_VEC_ID) {
-                       ERROR("too many Rx queues for interrupt vector size"
-                             " (%d), Rx interrupts cannot be enabled",
-                             RTE_MAX_RXTX_INTR_VEC_ID);
+                       DRV_LOG(ERR,
+                               "port %u too many Rx queues for interrupt"
+                               " vector size (%d), Rx interrupts cannot be"
+                               " enabled",
+                               dev->data->port_id, RTE_MAX_RXTX_INTR_VEC_ID);
                        mlx5_rx_intr_vec_disable(dev);
                        rte_errno = ENOMEM;
                        return -rte_errno;
@@ -408,8 +423,11 @@ mlx5_rx_intr_vec_enable(struct rte_eth_dev *dev)
                rc = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
                if (rc < 0) {
                        rte_errno = errno;
-                       ERROR("failed to make Rx interrupt file descriptor"
-                             " %d non-blocking for queue index %d", fd, i);
+                       DRV_LOG(ERR,
+                               "port %u failed to make Rx interrupt file"
+                               " descriptor %d non-blocking for queue index"
+                               " %d",
+                               dev->data->port_id, fd, i);
                        mlx5_rx_intr_vec_disable(dev);
                        return -rte_errno;
                }
@@ -575,7 +593,8 @@ exit:
        ret = rte_errno; /* Save rte_errno before cleanup. */
        if (rxq_ibv)
                mlx5_rxq_ibv_release(rxq_ibv);
-       WARN("unable to disable interrupt on rx queue %d", rx_queue_id);
+       DRV_LOG(WARNING, "port %u unable to disable interrupt on Rx queue %d",
+               dev->data->port_id, rx_queue_id);
        rte_errno = ret; /* Restore rte_errno. */
        return -rte_errno;
 }
@@ -623,8 +642,9 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
        tmpl = rte_calloc_socket(__func__, 1, sizeof(*tmpl), 0,
                                 rxq_ctrl->socket);
        if (!tmpl) {
-               ERROR("%p: cannot allocate verbs resources",
-                      (void *)rxq_ctrl);
+               DRV_LOG(ERR,
+                       "port %u Rx queue %u cannot allocate verbs resources",
+                       dev->data->port_id, rxq_ctrl->idx);
                rte_errno = ENOMEM;
                goto error;
        }
@@ -634,15 +654,16 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
        if (!tmpl->mr) {
                tmpl->mr = mlx5_mr_new(dev, rxq_data->mp);
                if (!tmpl->mr) {
-                       ERROR("%p: MR creation failure", (void *)rxq_ctrl);
+                       DRV_LOG(ERR, "port %u: memeroy region creation failure",
+                               dev->data->port_id);
                        goto error;
                }
        }
        if (rxq_ctrl->irq) {
                tmpl->channel = mlx5_glue->create_comp_channel(priv->ctx);
                if (!tmpl->channel) {
-                       ERROR("%p: Comp Channel creation failure",
-                             (void *)rxq_ctrl);
+                       DRV_LOG(ERR, "port %u: comp channel creation failure",
+                               dev->data->port_id);
                        rte_errno = ENOMEM;
                        goto error;
                }
@@ -666,20 +687,24 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
                if (mlx5_rxq_check_vec_support(rxq_data) < 0)
                        attr.cq.ibv.cqe *= 2;
        } else if (config->cqe_comp && rxq_data->hw_timestamp) {
-               DEBUG("Rx CQE compression is disabled for HW timestamp");
+               DRV_LOG(DEBUG,
+                       "port %u Rx CQE compression is disabled for HW"
+                       " timestamp",
+                       dev->data->port_id);
        }
        tmpl->cq = mlx5_glue->cq_ex_to_cq
                (mlx5_glue->dv_create_cq(priv->ctx, &attr.cq.ibv,
                                         &attr.cq.mlx5));
        if (tmpl->cq == NULL) {
-               ERROR("%p: CQ creation failure", (void *)rxq_ctrl);
+               DRV_LOG(ERR, "port %u Rx queue %u CQ creation failure",
+                       dev->data->port_id, idx);
                rte_errno = ENOMEM;
                goto error;
        }
-       DEBUG("priv->device_attr.max_qp_wr is %d",
-             priv->device_attr.orig_attr.max_qp_wr);
-       DEBUG("priv->device_attr.max_sge is %d",
-             priv->device_attr.orig_attr.max_sge);
+       DRV_LOG(DEBUG, "port %u priv->device_attr.max_qp_wr is %d",
+               dev->data->port_id, priv->device_attr.orig_attr.max_qp_wr);
+       DRV_LOG(DEBUG, "port %u priv->device_attr.max_sge is %d",
+               dev->data->port_id, priv->device_attr.orig_attr.max_sge);
        attr.wq = (struct ibv_wq_init_attr){
                .wq_context = NULL, /* Could be useful in the future. */
                .wq_type = IBV_WQT_RQ,
@@ -709,7 +734,8 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
 #endif
        tmpl->wq = mlx5_glue->create_wq(priv->ctx, &attr.wq);
        if (tmpl->wq == NULL) {
-               ERROR("%p: WQ creation failure", (void *)rxq_ctrl);
+               DRV_LOG(ERR, "port %u Rx queue %u WQ creation failure",
+                       dev->data->port_id, idx);
                rte_errno = ENOMEM;
                goto error;
        }
@@ -720,11 +746,13 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
        if (((int)attr.wq.max_wr !=
             ((1 << rxq_data->elts_n) >> rxq_data->sges_n)) ||
            ((int)attr.wq.max_sge != (1 << rxq_data->sges_n))) {
-               ERROR("%p: requested %u*%u but got %u*%u WRs*SGEs",
-                     (void *)rxq_ctrl,
-                     ((1 << rxq_data->elts_n) >> rxq_data->sges_n),
-                     (1 << rxq_data->sges_n),
-                     attr.wq.max_wr, attr.wq.max_sge);
+               DRV_LOG(ERR,
+                       "port %u Rx queue %u requested %u*%u but got %u*%u"
+                       " WRs*SGEs",
+                       dev->data->port_id, idx,
+                       ((1 << rxq_data->elts_n) >> rxq_data->sges_n),
+                       (1 << rxq_data->sges_n),
+                       attr.wq.max_wr, attr.wq.max_sge);
                rte_errno = EINVAL;
                goto error;
        }
@@ -735,8 +763,9 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
        };
        ret = mlx5_glue->modify_wq(tmpl->wq, &mod);
        if (ret) {
-               ERROR("%p: WQ state to IBV_WQS_RDY failed",
-                     (void *)rxq_ctrl);
+               DRV_LOG(ERR,
+                       "port %u Rx queue %u WQ state to IBV_WQS_RDY failed",
+                       dev->data->port_id, idx);
                rte_errno = ret;
                goto error;
        }
@@ -750,8 +779,10 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
                goto error;
        }
        if (cq_info.cqe_size != RTE_CACHE_LINE_SIZE) {
-               ERROR("Wrong MLX5_CQE_SIZE environment variable value: "
-                     "it should be set to %u", RTE_CACHE_LINE_SIZE);
+               DRV_LOG(ERR,
+                       "port %u wrong MLX5_CQE_SIZE environment variable"
+                       " value: it should be set to %u",
+                       dev->data->port_id, RTE_CACHE_LINE_SIZE);
                rte_errno = EINVAL;
                goto error;
        }
@@ -788,10 +819,11 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
        rxq_data->rq_ci = (1 << rxq_data->elts_n) >> rxq_data->sges_n;
        rte_wmb();
        *rxq_data->rq_db = rte_cpu_to_be_32(rxq_data->rq_ci);
-       DEBUG("%p: rxq updated with %p", (void *)rxq_ctrl, (void *)&tmpl);
+       DRV_LOG(DEBUG, "port %u rxq %u updated with %p", dev->data->port_id,
+               idx, (void *)&tmpl);
        rte_atomic32_inc(&tmpl->refcnt);
-       DEBUG("%p: Verbs Rx queue %p: refcnt %d", (void *)dev,
-             (void *)tmpl, rte_atomic32_read(&tmpl->refcnt));
+       DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d",
+               dev->data->port_id, idx, rte_atomic32_read(&tmpl->refcnt));
        LIST_INSERT_HEAD(&priv->rxqsibv, tmpl, next);
        priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
        return tmpl;
@@ -836,9 +868,9 @@ mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx)
        if (rxq_ctrl->ibv) {
                mlx5_mr_get(dev, rxq_data->mp);
                rte_atomic32_inc(&rxq_ctrl->ibv->refcnt);
-               DEBUG("%p: Verbs Rx queue %p: refcnt %d", (void *)dev,
-                     (void *)rxq_ctrl->ibv,
-                     rte_atomic32_read(&rxq_ctrl->ibv->refcnt));
+               DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d",
+                       dev->data->port_id, rxq_ctrl->idx,
+                       rte_atomic32_read(&rxq_ctrl->ibv->refcnt));
        }
        return rxq_ctrl->ibv;
 }
@@ -864,8 +896,9 @@ mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv)
        ret = mlx5_mr_release(rxq_ibv->mr);
        if (!ret)
                rxq_ibv->mr = NULL;
-       DEBUG("Verbs Rx queue %p: refcnt %d",
-             (void *)rxq_ibv, rte_atomic32_read(&rxq_ibv->refcnt));
+       DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d",
+               rxq_ibv->rxq_ctrl->priv->dev->data->port_id,
+               rxq_ibv->rxq_ctrl->idx, rte_atomic32_read(&rxq_ibv->refcnt));
        if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) {
                rxq_free_elts(rxq_ibv->rxq_ctrl);
                claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq));
@@ -897,8 +930,8 @@ mlx5_rxq_ibv_verify(struct rte_eth_dev *dev)
        struct mlx5_rxq_ibv *rxq_ibv;
 
        LIST_FOREACH(rxq_ibv, &priv->rxqsibv, next) {
-               DEBUG("%p: Verbs Rx queue %p still referenced", (void *)dev,
-                     (void *)rxq_ibv);
+               DRV_LOG(DEBUG, "port %u Verbs Rx queue %u still referenced",
+                       dev->data->port_id, rxq_ibv->rxq_ctrl->idx);
                ++ret;
        }
        return ret;
@@ -980,30 +1013,33 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
                size = mb_len * (1 << tmpl->rxq.sges_n);
                size -= RTE_PKTMBUF_HEADROOM;
                if (size < dev->data->dev_conf.rxmode.max_rx_pkt_len) {
-                       ERROR("%p: too many SGEs (%u) needed to handle"
-                             " requested maximum packet size %u",
-                             (void *)dev,
-                             1 << sges_n,
-                             dev->data->dev_conf.rxmode.max_rx_pkt_len);
+                       DRV_LOG(ERR,
+                               "port %u too many SGEs (%u) needed to handle"
+                               " requested maximum packet size %u",
+                               dev->data->port_id,
+                               1 << sges_n,
+                               dev->data->dev_conf.rxmode.max_rx_pkt_len);
                        rte_errno = EOVERFLOW;
                        goto error;
                }
        } else {
-               WARN("%p: the requested maximum Rx packet size (%u) is"
-                    " larger than a single mbuf (%u) and scattered"
-                    " mode has not been requested",
-                    (void *)dev,
-                    dev->data->dev_conf.rxmode.max_rx_pkt_len,
-                    mb_len - RTE_PKTMBUF_HEADROOM);
+               DRV_LOG(WARNING,
+                       "port %u the requested maximum Rx packet size (%u) is"
+                       " larger than a single mbuf (%u) and scattered mode has"
+                       " not been requested",
+                       dev->data->port_id,
+                       dev->data->dev_conf.rxmode.max_rx_pkt_len,
+                       mb_len - RTE_PKTMBUF_HEADROOM);
        }
-       DEBUG("%p: maximum number of segments per packet: %u",
-             (void *)dev, 1 << tmpl->rxq.sges_n);
+       DRV_LOG(DEBUG, "port %u maximum number of segments per packet: %u",
+               dev->data->port_id, 1 << tmpl->rxq.sges_n);
        if (desc % (1 << tmpl->rxq.sges_n)) {
-               ERROR("%p: number of RX queue descriptors (%u) is not a"
-                     " multiple of SGEs per packet (%u)",
-                     (void *)dev,
-                     desc,
-                     1 << tmpl->rxq.sges_n);
+               DRV_LOG(ERR,
+                       "port %u number of Rx queue descriptors (%u) is not a"
+                       " multiple of SGEs per packet (%u)",
+                       dev->data->port_id,
+                       desc,
+                       1 << tmpl->rxq.sges_n);
                rte_errno = EINVAL;
                goto error;
        }
@@ -1020,19 +1056,22 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
        } else if (config->hw_fcs_strip) {
                tmpl->rxq.crc_present = 1;
        } else {
-               WARN("%p: CRC stripping has been disabled but will still"
-                    " be performed by hardware, make sure MLNX_OFED and"
-                    " firmware are up to date",
-                    (void *)dev);
+               DRV_LOG(WARNING,
+                       "port %u CRC stripping has been disabled but will"
+                       " still be performed by hardware, make sure MLNX_OFED"
+                       " and firmware are up to date",
+                       dev->data->port_id);
                tmpl->rxq.crc_present = 0;
        }
-       DEBUG("%p: CRC stripping is %s, %u bytes will be subtracted from"
-             " incoming frames to hide it",
-             (void *)dev,
-             tmpl->rxq.crc_present ? "disabled" : "enabled",
-             tmpl->rxq.crc_present << 2);
+       DRV_LOG(DEBUG,
+               "port %u CRC stripping is %s, %u bytes will be subtracted from"
+               " incoming frames to hide it",
+               dev->data->port_id,
+               tmpl->rxq.crc_present ? "disabled" : "enabled",
+               tmpl->rxq.crc_present << 2);
        /* Save port ID. */
-       tmpl->rxq.rss_hash = priv->rxqs_n > 1;
+       tmpl->rxq.rss_hash = !!priv->rss_conf.rss_hf &&
+               (!!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS));
        tmpl->rxq.port_id = dev->data->port_id;
        tmpl->priv = priv;
        tmpl->rxq.mp = mp;
@@ -1040,9 +1079,10 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
        tmpl->rxq.elts_n = log2above(desc);
        tmpl->rxq.elts =
                (struct rte_mbuf *(*)[1 << tmpl->rxq.elts_n])(tmpl + 1);
+       tmpl->idx = idx;
        rte_atomic32_inc(&tmpl->refcnt);
-       DEBUG("%p: Rx queue %p: refcnt %d", (void *)dev,
-             (void *)tmpl, rte_atomic32_read(&tmpl->refcnt));
+       DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d", dev->data->port_id,
+               idx, rte_atomic32_read(&tmpl->refcnt));
        LIST_INSERT_HEAD(&priv->rxqsctrl, tmpl, next);
        return tmpl;
 error:
@@ -1073,8 +1113,9 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx)
                                        rxq);
                mlx5_rxq_ibv_get(dev, idx);
                rte_atomic32_inc(&rxq_ctrl->refcnt);
-               DEBUG("%p: Rx queue %p: refcnt %d", (void *)dev,
-                     (void *)rxq_ctrl, rte_atomic32_read(&rxq_ctrl->refcnt));
+               DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d",
+                       dev->data->port_id, rxq_ctrl->idx,
+                       rte_atomic32_read(&rxq_ctrl->refcnt));
        }
        return rxq_ctrl;
 }
@@ -1102,8 +1143,8 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
        assert(rxq_ctrl->priv);
        if (rxq_ctrl->ibv && !mlx5_rxq_ibv_release(rxq_ctrl->ibv))
                rxq_ctrl->ibv = NULL;
-       DEBUG("%p: Rx queue %p: refcnt %d", (void *)dev,
-             (void *)rxq_ctrl, rte_atomic32_read(&rxq_ctrl->refcnt));
+       DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d", dev->data->port_id,
+               rxq_ctrl->idx, rte_atomic32_read(&rxq_ctrl->refcnt));
        if (rte_atomic32_dec_and_test(&rxq_ctrl->refcnt)) {
                LIST_REMOVE(rxq_ctrl, next);
                rte_free(rxq_ctrl);
@@ -1156,8 +1197,8 @@ mlx5_rxq_verify(struct rte_eth_dev *dev)
        int ret = 0;
 
        LIST_FOREACH(rxq_ctrl, &priv->rxqsctrl, next) {
-               DEBUG("%p: Rx Queue %p still referenced", (void *)dev,
-                     (void *)rxq_ctrl);
+               DRV_LOG(DEBUG, "port %u Rx Queue %u still referenced",
+                       dev->data->port_id, rxq_ctrl->idx);
                ++ret;
        }
        return ret;
@@ -1220,12 +1261,14 @@ mlx5_ind_table_ibv_new(struct rte_eth_dev *dev, uint16_t queues[],
        }
        rte_atomic32_inc(&ind_tbl->refcnt);
        LIST_INSERT_HEAD(&priv->ind_tbls, ind_tbl, next);
-       DEBUG("%p: Indirection table %p: refcnt %d", (void *)dev,
-             (void *)ind_tbl, rte_atomic32_read(&ind_tbl->refcnt));
+       DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d",
+               dev->data->port_id, (void *)ind_tbl,
+               rte_atomic32_read(&ind_tbl->refcnt));
        return ind_tbl;
 error:
        rte_free(ind_tbl);
-       DEBUG("%p cannot create indirection table", (void *)dev);
+       DRV_LOG(DEBUG, "port %u cannot create indirection table",
+               dev->data->port_id);
        return NULL;
 }
 
@@ -1260,8 +1303,9 @@ mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, uint16_t queues[],
                unsigned int i;
 
                rte_atomic32_inc(&ind_tbl->refcnt);
-               DEBUG("%p: Indirection table %p: refcnt %d", (void *)dev,
-                     (void *)ind_tbl, rte_atomic32_read(&ind_tbl->refcnt));
+               DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d",
+                       dev->data->port_id, (void *)ind_tbl,
+                       rte_atomic32_read(&ind_tbl->refcnt));
                for (i = 0; i != ind_tbl->queues_n; ++i)
                        mlx5_rxq_get(dev, ind_tbl->queues[i]);
        }
@@ -1285,8 +1329,9 @@ mlx5_ind_table_ibv_release(struct rte_eth_dev *dev,
 {
        unsigned int i;
 
-       DEBUG("%p: Indirection table %p: refcnt %d", (void *)dev,
-             (void *)ind_tbl, rte_atomic32_read(&ind_tbl->refcnt));
+       DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d",
+               ((struct priv *)dev->data->dev_private)->port,
+               (void *)ind_tbl, rte_atomic32_read(&ind_tbl->refcnt));
        if (rte_atomic32_dec_and_test(&ind_tbl->refcnt))
                claim_zero(mlx5_glue->destroy_rwq_ind_table
                           (ind_tbl->ind_table));
@@ -1317,8 +1362,9 @@ mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev)
        int ret = 0;
 
        LIST_FOREACH(ind_tbl, &priv->ind_tbls, next) {
-               DEBUG("%p: Verbs indirection table %p still referenced",
-                     (void *)dev, (void *)ind_tbl);
+               DRV_LOG(DEBUG,
+                       "port %u Verbs indirection table %p still referenced",
+                       dev->data->port_id, (void *)ind_tbl);
                ++ret;
        }
        return ret;
@@ -1393,8 +1439,9 @@ mlx5_hrxq_new(struct rte_eth_dev *dev, uint8_t *rss_key, uint8_t rss_key_len,
        memcpy(hrxq->rss_key, rss_key, rss_key_len);
        rte_atomic32_inc(&hrxq->refcnt);
        LIST_INSERT_HEAD(&priv->hrxqs, hrxq, next);
-       DEBUG("%p: Hash Rx queue %p: refcnt %d", (void *)dev,
-             (void *)hrxq, rte_atomic32_read(&hrxq->refcnt));
+       DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d",
+               dev->data->port_id, (void *)hrxq,
+               rte_atomic32_read(&hrxq->refcnt));
        return hrxq;
 error:
        err = rte_errno; /* Save rte_errno before cleanup. */
@@ -1446,8 +1493,9 @@ mlx5_hrxq_get(struct rte_eth_dev *dev, uint8_t *rss_key, uint8_t rss_key_len,
                        continue;
                }
                rte_atomic32_inc(&hrxq->refcnt);
-               DEBUG("%p: Hash Rx queue %p: refcnt %d", (void *)dev,
-                     (void *)hrxq, rte_atomic32_read(&hrxq->refcnt));
+               DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d",
+                       dev->data->port_id, (void *)hrxq,
+                       rte_atomic32_read(&hrxq->refcnt));
                return hrxq;
        }
        return NULL;
@@ -1467,8 +1515,9 @@ mlx5_hrxq_get(struct rte_eth_dev *dev, uint8_t *rss_key, uint8_t rss_key_len,
 int
 mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)
 {
-       DEBUG("%p: Hash Rx queue %p: refcnt %d", (void *)dev,
-             (void *)hrxq, rte_atomic32_read(&hrxq->refcnt));
+       DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d",
+               ((struct priv *)dev->data->dev_private)->port,
+               (void *)hrxq, rte_atomic32_read(&hrxq->refcnt));
        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);
@@ -1497,8 +1546,9 @@ mlx5_hrxq_ibv_verify(struct rte_eth_dev *dev)
        int ret = 0;
 
        LIST_FOREACH(hrxq, &priv->hrxqs, next) {
-               DEBUG("%p: Verbs Hash Rx queue %p still referenced",
-                     (void *)dev, (void *)hrxq);
+               DRV_LOG(DEBUG,
+                       "port %u Verbs hash Rx queue %p still referenced",
+                       dev->data->port_id, (void *)hrxq);
                ++ret;
        }
        return ret;