Skip to contentSkip to conversation

netvsc: support multicast/promiscuous settings on VF

PATCH Applied Stephen Hemminger 2 participants 4 messages Sep 21, 2018 – Oct 1, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netvsc: support multicast/promiscuous settings on VF

Provide API's to enable allmulticast and promiscuous in Netvsc PMD with VF. This keeps the VF and PV path in sync.

---
Patch against dpdk-net-next

 drivers/net/netvsc/hn_ethdev.c | 14 +++++++++++++
 drivers/net/netvsc/hn_var.h    |  9 +++++++++
 drivers/net/netvsc/hn_vf.c     | 37 ++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
drivers/net/netvsc/hn_ethdev.c +14 -0
index b67cce1ba8f5..3092066ada36 100644
@@ -255,6 +255,7 @@ hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	struct hn_data *hv = dev->data->dev_private;
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
+	hn_vf_promiscuous_enable(dev);
 }
 
 static void
@@ -267,6 +268,7 @@ hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	if (dev->data->all_multicast)
 		filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
 	hn_rndis_set_rxfilter(hv, filter);
+	hn_vf_promiscuous_disable(dev);
 }
 
 static void
@@ -277,6 +279,7 @@ hn_dev_allmulticast_enable(struct rte_eth_dev *dev)
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_DIRECTED |
 			      NDIS_PACKET_TYPE_ALL_MULTICAST |
 			NDIS_PACKET_TYPE_BROADCAST);
+	hn_vf_allmulticast_enable(dev);
 }
 
 static void
@@ -286,6 +289,16 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev)
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_DIRECTED |
 			     NDIS_PACKET_TYPE_BROADCAST);
+	hn_vf_allmulticast_disable(dev);
+}
+
+static int
+hn_dev_mc_addr_list(struct rte_eth_dev *dev,
+		     struct ether_addr *mc_addr_set,
+		     uint32_t nb_mc_addr)
+{
+	/* No filtering on the synthetic path, but can do it on VF */
+	return hn_vf_mc_addr_list(dev, mc_addr_set, nb_mc_addr);
 }
 
 /* Setup shared rx/tx queue data */
@@ -640,6 +653,7 @@ static const struct eth_dev_ops hn_eth_dev_ops = {
 	.promiscuous_disable    = hn_dev_promiscuous_disable,
 	.allmulticast_enable    = hn_dev_allmulticast_enable,
 	.allmulticast_disable   = hn_dev_allmulticast_disable,
+	.set_mc_addr_list	= hn_dev_mc_addr_list,
 	.tx_queue_setup		= hn_dev_tx_queue_setup,
 	.tx_queue_release	= hn_dev_tx_queue_release,
 	.tx_done_cleanup        = hn_dev_tx_done_cleanup,
drivers/net/netvsc/hn_var.h +9 -0
index b8d9e5d5c470..e1072c7cfa55 100644
@@ -178,6 +178,15 @@ int	hn_vf_start(struct rte_eth_dev *dev);
 void	hn_vf_reset(struct rte_eth_dev *dev);
 void	hn_vf_stop(struct rte_eth_dev *dev);
 void	hn_vf_close(struct rte_eth_dev *dev);
+
+void	hn_vf_allmulticast_enable(struct rte_eth_dev *dev);
+void	hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
+void	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
+void	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
+int	hn_vf_mc_addr_list(struct rte_eth_dev *dev,
+			   struct ether_addr *mc_addr_set,
+			   uint32_t nb_mc_addr);
+
 int	hn_vf_link_update(struct rte_eth_dev *dev,
 			  int wait_to_complete);
 int	hn_vf_tx_queue_setup(struct rte_eth_dev *dev,
drivers/net/netvsc/hn_vf.c +37 -0
index c68d180fd894..7a84ad8c9b8f 100644
@@ -373,6 +373,43 @@ void hn_vf_stats_reset(struct rte_eth_dev *dev)
 	VF_ETHDEV_FUNC(dev, rte_eth_stats_reset);
 }
 
+void hn_vf_allmulticast_enable(struct rte_eth_dev *dev)
+{
+	VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_enable);
+}
+
+void hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
+{
+	VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable);
+}
+
+void hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable);
+}
+
+void hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable);
+}
+
+int hn_vf_mc_addr_list(struct rte_eth_dev *dev,
+			struct ether_addr *mc_addr_set,
+			uint32_t nb_mc_addr)
+{
+	struct hn_data *hv = dev->data->dev_private;
+	struct rte_eth_dev *vf_dev;
+	int ret = 0;
+
+	rte_spinlock_lock(&hv->vf_lock);
+	vf_dev = hv->vf_dev;
+	if (vf_dev)
+		ret = rte_eth_dev_set_mc_addr_list(vf_dev->data->port_id,
+						   mc_addr_set, nb_mc_addr);
+	rte_spinlock_unlock(&hv->vf_lock);
+	return ret;
+}
+
 int hn_vf_tx_queue_setup(struct rte_eth_dev *dev,
 			 uint16_t queue_idx, uint16_t nb_desc,
 			 unsigned int socket_id,
Signature · 1 line
2.18.0
#1 lore raw
Quoted 2 lines · Stephen Hemminger

Provide API's to enable allmulticast and promiscuous in Netvsc PMD with VF. This keeps the VF and PV path in sync.

VF and PF?

Quoted 15 lines

---
Patch against dpdk-net-next

 drivers/net/netvsc/hn_ethdev.c | 14 +++++++++++++
 drivers/net/netvsc/hn_var.h    |  9 +++++++++
 drivers/net/netvsc/hn_vf.c     | 37 ++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
drivers/net/netvsc/hn_ethdev.c +0 -0
index b67cce1ba8f5..3092066ada36 100644

drivers/net/netvsc/hn_ethdev.c hn_dev_promiscuous_enable(struct rte_eth_dev *dev) · line 258

Quoted 4 lines
drivers/net/netvsc/hn_ethdev.c +1 -0
@@ -255,6 +255,7 @@ hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	struct hn_data *hv = dev->data->dev_private;
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
+	hn_vf_promiscuous_enable(dev);

This VF approach is confusing to me, is this calling a underlay device a VF device?

<...>

drivers/net/netvsc/hn_ethdev.c hn_dev_allmulticast_disable(struct rte_eth_dev *dev) · line 298

Quoted 4 lines
drivers/net/netvsc/hn_ethdev.c +4 -0
+static int
+hn_dev_mc_addr_list(struct rte_eth_dev *dev,
+		     struct ether_addr *mc_addr_set,
+		     uint32_t nb_mc_addr)

Just to double check, this dev_ops to add MAC multicast filters, to add MAC filters it is mac_addr_set, mac_addr_add, mac_addr_remove. Many HW seems can set the multicast MAC filters via "mac_addr_add" too.

If this is the intention please enable "Multicast MAC filter" in netvsc.ini

#2 lore raw
Quoted 23 lines · On Mon, 24 Sep 2018 16:49:24 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

Provide API's to enable allmulticast and promiscuous in Netvsc PMD with VF. This keeps the VF and PV path in sync.

VF and PF?

Quoted 17 lines

---
Patch against dpdk-net-next

 drivers/net/netvsc/hn_ethdev.c | 14 +++++++++++++
 drivers/net/netvsc/hn_var.h    |  9 +++++++++
 drivers/net/netvsc/hn_vf.c     | 37 ++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
drivers/net/netvsc/hn_ethdev.c +0 -0
index b67cce1ba8f5..3092066ada36 100644
@@ -255,6 +255,7 @@ hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	struct hn_data *hv = dev->data->dev_private;
 
Quoted 4 lines

drivers/net/netvsc/hn_ethdev.c hn_dev_promiscuous_enable(struct rte_eth_dev *dev) · line 258

Quoted 2 lines
drivers/net/netvsc/hn_ethdev.c +1 -0
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
+	hn_vf_promiscuous_enable(dev);  

This VF approach is confusing to me, is this calling a underlay device a VF device?

Yes. This driver supports the Hyper-V/Azure accelerated networking model where the synthetic para-virtual device has a associated SR-IOV VF device. It is a less general version of what failsafe supports. The choice of hn_vf_XXX naming is to identify those functions which do operations on the underlying device.

Quoted 11 lines

drivers/net/netvsc/hn_ethdev.c hn_dev_allmulticast_disable(struct rte_eth_dev *dev) · line 298

Quoted 5 lines
drivers/net/netvsc/hn_ethdev.c +4 -0
+static int
+hn_dev_mc_addr_list(struct rte_eth_dev *dev,
+		     struct ether_addr *mc_addr_set,
+		     uint32_t nb_mc_addr)  

Just to double check, this dev_ops to add MAC multicast filters, to add MAC filters it is mac_addr_set, mac_addr_add, mac_addr_remove. Many HW seems can set the multicast MAC filters via "mac_addr_add" too.

If this is the intention please enable "Multicast MAC filter" in netvsc.ini

Maybe, the para-virtual device doesn't do MC filtering, only the VF device does. The RNDIS API to host does not support filtering, only the VF path does.

I am unsure. Perhaps best not to advertise MC address filtering. It doesn't matter for Azure (it does not support real Multicast); only for local Hyper-V.