]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: allow configuring GSO max values
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 1 Dec 2017 19:52:34 +0000 (11:52 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 9 Dec 2017 05:33:08 +0000 (21:33 -0800)
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>
ip/iplink.c
man/man8/ip-link.8.in

index 0a8eb56fb252822fa38082ec69ef0323abb78976..6379b16a14f559cc534261db68a49e765cd76a8d 100644 (file)
@@ -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,22 @@ 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)
+                               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();
index a6a10e577b1f5f10813529f11060b52162608884..0db2582e19f7a62a5e2e36a442b94d949cc73e0f 100644 (file)
@@ -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 " ]"
 
@@ -342,6 +347,14 @@ specifies the number of transmit queues for new device.
 .BI numrxqueues " QUEUE_COUNT "
 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.