summaryrefslogtreecommitdiff
path: root/tc
AgeCommit message (Collapse)Author
2020-05-31tc: report time an action was first usedRoman Mashak
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-27Merge branch 'master' into nextDavid Ahern
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-19tc: action: fix time values output in JSON formatRoman Mashak
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-18tc: mqprio: reject queues count/offset pair count higher than num_tcMaciej Fijalkowski
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-13iproute2-next:tc:action: add a gate control actionPo Liu
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-05tc: fq: fix two issuesEric Dumazet
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-05Merge branch 'master' into nextDavid Ahern
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-05tc: full JSON support for 'bpf' filterDavide Caratti
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-04Replace open-coded instances of print_nl()Benjamin Poirier
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 Long
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 Long
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 Long
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 Long
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-04-30tc: pedit: Support JSON dumpingPetr Machata
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-27tc: fq: add timer_slack parameterEric Dumazet
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 Dumazet
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-27tc: m_action: check cookie hex string lenJiri Pirko
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-20tc: fq_codel: fix class stat deficit is signed intBenjamin Lee
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 Ugedal
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 Ugedal
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 Ugedal
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-09Merge branch 'master' into nextDavid Ahern
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-04-09tc: p_ip6: Support pedit of IPv6 dsfieldPetr Machata
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-06Merge ../iproute2-nextStephen Hemminger
2020-03-31tc: show used HW stats typesJiri Pirko
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-25tc: q_red: Support 'nodrop' flagPetr Machata
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 Kicinski
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-20tc: m_action: introduce support for hw stats typeJiri Pirko
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-15iproute2: fix MPLS label parsingGuillaume Nault
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-10Revert "tc: pie: change maximum integer value of tc_pie_xstats->prob"Leslie Monis
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 Monis
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-02-04tc: add support for FQ-PIE packet schedulerMohit P. Tahiliani
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-01-29Merge branch 'master' of ↵Stephen Hemminger
git://git.kernel.org/pub/scm/network/iproute2/iproute2-next Resolved conflict in tc/f_flower.c
2020-01-22tc: parse attributes with NLA_F_NESTED flagLeslie Monis
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-21tc: flower: fix print with oneline optionRoi Dayan
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 Sommer
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 Engelhardt
$ 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-18tc: Add support for ETS QdiscPetr Machata
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-06tc: skbprio: add support for JSON outputStephen Hemminger
Print limit in JSON Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-06tc: prio: fix space in JSON tagStephen Hemminger
The priomap should not have extra space in the tag. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-01-02Merge branch 'master' into nextDavid Ahern
Signed-off-by: David Ahern <dsahern@gmail.com>
2019-12-29tc: fq_codel: fix missing statistic in JSON outputLeslie Monis
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 Monis
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 Monis
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 Monis
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 Monis
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 Monis
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 Monis
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 Monis
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 Monis
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>