[EXTERNAL] Re: [PATCH] net/netvsc: add support for mtu_set

Sam Andrew samandrew at microsoft.com
Mon Oct 9 18:41:38 CEST 2023


Hi Stephen,

From: Stephen Hemminger <stephen at networkplumber.org> 
Sent: Monday, October 9, 2023 8:18 AM

> On Thu, 5 Oct 2023 23:17:28 +0000
> Sam Andrew <samandrew at microsoft.com> wrote:

> > +
> > +static int
> > +hn_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> > +	struct hn_data *hv = dev->data->dev_private;
> > +	unsigned int orig_mtu = dev->data->mtu;
> > +	uint32_t rndis_mtu;
> > +	int ret = 0;
> > +	int i;
> > +
> > +	if (dev->data->dev_started) {
> > +		PMD_DRV_LOG(ERR, "Device must be stopped before changing MTU");
> > +		return -EIO;
> > +	}
> > +

> It looks like this proposed patch does not have the accelerated networking
> virtual device case.  The driver needs to first update the MTU of the underlying
> VF device (and handle errors), then reinit the vmbus device.

The following line should handle the AN virtual device case:

+	/* Change MTU of underlying VF dev first, if it exists */
+	ret = hn_vf_mtu_set(dev, mtu);
+	if (ret)
+		return ret;

This is the new method added in hn_vf.c:

--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -778,3 +784,18 @@ int hn_vf_reta_hash_update(struct rte_eth_dev *dev,
 
 	return ret;
 }
+
+int hn_vf_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
+	struct hn_data *hv = dev->data->dev_private;
+	struct rte_eth_dev *vf_dev;
+	int ret = 0;
+
+	rte_rwlock_read_lock(&hv->vf_lock);
+	vf_dev = hn_get_vf_dev(hv);
+	if (hv->vf_ctx.vf_vsc_switched && vf_dev)
+		ret = vf_dev->dev_ops->mtu_set(vf_dev, mtu);
+	rte_rwlock_read_unlock(&hv->vf_lock);
+
+	return ret;
+}


More information about the dev mailing list