From 14802d84d3477533c465e99678def2cfc71082f7 Mon Sep 17 00:00:00 2001 From: Antoine Tenart Date: Wed, 6 Oct 2021 11:44:53 +0200 Subject: [PATCH 1/9] man: devlink-port: fix the devlink port add synopsis When configuring a devlink PCI SF port, the sfnumber can be specified using 'sfnum' and not 'pcisf' as stated in the man page. Fix this. Signed-off-by: Antoine Tenart Signed-off-by: Stephen Hemminger --- man/man8/devlink-port.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man8/devlink-port.8 b/man/man8/devlink-port.8 index 147c8e27..4d2ff5d8 100644 --- a/man/man8/devlink-port.8 +++ b/man/man8/devlink-port.8 @@ -53,7 +53,7 @@ devlink-port \- devlink port configuration .RB "[ " pcipf .IR PFNUMBER " ]" .br -.RB "{ " pcisf +.RB "{ " sfnum .IR SFNUMBER " }" .br .RB "[ " controller From 04ee8e6f061dc378ee3a52d319dcd20e90f1ca93 Mon Sep 17 00:00:00 2001 From: Antoine Tenart Date: Wed, 6 Oct 2021 11:44:54 +0200 Subject: [PATCH 2/9] man: devlink-port: fix style Values should be .I, square brackets should be used for optional values, curly brackets for lists. Follow this in the devlink-port man page. Signed-off-by: Antoine Tenart Signed-off-by: Stephen Hemminger --- man/man8/devlink-port.8 | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/man/man8/devlink-port.8 b/man/man8/devlink-port.8 index 4d2ff5d8..e5686dea 100644 --- a/man/man8/devlink-port.8 +++ b/man/man8/devlink-port.8 @@ -45,16 +45,16 @@ devlink-port \- devlink port configuration .ti -8 .BI "devlink port add" -.RB "[" +.RB "{" .IR "DEV | DEV/PORT_INDEX" -.RB "] " +.RB "} " .RB "[ " flavour .IR FLAVOUR " ]" .RB "[ " pcipf .IR PFNUMBER " ]" .br -.RB "{ " sfnum -.IR SFNUMBER " }" +.RB "[ " sfnum +.IR SFNUMBER " ]" .br .RB "[ " controller .IR CNUM " ]" @@ -102,7 +102,7 @@ devlink-port \- devlink port configuration .SS devlink port set - change devlink port attributes .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .in +4 @@ -126,7 +126,7 @@ set port type .SS devlink port split - split devlink port into more .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .TP @@ -137,7 +137,7 @@ number of ports to split to. Could be performed on any split port of the same split group. .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .SS devlink port show - display devlink port attributes @@ -154,11 +154,11 @@ Is an alias for .ti -8 .SS devlink port add - add a devlink port .PP -.B "DEV" +.I "DEV" - specifies the devlink device to operate on. or .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port index to use for the requested new port. This is optional. When omitted, driver allocates unique port index. @@ -173,17 +173,17 @@ set port flavour - PCI SF port .TP -.BR pfnum " { " pfnumber " } " +.BI pfnum " PFNUMBER " Specifies PCI pfnumber to use on which a SF device to create .TP -.BR sfnum " { " sfnumber " } " +.BI sfnum " SFNUMBER " Specifies sfnumber to assign to the device of the SF. This field is optional for those devices which supports auto assignment of the SF number. .TP -.BR controller " { " controller " } " +.BI controller " CNUM " Specifies controller number for which the SF port is created. This field is optional. It is used only when SF port is created for the external controller. @@ -192,17 +192,17 @@ external controller. .SS devlink port function set - Set the port function attribute(s). .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .TP -.BR hw_addr " ADDR" -- hardware address of the function to set. This is a Ethernet MAC address when +.BI hw_addr " ADDR" +Hardware address of the function to set. This is a Ethernet MAC address when port type is Ethernet. .TP .BR state " { " active " | " inactive " } " -- new state of the function to change to. +New state of the function to change to. .I active - Once configuration of the function is done, activate the function. @@ -213,13 +213,13 @@ port type is Ethernet. .ti -8 .SS devlink port del - delete a devlink port .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to delete. .ti -8 .SS devlink port param set - set new value to devlink port configuration parameter .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .TP @@ -246,7 +246,7 @@ Configuration mode in which the new value is set. .SS devlink port param show - display devlink port supported configuration parameters attributes .PP -.B "DEV/PORT_INDEX" +.I "DEV/PORT_INDEX" - specifies the devlink port to operate on. .B name From 7c032cac10b326111ded931450830c62804611e7 Mon Sep 17 00:00:00 2001 From: Antoine Tenart Date: Wed, 6 Oct 2021 11:44:55 +0200 Subject: [PATCH 3/9] man: devlink-port: remove extra .br br. were added between options of the same command. That is not needed and makes the output to be one 3 lines for no particular reason. Signed-off-by: Antoine Tenart Signed-off-by: Stephen Hemminger --- man/man8/devlink-port.8 | 2 -- 1 file changed, 2 deletions(-) diff --git a/man/man8/devlink-port.8 b/man/man8/devlink-port.8 index e5686dea..e48c5735 100644 --- a/man/man8/devlink-port.8 +++ b/man/man8/devlink-port.8 @@ -52,10 +52,8 @@ devlink-port \- devlink port configuration .IR FLAVOUR " ]" .RB "[ " pcipf .IR PFNUMBER " ]" -.br .RB "[ " sfnum .IR SFNUMBER " ]" -.br .RB "[ " controller .IR CNUM " ]" .br From a500c5ac8733a1ea99fbd4ef039a999a93590c45 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 13 Oct 2021 16:39:27 +0200 Subject: [PATCH 4/9] lib/bpf: fix map-in-map creation without prepopulation When creating map-in-maps, the outer map can be prepopulated using the inner_idx field of inner maps. That field defines the index of the inner map in the outer map. It is ignored if set to -1. Commit 6d61a2b55799 ("lib: add libbpf support") however started using that field to identify inner maps. While iterating over all maps looking for inner maps, maps with inner_idx set to -1 are erroneously skipped. As a result, trying to create a map-in-map with prepopulation disabled fails because the inner_id of the outer map is not correctly set. This bug can be observed with strace -ebpf (notice the zero inner_map_fd for the outer map creation): bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=130996, max_entries=1, map_flags=0, inner_map_fd=0, map_name="maglev_inner", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 128) = 32 bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH_OF_MAPS, key_size=2, value_size=4, max_entries=65536, map_flags=BPF_F_NO_PREALLOC, inner_map_fd=0, map_name="maglev_outer", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 128) = -1 EINVAL (Invalid argument) Fixes: 6d61a2b55799 ("lib: add libbpf support") Signed-off-by: Paul Chaignon Signed-off-by: Stephen Hemminger --- lib/bpf_legacy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bpf_legacy.c b/lib/bpf_legacy.c index 275941dd..23854f17 100644 --- a/lib/bpf_legacy.c +++ b/lib/bpf_legacy.c @@ -3287,8 +3287,7 @@ bool iproute2_is_map_in_map(const char *libbpf_map_name, struct bpf_elf_map *ima continue; if (!ctx->maps[i].id || - ctx->maps[i].inner_id || - ctx->maps[i].inner_idx == -1) + ctx->maps[i].inner_id) continue; *imap = ctx->maps[i]; From 229eaba507954da73d0d51409676970518e901a4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 15 Oct 2021 17:40:30 -0700 Subject: [PATCH 5/9] uapi: pickup fix for xfrm ABI breakage See kernel Commit 844f7eaaed9 ("include/uapi/linux/xfrm.h: Fix XFRM_MSG_MAPPING ABI breakage") Signed-off-by: Stephen Hemminger --- include/uapi/linux/xfrm.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index ecd06396..378b4092 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -213,13 +213,13 @@ enum { XFRM_MSG_GETSPDINFO, #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO + XFRM_MSG_MAPPING, +#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING + XFRM_MSG_SETDEFAULT, #define XFRM_MSG_SETDEFAULT XFRM_MSG_SETDEFAULT XFRM_MSG_GETDEFAULT, #define XFRM_MSG_GETDEFAULT XFRM_MSG_GETDEFAULT - - XFRM_MSG_MAPPING, -#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING __XFRM_MSG_MAX }; #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) @@ -514,9 +514,12 @@ struct xfrm_user_offload { #define XFRM_OFFLOAD_INBOUND 2 struct xfrm_userpolicy_default { -#define XFRM_USERPOLICY_DIRMASK_MAX (sizeof(__u8) * 8) - __u8 dirmask; - __u8 action; +#define XFRM_USERPOLICY_UNSPEC 0 +#define XFRM_USERPOLICY_BLOCK 1 +#define XFRM_USERPOLICY_ACCEPT 2 + __u8 in; + __u8 fwd; + __u8 out; }; /* backwards compatibility for userspace */ From 7a235a101b326156305c9a593d1f9f12f1465d04 Mon Sep 17 00:00:00 2001 From: Antoine Tenart Date: Mon, 18 Oct 2021 10:52:20 +0200 Subject: [PATCH 6/9] man: devlink-port: fix pfnum for devlink port add When configuring a devlink PCI port, the pfnumber can be specified using 'pfnum' and not 'pcipf' as stated in the man page. Fix this. Signed-off-by: Antoine Tenart Signed-off-by: Stephen Hemminger --- man/man8/devlink-port.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man8/devlink-port.8 b/man/man8/devlink-port.8 index e48c5735..e668d0a2 100644 --- a/man/man8/devlink-port.8 +++ b/man/man8/devlink-port.8 @@ -50,7 +50,7 @@ devlink-port \- devlink port configuration .RB "} " .RB "[ " flavour .IR FLAVOUR " ]" -.RB "[ " pcipf +.RB "[ " pfnum .IR PFNUMBER " ]" .RB "[ " sfnum .IR SFNUMBER " ]" From ad3a118f885382f03f975d70e5d607e70befc7dd Mon Sep 17 00:00:00 2001 From: Neta Ostrovsky Date: Mon, 25 Oct 2021 13:37:07 +0300 Subject: [PATCH 7/9] rdma: Fix SRQ resource tracking information json Fix the json output for the QPs that are associated with the SRQ - The qpn are now displayed in a json array. Sample output before the fix: $ rdma res show srq lqpn 126-141 -j -p [ { "ifindex":0, "ifname":"ibp8s0f0", "srqn":4, "type":"BASIC", "lqpn":["126-128,130-140"], "pdn":9, "pid":3581, "comm":"ibv_srq_pingpon" },{ "ifindex":0, "ifname":"ibp8s0f0", "srqn":5, "type":"BASIC", "lqpn":["141"], "pdn":10, "pid":3584, "comm":"ibv_srq_pingpon" } ] Sample output after the fix: $ rdma res show srq lqpn 126-141 -j -p [ { "ifindex":0, "ifname":"ibp8s0f0", "srqn":4, "type":"BASIC", "lqpn":["126-128","130-140"], "pdn":9, "pid":3581, "comm":"ibv_srq_pingpon" },{ "ifindex":0, "ifname":"ibp8s0f0", "srqn":5, "type":"BASIC", "lqpn":["141"], "pdn":10, "pid":3584, "comm":"ibv_srq_pingpon" } ] Fixes: 9b272e138d23 ("rdma: Add SRQ resource tracking information") Signed-off-by: Neta Ostrovsky Signed-off-by: Leon Romanovsky Signed-off-by: Stephen Hemminger --- rdma/res-srq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/rdma/res-srq.c b/rdma/res-srq.c index c14ac5d8..5d8f3842 100644 --- a/rdma/res-srq.c +++ b/rdma/res-srq.c @@ -26,11 +26,24 @@ static void print_type(struct rd *rd, uint32_t val) srq_types_to_str(val)); } -static void print_qps(const char *str) +static void print_qps(char *qp_str) { - if (!strlen(str)) + char *qpn; + + if (!strlen(qp_str)) return; - print_color_string(PRINT_ANY, COLOR_NONE, "lqpn", "lqpn %s ", str); + + open_json_array(PRINT_ANY, "lqpn"); + print_color_string(PRINT_FP, COLOR_NONE, NULL, " ", NULL); + qpn = strtok(qp_str, ","); + while (qpn) { + print_color_string(PRINT_ANY, COLOR_NONE, NULL, "%s", qpn); + qpn = strtok(NULL, ","); + if (qpn) + print_color_string(PRINT_FP, COLOR_NONE, NULL, ",", NULL); + } + print_color_string(PRINT_FP, COLOR_NONE, NULL, " ", NULL); + close_json_array(PRINT_JSON, NULL); } static int filter_srq_range_qps(struct rd *rd, struct nlattr **qp_line, From 7a8b7573a49ee15ff4ae9cdce14fda74b62075a4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 1 Nov 2021 16:41:02 -0700 Subject: [PATCH 8/9] v5.15.0 --- include/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/version.h b/include/version.h index d0e1a49b..2ea520da 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -static const char version[] = "5.14.0"; +static const char version[] = "5.15.0"; From 047e9ae516b5427158c0653f15c9c20d3965e4e5 Mon Sep 17 00:00:00 2001 From: Moshe Shemesh Date: Sun, 31 Oct 2021 08:48:47 +0200 Subject: [PATCH 9/9] devlink: Fix cmd_dev_param_set() to check configuration mode This patch is fixing a bug, when param set user command includes configuration mode which is not supported, the tool may not respond with error if the requested value is 0. In such case cmd_dev_param_set_cb() won't find the requested configuration mode and returns ctx->value as initialized (equal 0). Then cmd_dev_param_set() may find that requested value equals current value and returns success. Fixing the bug by adding a flag cmode_found which is set only if cmd_dev_param_set_cb() finds the requested configuration mode. Fixes: 13925ae9eb38 ("devlink: Add param command support") Signed-off-by: Moshe Shemesh Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devlink/devlink.c b/devlink/devlink.c index 2f2142ed..14fbc856 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -3036,6 +3036,7 @@ static int cmd_dev_param_show_cb(const struct nlmsghdr *nlh, void *data) struct param_ctx { struct dl *dl; int nla_type; + bool cmode_found; union { uint8_t vu8; uint16_t vu16; @@ -3088,6 +3089,7 @@ static int cmd_dev_param_set_cb(const struct nlmsghdr *nlh, void *data) cmode = mnl_attr_get_u8(nla_value[DEVLINK_ATTR_PARAM_VALUE_CMODE]); if (cmode == dl->opts.cmode) { + ctx->cmode_found = true; val_attr = nla_value[DEVLINK_ATTR_PARAM_VALUE_DATA]; switch (nla_type) { case MNL_TYPE_U8: @@ -3140,6 +3142,10 @@ static int cmd_dev_param_set(struct dl *dl) err = mnlu_gen_socket_sndrcv(&dl->nlg, nlh, cmd_dev_param_set_cb, &ctx); if (err) return err; + if (!ctx.cmode_found) { + pr_err("Configuration mode not supported\n"); + return -ENOTSUP; + } nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_PARAM_SET, NLM_F_REQUEST | NLM_F_ACK);