Replace the usage of RTE_LOG* macro with PMD specific logging.

Signed-off-by: Chaoyong He <chaoyong...@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderl...@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c        | 10 ++---
 drivers/net/nfp/flower/nfp_flower_ctrl.c   |  2 +-
 drivers/net/nfp/nfp_cpp_bridge.c           | 48 ++++++++++------------
 drivers/net/nfp/nfp_ethdev.c               |  4 +-
 drivers/net/nfp/nfp_ethdev_vf.c            |  4 +-
 drivers/net/nfp/nfp_rxtx.c                 | 10 ++---
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c |  1 +
 7 files changed, 38 insertions(+), 41 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c 
b/drivers/net/nfp/flower/nfp_flower.c
index f1424a010d..42014295ab 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -330,7 +330,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue,
                 * DPDK just checks the queue is lower than max queues
                 * enabled. But the queue needs to be configured
                 */
-               RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
+               PMD_RX_LOG(ERR, "RX Bad queue");
                return 0;
        }
 
@@ -343,7 +343,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue,
        while (avail + avail_multiplexed < nb_pkts) {
                rxb = &rxq->rxbufs[rxq->rd_p];
                if (unlikely(rxb == NULL)) {
-                       RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
+                       PMD_RX_LOG(ERR, "rxb does not exist!");
                        break;
                }
 
@@ -363,8 +363,8 @@ nfp_flower_pf_recv_pkts(void *rx_queue,
                 */
                new_mb = rte_pktmbuf_alloc(rxq->mem_pool);
                if (unlikely(new_mb == NULL)) {
-                       RTE_LOG_DP(DEBUG, PMD,
-                       "RX mbuf alloc failed port_id=%u queue_id=%d\n",
+                       PMD_RX_LOG(DEBUG,
+                       "RX mbuf alloc failed port_id=%u queue_id=%d",
                                rxq->port_id, rxq->qidx);
                        nfp_net_mbuf_alloc_failed(rxq);
                        break;
@@ -391,7 +391,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue,
                         * responsibility of avoiding it. But we have
                         * to give some info about the error
                         */
-                       RTE_LOG_DP(ERR, PMD,
+                       PMD_RX_LOG(ERR,
                                "mbuf overflow likely due to the RX offset.\n"
                                "\t\tYour mbuf size should have extra space for"
                                " RX offset=%u bytes.\n"
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c 
b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 03a2e2e622..6e7545bc39 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -91,7 +91,7 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue,
                         * responsibility of avoiding it. But we have
                         * to give some info about the error
                         */
-                       RTE_LOG_DP(ERR, PMD,
+                       PMD_RX_LOG(ERR,
                                "mbuf overflow likely due to the RX offset.\n"
                                "\t\tYour mbuf size should have extra space for"
                                " RX offset=%u bytes.\n"
diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c
index 4aa36eb581..8e29cfb6d3 100644
--- a/drivers/net/nfp/nfp_cpp_bridge.c
+++ b/drivers/net/nfp/nfp_cpp_bridge.c
@@ -162,14 +162,14 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp 
*cpp)
                area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
                                                    nfp_offset, curlen);
                if (area == NULL) {
-                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
+                       PMD_CPP_LOG(ERR, "area alloc fail");
                        return -EIO;
                }
 
                /* mapping the target */
                err = nfp_cpp_area_acquire(area);
                if (err < 0) {
-                       RTE_LOG(ERR, PMD, "area acquire failed\n");
+                       PMD_CPP_LOG(ERR, "area acquire failed");
                        nfp_cpp_area_free(area);
                        return -EIO;
                }
@@ -183,16 +183,16 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp 
*cpp)
                                           len, count);
                        err = recv(sockfd, tmpbuf, len, MSG_WAITALL);
                        if (err != (int)len) {
-                               RTE_LOG(ERR, PMD,
-                                       "%s: error when receiving, %d of %zu\n",
-                                       __func__, err, count);
+                               PMD_CPP_LOG(ERR,
+                                       "error when receiving, %d of %zu",
+                                       err, count);
                                nfp_cpp_area_release(area);
                                nfp_cpp_area_free(area);
                                return -EIO;
                        }
                        err = nfp_cpp_area_write(area, pos, tmpbuf, len);
                        if (err < 0) {
-                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write error\n");
+                               PMD_CPP_LOG(ERR, "nfp_cpp_area_write error");
                                nfp_cpp_area_release(area);
                                nfp_cpp_area_free(area);
                                return -EIO;
@@ -262,13 +262,13 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
                area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
                                                    nfp_offset, curlen);
                if (area == NULL) {
-                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
+                       PMD_CPP_LOG(ERR, "area alloc failed");
                        return -EIO;
                }
 
                err = nfp_cpp_area_acquire(area);
                if (err < 0) {
-                       RTE_LOG(ERR, PMD, "area acquire failed\n");
+                       PMD_CPP_LOG(ERR, "area acquire failed");
                        nfp_cpp_area_free(area);
                        return -EIO;
                }
@@ -280,7 +280,7 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 
                        err = nfp_cpp_area_read(area, pos, tmpbuf, len);
                        if (err < 0) {
-                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read error\n");
+                               PMD_CPP_LOG(ERR, "nfp_cpp_area_read error");
                                nfp_cpp_area_release(area);
                                nfp_cpp_area_free(area);
                                return -EIO;
@@ -290,9 +290,9 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 
                        err = send(sockfd, tmpbuf, len, 0);
                        if (err != (int)len) {
-                               RTE_LOG(ERR, PMD,
-                                       "%s: error when sending: %d of %zu\n",
-                                       __func__, err, count);
+                               PMD_CPP_LOG(ERR,
+                                       "error when sending: %d of %zu",
+                                       err, count);
                                nfp_cpp_area_release(area);
                                nfp_cpp_area_free(area);
                                return -EIO;
@@ -325,19 +325,19 @@ nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp 
*cpp)
        /* Reading now the IOCTL command */
        err = recv(sockfd, &cmd, 4, 0);
        if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
+               PMD_CPP_LOG(ERR, "read error from socket");
                return -EIO;
        }
 
        /* Only supporting NFP_IOCTL_CPP_IDENTIFICATION */
        if (cmd != NFP_IOCTL_CPP_IDENTIFICATION) {
-               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
+               PMD_CPP_LOG(ERR, "unknown cmd %d", cmd);
                return -EINVAL;
        }
 
        err = recv(sockfd, &ident_size, 4, 0);
        if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
+               PMD_CPP_LOG(ERR, "read error from socket");
                return -EIO;
        }
 
@@ -347,7 +347,7 @@ nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp)
 
        err = send(sockfd, &tmp, 4, 0);
        if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
+               PMD_CPP_LOG(ERR, "error writing to socket");
                return -EIO;
        }
 
@@ -357,7 +357,7 @@ nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp)
 
        err = send(sockfd, &tmp, 4, 0);
        if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
+               PMD_CPP_LOG(ERR, "error writing to socket");
                return -EIO;
        }
 
@@ -384,8 +384,7 @@ nfp_cpp_bridge_service_func(void *args)
        unlink("/tmp/nfp_cpp");
        sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (sockfd < 0) {
-               RTE_LOG(ERR, PMD, "%s: socket creation error. Service failed\n",
-                       __func__);
+               PMD_CPP_LOG(ERR, "socket creation error. Service failed");
                return -EIO;
        }
 
@@ -399,16 +398,14 @@ nfp_cpp_bridge_service_func(void *args)
        ret = bind(sockfd, (const struct sockaddr *)&address,
                   sizeof(struct sockaddr));
        if (ret < 0) {
-               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n",
-                                 __func__, errno);
+               PMD_CPP_LOG(ERR, "bind error (%d). Service failed", errno);
                close(sockfd);
                return ret;
        }
 
        ret = listen(sockfd, 20);
        if (ret < 0) {
-               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n",
-                                 __func__, errno);
+               PMD_CPP_LOG(ERR, "listen error(%d). Service failed", errno);
                close(sockfd);
                return ret;
        }
@@ -421,9 +418,8 @@ nfp_cpp_bridge_service_func(void *args)
                        if (errno == EAGAIN || errno == EWOULDBLOCK)
                                continue;
 
-                       RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
-                                         __func__, errno);
-                       RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
+                       PMD_CPP_LOG(ERR, "accept call error (%d)", errno);
+                       PMD_CPP_LOG(ERR, "service failed");
                        close(sockfd);
                        return -EIO;
                }
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f05c50ac88..139f3090aa 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -519,8 +519,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 
        /* NFP can not handle DMA addresses requiring more than 40 bits */
        if (rte_mem_check_dma_mask(40)) {
-               RTE_LOG(ERR, PMD,
-                       "device %s can not be used: restricted dma mask to 40 
bits!\n",
+               PMD_INIT_LOG(ERR,
+                       "device %s can not be used: restricted dma mask to 40 
bits!",
                        pci_dev->device.name);
                return -ENODEV;
        }
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 07a2e17ef8..cbe5c5c5c8 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -293,8 +293,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
 
        /* NFP can not handle DMA addresses requiring more than 40 bits */
        if (rte_mem_check_dma_mask(40)) {
-               RTE_LOG(ERR, PMD,
-                       "device %s can not be used: restricted dma mask to 40 
bits!\n",
+               PMD_INIT_LOG(ERR,
+                       "device %s can not be used: restricted dma mask to 40 
bits!",
                        pci_dev->device.name);
                return -ENODEV;
        }
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 79a66b6e44..09cc24741a 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -353,7 +353,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
                 * DPDK just checks the queue is lower than max queues
                 * enabled. But the queue needs to be configured
                 */
-               RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
+               PMD_RX_LOG(ERR, "RX Bad queue");
                return avail;
        }
 
@@ -363,7 +363,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
        while (avail < nb_pkts) {
                rxb = &rxq->rxbufs[rxq->rd_p];
                if (unlikely(rxb == NULL)) {
-                       RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
+                       PMD_RX_LOG(ERR, "rxb does not exist!");
                        break;
                }
 
@@ -383,8 +383,8 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
                 */
                new_mb = rte_pktmbuf_alloc(rxq->mem_pool);
                if (unlikely(new_mb == NULL)) {
-                       RTE_LOG_DP(DEBUG, PMD,
-                       "RX mbuf alloc failed port_id=%u queue_id=%u\n",
+                       PMD_RX_LOG(DEBUG,
+                       "RX mbuf alloc failed port_id=%u queue_id=%u",
                                rxq->port_id, (unsigned int)rxq->qidx);
                        nfp_net_mbuf_alloc_failed(rxq);
                        break;
@@ -412,7 +412,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts)
                         * responsibility of avoiding it. But we have
                         * to give some info about the error
                         */
-                       RTE_LOG_DP(ERR, PMD,
+                       PMD_RX_LOG(ERR,
                                "mbuf overflow likely due to the RX offset.\n"
                                "\t\tYour mbuf size should have extra space for"
                                " RX offset=%u bytes.\n"
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c 
b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index d8d1293166..6029bd6c3a 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -36,6 +36,7 @@
 #include "nfp_logs.h"
 #include "nfp_target.h"
 #include "nfp6000/nfp6000.h"
+#include "../nfp_logs.h"
 
 #define NFP_PCIE_BAR(_pf)      (0x30000 + ((_pf) & 7) * 0xc0)
 
-- 
2.29.3

Reply via email to