From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BEFB438A3; Fri, 12 Jan 2024 14:58:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B5B74026E; Fri, 12 Jan 2024 14:58:03 +0100 (CET) Received: from office2.cesnet.cz (office2.cesnet.cz [78.128.248.237]) by mails.dpdk.org (Postfix) with ESMTP id 2CB1F4025E for ; Fri, 12 Jan 2024 14:58:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1705067881; bh=mAeHXnWf0uDThKQehyKKhe+1+ZZ0uNe3uvxd+WkEFiU=; h=Subject:From:To:Date:In-Reply-To:References; b=KuAp1hg57ZIcm9Uhrys+PCE2rxnBrAQoqqsodm5Nb//wN9XoGEOeQC/2o0ifVgiQC gHk6I6SeEOuM1DstpMNhZnYpChVsTSv/lt/PKbS2H8q1OE0iCDiTbwzxhp/Zfmu4vg jFBxxjx3+tBYZWoObA5VPPA2yvUJMOr6JGoz+aUSlCbPP9/EUWmL6mirrmBndI0QEC BYbPB9u8oLCakACehlXS0lh2DSWKXY+iwz4fRg5Hp1ozbd2PZg8tzgL7syuddIYrLX U8hcDHXSWZeJ6hcZ2rCGOa1fgoEqd300IkoLlmiQkdrUC5CtX1g7LPzNkxaBKia5lk 0+2qWR5fBflew== Received: from [IPv6:2001:67c:1220:80c:1b:e00e:9e81:ff5f] (unknown [IPv6:2001:67c:1220:80c:1b:e00e:9e81:ff5f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 0AADB1180072; Fri, 12 Jan 2024 14:58:00 +0100 (CET) Message-ID: <2e44b5aa50f190c431c1005d4ce51c141cc50f8f.camel@cesnet.cz> Subject: Re: [PATCH v6 08/20] net/nfb: use dynamic logtype From: Martin Spinler To: Stephen Hemminger , dev@dpdk.org Date: Fri, 12 Jan 2024 14:57:55 +0100 In-Reply-To: <20231222171820.8778-9-stephen@networkplumber.org> References: <20231213014408.612051-1-stephen@networkplumber.org> <20231222171820.8778-1-stephen@networkplumber.org> <20231222171820.8778-9-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Tested-by: Martin Spinler Acked-by: Martin Spinler On Fri, 2023-12-22 at 09:11 -0800, Stephen Hemminger wrote: > All drivers should be using dynamic logtype. >=20 > Fixes: 6435f9a0ac22 ("net/nfb: add new netcope driver") > Signed-off-by: Stephen Hemminger > --- > drivers/net/nfb/nfb.h | 5 +++++ > drivers/net/nfb/nfb_ethdev.c | 24 ++++++++++-------------- > drivers/net/nfb/nfb_rx.c | 9 ++++----- > drivers/net/nfb/nfb_rx.h | 2 +- > drivers/net/nfb/nfb_tx.c | 9 ++++----- > drivers/net/nfb/nfb_tx.h | 2 +- > 6 files changed, 25 insertions(+), 26 deletions(-) >=20 > diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h > index 7dc5bd29e44c..45226ee3d938 100644 > --- a/drivers/net/nfb/nfb.h > +++ b/drivers/net/nfb/nfb.h > @@ -12,6 +12,11 @@ > #include > #include > =20 > +extern int nfb_logtype; > +#define NFB_LOG(level, fmt, args...) \ > + rte_log(RTE_LOG_ ## level, nfb_logtype, "%s(): " fmt "\n", \ > + __func__, ## args) > + > #include "nfb_rx.h" > #include "nfb_tx.h" > =20 > diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c > index defd118bd0ee..e533144efe5d 100644 > --- a/drivers/net/nfb/nfb_ethdev.c > +++ b/drivers/net/nfb/nfb_ethdev.c > @@ -12,11 +12,9 @@ > #include > #include > =20 > +#include "nfb.h" > #include "nfb_stats.h" > -#include "nfb_rx.h" > -#include "nfb_tx.h" > #include "nfb_rxmode.h" > -#include "nfb.h" > =20 > /** > * Default MAC addr > @@ -192,8 +190,7 @@ nfb_eth_dev_configure(struct rte_eth_dev *dev __rte_u= nused) > (&nfb_timestamp_dynfield_offset, > &nfb_timestamp_rx_dynflag); > if (ret !=3D 0) { > - RTE_LOG(ERR, PMD, "Cannot register Rx timestamp" > - " field/flag %d\n", ret); > + NFB_LOG(ERR, "Cannot register Rx timestamp field/flag %d", ret); > nfb_close(internals->nfb); > return -rte_errno; > } > @@ -520,7 +517,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) > struct rte_ether_addr eth_addr_init; > struct rte_kvargs *kvlist; > =20 > - RTE_LOG(INFO, PMD, "Initializing NFB device (" PCI_PRI_FMT ")\n", > + NFB_LOG(INFO, "Initializing NFB device (" PCI_PRI_FMT ")", > pci_addr->domain, pci_addr->bus, pci_addr->devid, > pci_addr->function); > =20 > @@ -536,7 +533,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) > kvlist =3D rte_kvargs_parse(dev->device->devargs->args, > VALID_KEYS); > if (kvlist =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "Failed to parse device arguments %s", > + NFB_LOG(ERR, "Failed to parse device arguments %s", > dev->device->devargs->args); > rte_kvargs_free(kvlist); > return -EINVAL; > @@ -551,14 +548,14 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) > */ > internals->nfb =3D nfb_open(internals->nfb_dev); > if (internals->nfb =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "nfb_open(): failed to open %s", > + NFB_LOG(ERR, "nfb_open(): failed to open %s", > internals->nfb_dev); > return -EINVAL; > } > data->nb_rx_queues =3D ndp_get_rx_queue_available_count(internals->nfb)= ; > data->nb_tx_queues =3D ndp_get_tx_queue_available_count(internals->nfb)= ; > =20 > - RTE_LOG(INFO, PMD, "Available NDP queues RX: %u TX: %u\n", > + NFB_LOG(INFO, "Available NDP queues RX: %u TX: %u\n", > data->nb_rx_queues, data->nb_tx_queues); > =20 > nfb_nc_rxmac_init(internals->nfb, > @@ -583,7 +580,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) > data->mac_addrs =3D rte_zmalloc(data->name, > sizeof(struct rte_ether_addr) * mac_count, RTE_CACHE_LINE_SIZE); > if (data->mac_addrs =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "Could not alloc space for MAC address!\n"); > + NFB_LOG(ERR, "Could not alloc space for MAC address"); > nfb_close(internals->nfb); > return -EINVAL; > } > @@ -601,8 +598,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) > =20 > dev->data->dev_flags |=3D RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > =20 > - RTE_LOG(INFO, PMD, "NFB device (" > - PCI_PRI_FMT ") successfully initialized\n", > + NFB_LOG(INFO, "NFB device (" PCI_PRI_FMT ") successfully initialized", > pci_addr->domain, pci_addr->bus, pci_addr->devid, > pci_addr->function); > =20 > @@ -626,8 +622,7 @@ nfb_eth_dev_uninit(struct rte_eth_dev *dev) > =20 > nfb_eth_dev_close(dev); > =20 > - RTE_LOG(INFO, PMD, "NFB device (" > - PCI_PRI_FMT ") successfully uninitialized\n", > + NFB_LOG(INFO, "NFB device (" PCI_PRI_FMT ") successfully uninitialized"= , > pci_addr->domain, pci_addr->bus, pci_addr->devid, > pci_addr->function); > =20 > @@ -690,3 +685,4 @@ static struct rte_pci_driver nfb_eth_driver =3D { > RTE_PMD_REGISTER_PCI(RTE_NFB_DRIVER_NAME, nfb_eth_driver); > RTE_PMD_REGISTER_PCI_TABLE(RTE_NFB_DRIVER_NAME, nfb_pci_id_table); > RTE_PMD_REGISTER_KMOD_DEP(RTE_NFB_DRIVER_NAME, "* nfb"); > +RTE_LOG_REGISTER_DEFAULT(nfb_logtype, NOTICE); > diff --git a/drivers/net/nfb/nfb_rx.c b/drivers/net/nfb/nfb_rx.c > index 8a9b232305f2..a20f7b9b4b41 100644 > --- a/drivers/net/nfb/nfb_rx.c > +++ b/drivers/net/nfb/nfb_rx.c > @@ -6,7 +6,6 @@ > =20 > #include > =20 > -#include "nfb_rx.h" > #include "nfb.h" > =20 > uint64_t nfb_timestamp_rx_dynflag; > @@ -19,7 +18,7 @@ nfb_eth_rx_queue_start(struct rte_eth_dev *dev, uint16_= t rxq_id) > int ret; > =20 > if (rxq->queue =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "RX NDP queue is NULL!\n"); > + NFB_LOG(ERR, "RX NDP queue is NULL"); > return -EINVAL; > } > =20 > @@ -40,7 +39,7 @@ nfb_eth_rx_queue_stop(struct rte_eth_dev *dev, uint16_t= rxq_id) > int ret; > =20 > if (rxq->queue =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "RX NDP queue is NULL!\n"); > + NFB_LOG(ERR, "RX NDP queue is NULL"); > return -EINVAL; > } > =20 > @@ -70,8 +69,8 @@ nfb_eth_rx_queue_setup(struct rte_eth_dev *dev, > RTE_CACHE_LINE_SIZE, socket_id); > =20 > if (rxq =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "rte_zmalloc_socket() failed for rx queue id " > - "%" PRIu16 "!\n", rx_queue_id); > + NFB_LOG(ERR, "rte_zmalloc_socket() failed for rx queue id %" PRIu16, > + rx_queue_id); > return -ENOMEM; > } > =20 > diff --git a/drivers/net/nfb/nfb_rx.h b/drivers/net/nfb/nfb_rx.h > index b618682e1393..2802f17091a0 100644 > --- a/drivers/net/nfb/nfb_rx.h > +++ b/drivers/net/nfb/nfb_rx.h > @@ -156,7 +156,7 @@ nfb_eth_ndp_rx(void *queue, > struct rte_mbuf *mbufs[nb_pkts]; > =20 > if (unlikely(ndp->queue =3D=3D NULL || nb_pkts =3D=3D 0)) { > - RTE_LOG(ERR, PMD, "RX invalid arguments!\n"); > + NFB_LOG(ERR, "RX invalid arguments"); > return 0; > } > =20 > diff --git a/drivers/net/nfb/nfb_tx.c b/drivers/net/nfb/nfb_tx.c > index d49fc324e76b..0cc2f596301a 100644 > --- a/drivers/net/nfb/nfb_tx.c > +++ b/drivers/net/nfb/nfb_tx.c > @@ -4,7 +4,6 @@ > * All rights reserved. > */ > =20 > -#include "nfb_tx.h" > #include "nfb.h" > =20 > int > @@ -14,7 +13,7 @@ nfb_eth_tx_queue_start(struct rte_eth_dev *dev, uint16_= t txq_id) > int ret; > =20 > if (txq->queue =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "RX NDP queue is NULL!\n"); > + NFB_LOG(ERR, "RX NDP queue is NULL"); > return -EINVAL; > } > =20 > @@ -35,7 +34,7 @@ nfb_eth_tx_queue_stop(struct rte_eth_dev *dev, uint16_t= txq_id) > int ret; > =20 > if (txq->queue =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "TX NDP queue is NULL!\n"); > + NFB_LOG(ERR, "TX NDP queue is NULL"); > return -EINVAL; > } > =20 > @@ -62,8 +61,8 @@ nfb_eth_tx_queue_setup(struct rte_eth_dev *dev, > RTE_CACHE_LINE_SIZE, socket_id); > =20 > if (txq =3D=3D NULL) { > - RTE_LOG(ERR, PMD, "rte_zmalloc_socket() failed for tx queue id " > - "%" PRIu16 "!\n", tx_queue_id); > + NFB_LOG(ERR, "rte_zmalloc_socket() failed for tx queue id %" PRIu16, > + tx_queue_id); > return -ENOMEM; > } > =20 > diff --git a/drivers/net/nfb/nfb_tx.h b/drivers/net/nfb/nfb_tx.h > index 910020e9e96f..f107cf914bbd 100644 > --- a/drivers/net/nfb/nfb_tx.h > +++ b/drivers/net/nfb/nfb_tx.h > @@ -140,7 +140,7 @@ nfb_eth_ndp_tx(void *queue, > return 0; > =20 > if (unlikely(ndp->queue =3D=3D NULL)) { > - RTE_LOG(ERR, PMD, "TX invalid arguments!\n"); > + NFB_LOG(ERR, "TX invalid arguments"); > return 0; > } > =20