]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
4 years agotipc: support 128bit node identity for peer removing
Hoang Le [Thu, 27 Aug 2020 02:30:37 +0000 (09:30 +0700)]
tipc: support 128bit node identity for peer removing

Problem:
In kernel upstream, we add the support to set node identity with
128bit. However, we are still using legacy format in command tipc
peer removing. Then, we got a problem when trying to remove
offline node i.e:

$ tipc node list
Node Identity                    Hash     State
d6babc1c1c6d                     1cbcd7ca down

$ tipc peer remove address d6babc1c1c6d
invalid network address, syntax: Z.C.N
error: No such device or address

Solution:
We add the support to remove a specific node down with 128bit
node identifier, as an alternative to legacy 32-bit node address.

Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Huu Le <hoang.h.le@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoiplink: add support for protodown reason
Roopa Prabhu [Sat, 29 Aug 2020 03:42:56 +0000 (20:42 -0700)]
iplink: add support for protodown reason

This patch adds support for recently
added link IFLA_PROTO_DOWN_REASON attribute.
IFLA_PROTO_DOWN_REASON enumerates reasons
for the already existing IFLA_PROTO_DOWN link
attribute.

$ cat /etc/iproute2/protodown_reasons.d/r.conf
0 mlag
1 evpn
2 vrrp
3 psecurity

$ ip link set dev vx10 protodown on protodown_reason vrrp on
$ip link show dev vx10
14: vx10: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode
DEFAULT group default qlen 1000
    link/ether f2:32:28:b8:35:ff brd ff:ff:ff:ff:ff:ff protodown on
protodown_reason <vrrp>
$ip -p -j link show dev vx10
[ {
<snip>
        "proto_down": true,
        "proto_down_reason": [ "vrrp" ]
} ]
$ip link set dev vx10 protodown_reason mlag on
$ip link show dev vx10
14: vx10: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode
DEFAULT group default qlen 1000
    link/ether f2:32:28:b8:35:ff brd ff:ff:ff:ff:ff:ff protodown on
protodown_reason <mlag,vrrp>
$ip -p -j link show dev vx10
[ {
<snip>
        "proto_down": true,
        "protodown_reason": [ "mlag","vrrp" ]
} ]

$ip -p -j link show dev vx10
$ip link set dev vx10 protodown off protodown_reason vrrp off
Error: Cannot clear protodown, active reasons.
$ip link set dev vx10 protodown off protodown_reason mlag off
$

Note: for somereason the json and non-json key for protodown
are different (protodown and proto_down). I have kept the
same for protodown reason for consistency (protodown_reason and
proto_down_reason).

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip xfrm: support printing XFRMA_SET_MARK_MASK attribute in states
Antony Antony [Fri, 28 Aug 2020 14:59:07 +0000 (16:59 +0200)]
ip xfrm: support printing XFRMA_SET_MARK_MASK attribute in states

The XFRMA_SET_MARK_MASK attribute is set in states (4.19+).
It is the mask of XFRMA_SET_MARK(a.k.a. XFRMA_OUTPUT_MARK in 4.18)

sample output: note the output-mark mask
ip xfrm state
src 192.1.2.23 dst 192.1.3.33
proto esp spi 0xSPISPI reqid REQID mode tunnel
replay-window 32 flag af-unspec
output-mark 0x3/0xffffff
aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
if_id 0x1

Signed-off-by: Antony Antony <antony@phenome.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'main' into next
David Ahern [Wed, 2 Sep 2020 01:46:20 +0000 (19:46 -0600)]
Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip link: Fix indenting in help text
Phil Sutter [Sat, 29 Aug 2020 10:18:35 +0000 (12:18 +0200)]
ip link: Fix indenting in help text

Indenting of 'ip link set' options below 'link-netns' was wrong, they
should be on the same level as the above.

While being at it, fix closing brackets in vf-specific options. Also
write node/port_guid parameters in upper-case without curly braces: They
are supposed to be replaced by values, not put literally.

Fixes: 8589eb4efdf2a ("treewide: refactor help messages")
Fixes: 5a3ec4ba64783 ("iplink: Update usage in help message")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agogenl: ctrl: support dumping netlink policy
Johannes Berg [Mon, 24 Aug 2020 17:51:08 +0000 (19:51 +0200)]
genl: ctrl: support dumping netlink policy

Support dumping the netlink policy of a given generic netlink
family, the policy (with any sub-policies if appropriate) is
exported by the kernel in a general fashion.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolibnetlink: add nl_print_policy() helper
Johannes Berg [Mon, 24 Aug 2020 17:51:07 +0000 (19:51 +0200)]
libnetlink: add nl_print_policy() helper

This prints out the data from the given nested attribute
to the given FILE pointer, interpreting the firmware that
the kernel has for showing netlink policies.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolibnetlink: add rtattr_for_each_nested() iteration macro
Johannes Berg [Mon, 24 Aug 2020 17:51:06 +0000 (19:51 +0200)]
libnetlink: add rtattr_for_each_nested() iteration macro

This is useful for iterating elements in a nested attribute,
if they're not parsed with a strict length limit or such.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: iplink: prp: update man page for new parameter
Murali Karicheri [Mon, 17 Aug 2020 21:17:37 +0000 (17:17 -0400)]
ip: iplink: prp: update man page for new parameter

PRP support requires a proto parameter which is 0 for hsr and 1 for
prp. Default is hsr and is backward compatible.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoiplink: hsr: add support for creating PRP device similar to HSR
Murali Karicheri [Mon, 17 Aug 2020 21:17:36 +0000 (17:17 -0400)]
iplink: hsr: add support for creating PRP device similar to HSR

This patch enhances the iplink command to add a proto parameters to
create PRP device/interface similar to HSR. Both protocols are
quite similar and requires a pair of Ethernet interfaces. So re-use
the existing HSR iplink command to create PRP device/interface as
well. Use proto parameter to differentiate the two protocols.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add fflush() in cmd_mon_show_cb()
Amit Cohen [Thu, 20 Aug 2020 13:51:13 +0000 (16:51 +0300)]
devlink: Add fflush() in cmd_mon_show_cb()

Similar to other print functions we need to flush buffered data
in order to work with pipes and output redirects.

Without it, stdout output is buffered and not written to the disk.

This is useful when writing scripts that rely on devlink-monitor output.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoiproute2: ip maddress: Check multiaddr length
Sascha Hauer [Mon, 17 Aug 2020 11:25:19 +0000 (13:25 +0200)]
iproute2: ip maddress: Check multiaddr length

ip maddress add|del takes a MAC address as argument, so insist on
getting a length of ETH_ALEN bytes. This makes sure the passed argument
is actually a MAC address and especially not an IPv4 address which
was previously accepted and silently taken as a MAC address.

While at it, do not print *argv in the error path as this has been
modified by ll_addr_a2n() and doesn't contain the full string anymore,
which can lead to misleading error messages.

Also while at it, replace the hardcoded buffer size with the actual
buffer size using sizeof().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update bpf.h
Stephen Hemminger [Sun, 16 Aug 2020 23:09:52 +0000 (16:09 -0700)]
uapi: update bpf.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agordma: Properly print device and link names in CLI output
Leon Romanovsky [Tue, 11 Aug 2020 07:32:01 +0000 (10:32 +0300)]
rdma: Properly print device and link names in CLI output

The citied commit broke the CLI output and printed ifindex/ifname
instead of dev/link.

Before:
[leonro@vm ~]$ rdma res show qp
link mlx5_0/lqpn 1 type GSI state RTS sq-psn 0 comm ib_core
[leonro@vm ~]$ rdma res show cq
ifindex 0 ifname rocep0s9 cqn 0 cqe 1023 users 2 poll-ctx WORKQUEUE adaptive-moderation on comm ib_core

After:
[leonro@vm ~]$ rdma res show qp
link mlx5_0/- lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
[leonro@vm ~]$ rdma res show cq
dev rocep0s9 cqn 0 cqe 1023 users 2 poll-ctx WORKQUEUE adaptive-moderation on comm [ib_core]

It was missed because rdmatool mostly used in JSON mode.

Fixes: b0a688a542cd ("rdma: Rewrite custom JSON and prints logic to use common API")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agordma: Fix owner name for the kernel resources
Leon Romanovsky [Tue, 11 Aug 2020 07:32:00 +0000 (10:32 +0300)]
rdma: Fix owner name for the kernel resources

Owner of kernel resources is printed in different format than user
resources to easy with the reader by simply looking on the name.
The kernel owner will have "[ ]" around the name.

Before this change:
[leonro@vm ~]$ rdma res show qp
link rocep0s9/1 lqpn 1 type GSI state RTS sq-psn 58 comm ib_core

After this change:
[leonro@vm ~]$ rdma res show qp
link rocep0s9/1 lqpn 1 type GSI state RTS sq-psn 58 comm [ib_core]

Fixes: b0a688a542cd ("rdma: Rewrite custom JSON and prints logic to use common API")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update kernel headers
Stephen Hemminger [Tue, 11 Aug 2020 20:18:41 +0000 (13:18 -0700)]
uapi: update kernel headers

pre-rc1 version of Linux kernel headers.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agordma: Document the new "pid" criteria for auto mode
Mark Zhang [Tue, 4 Aug 2020 08:49:09 +0000 (11:49 +0300)]
rdma: Document the new "pid" criteria for auto mode

Document the new supported criteria of auto mode. Examples:
$ rdma statistic qp set link mlx5_2/1 auto pid on
$ rdma statistic qp set link mlx5_2/1 auto pid,type on

Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Ido Kalir <idok@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: Add "PID" criteria support for statistic counter auto mode
Mark Zhang [Tue, 4 Aug 2020 08:49:08 +0000 (11:49 +0300)]
rdma: Add "PID" criteria support for statistic counter auto mode

With this new criteria, QPs have different PIDs will be bound to
different counters in auto mode. This can be used in combination with
other criteria like "type". Examples:

$ rdma statistic qp set link mlx5_2/1 auto pid on
$ rdma statistic qp set link mlx5_2/1 auto type,pid on
$ rdma statistic qp set link mlx5_2/1 auto off
$ rdma statistic qp show link mlx5_0 qp-type UD

Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Ido Kalir <idok@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: update uapi headers
Mark Zhang [Tue, 4 Aug 2020 08:49:07 +0000 (11:49 +0300)]
rdma: update uapi headers

Update rdma_netlink.h file upto kernel commit 76251e15ea73
("RDMA/counter: Add PID category support in auto mode")

Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Ido Kalir <idok@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoMerge branch 'main' into next
David Ahern [Thu, 6 Aug 2020 16:21:35 +0000 (16:21 +0000)]
Merge branch 'main' into next

Conflicts:
bridge/fdb.c
man/man8/bridge.8

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agov5.8.0
Stephen Hemminger [Mon, 3 Aug 2020 17:03:42 +0000 (10:03 -0700)]
v5.8.0

4 years agolnstat: use same version as iproute2
Stephen Hemminger [Mon, 3 Aug 2020 16:27:48 +0000 (09:27 -0700)]
lnstat: use same version as iproute2

Lnstat was trying to be different and have its own version.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoreplace SNAPSHOT with auto-generated version string
Stephen Hemminger [Sat, 1 Aug 2020 17:26:41 +0000 (10:26 -0700)]
replace SNAPSHOT with auto-generated version string

Replace the iproute2 snapshot with a version string which is
autogenerated as part of the build process using git describe.

This will also allow seeing if the version of the command
is built from the same sources is as upstream.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add board.serial_number to info subcommand.
Vasundhara Volam [Fri, 31 Jul 2020 10:46:43 +0000 (03:46 -0700)]
devlink: Add board.serial_number to info subcommand.

Add support for reading board serial_number to devlink info
subcommand. Example:

$ devlink dev info pci/0000:af:00.0 -jp
{
    "info": {
        "pci/0000:af:00.0": {
            "driver": "bnxt_en",
            "serial_number": "00-10-18-FF-FE-AD-1A-00",
            "board.serial_number": "433551F+172300000",
            "versions": {
                "fixed": {
                    "board.id": "7339763 Rev 0.",
                    "asic.id": "16D7",
                    "asic.rev": "1"
                },
                "running": {
                    "fw": "216.1.216.0",
                    "fw.psid": "0.0.0",
                    "fw.mgmt": "216.1.192.0",
                    "fw.mgmt.api": "1.10.1",
                    "fw.ncsi": "0.0.0.0",
                    "fw.roce": "216.1.16.0"
                }
            }
        }
    }
}

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoip-xfrm: add support for oseq-may-wrap extra flag
Petr Vaněk [Fri, 31 Jul 2020 07:12:59 +0000 (09:12 +0200)]
ip-xfrm: add support for oseq-may-wrap extra flag

This flag allows to create SA where sequence number can cycle in
outbound packets if set.

Signed-off-by: Petr Vaněk <pv@excello.cz>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoUpdate kernel headers
David Ahern [Mon, 3 Aug 2020 14:56:28 +0000 (14:56 +0000)]
Update kernel headers

Update kernel headers to commit:
    bd0b33b24897 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Expose port split ability
Danielle Ratson [Thu, 30 Jul 2020 14:33:18 +0000 (17:33 +0300)]
devlink: Expose port split ability

Add a new attribute that indicates the port split ability to devlink port.

Expose the attribute to user space as RO value, for example:

$devlink port show swp1
pci/0000:03:00.0/61: type eth netdev swp1 flavour physical port 1
splittable false lanes 1

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Expose number of port lanes
Danielle Ratson [Thu, 30 Jul 2020 14:33:17 +0000 (17:33 +0300)]
devlink: Expose number of port lanes

Add a new attribute that indicates the port's number of lanes to devlink port.

Expose the attribute to user space as RO value, for example:

$devlink port show swp1
pci/0000:03:00.0/61: type eth netdev swp1 flavour physical port 1 lanes 1

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agobridge: fdb show: fix fdb entry state output for json context
Julien Fortin [Wed, 29 Jul 2020 13:04:25 +0000 (15:04 +0200)]
bridge: fdb show: fix fdb entry state output for json context

bridge json fdb show is printing an incorrect / non-machine readable
value, when using -j (json output) we are expecting machine readable
data that shouldn't require special handling/parsing.

$ bridge -j fdb show | \
python -c \
'import sys,json;print(json.dumps(json.loads(sys.stdin.read()),indent=4))'
[
    {
"master": "br0",
"mac": "56:23:28:4f:4f:e5",
"flags": [],
"ifname": "vx0",
"state": "state=0x80"  <<<<<<<<< with the patch: "state": "0x80"
    }
]

Fixes: c7c1a1ef51aea7c ("bridge: colorize output and use JSON print library")
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: Add space after format specifier
Briana Oursler [Tue, 28 Jul 2020 05:20:48 +0000 (22:20 -0700)]
tc: Add space after format specifier

Add space after format specifier in print_string call. Fixes broken
qdisc tests within tdc testing suite. Per suggestion from Petr Machata,
remove a space and change spacing in tc/q_event.c to complete the fix.

Tested fix in tdc using:
./tdc.py -c qdisc

All qdisc RED tests return ok.

Fixes: d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop")
Signed-off-by: Briana Oursler <briana.oursler@gmail.com>
Tested-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agobridge: fdb: the 'dynamic' option in the show/get commands
Anton Danilov [Mon, 27 Jul 2020 13:26:07 +0000 (16:26 +0300)]
bridge: fdb: the 'dynamic' option in the show/get commands

In most of cases a user wants to see only the dynamic mac addresses
in the fdb output. But currently the 'fdb show' displays tons of
various self entries, those only waste the output without any useful
goal.

New option 'dynamic' for 'show' and 'get' commands forces display
only relevant records.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agomptcp: show all endpoints when no ID is specified
Matthieu Baerts [Fri, 24 Jul 2020 12:17:18 +0000 (14:17 +0200)]
mptcp: show all endpoints when no ID is specified

According to 'ip mptcp help', 'endpoint show' can accept no argument:

  ip mptcp endpoint show [ id ID ]

It makes sense to print all endpoints when no filter is used.

So here if the following command is used, all endpoints are printed:

  ip mptcp endpoint show

Same as:

  ip mptcp endpoint

Fixes: 7e0767cd ("add support for mptcp netlink interface")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'devlink-port-health' into next
David Ahern [Thu, 23 Jul 2020 00:34:07 +0000 (00:34 +0000)]
Merge branch 'devlink-port-health' into next

Moshe Shemesh  says:

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

Implement commands for interaction with per-port devlink health
reporters. To do this, adapt devlink-health for usage of port handles
with any existing devlink-health subcommands. Add devlink-port health
subcommand as an alias for devlink-health.

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

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Update devlink-health and devlink-port manpages
Vladyslav Tarasiuk [Sun, 19 Jul 2020 13:36:03 +0000 (16:36 +0300)]
devlink: Update devlink-health and devlink-port manpages

Describe support for per-port reporters in devlink-health and
devlink-port commands.

Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Add devlink port health command
Vladyslav Tarasiuk [Sun, 19 Jul 2020 13:36:02 +0000 (16:36 +0300)]
devlink: Add devlink port health command

Add devlink port health show subcommand which displays information about
specified port reporter or all present port reporters as in the example.
Device and port reporters can be distinguished by a handle being used.

Make other devlink-health subcommands be aliased by devlink port health.
Refactor devlink-health commands for usage of port handles in order to
interact with port reporters.

Change devlink health show output to dump information about both device
and port reporters with correct handles.

Example:
$ devlink health show
pci/0000:00:0b.0:
  reporter fw
    state healthy error 0 recover 0 auto_dump true
  reporter fw_fatal
    state healthy error 0 recover 0 grace_period 1200000 auto_recover true auto_dump true
pci/0000:00:0b.0/1:
  reporter tx
    state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true
  reporter rx
    state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true

$ devlink health show pci/0000:00:0b.0/1 reporter rx
Which is equivalent to:
$ devlink port health show pci/0000:00:0b.0/1 reporter rx
pci/0000:00:0b.0/1:
  reporter rx
    state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true

$ devlink port health show pci/0000:00:0b.0/1 reporter rx -j --pretty
{
    "health": {
         "pci/0000:00:0b.0/1": [ {
                 "reporter": "rx",
                 "state": "healthy",
                 "error": 0,
                 "recover": 0,
                 "grace_period": 500,
                 "auto_recover": true,
                 "auto_dump": true
              } ]
    }
}

$ devlink health set pci/0000:00:0b.0/1 reporter rx grace_period 5000
Which is equivalent to:
$ devlink port health set pci/0000:00:0b.0/1 reporter rx grace_period 5000

$ devlink port health show pci/0000:00:0b.0/1 reporter rx
pci/0000:00:0b.0/1:
  reporter rx
    state healthy error 0 recover 0 grace_period 5000 auto_recover true auto_dump true

Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Add a possibility to print arrays of devlink port handles
Vladyslav Tarasiuk [Sun, 19 Jul 2020 13:36:01 +0000 (16:36 +0300)]
devlink: Add a possibility to print arrays of devlink port handles

Add a capability of printing port handles for arrays in non-JSON format
in devlink-health manner.

Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agouapi: update bpf.h
Stephen Hemminger [Tue, 21 Jul 2020 16:18:15 +0000 (09:18 -0700)]
uapi: update bpf.h

Upstrean 5.8-rc6 changes.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotestsuite: Add tests for bareudp tunnels
Guillaume Nault [Fri, 17 Jul 2020 14:39:46 +0000 (16:39 +0200)]
testsuite: Add tests for bareudp tunnels

Test the plain MPLS (unicast and multicast) and IP (v4 and v6) modes.
Also test the multiproto option for MPLS and for IP.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agomisc: make the pattern matching case-insensitive
Anton Danilov [Thu, 9 Jul 2020 15:03:43 +0000 (18:03 +0300)]
misc: make the pattern matching case-insensitive

To improve the usability better use case-insensitive pattern-matching
in ifstat, nstat and ss tools.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc/m_estimator: Print proper value for estimator interval in raw.
Jamie Gloudon [Fri, 17 Jul 2020 15:05:30 +0000 (11:05 -0400)]
tc/m_estimator: Print proper value for estimator interval in raw.

While looking at the estimator code, I noticed an incorrect interval
number printed in raw for the handles. This patch fixes the formatting.

Before patch:

root@bytecenter.fr:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=4294967294 e=2]

After patch:

root@bytecenter.fr:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=-2 e=2]

Signed-off-by: Jamie Gloudon <jamie.gloudon@gmx.fr>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'tc-qevent-block' into next
David Ahern [Mon, 20 Jul 2020 16:36:41 +0000 (16:36 +0000)]
Merge branch 'tc-qevent-block' into next

Petr Machata  says:

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

When a list of filters at a given block is requested, tc first validates
that the block exists before doing the filter query. Currently the
validation routine checks ingress and egress blocks. But now that blocks
can be bound to qevents as well, qevent blocks should be looked for as
well:

    # ip link add up type dummy
    # tc qdisc add dev dummy1 root handle 1: \
         red min 30000 max 60000 avpkt 1000 qevent early_drop block 100
    # tc filter add block 100 pref 1234 handle 102 matchall action drop
    # tc filter show block 100
    Cannot find block "100"

This patchset fixes this issue:

    # tc filter show block 100
    filter protocol all pref 1234 matchall chain 0
    filter protocol all pref 1234 matchall chain 0 handle 0x66
      not_in_hw
            action order 1: gact action drop
             random type none pass val 0
             index 2 ref 1 bind 1

In patch #1, the helpers and necessary infrastructure is introduced,
including a new qdisc_util callback that implements sniffing out bound
blocks in a given qdisc.

In patch #2, RED implements the new callback.

v3:
- Patch #1:
    - Do not pass &ctx->found directly to has_block. Do it through a
      helper variable, so that the callee does not overwrite the result
      already stored in ctx->found.

v2:
- Patch #1:
    - In tc_qdisc_block_exists_cb(), do not initialize 'q'.
    - Propagate upwards errors from q->has_block.

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

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agotc: q_red: Implement has_block for RED
Petr Machata [Thu, 16 Jul 2020 16:47:08 +0000 (19:47 +0300)]
tc: q_red: Implement has_block for RED

In order for "tc filter show block X" to find a given block, implement the
has_block callback.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agotc: Look for blocks in qevents
Petr Machata [Thu, 16 Jul 2020 16:47:07 +0000 (19:47 +0300)]
tc: Look for blocks in qevents

When a list of filters at a given block is requested, tc first validates
that the block exists before doing the filter query. Currently the
validation routine checks ingress and egress blocks. But now that blocks
can be bound to qevents as well, qevent blocks should be looked for as
well.

In order to support that, extend struct qdisc_util with a new callback,
has_block. That should report whether, give the attributes in TCA_OPTIONS,
a blocks with a given number is bound to a qevent. In
tc_qdisc_block_exists_cb(), invoke that callback when set.

Add a helper to the tc_qevent module that walks the list of qevents and
looks for a given block. This is meant to be used by the individual qdiscs.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoss: mptcp: add msk diag interface support
Paolo Abeni [Fri, 10 Jul 2020 13:52:35 +0000 (15:52 +0200)]
ss: mptcp: add msk diag interface support

This implement support for MPTCP sockets type, comprising
extended socket info. Note that we need to add an extended
attribute carrying the actual protocol number to the diag
request.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoUpdate kernel headers
David Ahern [Tue, 14 Jul 2020 23:56:53 +0000 (23:56 +0000)]
Update kernel headers

Update kernel headers to commit:
    81adcd65b685 ("ksz884x: switch from 'pci_' to 'dma_' API")

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoMerge branch 'main' into next
David Ahern [Tue, 14 Jul 2020 23:52:43 +0000 (23:52 +0000)]
Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoip xfrm: policy: support policies with IF_ID in get/delete/deleteall
Eyal Birger [Thu, 9 Jul 2020 06:29:48 +0000 (09:29 +0300)]
ip xfrm: policy: support policies with IF_ID in get/delete/deleteall

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

Add support for getting/deleting policies with this attribute.

For supporting 'deleteall' the XFRMA_IF_ID attribute needs to be
explicitly copied.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip xfrm: update man page on setting/printing XFRMA_IF_ID in states/policies
Eyal Birger [Thu, 9 Jul 2020 06:29:47 +0000 (09:29 +0300)]
ip xfrm: update man page on setting/printing XFRMA_IF_ID in states/policies

In commit aed63ae1acb9 ("ip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies")
I added the ability to set/print the xfrm interface ID without updating
the man page.

Fixes: aed63ae1acb9 ("ip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotipc: fixed a compile warning in tipc/link.c
Hoang Huu Le [Thu, 9 Jul 2020 04:25:55 +0000 (11:25 +0700)]
tipc: fixed a compile warning in tipc/link.c

Fixes: 5027f233e35b ("tipc: add link broadcast get")
Signed-off-by: Hoang Huu Le <hoang.h.le@dektech.com.au>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: fdb get: add missing json init (new_json_obj)
Julien Fortin [Fri, 10 Jul 2020 00:53:02 +0000 (02:53 +0200)]
bridge: fdb get: add missing json init (new_json_obj)

'bridge fdb get' has json support but the json object is never initialized

before patch:

$ bridge -j fdb get 56:23:28:4f:4f:e5 dev vx0
56:23:28:4f:4f:e5 dev vx0 master br0 permanent
$

after patch:

$ bridge -j fdb get 56:23:28:4f:4f:e5 dev vx0 | \
python -c \
'import sys,json;print(json.dumps(json.loads(sys.stdin.read()),indent=4))'
[
    {
        "master": "br0",
        "mac": "56:23:28:4f:4f:e5",
        "flags": [],
        "ifname": "vx0",
        "state": "permanent"
    }
]
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoconfigure: support ipset version 7 with kernel version 5
Tony Ambardar [Tue, 7 Jul 2020 07:58:33 +0000 (00:58 -0700)]
configure: support ipset version 7 with kernel version 5

The configure script checks for ipset v6 availability but doesn't test
for v7, which is backward compatible and used on kernel v5.x systems.
Update the script to test for both ipset versions. Without this change,
the tc ematch function em_ipset will be disabled.

Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip address: remove useless include
Andrea Claudi [Tue, 7 Jul 2020 19:49:47 +0000 (21:49 +0200)]
ip address: remove useless include

utils.h is included two times in ipaddress.c, there is no need for that.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agogenl: use <> for system includes
Stephen Hemminger [Wed, 8 Jul 2020 15:41:24 +0000 (08:41 -0700)]
genl: use <> for system includes

Be consistent about local versus system headers.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agortacct: drop unused header
Stephen Hemminger [Wed, 8 Jul 2020 15:40:20 +0000 (08:40 -0700)]
rtacct: drop unused header

4 years agoiplink_bareudp: use common include syntax
Stephen Hemminger [Wed, 8 Jul 2020 15:38:58 +0000 (08:38 -0700)]
iplink_bareudp: use common include syntax

Follow the precedent of other parts of iproute2 follow the example of:
  Standard libc headers
  Linux headers

  Iproute2 support headers

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: add 'disk' to 'fw_load_policy' string validation
Louis Peens [Fri, 19 Jun 2020 11:50:07 +0000 (13:50 +0200)]
devlink: add 'disk' to 'fw_load_policy' string validation

The 'fw_load_policy' devlink parameter supports the 'disk' value
since kernel v5.4, seems like there was some oversight in adding
this to iproute, fixed by this patch.

Signed-off-by: Louis Peens <louis.peens@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Document zero policer identifier
Ido Schimmel [Tue, 23 Jun 2020 20:06:09 +0000 (23:06 +0300)]
devlink: Document zero policer identifier

When setting a policer to a trap group, a value of "0" will unbind the
currently bound policer from the group.

The behavior is intentional and tested in kernel selftests, so document
it.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Suggested-by: Alex Kushnarov <alexanderk@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: flower: support multiple MPLS LSE match
Guillaume Nault [Wed, 1 Jul 2020 19:49:18 +0000 (21:49 +0200)]
tc: flower: support multiple MPLS LSE match

Add the new "mpls" keyword that can be used to match MPLS fields in
arbitrary Label Stack Entries.
LSEs are introduced by the "lse" keyword and followed by LSE options:
"depth", "label", "tc", "bos" and "ttl". The depth is manadtory, the
other options are optionals.

For example, the following filter drops MPLS packets having two labels,
where the first label is 21 and has TTL 64 and the second label is 22:

$ tc filter add dev ethX ingress proto mpls_uc flower mpls \
    lse depth 1 label 21 ttl 64 \
    lse depth 2 label 22 bos 1 \
    action drop

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip link: initial support for bareudp devices
Guillaume Nault [Wed, 1 Jul 2020 19:45:04 +0000 (21:45 +0200)]
ip link: initial support for bareudp devices

Bareudp devices provide a generic L3 encapsulation for tunnelling
different protocols like MPLS, IP, NSH, etc. inside a UDP tunnel.

This patch is based on original work from Martin Varghese:
https://lore.kernel.org/netdev/1570532361-15163-1-git-send-email-martinvarghesenokia@gmail.com/

Examples:

  - ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc

This creates a bareudp tunnel device which tunnels L3 traffic with
ethertype 0x8847 (unicast MPLS traffic). The destination port of the
UDP header will be set to 6635. The device will listen on UDP port 6635
to receive traffic.

  - ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto

Same as the MPLS example, but for IPv4. The "multiproto" keyword allows
the device to also tunnel IPv6 traffic.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agolib: fix checking of returned file handle size for cgroup
Dmitry Yakunin [Sun, 5 Jul 2020 16:18:12 +0000 (19:18 +0300)]
lib: fix checking of returned file handle size for cgroup

Before this patch check is happened only in case when we try to find
cgroup at cgroup2 mount point.

v2:
  - add Fixes line before Signed-off-by (David Ahern)

Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions")
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip fou: respect preferred_family for IPv6
Sorah Fukumori [Thu, 25 Jun 2020 21:07:12 +0000 (06:07 +0900)]
ip fou: respect preferred_family for IPv6

ip(8) accepts -family ipv6 (-6) option at the toplevel. It is
straightforward to support the existing option for modifying listener
on IPv6 addresses.

Maintain the backward compatibility by leaving ip fou -6 flag
implemented, while it's removed from the usage message.

Signed-off-by: Sorah Fukumori <her@sorah.jp>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: improve the qdisc show command
Anton Danilov [Fri, 3 Jul 2020 15:39:22 +0000 (18:39 +0300)]
tc: improve the qdisc show command

Before can be possible show only all qeueue disciplines on an interface.
There wasn't a way to get the qdisc info by handle or parent, only full
dump of the disciplines with a following grep/sed usage.

Now new and old options work as expected to filter a qdisc by handle or
parent.

Full syntax of the qdisc show command:

tc qdisc { show | list } [ dev STRING ] [ QDISC_ID ] [ invisible ]
  QDISC_ID := { root | ingress | handle QHANDLE | parent CLASSID }

This change doesn't require any changes in the kernel.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update bpf.h
Stephen Hemminger [Mon, 6 Jul 2020 17:54:35 +0000 (10:54 -0700)]
uapi: update bpf.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlint-health.8: use a single-font macro for a single argument
Bjarni Ingi Gislason [Mon, 29 Jun 2020 00:42:48 +0000 (00:42 +0000)]
devlint-health.8: use a single-font macro for a single argument

Use a single font macro for a single argument.

  Remove unnecessary quotes for a single-font macro.

  Join two lines into one.

  The output of "nroff" and "groff" is unchanged.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink-dev.8: use a single-font macro for one argument
Bjarni Ingi Gislason [Sun, 28 Jun 2020 23:58:40 +0000 (23:58 +0000)]
devlink-dev.8: use a single-font macro for one argument

Use a single-font macro for one argument.

  Remove unnecessary quotes for a single font macro.

  Join some lines into one.

  The output of "nroff" and "groff" is unchanged, except for a font
change in two lines.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink.8: Use a single-font macro for a single argument
Bjarni Ingi Gislason [Sun, 28 Jun 2020 23:26:12 +0000 (23:26 +0000)]
devlink.8: Use a single-font macro for a single argument

Use a single-font macro for a single argument

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman8/bridge.8: fix misuse of two-fonts macros
Bjarni Ingi Gislason [Sun, 28 Jun 2020 22:46:26 +0000 (22:46 +0000)]
man8/bridge.8: fix misuse of two-fonts macros

Use a single-font macro for a single argument.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agolibnetlink.3: display section numbers in roman font, not boldface
Bjarni Ingi Gislason [Sun, 28 Jun 2020 16:26:15 +0000 (16:26 +0000)]
libnetlink.3: display section numbers in roman font, not boldface

Typeset section numbers in roman font, see man-pages(7).

###

  Details:

Output is from: test-groff -b -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

<./man/man3/libnetlink.3>:53 (macro BR): only 1 argument, but more are expected
<./man/man3/libnetlink.3>:132 (macro BR): only 1 argument, but more are expected
<./man/man3/libnetlink.3>:134 (macro BR): only 1 argument, but more are expected
<./man/man3/libnetlink.3>:197 (macro BR): only 1 argument, but more are expected
<./man/man3/libnetlink.3>:198 (macro BR): only 1 argument, but more are expected

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
4 years agoMerge branch 'rdma-raw-format-dumps' into next
David Ahern [Sun, 5 Jul 2020 18:11:49 +0000 (18:11 +0000)]
Merge branch 'rdma-raw-format-dumps' into next

Leon Romanovsky  says:

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

The following series adds support to get the RDMA resource data in RAW
format. The main motivation for doing this is to enable vendors to
return the entire QP/CQ/MR data without a need from the vendor to set
each field separately.

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

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: Add support to get MR in raw format
Maor Gottlieb [Wed, 24 Jun 2020 10:40:12 +0000 (13:40 +0300)]
rdma: Add support to get MR in raw format

Add the required support to print MR data in raw format.
Example:

$rdma res show mr dev mlx5_1 mrn 2 -r -j
[{"ifindex":7,"ifname":"mlx5_1",
"data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,0,216,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: Add support to get CQ in raw format
Maor Gottlieb [Wed, 24 Jun 2020 10:40:11 +0000 (13:40 +0300)]
rdma: Add support to get CQ in raw format

Add the required support to print CQ data in raw format.
Example:

$rdma res show cq dev mlx5_2 cqn 1 -r -j
[{"ifindex":8,"ifname":"mlx5_2",
"data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: Add support to get QP in raw format
Maor Gottlieb [Wed, 24 Jun 2020 10:40:10 +0000 (13:40 +0300)]
rdma: Add support to get QP in raw format

Add 'raw' argument to get the resource in raw format.
When RDMA_NLDEV_ATTR_RES_RAW is set in the netlink message,
then the resource fields are in raw format, print it as byte array.

Example:
$rdma res show qp link rocep0s12f0/1 lqpn 1137 -j -r
[{"ifindex":7,"ifname":"mlx5_1","port":1,
"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: update uapi headers
Maor Gottlieb [Wed, 24 Jun 2020 10:40:09 +0000 (13:40 +0300)]
rdma: update uapi headers

Update rdma_netlink.h file upto kernel commit 65959522f806
("RDMA: Add support to dump resource tracker in RAW format")

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoMerge branch 'tc-qevents' into next
David Ahern [Sun, 5 Jul 2020 15:45:48 +0000 (15:45 +0000)]
Merge branch 'tc-qevents' into next

Petr Machata  says:

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

To allow configuring user-defined actions as a result of inner workings of
a qdisc, a concept of qevents was recently introduced to the kernel.
Qevents are attach points for TC blocks, where filters can be put that are
executed as the packet hits well-defined points in the qdisc algorithms.
The attached blocks can be shared, in a manner similar to clsact ingress
and egress blocks, arbitrary classifiers with arbitrary actions can be put
on them, etc.

For example:

 # tc qdisc add dev eth0 root handle 1: \
red limit 500K avpkt 1K qevent early_drop block 10
 # tc filter add block 10 \
matchall action mirred egress mirror dev eth1

This patch set introduces the corresponding iproute2 support. Patch #1 adds
the new netlink attribute enumerators. Patch #2 adds a set of helpers to
implement qevents, and #3 adds a generic documentation to tc.8. Patch #4
then adds two new qevents to the RED qdisc: mark and early_drop.

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

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agotc: q_red: Add support for qevents "mark" and "early_drop"
Petr Machata [Tue, 30 Jun 2020 10:14:52 +0000 (13:14 +0300)]
tc: q_red: Add support for qevents "mark" and "early_drop"

The "early_drop" qevent matches packets that have been early-dropped. The
"mark" qevent matches packets that have been ECN-marked.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoman: tc: Describe qevents
Petr Machata [Tue, 30 Jun 2020 10:14:51 +0000 (13:14 +0300)]
man: tc: Describe qevents

Add some general remarks about qevents.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agotc: Add helpers to support qevent handling
Petr Machata [Tue, 30 Jun 2020 10:14:50 +0000 (13:14 +0300)]
tc: Add helpers to support qevent handling

Introduce a set of helpers to make it easy to add support for qevents into
qdisc.

The idea behind this is that qevent types will be generally reused between
qdiscs, rather than each having a completely idiosyncratic set of qevents.
The qevent module holds functions for parsing, dumping and formatting of
these common qevent types, and for dispatch to the appropriate set of
handlers based on the qevent name.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoaction police: make 'mtu' could be set independently in police action
Po Liu [Mon, 29 Jun 2020 02:04:20 +0000 (10:04 +0800)]
action police: make 'mtu' could be set independently in police action

Current police action must set 'rate' and 'burst'. 'mtu' parameter
set the max frame size and could be set alone without 'rate' and 'burst'
in some situation. Offloading to hardware for example, 'mtu' could limit
the flow max frame size.

Signed-off-by: Po Liu <po.liu@nxp.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoaction police: change the print message quotes style
Po Liu [Mon, 29 Jun 2020 02:04:19 +0000 (10:04 +0800)]
action police: change the print message quotes style

Change the double quotes to single quotes in fprintf message to make it
more readable.

Signed-off-by: Po Liu <po.liu@nxp.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoadd support to keepalived rtm_protocol
Alexandre Cassen [Wed, 24 Jun 2020 16:21:25 +0000 (18:21 +0200)]
add support to keepalived rtm_protocol

Following inclusion in net-next, extend rtnl_rtprot_tab and rt_protos
to support Keepalived.

Signed-off-by: Alexandre Cassen <acassen@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoMerge branch 'devlink-port-mac-addr' into next
David Ahern [Sun, 5 Jul 2020 14:49:53 +0000 (14:49 +0000)]
Merge branch 'devlink-port-mac-addr' into next

Parav Pandit  says:

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

Currently ip link set dev <pfndev> vf <vf_num> <param> <value> has
few below limitations.

1. Command is limited to set VF parameters only.
It cannot set the default MAC address for the PCI PF.

2. It can be set only on system where PCI SR-IOV is supported.
In smartnic based system, eswitch of a NIC resides on a different
embedded cpu which has the VF and PF representors for the SR-IOV
support on a host system in which this smartnic is plugged-in.

3. It cannot setup the function attributes of sub-function described
in detail in comprehensive RFC [1] and [2].

This series covers the first small part to let user query and set MAC
address (hardware address) of a PCI PF/VF which is represented by
devlink port.

[1] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/
[2] https://marc.info/?l=linux-netdev&m=158555928517777&w=2

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

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Support setting port function hardware address
Parav Pandit [Tue, 23 Jun 2020 10:44:25 +0000 (10:44 +0000)]
devlink: Support setting port function hardware address

Support setting devlink port function hardware address.

Example of a PCI VF port which supports a port function:
Set hardware address of the VF's port function.

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
  function:
    hw_addr 00:00:00:00:00:00

$ devlink port function set pci/0000:06:00.0/2 hw_addr 00:11:22:33:44:55

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
  function:
    hw_addr 00:11:22:33:44:55

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Support querying hardware address of port function
Parav Pandit [Tue, 23 Jun 2020 10:44:24 +0000 (10:44 +0000)]
devlink: Support querying hardware address of port function

Add support to query the hardware address of function represented
by devlink port function.

Example of a PCI VF port which supports a port function:
$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
  function:
    hw_addr 00:11:22:33:44:66

$ devlink port show pci/0000:06:00.0/2 -jp
{
    "port": {
        "pci/0000:06:00.0/2": {
            "type": "eth",
            "netdev": "enp6s0pf0vf1",
            "flavour": "pcivf",
            "pfnum": 0,
            "vfnum": 1,
            "function": {
                "hw_addr": "00:11:22:33:44:66"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: Move devlink port code at start to reuse
Parav Pandit [Tue, 23 Jun 2020 10:44:23 +0000 (10:44 +0000)]
devlink: Move devlink port code at start to reuse

To reuse print routines for port function in subsequent patch, move
print routine specific to devlink device at start of the file.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoUpdate kernel headers
David Ahern [Sun, 5 Jul 2020 14:33:15 +0000 (14:33 +0000)]
Update kernel headers

Update kernel headers to commit:
   e1f046704404 ("Merge branch 'qlogic-use-generic-power-management'")

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoman/tc: remove obsolete reference to ipchains
Stephen Hemminger [Wed, 24 Jun 2020 19:13:46 +0000 (12:13 -0700)]
man/tc: remove obsolete reference to ipchains

It isn't Linux 2.2 anymore.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip address: Fix loop initial declarations are only allowed in C99
Roi Dayan [Thu, 11 Jun 2020 17:35:43 +0000 (20:35 +0300)]
ip address: Fix loop initial declarations are only allowed in C99

On some distros, i.e. rhel 7.6, compilation fails with the following:

ipaddress.c: In function ‘lookup_flag_data_by_name’:
ipaddress.c:1260:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < ARRAY_SIZE(ifa_flag_data); ++i) {
  ^
ipaddress.c:1260:2: note: use option -std=c99 or -std=gnu99 to compile your code

This commit fixes the single place needed for compilation to pass.

Fixes: 9d59c86e575b ("iproute2: ip addr: Organize flag properties structurally")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update to magic.h
Stephen Hemminger [Thu, 11 Jun 2020 16:52:38 +0000 (09:52 -0700)]
uapi: update to magic.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add 'mirror' trap action
Ido Schimmel [Sun, 7 Jun 2020 08:36:47 +0000 (11:36 +0300)]
devlink: Add 'mirror' trap action

Allow setting 'mirror' trap action for traps that support it. Extend the
devlink-trap man page and bash completion accordingly.

Example:

# devlink -jp trap show netdevsim/netdevsim10 trap igmp_query
{
    "trap": {
        "netdevsim/netdevsim10": [ {
                "name": "igmp_query",
                "type": "control",
                "generic": true,
                "action": "mirror",
                "group": "mc_snooping"
            } ]
    }
}

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add 'control' trap type
Ido Schimmel [Sun, 7 Jun 2020 08:36:46 +0000 (11:36 +0300)]
devlink: Add 'control' trap type

This type is used for traps that trap control packets such as ARP
request and IGMP query to the CPU.

Example:

# devlink -jp trap show netdevsim/netdevsim10 trap igmp_v1_report
{
    "trap": {
        "netdevsim/netdevsim10": [ {
                "name": "igmp_v1_report",
                "type": "control",
                "generic": true,
                "action": "trap",
                "group": "mc_snooping"
            } ]
    }
}

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: update include files
Stephen Hemminger [Thu, 11 Jun 2020 16:46:46 +0000 (09:46 -0700)]
devlink: update include files

Use the tool iwyu to get more complete list of includes for
all the bits used by devlink.

This should also fix build with musl libc.

Fixes: c4dfddccef4e ("fix JSON output of mon command")
Reported-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: support for nexthop id in fdb entries
Roopa Prabhu [Thu, 11 Jun 2020 00:35:21 +0000 (17:35 -0700)]
bridge: support for nexthop id in fdb entries

This patch adds support to assign a nexthop group
id to an fdb entry.

$bridge fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnexthop: support for fdb nexthops
Roopa Prabhu [Thu, 11 Jun 2020 00:35:20 +0000 (17:35 -0700)]
ipnexthop: support for fdb nexthops

This patch adds support to add and delete
ecmp nexthops of type fdb. Such nexthops can
be linked to vxlan fdb entries.

$ip nexthop add id 12 via 172.16.1.2 fdb
$ip nexthop add id 13 via 172.16.1.3 fdb
$ip nexthop add id 102 group 12/13 fdb

$bridge fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Mon, 8 Jun 2020 14:40:54 +0000 (14:40 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agouapi: update headers
Stephen Hemminger [Fri, 5 Jun 2020 15:36:54 +0000 (08:36 -0700)]
uapi: update headers

Update kernel headers from 5.8.0 merge

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge git://git.kernel.org/pub/scm/network/iproute2/iproute2-next
Stephen Hemminger [Fri, 5 Jun 2020 15:33:29 +0000 (08:33 -0700)]
Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-next

4 years agov5.7.0
Stephen Hemminger [Wed, 3 Jun 2020 03:35:00 +0000 (20:35 -0700)]
v5.7.0

4 years agonexthop: Fix Deletion display
Donald Sharp [Sat, 30 May 2020 12:16:37 +0000 (08:16 -0400)]
nexthop: Fix Deletion display

Actually display that deletions are happening
when monitoring nexthops.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: fix comment in xfrm.h
Stephen Hemminger [Mon, 1 Jun 2020 15:07:02 +0000 (08:07 -0700)]
uapi: fix comment in xfrm.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoiproute2: ip addr: Add support for setting 'optimistic'
Ian K. Coolidge [Wed, 27 May 2020 18:03:46 +0000 (11:03 -0700)]
iproute2: ip addr: Add support for setting 'optimistic'

optimistic DAD is controllable via sysctl for an interface
or all interfaces on the system. This would affect addresses
added by the kernel only.

Recent kernels, however, have enabled support for adding optimistic
address via userspace. This plumbs that support.

Signed-off-by: David Ahern <dsahern@gmail.com>