From: Parav Pandit <parav@mellanox.com>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, dsahern@kernel.org,
jiri@mellanox.com, Parav Pandit <parav@mellanox.com>
Subject: [PATCH net-next iproute2 v2 2/2] devlink: Introduce PCI PF and VF port flavour and attribute
Date: Wed, 10 Jul 2019 07:39:52 -0500 [thread overview]
Message-ID: <20190710123952.6877-2-parav@mellanox.com> (raw)
In-Reply-To: <20190710123952.6877-1-parav@mellanox.com>
Introduce PCI PF and VF port flavour and port attributes such as PF
number and VF number.
$ devlink port show
pci/0000:05:00.0/0: type eth netdev eth0 flavour pcipf pfnum 0
pci/0000:05:00.0/1: type eth netdev eth1 flavour pcivf pfnum 0 vfnum 0
pci/0000:05:00.0/2: type eth netdev eth2 flavour pcivf pfnum 0 vfnum 1
Signed-off-by: Parav Pandit <parav@mellanox.com>
---
Changelog:
v1->v2:
- Instead of if-else using switch-case.
- Split patch to two patches to have kernel header update in dedicated
patch.
---
devlink/devlink.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index ac8c0fb1..d8197ea3 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2794,11 +2794,29 @@ static const char *port_flavour_name(uint16_t flavour)
return "cpu";
case DEVLINK_PORT_FLAVOUR_DSA:
return "dsa";
+ case DEVLINK_PORT_FLAVOUR_PCI_PF:
+ return "pcipf";
+ case DEVLINK_PORT_FLAVOUR_PCI_VF:
+ return "pcivf";
default:
return "<unknown flavour>";
}
}
+static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
+{
+ uint16_t fn_num;
+
+ if (tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) {
+ fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]);
+ pr_out_uint(dl, "pfnum", fn_num);
+ }
+ if (tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]) {
+ fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]);
+ pr_out_uint(dl, "vfnum", fn_num);
+ }
+}
+
static void pr_out_port(struct dl *dl, struct nlattr **tb)
{
struct nlattr *pt_attr = tb[DEVLINK_ATTR_PORT_TYPE];
@@ -2828,6 +2846,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_FLAVOUR]);
pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
+
+ switch (port_flavour) {
+ case DEVLINK_PORT_FLAVOUR_PCI_PF:
+ case DEVLINK_PORT_FLAVOUR_PCI_VF:
+ pr_out_port_pfvf_num(dl, tb);
+ break;
+ default:
+ break;
+ }
}
if (tb[DEVLINK_ATTR_PORT_NUMBER]) {
uint32_t port_number;
--
2.19.2
next prev parent reply other threads:[~2019-07-10 12:40 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 12:27 [PATCH net-next 0/3] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-01 12:27 ` [PATCH net-next 1/3] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-01 23:26 ` Jakub Kicinski
2019-07-02 4:26 ` Parav Pandit
2019-07-02 17:47 ` Jakub Kicinski
2019-07-02 18:50 ` Parav Pandit
2019-07-02 23:42 ` Jakub Kicinski
2019-07-03 2:08 ` Parav Pandit
2019-07-03 2:15 ` Jakub Kicinski
2019-07-03 4:46 ` Parav Pandit
2019-07-03 10:37 ` Jiri Pirko
2019-07-03 13:49 ` Parav Pandit
2019-07-03 14:33 ` Jiri Pirko
2019-07-03 14:09 ` Andrew Lunn
2019-07-03 14:34 ` Jiri Pirko
2019-07-03 16:13 ` Parav Pandit
2019-07-04 7:44 ` Jiri Pirko
2019-07-01 12:27 ` [PATCH net-next 2/3] devlink: Introduce PCI VF " Parav Pandit
2019-07-01 12:27 ` [PATCH net-next 3/3] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-01 18:27 ` [PATCH] devlink: Introduce PCI PF and VF port flavour and attribute Parav Pandit
2019-07-01 18:30 ` [RESEND PATCH iproute2 net-next] " Parav Pandit
2019-07-09 19:49 ` Parav Pandit
2019-07-10 12:39 ` [PATCH net-next iproute2 v2 1/2] devlink: Update kernel header to commit Parav Pandit
2019-07-10 12:39 ` Parav Pandit [this message]
2019-07-10 13:57 ` [PATCH net-next iproute2 v2 2/2] devlink: Introduce PCI PF and VF port flavour and attribute Jiri Pirko
2019-07-10 21:01 ` David Ahern
2019-07-05 7:37 ` [PATCH net-next v2 0/3] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-05 7:37 ` [PATCH net-next v2 1/3] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-05 19:17 ` Jakub Kicinski
2019-07-06 6:12 ` Parav Pandit
2019-07-05 7:37 ` [PATCH net-next v2 2/3] devlink: Introduce PCI VF " Parav Pandit
2019-07-05 7:37 ` [PATCH net-next v2 3/3] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-06 6:16 ` [PATCH net-next v3 0/3] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-06 6:16 ` [PATCH net-next v3 1/3] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-06 6:26 ` Jiri Pirko
2019-07-06 18:38 ` Parav Pandit
2019-07-06 6:16 ` [PATCH net-next v3 2/3] devlink: Introduce PCI VF " Parav Pandit
2019-07-06 6:16 ` [PATCH net-next v3 3/3] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-06 18:23 ` [PATCH net-next v4 0/4] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-06 18:23 ` [PATCH net-next v4 1/4] devlink: Refactor physical port attributes Parav Pandit
2019-07-07 19:47 ` Jiri Pirko
2019-07-08 4:34 ` Parav Pandit
2019-07-06 18:23 ` [PATCH net-next v4 2/4] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-07 19:50 ` Jiri Pirko
2019-07-06 18:23 ` [PATCH net-next v4 3/4] devlink: Introduce PCI VF " Parav Pandit
2019-07-07 19:50 ` Jiri Pirko
2019-07-06 18:23 ` [PATCH net-next v4 4/4] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-07 19:51 ` Jiri Pirko
2019-07-08 4:15 ` [PATCH net-next v5 0/5] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-08 4:15 ` [PATCH net-next v5 1/5] devlink: Refactor physical port attributes Parav Pandit
2019-07-08 14:44 ` Jiri Pirko
2019-07-08 4:15 ` [PATCH net-next v5 2/5] devlink: Return physical port fields only for applicable port flavours Parav Pandit
2019-07-08 14:44 ` Jiri Pirko
2019-07-08 4:15 ` [PATCH net-next v5 3/5] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-08 21:14 ` Jakub Kicinski
2019-07-09 2:36 ` Parav Pandit
2019-07-08 4:15 ` [PATCH net-next v5 4/5] devlink: Introduce PCI VF " Parav Pandit
2019-07-08 4:15 ` [PATCH net-next v5 5/5] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 0/5] devlink: Introduce PCI PF, VF ports and attributes Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 1/5] devlink: Refactor physical port attributes Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 2/5] devlink: Return physical port fields only for applicable port flavours Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 3/5] devlink: Introduce PCI PF port flavour and port attribute Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 4/5] devlink: Introduce PCI VF " Parav Pandit
2019-07-09 4:17 ` [PATCH net-next v6 5/5] net/mlx5e: Register devlink ports for physical link, PCI PF, VFs Parav Pandit
2019-07-09 5:40 ` [PATCH net-next v6 0/5] devlink: Introduce PCI PF, VF ports and attributes Jakub Kicinski
2019-07-09 6:17 ` Jiri Pirko
2019-07-09 18:20 ` Jakub Kicinski
2019-07-09 19:03 ` David Miller
2019-07-09 19:21 ` Parav Pandit
2019-07-10 6:41 ` Jiri Pirko
2019-07-09 6:20 ` Parav Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190710123952.6877-2-parav@mellanox.com \
--to=parav@mellanox.com \
--cc=dsahern@kernel.org \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).