Commit cdc0974f authored by David S. Miller's avatar David S. Miller

Merge branch 'hv_netvsc-Fix-default-and-limit-of-recv-buffer'

Stephen Hemminger says:

====================
hv_netvsc: Fix default and limit of recv buffer

The default for receive buffer descriptors is not correct, it should
match the default receive buffer size and the upper limit of receive
buffer size is too low.  Also, for older versions of Window servers
hosts, different lower limit check is necessary, otherwise the buffer
request will be rejected by the host, resulting vNIC not come up.

This patch set corrects these problems.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f93ea3bf 41f61db2
......@@ -637,14 +637,27 @@ 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 */
#define NETVSC_SEND_BUFFER_SIZE (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_RECEIVE_BUFFER_DEFAULT (1024 * 1024 * 16)
#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
#define NETVSC_SEND_BUFFER_DEFAULT (1024 * 1024)
#define NETVSC_INVALID_INDEX -1
#define NETVSC_SEND_SECTION_SIZE 6144
#define NETVSC_RECV_SECTION_SIZE 1728
/* Default size of TX buf: 1MB, RX buf: 16MB */
#define NETVSC_MIN_TX_SECTIONS 10
#define NETVSC_DEFAULT_TX (NETVSC_SEND_BUFFER_DEFAULT \
/ NETVSC_SEND_SECTION_SIZE)
#define NETVSC_MIN_RX_SECTIONS 10
#define NETVSC_DEFAULT_RX (NETVSC_RECEIVE_BUFFER_DEFAULT \
/ NETVSC_RECV_SECTION_SIZE)
#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
#define NETVSC_SEND_BUFFER_ID 0
......
......@@ -268,6 +268,11 @@ static int netvsc_init_buf(struct hv_device *device,
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,
......
......@@ -47,10 +47,6 @@
#include "hyperv_net.h"
#define RING_SIZE_MIN 64
#define NETVSC_MIN_TX_SECTIONS 10
#define NETVSC_DEFAULT_TX 192 /* ~1M */
#define NETVSC_MIN_RX_SECTIONS 10 /* ~64K */
#define NETVSC_DEFAULT_RX 10485 /* Max ~16M */
#define LINKCHANGE_INT (2 * HZ)
#define VF_TAKEOVER_INT (HZ / 10)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment