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 8F0E343673; Thu, 7 Dec 2023 19:57:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D5D242F63; Thu, 7 Dec 2023 19:57:34 +0100 (CET) Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by mails.dpdk.org (Postfix) with ESMTP id D347042ECC for ; Thu, 7 Dec 2023 19:57:31 +0100 (CET) Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-58d3c5126e9so578595eaf.1 for ; Thu, 07 Dec 2023 10:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1701975451; x=1702580251; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZmL/hI4IpmfnPy2aHJGl8ievY3FLHkjt2GGn4xXD0Sg=; b=Cdx3KbtAOwJnvTTWGijn7Q0Sg7OFVSXW+1/4BmKBTOB+eXwxKMuFwYVu0CrKGMls51 T920uSswEKyIAEOeP/QQaEOde3/KueDje4/RCd+JJmGSfA+8tqbxeBh9UlOCIhlsVRZc AfTYWhJABZpIsLPdgHOOflwqcX61+8JxTwEO3FQBxICdKeRPMsRp+XocDTcw9CIRv5X9 OVsgrIOCLnyemg9tCSfrZ5JNTk5PvtJTwt90iBJE5QcAWK7B5cwBGvl2zH+G/Qsjy7uZ iyukbKLU13xLXsJBJlpD1YAcnEbl+QvzJIy5qDYqQ+goWMA6akKkzg7GNZ/hsab2h/zF Udtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701975451; x=1702580251; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZmL/hI4IpmfnPy2aHJGl8ievY3FLHkjt2GGn4xXD0Sg=; b=fkVUVBB5KjLnr2n28yWm7HNiDr9zw6YFzEC/DOEnOjpUMWmnTkFKHjS1Ot9HR9uf69 /tOzIGll59M3SZk0VPhtGXOFxQ0o2bZdopFvn/Lnt0bZKwc+BQS5uTMyB8dTYjK+IUnQ pXHFIeZapPDWAj80g4Ix9t10HEb0OzW2SKmUIcm9fPW0eJN1Lsk559EQw9+/kEDNqMmg wY/dCYVSO2Pd0JJ4E+JwCBD0eUNMaw6MRFr+6Giu3V2UDwaIPrRs0SR87rcxmsGufnef 6EyyDA1MKbjFqSB9QNrHl3Y1JSIQazgefgSRkjHDB9mgSr9nxNj/hM2bKhx57GrEgUpu edPw== X-Gm-Message-State: AOJu0Yyo2fy2qF5ExVLVhjyWYI55+wwUpeMCSOzB1BtJP7JUky4oobey luLMFFxF4YRBc64fzDDz75UHEa3/NLwvvZIu49PoFQ== X-Google-Smtp-Source: AGHT+IEA4O4azBlm11tMJvstU8f3/G9YQyrikcbDnJdG1/eBUvmy71MgFu8YIEH/RnGaKd8M4thfgQ== X-Received: by 2002:a05:6358:4425:b0:16e:5095:731a with SMTP id z37-20020a056358442500b0016e5095731amr3372758rwc.24.1701975451119; Thu, 07 Dec 2023 10:57:31 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id 64-20020a630043000000b005c65d432119sm105124pga.67.2023.12.07.10.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:57:30 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Martin Spinler Subject: [PATCH 2/3] net/nfb: make device path local to init function Date: Thu, 7 Dec 2023 10:56:30 -0800 Message-ID: <20231207185720.19913-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231207185720.19913-1-stephen@networkplumber.org> References: <20231206175326.116375-1-stephen@networkplumber.org> <20231207185720.19913-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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