From: Stephen Hemminger <stephen@networkplumber.org>
To: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com
Cc: devel@linuxdriverproject.org, netdev@vger.kernel.org
Subject: [PATCH net 2/3] hv_netvsc: Limit the receive buffer size for legacy hosts
Date: Thu, 7 Dec 2017 16:10:54 -0800 [thread overview]
Message-ID: <20171208001055.24670-3-sthemmin@microsoft.com> (raw)
In-Reply-To: <20171208001055.24670-1-sthemmin@microsoft.com>
From: Haiyang Zhang <haiyangz@microsoft.com>
Legacy hosts only allow 15 MB receive buffer, and we know the
NVSP version only after negotiation. So, we put the limit in
netvsc_init_buf().
Fixes: 5023a6db73196 ("netvsc: increase default receive buffer size")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/netvsc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index e4bcd202a56a..e5d16a8cf0d6 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -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,
--
2.11.0
next prev parent reply other threads:[~2017-12-08 0:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 0:10 [PATCH net 0/3] netvsc fix buffer size issues Stephen Hemminger
2017-12-08 0:10 ` [PATCH net 1/3] hv_netvsc: Correct the max receive buffer size Stephen Hemminger
2017-12-08 10:33 ` Dan Carpenter
2017-12-08 16:03 ` David Miller
2017-12-08 16:11 ` Haiyang Zhang
2017-12-08 0:10 ` Stephen Hemminger [this message]
2017-12-08 0:10 ` [PATCH net 3/3] hv_netvsc: Fix the default " Stephen Hemminger
2017-12-08 10:44 ` Dan Carpenter
2017-12-08 16:18 ` Haiyang Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171208001055.24670-3-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.