Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9cbce34 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by David S. Miller
Browse files

hv_netvsc: Add support to set MTU reservation from guest side



When packet encapsulation is in use, the MTU needs to be reduced for
headroom reservation.
The existing code takes the updated MTU value only from the host side.
But vSwitch extensions, such as Open vSwitch, require the flexibility
to change the MTU to different values from within a guest during the
lifecycle of a vNIC, when the encapsulation protocol is changed. The
patch supports this kind of MTU changes.

Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e29e21a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -589,6 +589,7 @@ struct nvsp_message {


#define NETVSC_MTU 65536
#define NETVSC_MTU_MIN 68

#define NETVSC_RECEIVE_BUFFER_SIZE		(1024*1024*16)	/* 16MB */
#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY	(1024*1024*15)  /* 15MB */
+1 −2
Original line number Diff line number Diff line
@@ -743,8 +743,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
	if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
		limit = NETVSC_MTU - ETH_HLEN;

	/* Hyper-V hosts don't support MTU < ETH_DATA_LEN (1500) */
	if (mtu < ETH_DATA_LEN || mtu > limit)
	if (mtu < NETVSC_MTU_MIN || mtu > limit)
		return -EINVAL;

	nvdev->start_remove = true;
+1 −1
Original line number Diff line number Diff line
@@ -1054,7 +1054,7 @@ int rndis_filter_device_add(struct hv_device *dev,
	ret = rndis_filter_query_device(rndis_device,
					RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE,
					&mtu, &size);
	if (ret == 0 && size == sizeof(u32))
	if (ret == 0 && size == sizeof(u32) && mtu < net_device->ndev->mtu)
		net_device->ndev->mtu = mtu;

	/* Get the mac address */