Skip to contentSkip to conversation

net/netvsc: make da_cache_list local

PATCH Applied Stephen Hemminger 2 participants 6 messages Sep 26, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/netvsc: make da_cache_list local

The list of devices is only used in one file and does not follow naming prefix convention. Make it local.

Fixes 9a9d038c782e ("net/netvsc: cache device parameters for hotplug events")
---
 drivers/net/netvsc/hn_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/netvsc/hn_ethdev.c +1 -1
index 1d788f3fb7..5b9b54c068 100644
@@ -102,7 +102,7 @@ struct da_cache {
 	char drv_str[];
 };
 
-LIST_HEAD(da_cache_list, da_cache) da_cache_list;
+static LIST_HEAD(da_cache_list, da_cache) da_cache_list;
 static unsigned int da_cache_usage;
 
 static struct rte_eth_dev *
Signature · 1 line
2.47.3
#1 lore raw

PATCH 2/2 net/netvsc: rename get_vmbus_device internal function

All global functions should use a common prefix. For netvsc all globals start with hn_. Rename get_vmbus_device to hn_nvs_get_vmbus_device to follow pattern used in this code.

Fixes 11c0663c9445 ("net/netvsc: add function to get vmbus device")
---
 drivers/net/netvsc/hn_nvs.c  | 10 +++++-----
 drivers/net/netvsc/hn_nvs.h  |  6 +++---
 drivers/net/netvsc/hn_rxtx.c |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/netvsc/hn_nvs.c +5 -5
index 0b7e6c0264..c6bd60dbda 100644
@@ -44,7 +44,7 @@ static const uint32_t hn_nvs_version[] = {
 	NVS_VERSION_1
 };
 
-struct rte_vmbus_device *get_vmbus_device(struct hn_data *hv)
+struct rte_vmbus_device *hn_nvs_get_vmbus_device(struct hn_data *hv)
 {
 	struct rte_vmbus_device *vmbus = hv->vmbus;
 
@@ -62,7 +62,7 @@ struct rte_vmbus_device *get_vmbus_device(struct hn_data *hv)
 static int hn_nvs_req_send(struct hn_data *hv,
 			   void *req, uint32_t reqlen)
 {
-	return rte_vmbus_chan_send(get_vmbus_device(hv), hn_primary_chan(hv),
+	return rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), hn_primary_chan(hv),
 				   VMBUS_CHANPKT_TYPE_INBAND,
 				   req, reqlen, 0,
 				   VMBUS_CHANPKT_FLAG_NONE, NULL);
@@ -82,7 +82,7 @@ __hn_nvs_execute(struct hn_data *hv,
 	int ret;
 
 	/* Send request to ring buffer */
-	ret = rte_vmbus_chan_send(get_vmbus_device(hv), chan,
+	ret = rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan,
 				  VMBUS_CHANPKT_TYPE_INBAND, req, reqlen, 0,
 				  VMBUS_CHANPKT_FLAG_RC, NULL);
 
@@ -93,7 +93,7 @@ __hn_nvs_execute(struct hn_data *hv,
 
  retry:
 	len = sizeof(buffer);
-	ret = rte_vmbus_chan_recv(get_vmbus_device(hv), chan, buffer, &len, &xactid);
+	ret = rte_vmbus_chan_recv(hn_nvs_get_vmbus_device(hv), chan, buffer, &len, &xactid);
 	if (ret == -EAGAIN) {
 		rte_delay_us(HN_CHAN_INTERVAL_US);
 		goto retry;
@@ -530,7 +530,7 @@ hn_nvs_ack_rxbuf(struct hn_data *hv, struct vmbus_channel *chan, uint64_t tid)
 	PMD_RX_LOG(DEBUG, "ack RX id %" PRIu64, tid);
 
  again:
-	error = rte_vmbus_chan_send(get_vmbus_device(hv), chan,
+	error = rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan,
 				    VMBUS_CHANPKT_TYPE_COMP, &ack, sizeof(ack),
 				    tid, VMBUS_CHANPKT_FLAG_NONE, NULL);
 
drivers/net/netvsc/hn_nvs.h +3 -3
index b7691a5dc2..bf10621927 100644
@@ -222,14 +222,14 @@ void	hn_nvs_handle_vfassoc(struct rte_eth_dev *dev,
 			      const struct vmbus_chanpkt_hdr *hdr,
 			      const void *data);
 
-struct rte_vmbus_device *get_vmbus_device(struct hn_data *hv);
+struct rte_vmbus_device *hn_nvs_get_vmbus_device(struct hn_data *hv);
 
 static inline int
 hn_nvs_send(struct hn_data *hv, struct vmbus_channel *chan,
 	    uint16_t flags, void *nvs_msg, int nvs_msglen, uintptr_t sndc,
 	    bool *need_sig)
 {
-	return rte_vmbus_chan_send(get_vmbus_device(hv), chan, VMBUS_CHANPKT_TYPE_INBAND,
+	return rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan, VMBUS_CHANPKT_TYPE_INBAND,
 				   nvs_msg, nvs_msglen, (uint64_t)sndc,
 				   flags, need_sig);
 }
@@ -240,6 +240,6 @@ hn_nvs_send_sglist(struct hn_data *hv, struct vmbus_channel *chan,
 		   void *nvs_msg, int nvs_msglen,
 		   uintptr_t sndc, bool *need_sig)
 {
-	return rte_vmbus_chan_send_sglist(get_vmbus_device(hv), chan, sg, sglen, nvs_msg,
+	return rte_vmbus_chan_send_sglist(hn_nvs_get_vmbus_device(hv), chan, sg, sglen, nvs_msg,
 					  nvs_msglen, (uint64_t)sndc, need_sig);
 }
drivers/net/netvsc/hn_rxtx.c +2 -2
index 0764d5b319..72dab26ede 100644
@@ -1176,7 +1176,7 @@ uint32_t hn_process_events(struct hn_data *hv, uint16_t queue_id,
 	}
 
 	if (bytes_read > 0)
-		rte_vmbus_chan_signal_read(get_vmbus_device(hv), rxq->chan, bytes_read);
+		rte_vmbus_chan_signal_read(hn_nvs_get_vmbus_device(hv), rxq->chan, bytes_read);
 
 	rte_spinlock_unlock(&rxq->ring_lock);
 
@@ -1641,7 +1641,7 @@ hn_xmit_pkts(void *ptxq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 fail:
 	if (need_sig)
-		rte_vmbus_chan_signal_tx(get_vmbus_device(hv), txq->chan);
+		rte_vmbus_chan_signal_tx(hn_nvs_get_vmbus_device(hv), txq->chan);
 
 	return nb_tx;
 }
Signature · 1 line
2.47.3
Reviewed-by on v1 2/2
#2 lore raw

RE: [EXTERNAL] [PATCH 2/2] net/netvsc: rename get_vmbus_device internal function

Quoted 10 lines

Subject: [EXTERNAL] [PATCH 2/2] net/netvsc: rename get_vmbus_device internal function

All global functions should use a common prefix. For netvsc all globals start with hn_. Rename get_vmbus_device to hn_nvs_get_vmbus_device to follow pattern used in this code.

Fixes 11c0663c9445 ("net/netvsc: add function to get vmbus device")
Quoted 126 lines
---
 drivers/net/netvsc/hn_nvs.c  | 10 +++++-----  drivers/net/netvsc/hn_nvs.h  |  6
+++---  drivers/net/netvsc/hn_rxtx.c |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/netvsc/hn_nvs.c index renamed from drivers/net/netvsc/hn_nvs.c +0 -0

0b7e6c0264..c6bd60dbda 100644

drivers/net/netvsc/hn_nvs.c +7 -5
@@ -44,7 +44,7 @@ static const uint32_t hn_nvs_version[] = {
 	NVS_VERSION_1
 };
 
-struct rte_vmbus_device *get_vmbus_device(struct hn_data *hv)
+struct rte_vmbus_device *hn_nvs_get_vmbus_device(struct hn_data *hv)
 {
 	struct rte_vmbus_device *vmbus = hv->vmbus;
 
@@ -62,7 +62,7 @@ struct rte_vmbus_device *get_vmbus_device(struct
 hn_data *hv)  static int hn_nvs_req_send(struct hn_data *hv,
 			   void *req, uint32_t reqlen)
 {
-	return rte_vmbus_chan_send(get_vmbus_device(hv),
 hn_primary_chan(hv),
+	return rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv),
+hn_primary_chan(hv),
 				   VMBUS_CHANPKT_TYPE_INBAND,
 				   req, reqlen, 0,
 				   VMBUS_CHANPKT_FLAG_NONE, NULL);
@@ -82,7 +82,7 @@ __hn_nvs_execute(struct hn_data *hv,
 	int ret;
 
 	/* Send request to ring buffer */
-	ret = rte_vmbus_chan_send(get_vmbus_device(hv), chan,
+	ret = rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan,
 				  VMBUS_CHANPKT_TYPE_INBAND, req, reqlen,
 0,
 				  VMBUS_CHANPKT_FLAG_RC, NULL);
@@ -93,7 +93,7 @@ __hn_nvs_execute(struct hn_data *hv,
 
  retry:
 	len = sizeof(buffer);
-	ret = rte_vmbus_chan_recv(get_vmbus_device(hv), chan, buffer, &len,
 &xactid);
+	ret = rte_vmbus_chan_recv(hn_nvs_get_vmbus_device(hv), chan, buffer,
+&len, &xactid);
 	if (ret == -EAGAIN) {
 		rte_delay_us(HN_CHAN_INTERVAL_US);
 		goto retry;
@@ -530,7 +530,7 @@ hn_nvs_ack_rxbuf(struct hn_data *hv, struct
 vmbus_channel *chan, uint64_t tid)
 	PMD_RX_LOG(DEBUG, "ack RX id %" PRIu64, tid);
 
  again:
-	error = rte_vmbus_chan_send(get_vmbus_device(hv), chan,
+	error = rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan,
 				    VMBUS_CHANPKT_TYPE_COMP, &ack,
 sizeof(ack),
drivers/net/netvsc/hn_nvs.c +0 -0
 				    tid, VMBUS_CHANPKT_FLAG_NONE, NULL);
drivers/net/netvsc/hn_nvs.h index renamed from drivers/net/netvsc/hn_nvs.h +0 -0

b7691a5dc2..bf10621927 100644

drivers/net/netvsc/hn_nvs.h +4 -3
@@ -222,14 +222,14 @@ void	hn_nvs_handle_vfassoc(struct rte_eth_dev
 *dev,
 			      const struct vmbus_chanpkt_hdr *hdr,
 			      const void *data);
 
-struct rte_vmbus_device *get_vmbus_device(struct hn_data *hv);
+struct rte_vmbus_device *hn_nvs_get_vmbus_device(struct hn_data *hv);
 
 static inline int
 hn_nvs_send(struct hn_data *hv, struct vmbus_channel *chan,
 	    uint16_t flags, void *nvs_msg, int nvs_msglen, uintptr_t sndc,
 	    bool *need_sig)
 {
-	return rte_vmbus_chan_send(get_vmbus_device(hv), chan,
 VMBUS_CHANPKT_TYPE_INBAND,
+	return rte_vmbus_chan_send(hn_nvs_get_vmbus_device(hv), chan,
+VMBUS_CHANPKT_TYPE_INBAND,
 				   nvs_msg, nvs_msglen, (uint64_t)sndc,
 				   flags, need_sig);
 }
@@ -240,6 +240,6 @@ hn_nvs_send_sglist(struct hn_data *hv, struct
 vmbus_channel *chan,
 		   void *nvs_msg, int nvs_msglen,
 		   uintptr_t sndc, bool *need_sig)
 {
-	return rte_vmbus_chan_send_sglist(get_vmbus_device(hv), chan, sg,
 sglen, nvs_msg,
+	return rte_vmbus_chan_send_sglist(hn_nvs_get_vmbus_device(hv),

chan,

drivers/net/netvsc/hn_nvs.h +1 -0
+sg, sglen, nvs_msg,
 					  nvs_msglen, (uint64_t)sndc, need_sig);

} diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 0764d5b319..72dab26ede 100644

drivers/net/netvsc/hn_rxtx.c +3 -2
@@ -1176,7 +1176,7 @@ uint32_t hn_process_events(struct hn_data *hv,
 uint16_t queue_id,
 	}
 
 	if (bytes_read > 0)
-		rte_vmbus_chan_signal_read(get_vmbus_device(hv), rxq->chan,
 bytes_read);
+		rte_vmbus_chan_signal_read(hn_nvs_get_vmbus_device(hv),
 rxq->chan,
+bytes_read);
 
 	rte_spinlock_unlock(&rxq->ring_lock);
@@ -1641,7 +1641,7 @@ hn_xmit_pkts(void *ptxq, struct rte_mbuf **tx_pkts,
 uint16_t nb_pkts)
 
 fail:
 	if (need_sig)
-		rte_vmbus_chan_signal_tx(get_vmbus_device(hv), txq->chan);
+		rte_vmbus_chan_signal_tx(hn_nvs_get_vmbus_device(hv), txq-
 >chan);
 

return nb_tx;
}
--
2.47.3

author Applied
#3 lore raw

Re: [PATCH 2/2] net/netvsc: rename get_vmbus_device internal function

In reply to Stephen Hemminger
Quoted 8 lines · On Fri, 26 Sep 2025 08:58:01 -0700 Stephen Hemminger…

All global functions should use a common prefix. For netvsc all globals start with hn_. Rename get_vmbus_device to hn_nvs_get_vmbus_device to follow pattern used in this code.

Fixes 11c0663c9445 ("net/netvsc: add function to get vmbus device")

---

Queued to next-net

Reviewed-by on v1 1/2
#4 lore raw
In reply to Stephen Hemminger
Quoted 9 lines

Subject: [EXTERNAL] [PATCH 1/2] net/netvsc: make da_cache_list local

The list of devices is only used in one file and does not follow naming prefix convention. Make it local.

Fixes 9a9d038c782e ("net/netvsc: cache device parameters for hotplug events")
Quoted 19 lines
---
 drivers/net/netvsc/hn_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/netvsc/hn_ethdev.c +1 -2
index 1d788f3fb7..5b9b54c068 100644
@@ -102,7 +102,7 @@ struct da_cache {
 	char drv_str[];
 };
 
-LIST_HEAD(da_cache_list, da_cache) da_cache_list;
+static LIST_HEAD(da_cache_list, da_cache) da_cache_list;
 static unsigned int da_cache_usage;
 
 static struct rte_eth_dev *
--

2.47.3