[PATCH 1/2 Utopic LTS SRU] hv_netvsc: Add support to set MTU reservation from guest side
tim.gardner at canonical.com
tim.gardner at canonical.com
Mon Oct 5 18:28:00 UTC 2015
From: Tim Gardner <tim.gardner at canonical.com>
BugLink: http://bugs.launchpad.net/bugs/1494431
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: Haiyang Zhang <haiyangz at microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys at microsoft.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(back ported from commit f9cbce34c34bcc05ea0dd78c8999bfe88b5b6b86)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc_drv.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 6cc37c1..7a72bcb 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -581,6 +581,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 */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 7e33318..74266e9 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -692,7 +692,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
limit = NETVSC_MTU;
- if (mtu < 68 || mtu > limit)
+ if (mtu < NETVSC_MTU_MIN || mtu > limit)
return -EINVAL;
nvdev->start_remove = true;
--
1.9.1
More information about the kernel-team
mailing list