From: Solio Sarabia <solio.sarabia@intel.com>
To: netdev@vger.kernel.org, davem@davemloft.net, stephen@networkplumber.org
Cc: eric.dumazet@gmail.com, dsahern@gmail.com, kys@microsoft.com,
shiny.sebastian@intel.com, solio.sarabia@intel.com,
Stephen Hemminger <sthemmin@microsoft.com>
Subject: [PATCH iproute2] iplink: allow configuring GSO max values
Date: Tue, 5 Dec 2017 17:37:45 -0800 [thread overview]
Message-ID: <1512524265-7041-1-git-send-email-solio.sarabia@intel.com> (raw)
From: Stephen Hemminger <stephen@networkplumber.org>
This allows sending GSO maximum values when configuring a device.
The values are advisory. Most devices will ignore them but for some
pseudo devices such as veth pairs they can be set.
Example:
# ip link add dev vm1 type veth peer name vm2 gso_max_size 32768
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>
---
Rebases original patch against linux-next. Also fixes minor space in
ip-link.8.in, check gso_max_size range, and fixes some style warnings.
ip/iplink.c | 23 ++++++++++++++++++++++-
man/man8/ip-link.8.in | 13 +++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 0a8eb56..94efa1f 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -97,7 +97,8 @@ void iplink_usage(void)
" [ master DEVICE ][ vrf NAME ]\n"
" [ nomaster ]\n"
" [ addrgenmode { eui64 | none | stable_secret | random } ]\n"
- " [ protodown { on | off } ]\n"
+ " [ protodown { on | off } ]\n"
+ " [ gso_max_size BYTES ] | [ gso_max_segs PACKETS ]\n"
"\n"
" ip link show [ DEVICE | group GROUP ] [up] [master DEV] [vrf NAME] [type TYPE]\n");
@@ -848,6 +849,26 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
return on_off("protodown", *argv);
addattr8(&req->n, sizeof(*req), IFLA_PROTO_DOWN,
proto_down);
+ } else if (strcmp(*argv, "gso_max_size") == 0) {
+ unsigned int max_size;
+
+ NEXT_ARG();
+ if (get_unsigned(&max_size, *argv, 0) ||
+ max_size > UINT16_MAX + 1)
+ invarg("Invalid \"gso_max_size\" value\n",
+ *argv);
+ addattr32(&req->n, sizeof(*req), IFLA_GSO_MAX_SIZE,
+ max_size);
+ } else if (strcmp(*argv, "gso_max_segs") == 0) {
+ unsigned int max_segs;
+
+ NEXT_ARG();
+ if (get_unsigned(&max_segs, *argv, 0) ||
+ max_segs > UINT16_MAX)
+ invarg("Invalid \"gso_max_segs\" value\n",
+ *argv);
+ addattr32(&req->n, sizeof(*req), IFLA_GSO_MAX_SEGS,
+ max_segs);
} else {
if (matches(*argv, "help") == 0)
usage();
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index a6a10e5..40f09b3 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -36,6 +36,11 @@ ip-link \- network device configuration
.RB "[ " numrxqueues
.IR QUEUE_COUNT " ]"
.br
+.BR "[ " gso_max_size
+.IR BYTES " ]"
+.RB "[ " gso_max_segs
+.IR SEGMENTS " ]"
+.br
.BI type " TYPE"
.RI "[ " ARGS " ]"
@@ -343,6 +348,14 @@ specifies the number of transmit queues for new device.
specifies the number of receive queues for new device.
.TP
+.BI gso_max_size " BYTES "
+specifies the recommended maximum size of a Generic Segment Offload packet the new device should accept.
+
+.TP
+.BI gso_max_segs " SEGMENTS "
+specifies the recommended maximum number of a Generic Segment Offload segments the new device should accept.
+
+.TP
.BI index " IDX "
specifies the desired index of the new virtual device. The link creation fails, if the index is busy.
--
2.7.4
reply other threads:[~2017-12-06 1:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1512524265-7041-1-git-send-email-solio.sarabia@intel.com \
--to=solio.sarabia@intel.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=kys@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=shiny.sebastian@intel.com \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox