iplink: add gro_max_size attribute handling
Subsystems (2)
PATCH 1/1 iplink: add gro_max_size attribute handling
From: Coco Li <[email protected]>
Add the ability to display or change the gro_max_size attribute.
ip link set dev eth1 gro_max_size 60000
ip -d link show eth1
5: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9198 qdisc mq master eth0 state UP mode DEFAULT group default qlen 1000
link/ether bc:ae:c5:39:69:66 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 46 maxmtu 9600
<...> gro_max_size 60000--- ip/ipaddress.c | 5 +++++ ip/iplink.c | 10 ++++++++++ 2 files changed, 15 insertions(+)
ip/ipaddress.c +5 -0
@@ -904,6 +904,11 @@ static int print_linkinfo_brief(FILE *fp, const char *name, ifi->ifi_type, b1, sizeof(b1))); } +if (tb[IFLA_GRO_MAX_SIZE ]) +print_uint (PRINT_ANY , +"gro_max_size" , +"gro_max_size %u " , +rta_getattr_u32 (tb[IFLA_GRO_MAX_SIZE ])); }if (filter.family ==AF_PACKET ) {
ip/iplink.c +10 -0
@@ -118,6 +118,7 @@ void iplink_usage(void)" [ protodown { on | off } ]\n" " [ protodown_reason PREASON { on | off } ]\n" " [ gso_max_size BYTES ] | [ gso_max_segs PACKETS ]\n" +" [ gro_max_size BYTES ]\n" "\n" " ip link show [ DEVICE | group GROUP ] [up] [master DEV] [vrf NAME] [type TYPE]\n" " [nomaster]\n"
@@ -942,6 +943,15 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type) *argv);addattr32 (&req->n,sizeof (*req),IFLA_GSO_MAX_SEGS , max_segs); + }else if (strcmp (*argv,"gro_max_size" ) ==0 ) { +unsigned int max_size; + +NEXT_ARG (); +if (get_unsigned (&max_size, *argv,0 )) +invarg ("Invalid \"gro_max_size\" value\n" , + *argv); +addattr32 (&req->n,sizeof (*req), +IFLA_GRO_MAX_SIZE , max_size); }else if (strcmp (*argv,"parentdev" ) ==0 ) {NEXT_ARG (); addattr_l(&req->n, sizeof(*req), IFLA_PARENT_DEV_NAME,
Signature · 1 line
2.35.0.rc2.247.g8bbb082509-goog
Quoted 4 lines · On Tue, 1 Feb 2022 15:27:15 -0800 Eric Dumazet <[email protected]> wrote:
From: Coco Li <[email protected]>
Add the ability to display or change the
gro_max_sizeattribute.
Quoted 8 lines
ip link set dev eth1
gro_max_size60000
ip -d link show eth1
5: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9198 qdisc mq master eth0 state UP mode DEFAULT group default qlen 1000link/ether bc:ae:c5:39:69:66 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 46 maxmtu 9600 <...> gro_max_size 60000Signed-off-by Coco Li <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
Looks good, could you send update to man page as well?
Quoted 6 lines · Eric Dumazet
ip/ipaddress.c +0
-0@@ -904,6 +904,11 @@ static int print_linkinfo_brief(FILE *fp, const char *name, ifi->ifi_type,
ip/ipaddress.c static int print_linkinfo_brief(FILE *fp, const char *name, · line 914
Quoted 10 lines
ip/ipaddress.c +5
-0b1, sizeof(b1))); } +if (tb[IFLA_GRO_MAX_SIZE ]) +print_uint (PRINT_ANY , +"gro_max_size" , +"gro_max_size %u " , +rta_getattr_u32 (tb[IFLA_GRO_MAX_SIZE ])); }if (filter.family ==AF_PACKET ) {
gso_max_segs only shows in detail mode; this change prints it only for brief mode.
Quoted 17 lines · David Ahern
Quoted 15 lines · Eric Dumazet
ip/ipaddress.c +5
-0@@ -904,6 +904,11 @@ static int print_linkinfo_brief(FILE *fp, const char *name, ifi->ifi_type, b1, sizeof(b1))); } +if (tb[IFLA_GRO_MAX_SIZE ]) +print_uint (PRINT_ANY , +"gro_max_size" , +"gro_max_size %u " , +rta_getattr_u32 (tb[IFLA_GRO_MAX_SIZE ])); }
Quoted 4 lines
ip/ipaddress.c static int print_linkinfo_brief(FILE *fp, const char *name, · line 914
Quoted 1 line
ip/ipaddress.c +0
-0if (filter.family ==AF_PACKET ) {
gso_max_segsonly shows in detail mode; this change prints it only for brief mode.
This is a rebase error, I will send a v2.