Skip to content

Commit

Permalink
hv_netvsc: Fix the TX/RX buffer default sizes
Browse files Browse the repository at this point in the history
The values were not computed correctly. There are no significant
visible impact, though.

The intended size of RX buffer is 16 MB, and the default slot size is 1728.
So, NETVSC_DEFAULT_RX should be 16*1024*1024 / 1728 = 9709.

The intended size of TX buffer is 1 MB, and the slot size is 6144.
So, NETVSC_DEFAULT_TX should be 1024*1024 / 6144 = 170.

The patch puts the formula directly into the macro, and moves them to
hyperv_net.h, together with related macros.

Fixes: 5023a6d ("netvsc: increase default receive buffer size")
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
haiyangz authored and davem330 committed Dec 13, 2017
1 parent 11b2b65 commit 41f61db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 12 additions & 1 deletion drivers/net/hyperv/hyperv_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,24 @@ struct nvsp_message {
/* 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_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

Expand Down
4 changes: 0 additions & 4 deletions drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41f61db

Please sign in to comment.