Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Parav Pandit <parav@mellanox.com> To: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org Cc: Parav Pandit <parav@nvidia.com>, Jiri Pirko <jiri@nvidia.com> Subject: [PATCH net-next v3 6/6] devlink: Use controller while building phys_port_name Date: Wed, 9 Sep 2020 07:50:38 +0300 [thread overview] Message-ID: <20200909045038.63181-7-parav@mellanox.com> (raw) In-Reply-To: <20200909045038.63181-1-parav@mellanox.com> From: Parav Pandit <parav@nvidia.com> Now that controller number attribute is available, use it when building phsy_port_name for external controller ports. An example devlink port and representor netdev name consist of controller annotation for external controller with controller number = 1, for a VF 1 of PF 0: $ devlink port show pci/0000:06:00.0/2 pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf controller 1 pfnum 0 vfnum 1 external true splittable false function: hw_addr 00:00:00:00:00:00 $ devlink port show pci/0000:06:00.0/2 -jp { "port": { "pci/0000:06:00.0/2": { "type": "eth", "netdev": "ens2f0c1pf0vf1", "flavour": "pcivf", "controller": 1, "pfnum": 0, "vfnum": 1, "external": true, "splittable": false, "function": { "hw_addr": "00:00:00:00:00:00" } } } } Controller number annotation is skipped for non external controllers to maintain backward compatibility. Signed-off-by: Parav Pandit <parav@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> --- Changelog: v1->v2: - New patch --- net/core/devlink.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/core/devlink.c b/net/core/devlink.c index 9cf5b118253b..91c12612f2b7 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -7793,9 +7793,23 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, WARN_ON(1); return -EINVAL; case DEVLINK_PORT_FLAVOUR_PCI_PF: + if (attrs->pci_pf.external) { + n = snprintf(name, len, "c%u", attrs->pci_pf.controller); + if (n >= len) + return -EINVAL; + len -= n; + name += n; + } n = snprintf(name, len, "pf%u", attrs->pci_pf.pf); break; case DEVLINK_PORT_FLAVOUR_PCI_VF: + if (attrs->pci_vf.external) { + n = snprintf(name, len, "c%u", attrs->pci_vf.controller); + if (n >= len) + return -EINVAL; + len -= n; + name += n; + } n = snprintf(name, len, "pf%uvf%u", attrs->pci_vf.pf, attrs->pci_vf.vf); break; -- 2.26.2
next prev parent reply other threads:[~2020-09-09 4:51 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-25 13:58 [PATCH net-next 0/3] devlink show controller info Parav Pandit 2020-08-25 13:58 ` [PATCH net-next 1/3] devlink: Add comment block for missing port attributes Parav Pandit 2020-08-25 13:58 ` [PATCH net-next 2/3] devlink: Consider other controller while building phys_port_name Parav Pandit 2020-08-26 0:32 ` Jakub Kicinski 2020-08-26 4:27 ` Parav Pandit 2020-08-26 20:07 ` Jakub Kicinski 2020-08-27 4:31 ` Parav Pandit 2020-08-27 18:32 ` Jakub Kicinski 2020-08-27 20:15 ` Parav Pandit 2020-08-27 21:42 ` Jakub Kicinski 2020-08-28 4:27 ` Parav Pandit 2020-08-28 5:08 ` Parav Pandit 2020-08-28 16:43 ` Jakub Kicinski 2020-08-29 3:43 ` Parav Pandit 2020-09-01 8:19 ` Jiri Pirko 2020-09-01 8:53 ` Parav Pandit 2020-09-01 9:17 ` Jiri Pirko 2020-09-01 21:28 ` Jakub Kicinski 2020-09-02 4:26 ` Parav Pandit 2020-09-02 4:44 ` Parav Pandit 2020-09-02 8:00 ` Jiri Pirko 2020-09-02 15:23 ` Jakub Kicinski 2020-09-02 16:18 ` Parav Pandit 2020-09-02 20:10 ` Parav Pandit 2020-09-03 5:54 ` Jiri Pirko 2020-09-03 19:31 ` Jakub Kicinski 2020-09-04 8:43 ` Jiri Pirko 2020-09-06 3:08 ` Parav Pandit 2020-09-06 16:46 ` Jakub Kicinski 2020-09-07 7:21 ` Jiri Pirko 2020-09-07 16:18 ` Jakub Kicinski 2020-08-25 13:58 ` [PATCH net-next 3/3] net/mlx5: E-switch, Set controller attribute for PCI PF and VF ports Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 0/6] devlink show controller number Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 1/6] net/mlx5: E-switch, Read controller number from device Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 2/6] devlink: Add comment block for missing port attributes Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 3/6] devlink: Move structure comments outside of structure Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 4/6] devlink: Introduce external controller flag Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 5/6] devlink: Introduce controller number Parav Pandit 2020-09-08 18:50 ` Jakub Kicinski 2020-09-09 3:06 ` Parav Pandit 2020-09-08 14:42 ` [PATCH net-next v2 6/6] devlink: Use controller while building phys_port_name Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 0/6] devlink show controller number Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 1/6] net/mlx5: E-switch, Read controller number from device Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 2/6] devlink: Add comment block for missing port attributes Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 3/6] devlink: Move structure comments outside of structure Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 4/6] devlink: Introduce external controller flag Parav Pandit 2020-09-09 4:50 ` [PATCH net-next v3 5/6] devlink: Introduce controller number Parav Pandit 2020-09-09 4:50 ` Parav Pandit [this message] 2020-09-10 15:02 ` [PATCH net-next v3 6/6] devlink: Use controller while building phys_port_name David Ahern 2020-09-09 15:34 ` [PATCH net-next v3 0/6] devlink show controller number Jakub Kicinski 2020-09-09 21:20 ` David Miller
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=20200909045038.63181-7-parav@mellanox.com \ --to=parav@mellanox.com \ --cc=davem@davemloft.net \ --cc=jiri@nvidia.com \ --cc=kuba@kernel.org \ --cc=netdev@vger.kernel.org \ --cc=parav@nvidia.com \ /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: linkBe 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).