Skip to contentSkip to conversation

Patch "hv_netvsc: Fix the receive buffer size limit" has been added to the 4.15-stable tree

PATCH [email protected] 1 participant 1 message Mar 22, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

hv_netvsc: Fix the receive buffer size limit

to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
hv_netvsc-fix-the-receive-buffer-size-limit.patch
and it can be found in the queue-4.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Mar 22 14:03:39 CET 2018

From: Haiyang Zhang <[email protected]>
Date: Mon, 11 Dec 2017 08:56:57 -0800
Subject: hv_netvsc: Fix the receive buffer size limit

From: Haiyang Zhang <[email protected]>

[ Upstream commit 11b2b653102571ac791885324371d9a1a17b900e ]

The max should be 31 MB on host with NVSP version > 2.

On legacy hosts (NVSP version <=2) only 15 MB receive buffer is allowed, otherwise the buffer request will be rejected by the host, resulting vNIC not coming up.

The NVSP version is only available after negotiation. So, we add the limit checking for legacy hosts in netvsc_init_buf().

Fixes 5023a6db73196 ("netvsc: increase default receive buffer size")
---
 drivers/net/hyperv/hyperv_net.h |    6 ++++--
 drivers/net/hyperv/netvsc.c     |    5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/hyperv/hyperv_net.h +4 -2
@@ -635,9 +635,11 @@ struct nvsp_message {
 #define NETVSC_MTU 65535
 #define NETVSC_MTU_MIN ETH_MIN_MTU
 
-#define NETVSC_RECEIVE_BUFFER_SIZE		(1024*1024*16)	/* 16MB */
-#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY	(1024*1024*15)  /* 15MB */
+/* Max buffer sizes allowed by a host */
+#define NETVSC_RECEIVE_BUFFER_SIZE		(1024 * 1024 * 31) /* 31MB */
+#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY	(1024 * 1024 * 15) /* 15MB */
 #define NETVSC_SEND_BUFFER_SIZE			(1024 * 1024 * 15)   /* 15MB */
+
 #define NETVSC_INVALID_INDEX			-1
 
 #define NETVSC_SEND_SECTION_SIZE		6144
drivers/net/hyperv/netvsc.c +5 -0
@@ -267,6 +267,11 @@ static int netvsc_init_buf(struct hv_dev
 	buf_size = device_info->recv_sections * device_info->recv_section_size;
 	buf_size = roundup(buf_size, PAGE_SIZE);
 
+	/* Legacy hosts only allow smaller receive buffer */
+	if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
+		buf_size = min_t(unsigned int, buf_size,
+				 NETVSC_RECEIVE_BUFFER_SIZE_LEGACY);
+
 	net_device->recv_buf = vzalloc(buf_size);
 	if (!net_device->recv_buf) {
 		netdev_err(ndev,

Patches currently in stable-queue which might be from [email protected] are

queue-4.15/hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch queue-4.15/hv_netvsc-fix-the-receive-buffer-size-limit.patch