Skip to contentSkip to conversation

net/netvsc: minor fixes

PATCH In review Stephen Hemminger 2 participants 6 messages Apr 27, 2020 – Apr 29, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/netvsc: minor fixes

These fix some minor issues found during testing and review of netvsc PMD

Stephen Hemminger (4):
net/vmbus: add missing barrier
net/netvsc: fix invalid rte_free on dev_close
net/netvsc: fix comment spelling errors
bus/vmbus: fix comment spelling errors

 drivers/bus/vmbus/linux/vmbus_uio.c | 2 +-
 drivers/bus/vmbus/vmbus_channel.c   | 1 +
 drivers/bus/vmbus/vmbus_common.c    | 2 +-
 drivers/net/netvsc/hn_ethdev.c      | 5 ++++-
 drivers/net/netvsc/hn_nvs.h         | 2 +-
 5 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 net/vmbus: add missing barrier

The check for event ring being empty needs a barrier to avoid any over agressive optimization. This is same barrier as Linux kernel.

---
 drivers/bus/vmbus/vmbus_channel.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bus/vmbus/vmbus_channel.c +1 -0
index 46b3ba3f9f9e..ff2985c25758 100644
@@ -199,6 +199,7 @@ bool rte_vmbus_chan_rx_empty(const struct vmbus_channel *channel)
 {
 	const struct vmbus_br *br = &channel->rxbr;
 
+	rte_smp_rmb();
 	return br->vbr->rindex == br->vbr->windex;
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/4] net/vmbus: add missing barrier

Quoted 30 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Tuesday, April 28, 2020 7:28 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>
Subject: [dpdk-dev] [PATCH 1/4] net/vmbus: add missing barrier

The check for event ring being empty needs a barrier to avoid any over agressive optimization.
This is same barrier as Linux kernel.

---
 drivers/bus/vmbus/vmbus_channel.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bus/vmbus/vmbus_channel.c +1 -1
index 46b3ba3f9f9e..ff2985c25758 100644
@@ -199,6 +199,7 @@ bool rte_vmbus_chan_rx_empty(const struct
 vmbus_channel *channel)  {
 const struct vmbus_br *br = &channel->rxbr;
 
+rte_smp_rmb();
 return br->vbr->rindex == br->vbr->windex;  }
 
--
Quoted 1 line

2.20.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#3 lore raw

PATCH 2/4 net/netvsc: fix invalid rte_free on dev_close

In reply to Stephen Hemminger

The netvsc PMD is putting the mac address in private data. Unless dev->data->mac_addrs is NULL'd rte_ethdev_close will try and free the address array.
Causing the following scary error.
EAL: Invalid memory

This is a simpler alternative to the fix already merged in 20.05-rc1

Fixes f8279f47dd89 ("net/netvsc: fix crash in secondary process")
---
 drivers/net/netvsc/hn_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/netvsc/hn_ethdev.c +3 -0
index 05f1a25a1abc..96480f930a46 100644
@@ -849,6 +849,9 @@ hn_dev_close(struct rte_eth_dev *dev)
 
 	hn_vf_close(dev);
 	hn_dev_free_queues(dev);
+
+	/* mac_addrs must not be freed alone because part of dev_private */
+	dev->data->mac_addrs = NULL;
 }
 
 static const struct eth_dev_ops hn_eth_dev_ops = {
Signature · 1 line
2.20.1
#4 lore raw

PATCH 3/4 net/netvsc: fix comment spelling errors

In reply to Stephen Hemminger
---
 drivers/net/netvsc/hn_ethdev.c | 2 +-
 drivers/net/netvsc/hn_nvs.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/netvsc/hn_ethdev.c +1 -1
index 96480f930a46..6723abab1fe5 100644
@@ -72,7 +72,7 @@ static const struct hn_xstats_name_off hn_stat_strings[] = {
 
 /* The default RSS key.
  * This value is the same as MLX5 so that flows will be
- * received on same path for both VF ans synthetic NIC.
+ * received on same path for both VF and synthetic NIC.
  */
 static const uint8_t rss_default_key[NDIS_HASH_KEYSIZE_TOEPLITZ] = {
 	0x2c, 0xc6, 0x81, 0xd1,	0x5b, 0xdb, 0xf4, 0xf7,
drivers/net/netvsc/hn_nvs.h +1 -1
index 2563fd8d8669..015839e3644f 100644
@@ -37,7 +37,7 @@
 #define NVS_RNDIS_MTYPE_CTRL		1
 
 /*
- * NVS message transacion status codes.
+ * NVS message transaction status codes.
  */
 #define NVS_STATUS_OK		1
 #define NVS_STATUS_FAILED		2
Signature · 1 line
2.20.1
#5 lore raw

PATCH 4/4 bus/vmbus: fix comment spelling errors

In reply to Stephen Hemminger
---
 drivers/bus/vmbus/linux/vmbus_uio.c | 2 +-
 drivers/bus/vmbus/vmbus_common.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/bus/vmbus/linux/vmbus_uio.c +1 -1
index 10e50c9b5a10..5451bfd1501d 100644
@@ -165,7 +165,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
 	dev->resource[idx].addr = mapaddr;
 	vmbus_map_addr = RTE_PTR_ADD(mapaddr, size);
 
-	/* Record result of sucessful mapping for use by secondary */
+	/* Record result of successful mapping for use by secondary */
 	maps[idx].addr = mapaddr;
 	maps[idx].size = size;
 
drivers/bus/vmbus/vmbus_common.c +1 -1
index 48a219f73529..eaf5c292f986 100644
@@ -131,7 +131,7 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
 }
 
 /*
- * IF device class GUID mathces, call the probe function of
+ * IF device class GUID matches, call the probe function of
  * registere drivers for the vmbus device.
  * Return -1 if initialization failed,
  * and 1 if no driver found for this device.
Signature · 1 line
2.20.1