]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
4 years agoip link: Add support to get SR-IOV VF node GUID and port GUID
Danit Goldberg [Mon, 18 Nov 2019 07:49:12 +0000 (09:49 +0200)]
ip link: Add support to get SR-IOV VF node GUID and port GUID

Extend iplink to show VF GUIDs (IFLA_VF_IB_NODE_GUID, IFLA_VF_IB_PORT_GUID),
giving the ability for user-space application to print GUID values.
This ability is added to the one of setting new node GUID and port GUID values.

Suitable ip link command:
- ip link show <device>

For example:
- ip link set ib4 vf 0 node_guid 22:44:33:00:33:11:00:33
- ip link set ib4 vf 0 port_guid 10:21:33:12:00:11:22:10
- ip link show ib4
ib4: <BROADCAST,MULTICAST> mtu 4092 qdisc noop state DOWN mode DEFAULT group default qlen 256
link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0     link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff,
spoof checking off, NODE_GUID 22:44:33:00:33:11:00:33, PORT_GUID 10:21:33:12:00:11:22:10, link-state disable, trust off, query_rss off

Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'nsid-cleanup' into next
David Ahern [Sat, 9 Nov 2019 01:34:24 +0000 (01:34 +0000)]
Merge branch 'nsid-cleanup' into next

Guillaume Nault  says:

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

It's currently hard to review ipnetns. The netns ids are inconsistently
treated as signed or unsigned and most helper functions aren't prepared
to use negative ids.

Netns id attributes can be negative: NETNSA_NSID_NOT_ASSIGNED =3D=3D -1.
So let's consistently treat nsids as signed and also reject negative
values in functions that are supposed to only handle assigned netns
ids.

While there, let's drop the extra blank line generated by some command
line parsing errors (patch 5/5).

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

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: remove blank lines printed by invarg() messages
Guillaume Nault [Fri, 8 Nov 2019 17:00:20 +0000 (18:00 +0100)]
ipnetns: remove blank lines printed by invarg() messages

Since invarg() automatically adds a '\n' character, having one in the
error message generates an extra blank line.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: don't print unassigned nsid in json export
Guillaume Nault [Fri, 8 Nov 2019 17:00:18 +0000 (18:00 +0100)]
ipnetns: don't print unassigned nsid in json export

Don't output the nsid and current-nsid json keys if they're not set.
Otherwise a parser would have to special case the "not-assigned"
string.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: harden helper functions wrt. negative netns ids
Guillaume Nault [Fri, 8 Nov 2019 17:00:15 +0000 (18:00 +0100)]
ipnetns: harden helper functions wrt. negative netns ids

Negative values are invalid netns ids. Ensure that helper functions
don't accidentally try to process them.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: fix misleading comment about 'ip monitor nsid'
Guillaume Nault [Fri, 8 Nov 2019 17:00:14 +0000 (18:00 +0100)]
ipnetns: fix misleading comment about 'ip monitor nsid'

'ip monitor nsid' doesn't call print_nsid().

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: treat NETNSA_NSID and NETNSA_CURRENT_NSID as signed
Guillaume Nault [Fri, 8 Nov 2019 17:00:12 +0000 (18:00 +0100)]
ipnetns: treat NETNSA_NSID and NETNSA_CURRENT_NSID as signed

These attributes are signed (with -1 meaning NETNSA_NSID_NOT_ASSIGNED).
So let's use rta_getattr_s32() and print_int() instead of their
unsigned counterpart to avoid confusion.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: allow full range of resource sizes
Jakub Kicinski [Tue, 5 Nov 2019 21:17:07 +0000 (13:17 -0800)]
devlink: allow full range of resource sizes

Resource size is a 64 bit attribute at netlink level.
Make the command line argument 64 bit as well.

Fixes: 8cd644095842 ("devlink: Add support for devlink resource abstraction")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: catch missing strings in dl_args_required
Jakub Kicinski [Tue, 5 Nov 2019 21:17:06 +0000 (13:17 -0800)]
devlink: catch missing strings in dl_args_required

Currently if dl_args_required doesn't contain a string
for a given option the fact that the option is missing
is silently ignored.

Add a catch-all case and print a generic error.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: fix referencing namespace by PID
Jakub Kicinski [Tue, 5 Nov 2019 21:17:05 +0000 (13:17 -0800)]
devlink: fix referencing namespace by PID

netns parameter for devlink reload is supposed to take PID
as well as string name. However, the PID parsing has two
bugs:
 - the opts->netns member is unsigned so the < 0
   condition is always false;
 - the parameter list is not rewinded after parsing as
   a name, so parsing as a pid uses the wrong argument.

Fixes: 08e8e1ca3e05 ("devlink: extend reload command to add support for network namespace change")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Sat, 9 Nov 2019 00:38:37 +0000 (00:38 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: require resource parameters
Jakub Kicinski [Tue, 5 Nov 2019 21:13:36 +0000 (13:13 -0800)]
devlink: require resource parameters

If devlink resource set parameters are not provided it crashes:
$ devlink resource set netdevsim/netdevsim0
Segmentation fault (core dumped)

This is because even though DL_OPT_RESOURCE_PATH and
DL_OPT_RESOURCE_SIZE are passed as o_required, the validation
table doesn't contain a relevant string.

Fixes: 8cd644095842 ("devlink: Add support for devlink resource abstraction")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: implement support for action flags
Vlad Buslov [Wed, 30 Oct 2019 14:20:40 +0000 (16:20 +0200)]
tc: implement support for action flags

Implement setting and printing of action flags with single available flag
value "no_percpu" that translates to kernel UAPI TCA_ACT_FLAGS value
TCA_ACT_FLAGS_NO_PERCPU_STATS. Update man page with information regarding
usage of action flags.

Example usage:

 # tc actions add action gact drop no_percpu
 # sudo tc actions list action gact
 total acts 1

        action order 0: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 0
        no_percpu

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Sat, 2 Nov 2019 14:43:01 +0000 (07:43 -0700)]
Update kernel headers

Update kernel headers to commit:
    c23fcbbc6aa4 ("tc-testing: added tests with cookie for conntrack TC action")

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolibnetlink.c, ss.c: properly handle fread() errors
Michał Łyszczek [Tue, 29 Oct 2019 11:13:11 +0000 (12:13 +0100)]
libnetlink.c, ss.c: properly handle fread() errors

fread(3) returns size_t data type which is unsigned, thus check
`if (fread(...) < 0)' is always false. To check if fread(3) has
failed, user should check error indicator with ferror(3).

This commit also changes read logic a little bit by being less
forgiving for errors. Previous logic was checking if fread(3)
read *at least* required ammount of data, now code checks if
fread(3) read *exactly* expected ammount of data. This makes
sense because code parses very specific binary file, and reading
even 1 less/more byte than expected, will later corrupt data anyway.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: remove duplicated NEXT_ARG_FWD() in parse_ct()
Vlad Buslov [Tue, 29 Oct 2019 17:53:46 +0000 (19:53 +0200)]
tc: remove duplicated NEXT_ARG_FWD() in parse_ct()

Function parse_ct() manually calls NEXT_ARG_FWD() after
parse_action_control_dflt(). This is redundant because
parse_action_control_dflt() modifies argc and argv itself. Moreover, such
implementation parses out any following actions option. For example, adding
action ct with cookie errors:

$ sudo tc actions add action ct cookie 111111111111
Bad action type 111111111111
Usage: ... gact <ACTION> [RAND] [INDEX]
Where:  ACTION := reclassify | drop | continue | pass | pipe |
                  goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
        RAND := random <RANDTYPE> <ACTION> <VAL>
        RANDTYPE := netrand | determ
        VAL : = value not exceeding 10000
        JUMP_COUNT := Absolute jump from start of action list
        INDEX := index value used

With fix:

$ sudo tc actions add action ct cookie 111111111111
$ sudo tc actions list action ct
total acts 1

        action order 0: ct zone 0 pipe
         index 1 ref 1 bind 0
        cookie 111111111111

Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip: fix ip route show json output for multipath nexthops
Julien Fortin [Thu, 26 Sep 2019 15:29:34 +0000 (17:29 +0200)]
ip: fix ip route show json output for multipath nexthops

print_rta_multipath doesn't support JSON output:

{
    "dst":"27.0.0.13",
    "protocol":"bgp",
    "metric":20,
    "flags":[],
    "gateway":"169.254.0.1"dev uplink-1 weight 1 ,
    "flags":["onlink"],
    "gateway":"169.254.0.1"dev uplink-2 weight 1 ,
    "flags":["onlink"]
},

since RTA_MULTIPATH has nested objects we should print them
in a json array.

With the path we have the following output:

{
    "flags": [],
    "dst": "36.0.0.13",
    "protocol": "bgp",
    "metric": 20,
    "nexthops": [
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-1"
        },
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-2"
        }
    ]
}

Fixes: 663c3cb23103f4 ("iproute: implement JSON and color output")
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agordma/sys.c: fix possible out-of-bound array access
Michał Łyszczek [Thu, 24 Oct 2019 21:20:43 +0000 (23:20 +0200)]
rdma/sys.c: fix possible out-of-bound array access

netns_modes_str[] array has 2 elements, when netns_mode is 2,
condition (2 <= 2) will be true and `mode_str = netns_modes_str[2]'
will be executed, which will result in out-of-bound read.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'alt-names' into next
David Ahern [Mon, 28 Oct 2019 14:38:24 +0000 (07:38 -0700)]
Merge branch 'alt-names' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: allow to use alternative names as handle
Jiri Pirko [Thu, 24 Oct 2019 10:20:52 +0000 (12:20 +0200)]
ip: allow to use alternative names as handle

Extend ll_name_to_index() to get the index of a netdevice using
alternative interface name. Allow alternative long names to pass checks
in couple of ip link/addr commands.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: add support for alternative name addition/deletion/list
Jiri Pirko [Thu, 24 Oct 2019 10:20:51 +0000 (12:20 +0200)]
ip: add support for alternative name addition/deletion/list

Implement addition/deletion of lists of properties, currently
alternative ifnames. Also extent the ip link show command to list them.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolib/ll_map: cache alternative names
Jiri Pirko [Thu, 24 Oct 2019 10:20:50 +0000 (12:20 +0200)]
lib/ll_map: cache alternative names

Alternative names are related to the "parent name". That means,
whenever ll_remember_index() is called to add/delete/update and it founds
the "parent name" im object by ifindex, processes related
alternative name im objects too. Put them in a list which holds the
relationship with the parent.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'rdma-mr-stats' into next
David Ahern [Sun, 27 Oct 2019 17:28:49 +0000 (10:28 -0700)]
Merge branch 'rdma-mr-stats' into next

Leon Romanovsky  says:

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

This is supplementary part of "ODP information and statistics"
kernel series.
https://lore.kernel.org/linux-rdma/20191016062308.11886-1-leon@kernel.org

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

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agordma: Document MR statistics
Erez Alfasi [Wed, 23 Oct 2019 10:38:54 +0000 (13:38 +0300)]
rdma: Document MR statistics

Add document of accessing the MR counters into
the rdma-statistic man pages.

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agordma: Add "stat show mr" support
Erez Alfasi [Wed, 23 Oct 2019 10:38:53 +0000 (13:38 +0300)]
rdma: Add "stat show mr" support

Show MR counters statistics. Filters are also enabled.

Examples:
~$: rdma stat show mr
dev mlx5_0 mrn 8 page_faults 1221 page_invalidations 0
dev mlx5_0 mrn 9 page_faults 1221 page_invalidations 0

~$: rdma stat show mr mrn 8
dev mlx5_0 mrn 8 page_faults 1221 page_invalidations 0

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoMerge branch 'master' into next
David Ahern [Sun, 27 Oct 2019 16:53:46 +0000 (09:53 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodon't install examples
Stephen Hemminger [Wed, 23 Oct 2019 17:21:06 +0000 (10:21 -0700)]
don't install examples

No longer relevant

4 years agoremove out of date README
Stephen Hemminger [Wed, 23 Oct 2019 17:19:45 +0000 (10:19 -0700)]
remove out of date README

The original old README refers to stuff from the pre 2.6
era including cbz. Just kill it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoipnetns: do not check netns NAME when -all is specified
Michał Łyszczek [Tue, 22 Oct 2019 20:09:23 +0000 (22:09 +0200)]
ipnetns: do not check netns NAME when -all is specified

When `-all' argument is specified netns runs cmd on all namespaces
and NAME is not used, but netns nevertheless checks if argv[1] is a
valid namespace name ignoring the fact that argv[1] contains cmd
and not NAME. This results in bug where user cannot specify
absolute path to command.

    # ip -all netns exec /usr/bin/whoami
    Invalid netns name "/usr/bin/whoami"

This forces user to have his command in PATH.

Solution is simply to not validate argv[1] when `-all' argument is
specified.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoexamples: remove diffserv
Stephen Hemminger [Wed, 23 Oct 2019 16:13:55 +0000 (09:13 -0700)]
examples: remove diffserv

The diffserv examples here are out of date and incomplete.
Remove them rather than try and fix them.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoexamples: remove gaiconf
Stephen Hemminger [Wed, 23 Oct 2019 16:12:19 +0000 (09:12 -0700)]
examples: remove gaiconf

The gaiconf script is a workaround for something now handled
in distros as part of libc.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoexamples: remove out of date cbq stuff
Stephen Hemminger [Tue, 22 Oct 2019 16:53:26 +0000 (09:53 -0700)]
examples: remove out of date cbq stuff

The examples around cbq are out of date and never updated.
There are better ways to achieve same kind of thing with more
modern qdisc.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip-netns.8: document target-nsid and nsid options of list-id
Nicolas Dichtel [Wed, 16 Oct 2019 15:00:52 +0000 (17:00 +0200)]
ip-netns.8: document target-nsid and nsid options of list-id

This is a follow up of the commit eaefb07804a1 ("ipnetns: enable to dump
nsid conversion table").

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip-netns.8: document the 'auto' keyword of 'ip netns set'
Nicolas Dichtel [Wed, 16 Oct 2019 15:00:51 +0000 (17:00 +0200)]
ip-netns.8: document the 'auto' keyword of 'ip netns set'

This is a follow up of the commit ebe3ce2fcc5f ("ipnetns: parse nsid as a
signed integer").

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: remove "defaut group" sentence on ip link
Florent Fourcot [Tue, 15 Oct 2019 15:35:50 +0000 (17:35 +0200)]
man: remove "defaut group" sentence on ip link

By default, all devices are listed, not only the default group.

Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
Signed-off-by: Romain Bellan <romain.bellan@wifirst.fr>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoss: allow dumping kTLS info
Davide Caratti [Mon, 7 Oct 2019 10:16:44 +0000 (12:16 +0200)]
ss: allow dumping kTLS info

now that INET_DIAG_INFO requests can dump TCP ULP information, extend 'ss'
to allow diagnosing kTLS when it is attached to a TCP socket. While at it,
import kTLS uAPI definitions from the latest net-next tree.

CC: Andrea Claudi <aclaudi@redhat.com>
Co-developed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers and import tls.h
David Ahern [Tue, 15 Oct 2019 02:54:12 +0000 (19:54 -0700)]
Update kernel headers and import tls.h

Update kernel headers to commit:
    85a83a8fca7f ("Merge branch 'PTP-driver-refactoring-for-SJA1105-DSA'")

and add tls.h.

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoipnetns: enable to dump nsid conversion table
Nicolas Dichtel [Mon, 7 Oct 2019 13:44:47 +0000 (15:44 +0200)]
ipnetns: enable to dump nsid conversion table

This patch enables to dump/get nsid from a netns into another netns.

Example:
$ ./test.sh
+ ip netns add foo
+ ip netns add bar
+ touch /var/run/netns/init_net
+ mount --bind /proc/1/ns/net /var/run/netns/init_net
+ ip netns set init_net 11
+ ip netns set foo 12
+ ip netns set bar 13
+ ip netns
init_net (id: 11)
bar (id: 13)
foo (id: 12)
+ ip -n foo netns set init_net 21
+ ip -n foo netns set foo 22
+ ip -n foo netns set bar 23
+ ip -n foo netns
init_net (id: 21)
bar (id: 23)
foo (id: 22)
+ ip -n bar netns set init_net 31
+ ip -n bar netns set foo 32
+ ip -n bar netns set bar 33
+ ip -n bar netns
init_net (id: 31)
bar (id: 33)
foo (id: 32)
+ ip netns list-id target-nsid 12
nsid 21 current-nsid 11 (iproute2 netns name: init_net)
nsid 22 current-nsid 12 (iproute2 netns name: foo)
nsid 23 current-nsid 13 (iproute2 netns name: bar)
+ ip -n foo netns list-id target-nsid 21
nsid 11 current-nsid 21 (iproute2 netns name: init_net)
nsid 12 current-nsid 22 (iproute2 netns name: foo)
nsid 13 current-nsid 23 (iproute2 netns name: bar)
+ ip -n bar netns list-id target-nsid 33 nsid 32
nsid 32 current-nsid 32 (iproute2 netns name: foo)
+ ip -n bar netns list-id target-nsid 31 nsid 32
nsid 12 current-nsid 32 (iproute2 netns name: foo)
+ ip netns list-id nsid 13
nsid 13 (iproute2 netns name: bar)

CC: Petr Oros <poros@redhat.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Petr Oros <poros@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Fix inconsistency between command input and output
Aya Levin [Wed, 2 Oct 2019 14:35:16 +0000 (17:35 +0300)]
devlink: Fix inconsistency between command input and output

In devlink health show command the reporter's name parameter is called
reporter, but in the output the reporter's name is referred to as name

Before this patch:
$ devlink health show pci/0000:04:00.0 reporter tx
pci/0000:04:00.0:
   name tx
     state healthy error 0 recover 0 grace_period 500 auto_recover true

After this patch:
$ devlink health show pci/0000:04:00.0 reporter tx
pci/0000:04:00.0:
   reporter tx
     state healthy error 0 recover 0 grace_period 500 auto_recover true

Reported-by: Jiri Pirko <jiri@mellanox.com>
Fixes: 2f1242efe9d0 ("devlink: Add devlink health show command")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Left justification on FMSG output
Aya Levin [Wed, 2 Oct 2019 14:35:15 +0000 (17:35 +0300)]
devlink: Left justification on FMSG output

FMSG output is dynamic, space separator must be on the left hand side of
the value. Otherwise output has redundant left indentation regardless
the hierarchy.

Before the patch:
 Common config: SQ: stride size: 64 size: 1024
 CQ: stride size: 64 size: 1024
 SQs:
   channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0
   channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0
   channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0
   channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0

With the patch:
Common config: SQ: stride size: 64 size: 1024
CQ: stride size: 64 size: 1024
SQs:
  channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0
  channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0
  channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0
  channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0

Fixes: 844a61764c6f ("devlink: Add helper functions for name and value separately")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add helper for left justification print
Aya Levin [Wed, 2 Oct 2019 14:35:14 +0000 (17:35 +0300)]
devlink: Add helper for left justification print

Introduce a helper function which wraps code that adds a left hand side
space separator unless it follows a newline.

Fixes: e3d0f0c0e3d8 ("devlink: add option to generate JSON output")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fix segmentation fault on gact action
Andrea Claudi [Tue, 1 Oct 2019 10:32:17 +0000 (12:32 +0200)]
tc: fix segmentation fault on gact action

tc segfaults if gact action is used without action or index:

$ ip link add type dummy
$ tc actions add action pipe index 1
$ tc filter add dev dummy0 parent ffff: protocol ip \
  pref 10 u32 match ip src 127.0.0.2 flowid 1:10 action gact
Segmentation fault

We expect tc to fail gracefully with an error message.

This happens if gact is the last argument of the incomplete
command. In this case the "gact" action is parsed, the macro
NEXT_ARG_FWD() is executed and the next matches() crashes
because of null argv pointer.

To avoid this, simply use NEXT_ARG() instead.

With this change in place:

$ ip link add type dummy
$ tc actions add action pipe index 1
$ tc filter add dev dummy0 parent ffff: protocol ip \
  pref 10 u32 match ip src 127.0.0.2 flowid 1:10 action gact
Command line is not complete. Try option "help"

Fixes: fa4958897314 ("tc: Fix binding of gact action by index.")
Reported-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: add reference to `ip route add encap ... src`
Damien Robert [Mon, 30 Sep 2019 21:11:37 +0000 (23:11 +0200)]
man: add reference to `ip route add encap ... src`

The ability to specify the source adresse for 'encap ip' / 'encap ip6'
was added in commit 94a8722f2f78f04c47678cf864ac234a38366709 but the man
page was not updated.

Also fixes a missing page in ip-route.8.in.

Signed-off-by: Damien Robert <damien.olivier.robert+git@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'master' into next
David Ahern [Mon, 7 Oct 2019 22:02:36 +0000 (22:02 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: extend reload command to add support for network namespace change
Jiri Pirko [Thu, 3 Oct 2019 09:51:15 +0000 (11:51 +0200)]
devlink: extend reload command to add support for network namespace change

Extend existing devlink reload command by adding option "netns" by which
user can instruct kernel to reload the devlink instance into specified
network namespace.

Example:

$ ip netns add testns1
$ devlink dev reload netdevsim/netdevsim10 netns testns1

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agodevlink: introduce cmdline option to switch to a different namespace
Jiri Pirko [Thu, 3 Oct 2019 09:51:14 +0000 (11:51 +0200)]
devlink: introduce cmdline option to switch to a different namespace

Similar to ip tool, add an option to devlink to operate under certain
network namespace. Unfortunately, "-n" is already taken, so use "-N"
instead.

Example:

$ devlink -N testns1 dev show

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agordma: Relax requirement to have PID for HW objects
Leon Romanovsky [Wed, 2 Oct 2019 13:49:34 +0000 (16:49 +0300)]
rdma: Relax requirement to have PID for HW objects

RDMA has weak connection between PIDs and HW objects, because
the latter tied to file descriptors for their lifetime management.

The outcome of such connection is that for the following scenario,
the returned PID will be 0 (not-valid):
 1. Create FD and context
 2. Share it with ephemeral child
 3. Create any object and exit that child

This flow was revealed in testing environment and of course real users
are not running such scenario, because it makes no sense at all in RDMA
world.

Let's do two changes in the code to support such workflow anyway:
 1. Remove need to provide PID/kernel name. Code already supports it,
    just need to remove extra validation.
 2. Ball-out in case PID is 0.

Link: https://lore.kernel.org/linux-rdma/20191002123245.18153-2-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agoUpdate kernel headers
David Ahern [Mon, 7 Oct 2019 20:43:13 +0000 (20:43 +0000)]
Update kernel headers

Update kernel headers to commit:
    940f13821528 ("Merge branch 'dpaa2-eth-misc-cleanup'")

Signed-off-by: David Ahern <dsahern@kernel.org>
4 years agouapi: update btf from 5.4-rc1
Stephen Hemminger [Tue, 1 Oct 2019 15:55:01 +0000 (08:55 -0700)]
uapi: update btf from 5.4-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoipneigh: neigh get support
Roopa Prabhu [Tue, 1 Oct 2019 04:52:23 +0000 (21:52 -0700)]
ipneigh: neigh get support

This patch adds support to lookup a neigh entry
using recently added support in the kernel using RTM_GETNEIGH

example:
$ip neigh get 10.0.2.4 dev test-dummy0
10.0.2.4 dev test-dummy0 lladdr de:ad:be:ef:13:37 PERMANENT

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Tested-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agobridge: fdb get support
Roopa Prabhu [Tue, 1 Oct 2019 04:52:22 +0000 (21:52 -0700)]
bridge: fdb get support

This patch adds support to lookup a bridge fdb entry
using recently added support in the kernel using RTM_GETNEIGH
(and AF_BRIDGE family).

example:
$bridge fdb get 02:02:00:00:00:03 dev test-dummy0 vlan 1002
02:02:00:00:00:03 dev test-dummy0 vlan 1002 master bridge

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Tested-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: fix ip route show json output for multipath nexthops
Julien Fortin [Thu, 26 Sep 2019 15:29:34 +0000 (17:29 +0200)]
ip: fix ip route show json output for multipath nexthops

print_rta_multipath doesn't support JSON output:

{
    "dst":"27.0.0.13",
    "protocol":"bgp",
    "metric":20,
    "flags":[],
    "gateway":"169.254.0.1"dev uplink-1 weight 1 ,
    "flags":["onlink"],
    "gateway":"169.254.0.1"dev uplink-2 weight 1 ,
    "flags":["onlink"]
},

since RTA_MULTIPATH has nested objects we should print them
in a json array.

With the path we have the following output:

{
    "flags": [],
    "dst": "36.0.0.13",
    "protocol": "bgp",
    "metric": 20,
    "nexthops": [
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-1"
        },
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-2"
        }
    ]
}

Fixes: 663c3cb23103f4 ("iproute: implement JSON and color output")
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoman: add note to ip-macsec manual about necessary key management
Thomas Haller [Wed, 25 Sep 2019 10:24:03 +0000 (12:24 +0200)]
man: add note to ip-macsec manual about necessary key management

The man page of ip-macsec and the existance of the tool makes it seem like
the user could just configure static keys once, and be done with it. That is
not the case. Some form or key management must be done in user space.

Add a note about that.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip vrf: Add json support for show command
David Ahern [Wed, 18 Sep 2019 16:42:21 +0000 (09:42 -0700)]
ip vrf: Add json support for show command

Add json support to 'ip vrf sh':
$ ip -j -p vrf ls
[ {
        "name": "mgmt",
        "table": 1001
    } ]

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Wed, 25 Sep 2019 02:34:34 +0000 (19:34 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agouapi: update headers from 5.4-rc
Stephen Hemminger [Tue, 24 Sep 2019 19:38:57 +0000 (12:38 -0700)]
uapi: update headers from 5.4-rc

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge ../iproute2-next
Stephen Hemminger [Tue, 24 Sep 2019 19:37:33 +0000 (12:37 -0700)]
Merge ../iproute2-next

4 years agov5.3.0
Stephen Hemminger [Tue, 24 Sep 2019 19:32:05 +0000 (12:32 -0700)]
v5.3.0

4 years agobpf: Fix race condition with map pinning
Joe Stringer [Fri, 20 Sep 2019 02:04:47 +0000 (19:04 -0700)]
bpf: Fix race condition with map pinning

If two processes attempt to invoke bpf_map_attach() at the same time,
then they will both create maps, then the first will successfully pin
the map to the filesystem and the second will not pin the map, but will
continue operating with a reference to its own copy of the map. As a
result, the sharing of the same map will be broken from the two programs
that were concurrently loaded via loaders using this library.

Fix this by adding a retry in the case where the pinning fails because
the map already exists on the filesystem. In that case, re-attempt
opening a fd to the map on the filesystem as it shows that another
program already created and pinned a map at that location.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'master' into next
David Ahern [Thu, 19 Sep 2019 14:55:53 +0000 (07:55 -0700)]
Merge branch 'master' into next

Conflicts:
devlink/devlink.c

Fixed the conflict by updating the numbering for all new attributes
after the ones in master branch.

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: add reload failed indication
Jiri Pirko [Mon, 16 Sep 2019 09:44:48 +0000 (11:44 +0200)]
devlink: add reload failed indication

Add indication about previous failed devlink reload.

Example outputs:

$ devlink dev
netdevsim/netdevsim10: reload_failed true
$ devlink dev -j -p
{
    "dev": {
        "netdevsim/netdevsim10": {
            "reload_failed": true
        }
    }
}

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agobpf: replace snprintf with asprintf when dealing with long buffers
Andrea Claudi [Mon, 16 Sep 2019 13:00:55 +0000 (15:00 +0200)]
bpf: replace snprintf with asprintf when dealing with long buffers

This reduces stack usage, as asprintf allocates memory on the heap.

This indirectly fixes a snprintf truncation warning (from gcc v9.2.1):

bpf.c: In function ‘bpf_get_work_dir’:
bpf.c:784:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  784 |  snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt);
      |                                                 ^
bpf.c:784:2: note: ‘snprintf’ output between 2 and 4097 bytes into a destination of size 4096
  784 |  snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolink_xfrm: don't force to set phydev
Nicolas Dichtel [Mon, 16 Sep 2019 15:36:27 +0000 (17:36 +0200)]
link_xfrm: don't force to set phydev

Since linux commit 22d6552f827e ("xfrm interface: fix management of
phydev"), phydev is not mandatory anymore.

Note that it also could be useful before the above commit to not force the
user to put a phydev (the kernel was checking it anyway).
For example, it was useful to not set it in case of x-netns, because the
phydev is not available in the current netns:

Before the patch:
$ ip netns add foo
$ ip link add xfrm1 type xfrm dev eth1 if_id 1
$ ip link set xfrm1 netns foo
$ ip -n foo link set xfrm1 type xfrm dev eth1 if_id 2
Cannot find device "eth1"
$ ip -n foo link set xfrm1 type xfrm if_id 2
must specify physical device

Fixes: 286446c1e8c7 ("ip: support for xfrm interfaces")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Matt Ellison <matt@arroyo.io>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: ss.8: add documentation for drop counter
Andrea Claudi [Wed, 11 Sep 2019 10:19:29 +0000 (12:19 +0200)]
man: ss.8: add documentation for drop counter

After commit 6df9c7a06a845 ("ss: add SK_MEMINFO_DROPS display") ss -m
displays also a drop counter for each socket.

This commit properly document it into the man page.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agordma: Check comm string before print in print_comm()
Mark Zhang [Wed, 11 Sep 2019 08:12:43 +0000 (11:12 +0300)]
rdma: Check comm string before print in print_comm()

Broken kernels (not-upstream) can provide wrong empty "comm" field.
It causes to segfault while printing in JSON format.

Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information")
Signed-off-by: Mark Zhang <markz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: implement flash status monitoring
Jiri Pirko [Thu, 12 Sep 2019 11:29:38 +0000 (13:29 +0200)]
devlink: implement flash status monitoring

Listen to status notifications coming from kernel during flashing and
put them on stdout to inform user about the status.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: implement flash update status monitoring
Jiri Pirko [Thu, 12 Sep 2019 11:29:37 +0000 (13:29 +0200)]
devlink: implement flash update status monitoring

Kernel sends notifications about flash update status, so implement these
messages for monitoring.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: unknown 'fw_load_policy' string validation
Dirk van der Merwe [Wed, 11 Sep 2019 14:56:29 +0000 (15:56 +0100)]
devlink: unknown 'fw_load_policy' string validation

The 'fw_load_policy' devlink parameter now supports an unknown value.

Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: add 'reset_dev_on_drv_probe' devlink param
Dirk van der Merwe [Wed, 11 Sep 2019 13:05:17 +0000 (14:05 +0100)]
devlink: add 'reset_dev_on_drv_probe' devlink param

Add support for the new devlink parameter along with string to uint
conversion.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoiproute2-next: police: support 64bit rate and peakrate in tc utility
David Dai [Wed, 4 Sep 2019 15:06:51 +0000 (10:06 -0500)]
iproute2-next: police: support 64bit rate and peakrate in tc utility

For high speed adapter like Mellanox CX-5 card, it can reach upto
100 Gbits per second bandwidth. Currently htb already supports 64bit rate
in tc utility. However police action rate and peakrate are still limited
to 32bit value (upto 32 Gbits per second). Taking advantage of the 2 new
attributes TCA_POLICE_RATE64 and TCA_POLICE_PEAKRATE64 from kernel,
tc can use them to break the 32bit limit, and still keep the backward
binary compatibility.

Tested-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Sun, 15 Sep 2019 17:32:58 +0000 (10:32 -0700)]
Update kernel headers

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

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agonexthop: Add space after blackhole
David Ahern [Wed, 4 Sep 2019 15:09:52 +0000 (08:09 -0700)]
nexthop: Add space after blackhole

Add a space after 'blackhole' is missing to properly separate the
protocol when it is given.

Fixes: 63df8e8543b0 ("Add support for nexthop objects")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: fix segfault on health command
Andrea Claudi [Wed, 4 Sep 2019 17:26:14 +0000 (19:26 +0200)]
devlink: fix segfault on health command

devlink segfaults when using grace_period without reporter

$ devlink health set pci/0000:00:09.0 grace_period 3500
Segmentation fault

devlink is instead supposed to gracefully fail printing a warning
message

$ devlink health set pci/0000:00:09.0 grace_period 3500
Reporter's name is expected.

This happens because DL_OPT_HEALTH_REPORTER_NAME and
DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD are both defined as BIT(27).
When dl_opts_put() parse options and grace_period is set, it erroneously
tries to set reporter name to null.

This is fixed simply shifting by 1 bit enumeration starting with
DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD.

Fixes: b18d89195b16 ("devlink: Add devlink health set command")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip nexthop: Allow flush|list operations to specify a specific protocol
Donald Sharp [Sat, 10 Aug 2019 00:18:43 +0000 (20:18 -0400)]
ip nexthop: Allow flush|list operations to specify a specific protocol

In the case where we have a large number of nexthops from a specific
protocol, allow the flush and list operations to take a protocol
to limit the commands scopes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Wed, 4 Sep 2019 14:48:15 +0000 (07:48 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agouapi: update bpf.h header
Stephen Hemminger [Thu, 29 Aug 2019 23:20:21 +0000 (16:20 -0700)]
uapi: update bpf.h header

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'devlink-trap' into next
David Ahern [Sun, 18 Aug 2019 18:51:38 +0000 (11:51 -0700)]
Merge branch 'devlink-trap' into next

Ido Schimmel  says:

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

From: Ido Schimmel <idosch@mellanox.com>

This patchset adds devlink-trap support in iproute2.

Patch #1 increases the number of options devlink can handle.

Patches #2-#3 gradually add support for all devlink-trap commands.

Patch #4 adds a man page for devlink-trap.

See individual commit messages for example usage and output.

Changes in v2:
* Remove report option and monitor command since monitoring is done
  using drop monitor

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

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: Add man page for devlink-trap
Ido Schimmel [Tue, 13 Aug 2019 08:31:43 +0000 (11:31 +0300)]
devlink: Add man page for devlink-trap

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: Add devlink trap group set and show commands
Ido Schimmel [Tue, 13 Aug 2019 08:31:42 +0000 (11:31 +0300)]
devlink: Add devlink trap group set and show commands

These commands are similar to the trap set and show commands, but
operate on a trap group and not individual traps. Example:

# devlink trap group set netdevsim/netdevsim10 group l3_drops action trap
# devlink -jps trap group show netdevsim/netdevsim10 group l3_drops
{
    "trap_group": {
        "netdevsim/netdevsim10": [ {
                "name": "l3_drops",
                "generic": true,
                "stats": {
                    "rx": {
                        "bytes": 0,
                        "packets": 0
                    }
                }
            } ]
    }
}

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: Add devlink trap set and show commands
Ido Schimmel [Tue, 13 Aug 2019 08:31:41 +0000 (11:31 +0300)]
devlink: Add devlink trap set and show commands

The trap set command allows the user to set the action of an individual
trap. Example:

# devlink trap set netdevsim/netdevsim10 trap blackhole_route action trap

The trap show command allows the user to get the current status of an
individual trap or a dump of all traps in case one is not specified.
When '-s' is specified the trap's statistics are shown. When '-v' is
specified the metadata types the trap can provide are shown. Example:

# devlink -jvps trap show netdevsim/netdevsim10 trap blackhole_route
{
    "trap": {
        "netdevsim/netdevsim10": [ {
                "name": "blackhole_route",
                "type": "drop",
                "generic": true,
                "action": "trap",
                "group": "l3_drops",
                "metadata": [ "input_port" ],
                "stats": {
                    "rx": {
                        "bytes": 0,
                        "packets": 0
                    }
                }
            } ]
    }
}

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: Increase number of supported options
Ido Schimmel [Tue, 13 Aug 2019 08:31:40 +0000 (11:31 +0300)]
devlink: Increase number of supported options

Currently, the number of supported options is capped at 32 which is a
problem given we are about to add a few more and go over the limit.

Increase the limit to 64 options.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Sun, 18 Aug 2019 18:48:02 +0000 (11:48 -0700)]
Update kernel headers

Update kernel headers to commit:
    d83d508b74c4 ("Merge branch 'stmmac-next'")

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Sun, 18 Aug 2019 18:40:30 +0000 (11:40 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip nexthop: Add space to display properly when showing a group
Donald Sharp [Sat, 10 Aug 2019 00:18:42 +0000 (20:18 -0400)]
ip nexthop: Add space to display properly when showing a group

When displaying a nexthop group made up of other nexthops, the display
line shows this when you have additional data at the end:

id 42 group 43/44/45/46/47/48/49/50/51/52/53/54/55/56/57/58/59/60/61/62/63/64/65/66/67/68/69/70/71/72/73/74proto zebra

Modify code so that it shows:

id 42 group 43/44/45/46/47/48/49/50/51/52/53/54/55/56/57/58/59/60/61/62/63/64/65/66/67/68/69/70/71/72/73/74 proto zebra

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agolib: fix spelling errors
Stephen Hemminger [Tue, 13 Aug 2019 01:21:10 +0000 (18:21 -0700)]
lib: fix spelling errors

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fix spelling errors
Stephen Hemminger [Tue, 13 Aug 2019 01:18:51 +0000 (18:18 -0700)]
tc: fix spelling errors

Minor spelling errors found by codespell

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update socket.h
Stephen Hemminger [Mon, 12 Aug 2019 17:58:49 +0000 (10:58 -0700)]
uapi: update socket.h

Upstream change to resolve gcc-9 issues.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: Fix block-handle support for filter operations
Ido Schimmel [Mon, 12 Aug 2019 10:17:06 +0000 (13:17 +0300)]
tc: Fix block-handle support for filter operations

The revert of batchsize accidently reverted more than it should
and broke shared block functionality.  Fix this by restoring the
original functionality.

To reproduce:

dst_ip 192.0.2.0/24 action drop
Unknown filter "block", hence option "10" is unparsable

Fixes: e991c04d64c0 ("Revert "tc: Add batchsize feature for filter and actions"")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip tunnel: add json output
Andrea Claudi [Fri, 2 Aug 2019 17:38:10 +0000 (19:38 +0200)]
ip tunnel: add json output

Add json support on iptunnel and ip6tunnel.
The plain text output format should remain the same.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agordma: Add driver QP type string
Gal Pressman [Sun, 4 Aug 2019 08:07:56 +0000 (11:07 +0300)]
rdma: Add driver QP type string

RDMA resource tracker now tracks driver QPs as well, add driver QP type
string to qp_types_to_str function.

Signed-off-by: Gal Pressman <galpress@amazon.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Wed, 7 Aug 2019 18:59:19 +0000 (11:59 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoss: sctp: Formatting tweak in sctp_show_info for locals
Patrick Talbert [Sat, 3 Aug 2019 08:47:08 +0000 (10:47 +0200)]
ss: sctp: Formatting tweak in sctp_show_info for locals

'locals' output does not include a leading space so it runs up against
skmem:() output. Add a leading space to fix it.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoss: sctp: fix typo for nodelay
Patrick Talbert [Sat, 3 Aug 2019 08:37:41 +0000 (10:37 +0200)]
ss: sctp: fix typo for nodelay

nodealy should be nodelay.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: finish queue.h to list.h transition
Jiri Pirko [Mon, 5 Aug 2019 09:56:56 +0000 (11:56 +0200)]
devlink: finish queue.h to list.h transition

Loose the "q" from the names and name the structure fields in the same
way rest of the code does. Also, fix list_add arg order which leads
to segfault.

Fixes: 33267017faf1 ("iproute2: devlink: port from sys/queue.h to list.h")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fflush after each command in batch mode
Stephen Hemminger [Fri, 2 Aug 2019 16:33:39 +0000 (09:33 -0700)]
tc: fflush after each command in batch mode

Restore behaviour of tc batch mode.
Flush stdout after each command.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoRevert "tc: Add batchsize feature for filter and actions"
Stephen Hemminger [Thu, 1 Aug 2019 00:27:59 +0000 (17:27 -0700)]
Revert "tc: Add batchsize feature for filter and actions"

This reverts commit 485d0c6001c4aa134b99c86913d6a7089b7b2ab0.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoRevert "tc: fix batch force option"
Stephen Hemminger [Thu, 1 Aug 2019 00:19:33 +0000 (17:19 -0700)]
Revert "tc: fix batch force option"

This reverts commit b133392468d1f404077a8f3554d1f63d48bb45e8.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoRevert "tc: flush after each command in batch mode"
Stephen Hemminger [Thu, 1 Aug 2019 00:19:18 +0000 (17:19 -0700)]
Revert "tc: flush after each command in batch mode"

This reverts commit d66fdfda71e4a30c1ca0ddb7b1a048bef30fe79e.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoRevert "tc: Remove pointless assignments in batch()"
Stephen Hemminger [Thu, 1 Aug 2019 00:16:54 +0000 (17:16 -0700)]
Revert "tc: Remove pointless assignments in batch()"

This reverts commit 6358bbc381c6e38465838370bcbbdeb77ec3565a.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agordma: Document adaptive-moderation
Yamin Friedman [Mon, 29 Jul 2019 07:42:26 +0000 (10:42 +0300)]
rdma: Document adaptive-moderation

Add document of setting the adaptive-moderation for the ib device.

Signed-off-by: Yamin Friedman <yaminf@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>