]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
5 years agoss: add option to print socket information on one line
Josh Hunt [Wed, 1 May 2019 01:38:38 +0000 (21:38 -0400)]
ss: add option to print socket information on one line

Multi-line output in ss makes it difficult to search for things with
grep. This new option will make it easier to find sockets matching
certain criteria with simple grep commands.

Example without option:
$ ss -emoitn
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port
ESTAB      0      0      127.0.0.1:13265              127.0.0.1:36743               uid:1974 ino:48271 sk:1 <->
 skmem:(r0,rb2227595,t0,tb2626560,f0,w0,o0,bl0,d0) ts sack reno wscale:7,7 rto:211 rtt:10.245/16.616 ato:40 mss:65483 cwnd:10 bytes_acked:41865496 bytes_received:21580440 segs_out:242496 segs_in:351446 data_segs_out:242495 data_segs_in:242495 send 511.3Mbps lastsnd:2383 lastrcv:2383 lastack:2342 pacing_rate 1022.6Mbps rcv_rtt:92427.6 rcv_space:43725 minrtt:0.007

Example with new option:
$ ss -emoitnO
State    Recv-Q Send-Q          Local Address:Port            Peer Address:Port
ESTAB    0      0                   127.0.0.1:13265              127.0.0.1:36743 uid:1974 ino:48271 sk:1 <-> skmem:(r0,rb2227595,t0,tb2626560,f0,w0,o0,bl0,d0) ts sack reno wscale:7,7 rto:211 rtt:10.067/16.429 ato:40 mss:65483 pmtu:65535 rcvmss:536 advmss:65483 cwnd:10 bytes_sent:41868244 bytes_acked:41868244 bytes_received:21581866 segs_out:242512 segs_in:351469 data_segs_out:242511 data_segs_in:242511 send 520.4Mbps lastsnd:14355 lastrcv:14355 lastack:14314 pacing_rate 1040.7Mbps delivery_rate 74837.7Mbps delivered:242512 app_limited busy:1861946ms rcv_rtt:92427.6 rcv_space:43725 rcv_ssthresh:43690 minrtt:0.007

Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Increase column size for larger shared buffers
Ido Schimmel [Tue, 30 Apr 2019 08:42:08 +0000 (11:42 +0300)]
devlink: Increase column size for larger shared buffers

With current number of spaces the output is mangled if the shared buffer
is congested.

Before:

# devlink sb occupancy show swp25
swp25:
  pool: 0:    33384960/39344256 1:          0/0       2:          0/0       3:          0/0
        4:          0/720     5:          0/0       6:          0/0       7:          0/0
        8:          0/288     9:          0/0      10:          0/0
  itc:  0(0): 33272064/39344256 1(0):       0/0       2(0):       0/0       3(0):       0/0
        4(0):       0/0       5(0):       0/0       6(0):       0/0       7(0):       0/0
  etc:  0(4):       0/720     1(4):       0/0       2(4):       0/0       3(4):       0/0
        4(4):       0/0       5(4):       0/0       6(4):       0/0       7(4):       0/0
        8(8):       0/288     9(8):       0/0      10(8):       0/0      11(8):       0/0
       12(8):       0/0      13(8):       0/0      14(8):       0/0      15(8):       0/0

After:

# devlink sb occupancy show swp25
swp25:
  pool: 0:      39070080/39344256   1:             0/0          2:             0/0          3:             0/0
        4:             0/720        5:             0/0          6:             0/0          7:             0/0
        8:             0/288        9:             0/0         10:             0/0
  itc:  0(0):   39062016/39344256   1(0):          0/0          2(0):          0/0          3(0):          0/0
        4(0):          0/0          5(0):          0/0          6(0):          0/0          7(0):          0/0
  etc:  0(4):          0/720        1(4):          0/0          2(4):          0/0          3(4):          0/0
        4(4):          0/0          5(4):          0/0          6(4):          0/0          7(4):          0/0
        8(8):          0/288        9(8):          0/0         10(8):          0/0         11(8):          0/0
       12(8):          0/0         13(8):          0/0         14(8):          0/0         15(8):          0/0

v2:
* Increase number of spaces to make the change more future-proof

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate tc-bpf.8 man page examples
Lucas Siba 2019-04-20 11:40 UTC [Sat, 20 Apr 2019 19:06:18 +0000 (12:06 -0700)]
Update tc-bpf.8 man page examples

This patch updates the tc-bpf.8 example application for changes to the
struct bpf_elf_map definition. In it's current form, things compile, but
the resulting object file is rejected by the verifier when attempting to
load it through tc.

Signed-off-by: Lucas Siba <lucas.siba@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
[ dropped the unnecessary flags initialization on commit ]

5 years agoMerge branch 'iproute2-master' into next
David Ahern [Fri, 26 Apr 2019 18:13:54 +0000 (11:13 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink_vlan: add support for VLAN bridge binding flag
Mike Manning [Sat, 20 Apr 2019 10:45:37 +0000 (11:45 +0100)]
iplink_vlan: add support for VLAN bridge binding flag

This patch adds support for the VLAN bridge binding flag that is
provided in net-next kernel by the series merged by 1ab839281cf7
("net-support-binding-vlan-dev-link-state-to-vlan-member-bridge-ports")

Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Fri, 26 Apr 2019 18:02:36 +0000 (11:02 -0700)]
Update kernel headers

Update kernel headers to commit
    148f025d41a8 ("Merge branch 'hns3-next'")

Note, these warnings:
../include/uapi/linux/sockios.h:42:0: warning: "SIOCGSTAMP" redefined
../include/uapi/linux/sockios.h:43:0: warning: "SIOCGSTAMPNS" redefined

are due to kernel commit
    0768e17073dc5 ("net: socket: implement 64-bit timestamps")

which moved the definitions from include/asm-generic/sockios.h
to include/uapi/linux/sockios.h

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc/ematch: fix deprecated yacc warning
Stephen Hemminger [Wed, 24 Apr 2019 22:08:31 +0000 (15:08 -0700)]
tc/ematch: fix deprecated yacc warning

Newer versions of Bison deprecated some directives.

    YACC     emp_ematch.yacc.c
emp_ematch.y:11.1-14: warning: deprecated directive, use ‘%define parse.error verbose’ [-Wdeprecated]
 %error-verbose
 ^~~~~~~~~~~~~~
emp_ematch.y:12.1-22: warning: deprecated directive, use ‘%define api.prefix {ematch_}’ [-Wdeprecated]
 %name-prefix "ematch_"

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: always print realms keyword for rule
Thomas Haller [Tue, 23 Apr 2019 07:16:15 +0000 (09:16 +0200)]
iprule: always print realms keyword for rule

# rule add priority 10 realms 1/0xF
    # rule add priority 10 realms 0/0xF
    # ip rule
    10:     from all lookup main 15
    10:     from all lookup main realms 1/15

The previous behavior was there since the beginning.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: refactor print_rule() to use leading space before printing attribute
Thomas Haller [Tue, 23 Apr 2019 07:16:14 +0000 (09:16 +0200)]
iprule: refactor print_rule() to use leading space before printing attribute

When printing the actions, we avoid adding the trailing space after the
attribute. Possibly because we expect the action to be the last output
on the line and not end with a space.

But for FR_ACT_TO_TBL nothing is printed. That means, we add double
spaces if a protocol is printed as well:

    # ip rule add priority 10 protocol 10 type 1

will be printed as

    10:     from all lookup 1  proto mrt

The only visible effect of the patch is to avoid the double-space and
avoid a trailing space if the action is FR_ACT_TO_TBL.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: avoid trailing space in print_rule() after printing protocol
Thomas Haller [Tue, 23 Apr 2019 07:16:13 +0000 (09:16 +0200)]
iprule: avoid trailing space in print_rule() after printing protocol

It seems print_rule() tries to avoid a trailing space at the end
of the line. At least, when printing details about the actions,
they no longer append the space. Probably expecting to be the
last attribute that will be printed.

Don't let the protocol add the trailing space. The space at the end
of the line should be printed consistently (or not).

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: avoid printing extra space after gateway for nat action
Thomas Haller [Tue, 23 Apr 2019 07:16:12 +0000 (09:16 +0200)]
iprule: avoid printing extra space after gateway for nat action

For all other actions we avoid the trailing space, so do it here
as well.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip fou: Support binding FOU ports
Kristian Evensen [Mon, 22 Apr 2019 15:27:41 +0000 (17:27 +0200)]
ip fou: Support binding FOU ports

This patch adds support for binding FOU ports using iproute2.
Kernel-support was added in 1713cb37bf67 ("fou: Support binding FoU
socket").

The parse function now handles new arguments for setting the
binding-related attributes, while the print function writes the new
attributes if they are set. Also, the man page has been updated.

v2->v3:
* Remove redundant ll_init_map()-calls (thanks David Ahern).

v1->v2 (all changes suggested by David Ahern):
* Fix reverse Christmas tree ordering.
* Remove redundant peer_port_set-variable, it is enough to check
peer_port.
* Add proper error handling of invalid local/peer addresses.
* Use interface name and not index.
* Remove updating fou-header file, it is already done.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink: bridge: add support for vlan_stats_per_port
Nikolay Aleksandrov [Tue, 16 Apr 2019 13:19:10 +0000 (16:19 +0300)]
iplink: bridge: add support for vlan_stats_per_port

Add support for manipulating and showing the vlan_stats_per_port bridge
option which can be toggled only when there are no port VLANs
configured. Also update the man page with the new option.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoipneigh: Print neighbour offload indication
Ido Schimmel [Thu, 18 Apr 2019 06:44:05 +0000 (06:44 +0000)]
ipneigh: Print neighbour offload indication

Print the offload indication in case it is set on the neighbour.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobridge: vlan: fix standard stats output
Nikolay Aleksandrov [Tue, 16 Apr 2019 15:30:12 +0000 (18:30 +0300)]
bridge: vlan: fix standard stats output

Each of the commits below broke the vlan stats output in a different
way:
45fca4ed9412 ("bridge: fix vlan show stats formatting")
 Added a second print of an interface name (e.g. eth4eth4)
c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
 Broke normal vlan stats output by not printing a new line after them
 Also printed interfaces without any vlans when printing stats

This fix is not pretty but it brings back the previous behaviour.

Before this fix:
$ bridge -s vlan show
port             vlan id
br0br0              1 PVID Egress Untagged
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets 4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packetseth4eth4             4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packetsroot@debian:~/

After this fix:
$ bridge -s vlan show
port             vlan id
br0              1 PVID Egress Untagged
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets
                 4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets
eth4             4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets

Fixes: 45fca4ed9412 ("bridge: fix vlan show stats formatting")
Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: mdb: restore valid json output
Nikolay Aleksandrov [Fri, 12 Apr 2019 15:30:55 +0000 (18:30 +0300)]
bridge: mdb: restore valid json output

Since the commit below mdb's json output has been invalid and also with
changed format. Restore it to a valid json like the previous format.
Also takes care of a double "Deleted" print when monitoring for changes.

Example bridge -p -d -j mdb show:
 [ {
        "mdb": [ {
                "index": 4,
                "dev": "virbr0",
                "port": "vnet2",
                "grp": "ff02::202",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 4,
                "dev": "virbr0",
                "port": "vnet2",
                "grp": "ff02::1:fffb:1939",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 6,
                "dev": "virbr1",
                "port": "vnet7",
                "grp": "ff02::202",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 6,
                "dev": "virbr1",
                "port": "vnet7",
                "grp": "ff02::1:ffd0:f61f",
                "state": "temp",
                "flags": [ ]
            } ],
        "router": {
            "virbr0": [ {
                    "port": "vnet1"
                },{
                    "port": "vnet0"
                } ],
            "virbr1": [ {
                    "port": "vnet5"
                } ]
        }
    } ]

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: add missing space after 'external' in detailed mode
Beniamino Galvani [Tue, 16 Apr 2019 14:04:39 +0000 (16:04 +0200)]
ip: add missing space after 'external' in detailed mode

Add a missing space after the 'external' keyword in the detailed mode
of tunnel links output:

 # ip -d link
 79: geneve1: <BROADCAST,MULTICAST> mtu 65465 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether da:e9:e4:2b:f9:d4 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65465
     geneve externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 80: vxlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether 7a:a8:19:07:da:01 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65535
     vxlan externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 84: gre1@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/none 00:00:00:00 brd 00:00:00:00 promiscuity 0 minmtu 0 maxmtu 0
     gre externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 87: ip6gre1@NONE: <NOARP> mtu 1448 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/gre6 :: brd :: promiscuity 0 minmtu 0 maxmtu 0
     ip6gre externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 88: ip6tnl1@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/tunnel6 :: brd :: promiscuity 0 minmtu 68 maxmtu 65407
     ip6tnl externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 90: ipip1@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ipip 0.0.0.0 brd 0.0.0.0 promiscuity 0 minmtu 0 maxmtu 0
     ipip externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Fixes: 00ff4b8e31af ("ip/tunnel: Be consistent when printing tunnel collect metadata")
Reviewed-and-tested-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUpdate kernel headers
David Ahern [Wed, 17 Apr 2019 21:07:48 +0000 (14:07 -0700)]
Update kernel headers

Update kernel headers to commit
    6b0a7f84ea1f ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Wed, 17 Apr 2019 20:59:44 +0000 (13:59 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies
Eyal Birger [Thu, 4 Apr 2019 16:07:38 +0000 (19:07 +0300)]
ip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies

The XFRMA_IF_ID attribute is set in policies/states for them to be
associated with an XFRM interface (4.19+).

Add support for setting / displaying this attribute.

Note that 0 is a valid value therefore set XFRMA_IF_ID if any value
was provided in command line.

Tested-by: Antony Antony <antony@phenome.org>
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: display netrom link type
Ralf Baechle [Thu, 4 Apr 2019 10:21:54 +0000 (12:21 +0200)]
ip: display netrom link type

For a NETROM "ip link show dev nr0" will show

4: nr0: <NOARP,UP,LOWER_UP> mtu 236 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/generic 88:98:6a:a4:84:40:0a brd 00:00:00:00:00:00:00

But rather link/netrom is expected to be displayed.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: support for xfrm interfaces
Matt Ellison [Thu, 4 Apr 2019 14:08:45 +0000 (10:08 -0400)]
ip: support for xfrm interfaces

Interfaces take a 'if_id' which is an interface id which can be set on
an xfrm policy as its interface lookup key (XFRMA_IF_ID).

Signed-off-by: Matt Ellison <matt@arroyo.io>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoq_cake: Add support for setting the fwmark option
Toke Høiland-Jørgensen [Thu, 4 Apr 2019 13:09:10 +0000 (15:09 +0200)]
q_cake: Add support for setting the fwmark option

This adds support for the newly added fwmark option to CAKE, which allows
overriding the tin selection from the per-packet firewall marks. The fwmark
field is a bitmask that is applied to the fwmark to select the tin.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update bpf.h
Stephen Hemminger [Fri, 5 Apr 2019 22:00:48 +0000 (15:00 -0700)]
uapi: update bpf.h

Updated bpf.h from 5.1-rc

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'rdma-dynamic-link-create' into next
David Ahern [Wed, 3 Apr 2019 19:05:17 +0000 (12:05 -0700)]
Merge branch 'rdma-dynamic-link-create' into next

Steve Wise  says:

====================

This series adds rdmatool support for creating/deleting rdma links.
This will be used, mainly, by soft rdma drivers to allow adding/deleting
rdma links over netdev interfaces.  It provides the user side for
the following kernel changes merged in linux-5.1.

Changes since v2:

- move checks for required parameters in the parameter handlers
- move final 'link add' processing to link_add_netdev()
- added reviewed-by tags

Changes since v1:

- move error receive checking from rd_sendrecv_msg() to rd_recv_msg().
- Add rd->suppress_errors to allow control over whether errors when
  reading a response should be ignored.  Namely: resource queries can
  get errors like "none found" when querying for resources, and this
  error should not be displayed.  So on a rd object basis, error
  suppression can be controlled.
- Rebased on rdma/for-next UABI (no need to sync rdma_netlink.h now)
- use chains of struct rd_cmd and rd_exec_cmd vs open coding the parsing
  for the 'link add' command.
- minor nit resolution
- added .mailmap file.  If this is not desired for iproute2, then please
  drop the patch.

Changes since RFC:

- add rd_sendrecv_msg() and make use of it in dev_set as well
  as the new link commands.
- fixed problems with the man pages
- changed the command line to use "netdev" as the keyword
  for the network device, do avoid confused with the ib_device
  name.
- got rid of the "type" parameter for link delete.  Also pass
  down the device index instead of the name, using the common
  rd services for validating the device name and fetching the
  index.

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: man page update for link add/delete
Steve Wise [Wed, 3 Apr 2019 17:10:32 +0000 (12:10 -0500)]
rdma: man page update for link add/delete

Update the 'rdma link' man page with 'link add/delete' info.

Signed-off-by: Steve Wise <larrystevenwise@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: add 'link add/delete' commands
Steve Wise [Wed, 3 Apr 2019 17:10:31 +0000 (12:10 -0500)]
rdma: add 'link add/delete' commands

Add new 'link' subcommand 'add' and 'delete' to allow binding a soft-rdma
device to a netdev interface.

EG:

rdma link add rxe_eth0 type rxe netdev eth0
rdma link delete rxe_eth0

Signed-off-by: Steve Wise <larrystevenwise@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: add helper rd_sendrecv_msg()
Steve Wise [Wed, 3 Apr 2019 17:10:30 +0000 (12:10 -0500)]
rdma: add helper rd_sendrecv_msg()

This function sends the constructed netlink message and then
receives the response.

Change rd_recv_msg() to display any error messages.

Change 'rdma dev set' to use rd_sendrecv_msg().

Signed-off-by: Steve Wise <larrystevenwise@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoAdd .mailmap file
Steve Wise [Wed, 3 Apr 2019 17:10:29 +0000 (12:10 -0500)]
Add .mailmap file

.mailmap allows tracking multiple email addresses to the proper user name.

Signed-off-by: Steve Wise <larrystevenwise@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: pie: update man page
Leslie Monis [Wed, 27 Mar 2019 15:36:06 +0000 (21:06 +0530)]
tc: pie: update man page

Update man page to reflect the changes made in Linux.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: pie: change maximum integer value of tc_pie_xstats->prob
Leslie Monis [Wed, 27 Mar 2019 15:36:05 +0000 (21:06 +0530)]
tc: pie: change maximum integer value of tc_pie_xstats->prob

tc_pie_xstats->prob has a maximum value of (2^64 - 1).

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: fix typo in iplink_vlan usage message
Stephen Hemminger [Wed, 27 Mar 2019 14:56:07 +0000 (07:56 -0700)]
ip: fix typo in iplink_vlan usage message

Need to use bar "|" rather than slash to indicate alternatives.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotipc: add link broadcast man page
Hoang Le [Fri, 22 Mar 2019 08:47:35 +0000 (15:47 +0700)]
tipc: add link broadcast man page

Add a man page describing tipc link broadcast command get and set

Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotipc: add link broadcast get
Hoang Le [Fri, 22 Mar 2019 08:47:34 +0000 (15:47 +0700)]
tipc: add link broadcast get

The command prints the actually method that multicast
is running in the system.
Also 'ratio' value for AUTOSELECT method.

A sample usage is shown below:
$tipc link get broadcast
BROADCAST

$tipc link get broadcast
AUTOSELECT ratio:30%

$tipc link get broadcast -j -p
[ {
        "method": "AUTOSELECT"
    },{
        "ratio": 30
    } ]

Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotipc: add link broadcast set method and ratio
Hoang Le [Fri, 22 Mar 2019 08:47:33 +0000 (15:47 +0700)]
tipc: add link broadcast set method and ratio

The command added here makes it possible to forcibly configure the
broadcast link to use either broadcast or replicast, in addition to
the already existing auto selection algorithm.

A sample usage is shown below:
$tipc link set broadcast BROADCAST
$tipc link set broadcast AUTOSELECT ratio 25

$tipc link set broadcast -h
Usage: tipc link set broadcast PROPERTY

PROPERTIES
 BROADCAST         - Forces all multicast traffic to be
                     transmitted via broadcast only,
                     irrespective of cluster size and number
                     of destinations

 REPLICAST         - Forces all multicast traffic to be
                     transmitted via replicast only,
                     irrespective of cluster size and number
                     of destinations

 AUTOSELECT        - Auto switching to broadcast or replicast
                     depending on cluster size and destination
                     node number

 ratio SIZE        - Set the AUTOSELECT criteria, percentage of
                     destination nodes vs cluster size

Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Tue, 26 Mar 2019 23:08:05 +0000 (16:08 -0700)]
Update kernel headers

Update kernel headers to
    fa7e428c6b7e ("openvswitch: add seqadj extension when NAT is used.")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoman: break long lines in man page sources
Stephen Hemminger [Fri, 22 Mar 2019 16:46:40 +0000 (09:46 -0700)]
man: break long lines in man page sources

No impact for output, just easier to edit.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: bridge: add mcast to unicast config flag
Tobias Jungel [Thu, 21 Mar 2019 08:32:39 +0000 (09:32 +0100)]
ip: bridge: add mcast to unicast config flag

This adds configuration for the IFLA_BRPORT_MCAST_TO_UCAST flag that
allows multicast packets to be replicated as unicast packets.

Signed-off-by: Tobias Jungel <tobias.jungel@bisdn.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Wed, 20 Mar 2019 07:38:08 +0000 (00:38 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: bpf add set_ce
Stephen Hemminger [Tue, 19 Mar 2019 17:37:55 +0000 (10:37 -0700)]
uapi: bpf add set_ce

New api from upstream.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: in6.h add router alert isolate
Stephen Hemminger [Tue, 19 Mar 2019 17:37:28 +0000 (10:37 -0700)]
uapi: in6.h add router alert isolate

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: add CAKE FWMARK
Stephen Hemminger [Tue, 19 Mar 2019 17:36:56 +0000 (10:36 -0700)]
uapi: add CAKE FWMARK

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: update uapi headers from 5.1-rc1
Stephen Hemminger [Tue, 19 Mar 2019 17:34:32 +0000 (10:34 -0700)]
rdma: update uapi headers from 5.1-rc1

Update from upstream.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'master' of ../iproute2-next
Stephen Hemminger [Tue, 19 Mar 2019 17:32:45 +0000 (10:32 -0700)]
Merge branch 'master' of ../iproute2-next

5 years agov5.0.0 v5.0.0
Stephen Hemminger [Tue, 19 Mar 2019 17:06:19 +0000 (10:06 -0700)]
v5.0.0

5 years agoip route: get: print JSON output when -j is given
Matteo Croce [Mon, 18 Mar 2019 17:19:30 +0000 (18:19 +0100)]
ip route: get: print JSON output when -j is given

The ip -j option to print output as JSON is ignored when using 'route get':

    $ ip -j route get 127.0.0.1
    local 127.0.0.1 dev lo src 127.0.0.1 uid 1000
        cache <local>

Enable JSON output in iproute_get(), and don't let print_cache_flags() close
the JSON output, as it's not always the last called JSON function.

Tested on different route types:

    $ ip -j -p route get 127.0.0.1
    [ {
            "type": "local",
            "dst": "127.0.0.1",
            "dev": "lo",
            "prefsrc": "127.0.0.1",
            "flags": [ ],
            "uid": 1000,
            "cache": [ "local" ]
        } ]

    $ ip -d -j -p route get 192.0.2.1
    [ {
            "type": "unicast",
            "dst": "192.0.2.1",
            "gateway": "192.168.85.1",
            "dev": "wlp3s0",
            "table": "main",
            "prefsrc": "192.168.85.2",
            "flags": [ ],
            "uid": 1000,
            "cache": [ ]
        } ]

Fixes: 663c3cb23103 ("iproute: implement JSON and color output")
Acked-by: Phil Sutter <phil@nwl.cc>
Reviewed-and-tested-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip route: print route type in JSON output
Matteo Croce [Mon, 18 Mar 2019 17:19:29 +0000 (18:19 +0100)]
ip route: print route type in JSON output

ip route generates an invalid JSON if the route type has to be printed,
eg. when detailed mode is active, or the type is different that unicast:

    $ ip -d -j -p route show
    [ {"unicast",
            "dst": "192.168.122.0/24",
            "dev": "virbr0",
            "protocol": "kernel",
            "scope": "link",
            "prefsrc": "192.168.122.1",
            "flags": [ "linkdown" ]
        } ]

    $ ip -j -p route show
    [ {"unreachable",
            "dst": "192.168.23.0/24",
            "flags": [ ]
        },{"prohibit",
            "dst": "192.168.24.0/24",
            "flags": [ ]
        },{"blackhole",
            "dst": "192.168.25.0/24",
            "flags": [ ]
        } ]

Fix it by printing the route type as the "type" attribute:

    $ ip -d -j -p route show
    [ {
            "type": "unicast",
            "dst": "default",
            "gateway": "192.168.85.1",
            "dev": "wlp3s0",
            "protocol": "dhcp",
            "scope": "global",
            "metric": 600,
            "flags": [ ]
        },{
            "type": "unreachable",
            "dst": "192.168.23.0/24",
            "protocol": "boot",
            "scope": "global",
            "flags": [ ]
        },{
            "type": "prohibit",
            "dst": "192.168.24.0/24",
            "protocol": "boot",
            "scope": "global",
            "flags": [ ]
        },{
            "type": "blackhole",
            "dst": "192.168.25.0/24",
            "protocol": "boot",
            "scope": "global",
            "flags": [ ]
        } ]

Fixes: 663c3cb23103 ("iproute: implement JSON and color output")
Acked-by: Phil Sutter <phil@nwl.cc>
Reviewed-and-tested-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: m_connmark: fix action error messages
Kevin 'ldir' Darbyshire-Bryant [Fri, 15 Mar 2019 10:50:45 +0000 (10:50 +0000)]
tc: m_connmark: fix action error messages

action m_connmark returns error messages identifying itself as the
'simple' action instead of 'connmark' action. e.g.

tc filter add dev eth0 protocol all u32 match u32 0 0 flowid 1:1 \
action connmark index wrong
simple: Illegal "index"
bad action parsing
parse_action: bad value (3:connmark)!
Illegal "action"

In what is most likely a copy/paste error from the simple action example
code, fix connmark error messages to identify themselves as coming from
connmark.

tc filter add dev eth0 protocol all u32 match u32 0 0 flowid 1:1 \
action connmark index wrong
connmark: Illegal "index"
bad action parsing
parse_action: bad value (3:connmark)!
Illegal "action"

While we're here also fixup the 'Illegal "Zone"' error code to say
'Illegal "zone"' instead of 'Illegal "index"'

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'bond-bridge-xstats-json' into next
David Ahern [Fri, 15 Mar 2019 21:01:35 +0000 (14:01 -0700)]
Merge branch 'bond-bridge-xstats-json' into next

Nikolay Aleksandrov  says:

====================

This set adds json output support to the xstats API (patch 01) and then
adds json support to the bridge xstats output (patch 02) and adds xstats
output support (both plain text and json) for the bonding (patch 03).
It doesn't change the bridge's plain text output, but it fixes an
inconsistency that could happen if new bridge xstats attributes were
added (print the interface name once for each group of xstats attrs).

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip: bond: add xstats support
Nikolay Aleksandrov [Tue, 12 Mar 2019 16:41:28 +0000 (18:41 +0200)]
ip: bond: add xstats support

Add bond and bond_slave xstats support with optional json output.
Example:
- Plain text:
$ ip link xstats type bond 802.3ad
 bond0
                    LACPDU Rx 2017
                    LACPDU Tx 2038
                    LACPDU Unknown type Rx 0
                    LACPDU Illegal Rx 0
                    Marker Rx 0
                    Marker Tx 0
                    Marker response Rx 0
                    Marker response Tx 0
                    Marker unknown type Rx 0

- JSON:
$ ip -j -p link xstats type bond 802.3ad
  [ {
        "ifname": "bond0",
        "802.3ad": {
            "lacpdu_rx": 219,
            "lacpdu_tx": 241,
            "lacpdu_unknown_rx": 0,
            "lacpdu_illegal_rx": 0,
            "marker_rx": 0,
            "marker_tx": 0,
            "marker_response_rx": 0,
            "marker_response_tx": 0,
            "marker_unknown_rx": 0
        }
    } ]

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip: bridge: add xstats json support
Nikolay Aleksandrov [Tue, 12 Mar 2019 16:41:27 +0000 (18:41 +0200)]
ip: bridge: add xstats json support

Add json support for bridge's xstats output.
The plain text output format should remain the same.
Note that this patch pulls the interface out of the attribute
loop, this was an oversight when the set was upstreamed. This does not
change the output format, but fixes it when new xstats attributes show
up.

Example:
$ ip -p -j link xstats type bridge
  [ {
        "ifname": "br0",
        "multicast": {
            "igmp_queries": {
                "rx_v1": 0,
                "rx_v2": 32,
                "rx_v3": 0,
                "tx_v1": 0,
                "tx_v2": 0,
                "tx_v3": 0
            },
            "igmp_reports": {
                "rx_v1": 0,
                "rx_v2": 32,
                "rx_v3": 0,
                "tx_v1": 0,
                "tx_v2": 0,
                "tx_v3": 0
            },
            "igmp_leaves": {
                "rx": 0,
                "tx": 0
            },
            "igmp_parse_errors": 0,
            "mld_queries": {
                "rx_v1": 33,
                "rx_v2": 0,
                "tx_v1": 0,
                "tx_v2": 0
            },
            "mld_reports": {
                "rx_v1": 66,
                "rx_v2": 2,
                "tx_v1": 0,
                "tx_v2": 0
            },
            "mld_leaves": {
                "rx": 0,
                "tx": 0
            },
            "mld_parse_errors": 0
        }
    } ]

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip: xstats: add json output support
Nikolay Aleksandrov [Tue, 12 Mar 2019 16:41:26 +0000 (18:41 +0200)]
ip: xstats: add json output support

This adds only initial object support if json argument is specified.
Later patches convert the current xstats users to json.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoipaddress: print error message on stderr
Stephen Hemminger [Fri, 15 Mar 2019 15:30:26 +0000 (08:30 -0700)]
ipaddress: print error message on stderr

Convention is to print error messages only on stderr.
Helps when scripting.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: fix printing hint about unresolved iifname and oifname
Thomas Haller [Wed, 6 Mar 2019 11:04:00 +0000 (12:04 +0100)]
iprule: fix printing hint about unresolved iifname and oifname

was displayed as

    10:     from all iif eth1 [detached] goto 10000unresolved proto mrt

now:

    10:     from all iif eth1 [detached] goto 10000 [unresolved] proto mrt

Fixes: 0dd4ccc56c0e ("iprule: add json support")
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Tue, 5 Mar 2019 15:55:05 +0000 (07:55 -0800)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobridge: fdb: add support for src_vni option
Roopa Prabhu [Mon, 4 Mar 2019 05:26:32 +0000 (21:26 -0800)]
bridge: fdb: add support for src_vni option

We already print src_vni for a fdb entry when present.
This patch adds the ability to set src_vni on a fdb
entry. When not specified, kernel will use vni specified
on the vxlan device. This can be used on a vxlan fdb entry
when the vxlan device is in external or collect metadata
mode.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoman: Document COLORFGBG environment variable
Petr Vorel [Thu, 21 Feb 2019 15:04:01 +0000 (16:04 +0100)]
man: Document COLORFGBG environment variable

Default colors are not contrast enough on dark backround
and this functionality, which uses more suitable colors
is hidden in the code.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
5 years agotc/pedit: Fix wrong pedit ipv6 structure id
Dmytro Linkin [Wed, 27 Feb 2019 12:10:17 +0000 (12:10 +0000)]
tc/pedit: Fix wrong pedit ipv6 structure id

Tc pedit action with more than two ip6 munge in a row cause infinite
loop.

Example:

$ tc filter add dev eth0 protocol ipv6 parent ffff: \
flower ip_proto sctp \
    action pedit ex \
        munge ip6 hoplimit set 0x1 \
        munge ip6 src set 2001:0db8:0:f101::1 \
        munge that cause infinite loop

The example command never returns, instead of failing with parse error
as expected. Pedit ipv6 structure has wrong id, which leads to the
creation linked list with one node in tc/m_pedit.c:get_pedit_kind(),
referring to itself. This node is created if command have two ip6 munge
in a row, and any third ip6 munge will cause infinite loop.
Changing this id from "ipv6" to "ip6" solves the problem.

Fixes: f3e1b2448a95 ("pedit: Introduce ipv6 support")
Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'devlink-health' into next
David Ahern [Thu, 28 Feb 2019 16:00:19 +0000 (08:00 -0800)]
Merge branch 'devlink-health' into next

Aya Levin  says:

====================

This series adds support for devlink health commands:
 devlink health show     [ DEV reporter REPORTER_NAME ]
 devlink health recover    DEV reporter REPORTER_NAME
 devlink health diagnose   DEV reporter REPORTER_NAME
 devlink health dump show  DEV reporter REPORTER_NAME
 devlink health dump clear DEV reporter REPORTER_NAME
 devlink health set        DEV reporter REPORTER_NAME { grace_period | auto_recover } { msec | boolean }

The first patch refactors the validation of input parameters, which
grow way too long. Second and third patches fix bugs that were
discovered during the devlink health development. The forth patch adds
helper functions which enable output of value and labels separately.
Patches 5-10 add the devlink health functionality by command, the last
is the man page.

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink-health man page
Aya Levin [Thu, 28 Feb 2019 12:13:04 +0000 (14:13 +0200)]
devlink: Add devlink-health man page

Add a man page describing devlink health's command set. Also add a
reference link from devlink main man page.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health set command
Aya Levin [Thu, 28 Feb 2019 12:13:03 +0000 (14:13 +0200)]
devlink: Add devlink health set command

Add devlink set command which enables the user to configure parameters
related to the devlink health mechanism per reporter.
1) grace_period [msec] time interval between auto recoveries.
2) auto_recover [true/false] whether the devlink should execute automatic
recover on error.
Add a helper function to retrieve a boolean value as an input parameter.
Example:
$ devlink health set pci/0000:00:09.0 reporter tx grace_period 3500
$ devlink health set pci/0000:00:09.0 reporter tx auto_recover false

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health dump clear command
Aya Levin [Thu, 28 Feb 2019 12:13:02 +0000 (14:13 +0200)]
devlink: Add devlink health dump clear command

Add devlink dump clear command which deletes the last saved dump file.
Clearing the last saved dump enables a new dump file to be saved.
Example:
$ devlink health dump clear pci/0000:00:09.0 reporter tx

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health dump show command
Aya Levin [Thu, 28 Feb 2019 12:13:01 +0000 (14:13 +0200)]
devlink: Add devlink health dump show command

Add devlink dump show command which displays the last saved dump.
Devlink health saves a single dump. If a dump is not already stored
by the devlink for this reporter, devlink generates a new dump. The dump
can be generated automatically when a reporter reports on an
error or manually by user's request.
The dump's output is defined by the reporter. The command uses the
infra structure for flexible format output introduced in previous patch.
Example:
$ devlink health dump show pci/0000:00:09.0 reporter tx

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health diagnose command
Aya Levin [Thu, 28 Feb 2019 12:13:00 +0000 (14:13 +0200)]
devlink: Add devlink health diagnose command

Add devlink health diagnose command: enabling retrieval of diagnostics data
by the user on a reporter on a device. The command's output is a
free text defined by the reporter.

This patch also introduces an infra structure for flexible format
output. This allow the command to display different data fields
according to the reporter.
Example:
$ devlink health diagnose pci/0000:00:0a.0 reporter tx
SQs:
  sqn: 4403 HW state: 1 stopped: false
  sqn: 4408 HW state: 1 stopped: false
  sqn: 4413 HW state: 1 stopped: false
  sqn: 4418 HW state: 1 stopped: false
  sqn: 4423 HW state: 1 stopped: false

$ devlink health diagnose pci/0000:00:0a.0 reporter tx -jp
{
 "SQs":[
      {
       "sqn":4403,
       "HW state":1,
       "stopped":false
     },
      {
       "sqn":4408,
       "HW state":1,
       "stopped":false
     },
      {
       "sqn":4413,
       "HW state":1,
       "stopped":false
     },
      {
       "sqn":4418,
       "HW state":1,
       "stopped":false
     },
      {
       "sqn":4423,
       "HW state":1,
       "stopped":false
     }
   ]
}

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health recover command
Aya Levin [Thu, 28 Feb 2019 12:12:59 +0000 (14:12 +0200)]
devlink: Add devlink health recover command

Add devlink health recover command which enables the user to initiate a
recovery on a reporter (if a recovery cb was supplied by the reporter).
This operation will increment the recoveries counter displayed in the
show command.
Example:
$ devlink health recover pci/0000:00:09.0 reporter tx

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add devlink health show command
Aya Levin [Thu, 28 Feb 2019 12:12:58 +0000 (14:12 +0200)]
devlink: Add devlink health show command

Add devlink health show command which displays status and configuration
info on a specific reporter on a device or dump the info on all
reporters on all devices. Add helper functions to display status and
dump's time stamp.
Example:
$ devlink health show pci/0000:00:09.0 reporter tx
pci/0000:00:09.0:
 name tx
  state healthy error 0 recover 1 last_dump_date 2019-02-14 last_dump_time 10:10:10 grace_period 600 auto_recover true
$ devlink health show pci/0000:00:09.0 reporter tx -jp
{
 "health":{
  "pci/0000:00:0a.0":[
     {
     "name":"tx",
     "state":"healthy",
     "error":0,
     "recover":1,
     "last_dump_date":"2019-Feb-14",
     "last_dump_time":"10:10:10",
     "grace_period":600,
     "auto_recover":true
    }
  ]
}

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add helper functions for name and value separately
Aya Levin [Thu, 28 Feb 2019 12:12:57 +0000 (14:12 +0200)]
devlink: Add helper functions for name and value separately

Add a new helper functions which outputs only values (without name
label) for different types: boolean, uint, uint64, string and binary.
In addition add a helper function which prints only the name label.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Fix boolean JSON print
Aya Levin [Thu, 28 Feb 2019 12:12:56 +0000 (14:12 +0200)]
devlink: Fix boolean JSON print

This patch removes the inverted commas from boolean values in JSON
format: true/false instead of "true"/"false".

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Fix print of uint64_t
Aya Levin [Thu, 28 Feb 2019 12:12:55 +0000 (14:12 +0200)]
devlink: Fix print of uint64_t

This patch prints uint64_t with its corresponding format and avoid implicit
cast to uint32_t.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Refactor validation of finding required arguments
Aya Levin [Thu, 28 Feb 2019 12:12:54 +0000 (14:12 +0200)]
devlink: Refactor validation of finding required arguments

Introducing argument's metadata structure matching a bitmap flag per
required argument and an error message if missing. Using this static
array to refactor validation of finding required arguments in devlink
command line and to ease further maintenance.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add the prefix for driver attributes
Leon Romanovsky [Wed, 27 Feb 2019 06:41:51 +0000 (08:41 +0200)]
rdma: Add the prefix for driver attributes

There is a need to distinguish between driver vs. general exposed
attributes. The most common use case is to expose some internal
garbage under extremely common and sexy name, e.g. pi, ci e.t.c

In order to achieve that, we will add "drv_" prefix to all strings
which were received through RDMA_NLDEV_ATTR_DRIVER_* attributes.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>a
Tested-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: add support for updating device flash
Jakub Kicinski [Tue, 26 Feb 2019 20:20:14 +0000 (12:20 -0800)]
devlink: add support for updating device flash

Add new command for updating flash of devices via devlink API.
Example:

$ cp flash-boot.bin /lib/firmware/
$ devlink dev flash pci/0000:05:00.0 file flash-boot.bin

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Wed, 27 Feb 2019 16:23:22 +0000 (08:23 -0800)]
Update kernel headers

Update kernel headers to commit:
    ff8285f81822 ("net: sched: pie: fix 64-bit division")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'rdma-object-ids' into next
David Ahern [Sun, 24 Feb 2019 15:13:21 +0000 (07:13 -0800)]
Merge branch 'rdma-object-ids' into next

Leon Romanovsky says:

====================

This series adds ability to present and query all known to rdmatool
object by their respective, unique IDs (e.g. pdn. mrn, cqn e.t.c).
All objects which have "parent" object has this information too.

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Provide and reuse filter functions
Leon Romanovsky [Sat, 23 Feb 2019 09:15:28 +0000 (11:15 +0200)]
rdma: Provide and reuse filter functions

Globally replace all filter function in safer variants of those
is_filtered functions, which take into account the availability/lack
of netlink attributes.

Such conversion allowed to fix a number of places in the code, where
the previous implementation didn't honor filter requests if netlink
attribute wasn't present.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Perform single .doit call to query specific objects
Leon Romanovsky [Sat, 23 Feb 2019 09:15:27 +0000 (11:15 +0200)]
rdma: Perform single .doit call to query specific objects

If user provides specific index, we can speedup query
by using .doit callback and save full dump and filtering
after that.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Unify netlink attribute checks prior to prints
Leon Romanovsky [Sat, 23 Feb 2019 09:15:26 +0000 (11:15 +0200)]
rdma: Unify netlink attribute checks prior to prints

Place check if netlink attribute available in general place,
instead of doing the same check in many paces.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move QP code to separate function
Leon Romanovsky [Sat, 23 Feb 2019 09:15:25 +0000 (11:15 +0200)]
rdma: Move QP code to separate function

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Place PD parsing print routine into separate function
Leon Romanovsky [Sat, 23 Feb 2019 09:15:24 +0000 (11:15 +0200)]
rdma: Place PD parsing print routine into separate function

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move MR code to be suitable for per-line parsing
Leon Romanovsky [Sat, 23 Feb 2019 09:15:23 +0000 (11:15 +0200)]
rdma: Move MR code to be suitable for per-line parsing

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Refactor CQ prints
Leon Romanovsky [Sat, 23 Feb 2019 09:15:22 +0000 (11:15 +0200)]
rdma: Refactor CQ prints

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Simplify CM_ID print code
Leon Romanovsky [Sat, 23 Feb 2019 09:15:21 +0000 (11:15 +0200)]
rdma: Simplify CM_ID print code

Refactor our the CM_ID print code.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Simplify code to reuse existing functions
Leon Romanovsky [Sat, 23 Feb 2019 09:15:20 +0000 (11:15 +0200)]
rdma: Simplify code to reuse existing functions

Remove duplicated functions in favour general res_print_uint() call.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Properly mark RDMAtool license
Leon Romanovsky [Sat, 23 Feb 2019 09:15:19 +0000 (11:15 +0200)]
rdma: Properly mark RDMAtool license

RDMA subsystem is dual-licensed with "GPL-2.0 OR Linux-OpenIB" proper
license and Mellanox submission are supposed to have this type of license.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move resource QP logic to separate file
Leon Romanovsky [Sat, 23 Feb 2019 09:15:18 +0000 (11:15 +0200)]
rdma: Move resource QP logic to separate file

Logically separate resource QP logic to separate file,
in order to make PD specific logic self-contained.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move out resource CM-ID logic to separate file
Leon Romanovsky [Sat, 23 Feb 2019 09:15:17 +0000 (11:15 +0200)]
rdma: Move out resource CM-ID logic to separate file

Logically separate resource CM-ID logic to separate file,
in order to make CM-ID specific logic self-contained.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move out resource CQ logic to separate file
Leon Romanovsky [Sat, 23 Feb 2019 09:15:16 +0000 (11:15 +0200)]
rdma: Move out resource CQ logic to separate file

Logically separate resource CQ logic to separate file,
in order to make CQ specific logic self-contained.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Refactor out resource MR logic to separate file
Leon Romanovsky [Sat, 23 Feb 2019 09:15:15 +0000 (11:15 +0200)]
rdma: Refactor out resource MR logic to separate file

Logically separate resource MR logic to separate file,
in order to make MR specific logic self-contained.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Move resource PD logic to separate file
Leon Romanovsky [Sat, 23 Feb 2019 09:15:14 +0000 (11:15 +0200)]
rdma: Move resource PD logic to separate file

Logically separate resource PD logic to separate file,
in order to make PD specific logic self-contained.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Provide parent context index for all objects except CM_ID
Leon Romanovsky [Sat, 23 Feb 2019 09:15:13 +0000 (11:15 +0200)]
rdma: Provide parent context index for all objects except CM_ID

Allow users to correlate allocated object with relevant parent

[leonro@server ~]$ rdma res show pd
dev mlx5_0 users 5 pid 0 comm [ib_core] pdn 1
dev mlx5_0 users 7 pid 0 comm [ib_ipoib] pdn 2
dev mlx5_0 users 0 pid 0 comm [mlx5_ib] pdn 3
dev mlx5_0 users 2 pid 548 comm ibv_rc_pingpong ctxn 0 pdn 4

[leonro@server ~]$ rdma res show cq cqn 0-100
dev mlx5_0 cqe 2047 users 6 poll-ctx UNBOUND_WORKQUEUE pid 0 comm [ib_core] cqn 2
dev mlx5_0 cqe 255 users 2 poll-ctx SOFTIRQ pid 0 comm [mlx5_ib] cqn 3
dev mlx5_0 cqe 511 users 1 poll-ctx DIRECT pid 0 comm [ib_ipoib] cqn 4
dev mlx5_0 cqe 255 users 1 poll-ctx DIRECT pid 0 comm [ib_ipoib] cqn 5
dev mlx5_0 cqe 255 users 0 poll-ctx SOFTIRQ pid 0 comm [mlx5_ib] cqn 6
dev mlx5_0 cqe 511 users 2 pid 548 comm ibv_rc_pingpong cqn 7 ctxn 0

[leonro@server ~]$ rdma res show mr
dev mlx5_0 mrlen 4096 pid 548 comm ibv_rc_pingpong mrn 4 pdn 0

[leonro@nps-server-14-015 ~]$ /images/leonro/src/iproute2/rdma/rdma res show qp
link mlx5_0/1 lqpn 0 type SMI state RTS sq-psn 0 pid 0 comm [ib_core]
link mlx5_0/1 lqpn 1 type GSI state RTS sq-psn 0 pid 0 comm [ib_core]
link mlx5_0/1 lqpn 7 type UD state RTS sq-psn 0 pid 0 comm [ib_core]
link mlx5_0/1 lqpn 8 type UD state RTS sq-psn 0 pid 0 comm [ib_ipoib]
link mlx5_0/1 lqpn 9 pdn 4 rqpn 0 type RC state INIT rq-psn 0 sq-psn 0 path-mig-state MIGRATED pid 548 comm ibv_rc_pingpong

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Provide unique indexes for all visible objects
Leon Romanovsky [Sat, 23 Feb 2019 09:15:12 +0000 (11:15 +0200)]
rdma: Provide unique indexes for all visible objects

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Remove duplicated print code
Leon Romanovsky [Sat, 23 Feb 2019 09:15:11 +0000 (11:15 +0200)]
rdma: Remove duplicated print code

There is no need to keep same print functions for
uint32_t and uint64_t, unify them into one function.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: update uapi headers
Leon Romanovsky [Sat, 23 Feb 2019 09:15:10 +0000 (11:15 +0200)]
rdma: update uapi headers

Update rdma_netlink.h file upto kernel commit
f2a0e45f36b0 RDMA/nldev: Don't expose number of not-visible entries

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoImprove batch and dump times by caching link lookups
David Ahern [Wed, 13 Feb 2019 23:56:30 +0000 (15:56 -0800)]
Improve batch and dump times by caching link lookups

ip route uses ll_name_to_index and ll_index_to_name to convert between
device names and indices. At the moment both use for the ioctl based glibc
functions if_nametoindex and if_indextoname and does not cache the result.
When using a batch file or dumping large number of routes this means the
same device lookups can be done repeatedly adding unnecessary overhead
(socket + ioctl + close for each device lookup).

Add a new function, ll_link_get, to send a netlink based RTM_GETLINK. If
successful, cache the result in idx_head and name_head so future lookups
can re-use the entry. Update ll_name_to_index and ll_index_to_name to use
ll_link_get and only fallback to the glibc functions if it fails.

With this change the time to install 720,022 routes with 2 ecmp nexthops
where the nexthop device is given is reduced from 31.4 seconds to 19.2
seconds. A dump of those routes drops from 13.3 to 2.8 seconds.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip link: Drop cache entry on any changes
David Ahern [Wed, 13 Feb 2019 23:53:21 +0000 (15:53 -0800)]
ip link: Drop cache entry on any changes

Remove any entry from the link cache when the link is modified.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoll_map: Add function to remove link cache entry by index
David Ahern [Mon, 7 Jan 2019 22:29:15 +0000 (14:29 -0800)]
ll_map: Add function to remove link cache entry by index

Add ll_drop_by_index to remove an entry from the link cache.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Sat, 23 Feb 2019 02:50:39 +0000 (18:50 -0800)]
Merge branch 'iproute2-master' into next

Conflicts:
misc/ss.c

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoss: Render buffer to output every time a number of chunks are allocated
Stefano Brivio [Thu, 14 Feb 2019 00:58:32 +0000 (01:58 +0100)]
ss: Render buffer to output every time a number of chunks are allocated

Eric reported that, with 10 million sockets, ss -emoi (about 1000 bytes
output per socket) can easily lead to OOM (buffer would grow to 10GB of
memory).

Limit the maximum size of the buffer to five chunks, 1M each. Render and
flush buffers whenever we reach that.

This might make the resulting blocks slightly unaligned between them, with
occasional loss of readability on lines occurring every 5k to 50k sockets
approximately. Something like (from ss -tu):

[...]
CLOSE-WAIT   32       0           192.168.1.50:35232           10.0.0.1:https
ESTAB        0        0           192.168.1.50:53820           10.0.0.1:https
ESTAB       0        0           192.168.1.50:46924            10.0.0.1:https
CLOSE-WAIT  32       0           192.168.1.50:35228            10.0.0.1:https
[...]

However, I don't actually expect any human user to scroll through that
amount of sockets, so readability should be preserved when it matters.

The bulk of the diffstat comes from moving field_next() around, as we now
call render() from it. Functionally, this is implemented by six lines of
code, most of them in field_next().

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: fix compilation under glibc < 2.18
Thomas De Schampheleire [Wed, 20 Feb 2019 14:41:51 +0000 (15:41 +0100)]
ss: fix compilation under glibc < 2.18

Commit c759116a0b2b6da8df9687b0a40ac69050132c77 introduced support for
AF_VSOCK. This define is only provided since glibc version 2.18, so
compilation fails when using older toolchains.

Provide the necessary definitions if needed.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update inet_diag_info.h
Stephen Hemminger [Thu, 21 Feb 2019 22:24:07 +0000 (14:24 -0800)]
uapi: update inet_diag_info.h

Upstream changes.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>