aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-06-11ip address: Fix loop initial declarations are only allowed in C99HEADmasterRoi Dayan1-1/+3
On some distros, i.e. rhel 7.6, compilation fails with the following: ipaddress.c: In function ‘lookup_flag_data_by_name’: ipaddress.c:1260:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < ARRAY_SIZE(ifa_flag_data); ++i) { ^ ipaddress.c:1260:2: note: use option -std=c99 or -std=gnu99 to compile your code This commit fixes the single place needed for compilation to pass. Fixes: 9d59c86e575b ("iproute2: ip addr: Organize flag properties structurally") Signed-off-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-11uapi: update to magic.hStephen Hemminger1-0/+1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-11devlink: Add 'mirror' trap actionIdo Schimmel3-8/+15
Allow setting 'mirror' trap action for traps that support it. Extend the devlink-trap man page and bash completion accordingly. Example: # devlink -jp trap show netdevsim/netdevsim10 trap igmp_query { "trap": { "netdevsim/netdevsim10": [ { "name": "igmp_query", "type": "control", "generic": true, "action": "mirror", "group": "mc_snooping" } ] } } Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-11devlink: Add 'control' trap typeIdo Schimmel1-0/+2
This type is used for traps that trap control packets such as ARP request and IGMP query to the CPU. Example: # devlink -jp trap show netdevsim/netdevsim10 trap igmp_v1_report { "trap": { "netdevsim/netdevsim10": [ { "name": "igmp_v1_report", "type": "control", "generic": true, "action": "trap", "group": "mc_snooping" } ] } } Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-11devlink: update include filesStephen Hemminger1-1/+8
Use the tool iwyu to get more complete list of includes for all the bits used by devlink. This should also fix build with musl libc. Fixes: c4dfddccef4e ("fix JSON output of mon command") Reported-off-by: Dan Robertson <dan@dlrobertson.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-05uapi: update headersStephen Hemminger7-51/+382
Update kernel headers from 5.8.0 merge Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-05Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-nextStephen Hemminger56-195/+3575
2020-06-02v5.7.0Stephen Hemminger1-1/+1
2020-06-01nexthop: Fix Deletion displayDonald Sharp1-1/+1
Actually display that deletions are happening when monitoring nexthops. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-06-01uapi: fix comment in xfrm.hStephen Hemminger1-1/+1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-31iproute2: ip addr: Add support for setting 'optimistic'Ian K. Coolidge2-2/+7
optimistic DAD is controllable via sysctl for an interface or all interfaces on the system. This would affect addresses added by the kernel only. Recent kernels, however, have enabled support for adding optimistic address via userspace. This plumbs that support. Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-31iproute2: ip addr: Organize flag properties structurallyIan K. Coolidge1-57/+55
This creates a nice systematic way to check that the various flags are mutable from userspace and that the address family is valid. Mutability properties are preserved to avoid introducing any behavioral change in this CL. However, previously, immutable flags were ignored and fell through to this confusing error: Error: either "local" is duplicate, or "dadfailed" is a garbage. But now, they just warn more explicitly: Warning: dadfailed option is not mutable from userspace Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-31tc: report time an action was first usedRoman Mashak1-0/+4
Have print_tm() dump firstuse value along with install, lastuse and expires. v2: Resubmit after 'master' merged into next Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-27bpf: Fixes a snprintf truncation warningAndrea Claudi1-1/+5
gcc v9.3.1 reports: bpf.c: In function ‘bpf_get_work_dir’: bpf.c:784:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); | ^ bpf.c:784:2: note: ‘snprintf’ output between 2 and 4097 bytes into a destination of size 4096 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this simply checking snprintf return code and properly handling the error. Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-27Revert "bpf: replace snprintf with asprintf when dealing with long buffers"Andrea Claudi1-116/+39
This reverts commit c0325b06382cb4f7ebfaf80c29c8800d74666fd9. It introduces a segfault in bpf_make_custom_path() when custom pinning is used. This happens because asprintf allocates exactly the space needed to hold a string in the buffer passed as its first argument, but if this buffer is later used in strcat() or similar we have a buffer overrun. As the aim of commit c0325b06382c is simply to fix a compiler warning, it seems safe and reasonable to revert it. Fixes: c0325b06382c ("bpf: replace snprintf with asprintf when dealing with long buffers") Reported-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-27Merge branch 'master' into nextDavid Ahern6-26/+146
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-27tipc: enable printing of broadcast rcv link statsTuong Lien1-8/+17
This commit allows printing the statistics of a broadcast-receiver link using the same tipc command, but with additional 'link' options: $ tipc link stat show --help Usage: tipc link stat show [ link { LINK | SUBSTRING | all } ] With: + 'LINK' : print the stats of the specific link 'LINK'; + 'SUBSTRING' : print the stats of all the links having the 'SUBSTRING' in name; + 'all' : print all the links' stats incl. the broadcast-receiver ones; Also, a link stats can be reset in the usual way by specifying the link name in command. For example: $ tipc l st sh l br Link <broadcast-link> Window:50 packets RX packets:0 fragments:0/0 bundles:0/0 TX packets:5011125 fragments:4968774/149643 bundles:38402/307061 RX naks:781484 defs:0 dups:0 TX naks:0 acks:0 retrans:330259 Congestion link:50657 Send queue max:0 avg:0 Link <broadcast-link:1001001> Window:50 packets RX packets:95146 fragments:95040/1980 bundles:1/2 TX packets:0 fragments:0/0 bundles:0/0 RX naks:380938 defs:83962 dups:403 TX naks:8362 acks:0 retrans:170662 Congestion link:0 Send queue max:0 avg:0 Link <broadcast-link:1001002> Window:50 packets RX packets:0 fragments:0/0 bundles:0/0 TX packets:0 fragments:0/0 bundles:0/0 RX naks:400546 defs:0 dups:0 TX naks:0 acks:0 retrans:159597 Congestion link:0 Send queue max:0 avg:0 $ tipc l st sh l 1001002 Link <1001003:data0-1001002:data0> ACTIVE MTU:1500 Priority:10 Tolerance:1500 ms Window:50 packets RX packets:99546 fragments:0/0 bundles:33/877 TX packets:629 fragments:0/0 bundles:35/828 TX profile sample:8 packets average:390 octets 0-64:75% -256:0% -1024:0% -4096:25% -16384:0% -32768:0% -66000:0% RX states:488714 probes:7397 naks:0 defs:4 dups:5 TX states:27734 probes:18016 naks:5 acks:2305 retrans:0 Congestion link:0 Send queue max:0 avg:0 Link <broadcast-link:1001002> Window:50 packets RX packets:0 fragments:0/0 bundles:0/0 TX packets:0 fragments:0/0 bundles:0/0 RX naks:400546 defs:0 dups:0 TX naks:0 acks:0 retrans:159597 Congestion link:0 Send queue max:0 avg:0 $ tipc l st re l broadcast-link:1001002 $ tipc l st sh l broadcast-link:1001002 Link <broadcast-link:1001002> Window:50 packets RX packets:0 fragments:0/0 bundles:0/0 TX packets:0 fragments:0/0 bundles:0/0 RX naks:0 defs:0 dups:0 TX naks:0 acks:0 retrans:0 Congestion link:0 Send queue max:0 avg:0 Acked-by: Ying Xue <ying.xue@windriver.com> Acked-by: Jon Maloy <jmaloy@redhat.com> Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-27lwtunnel: add support for rpl segment routingAlexander Aring2-1/+122
This patch adds support for rpl segment routing settings. Example: ip -n ns0 -6 route add 2001::3 encap rpl segs \ fe80::c8fe:beef:cafe:cafe,fe80::c8fe:beef:cafe:beef dev lowpan0 Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-19tc: action: fix time values output in JSON formatRoman Mashak1-15/+11
Report tcf_t values in seconds, not jiffies, in JSON format as it is now for stdout. v2: use PRINT_ANY, drop the useless casts and fix the style (Stephen Hemminger) Fixes: 2704bd625583 ("tc: jsonify actions core") Cc: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-19uapi: update to bpf.hStephen Hemminger1-1/+1
Part of the zero-length array changes Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-19utils: remove trailing zeros in print_time() and print_time64()Eric Dumazet1-5/+5
Before : tc qd sh dev eth1 ... refill_delay 40.0ms timer_slack 10.000us horizon 10.000s After : ... refill_delay 40ms timer_slack 10us horizon 10s Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-19man: tc-ct.8: Add manual page for ct tc actionPaul Blakey2-0/+113
Signed-off-by: Paul Blakey <paulb@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-18tc: mqprio: reject queues count/offset pair count higher than num_tcMaciej Fijalkowski1-0/+8
Provide a sanity check that will make sure whether queues count/offset pair count will not exceed the actual number of TCs being created. Example command that is invalid because there are 4 count/offset pairs whereas num_tc is only 2. # tc qdisc add dev enp96s0f0 root mqprio num_tc 2 map 0 0 0 0 1 1 1 1 queues 4@0 4@4 4@8 4@12 hw 1 mode channel Store the parsed count/offset pair count onto a dedicated variable that will be compared against opt.num_tc after all of the command line arguments were parsed. Bail out if this count is higher than opt.num_tc and let user know about it. Drivers were swallowing such commands as they were iterating over count/offset pairs where num_tc was used as a delimiter, so this is not a big deal, but better catch such misconfiguration at the command line argument parsing level. Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13ss: add checks for bc filter supportDmitry Yakunin6-33/+154
As noted by David Ahern, now if some bytecode filter is not supported by running kernel printed error message is not clear. This patch is attempt to detect such case and print correct message. This is done by providing checking function for new filter types. As example check function for cgroup filter is implemented. It sends correct lightweight request (idiag_states = 0) with zero cgroup condition to the kernel and checks returned errno. If filter is not supported EINVAL is returned. Result of checking is cached to avoid extra checks if several same filters are specified. Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13ss: add support for cgroup v2 information and filteringDmitry Yakunin4-1/+93
This patch introduces two new features: obtaining cgroup information and filtering sockets by cgroups. These features work based on cgroup v2 ID field in the socket (kernel should be compiled with CONFIG_SOCK_CGROUP_DATA). Cgroup information can be obtained by specifying --cgroup flag and now contains only pathname. For faster pathname lookups cgroup cache is implemented. This cache is filled on ss startup and missed entries are resolved and saved on the fly. Cgroup filter extends EXPRESSION and allows to specify cgroup pathname (relative or absolute) to obtain sockets attached only to this cgroup. Filter syntax: ss [ cgroup PATHNAME ] Examples: ss -a cgroup /sys/fs/cgroup/unified (or ss -a cgroup .) ss -a cgroup /sys/fs/cgroup/unified/cgroup1 (or ss -a cgroup cgroup1) v2: - style fixes (David Ahern) Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13ss: introduce cgroup2 cache and helper functionsDmitry Yakunin6-6/+282
This patch prepares infrastructure for matching sockets by cgroups. Two helper functions are added for transformation between cgroup v2 ID and pathname. Cgroup v2 cache is implemented as hash table indexed by ID. This cache is needed for faster lookups of socket cgroup. v2: - style fixes (David Ahern) Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13iproute2-next: add gate action man pagePo Liu1-0/+123
This patch is to add the man page for the tc gate action. Signed-off-by: Po Liu <Po.Liu@nxp.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13iproute2-next:tc:action: add a gate control actionPo Liu2-0/+581
Introduce a ingress frame gate control flow action. Tc gate action does the work like this: Assume there is a gate allow specified ingress frames can pass at specific time slot, and also drop at specific time slot. Tc filter chooses the ingress frames, and tc gate action would specify what slot does these frames can be passed to device and what time slot would be dropped. Tc gate action would provide an entry list to tell how much time gate keep open and how much time gate keep state close. Gate action also assign a start time to tell when the entry list start. Then driver would repeat the gate entry list cyclically. For the software simulation, gate action require the user assign a time clock type. Below is the setting example in user space. Tc filter a stream source ip address is 192.168.0.20 and gate action own two time slots. One is last 200ms gate open let frame pass another is last 100ms gate close let frames dropped. # tc qdisc add dev eth0 ingress # tc filter add dev eth0 parent ffff: protocol ip \ flower src_ip 192.168.0.20 \ action gate index 2 clockid CLOCK_TAI \ sched-entry open 200000000ns -1 8000000b \ sched-entry close 100000000ns # tc chain del dev eth0 ingress chain 0 "sched-entry" follow the name taprio style. Gate state is "open"/"close". Follow the period nanosecond. Then next -1 is internal priority value means which ingress queue should put to. "-1" means wildcard. The last value optional specifies the maximum number of MSDU octets that are permitted to pass the gate during the specified time interval, the overlimit frames would be dropped. Below example shows filtering a stream with destination mac address is 10:00:80:00:00:00 and ip type is ICMP, follow the action gate. The gate action would run with one close time slot which means always keep close. The time cycle is total 200000000ns. The base-time would calculate by: 1357000000000 + (N + 1) * cycletime When the total value is the future time, it will be the start time. The cycletime here would be 200000000ns for this case. #tc filter add dev eth0 parent ffff: protocol ip \ flower skip_hw ip_proto icmp dst_mac 10:00:80:00:00:00 \ action gate index 12 base-time 1357000000000ns \ sched-entry CLOSE 200000000ns \ clockid CLOCK_TAI Signed-off-by: Po Liu <Po.Liu@nxp.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13Update kernel headers and import tc_gate.hDavid Ahern2-1/+48
Update kernel headers to commit: fb9f2e92864f ("net: dsa: tag_sja1105: appease sparse checks for ethertype accessors") and import tc_act/tc_gate.h Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05tc: fq: fix two issuesEric Dumazet1-2/+4
My latest patch missed the fact that this file got JSON support. Also fixes a spelling error added during JSON change. Fixes: be9ca9d54123 ("tc: fq: add timer_slack parameter") Fixes: d15e2bfc042b ("tc: fq: add support for JSON output") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-05ss: update to bw printStephen Hemminger1-1/+8
Display kilobit with the standard suffix. Add comment to describe where data rate suffixes come from. Add support for terrabit. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-05devlink: support kernel-side snapshot id allocationJakub Kicinski1-3/+23
Make ID argument optional and read the snapshot info that kernel sends us. $ devlink region new netdevsim/netdevsim1/dummy netdevsim/netdevsim1/dummy: snapshot 0 $ devlink -jp region new netdevsim/netdevsim1/dummy { "regions": { "netdevsim/netdevsim1/dummy": { "snapshot": [ 1 ] } } } $ devlink region show netdevsim/netdevsim1/dummy netdevsim/netdevsim1/dummy: size 32768 snapshot [0 1] Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05ss: add support for Gbit speeds in sprint_bw()Eric Dumazet1-4/+6
Also use 'g' specifier instead of 'f' to remove trailing zeros, and increase precision. Examples of output : Before After 8.0Kbps 8Kbps 9.9Mbps 9.92Mbps 55001Mbps 55Gbps Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-05Merge branch 'master' into nextDavid Ahern26-162/+380
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05Import rpl.h and rpl_iptunnel.h uapi headersDavid Ahern2-0/+69
Import rpl.h and rpl_iptunnel.h as of kernel commit: 354d86141796 ("Merge branch 'net-reduce-dynamic-lockdep-keys'") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05tc: full JSON support for 'bpf' filterDavide Caratti1-14/+15
example using eBPF: # tc filter add dev dummy0 ingress bpf \ > direct-action obj ./bpf/filter.o sec tc-ingress # tc -j filter show dev dummy0 ingress | jq [ { "protocol": "all", "pref": 49152, "kind": "bpf", "chain": 0 }, { "protocol": "all", "pref": 49152, "kind": "bpf", "chain": 0, "options": { "handle": "0x1", "bpf_name": "filter.o:[tc-ingress]", "direct-action": true, "not_in_hw": true, "prog": { "id": 101, "tag": "a04f5eef06a7f555", "jited": 1 } } } ] v2: - use print_nl(), thanks to Andrea Claudi - use print_0xhex() for filter handle, thanks to Stephen Hemminger Signed-off-by: Davide Caratti <dcaratti@redhat.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05Update kernel headersDavid Ahern6-3/+180
Update kernel headers to commit: 354d86141796 ("Merge branch 'net-reduce-dynamic-lockdep-keys'") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-04Replace open-coded instances of print_nl()Benjamin Poirier12-36/+36
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-04bridge: Align output columnsBenjamin Poirier1-21/+52
Use fixed column widths to improve readability. Before: root@vsid:/src/iproute2# ./bridge/bridge vlan tunnelshow port vlan-id tunnel-id vx0 2 2 1010-1020 1010-1020 1030 65556 vx-longname 2 2 After: root@vsid:/src/iproute2# ./bridge/bridge vlan tunnelshow port vlan-id tunnel-id vx0 2 2 1010-1020 1010-1020 1030 65556 vx-longname 2 2 Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-04json_print: Return number of characters printedBenjamin Poirier2-46/+73
When outputting in normal mode, forward the return value from color_fprintf(). Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-04bridge: Fix output with empty vlan listsBenjamin Poirier3-18/+50
Consider this configuration: ip link add br0 type bridge ip link add vx0 type vxlan dstport 4789 external ip link set dev vx0 master br0 bridge vlan del vid 1 dev vx0 ip link add vx1 type vxlan dstport 4790 external ip link set dev vx1 master br0 root@vsid:/src/iproute2# ./bridge/bridge vlan port vlan-id br0 1 PVID Egress Untagged vx0 None vx1 1 PVID Egress Untagged root@vsid:/src/iproute2# Note the useless and inconsistent empty lines. root@vsid:/src/iproute2# ./bridge/bridge vlan tunnelshow port vlan-id tunnel-id br0 vx0 None vx1 What's the difference between "None" and ""? root@vsid:/src/iproute2# ./bridge/bridge -j -p vlan tunnelshow [ { "ifname": "br0", "tunnels": [ ] },{ "ifname": "vx1", "tunnels": [ ] } ] Why does vx0 appear in normal output and not json output? Why output an empty list for br0 and vx1? Fix these inconsistencies and avoid outputting entries with no values. This makes the behavior consistent with other iproute2 commands, for example `ip -6 addr`: if an interface doesn't have any ipv6 addresses, it is not part of the listing. Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-04bridge: Fix typoBenjamin Poirier1-1/+1
Fixes: 7abf5de677e3 ("bridge: vlan: add support to display per-vlan statistics") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-04bridge: Use consistent column names in vlan outputBenjamin Poirier1-3/+3
Fix singular vs plural. Add a hyphen to clarify that each of those are single fields. Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-05-01tc: f_flower: add options support for erspanXin Long2-0/+184
This patch is to add TCA_FLOWER_KEY_ENC_OPTS_ERSPAN's parse and print to implement erspan options support in m_tunnel_key, like Commit 56155d4df86d ("tc: f_flower: add geneve option match support to flower") for geneve options support. Option is expressed as version:index:dir:hwid, dir and hwid will be parsed when version is 2, while index will be parsed when version is 1. erspan doesn't support multiple options. With this patch, users can add and dump erspan options like: # ip link add name erspan1 type erspan external # tc qdisc add dev erspan1 ingress # tc filter add dev erspan1 protocol ip parent ffff: \ flower \ enc_src_ip 10.0.99.192 \ enc_dst_ip 10.0.99.193 \ enc_key_id 11 \ erspan_opts 1:2:0:0/1:255:0:0 \ ip_proto udp \ action mirred egress redirect dev eth1 # tc -s filter show dev erspan1 parent ffff: filter protocol ip pref 49152 flower chain 0 handle 0x1 eth_type ipv4 ip_proto udp enc_dst_ip 10.0.99.193 enc_src_ip 10.0.99.192 enc_key_id 11 erspan_opts 1:2:0:0/1:255:0:0 not_in_hw action order 1: mirred (Egress Redirect to device eth1) stolen index 1 ref 1 bind 1 Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 v1->v2: - no change. v2->v3: - no change. v3->v4: - keep the same format between input and output, json and non json. - print version, index, dir and hwid as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01tc: f_flower: add options support for vxlanXin Long2-16/+126
This patch is to add TCA_FLOWER_KEY_ENC_OPTS_VXLAN's parse and print to implement vxlan options support in m_tunnel_key, like Commit 56155d4df86d ("tc: f_flower: add geneve option match support to flower") for geneve options support. Option is expressed a 32bit number for gbp only, and vxlan doesn't support multiple options. With this patch, users can add and dump vxlan options like: # ip link add name vxlan1 type vxlan dstport 0 external # tc qdisc add dev vxlan1 ingress # tc filter add dev vxlan1 protocol ip parent ffff: \ flower \ enc_src_ip 10.0.99.192 \ enc_dst_ip 10.0.99.193 \ enc_key_id 11 \ vxlan_opts 65793/4008635966 \ ip_proto udp \ action mirred egress redirect dev eth1 # tc -s filter show dev vxlan1 parent ffff: filter protocol ip pref 49152 flower chain 0 handle 0x1 eth_type ipv4 ip_proto udp enc_dst_ip 10.0.99.193 enc_src_ip 10.0.99.192 enc_key_id 11 vxlan_opts 65793/4008635966 not_in_hw action order 1: mirred (Egress Redirect to device eth1) stolen index 3 ref 1 bind 1 Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 v1->v2: - get_u32 with base = 0 for gbp. v2->v3: - implement proper JSON array for opts. v3->v4: - keep the same format between input and output, json and non json. - print gbp as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01tc: m_tunnel_key: add options support for erpsanXin Long2-2/+127
This patch is to add TCA_TUNNEL_KEY_ENC_OPTS_ERSPAN's parse and print to implement erspan options support in m_tunnel_key, like Commit 6217917a3826 ("tc: m_tunnel_key: Add tunnel option support to act_tunnel_key") for geneve options support. Option is expressed as version:index:dir:hwid, dir and hwid will be parsed when version is 2, while index will be parsed when version is 1. erspan doesn't support multiple options. With this patch, users can add and dump erspan options like: # ip link add name erspan1 type erspan external # tc qdisc add dev eth0 ingress # tc filter add dev eth0 protocol ip parent ffff: \ flower indev eth0 \ ip_proto udp \ action tunnel_key \ set src_ip 10.0.99.192 \ dst_ip 10.0.99.193 \ dst_port 6081 \ id 11 \ erspan_opts 1:2:0:0 \ action mirred egress redirect dev erspan1 # tc -s filter show dev eth0 parent ffff: filter protocol ip pref 49151 flower chain 0 handle 0x1 indev eth0 eth_type ipv4 ip_proto udp not_in_hw action order 1: tunnel_key set src_ip 10.0.99.192 dst_ip 10.0.99.193 key_id 11 dst_port 6081 erspan_opts 1:2:0:0 csum pipe index 2 ref 1 bind 1 ... v1->v2: - no change. v2->v3: - no change. v3->v4: - keep the same format between input and output, json and non json. - print version, index, dir and hwid as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01tc: m_tunnel_key: add options support for vxlanXin Long2-10/+84
This patch is to add TCA_TUNNEL_KEY_ENC_OPTS_VXLAN's parse and print to implement vxlan options support in m_tunnel_key, like Commit 6217917a3826 ("tc: m_tunnel_key: Add tunnel option support to act_tunnel_key") for geneve options support. Option is expressed a 32bit number for gbp only, and vxlan doesn't support multiple options. With this patch, users can add and dump vxlan options like: # ip link add name vxlan1 type vxlan dstport 0 external # tc qdisc add dev eth0 ingress # tc filter add dev eth0 protocol ip parent ffff: \ flower indev eth0 \ ip_proto udp \ action tunnel_key \ set src_ip 10.0.99.192 \ dst_ip 10.0.99.193 \ dst_port 6081 \ id 11 \ vxlan_opts 65793 \ action mirred egress redirect dev vxlan1 # tc -s filter show dev eth0 parent ffff: filter protocol ip pref 49152 flower chain 0 handle 0x1 indev eth0 eth_type ipv4 ip_proto udp not_in_hw action order 1: tunnel_key set src_ip 10.0.99.192 dst_ip 10.0.99.193 key_id 11 dst_port 6081 vxlan_opts 65793 ... v1->v2: - get_u32 with base = 0 for gbp. - use to print_unint("0x%x") to print gbp. v2->v3: - implement proper JSON array for opts. v3->v4: - keep the same format between input and output, json and non json. - print gbp as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01iproute_lwtunnel: add options support for erspan metadataXin Long1-0/+140
This patch is to add LWTUNNEL_IP_OPTS_ERSPAN's parse and print to implement erspan options support in iproute_lwtunnel. Option is expressed as version:index:dir:hwid, dir and hwid will be parsed when version is 2, while index will be parsed when version is 1. All of these are numbers. erspan doesn't support multiple options. With this patch, users can add and dump erspan options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up # ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add erspan1 type erspan key 1 seq erspan 123 \ local 10.1.0.2 remote 10.1.0.1 # ip -n b addr add 1.1.1.1/24 dev erspan1 # ip -n b link set erspan1 up # ip -n b route add 2.1.1.0/24 dev erspan1 # ip -n a link add erspan1 type erspan key 1 seq local 10.1.0.1 external # ip -n a addr add 2.1.1.1/24 dev erspan1 # ip -n a link set erspan1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 \ erspan_opts 2:123:1:2 dst 10.1.0.2 dev erspan1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 erspan_opts 2:0:1:2 dev erspan1 scope link PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.124 ms v1->v2: - improve the changelog. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON object for opts instead of just bunch of strings. v3->v4: - keep the same format between input and output, json and non json. - print version, index, dir and hwid as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01iproute_lwtunnel: add options support for vxlan metadataXin Long1-0/+68
This patch is to add LWTUNNEL_IP_OPTS_VXLAN's parse and print to implement vxlan options support in iproute_lwtunnel. Option is expressed a number for gbp only, and vxlan doesn't support multiple options. With this patch, users can add and dump vxlan options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up # ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add vxlan1 type vxlan id 1 local 10.1.0.2 \ remote 10.1.0.1 dev eth0 ttl 64 gbp # ip -n b addr add 1.1.1.1/24 dev vxlan1 # ip -n b link set vxlan1 up # ip -n b route add 2.1.1.0/24 dev vxlan1 # ip -n a link add vxlan1 type vxlan local 10.1.0.1 dev eth0 ttl 64 \ gbp external # ip -n a addr add 2.1.1.1/24 dev vxlan1 # ip -n a link set vxlan1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 \ vxlan_opts 1110 dst 10.1.0.2 dev vxlan1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 vxlan_opts 1110 dev vxlan1 scope link PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.111 ms v1->v2: - improve the changelog. - get_u32 with base = 0 for gbp. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON array for opts. v3->v4: - keep the same format between input and output, json and non json. - print gbp as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-01iproute_lwtunnel: add options support for geneve metadataXin Long1-2/+172
This patch is to add LWTUNNEL_IP(6)_OPTS and LWTUNNEL_IP_OPTS_GENEVE's parse and print to implement geneve options support in iproute_lwtunnel. Options are expressed as class:type:data and multiple options may be listed using a comma delimiter, class and type are numbers and data is a hex string. With this patch, users can add and dump geneve options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up; ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add geneve1 type geneve id 1 remote 10.1.0.1 ttl 64 # ip -n b addr add 1.1.1.1/24 dev geneve1 # ip -n b link set geneve1 up # ip -n b route add 2.1.1.0/24 dev geneve1 # ip -n a link add geneve1 type geneve external # ip -n a addr add 2.1.1.1/24 dev geneve1 # ip -n a link set geneve1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 geneve_opts \ 1:1:1212121234567890,1:1:1212121234567890,1:1:1212121234567890 \ dst 10.1.0.2 dev geneve1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 geneve_opts 1:1:1212121234567890,1:1:1212121234567890 ... PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.079 ms v1->v2: - improve the changelog. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON array for opts instead of just bunch of strings. v3->v4: - keep the same format between input and output, json and non json. - print class and type as uint and print data as hex string. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29devlink: add support for DEVLINK_CMD_REGION_NEWJacob Keller1-0/+20
Add support to request that a new snapshot be taken immediately for a devlink region. To avoid confusion, the desired snapshot id must be provided. Note that if a region does not support snapshots on demand, the kernel will reject the request with -EOPNOTSUP. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-29uapi: update bpf.hStephen Hemminger1-1/+1
Minor spelling in comment Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-30tc: pedit: Support JSON dumpingPetr Machata1-25/+46
The action pedit does not currently support dumping to JSON. Convert print_pedit() to the print_* family of functions so that dumping is correct both in plain and JSON mode. In plain mode, the output is character for character the same as it was before. In JSON mode, this is an example dump: $ tc filter add dev dummy0 ingress prio 125 flower \ action pedit ex munge udp dport set 12345 \ munge ip ttl add 1 \ munge offset 10 u8 clear $ tc -j filter show dev dummy0 ingress | jq [ { "protocol": "all", "pref": 125, "kind": "flower", "chain": 0 }, { "protocol": "all", "pref": 125, "kind": "flower", "chain": 0, "options": { "handle": 1, "keys": {}, "not_in_hw": true, "actions": [ { "order": 1, "kind": "pedit", "control_action": { "type": "pass" }, "nkeys": 3, "index": 1, "ref": 1, "bind": 1, "keys": [ { "htype": "udp", "offset": 0, "cmd": "set", "val": "3039", "mask": "ffff0000" }, { "htype": "ipv4", "offset": 8, "cmd": "add", "val": "1000000", "mask": "ffffff" }, { "htype": "network", "offset": 8, "cmd": "set", "val": "0", "mask": "ffff00ff" } ] } ] } } ] Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-30erspan: Add type I version 0 support.William Tu3-7/+7
The Type I ERSPAN frame format is based on the barebones IP + GRE(4-byte) encapsulation on top of the raw mirrored frame. Both type I and II use 0x88BE as protocol type. Unlike type II and III, no sequence number or key is required. To creat a type I erspan tunnel device: $ ip link add dev erspan11 type erspan \ local 172.16.1.100 remote 172.16.1.200 \ erspan_ver 0 CC: Dmitriy Andreyevskiy <dandreye@cisco.com> Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29man: ip.8: add reference to mptcp man-pagePaolo Abeni2-2/+6
While at it, additionally fix a mandoc warning in mptcp.8 Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29Merge branch 'mptcp' into nextDavid Ahern7-2/+649
Paolo Abeni says: ==================== This introduces support for the MPTCP PM netlink interface, allowing admins to configure several aspects of the MPTCP path manager. The subcommand is documented with a newly added man-page. This series also includes support for MPTCP subflow diag. ==================== Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29man: mptcp man pagePaolo Abeni1-0/+142
describe the mptcp subcommands implemented so far. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29ss: allow dumping MPTCP subflow informationDavide Caratti2-0/+67
[root@f31 packetdrill]# ss -tni ESTAB 0 0 192.168.82.247:8080 192.0.2.1:35273 cubic wscale:7,8 [...] tcp-ulp-mptcp flags:Mec token:0000(id:0)/5f856c60(id:0) seq:b810457db34209a5 sfseq:1 ssnoff:0 maplen:190 Additionally extends ss manpage to describe the new entry layout. Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29add support for mptcp netlink interfacePaolo Abeni4-2/+440
Implement basic commands to: - manipulate MPTCP endpoints list - manipulate MPTCP connection limits Examples: 1. Allows multiple subflows per MPTCP connection $ ip mptcp limits set subflows 2 2. Accept ADD_ADDR announcement from the peer (server): $ ip mptcp limits set add_addr_accepted 2 3. Add a ipv4 address to be annunced for backup subflows: $ ip mptcp endpoint add 10.99.1.2 signal backup 4. Add an ipv6 address used as source for additional subflows: $ ip mptcp endpoint add 2001::2 subflow Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-29Update kernel headers and import mptcp.hDavid Ahern6-1/+135
Update kernel headers to commit 790ab249b55d ("net: ethernet: fec: Prevent MII event after MII_SPEED write") and import mptcp.h Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-27tc: fq: add timer_slack parameterEric Dumazet1-0/+27
Commit 583396f4ca4d ("net_sched: sch_fq: enable use of hrtimer slack") added TCA_FQ_TIMER_SLACK parameter, with a default value of 10 usec. Add the corresponding tc support to get/set this tunable. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-27tc: fq_codel: add drop_batch parameterEric Dumazet1-1/+18
Commit 9d18562a2278 ("fq_codel: add batch ability to fq_codel_drop()") added the new TCA_FQ_CODEL_DROP_BATCH_SIZE parameter, set by default to 64. Add to tc command the ability to get/set the drop_batch Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-27xfrm: also check for ipv6 state in xfrm_state_keepXin Long1-1/+2
As commit f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall") does, this patch is to fix the same issue for ip6 state where xsinfo->id.proto == IPPROTO_IPV6. # ip xfrm state add src 2000::1 dst 2000::2 spi 0x1000 \ proto comp comp deflate mode tunnel sel src 2000::1 dst \ 2000::2 proto gre # ip xfrm sta deleteall Failed to send delete-all request : Operation not permitted Note that the xsinfo->proto in common states can never be IPPROTO_IPV6. Fixes: f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall") Reported-by: Xiumei Mu <xmu@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-27tc: m_action: check cookie hex string lenJiri Pirko1-1/+2
Check the cookie hex string len is dividable by 2 as the valid hex string always should be. Reported-by: Alex Kushnarov <alexanderk@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-26Merge branch 'macsec-offload' into nextDavid Ahern2-3/+30
Igor Russkikh says: ==================== From: Mark Starovoytov <mstarovoitov@marvell.com> This series adds support for selecting the offloading mode of a MACsec interface at link creation time. Available modes are for now 'off', 'phy' and 'mac', 'off' being the default when an interface is created. First patch adds support for MAC offloading. Last patch allows a user to change the offloading mode at runtime through a new attribute, `ip link add link ... offload`: # ip link add link enp1s0 type macsec encrypt on offload off # ip link add link enp1s0 type macsec encrypt on offload phy # ip link add link enp1s0 type macsec encrypt on offload mac ==================== Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-26macsec: add support for specifying offload at link add timeMark Starovoytov2-1/+27
This patch adds support for configuring offload mode upon MACsec device creation. If offload mode is not specified, then netlink attribute is not added. Default behavior on the kernel side in this case is backward-compatible (offloading is disabled by default). Example: $ ip link add link eth0 macsec0 type macsec port 11 encrypt on offload mac Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> Signed-off-by: Igor Russkikh <irusskikh@marvell.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-26macsec: add support for MAC offloadMark Starovoytov2-2/+3
This patch enables MAC HW offload usage in iproute, since MACSec implementation supports it now. Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> Signed-off-by: Igor Russkikh <irusskikh@marvell.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-20bridge: man page spelling fixesStephen Hemminger1-3/+3
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20State of bridge STP port are now case insensitiveBastien Roucariès2-9/+9
Improve use experience Signed-off-by: Bastien Roucariès <rouca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20Document root_block optionBastien Roucariès1-0/+5
Root_block is also called root port guard, document it. Signed-off-by: Bastien Roucariès <rouca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20Better documentation of BDPU guardBastien Roucariès1-1/+12
Document that guard disable the port and how to reenable it Signed-off-by: Bastien Roucariès <rouca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20Document BPDU filter optionBastien Roucariès1-6/+19
Disabled state is also BPDU filter Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20Improve hairpin mode descriptionBastien Roucariès1-1/+3
Mention VEPA and reflective relay. Signed-off-by: Bastien Roucariès <rouca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20Better documentation of mcast_to_unicast optionBastien Roucariès1-0/+26
This option is useful for Wifi bridge but need some tweak. Document it from kernel patches documentation Signed-off-by: Bastien Roucariès <rouca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20man: replace $(NETNS_ETC_DIR) and $(NETNS_RUN_DIR) in ip-netns(8)Brian Norris2-11/+15
These can be configured to different paths. Reflect that in the generated documentation. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20man: add ip-netns(8) as generation targetBrian Norris3-8/+3
Prepare for adding new variable substitutions. Unify the sed rules while we're at it, since there's no need to write this out 4 times. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20tc: fq_codel: fix class stat deficit is signed intBenjamin Lee1-1/+1
The fq_codel class stat deficit is a signed int. This is a regression from when JSON output was added. Fixes: 997f2dc19378 ("tc: Add JSON output of fq_codel stats") Signed-off-by: Benjamin Lee <ben@b1c1l1.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20q_cake: properly print memlimitOdin Ugedal1-1/+5
Load memlimit so that it will be printed if it isn't set to zero. Also add a space to properly print it. Signed-off-by: Odin Ugedal <odin@ugedal.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20q_cake: Make fwmark uint instead of intOdin Ugedal1-6/+3
This will help avoid overflow, since setting it to 0xffffffff would result in -1 when converted to integer, resulting in being "-1", setting the fwmark to 0x00. Signed-off-by: Odin Ugedal <odin@ugedal.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-20tc_util: detect overflow in get_sizeOdin Ugedal1-0/+5
This detects overflow during parsing of value using get_size: eg. running: $ tc qdisc add dev lo root cake memlimit 11gb currently gives a memlimit of "3072Mb", while with this patch it errors with 'illegal value for "memlimit": "11gb"', since memlinit is an unsigned integer. Signed-off-by: Odin Ugedal <odin@ugedal.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-19devlink: Add devlink health auto_dump command supportEran Ben Elisha2-3/+27
Add support for configuring auto_dump attribute per reporter. With this attribute, one can indicate whether the devlink kernel core should execute automatic dump on error. The change will be reflected in show, set and man commands. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Reviewed-by: Aya Levin <ayal@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-19Merge branch 'master' into nextDavid Ahern3-15/+97
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-13man: tc-htb.8: fix class prio is not mandatoryBenjamin Lee1-1/+1
Fix description for htb class prio parameter to indicate it's not mandatory. Signed-off-by: Benjamin Lee <ben@b1c1l1.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-13man: tc-htb.8: add missing class parameter quantumBenjamin Lee1-0/+13
Add description for htb class parameter quantum. Signed-off-by: Benjamin Lee <ben@b1c1l1.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-13man: tc-htb.8: add missing qdisc parameter r2qBenjamin Lee1-0/+9
Add description for htb qdisc parameter r2q. Signed-off-by: Benjamin Lee <ben@b1c1l1.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-13ip: link_gre: Do not send ERSPAN attributes to GRE tunnelsPetr Machata1-12/+22
In the commit referenced below, ip link started sending ERSPAN-specific attributes even for GRE and gretap tunnels. Fix by more carefully distinguishing between the GRE/tap and ERSPAN modes. Do not show ERSPAN-related help in GRE/tap mode, likewise do not accept ERSPAN arguments, or send ERSPAN attributes. Fixes: 83c543af872e ("erspan: set erspan_ver to 1 by default") Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-13devlink: fix JSON output of mon commandJiri Pirko1-2/+52
The current JSON output of mon command is broken. Fix it and make sure that the output is a valid JSON. Also, handle SIGINT gracefully to allow to end the JSON properly. Example: $ devlink mon -j -p { "mon": [ { "command": "new", "dev": { "netdevsim/netdevsim10": {} } },{ "command": "new", "port": { "netdevsim/netdevsim10/0": { "type": "notset", "flavour": "physical", "port": 1 } } },{ "command": "new", "port": { "netdevsim/netdevsim10/0": { "type": "eth", "netdev": "eth0", "flavour": "physical", "port": 1 } } },{ "command": "new", "port": { "netdevsim/netdevsim10/0": { "type": "notset", "flavour": "physical", "port": 1 } } },{ "command": "del", "port": { "netdevsim/netdevsim10/0": { "type": "notset", "flavour": "physical", "port": 1 } } },{ "command": "del", "dev": { "netdevsim/netdevsim10": {} } } ] } Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-09Merge branch 'master' into nextDavid Ahern10-104/+190
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-09man: tc-pedit: Drop the claim that pedit ex is only for IPv4Petr Machata1-2/+1
This sentence predates addition of extended pedit for IPv6 packets. Reported-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-09man: tc-pedit: Add examples for dsfield and retainPetr Machata1-0/+22
Describe a way to update just the DSCP and just the ECN part of the dsfield. That is useful on its own, but also it shows how retain works. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-09tc: p_ip6: Support pedit of IPv6 dsfieldPetr Machata2-2/+19
Support keywords dsfield, traffic_class and tos in the IPv6 context. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-09devlink: remove unused "jw" fieldJiri Pirko1-1/+0
This field is not used. Remove it. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-06man/tc-actions: fix formattingStephen Hemminger1-2/+1
Fix error from make check. n-old.tmac: <standard input>: line 86: 'R' is a string (producing the registered sign), not a macro. Error in tc-actions.8 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06man: add man page for devlink dpipeJiri Pirko1-0/+99
Add simple man page for devlink dpipe. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: remove "dev" object sub help messagesJiri Pirko1-19/+3
Remove duplicate sub help messages for "dev" object and have them all show help message for "dev". Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: Fix help message for dpipeJiri Pirko1-16/+8
Have one help message for all dpipe commands, as it is done for the rest of the devlink object. Possible and required options to the help. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabledJiri Pirko1-3/+3
To be consistent with the rest of the code and name of netlink attribute, rename the dpipe_counters_enable struct fielt to dpipe_counters_enabled. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: Add alias "counters_enabled" for "counters" optionJiri Pirko1-1/+2
To be consistent with netlink attribute name and also with the "dpipe table show" output, add "counters_enabled" for "counters" in "dpipe table set" command. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: fix encap mode manupulationJiri Pirko3-20/+42
DEVLINK_ATTR_ESWITCH_ENCAP_MODE netlink attribute carries enum. But the code assumes bool value. Fix this by treating the encap mode in the same way as other eswitch mode attributes, switching from "enable"/"disable" to "basic"/"none", according to the enum. Maintain the backward compatibility to allow user to pass "enable"/"disable" too. Also to be in-sync with the rest of the "mode" commands, rename to "encap-mode". Adjust the help and man page accordingly. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: Fix help and man of "devlink health set" commandJiri Pirko2-15/+19
Fix the help and man page of "devlink health set" command to be aligned with the rest of helps and man pages. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06devlink: remove custom bool command line options parsingJiri Pirko1-23/+5
Change the code that is doing custom processing of boolean command line options to use dl_argv_bool(). Extend strtobool() to accept "enable"/"disable" to maintain current behavior. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-06Merge ../iproute2-nextStephen Hemminger23-87/+1841
2020-03-31tc: show used HW stats typesJiri Pirko1-3/+7
If kernel provides the attribute, show the used HW stats types. Example: $ tc filter add dev enp3s0np1 ingress proto ip handle 1 pref 1 flower dst_ip 192.168.1.1 action drop $ tc -s filter show dev enp3s0np1 ingress filter protocol ip pref 1 flower chain 0 filter protocol ip pref 1 flower chain 0 handle 0x1 eth_type ipv4 dst_ip 192.168.1.1 in_hw in_hw_count 2 action order 1: gact action drop random type none pass val 0 index 1 ref 1 bind 1 installed 10 sec used 10 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 used_hw_stats immediate <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-31bash-completion: devlink: Extend bash-completion for new commandsIdo Schimmel1-1/+130
Extend bash-completion for two new commands: devlink trap policer set DEV policer POLICER [ rate RATE ] [ burst BURST ] devlink trap policer show DEV policer POLICER And for "policer" / "nopolicer" parameters in existing command: devlink trap group set DEV group GROUP [ action { trap | drop } ] [ policer POLICER ] [ nopolicer ] Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-31devlink: Add ability to bind policer to trap groupIdo Schimmel2-1/+22
Add ability to associate a policer with a trap group. The policer can be unbound by using the 'nopolicer' keyword. In which case, the value encoded in the 'DEVLINK_ATTR_TRAP_POLICER_ID' attribute will be '0'. This is consistent with ip-link 'nomaster' keyword and the 'IFLA_MASTER' attribute. Example: # devlink trap group set netdevsim/netdevsim10 group l3_drops policer 2 # devlink -jp trap group show netdevsim/netdevsim10 group l3_drops { "trap_group": { "netdevsim/netdevsim10": [ { "name": "l3_drops", "generic": true, "policer": 2 } ] } } # devlink trap group set netdevsim/netdevsim10 group l3_drops nopolicer # devlink -jp trap group show netdevsim/netdevsim10 group l3_drops { "trap_group": { "netdevsim/netdevsim10": [ { "name": "l3_drops", "generic": true } ] } } Signed-off-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-31devlink: Add devlink trap policer set and show commandsIdo Schimmel3-3/+213
The trap policer set command allows the user to set the parameters of the packet trap policer, such as rate and burst size. Example: # devlink trap policer set netdevsim/netdevsim10 policer 1 rate 1000 burst 32 The trap policer show command allows the user to get the current parameters of an individual policer or a dump of all policers in case one is not specified. When '-s' is specified the policer's statistics are shown. Example: # devlink -jps trap policer show netdevsim/netdevsim10 policer 1 { "trap_policer": { "netdevsim/netdevsim10": [ { "policer": 1, "rate": 1000, "burst": 32, "stats": { "rx": { "dropped": 53 } } } ] } } Signed-off-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-31Update kernel headersDavid Ahern7-5/+103
Update kernel headers to commit: 7f80ccfe9968 ("net: ipv6: rpl_iptunnel: Fix potential memory leak in rpl_do_srh_inline") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-30v5.6.0Stephen Hemminger1-1/+1
2020-03-30man: bridge.8: fix bridge link show descriptionAndrea Claudi1-2/+5
When multiple bridges are present, 'bridge link show' diplays ports for all bridges. Make this clear in the command description, and point out the user to the ip command to display ports for a specific bridge. Reported-by: Marc Muehlfeld <mmuehlfe@redhat.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-03-25bash-completion: devlink: add bash-completion functionDanielle Ratson2-0/+823
Add function for command completion for devlink in bash, and update Makefile to install it under /usr/share/bash-completion/completions/. Signed-off-by: Danielle Ratson <danieller@mellanox.com> Tested-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-25tc: q_red: Support 'nodrop' flagPetr Machata3-6/+30
Recognize the new configuration option of the RED Qdisc, "nodrop". Add support for passing flags through TCA_RED_FLAGS, and use it when passing TC_RED_NODROP flag. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-25tc: m_action: rename hw stats type uAPIJakub Kicinski1-20/+19
Follow the kernel rename to shorten the identifiers. Rename hw_stats_type to hw_stats. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-25Update kernel headersDavid Ahern2-17/+30
Update kernel headers to commit: cd556e40fdf3 ("devlink: expand the devlink-info documentation") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-20uapi: update linux/in.hStephen Hemminger1-0/+2
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-03-20tc: m_action: introduce support for hw stats typeJiri Pirko2-1/+96
Introduce support for per-action hw stats type config. This patch allows user to specify one of the following types of HW stats for added action: immediate - queried during dump time delayed - polled from HW periodically or sent by HW in async manner disabled - no stats needed Note that if "hw_stats" option is not passed, user does not care about the type, just expects any type of stats. Examples: $ tc filter add dev enp0s16np28 ingress proto ip handle 1 pref 1 flower skip_sw dst_ip 192.168.1.1 action drop hw_stats disabled $ tc -s filter show dev enp0s16np28 ingress filter protocol ip pref 1 flower chain 0 filter protocol ip pref 1 flower chain 0 handle 0x1 eth_type ipv4 dst_ip 192.168.1.1 skip_sw in_hw in_hw_count 2 action order 1: gact action drop random type none pass val 0 index 1 ref 1 bind 1 installed 7 sec used 2 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 hw_stats disabled $ tc filter add dev enp0s16np28 ingress proto ip handle 1 pref 1 flower skip_sw dst_ip 192.168.1.1 action drop hw_stats immediate $ tc -s filter show dev enp0s16np28 ingress filter protocol ip pref 1 flower chain 0 filter protocol ip pref 1 flower chain 0 handle 0x1 eth_type ipv4 dst_ip 192.168.1.1 skip_sw in_hw in_hw_count 2 action order 1: gact action drop random type none pass val 0 index 1 ref 1 bind 1 installed 11 sec used 4 sec Action statistics: Sent 102 bytes 1 pkt (dropped 1, overlimits 0 requeues 0) Sent software 0 bytes 0 pkt Sent hardware 102 bytes 1 pkt backlog 0b 0p requeues 0 hw_stats immediate Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-20Update kernel headersDavid Ahern7-69/+236
Update kernel headers to commit: 3fd177cb2b47 ("net: stmmac: dwmac_lib: remove unnecessary checks in dwmac_dma_reset()") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-15iproute2: fix MPLS label parsingGuillaume Nault1-1/+1
The initial value of "label" in parse_mpls() is 0xffffffff. Therefore we should test for this value, and not 0, to detect if a label has been provided. The "!label" test not only fails to detect a missing label parameter, it also prevents the use of the IPv4 explicit NULL label, which actually equals 0. Reproducer: $ ip link add name dm0 type dummy $ tc qdisc add dev dm0 ingress $ tc filter add dev dm0 parent ffff: matchall action mpls push Error: act_mpls: Label is required for MPLS push. We have an error talking to the kernel --> Filter was pushed to the kernel, where it got rejected. $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0 Error: argument "label" is required --> Label 0 was rejected by iproute2. Expected result: $ tc filter add dev dm0 parent ffff: matchall action mpls push Error: argument "label" is required --> Filter was directly rejected by iproute2. $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0 --> Filter is accepted. Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-03-15nexthop: fix error reporting in filter dumpAndrea Claudi1-2/+2
nh_dump_filter is missing a return value check in two cases. Fix this simply adding an assignment to the proper variable. Fixes: 63df8e8543b03 ("Add support for nexthop objects") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-03-10Revert "tc: pie: change maximum integer value of tc_pie_xstats->prob"Leslie Monis1-2/+2
This reverts commit 92cfe3260e9110c3d33627847b6eaa153664c79c. Kernel commit 3f95f55eb55d ("net: sched: pie: change tc_pie_xstats->prob") removes the need to change the maximum integer value of tc_pie_stats->prob here. Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-09tc: pie: change maximum integer value of tc_pie_xstats->probLeslie Monis1-2/+2
Kernel commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows"), changes the maximum value of tc_pie_xstats->prob from (2^64 - 1) to (2^56 - 1). Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in> Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com> Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04Merge branch 'macsec-offload' into nextDavid Ahern2-2/+88
Antoine Tenart says: ==================== This series adds support for selecting and reporting the offloading mode of a MACsec interface. Available modes are for now 'off' and 'phy', 'off' being the default when an interface is created. Modes are not only 'off' and 'on' as the MACsec operations can be offloaded to multiple kinds of specialized hardware devices, at least to PHYs and Ethernet MACs. The later isn't currently supported in the kernel though. The first patch adds support for reporting the offloading mode currently selected for a given MACsec interface through the `ip macsec show` command: # ip macsec show 18: macsec0: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c860001 on SA 0 0: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 0: PN 1, state on, key 01000000000000000000000000000000 -> offload: phy 19: macsec1: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c880001 on SA 0 1: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 1: PN 1, state on, key 01000000000000000000000000000000 -> offload: off The second patch allows an user to change the offloading mode at runtime through a new subcommand, `ip macsec offload`: # ip macsec offload macsec0 phy # ip macsec offload macsec0 off If a mode isn't supported, `ip macsec offload` will report an issue (-EOPNOTSUPP). Giving the offloading mode when a macsec interface is created was discussed; it is not implemented in this series. It could come later on, when needed, as we'll still want to support updating the offloading mode at runtime (what's implemented in this series). ==================== Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04macsec: add an accessor for validate_strAntoine Tenart1-2/+10
This patch adds an accessor for the validate_str array, to handle future changes adding a member. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04man: document the ip macsec offload commandAntoine Tenart1-0/+7
Add a description of the `ip macsec offload` command used to select the offloading mode on a macsec interface when the underlying device supports it. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04macsec: add support for changing the offloading modeAntoine Tenart1-0/+45
MacSEC can now be offloaded to specialized hardware devices. Offloading is off by default when creating a new MACsec interface, but the mode can be updated at runtime. This patch adds a new subcommand, `ip macsec offload`, to allow users to select the offloading mode of a MACsec interface. It takes the mode to switch to as an argument, which can for now either be 'off' or 'phy': # ip macsec offload macsec0 phy # ip macsec offload macsec0 off Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04macsec: report the offloading mode currently selectedAntoine Tenart1-0/+26
This patch adds support to report the MACsec offloading mode currently being enabled, which as of now can either be 'off' or 'phy'. This information is reported through the `ip macsec show` command: # ip macsec show 18: macsec0: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c860001 on SA 0 0: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 0: PN 1, state on, key 01000000000000000000000000000000 offload: phy 19: macsec1: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c880001 on SA 0 1: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 1: PN 1, state on, key 01000000000000000000000000000000 offload: off Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04devlink: Introduce devlink port flavour virtualParav Pandit1-0/+2
Currently PCI PF and VF devlink devices register their ports as physical port in non-representors mode. Introduce a new port flavour as virtual so that virtual devices can register 'virtual' flavour to make it more clear to users. An example of one PCI PF and 2 PCI virtual functions, each having one devlink port. $ devlink port show pci/0000:06:00.0/1: type eth netdev ens2f0 flavour physical port 0 pci/0000:06:00.2/1: type eth netdev ens2f2 flavour virtual port 0 pci/0000:06:00.3/1: type eth netdev ens2f3 flavour virtual port 0 Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04devlink: add trap metadata type for flow action cookieJiri Pirko1-0/+2
Flow action cookie has been recently added to kernel, print it out. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-03-04Update kernel headersDavid Ahern6-3/+72
Update kernel headers to commit ef71037047b0 ("Merge branch 'act_ct-software-offload-of-established-flows-fixes'") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-02-28Merge branch 'master' into nextDavid Ahern20-90/+604
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-02-28uapi: update bpf.hStephen Hemminger1-9/+7
Updated upstream Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-28man: rdma-statistic: Add filter descriptionAndrea Claudi2-4/+13
Add description for filters on rdma statistics show command. Also add a filter description on the help message of the command. Additionally, fix some whitespace issue in the man page. Reported-by: Zhaojuan Guo <zguo@redhat.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-28man: rdma.8: Add missing resource subcommand descriptionAndrea Claudi1-1/+5
Add resource subcommand in the OBJECT section and a short description for it. Reported-by: Zhaojuan Guo <zguo@redhat.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-28xfrm: not try to delete ipcomp states when using deleteallXin Long1-0/+3
In kernel space, ipcomp(sub) states used by main states are not allowed to be deleted by users, they would be freed only when all main states are destroyed and no one uses them. In user space, ip xfrm sta deleteall doesn't filter these ipcomp states out, and it causes errors: # ip xfrm state add src 192.168.0.1 dst 192.168.0.2 spi 0x1000 \ proto comp comp deflate mode tunnel sel src 192.168.0.1 dst \ 192.168.0.2 proto gre # ip xfrm sta deleteall Failed to send delete-all request : Operation not permitted This patch is to fix it by filtering ipcomp states with a check xsinfo->id.proto == IPPROTO_IPIP. Fixes: c7699875bee0 ("Import patch ipxfrm-20040707_2.diff") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-28man: ip.8: Add missing vrf subcommand descriptionAndrea Claudi1-1/+6
Add description to the vrf subcommand and a reference to the dedicated man page. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-28ip route: Do not imply pref and ttl-propagate are per nexthopDonald Sharp1-3/+8
Currently `ip -6 route show` gives us this output: sharpd@eva ~/i/ip (master)> ip -6 route show ::1 dev lo proto kernel metric 256 pref medium 4:5::6:7 nhid 18 proto static metric 20 nexthop via fe80::99 dev enp39s0 weight 1 nexthop via fe80::44 dev enp39s0 weight 1 pref medium Displaying `pref medium` as the last bit of output implies that the RTA_PREF is a per nexthop value, when it is infact a per route piece of data. Change the output to display RTA_PREF and RTA_TTL_PROPAGATE before the RTA_MULTIPATH data is shown: sharpd@eva ~/i/ip (master)> ./ip -6 route show ::1 dev lo proto kernel metric 256 pref medium 4:5::6:7 nhid 18 proto static metric 20 pref medium nexthop via fe80::99 dev enp39s0 weight 1 nexthop via fe80::44 dev enp39s0 weight 1 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-23nstat: print useful error messages in abort() casesAndrea Claudi1-14/+33
When nstat temporary file is corrupted or in some other corner cases, nstat use abort() to stop its execution. This can puzzle some users, wondering what is the reason for the crash. This commit replaces abort() with some meaningful error messages and exit() Reported-by: Renaud Métrich <rmetrich@redhat.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-23erspan: set erspan_ver to 1 by defaultXin Long2-2/+2
Commit 289763626721 ("erspan: add erspan version II support") breaks the command: # ip link add erspan1 type erspan key 1 seq erspan 123 \ local 10.1.0.2 remote 10.1.0.1 as erspan_ver is set to 0 by default, then IFLA_GRE_ERSPAN_INDEX won't be set in gre_parse_opt(). # ip -d link show erspan1 ... erspan remote 10.1.0.1 local 10.1.0.2 ... erspan_index 0 erspan_ver 1 ^^^^^^^^^^^^^^ This patch is to change to set erspan_ver to 1 by default. Fixes: 289763626721 ("erspan: add erspan version II support") Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-11uapi: update magic.hStephen Hemminger1-0/+1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-10devlink: Add health error recovery status monitoringMoshe Shemesh2-2/+16
Add support for devlink health error recovery status monitoring. Update devlink-monitor man page accordingly. Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-02-04tc: add support for FQ-PIE packet schedulerMohit P. Tahiliani5-2/+503
This patch adds support for the FQ-PIE packet Scheduler Principles: - Packets are classified on flows. - This is a Stochastic model (as we use a hash, several flows might be hashed to the same slot) - Each flow has a PIE managed queue. - Flows are linked onto two (Round Robin) lists, so that new flows have priority on old ones. - For a given flow, packets are not reordered. - Drops during enqueue only. - ECN capability is off by default. - ECN threshold (if ECN is enabled) is at 10% by default. - Uses timestamps to calculate queue delay by default. Usage: tc qdisc ... fq_pie [ limit PACKETS ] [ flows NUMBER ] [ target TIME ] [ tupdate TIME ] [ alpha NUMBER ] [ beta NUMBER ] [ quantum BYTES ] [ memory_limit BYTES ] [ ecn_prob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ] defaults: limit: 10240 packets, flows: 1024 target: 15 ms, tupdate: 15 ms (in jiffies) alpha: 1/8, beta : 5/4 quantum: device MTU, memory_limit: 32 Mb ecnprob: 10%, ecn: off bytemode: off, dq_rate_estimator: off Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in> Signed-off-by: Sachin D. Patil <sdp.sachin@gmail.com> Signed-off-by: V. Saicharan <vsaicharan1998@gmail.com> Signed-off-by: Mohit Bhasi <mohitbhasi1998@gmail.com> Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-04ss: fix tests to reflect compact outputPeter Junos1-12/+12
This fixes broken tests in commit c4f5862994589 ("ss: use compact output for undetected screen width") It also escapes stars as grep is used and more bugs could sneak under the radar with the previous solution. Signed-off-by: Peter Junos <petoju@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-02devlink: fix warning from unchecked writeStephen Hemminger1-2/+4
Warning seen on Ubuntu devlink.c: In function ‘cmd_dev_flash’: devlink.c:3071:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] 3071 | write(pipe_w, &err, sizeof(err)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 9b13cddfe268 ("devlink: implement flash status monitoring") Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29ip link: xstats: fix TX IGMP reports stringAndrea Claudi1-1/+1
This restore the string format we have before jsonification, adding a missing space between v2 and v3 on TX IGMP reports string. Fixes: a9bc23a79227a ("ip: bridge: add xstats json support") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29ip-xfrm: Fix help messagesAndrea Claudi2-39/+6
After commit 8589eb4efdf2a ("treewide: refactor help messages") help messages for xfrm state and policy are broken, printing many times the same protocol in UPSPEC section: $ ip xfrm state help [...] UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] | { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] | gre [ key { DOTTED-QUAD | NUMBER } ] | PROTO } This happens because strxf_proto function is non-reentrant and gets called multiple times in the same fprintf instruction. This commit fix the issue avoiding calls to strxf_proto() with a constant param, just hardcoding strings for protocol names. Fixes: 8589eb4efdf2a ("treewide: refactor help messages") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29Merge branch 'master' into nextDavid Ahern28-358/+498
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-29uapi: updates to tcp.h, snmp.h and if_bridge.hStephen Hemminger3-0/+5
Upstream changes Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29uapi/pkt_sched: upstream changes from fq_pieStephen Hemminger1-0/+31
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29uapi: update bpf.h and btf.hStephen Hemminger2-4/+74
Upstream headers from 5.6 pre rc1 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-29Merge branch 'master' of ↵Stephen Hemminger45-56/+873
git://git.kernel.org/pub/scm/network/iproute2/iproute2-next Resolved conflict in tc/f_flower.c
2020-01-27v5.5.0Stephen Hemminger1-1/+1
2020-01-27devlink: Replace pr_out_bool/uint() wrappers with common print functionsRon Diskin1-77/+73
Replace calls for pr_out_bool() and pr_out_uint() with direct calls to common json_print library function print_bool() and print_uint(). Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-27devlink: Replace pr_#type_value wrapper functions with common functionsRon Diskin1-32/+5
Replace calls for pr_bool/uint/uint64_value with direct calls for the matching common json_print library function: print_bool(), print_uint() and print_u64() Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-27devlink: Replace pr_out_str wrapper function with common functionRon Diskin1-126/+166
Replace calls for pr_out_str() and pr_out_str_value() with direct calls to common json_print library functions. Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-27devlink: Replace json prints by common library functionsRon Diskin1-86/+61
Substitute json prints to use json_print.c common library functions, instead of directly calling jsonw_functions. Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-27json_print: Add new json object function not as array itemRon Diskin2-4/+28
Currently new json object opens (and delete_json_obj closes) the object as an array, what adds prints for the matching bracket '[' ']' at the start/end of the object. This patch adds new_json_obj_plain() and the matching delete_json_obj_plain() to enable opening and closing json object, not as array and leave it to the using function to decide which type of object to open/close as the main object. Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-27json_print: Introduce print_#type_name_valueRon Diskin2-0/+20
Until now print_#type functions supported printing constant names and unknown (variable) values only. Add functions to allow printing when the name is also sent to the function as a variable. Signed-off-by: Ron Diskin <rondi@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-22tc: parse attributes with NLA_F_NESTED flagLeslie Monis3-6/+6
The kernel now requires all new nested attributes to set the NLA_F_NESTED flag. Enable tc {qdisc,class,filter} to parse attributes that have the NLA_F_NESTED flag set. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-22ip: xfrm: add espintcp encapsulationSabrina Dubroca3-7/+13
While at it, convert xfrm_xfrma_print and xfrm_encap_type_parse to use the UAPI macros for encap_type as suggested by David Ahern, and add the UAPI udp.h header (sync'd from ipsec-next to get the TCP_ENCAP_ESPINTCP definition). Co-developed-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-22Update kernel headers and import udp.hDavid Ahern3-0/+57
Update kernel headers to commit: 4f2c17e0f332 ("Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next") and import udp.h for the next patch. Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-21tc: flower: fix print with oneline optionRoi Dayan1-29/+53
This commit fix all location in flower to use _SL_ instead of \n for newline to allow support for oneline option. Example before this commit: filter protocol ip pref 2 flower chain 0 handle 0x1 indev ens1f0 dst_mac 11:22:33:44:55:66 eth_type ipv4 ip_proto tcp src_ip 2.2.2.2 src_port 99 dst_port 1-10\ tcp_flags 0x5/5 ip_flags frag ct_state -trk\ ct_zone 4\ ct_mark 255 ct_label 00000000000000000000000000000000 skip_hw not_in_hw\ action order 1: ct zone 5 pipe index 1 ref 1 bind 1 installed 287 sec used 287 sec Action statistics:\ Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0\ Example output after this commit: filter protocol ip pref 2 flower chain 0 handle 0x1 \ indev ens1f0\ dst_mac 11:22:33:44:55:66\ eth_type ipv4\ ip_proto tcp\ src_ip 2.2.2.2\ src_port 99\ dst_port 1-10\ tcp_flags 0x5/5\ ip_flags frag\ ct_state -trk\ ct_zone 4\ ct_mark 255\ ct_label 00000000000000000000000000000000\ skip_hw\ not_in_hw\action order 1: ct zone 5 pipe index 1 ref 1 bind 1 installed 346 sec used 346 sec Action statistics:\ Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0\ Signed-off-by: Roi Dayan <roid@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-20make yacc usage POSIX compatibleEthan Sommer7-19/+15
config: put YACC in config.mk and use environmental variable if present ss: use YACC variable instead of hardcoding bison place options before source file argument use -b to specify file prefix instead of output file, as -o isn't POSIX compatible, this generates ssfilter.tab.c instead of ssfilter.c replace any references to ssfilter.c with references to ssfilter.tab.c tc: use -p flag to set name prefix instead of bison-specific api.prefix directive remove unneeded bison-specific directives use -b instead of -o, replace references to previously generated emp_ematch.yacc.[ch] with references to newly generated emp_ematch.tab.[ch] Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-20build: fix build failure with -fno-commonJan Engelhardt5-4/+6
$ make CCOPTS=-fno-common gcc ... -o ip ld: rt_names.o (symbol from plugin): in function "rtnl_rtprot_n2a": (.text+0x0): multiple definition of "numeric"; ip.o (symbol from plugin):(.text+0x0): first defined here gcc ... -o tipc ld: ../lib/libutil.a(utils.o):(.bss+0xc): multiple definition of `pretty'; tipc.o:tipc.c:28: first defined here References: https://bugzilla.opensuse.org/1160244 Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-20ip: use print_nl() to handle one line modeStephen Hemminger1-1/+2
The helper function print_nl() does the right thing and prints the newline or backslash. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-20ip: fix link type and vlan oneline outputVladis Dronov1-1/+2
Move link type printing in print_linkinfo() so multiline output does not break link options line. Add oneline support for vlan's ingress and egress qos maps. Before the fix: 5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 vlan protocol 802.1Q id 4000 <REORDER_HDR> the option line is broken ^^^ ingress-qos-map { 1:2 } egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\ link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 \ vlan protocol 802.1Q id 4000 <REORDER_HDR> ingress-qos-map { 1:2 } <<< a multiline output despite -oneline egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 After the fix: 5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 vlan protocol 802.1Q id 4000 <REORDER_HDR> ingress-qos-map { 1:2 } egress-qos-map { 2:1 } 5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\ link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 \ vlan protocol 802.1Q id 4000 <REORDER_HDR> \ ingress-qos-map { 1:2 } \ egress-qos-map { 2:1 } Fixes: 5c302d518f10 ("vlan support") Link: https://bugzilla.kernel.org/show_bug.cgi?id=206241 Reported-by: George Shuklin <george.shuklin@gmail.com> Signed-off-by: Vladis Dronov <vdronov@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-18Merge branch 'tc-ets-qdisc' into nextDavid Ahern5-1/+544
Petr Machata says: ==================== A new Qdisc, "ETS", has been accepted into Linux at kernel commit 6bff00170277 ("Merge branch 'ETS-qdisc'"). Add iproute2 support for this Qdisc. Patch #1, changes libnetlink to admit NLA_F_NESTED in nested attributes. Patch #2 then adds ETS support as such. Examples (taken from the kernel patchset): - Add a Qdisc with 6 bands, 3 strict and 3 ETS with 45%-30%-25% weights: # tc qdisc add dev swp1 root handle 1: \ ets strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5 # tc qdisc sh dev swp1 qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5 - Tweak quantum of one of the classes of the previous Qdisc: # tc class ch dev swp1 classid 1:4 ets quantum 1000 # tc qdisc sh dev swp1 qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 1000 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5 # tc class ch dev swp1 classid 1:3 ets quantum 1000 Error: Strict bands do not have a configurable quantum. - Purely strict Qdisc with 1:1 mapping between priorities and TCs: # tc qdisc add dev swp1 root handle 1: \ ets strict 8 priomap 7 6 5 4 3 2 1 0 # tc qdisc sh dev swp1 qdisc ets 1: root refcnt 2 bands 8 strict 8 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7 - Use "bands" to specify number of bands explicitly. Underspecified bands are implicitly ETS and their quantum is taken from MTU. The following thus gives each band the same weight: # tc qdisc add dev swp1 root handle 1: \ ets bands 8 priomap 7 6 5 4 3 2 1 0 # tc qdisc sh dev swp1 qdisc ets 1: root refcnt 2 bands 8 quanta 1514 1514 1514 1514 1514 1514 1514 1514 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7 ==================== Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-18tc: Add support for ETS QdiscPetr Machata4-0/+542
Add a new module to generate and parse options specific to the ETS Qdisc. Example output: bands 8 strict 3 priomap 0 1 2 3 4 5 6 7 qdisc ets 1: root refcnt 2 offloaded bands 8 strict 3 quanta 1514 1514 1514 1514 1514 priomap 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 [ { "kind": "ets", "handle": "1:", "root": true, "refcnt": 2, "offloaded": true, "options": { "bands": 8, "strict": 3, "quanta": [1514, 1514, 1514, 1514, 1514], "priomap": [0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7] } } ] Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-18libnetlink: parse_rtattr_nested should allow NLA_F_NESTED flagPetr Machata1-1/+2
In kernel commit 8cb081746c03 ("netlink: make validation more configurable for future strictness"), Linux started implicitly flagging nests with NLA_F_NESTED, unless the nest is created with nla_nest_start_noflag(). The ETS code uses nla_nest_start() where possible, so it does not work with the current iproute2 code. Have libnetlink catch up by admitting the flag in the attribute. Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-18ip route: Print "rt_offload" and "rt_trap" indicationIdo Schimmel1-0/+4
The kernel now signals the offload state of a route using the 'RTM_F_OFFLOAD' and 'RTM_F_TRAP' flags. Print these to help users understand the offload state of each route. The "rt_" prefix is used in order to distinguish it from the offload state of nexthops. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-18Update kernel headersDavid Ahern6-2/+63
Update kernel headers to commit 9aaa29494030 ("Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue") Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-06tipc: fix clang warning in tipc/node.cTuong Lien1-2/+4
When building tipc with clang, the following warning is found: tipc CC bearer.o CC cmdl.o CC link.o CC media.o CC misc.o CC msg.o CC nametable.o CC node.o node.c:182:24: warning: field 'key' with variable sized type 'struct tipc_aead_key' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct tipc_aead_key key; This commit fixes it by putting the memory area allocated for the user input key along with the variable-sized 'key' structure in the 'union' form instead. Fixes: 24bee3bf9752 ("tipc: add new commands to set TIPC AEAD key") Reported-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-06tc: skbprio: add support for JSON outputStephen Hemminger1-1/+2
Print limit in JSON Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-06tc: prio: fix space in JSON tagStephen Hemminger1-1/+1
The priomap should not have extra space in the tag. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-02ss: use compact output for undetected screen widthPeter Junos1-4/+15
This change fixes calculation of width in case user pipes the output. SS output output works correctly when stdout is a terminal. When one pipes the output, it tries to use 80 or 160 columns. That adds a line-break if user has terminal width of 100 chars and output is of the similar width. No width is assumed here. To reproduce the issue, call ss | less and see every other line empty if your screen is between 80 and 160 columns wide. This second version of the patch fixes screen_width being set to arbitrary value. Signed-off-by: Peter Junos <petoju@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-02Merge branch 'master' into nextDavid Ahern21-305/+546
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-02iplink: bond: print lacp actor/partner oper states as stringsAndy Roulin1-4/+32
The 802.3ad/LACP actor/partner operating states are only printed as numbers, e.g, ad_actor_oper_port_state 15 Add an additional output in ip link show that prints a string describing the individual 3ad bit meanings in the following way: ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync> JSON output is also supported, the field becomes a json array: "ad_actor_oper_port_state_str": ["active","short_timeout","aggregating","in_sync"] Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2020-01-02Update kernel headersDavid Ahern5-9/+39
Update kernel headers to commit: fe23d63422c8 Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue Signed-off-by: David Ahern <dsahern@gmail.com>
2019-12-29tc: fq_codel: fix missing statistic in JSON outputLeslie Monis1-2/+2
Print JSON object even if tc_fq_codel_xstats->class_stats.drop_next is negative. Cc: Toke Høiland-Jørgensen <toke@toke.dk> Fixes: 997f2dc19378 ("tc: Add JSON output of fq_codel stats") Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: tbf: add support for JSON outputLeslie Monis1-21/+47
Enable proper JSON output for the TBF Qdisc. Also, fix the style of the statement that's calculating "latency" in tbf_print_opt(). Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: sfq: add support for JSON outputLeslie Monis1-24/+42
Enable proper JSON output for the SFQ Qdisc. Use the long double format specifier to print the value of "probability". Also, fix the indentation in the online output of the contents in the tc_sfqred_stats structure. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: sfb: add support for JSON outputLeslie Monis1-22/+45
Enable proper JSON output for the SFB Qdisc. Make the output for options "rehash" and "db" explicit. Use the long double format specifier to print probability values. Use sprint_time() to print time values. Also, fix the indentation in sfb_print_opt(). Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: pie: add support for JSON outputLeslie Monis2-25/+38
Enable proper JSON output for the PIE Qdisc. Use sprint_time() to print the value of tc_pie_xstats->delay. Use the long double format specifier to print tc_pie_xstats->prob. Also, fix the indentation in the oneline output of statistics and update the man page to reflect this change. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: hhf: add support for JSON outputLeslie Monis1-10/+23
Enable proper JSON output for the HHF Qdisc. Also, use sprint_size() to print size values. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: fq: add support for JSON outputLeslie Monis2-39/+83
Enable proper JSON output for the FQ Qdisc. Use the "KEY VALUE" format for oneline output of statistics instead of "VALUE KEY", and remove unnecessary commas from the output. Use sprint_size() to print size values in fq_print_opt(). Use sprint_time64() to print time values in fq_print_xstats(). Also, update the man page to reflect the changes in the output format. Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: codel: add support for JSON outputLeslie Monis1-13/+32
Enable proper JSON output for the CoDel Qdisc. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: choke: add support for JSON outputLeslie Monis1-8/+18
Enable proper JSON output for the choke Qdisc. Also, use the long double format specifier to print the value of "probability". Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29tc: cbs: add support for JSON outputLeslie Monis1-5/+5
Enable proper JSON output for the CBS Qdisc. Signed-off-by: Leslie Monis <lesliemonis@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-29utils: fix indentationStephen Hemminger1-1/+1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-25ip: xfrm if_id -ve value is errorAntony Antony1-1/+3
if_id is u32, error on -ve values instead of setting to 0 after : ip link add ipsec1 type xfrm dev lo if_id -10 Error: argument "-10" is wrong: if_id value is invalid before : note xfrm if_id 0 ip link add ipsec1 type xfrm dev lo if_id -10 ip -d link show dev ipsec1 9: ipsec1@lo: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/none 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500 xfrm if_id 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 Fixes: 286446c1e8c ("ip: support for xfrm interfaces") Signed-off-by: Antony Antony <antony@phenome.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-17iplink: add support for STP xstatsVivien Didelot1-0/+26
Add support for the BRIDGE_XSTATS_STP xstats, as follow: # ip link xstats type bridge_slave dev lan4 stp lan4 STP BPDU: RX: 0 TX: 61 STP TCN: RX: 0 TX: 0 STP Transitions: Blocked: 2 Forwarding: 1 Or below as JSON: # ip -j -p link xstats type bridge_slave dev lan0 stp [ { "ifname": "lan0", "stp": { "rx_bpdu": 0, "tx_bpdu": 500, "rx_tcn": 0, "tx_tcn": 0, "transition_blk": 0, "transition_fwd": 0 } } ] Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
2019-12-17ip link: show permanent hardware addressMichal Kubecek1-0/+18
Display permanent hardware address of an interface in output of "ip link show" and "ip addr show". To reduce noise, permanent address is only shown if it is different from current one. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David Ahern <dsahern@gmail.com>
2019-12-17Update kernel headersDavid Ahern3-0/+21
Update kernel headers to commit: 6f6dded1385c ("Merge branch 'WireGuard-CI-and-housekeeping'") Signed-off-by: David Ahern <dsahern@gmail.com>
2019-12-16devlink: Fix fmsg nesting in non JSON outputAya Levin1-18/+88
When an object or an array opening follows a name (label), add a new line and indentation before printing the label. When name (label) is followed by a value, print both at the same line. Prior to this patch nesting was not visible in a non JSON output: JSON: { "Common config": { "SQ": { "stride size": 64, "size": 1024 }, "CQ": { "stride size": 64, "size": 1024 } }, "SQs": [ { "channel ix": 0, "sqn": 10, "HW state": 1, "stopped": false, "cc": 0, "pc": 0, "CQ": { "cqn": 6, "HW status": 0 } },{ "channel ix": 0, "sqn": 14, "HW state": 1, "stopped": false, "cc": 0, "pc": 0, "CQ": { "cqn": 10, "HW status": 0 } } ] } Before this patch: Common Config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 With this patch: Common config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 Fixes: 7b8baf834d5e ("devlink: Add devlink health diagnose command") Signed-off-by: Aya Levin <ayal@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16devlink: Add a new time-stamp format for health reporter's dumpAya Levin1-1/+22
Introduce a new attribute representing a new time-stamp format: current time in ns (to comply with y2038) instead of jiffies. If the new attribute was received, translate the time-stamp accordingly (ns). Fixes: 2f1242efe9d0 ("devlink: Add devlink health show command") Signed-off-by: Aya Levin <ayal@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16devlink: Print health reporter's dump time-stamp in a helper functionAya Levin1-16/+10
Add pr_out_dump_reporter prefix to the helper function's name and encapsulate the print in it. Fixes: 2f1242efe9d0 ("devlink: Add devlink health show command") Signed-off-by: Aya Levin <ayal@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Fix tunnelshow json outputBenjamin Poirier2-19/+10
repeats for "vlan tunnelshow" what commit 0f36267485e3 ("bridge: fix vlan show formatting") did for "vlan show". This fixes problems in json output. Note that the resulting json output format of "vlan tunnelshow" is not the same as the original, introduced in commit 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info"). Changes similar to the ones done for "vlan show" in commit 0f36267485e3 ("bridge: fix vlan show formatting") are carried over to "vlan tunnelshow". Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library") Fixes: 0f36267485e3 ("bridge: fix vlan show formatting") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Deduplicate vlan show functionsBenjamin Poirier2-64/+34
print_vlan() and print_vlan_tunnel() are almost identical copies, save for a missing newline in the latter which leads to broken output of "vlan tunnelshow" in normal mode. Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Fix vni printingBenjamin Poirier4-5/+34
Since commit c7c1a1ef51ae ("bridge: colorize output and use JSON print library"), print_range() is used for vid (16bits) and vni. However, the latter are 32bits so they get truncated. They got truncated even before that commit though. Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Fix BRIDGE_VLAN_TUNNEL attribute sizesBenjamin Poirier1-4/+4
As per the kernel's vlan_tunnel_policy, IFLA_BRIDGE_VLAN_TUNNEL_VID and IFLA_BRIDGE_VLAN_TUNNEL_FLAGS have type NLA_U16. Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Fix src_vni argument in man pageBenjamin Poirier1-2/+2
"SRC VNI" is only one argument and should appear as such. Moreover, this argument to the src_vni option is documented under three forms: "SRC_VNI", "SRC VNI" and "VNI" in different places. Consistenly use the simplest form, "VNI". Fixes: c5b176e5ba1f ("bridge: fdb: add support for src_vni option") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2019-12-16bridge: Fix typo in error messagesBenjamin Poirier1-3/+3
Fixes: 9eff0e5cc447 ("bridge: Add vlan configuration support") Fixes: 7abf5de677e3 ("bridge: vlan: add support to display per-vlan statistics") Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>