* Re: [PATCH iproute2-next v5] devlink: add info subcommand
From: Jiri Pirko @ 2019-02-04 16:16 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: dsahern, stephen, netdev, oss-drivers
In-Reply-To: <20190204161011.7808-1-jakub.kicinski@netronome.com>
Mon, Feb 04, 2019 at 05:10:11PM CET, jakub.kicinski@netronome.com wrote:
>Add support for reading the device serial number, driver name
>and various versions. Example:
>
>$ devlink dev info pci/0000:82:00.0
>pci/0000:82:00.0:
> driver nfp
> serial_number 16240145
> versions:
> fixed:
> board.id AMDA0081-0001
> board.rev 15
> board.vendor SMA
> board.model hydrogen
> running:
> fw.mgmt 010181.010181.0101d4
> fw.cpld 0x1030000
> fw.app abm-d372b6
> fw.undi 0.0.2
> chip.init AMDA-0081-0001 20160318164536
> stored:
> fw.mgmt 010181.010181.0101d4
> fw.app abm-d372b6
> fw.undi 0.0.2
> chip.init AMDA-0081-0001 20160318164536
>
>$ devlink -jp dev info pci/0000:82:00.0
>{
> "info": {
> "pci/0000:82:00.0": {
> "driver": "nfp",
> "serial_number": "16240145",
> "versions": {
> "fixed": {
> "board.id": "AMDA0081-0001",
> "board.rev": "15",
> "board.vendor": "SMA",
> "board.model": "hydrogen"
> },
> "running": {
> "fw.mgmt": "010181.010181.0101d4",
> "fw.cpld": "0x1030000",
> "fw.app": "abm-d372b6",
> "fw.undi": "0.0.2",
> "chip.init": "AMDA-0081-0001 20160318164536"
> },
> "stored": {
> "fw.mgmt": "010181.010181.0101d4",
> "fw.app": "abm-d372b6",
> "fw.undi": "0.0.2",
> "chip.init": "AMDA-0081-0001 20160318164536"
> }
> }
> }
> }
>}
>
>v5:
> - remove spurious new line.
>v4:
> - more commit message improvements.
>v3:
> - show up-to-date output in the commit message.
>v2 (Jiri):
> - remove filtering;
> - add example in the commit message.
>RFCv2:
> - make info subcommand of dev.
>
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Thanks!
^ permalink raw reply
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
From: Jiong Wang @ 2019-02-04 16:15 UTC (permalink / raw)
To: Heiko Carstens
Cc: Alexei Starovoitov, Martin Schwidefsky, Jiong Wang, linux-s390,
netdev
In-Reply-To: <20190204154455.88687-1-heiko.carstens@de.ibm.com>
Heiko Carstens writes:
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Thanks for fixing this.
Acked-by: Jiong Wang <jiong.wang@netronome.com>
Regards,
Jiong
> ---
> arch/s390/net/bpf_jit_comp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
> index ce9defdff62a..51dd0267d014 100644
> --- a/arch/s390/net/bpf_jit_comp.c
> +++ b/arch/s390/net/bpf_jit_comp.c
> @@ -1154,7 +1154,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> mask = 0x7000; /* jnz */
> if (BPF_CLASS(insn->code) == BPF_JMP32) {
> /* llilf %w1,imm (load zero extend imm) */
> - EMIT6_IMM(0xc0010000, REG_W1, imm);
> + EMIT6_IMM(0xc00f0000, REG_W1, imm);
> /* nr %w1,%dst */
> EMIT2(0x1400, REG_W1, dst_reg);
> } else {
> @@ -1216,6 +1216,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> REG_W1, dst_reg, src_reg);
> goto branch_oc;
> branch_ks:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* lgfi %w1,imm (load sign extend imm) */
> EMIT6_IMM(0xc0010000, REG_W1, imm);
> /* crj or cgrj %dst,%w1,mask,off */
> @@ -1223,6 +1224,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> dst_reg, REG_W1, i, off, mask);
> break;
> branch_ku:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* lgfi %w1,imm (load sign extend imm) */
> EMIT6_IMM(0xc0010000, REG_W1, imm);
> /* clrj or clgrj %dst,%w1,mask,off */
> @@ -1230,11 +1232,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> dst_reg, REG_W1, i, off, mask);
> break;
> branch_xs:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* crj or cgrj %dst,%src,mask,off */
> EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0076 : 0x0064),
> dst_reg, src_reg, i, off, mask);
> break;
> branch_xu:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* clrj or clgrj %dst,%src,mask,off */
> EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0077 : 0x0065),
> dst_reg, src_reg, i, off, mask);
^ permalink raw reply
* [PATCH iproute2-next v5] devlink: add info subcommand
From: Jakub Kicinski @ 2019-02-04 16:10 UTC (permalink / raw)
To: jiri, dsahern; +Cc: stephen, netdev, oss-drivers, Jakub Kicinski
Add support for reading the device serial number, driver name
and various versions. Example:
$ devlink dev info pci/0000:82:00.0
pci/0000:82:00.0:
driver nfp
serial_number 16240145
versions:
fixed:
board.id AMDA0081-0001
board.rev 15
board.vendor SMA
board.model hydrogen
running:
fw.mgmt 010181.010181.0101d4
fw.cpld 0x1030000
fw.app abm-d372b6
fw.undi 0.0.2
chip.init AMDA-0081-0001 20160318164536
stored:
fw.mgmt 010181.010181.0101d4
fw.app abm-d372b6
fw.undi 0.0.2
chip.init AMDA-0081-0001 20160318164536
$ devlink -jp dev info pci/0000:82:00.0
{
"info": {
"pci/0000:82:00.0": {
"driver": "nfp",
"serial_number": "16240145",
"versions": {
"fixed": {
"board.id": "AMDA0081-0001",
"board.rev": "15",
"board.vendor": "SMA",
"board.model": "hydrogen"
},
"running": {
"fw.mgmt": "010181.010181.0101d4",
"fw.cpld": "0x1030000",
"fw.app": "abm-d372b6",
"fw.undi": "0.0.2",
"chip.init": "AMDA-0081-0001 20160318164536"
},
"stored": {
"fw.mgmt": "010181.010181.0101d4",
"fw.app": "abm-d372b6",
"fw.undi": "0.0.2",
"chip.init": "AMDA-0081-0001 20160318164536"
}
}
}
}
}
v5:
- remove spurious new line.
v4:
- more commit message improvements.
v3:
- show up-to-date output in the commit message.
v2 (Jiri):
- remove filtering;
- add example in the commit message.
RFCv2:
- make info subcommand of dev.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
devlink/devlink.c | 171 +++++++++++++++++++++++++++++++++++++++++
man/man8/devlink-dev.8 | 26 +++++++
2 files changed, 197 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 4c44c3bea724..d823512a4030 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -383,6 +383,13 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_REGION_CHUNK_DATA] = MNL_TYPE_BINARY,
[DEVLINK_ATTR_REGION_CHUNK_ADDR] = MNL_TYPE_U64,
[DEVLINK_ATTR_REGION_CHUNK_LEN] = MNL_TYPE_U64,
+ [DEVLINK_ATTR_INFO_DRIVER_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_SERIAL_NUMBER] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_FIXED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_RUNNING] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_STORED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_VALUE] = MNL_TYPE_STRING,
};
static int attr_cb(const struct nlattr *attr, void *data)
@@ -1443,6 +1450,7 @@ static void cmd_dev_help(void)
pr_err(" devlink dev param set DEV name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n");
pr_err(" devlink dev param show [DEV name PARAMETER]\n");
pr_err(" devlink dev reload DEV\n");
+ pr_err(" devlink dev info [ DEV ]\n");
}
static bool cmp_arr_last_handle(struct dl *dl, const char *bus_name,
@@ -1775,6 +1783,30 @@ static void pr_out_array_end(struct dl *dl)
}
}
+static void pr_out_object_start(struct dl *dl, const char *name)
+{
+ if (dl->json_output) {
+ jsonw_name(dl->jw, name);
+ jsonw_start_object(dl->jw);
+ } else {
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ pr_out("%s:", name);
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ }
+}
+
+static void pr_out_object_end(struct dl *dl)
+{
+ if (dl->json_output) {
+ jsonw_end_object(dl->jw);
+ } else {
+ __pr_out_indent_dec();
+ __pr_out_indent_dec();
+ }
+}
+
static void pr_out_entry_start(struct dl *dl)
{
if (dl->json_output)
@@ -2415,6 +2447,142 @@ static int cmd_dev_reload(struct dl *dl)
return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
}
+static void pr_out_versions_single(struct dl *dl, const struct nlmsghdr *nlh,
+ const char *name, int type)
+{
+ struct nlattr *version;
+
+ mnl_attr_for_each(version, nlh, sizeof(struct genlmsghdr)) {
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ const char *ver_value;
+ const char *ver_name;
+ int err;
+
+ if (mnl_attr_get_type(version) != type)
+ continue;
+
+ err = mnl_attr_parse_nested(version, attr_cb, tb);
+ if (err != MNL_CB_OK)
+ continue;
+
+ if (!tb[DEVLINK_ATTR_INFO_VERSION_NAME] ||
+ !tb[DEVLINK_ATTR_INFO_VERSION_VALUE])
+ continue;
+
+ if (name) {
+ pr_out_object_start(dl, name);
+ name = NULL;
+ }
+
+ ver_name = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_NAME]);
+ ver_value = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_VALUE]);
+
+ pr_out_str(dl, ver_name, ver_value);
+ if (!dl->json_output)
+ __pr_out_newline();
+ }
+
+ if (!name)
+ pr_out_object_end(dl);
+}
+
+static void pr_out_info(struct dl *dl, const struct nlmsghdr *nlh,
+ struct nlattr **tb, bool has_versions)
+{
+ __pr_out_handle_start(dl, tb, true, false);
+
+ __pr_out_indent_inc();
+ if (tb[DEVLINK_ATTR_INFO_DRIVER_NAME]) {
+ struct nlattr *nla_drv = tb[DEVLINK_ATTR_INFO_DRIVER_NAME];
+
+ if (!dl->json_output)
+ __pr_out_newline();
+ pr_out_str(dl, "driver", mnl_attr_get_str(nla_drv));
+ }
+
+ if (tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER]) {
+ struct nlattr *nla_sn = tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER];
+
+ if (!dl->json_output)
+ __pr_out_newline();
+ pr_out_str(dl, "serial_number", mnl_attr_get_str(nla_sn));
+ }
+ __pr_out_indent_dec();
+
+ if (has_versions) {
+ pr_out_object_start(dl, "versions");
+
+ pr_out_versions_single(dl, nlh, "fixed",
+ DEVLINK_ATTR_INFO_VERSION_FIXED);
+ pr_out_versions_single(dl, nlh, "running",
+ DEVLINK_ATTR_INFO_VERSION_RUNNING);
+ pr_out_versions_single(dl, nlh, "stored",
+ DEVLINK_ATTR_INFO_VERSION_STORED);
+
+ pr_out_object_end(dl);
+ }
+
+ pr_out_handle_end(dl);
+}
+
+static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data)
+{
+ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ bool has_versions, has_info;
+ struct dl *dl = data;
+
+ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
+
+ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME])
+ return MNL_CB_ERROR;
+
+ has_versions = tb[DEVLINK_ATTR_INFO_VERSION_FIXED] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_RUNNING] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_STORED];
+ has_info = tb[DEVLINK_ATTR_INFO_DRIVER_NAME] ||
+ tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER] ||
+ has_versions;
+
+ if (has_info)
+ pr_out_info(dl, nlh, tb, has_versions);
+
+ return MNL_CB_OK;
+}
+
+static void cmd_dev_info_help(void)
+{
+ pr_err("Usage: devlink dev info [ DEV ]\n");
+}
+
+static int cmd_dev_info(struct dl *dl)
+{
+ struct nlmsghdr *nlh;
+ uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
+ int err;
+
+ if (dl_argv_match(dl, "help")) {
+ cmd_dev_info_help();
+ return 0;
+ }
+
+ if (dl_argc(dl) == 0)
+ flags |= NLM_F_DUMP;
+
+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_INFO_GET, flags);
+
+ if (dl_argc(dl) > 0) {
+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0);
+ if (err)
+ return err;
+ }
+
+ pr_out_section_start(dl, "info");
+ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_versions_show_cb, dl);
+ pr_out_section_end(dl);
+ return err;
+}
+
static int cmd_dev(struct dl *dl)
{
if (dl_argv_match(dl, "help")) {
@@ -2433,6 +2601,9 @@ static int cmd_dev(struct dl *dl)
} else if (dl_argv_match(dl, "param")) {
dl_arg_inc(dl);
return cmd_dev_param(dl);
+ } else if (dl_argv_match(dl, "info")) {
+ dl_arg_inc(dl);
+ return cmd_dev_info(dl);
}
pr_err("Command \"%s\" not found\n", dl_argv(dl));
return -ENOENT;
diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8
index d985da172aa0..47838371fecd 100644
--- a/man/man8/devlink-dev.8
+++ b/man/man8/devlink-dev.8
@@ -63,6 +63,12 @@ devlink-dev \- devlink device configuration
.BR "devlink dev reload"
.IR DEV
+.ti -8
+.BR "devlink dev info"
+.RI "[ "
+.IR DEV
+.RI "]"
+
.SH "DESCRIPTION"
.SS devlink dev show - display devlink device attributes
@@ -151,6 +157,26 @@ If this argument is omitted all parameters supported by devlink devices are list
.I "DEV"
- Specifies the devlink device to reload.
+.SS devlink dev info - display device information.
+Display device information provided by the driver. This command can be used
+to query versions of the hardware components or device components which
+can't be updated (
+.I fixed
+) as well as device firmware which can be updated. For firmware components
+.I running
+displays the versions of firmware currently loaded into the device, while
+.I stored
+reports the versions in device's flash.
+.I Running
+and
+.I stored
+versions may differ after flash has been updated, but before reboot.
+
+.PP
+.I "DEV"
+- specifies the devlink device to show.
+If this argument is omitted all devices are listed.
+
.SH "EXAMPLES"
.PP
devlink dev show
--
2.19.2
^ permalink raw reply related
* Need this for your photos?
From: Stacy @ 2019-02-04 11:03 UTC (permalink / raw)
To: netdev
Need to retouch your photos? Deep etching or masking for your photos?
We are the studio who can do those service for your photos.
Please send photos to start
Thanks,
Stacy
Aaledn
Kaarsd
^ permalink raw reply
* [PATCH] s390: bpf: fix JMP32 code-gen
From: Heiko Carstens @ 2019-02-04 15:44 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Martin Schwidefsky, Jiong Wang, linux-s390, netdev
Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
JMP32 code-gen support for s390. However it triggers the warning below
due to some unusual gotos in the original s390 bpf jit code.
Add a couple of additional "is_jmp32" initializations to fix this.
Also fix the wrong opcode for the "llilf" instruction that was
introduced with the same commit.
arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
_EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
^
arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
Cc: Jiong Wang <jiong.wang@netronome.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
arch/s390/net/bpf_jit_comp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index ce9defdff62a..51dd0267d014 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -1154,7 +1154,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
mask = 0x7000; /* jnz */
if (BPF_CLASS(insn->code) == BPF_JMP32) {
/* llilf %w1,imm (load zero extend imm) */
- EMIT6_IMM(0xc0010000, REG_W1, imm);
+ EMIT6_IMM(0xc00f0000, REG_W1, imm);
/* nr %w1,%dst */
EMIT2(0x1400, REG_W1, dst_reg);
} else {
@@ -1216,6 +1216,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
REG_W1, dst_reg, src_reg);
goto branch_oc;
branch_ks:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* lgfi %w1,imm (load sign extend imm) */
EMIT6_IMM(0xc0010000, REG_W1, imm);
/* crj or cgrj %dst,%w1,mask,off */
@@ -1223,6 +1224,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
dst_reg, REG_W1, i, off, mask);
break;
branch_ku:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* lgfi %w1,imm (load sign extend imm) */
EMIT6_IMM(0xc0010000, REG_W1, imm);
/* clrj or clgrj %dst,%w1,mask,off */
@@ -1230,11 +1232,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
dst_reg, REG_W1, i, off, mask);
break;
branch_xs:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* crj or cgrj %dst,%src,mask,off */
EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0076 : 0x0064),
dst_reg, src_reg, i, off, mask);
break;
branch_xu:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* clrj or clgrj %dst,%src,mask,off */
EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0077 : 0x0065),
dst_reg, src_reg, i, off, mask);
--
2.16.4
^ permalink raw reply related
* Re: stable 3.18 backport: netlink: Trim skb to alloc size to avoid MSG_TRUNC
From: Mark Salyzyn @ 2019-02-04 15:44 UTC (permalink / raw)
To: linux-kernel
Cc: Ronen Arad, David S . Miller, Dmitry Safonov, David Ahern,
Kirill Tkhai, Andrei Vagin, Li RongQing, YU Bo, Denys Vlasenko,
netdev
In-Reply-To: <20190201194211.44372-1-salyzyn@android.com>
On 02/01/2019 11:41 AM, Mark Salyzyn wrote:
> if (alloc_size < nlk->max_recvmsg_len) {
if (alloc_min_size < nlk->max_recvmgs_len) {
-- Mark
^ permalink raw reply
* Re: [PATCH iproute2-next v3] devlink: report cell size
From: Jiri Pirko @ 2019-02-04 15:25 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: idosch, dsahern, stephen, oss-drivers, netdev
In-Reply-To: <20190204152859.6667-1-jakub.kicinski@netronome.com>
Mon, Feb 04, 2019 at 04:28:59PM CET, jakub.kicinski@netronome.com wrote:
>Print the value of DEVLINK_ATTR_SB_POOL_CELL_SIZE, if reported.
>
>Example:
>pci/0000:82:00.0:
> sb 1 pool 0 type egress size 40945664 thtype static cell_size 2048
> sb 2 pool 0 type egress size 258867200 thtype static cell_size 10240
>...
>
>v3: - don't double space.
>v2: - fix spelling.
>
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply
* Re: [PATCH iproute2-next v4] devlink: add info subcommand
From: Jiri Pirko @ 2019-02-04 15:25 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: dsahern, stephen, netdev, oss-drivers
In-Reply-To: <20190204152820.6607-1-jakub.kicinski@netronome.com>
Mon, Feb 04, 2019 at 04:28:20PM CET, jakub.kicinski@netronome.com wrote:
>Add support for reading the device serial number, driver name
>and various versions. Example:
>
>$ devlink dev info pci/0000:82:00.0
>pci/0000:82:00.0:
> driver nfp
> serial_number 16240145
> versions:
> fixed:
> board.id AMDA0081-0001
> board.rev 15
> board.vendor SMA
> board.model hydrogen
> running:
> fw.mgmt 010181.010181.0101d4
> fw.cpld 0x1030000
> fw.app abm-d372b6
> fw.undi 0.0.2
> chip.init AMDA-0081-0001 20160318164536
> stored:
> fw.mgmt 010181.010181.0101d4
> fw.app abm-d372b6
> fw.undi 0.0.2
> chip.init AMDA-0081-0001 20160318164536
>
>$ devlink -jp dev info pci/0000:82:00.0
>{
> "info": {
> "pci/0000:82:00.0": {
>
I just noticed, this extra line should not be here.
> "driver": "nfp",
> "serial_number": "16240145",
> "versions": {
> "fixed": {
> "board.id": "AMDA0081-0001",
> "board.rev": "15",
> "board.vendor": "SMA",
> "board.model": "hydrogen"
> },
> "running": {
> "fw.mgmt": "010181.010181.0101d4",
> "fw.cpld": "0x1030000",
> "fw.app": "abm-d372b6",
> "fw.undi": "0.0.2",
> "chip.init": "AMDA-0081-0001 20160318164536"
> },
> "stored": {
> "fw.mgmt": "010181.010181.0101d4",
> "fw.app": "abm-d372b6",
> "fw.undi": "0.0.2",
> "chip.init": "AMDA-0081-0001 20160318164536"
> }
> }
> }
> }
>}
[...]
^ permalink raw reply
* Re: [PATCH iproute2-next v3] devlink: add info subcommand
From: Jiri Pirko @ 2019-02-04 15:24 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: dsahern, stephen, netdev, oss-drivers
In-Reply-To: <20190204071302.7a844b0a@cakuba.hsd1.ca.comcast.net>
Mon, Feb 04, 2019 at 04:13:02PM CET, jakub.kicinski@netronome.com wrote:
>On Mon, 4 Feb 2019 15:49:48 +0100, Jiri Pirko wrote:
>> > running:
>> > fw.bundle_id -
>>
>> Wait, what are these "-" ?
>> That looks a bit scarry.
>
>It's a test build of the FW, I wanted to show you the real output with
>all the versions reported... I can use a FW where those are just not
>reported. Do you want me to respin v4 for this?
No problem :)
Acked-by: Jiri Pirko <jiri@mellanox.com>
Thanks!
^ permalink raw reply
* Re: [PATCH net-next v3 01/16] net: sched: protect block state with mutex
From: Jiri Pirko @ 2019-02-04 15:23 UTC (permalink / raw)
To: Vlad Buslov; +Cc: netdev, jhs, xiyou.wangcong, davem, ast, daniel
In-Reply-To: <20190204123301.4223-2-vladbu@mellanox.com>
Mon, Feb 04, 2019 at 01:32:46PM CET, vladbu@mellanox.com wrote:
>Currently, tcf_block doesn't use any synchronization mechanisms to protect
>critical sections that manage lifetime of its chains. block->chain_list and
>multiple variables in tcf_chain that control its lifetime assume external
>synchronization provided by global rtnl lock. Converting chain reference
>counting to atomic reference counters is not possible because cls API uses
>multiple counters and flags to control chain lifetime, so all of them must
>be synchronized in chain get/put code.
>
>Use single per-block lock to protect block data and manage lifetime of all
>chains on the block. Always take block->lock when accessing chain_list.
>Chain get and put modify chain lifetime-management data and parent block's
>chain_list, so take the lock in these functions. Verify block->lock state
>with assertions in functions that expect to be called with the lock taken
>and are called from multiple places. Take block->lock when accessing
>filter_chain_list.
>
>In order to allow parallel update of rules on single block, move all calls
>to classifiers outside of critical sections protected by new block->lock.
>Rearrange chain get and put functions code to only access protected chain
>data while holding block lock:
>- Check if chain was explicitly created inside put function while holding
> block lock. Add additional argument to __tcf_chain_put() to only put
> explicitly created chain.
>- Rearrange code to only access chain reference counter and chain action
> reference counter while holding block lock.
>- Extract code that requires block->lock from tcf_chain_destroy() into
> standalone tcf_chain_destroy() function that is called by
> __tcf_chain_put() in same critical section that changes chain reference
> counters.
>
>Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>---
>
>Changes from V2 to V3:
> - Change block->lock type to mutex.
> - Implement tcf_block_destroy() helper function that destroys
> block->lock mutex before deallocating the block.
> - Revert GFP_KERNEL->GFP_ATOMIC memory allocation flags of tcf_chain
> which is no longer needed after block->lock type change.
>
> include/net/sch_generic.h | 5 +++
> net/sched/cls_api.c | 102 ++++++++++++++++++++++++++++++++++++++--------
> 2 files changed, 89 insertions(+), 18 deletions(-)
>
>diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
>index 7a4957599874..31b8ea66a47d 100644
>--- a/include/net/sch_generic.h
>+++ b/include/net/sch_generic.h
>@@ -12,6 +12,7 @@
> #include <linux/list.h>
> #include <linux/refcount.h>
> #include <linux/workqueue.h>
>+#include <linux/mutex.h>
> #include <net/gen_stats.h>
> #include <net/rtnetlink.h>
>
>@@ -352,6 +353,10 @@ struct tcf_chain {
> };
>
> struct tcf_block {
>+ /* Lock protects tcf_block and lifetime-management data of chains
>+ * attached to the block (refcnt, action_refcnt, explicitly_created).
>+ */
>+ struct mutex lock;
> struct list_head chain_list;
> u32 index; /* block index for shared blocks */
> refcount_t refcnt;
>diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
>index e2b5cb2eb34e..cc416b6a3aa2 100644
>--- a/net/sched/cls_api.c
>+++ b/net/sched/cls_api.c
>@@ -193,6 +193,9 @@ static void tcf_proto_destroy(struct tcf_proto *tp,
> kfree_rcu(tp, rcu);
> }
>
>+#define ASSERT_BLOCK_LOCKED(block) \
>+ lockdep_assert_held(&(block)->lock)
>+
> struct tcf_filter_chain_list_item {
> struct list_head list;
> tcf_chain_head_change_t *chain_head_change;
>@@ -204,6 +207,8 @@ static struct tcf_chain *tcf_chain_create(struct tcf_block *block,
> {
> struct tcf_chain *chain;
>
>+ ASSERT_BLOCK_LOCKED(block);
>+
> chain = kzalloc(sizeof(*chain), GFP_KERNEL);
> if (!chain)
> return NULL;
>@@ -235,25 +240,51 @@ static void tcf_chain0_head_change(struct tcf_chain *chain,
> tcf_chain_head_change_item(item, tp_head);
> }
>
>-static void tcf_chain_destroy(struct tcf_chain *chain)
>+/* Returns true if block can be safely freed. */
>+
>+static bool tcf_chain_detach(struct tcf_chain *chain)
> {
> struct tcf_block *block = chain->block;
>
>+ ASSERT_BLOCK_LOCKED(block);
>+
> list_del(&chain->list);
> if (!chain->index)
> block->chain0.chain = NULL;
>+
>+ if (list_empty(&block->chain_list) &&
>+ refcount_read(&block->refcnt) == 0)
>+ return true;
>+
>+ return false;
>+}
>+
>+static void tcf_block_destroy(struct tcf_block *block)
>+{
>+ mutex_destroy(&block->lock);
>+ kfree_rcu(block, rcu);
>+}
>+
>+static void tcf_chain_destroy(struct tcf_chain *chain, bool free_block)
>+{
>+ struct tcf_block *block = chain->block;
>+
> kfree(chain);
>- if (list_empty(&block->chain_list) && !refcount_read(&block->refcnt))
>- kfree_rcu(block, rcu);
>+ if (free_block)
>+ tcf_block_destroy(block);
> }
>
> static void tcf_chain_hold(struct tcf_chain *chain)
> {
>+ ASSERT_BLOCK_LOCKED(chain->block);
>+
> ++chain->refcnt;
> }
>
> static bool tcf_chain_held_by_acts_only(struct tcf_chain *chain)
> {
>+ ASSERT_BLOCK_LOCKED(chain->block);
>+
> /* In case all the references are action references, this
> * chain should not be shown to the user.
> */
>@@ -265,6 +296,8 @@ static struct tcf_chain *tcf_chain_lookup(struct tcf_block *block,
> {
> struct tcf_chain *chain;
>
>+ ASSERT_BLOCK_LOCKED(block);
>+
> list_for_each_entry(chain, &block->chain_list, list) {
> if (chain->index == chain_index)
> return chain;
>@@ -279,31 +312,40 @@ static struct tcf_chain *__tcf_chain_get(struct tcf_block *block,
> u32 chain_index, bool create,
> bool by_act)
> {
>- struct tcf_chain *chain = tcf_chain_lookup(block, chain_index);
>+ struct tcf_chain *chain = NULL;
>+ bool is_first_reference;
>
>+ mutex_lock(&block->lock);
>+ chain = tcf_chain_lookup(block, chain_index);
> if (chain) {
> tcf_chain_hold(chain);
> } else {
> if (!create)
>- return NULL;
>+ goto errout;
> chain = tcf_chain_create(block, chain_index);
> if (!chain)
>- return NULL;
>+ goto errout;
> }
>
> if (by_act)
> ++chain->action_refcnt;
>+ is_first_reference = chain->refcnt - chain->action_refcnt == 1;
>+ mutex_unlock(&block->lock);
>
> /* Send notification only in case we got the first
> * non-action reference. Until then, the chain acts only as
> * a placeholder for actions pointing to it and user ought
> * not know about them.
> */
>- if (chain->refcnt - chain->action_refcnt == 1 && !by_act)
>+ if (is_first_reference && !by_act)
> tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL,
> RTM_NEWCHAIN, false);
>
> return chain;
>+
>+errout:
>+ mutex_unlock(&block->lock);
>+ return chain;
> }
>
> static struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
>@@ -320,37 +362,59 @@ EXPORT_SYMBOL(tcf_chain_get_by_act);
>
> static void tc_chain_tmplt_del(struct tcf_chain *chain);
>
>-static void __tcf_chain_put(struct tcf_chain *chain, bool by_act)
>+static void __tcf_chain_put(struct tcf_chain *chain, bool by_act,
>+ bool explicitly_created)
> {
>+ struct tcf_block *block = chain->block;
>+ bool is_last, free_block = false;
>+ unsigned int refcnt;
>+
>+ mutex_lock(&block->lock);
>+ if (explicitly_created) {
>+ if (!chain->explicitly_created) {
>+ mutex_unlock(&block->lock);
>+ return;
>+ }
>+ chain->explicitly_created = false;
Hmm, I think that you left "chain->explicitly_created = false" at the
original location (tc_ctl_chain()). I think it would be better to do
the chain->explicitly_created management move in a separate patch.
>+ }
>+
> if (by_act)
> chain->action_refcnt--;
>- chain->refcnt--;
>+
>+ /* tc_chain_notify_delete can't be called while holding block lock.
>+ * However, when block is unlocked chain can be changed concurrently, so
>+ * save these to temporary variables.
>+ */
>+ refcnt = --chain->refcnt;
>+ is_last = refcnt - chain->action_refcnt == 0;
>+ if (refcnt == 0)
>+ free_block = tcf_chain_detach(chain);
>+ mutex_unlock(&block->lock);
>
> /* The last dropped non-action reference will trigger notification. */
>- if (chain->refcnt - chain->action_refcnt == 0 && !by_act)
>+ if (is_last && !by_act)
> tc_chain_notify(chain, NULL, 0, 0, RTM_DELCHAIN, false);
>
>- if (chain->refcnt == 0) {
>+ if (refcnt == 0) {
> tc_chain_tmplt_del(chain);
>- tcf_chain_destroy(chain);
>+ tcf_chain_destroy(chain, free_block);
> }
> }
>
> static void tcf_chain_put(struct tcf_chain *chain)
> {
>- __tcf_chain_put(chain, false);
>+ __tcf_chain_put(chain, false, false);
> }
>
> void tcf_chain_put_by_act(struct tcf_chain *chain)
> {
>- __tcf_chain_put(chain, true);
>+ __tcf_chain_put(chain, true, false);
> }
> EXPORT_SYMBOL(tcf_chain_put_by_act);
>
> static void tcf_chain_put_explicitly_created(struct tcf_chain *chain)
> {
>- if (chain->explicitly_created)
>- tcf_chain_put(chain);
>+ __tcf_chain_put(chain, false, true);
> }
>
> static void tcf_chain_flush(struct tcf_chain *chain)
>@@ -764,6 +828,7 @@ static struct tcf_block *tcf_block_create(struct net *net, struct Qdisc *q,
> NL_SET_ERR_MSG(extack, "Memory allocation for block failed");
> return ERR_PTR(-ENOMEM);
> }
>+ mutex_init(&block->lock);
> INIT_LIST_HEAD(&block->chain_list);
> INIT_LIST_HEAD(&block->cb_list);
> INIT_LIST_HEAD(&block->owner_list);
>@@ -827,7 +892,7 @@ static void tcf_block_put_all_chains(struct tcf_block *block)
> static void __tcf_block_put(struct tcf_block *block, struct Qdisc *q,
> struct tcf_block_ext_info *ei)
> {
>- if (refcount_dec_and_test(&block->refcnt)) {
>+ if (refcount_dec_and_mutex_lock(&block->refcnt, &block->lock)) {
> /* Flushing/putting all chains will cause the block to be
> * deallocated when last chain is freed. However, if chain_list
> * is empty, block has to be manually deallocated. After block
>@@ -836,6 +901,7 @@ static void __tcf_block_put(struct tcf_block *block, struct Qdisc *q,
> */
> bool free_block = list_empty(&block->chain_list);
>
>+ mutex_unlock(&block->lock);
> if (tcf_block_shared(block))
> tcf_block_remove(block, block->net);
> if (!free_block)
>@@ -845,7 +911,7 @@ static void __tcf_block_put(struct tcf_block *block, struct Qdisc *q,
> tcf_block_offload_unbind(block, q, ei);
>
> if (free_block)
>- kfree_rcu(block, rcu);
>+ tcf_block_destroy(block);
> else
> tcf_block_put_all_chains(block);
> } else if (q) {
>--
>2.13.6
>
^ permalink raw reply
* [PATCH iproute2-next v3] devlink: report cell size
From: Jakub Kicinski @ 2019-02-04 15:28 UTC (permalink / raw)
To: idosch, jiri, dsahern; +Cc: stephen, oss-drivers, netdev, Jakub Kicinski
Print the value of DEVLINK_ATTR_SB_POOL_CELL_SIZE, if reported.
Example:
pci/0000:82:00.0:
sb 1 pool 0 type egress size 40945664 thtype static cell_size 2048
sb 2 pool 0 type egress size 258867200 thtype static cell_size 10240
...
v3: - don't double space.
v2: - fix spelling.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
devlink/devlink.c | 3 +++
man/man8/devlink-sb.8 | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index fc4b18d1b613..40f6105af109 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2891,6 +2891,9 @@ static void pr_out_sb_pool(struct dl *dl, struct nlattr **tb)
mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_SIZE]));
pr_out_str(dl, "thtype",
threshold_type_name(mnl_attr_get_u8(tb[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE])));
+ if (tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE])
+ pr_out_uint(dl, "cell_size",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE]));
pr_out_handle_end(dl);
}
diff --git a/man/man8/devlink-sb.8 b/man/man8/devlink-sb.8
index 1882833a3fa7..91b681897d01 100644
--- a/man/man8/devlink-sb.8
+++ b/man/man8/devlink-sb.8
@@ -128,6 +128,16 @@ Behaviour of this argument it the same for every command.
- specifies the devlink device to show pools.
If this argument is omitted all pools of all devices are listed.
+Display available pools listing their
+.B type, size, thtype
+and
+.B cell_size. cell_size
+is the allocation granularity of memory within the shared buffer. Drivers
+may round up, round down or reject
+.B size
+passed to the set command if it is not multiple of
+.B cell_size.
+
.SS devlink sb pool set - set attributes of pool
.PP
--
2.19.2
^ permalink raw reply related
* [PATCH iproute2-next v4] devlink: add info subcommand
From: Jakub Kicinski @ 2019-02-04 15:28 UTC (permalink / raw)
To: jiri, dsahern; +Cc: stephen, netdev, oss-drivers, Jakub Kicinski
Add support for reading the device serial number, driver name
and various versions. Example:
$ devlink dev info pci/0000:82:00.0
pci/0000:82:00.0:
driver nfp
serial_number 16240145
versions:
fixed:
board.id AMDA0081-0001
board.rev 15
board.vendor SMA
board.model hydrogen
running:
fw.mgmt 010181.010181.0101d4
fw.cpld 0x1030000
fw.app abm-d372b6
fw.undi 0.0.2
chip.init AMDA-0081-0001 20160318164536
stored:
fw.mgmt 010181.010181.0101d4
fw.app abm-d372b6
fw.undi 0.0.2
chip.init AMDA-0081-0001 20160318164536
$ devlink -jp dev info pci/0000:82:00.0
{
"info": {
"pci/0000:82:00.0": {
"driver": "nfp",
"serial_number": "16240145",
"versions": {
"fixed": {
"board.id": "AMDA0081-0001",
"board.rev": "15",
"board.vendor": "SMA",
"board.model": "hydrogen"
},
"running": {
"fw.mgmt": "010181.010181.0101d4",
"fw.cpld": "0x1030000",
"fw.app": "abm-d372b6",
"fw.undi": "0.0.2",
"chip.init": "AMDA-0081-0001 20160318164536"
},
"stored": {
"fw.mgmt": "010181.010181.0101d4",
"fw.app": "abm-d372b6",
"fw.undi": "0.0.2",
"chip.init": "AMDA-0081-0001 20160318164536"
}
}
}
}
}
v4:
- more commit message improvements.
v3:
- show up-to-date output in the commit message.
v2 (Jiri):
- remove filtering;
- add example in the commit message.
RFCv2:
- make info subcommand of dev.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
devlink/devlink.c | 169 +++++++++++++++++++++++++++++++++++++++++
man/man8/devlink-dev.8 | 26 +++++++
2 files changed, 195 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 3651e90c1159..fc4b18d1b613 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -383,6 +383,13 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_REGION_CHUNK_DATA] = MNL_TYPE_BINARY,
[DEVLINK_ATTR_REGION_CHUNK_ADDR] = MNL_TYPE_U64,
[DEVLINK_ATTR_REGION_CHUNK_LEN] = MNL_TYPE_U64,
+ [DEVLINK_ATTR_INFO_DRIVER_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_SERIAL_NUMBER] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_FIXED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_RUNNING] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_STORED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_VALUE] = MNL_TYPE_STRING,
};
static int attr_cb(const struct nlattr *attr, void *data)
@@ -1443,6 +1450,7 @@ static void cmd_dev_help(void)
pr_err(" devlink dev param set DEV name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n");
pr_err(" devlink dev param show [DEV name PARAMETER]\n");
pr_err(" devlink dev reload DEV\n");
+ pr_err(" devlink dev info [ DEV ]\n");
}
static bool cmp_arr_last_handle(struct dl *dl, const char *bus_name,
@@ -1775,6 +1783,30 @@ static void pr_out_array_end(struct dl *dl)
}
}
+static void pr_out_object_start(struct dl *dl, const char *name)
+{
+ if (dl->json_output) {
+ jsonw_name(dl->jw, name);
+ jsonw_start_object(dl->jw);
+ } else {
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ pr_out("%s:", name);
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ }
+}
+
+static void pr_out_object_end(struct dl *dl)
+{
+ if (dl->json_output) {
+ jsonw_end_object(dl->jw);
+ } else {
+ __pr_out_indent_dec();
+ __pr_out_indent_dec();
+ }
+}
+
static void pr_out_entry_start(struct dl *dl)
{
if (dl->json_output)
@@ -2415,6 +2447,140 @@ static int cmd_dev_reload(struct dl *dl)
return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
}
+static void pr_out_versions_single(struct dl *dl, const struct nlmsghdr *nlh,
+ const char *name, int type)
+{
+ struct nlattr *version;
+
+ mnl_attr_for_each(version, nlh, sizeof(struct genlmsghdr)) {
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ const char *ver_value;
+ const char *ver_name;
+ int err;
+
+ if (mnl_attr_get_type(version) != type)
+ continue;
+
+ err = mnl_attr_parse_nested(version, attr_cb, tb);
+ if (err != MNL_CB_OK)
+ continue;
+
+ if (!tb[DEVLINK_ATTR_INFO_VERSION_NAME] ||
+ !tb[DEVLINK_ATTR_INFO_VERSION_VALUE])
+ continue;
+
+ if (name) {
+ pr_out_object_start(dl, name);
+ name = NULL;
+ }
+
+ ver_name = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_NAME]);
+ ver_value = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_VALUE]);
+
+ pr_out_str(dl, ver_name, ver_value);
+ if (!dl->json_output)
+ __pr_out_newline();
+ }
+
+ if (!name)
+ pr_out_object_end(dl);
+}
+
+static void pr_out_info(struct dl *dl, const struct nlmsghdr *nlh,
+ struct nlattr **tb, bool has_versions)
+{
+ __pr_out_handle_start(dl, tb, true, false);
+
+ __pr_out_indent_inc();
+ if (tb[DEVLINK_ATTR_INFO_DRIVER_NAME]) {
+ struct nlattr *nla_drv = tb[DEVLINK_ATTR_INFO_DRIVER_NAME];
+
+ __pr_out_newline();
+ pr_out_str(dl, "driver", mnl_attr_get_str(nla_drv));
+ }
+
+ if (tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER]) {
+ struct nlattr *nla_sn = tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER];
+
+ __pr_out_newline();
+ pr_out_str(dl, "serial_number", mnl_attr_get_str(nla_sn));
+ }
+ __pr_out_indent_dec();
+
+ if (has_versions) {
+ pr_out_object_start(dl, "versions");
+
+ pr_out_versions_single(dl, nlh, "fixed",
+ DEVLINK_ATTR_INFO_VERSION_FIXED);
+ pr_out_versions_single(dl, nlh, "running",
+ DEVLINK_ATTR_INFO_VERSION_RUNNING);
+ pr_out_versions_single(dl, nlh, "stored",
+ DEVLINK_ATTR_INFO_VERSION_STORED);
+
+ pr_out_object_end(dl);
+ }
+
+ pr_out_handle_end(dl);
+}
+
+static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data)
+{
+ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ bool has_versions, has_info;
+ struct dl *dl = data;
+
+ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
+
+ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME])
+ return MNL_CB_ERROR;
+
+ has_versions = tb[DEVLINK_ATTR_INFO_VERSION_FIXED] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_RUNNING] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_STORED];
+ has_info = tb[DEVLINK_ATTR_INFO_DRIVER_NAME] ||
+ tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER] ||
+ has_versions;
+
+ if (has_info)
+ pr_out_info(dl, nlh, tb, has_versions);
+
+ return MNL_CB_OK;
+}
+
+static void cmd_dev_info_help(void)
+{
+ pr_err("Usage: devlink dev info [ DEV ]\n");
+}
+
+static int cmd_dev_info(struct dl *dl)
+{
+ struct nlmsghdr *nlh;
+ uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
+ int err;
+
+ if (dl_argv_match(dl, "help")) {
+ cmd_dev_info_help();
+ return 0;
+ }
+
+ if (dl_argc(dl) == 0)
+ flags |= NLM_F_DUMP;
+
+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_INFO_GET, flags);
+
+ if (dl_argc(dl) > 0) {
+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0);
+ if (err)
+ return err;
+ }
+
+ pr_out_section_start(dl, "info");
+ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_versions_show_cb, dl);
+ pr_out_section_end(dl);
+ return err;
+}
+
static int cmd_dev(struct dl *dl)
{
if (dl_argv_match(dl, "help")) {
@@ -2433,6 +2599,9 @@ static int cmd_dev(struct dl *dl)
} else if (dl_argv_match(dl, "param")) {
dl_arg_inc(dl);
return cmd_dev_param(dl);
+ } else if (dl_argv_match(dl, "info")) {
+ dl_arg_inc(dl);
+ return cmd_dev_info(dl);
}
pr_err("Command \"%s\" not found\n", dl_argv(dl));
return -ENOENT;
diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8
index d985da172aa0..47838371fecd 100644
--- a/man/man8/devlink-dev.8
+++ b/man/man8/devlink-dev.8
@@ -63,6 +63,12 @@ devlink-dev \- devlink device configuration
.BR "devlink dev reload"
.IR DEV
+.ti -8
+.BR "devlink dev info"
+.RI "[ "
+.IR DEV
+.RI "]"
+
.SH "DESCRIPTION"
.SS devlink dev show - display devlink device attributes
@@ -151,6 +157,26 @@ If this argument is omitted all parameters supported by devlink devices are list
.I "DEV"
- Specifies the devlink device to reload.
+.SS devlink dev info - display device information.
+Display device information provided by the driver. This command can be used
+to query versions of the hardware components or device components which
+can't be updated (
+.I fixed
+) as well as device firmware which can be updated. For firmware components
+.I running
+displays the versions of firmware currently loaded into the device, while
+.I stored
+reports the versions in device's flash.
+.I Running
+and
+.I stored
+versions may differ after flash has been updated, but before reboot.
+
+.PP
+.I "DEV"
+- specifies the devlink device to show.
+If this argument is omitted all devices are listed.
+
.SH "EXAMPLES"
.PP
devlink dev show
--
2.19.2
^ permalink raw reply related
* Re: [PATCH 7/7] sh_eth: offload RX checksum on SH7763
From: Sergei Shtylyov @ 2019-02-04 15:17 UTC (permalink / raw)
To: Rob Landley, netdev, David S. Miller; +Cc: linux-renesas-soc, linux-sh
In-Reply-To: <2859e252-a900-fdc7-bfd8-d1b7663174f2@landley.net>
Hello!
On 02/04/2019 02:55 PM, Rob Landley wrote:
>> The SH7763 SoC manual describes the Ether MAC's RX checksum offload
>> the same way as it's implemented in the EtherAVB MACs...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> I think this is the chip in the JCI N40 on my desk, how would I test this and
> tell it was working? (Is there an existing test program or...?)
There are programs, yes. I used (rather old) netperf-2.2pl4 (I can send it to
you) running under perf (provided by the Poky rootfs). The details running netperf
on target are in the patch description #2; on host you just run netserver from that
same testsuite. The current netperf is maintained by HP on github but I was unable
to figure out how to build it quickly enough... :-)
> Also, can this be tested under QEMU's r2 board emulation?
I have no idea, sorry.
> Rob
MBR, Sergei
^ permalink raw reply
* Re: [PATCH iproute2-next v3] devlink: add info subcommand
From: Jakub Kicinski @ 2019-02-04 15:13 UTC (permalink / raw)
To: Jiri Pirko; +Cc: dsahern, stephen, netdev, oss-drivers
In-Reply-To: <20190204144948.GA2118@nanopsycho>
On Mon, 4 Feb 2019 15:49:48 +0100, Jiri Pirko wrote:
> > running:
> > fw.bundle_id -
>
> Wait, what are these "-" ?
> That looks a bit scarry.
It's a test build of the FW, I wanted to show you the real output with
all the versions reported... I can use a FW where those are just not
reported. Do you want me to respin v4 for this?
^ permalink raw reply
* Re: [PATCH iproute2-next v2] devlink: report cell size
From: Jiri Pirko @ 2019-02-04 14:51 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: idosch, dsahern, stephen, oss-drivers, netdev
In-Reply-To: <20190204144442.5704-1-jakub.kicinski@netronome.com>
Mon, Feb 04, 2019 at 03:44:42PM CET, jakub.kicinski@netronome.com wrote:
>Print the value of DEVLINK_ATTR_SB_POOL_CELL_SIZE, if reported.
>
>Example:
>pci/0000:82:00.0:
> sb 1 pool 0 type egress size 40945664 thtype static cell_size 2048
> sb 2 pool 0 type egress size 258867200 thtype static cell_size 10240
>...
>
>v2: - fix spelling.
>
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
>---
> devlink/devlink.c | 3 +++
> man/man8/devlink-sb.8 | 10 ++++++++++
> 2 files changed, 13 insertions(+)
>
>diff --git a/devlink/devlink.c b/devlink/devlink.c
>index fc4b18d1b613..40f6105af109 100644
>--- a/devlink/devlink.c
>+++ b/devlink/devlink.c
>@@ -2891,6 +2891,9 @@ static void pr_out_sb_pool(struct dl *dl, struct nlattr **tb)
> mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_SIZE]));
> pr_out_str(dl, "thtype",
> threshold_type_name(mnl_attr_get_u8(tb[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE])));
>+ if (tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE])
>+ pr_out_uint(dl, "cell_size",
>+ mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE]));
> pr_out_handle_end(dl);
> }
>
>diff --git a/man/man8/devlink-sb.8 b/man/man8/devlink-sb.8
>index 1882833a3fa7..0deacd9ccd23 100644
>--- a/man/man8/devlink-sb.8
>+++ b/man/man8/devlink-sb.8
>@@ -128,6 +128,16 @@ Behaviour of this argument it the same for every command.
> - specifies the devlink device to show pools.
> If this argument is omitted all pools of all devices are listed.
>
>+Display available pools listing their
>+.B type, size, thtype
>+and
>+.B cell_size. cell_size
>+is the allocation granularity of memory within the shared buffer. Drivers
Double space. Other than this nit, looks fine to me.
>+may round up, round down or reject
>+.B size
>+passed to the set command if it is not multiple of
>+.B cell_size.
>+
> .SS devlink sb pool set - set attributes of pool
>
> .PP
>--
>2.19.2
>
^ permalink raw reply
* Re: [net-next RFC/PATCH] net: nixge: Make mdio child node optional
From: Andrew Lunn @ 2019-02-04 14:58 UTC (permalink / raw)
To: Moritz Fischer
Cc: linux-kernel, netdev, devicetree, davem, alex.williams,
Rob Herring
In-Reply-To: <20190202025048.14772-1-mdf@kernel.org>
On Fri, Feb 01, 2019 at 06:50:48PM -0800, Moritz Fischer wrote:
> Make MDIO child optional and only instantiate the
> MDIO bus if the child is actually present.
>
> There are currently no (in-tree) users of this
> binding; all (out-of-tree) users use overlays that
> get shipped together with the FPGA images that contain
> the IP.
>
> This will significantly increase maintainabilty
> of future revisions of this IP.
>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Rob Herring <robh+dt@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply
* Re: [PATCH iproute2-next v3] devlink: add info subcommand
From: Jiri Pirko @ 2019-02-04 14:49 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: dsahern, stephen, netdev, oss-drivers
In-Reply-To: <20190204144343.5639-1-jakub.kicinski@netronome.com>
Mon, Feb 04, 2019 at 03:43:43PM CET, jakub.kicinski@netronome.com wrote:
>Add support for reading the device serial number, driver name
>and various versions. Example:
>
>$ devlink dev info pci/0000:82:00.0
>pci/0000:82:00.0:
> driver nfp
> serial_number 16240145
> versions:
> fixed:
> board.id AMDA0081-0001
> board.rev 15
> board.vendor SMA
> board.model hydrogen
> running:
> fw.bundle_id -
Wait, what are these "-" ?
That looks a bit scarry.
> fw.mgmt 010181.010181.0101d4
> fw.cpld 0x1030000
> fw.app abm-d372b6
> fw.undi 0.0.0
> fw.ncsi -
> chip.init AMDA-0081-0001 20160318164536
> stored:
> fw.bundle_id -
> fw.mgmt 010181.010181.0101d4
> fw.cpld 0xfeedbeef
> fw.app -
> fw.undi 0.0.0
> fw.ncsi -
> chip.init AMDA-0081-0001 20160318164536
>
>$ devlink -jp dev info pci/0000:82:00.0
>{
> "info": {
> "pci/0000:82:00.0": {
>
> "driver": "nfp",
> "serial_number": "16240145",
> "versions": {
> "fixed": {
> "board.id": "AMDA0081-0001",
> "board.rev": "15",
> "board.vendor": "SMA",
> "board.model": "hydrogen"
> },
> "running": {
> "fw.bundle_id": "-",
> "fw.mgmt": "010181.010181.0101d4",
> "fw.cpld": "0x1030000",
> "fw.app": "abm-d372b6",
> "fw.undi": "0.0.0",
> "fw.ncsi": "-",
> "chip.init": "AMDA-0081-0001 20160318164536"
> },
> "stored": {
> "fw.bundle_id": "-",
> "fw.mgmt": "010181.010181.0101d4",
> "fw.cpld": "0xfeedbeef",
> "fw.app": "-",
> "fw.undi": "0.0.0",
> "fw.ncsi": "-",
> "chip.init": "AMDA-0081-0001 20160318164536"
> }
> }
> }
> }
>}
>
>v3:
> - show up-to-date output in the commit message.
>v2 (Jiri):
> - remove filtering;
> - add example in the commit message.
>RFCv2:
> - make info subcommand of dev.
>
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
[...]
^ permalink raw reply
* Re: [PATCH v2 2/2] netdev/phy: add MDIO bus multiplexer driven by a regmap
From: kbuild test robot @ 2019-02-04 14:51 UTC (permalink / raw)
To: Pankaj Bansal
Cc: kbuild-all, Andrew Lunn, Florian Fainelli, netdev@vger.kernel.org,
Pankaj Bansal
In-Reply-To: <20190204142435.21175-3-pankaj.bansal@nxp.com>
[-- Attachment #1: Type: text/plain, Size: 5241 bytes --]
Hi Pankaj,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pankaj-Bansal/add-MDIO-bus-multiplexer-driven-by-a-regmap-device/20190204-213429
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=sh
All errors (new ones prefixed by >>):
>> drivers/net/phy/mdio-mux-regmap.c:72:5: error: redefinition of 'mdio_mux_regmap_init'
int mdio_mux_regmap_init(struct device *dev,
^~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/phy/mdio-mux-regmap.c:18:
include/linux/mdio-mux.h:53:19: note: previous definition of 'mdio_mux_regmap_init' was here
static inline int mdio_mux_regmap_init(struct device *dev,
^~~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/mdio-mux-regmap.c:158:5: error: redefinition of 'mdio_mux_regmap_uninit'
int mdio_mux_regmap_uninit(void *data)
^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/phy/mdio-mux-regmap.c:18:
include/linux/mdio-mux.h:60:19: note: previous definition of 'mdio_mux_regmap_uninit' was here
static inline int mdio_mux_regmap_uninit(void *data)
^~~~~~~~~~~~~~~~~~~~~~
vim +/mdio_mux_regmap_init +72 drivers/net/phy/mdio-mux-regmap.c
62
63 /**
64 * mdio_mux_regmap_init - control MDIO bus muxing using regmap constructs.
65 * @dev: device with which regmap construct is associated.
66 * @mux_node: mdio bus mux node that contains parent mdio bus phandle.
67 * This node also contains sub nodes, where each subnode denotes
68 * a child mdio bus. All the child mdio buses are muxed, i.e. at a
69 * time only one of the child mdio buses can be used.
70 * @data: to store the address of data allocated by this function
71 */
> 72 int mdio_mux_regmap_init(struct device *dev,
73 struct device_node *mux_node,
74 void **data)
75 {
76 struct device_node *child;
77 struct mdio_mux_regmap_state *s;
78 int ret;
79 u32 val;
80
81 dev_dbg(dev, "probing node %pOF\n", mux_node);
82
83 s = devm_kzalloc(dev, sizeof(*s), GFP_KERNEL);
84 if (!s)
85 return -ENOMEM;
86
87 s->regmap = dev_get_regmap(dev, NULL);
88 if (IS_ERR(s->regmap)) {
89 dev_err(dev, "Failed to get parent regmap\n");
90 return PTR_ERR(s->regmap);
91 }
92
93 ret = of_property_read_u32(mux_node, "reg", &s->mux_reg);
94 if (ret) {
95 dev_err(dev, "missing or invalid reg property\n");
96 return -ENODEV;
97 }
98
99 /* Test Register read write */
100 ret = regmap_read(s->regmap, s->mux_reg, &val);
101 if (ret) {
102 dev_err(dev, "error while reading reg\n");
103 return ret;
104 }
105
106 ret = regmap_write(s->regmap, s->mux_reg, val);
107 if (ret) {
108 dev_err(dev, "error while writing reg\n");
109 return ret;
110 }
111
112 ret = of_property_read_u32(mux_node, "mux-mask", &s->mask);
113 if (ret) {
114 dev_err(dev, "missing or invalid mux-mask property\n");
115 return -ENODEV;
116 }
117
118 /* Verify that the 'reg' property of each child MDIO bus does not
119 * set any bits outside of the 'mask'.
120 */
121 for_each_available_child_of_node(mux_node, child) {
122 ret = of_property_read_u32(child, "reg", &val);
123 if (ret) {
124 dev_err(dev, "%pOF is missing a 'reg' property\n",
125 child);
126 of_node_put(child);
127 return -ENODEV;
128 }
129 if (val & ~s->mask) {
130 dev_err(dev,
131 "%pOF has a 'reg' value with unmasked bits\n",
132 child);
133 of_node_put(child);
134 return -ENODEV;
135 }
136 }
137
138 ret = mdio_mux_init(dev, mux_node, mdio_mux_regmap_switch_fn,
139 &s->mux_handle, s, NULL);
140 if (ret) {
141 if (ret != -EPROBE_DEFER)
142 dev_err(dev, "failed to register mdio-mux bus %pOF\n",
143 mux_node);
144 return ret;
145 }
146
147 *data = s;
148
149 return 0;
150 }
151 EXPORT_SYMBOL_GPL(mdio_mux_regmap_init);
152
153 /**
154 * mdio_mux_regmap_uninit - relinquish the control of MDIO bus muxing using
155 * regmap constructs.
156 * @data: address of data allocated by mdio_mux_regmap_init
157 */
> 158 int mdio_mux_regmap_uninit(void *data)
159 {
160 struct mdio_mux_regmap_state *s = data;
161
162 mdio_mux_uninit(s->mux_handle);
163
164 return 0;
165 }
166 EXPORT_SYMBOL_GPL(mdio_mux_regmap_uninit);
167
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50803 bytes --]
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix decrementing reference count twice in releasing socket
From: Marcel Holtmann @ 2019-02-04 14:53 UTC (permalink / raw)
To: Myungho Jung
Cc: Johan Hedberg, David S. Miller, linux-bluetooth, netdev,
linux-kernel
In-Reply-To: <20190203005634.GA19908@myunghoj-Precision-5530>
Hi Myungho,
> When releasing socket, it is possible to enter hci_sock_release() and
> hci_sock_dev_event(HCI_DEV_UNREG) at the same time in different thread.
> The reference count of hdev should be decremented only once from one of
> them but if storing hdev to local variable in hci_sock_release() before
> detached from socket and setting to NULL in hci_sock_dev_event(),
> hci_dev_put(hdev) is unexpectedly called twice. This is resolved by
> referencing hdev from socket after bt_sock_unlink() in
> hci_sock_release().
>
> Reported-by: syzbot+fdc00003f4efff43bc5b@syzkaller.appspotmail.com
> Signed-off-by: Myungho Jung <mhjungk@gmail.com>
> ---
> net/bluetooth/hci_sock.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH bpf-next v4 0/3] tools/bpf: changes of libbpf debug interfaces
From: Arnaldo Carvalho de Melo @ 2019-02-04 14:51 UTC (permalink / raw)
To: Yonghong Song
Cc: Alexei Starovoitov, Magnus Karlsson, netdev, Alexei Starovoitov,
Daniel Borkmann, kernel-team, Arnaldo Carvalho de Melo
In-Reply-To: <20190202165228.jrcghbvro4st4thd@ast-mbp>
Em Sat, Feb 02, 2019 at 08:52:30AM -0800, Alexei Starovoitov escreveu:
> On Fri, Feb 01, 2019 at 04:14:13PM -0800, Yonghong Song wrote:
> > These are patches responding to my comments for
> > Magnus's patch (https://patchwork.ozlabs.org/patch/1032848/).
> > The goal is to make pr_* macros available to other C files
> > than libbpf.c, and to simplify API function libbpf_set_print().
> >
> > Specifically, Patch #1 used global functions
> > to facilitate pr_* macros in the header files so they
> > are available in different C files.
> > Patch #2 removes the global function libbpf_print_level_available()
> > which is added in Patch 1.
> > Patch #3 simplified libbpf_set_print() which takes only one print
> > function with a debug level argument among others.
> >
> > Changelogs:
> > v3 -> v4:
> > . rename libbpf internal header util.h to libbpf_util.h
> > . rename libbpf internal function libbpf_debug_print() to libbpf_print()
> > v2 -> v3:
> > . bailed out earlier in libbpf_debug_print() if __libbpf_pr is NULL
> > . added missing LIBBPF_DEBUG level check in libbpf.c __base_pr().
> > v1 -> v2:
> > . Renamed global function libbpf_dprint() to libbpf_debug_print()
> > to be more expressive.
> > . Removed libbpf_dprint_level_available() as it is used only
> > once in btf.c and we can remove it by optimizing for common cases.
> >
> > Yonghong Song (3):
> > tools/bpf: move libbpf pr_* debug print functions to headers
> > tools/bpf: print out btf log at LIBBPF_WARN level
> > tools/bpf: simplify libbpf API function libbpf_set_print()
> >
> > tools/lib/bpf/btf.c | 110 +++++++++---------
> > tools/lib/bpf/btf.h | 7 +-
> > tools/lib/bpf/libbpf.c | 47 ++++----
> > tools/lib/bpf/libbpf.h | 20 ++--
> > tools/lib/bpf/libbpf_util.h | 30 +++++
> > tools/lib/bpf/test_libbpf.cpp | 4 +-
> > tools/perf/util/bpf-loader.c | 32 ++---
>
> Overall looks good to me.
> Arnaldo, could you ack the set, so we can take it into bpf-next?
LGTM
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Arnaldo
^ permalink raw reply
* [PATCH net] net: cls_flower: Remove filter from mask before freeing it
From: Petr Machata @ 2019-02-04 14:50 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
Ido Schimmel, Paul Blakey, davem@davemloft.net
In fl_change(), when adding a new rule (i.e. fold == NULL), a driver may
reject the new rule, for example due to resource exhaustion. By that
point, the new rule was already assigned a mask, and it was added to
that mask's hash table. The clean-up path that's invoked as a result of
the rejection however neglects to undo the hash table addition, and
proceeds to free the new rule, thus leaving a dangling pointer in the
hash table.
Fix by removing fnew from the mask's hash table before it is freed.
Fixes: 35cc3cefc4de ("net/sched: cls_flower: Reject duplicated rules
also under skip_sw")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
---
Notes:
Note that this is covered by mirror_gre_scale test in
tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
net/sched/cls_flower.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index f6aa57fbbbaf..12ca9d13db83 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1371,7 +1371,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
if (!tc_skip_hw(fnew->flags)) {
err = fl_hw_replace_filter(tp, fnew, extack);
if (err)
- goto errout_mask;
+ goto errout_mask_ht;
}
if (!tc_in_hw(fnew->flags))
@@ -1401,6 +1401,10 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
kfree(mask);
return 0;
+errout_mask_ht:
+ rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node,
+ fnew->mask->filter_ht_params);
+
errout_mask:
fl_mask_put(head, fnew->mask, false);
--
2.4.11
^ permalink raw reply related
* [PATCH iproute2-next v2] devlink: report cell size
From: Jakub Kicinski @ 2019-02-04 14:44 UTC (permalink / raw)
To: idosch, jiri, dsahern; +Cc: stephen, oss-drivers, netdev, Jakub Kicinski
Print the value of DEVLINK_ATTR_SB_POOL_CELL_SIZE, if reported.
Example:
pci/0000:82:00.0:
sb 1 pool 0 type egress size 40945664 thtype static cell_size 2048
sb 2 pool 0 type egress size 258867200 thtype static cell_size 10240
...
v2: - fix spelling.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
devlink/devlink.c | 3 +++
man/man8/devlink-sb.8 | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index fc4b18d1b613..40f6105af109 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2891,6 +2891,9 @@ static void pr_out_sb_pool(struct dl *dl, struct nlattr **tb)
mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_SIZE]));
pr_out_str(dl, "thtype",
threshold_type_name(mnl_attr_get_u8(tb[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE])));
+ if (tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE])
+ pr_out_uint(dl, "cell_size",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_SB_POOL_CELL_SIZE]));
pr_out_handle_end(dl);
}
diff --git a/man/man8/devlink-sb.8 b/man/man8/devlink-sb.8
index 1882833a3fa7..0deacd9ccd23 100644
--- a/man/man8/devlink-sb.8
+++ b/man/man8/devlink-sb.8
@@ -128,6 +128,16 @@ Behaviour of this argument it the same for every command.
- specifies the devlink device to show pools.
If this argument is omitted all pools of all devices are listed.
+Display available pools listing their
+.B type, size, thtype
+and
+.B cell_size. cell_size
+is the allocation granularity of memory within the shared buffer. Drivers
+may round up, round down or reject
+.B size
+passed to the set command if it is not multiple of
+.B cell_size.
+
.SS devlink sb pool set - set attributes of pool
.PP
--
2.19.2
^ permalink raw reply related
* [PATCH iproute2-next v3] devlink: add info subcommand
From: Jakub Kicinski @ 2019-02-04 14:43 UTC (permalink / raw)
To: jiri, dsahern; +Cc: stephen, netdev, oss-drivers, Jakub Kicinski
Add support for reading the device serial number, driver name
and various versions. Example:
$ devlink dev info pci/0000:82:00.0
pci/0000:82:00.0:
driver nfp
serial_number 16240145
versions:
fixed:
board.id AMDA0081-0001
board.rev 15
board.vendor SMA
board.model hydrogen
running:
fw.bundle_id -
fw.mgmt 010181.010181.0101d4
fw.cpld 0x1030000
fw.app abm-d372b6
fw.undi 0.0.0
fw.ncsi -
chip.init AMDA-0081-0001 20160318164536
stored:
fw.bundle_id -
fw.mgmt 010181.010181.0101d4
fw.cpld 0xfeedbeef
fw.app -
fw.undi 0.0.0
fw.ncsi -
chip.init AMDA-0081-0001 20160318164536
$ devlink -jp dev info pci/0000:82:00.0
{
"info": {
"pci/0000:82:00.0": {
"driver": "nfp",
"serial_number": "16240145",
"versions": {
"fixed": {
"board.id": "AMDA0081-0001",
"board.rev": "15",
"board.vendor": "SMA",
"board.model": "hydrogen"
},
"running": {
"fw.bundle_id": "-",
"fw.mgmt": "010181.010181.0101d4",
"fw.cpld": "0x1030000",
"fw.app": "abm-d372b6",
"fw.undi": "0.0.0",
"fw.ncsi": "-",
"chip.init": "AMDA-0081-0001 20160318164536"
},
"stored": {
"fw.bundle_id": "-",
"fw.mgmt": "010181.010181.0101d4",
"fw.cpld": "0xfeedbeef",
"fw.app": "-",
"fw.undi": "0.0.0",
"fw.ncsi": "-",
"chip.init": "AMDA-0081-0001 20160318164536"
}
}
}
}
}
v3:
- show up-to-date output in the commit message.
v2 (Jiri):
- remove filtering;
- add example in the commit message.
RFCv2:
- make info subcommand of dev.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
devlink/devlink.c | 169 +++++++++++++++++++++++++++++++++++++++++
man/man8/devlink-dev.8 | 26 +++++++
2 files changed, 195 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 3651e90c1159..fc4b18d1b613 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -383,6 +383,13 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_REGION_CHUNK_DATA] = MNL_TYPE_BINARY,
[DEVLINK_ATTR_REGION_CHUNK_ADDR] = MNL_TYPE_U64,
[DEVLINK_ATTR_REGION_CHUNK_LEN] = MNL_TYPE_U64,
+ [DEVLINK_ATTR_INFO_DRIVER_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_SERIAL_NUMBER] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_FIXED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_RUNNING] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_STORED] = MNL_TYPE_NESTED,
+ [DEVLINK_ATTR_INFO_VERSION_NAME] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_VERSION_VALUE] = MNL_TYPE_STRING,
};
static int attr_cb(const struct nlattr *attr, void *data)
@@ -1443,6 +1450,7 @@ static void cmd_dev_help(void)
pr_err(" devlink dev param set DEV name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n");
pr_err(" devlink dev param show [DEV name PARAMETER]\n");
pr_err(" devlink dev reload DEV\n");
+ pr_err(" devlink dev info [ DEV ]\n");
}
static bool cmp_arr_last_handle(struct dl *dl, const char *bus_name,
@@ -1775,6 +1783,30 @@ static void pr_out_array_end(struct dl *dl)
}
}
+static void pr_out_object_start(struct dl *dl, const char *name)
+{
+ if (dl->json_output) {
+ jsonw_name(dl->jw, name);
+ jsonw_start_object(dl->jw);
+ } else {
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ pr_out("%s:", name);
+ __pr_out_indent_inc();
+ __pr_out_newline();
+ }
+}
+
+static void pr_out_object_end(struct dl *dl)
+{
+ if (dl->json_output) {
+ jsonw_end_object(dl->jw);
+ } else {
+ __pr_out_indent_dec();
+ __pr_out_indent_dec();
+ }
+}
+
static void pr_out_entry_start(struct dl *dl)
{
if (dl->json_output)
@@ -2415,6 +2447,140 @@ static int cmd_dev_reload(struct dl *dl)
return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
}
+static void pr_out_versions_single(struct dl *dl, const struct nlmsghdr *nlh,
+ const char *name, int type)
+{
+ struct nlattr *version;
+
+ mnl_attr_for_each(version, nlh, sizeof(struct genlmsghdr)) {
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ const char *ver_value;
+ const char *ver_name;
+ int err;
+
+ if (mnl_attr_get_type(version) != type)
+ continue;
+
+ err = mnl_attr_parse_nested(version, attr_cb, tb);
+ if (err != MNL_CB_OK)
+ continue;
+
+ if (!tb[DEVLINK_ATTR_INFO_VERSION_NAME] ||
+ !tb[DEVLINK_ATTR_INFO_VERSION_VALUE])
+ continue;
+
+ if (name) {
+ pr_out_object_start(dl, name);
+ name = NULL;
+ }
+
+ ver_name = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_NAME]);
+ ver_value = mnl_attr_get_str(tb[DEVLINK_ATTR_INFO_VERSION_VALUE]);
+
+ pr_out_str(dl, ver_name, ver_value);
+ if (!dl->json_output)
+ __pr_out_newline();
+ }
+
+ if (!name)
+ pr_out_object_end(dl);
+}
+
+static void pr_out_info(struct dl *dl, const struct nlmsghdr *nlh,
+ struct nlattr **tb, bool has_versions)
+{
+ __pr_out_handle_start(dl, tb, true, false);
+
+ __pr_out_indent_inc();
+ if (tb[DEVLINK_ATTR_INFO_DRIVER_NAME]) {
+ struct nlattr *nla_drv = tb[DEVLINK_ATTR_INFO_DRIVER_NAME];
+
+ __pr_out_newline();
+ pr_out_str(dl, "driver", mnl_attr_get_str(nla_drv));
+ }
+
+ if (tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER]) {
+ struct nlattr *nla_sn = tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER];
+
+ __pr_out_newline();
+ pr_out_str(dl, "serial_number", mnl_attr_get_str(nla_sn));
+ }
+ __pr_out_indent_dec();
+
+ if (has_versions) {
+ pr_out_object_start(dl, "versions");
+
+ pr_out_versions_single(dl, nlh, "fixed",
+ DEVLINK_ATTR_INFO_VERSION_FIXED);
+ pr_out_versions_single(dl, nlh, "running",
+ DEVLINK_ATTR_INFO_VERSION_RUNNING);
+ pr_out_versions_single(dl, nlh, "stored",
+ DEVLINK_ATTR_INFO_VERSION_STORED);
+
+ pr_out_object_end(dl);
+ }
+
+ pr_out_handle_end(dl);
+}
+
+static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data)
+{
+ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
+ bool has_versions, has_info;
+ struct dl *dl = data;
+
+ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
+
+ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME])
+ return MNL_CB_ERROR;
+
+ has_versions = tb[DEVLINK_ATTR_INFO_VERSION_FIXED] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_RUNNING] ||
+ tb[DEVLINK_ATTR_INFO_VERSION_STORED];
+ has_info = tb[DEVLINK_ATTR_INFO_DRIVER_NAME] ||
+ tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER] ||
+ has_versions;
+
+ if (has_info)
+ pr_out_info(dl, nlh, tb, has_versions);
+
+ return MNL_CB_OK;
+}
+
+static void cmd_dev_info_help(void)
+{
+ pr_err("Usage: devlink dev info [ DEV ]\n");
+}
+
+static int cmd_dev_info(struct dl *dl)
+{
+ struct nlmsghdr *nlh;
+ uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
+ int err;
+
+ if (dl_argv_match(dl, "help")) {
+ cmd_dev_info_help();
+ return 0;
+ }
+
+ if (dl_argc(dl) == 0)
+ flags |= NLM_F_DUMP;
+
+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_INFO_GET, flags);
+
+ if (dl_argc(dl) > 0) {
+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0);
+ if (err)
+ return err;
+ }
+
+ pr_out_section_start(dl, "info");
+ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_versions_show_cb, dl);
+ pr_out_section_end(dl);
+ return err;
+}
+
static int cmd_dev(struct dl *dl)
{
if (dl_argv_match(dl, "help")) {
@@ -2433,6 +2599,9 @@ static int cmd_dev(struct dl *dl)
} else if (dl_argv_match(dl, "param")) {
dl_arg_inc(dl);
return cmd_dev_param(dl);
+ } else if (dl_argv_match(dl, "info")) {
+ dl_arg_inc(dl);
+ return cmd_dev_info(dl);
}
pr_err("Command \"%s\" not found\n", dl_argv(dl));
return -ENOENT;
diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8
index d985da172aa0..47838371fecd 100644
--- a/man/man8/devlink-dev.8
+++ b/man/man8/devlink-dev.8
@@ -63,6 +63,12 @@ devlink-dev \- devlink device configuration
.BR "devlink dev reload"
.IR DEV
+.ti -8
+.BR "devlink dev info"
+.RI "[ "
+.IR DEV
+.RI "]"
+
.SH "DESCRIPTION"
.SS devlink dev show - display devlink device attributes
@@ -151,6 +157,26 @@ If this argument is omitted all parameters supported by devlink devices are list
.I "DEV"
- Specifies the devlink device to reload.
+.SS devlink dev info - display device information.
+Display device information provided by the driver. This command can be used
+to query versions of the hardware components or device components which
+can't be updated (
+.I fixed
+) as well as device firmware which can be updated. For firmware components
+.I running
+displays the versions of firmware currently loaded into the device, while
+.I stored
+reports the versions in device's flash.
+.I Running
+and
+.I stored
+versions may differ after flash has been updated, but before reboot.
+
+.PP
+.I "DEV"
+- specifies the devlink device to show.
+If this argument is omitted all devices are listed.
+
.SH "EXAMPLES"
.PP
devlink dev show
--
2.19.2
^ permalink raw reply related
* Re: stmmac / meson8b-dwmac
From: Martin Blumenstingl @ 2019-02-04 14:34 UTC (permalink / raw)
To: ingrassia, Gpeppe.cavallaro, alexandre.torgue
Cc: Simon Huelck, linux-amlogic, netdev
In-Reply-To: <e05b7448-cd95-cdeb-c88d-3a324d5f1ddc@gmx.de>
On Thu, Jan 17, 2019 at 10:23 PM Simon Huelck <simonmail@gmx.de> wrote:
[...]
> >> I got problems with my ODROID c2 running on 4.19.16 ( and some releases
> >> earlier ). the stmmac / dwmac driver doesnt provide the 800M/900M
> >> performance that i was used to earlier.
> >>
> >>
> >> Now im stuck near 550M/600M in the same environment. but what really
> >> confuses me that duplex does hurt even more.
> > interesting that you see this on the Odroid-C2 as well.
> > previously I have only observed it on an Odroid-C1
> >
> >> PC --- VLAN3 --> switch --VLAN3--> ODROID
> >>
> >> NAS <-- VLAN1 -- switch <-- VLAN1-- ODROID
> >>
> >>
> >> this means when im doing a iperf from PC to NAS, that my ODROID has load
> >> on RX/TX same time (duplex). this shouldnt be an issue , all is 1GBits
> >> FD. And in the past that wasnt an issue.
+Cc Emiliano who has seen a similar duplex issue on his Odroid-C1: [0]
(please note that all kernels prior to v5.1 with the pending patches
from [1] applied are only receiving data on RXD0 and RXD1 but not on
RXD2 and RXD3)
Emiliano, can you confirm the duplex issue observed by Simon is
similar to the one you see on your Odroid-C1?
> >>
> >>
> >> Now what happens:
> >>
> >> - benchmark between PC - ODROID is roughly 550M
> >>
> >> - benchmark between NAS - ODROID is roughly 550M
> >>
> >> - benchmark between PC - NAS is only around 300M
> >>
> >>
> >> and like i said i was easliy able to hit 800 or even 900M to my NAS
> >> earlier. I applied some .dtb fixes for interrupt levels for the
> >> meson-gx.dtsi and meson-gxbb-odroid-c2.dtb, which will be mainlined ,
> >> but the effect stayed identical.
> > good that you have the interrupt patches already applied
> > I believe it don't fix any performance issues - it's a fix for the
> > Ethernet controller seemingly getting "stuck" (not processing data
> > anymore). however, that already rules out one potential issue
> >
> >> are you aware of this problem ? Earlier kernel versions were all
> >> perfectly fine and i stepped ( self compiled) kernel through all major
> >> releases since odroid c2 was mainlined.
Guiseppe, Alexandre: what kind of data do you need from us if we see
the speeds drop (in both directions) when we send and receive at the
same time?
[...]
> the problem is that i dont have these kernel sources anymore :-(. but i
> can provide some testing and numbers. maybe i dig if i got these kernel
> configs somewhere around but i did not change much during migrating
do you remember the kernel version where it worked fine?
> im using a zyxel gs1900-8 switch and a qnap ts231p , and as i said i
> didnt change my setup. i was able to hit 100MByte/s from my NAS , so
> close to the benchmarks of 900MBit/s
I typically only do small transfers or I have traffic only in one direction.
thus it's likely that I missed this in my own tests
Regards
Martin
[0] http://lists.infradead.org/pipermail/linux-amlogic/2018-December/009679.html
[1] https://patchwork.kernel.org/cover/10744905/
^ permalink raw reply
* pull-request: wireless-drivers 2019-02-04
From: Kalle Valo @ 2019-02-04 13:58 UTC (permalink / raw)
To: David Miller; +Cc: linux-wireless, netdev, linux-kernel
Hi Dave,
here are fixes to net tree for 5.0, more info below. Please let me know
if there are any problems.
Kalle
The following changes since commit bfeffd155283772bbe78c6a05dec7c0128ee500c:
Linux 5.0-rc1 (2019-01-06 17:08:20 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git tags/wireless-drivers-for-davem-2019-02-04
for you to fetch changes up to 8c22d81d55353209f8976074ffa9fb1085da0830:
MAINTAINERS: add entry for redpine wireless driver (2019-02-03 21:41:51 +0200)
----------------------------------------------------------------
wireless-drivers fixes for 5.0
First set of small, but importnat, fixes for 5.0.
iwlwifi
* fix a build regression introduced in 5.0-rc1
wlcore
* fix a firmware regression from v4.18-rc1
mt76x0
* fix for configuring tx power from user space
ath10k
* fix wcn3990 regression from v4.20-rc1
----------------------------------------------------------------
Brian Norris (1):
ath10k: correct bus type for WCN3990
Lorenzo Bianconi (1):
mt76x0: eeprom: fix chan_vs_power map in mt76x0_get_power_info
Luca Coelho (1):
iwlwifi: make IWLWIFI depend on CFG80211
Siva Rebbagondla (1):
MAINTAINERS: add entry for redpine wireless driver
Ulf Hansson (1):
wlcore: sdio: Fixup power on/off sequence
MAINTAINERS | 7 ++++
drivers/net/wireless/ath/ath10k/core.c | 2 +-
drivers/net/wireless/intel/iwlwifi/Kconfig | 3 +-
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | 40 ++++++++++------------
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 10 +++---
drivers/net/wireless/ti/wlcore/sdio.c | 15 ++++----
7 files changed, 42 insertions(+), 37 deletions(-)
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox