DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Martin Spinler <spinler@cesnet.cz>
Subject: [PATCH 2/3] net/nfb: make device path local to init function
Date: Thu,  7 Dec 2023 10:56:30 -0800	[thread overview]
Message-ID: <20231207185720.19913-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20231207185720.19913-1-stephen@networkplumber.org>

The device path is only used to call nfb_open() it does
not have to be stored in internal structure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/nfb/nfb.h        | 2 --
 drivers/net/nfb/nfb_ethdev.c | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h
index 21cd8f78f641..2707f3db6240 100644
--- a/drivers/net/nfb/nfb.h
+++ b/drivers/net/nfb/nfb.h
@@ -42,8 +42,6 @@ struct pmd_internals {
 	uint16_t         max_txmac;
 	struct nc_rxmac *rxmac[RTE_MAX_NC_RXMAC];
 	struct nc_txmac *txmac[RTE_MAX_NC_TXMAC];
-
-	char             nfb_dev[PATH_MAX];
 	struct nfb_device *nfb;
 };
 
diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c
index 4c4e2e3273e6..892abe81f3d6 100644
--- a/drivers/net/nfb/nfb_ethdev.c
+++ b/drivers/net/nfb/nfb_ethdev.c
@@ -518,12 +518,13 @@ nfb_eth_dev_init(struct rte_eth_dev *dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_pci_addr *pci_addr = &pci_dev->addr;
 	struct rte_ether_addr eth_addr_init;
+	char nfb_dev[PATH_MAX];
 
 	RTE_LOG(INFO, PMD, "Initializing NFB device (" PCI_PRI_FMT ")\n",
 		pci_addr->domain, pci_addr->bus, pci_addr->devid,
 		pci_addr->function);
 
-	snprintf(internals->nfb_dev, PATH_MAX,
+	snprintf(nfb_dev, sizeof(nfb_dev),
 		"/dev/nfb/by-pci-slot/" PCI_PRI_FMT,
 		pci_addr->domain, pci_addr->bus, pci_addr->devid,
 		pci_addr->function);
@@ -533,10 +534,9 @@ nfb_eth_dev_init(struct rte_eth_dev *dev)
 	 * number of queues that can be created and store it in private device
 	 * data structure.
 	 */
-	internals->nfb = nfb_open(internals->nfb_dev);
+	internals->nfb = nfb_open(nfb_dev);
 	if (internals->nfb == NULL) {
-		RTE_LOG(ERR, PMD, "nfb_open(): failed to open %s",
-			internals->nfb_dev);
+		RTE_LOG(ERR, PMD, "nfb_open(): failed to open %s", nfb_dev);
 		return -EINVAL;
 	}
 	data->nb_rx_queues = ndp_get_rx_queue_available_count(internals->nfb);
-- 
2.42.0


  parent reply	other threads:[~2023-12-07 18:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 17:51 [RFT] net/nfb: use dynamic logtype Stephen Hemminger
2023-12-07 10:37 ` Martin Spinler
2023-12-07 17:32   ` Stephen Hemminger
2023-12-07 18:56 ` [PATCH 0/3] net/nfb: driver cleanups Stephen Hemminger
2023-12-07 18:56   ` [PATCH 1/3] net/nfb: remove unused device args Stephen Hemminger
2023-12-07 18:56   ` Stephen Hemminger [this message]
2023-12-07 18:56   ` [PATCH 3/3] net/nfb: use dynamic logtype Stephen Hemminger
2023-12-12  8:49     ` Martin Spinler
2024-01-12 12:16   ` [PATCH 0/3] net/nfb: driver cleanups Ferruh Yigit
2024-01-12 13:50     ` Martin Spinler
2024-02-08  1:02       ` Ferruh Yigit
2024-02-08 12:01   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231207185720.19913-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=spinler@cesnet.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).