* [patch iproute2/net-next 0/2] devlink: add port flavours/number/split_subport
@ 2018-05-20 8:15 Jiri Pirko
2018-05-20 8:15 ` [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours Jiri Pirko
2018-05-20 8:15 ` [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number Jiri Pirko
0 siblings, 2 replies; 7+ messages in thread
From: Jiri Pirko @ 2018-05-20 8:15 UTC (permalink / raw)
To: netdev
Cc: dsahern, idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
From: Jiri Pirko <jiri@mellanox.com>
Jiri Pirko (2):
devlink: introduce support for showing port flavours
devlink: introduce support for showing port number and split subport
number
devlink/devlink.c | 26 ++++++++++++++++++++++++++
include/uapi/linux/devlink.h | 14 ++++++++++++++
2 files changed, 40 insertions(+)
--
2.14.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours
2018-05-20 8:15 [patch iproute2/net-next 0/2] devlink: add port flavours/number/split_subport Jiri Pirko
@ 2018-05-20 8:15 ` Jiri Pirko
2018-05-23 20:03 ` David Ahern
2018-05-20 8:15 ` [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number Jiri Pirko
1 sibling, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2018-05-20 8:15 UTC (permalink / raw)
To: netdev
Cc: dsahern, idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
From: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
devlink/devlink.c | 20 ++++++++++++++++++++
include/uapi/linux/devlink.h | 12 ++++++++++++
2 files changed, 32 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index fa33684cb20a..df2c66dac1c7 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1693,6 +1693,20 @@ static const char *port_type_name(uint32_t type)
}
}
+static const char *port_flavour_name(uint16_t flavour)
+{
+ switch (flavour) {
+ case DEVLINK_PORT_FLAVOUR_PHYSICAL:
+ return "physical";
+ case DEVLINK_PORT_FLAVOUR_CPU:
+ return "cpu";
+ case DEVLINK_PORT_FLAVOUR_DSA:
+ return "dsa";
+ default:
+ return "<unknown flavour>";
+ }
+}
+
static void pr_out_port(struct dl *dl, struct nlattr **tb)
{
struct nlattr *pt_attr = tb[DEVLINK_ATTR_PORT_TYPE];
@@ -1717,6 +1731,12 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
if (tb[DEVLINK_ATTR_PORT_IBDEV_NAME])
pr_out_str(dl, "ibdev",
mnl_attr_get_str(tb[DEVLINK_ATTR_PORT_IBDEV_NAME]));
+ if (tb[DEVLINK_ATTR_PORT_FLAVOUR]) {
+ uint16_t port_flavour =
+ mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_FLAVOUR]);
+
+ pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
+ }
if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
pr_out_uint(dl, "split_group",
mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 9f17286ec89f..23a3af6284b4 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -132,6 +132,16 @@ enum devlink_eswitch_encap_mode {
DEVLINK_ESWITCH_ENCAP_MODE_BASIC,
};
+enum devlink_port_flavour {
+ DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically
+ * facing the user.
+ */
+ DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */
+ DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture
+ * interconnect port.
+ */
+};
+
enum devlink_attr {
/* don't change the order or add anything between, this is ABI! */
DEVLINK_ATTR_UNSPEC,
@@ -224,6 +234,8 @@ enum devlink_attr {
DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 */
DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */
+ DEVLINK_ATTR_PORT_FLAVOUR, /* u16 */
+
/* add new attributes above here, update the policy in devlink.c */
__DEVLINK_ATTR_MAX,
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number
2018-05-20 8:15 [patch iproute2/net-next 0/2] devlink: add port flavours/number/split_subport Jiri Pirko
2018-05-20 8:15 ` [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours Jiri Pirko
@ 2018-05-20 8:15 ` Jiri Pirko
2018-05-23 20:05 ` David Ahern
1 sibling, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2018-05-20 8:15 UTC (permalink / raw)
To: netdev
Cc: dsahern, idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
From: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
devlink/devlink.c | 6 ++++++
include/uapi/linux/devlink.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index df2c66dac1c7..b0ae17767dab 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1737,9 +1737,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
}
+ if (tb[DEVLINK_ATTR_PORT_NUMBER])
+ pr_out_uint(dl, "number",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]));
if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
pr_out_uint(dl, "split_group",
mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));
+ if (tb[DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER])
+ pr_out_uint(dl, "subport",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER]));
pr_out_port_handle_end(dl);
}
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 23a3af6284b4..493f71fef7ee 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -235,6 +235,8 @@ enum devlink_attr {
DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */
DEVLINK_ATTR_PORT_FLAVOUR, /* u16 */
+ DEVLINK_ATTR_PORT_NUMBER, /* u32 */
+ DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER, /* u32 */
/* add new attributes above here, update the policy in devlink.c */
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours
2018-05-20 8:15 ` [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours Jiri Pirko
@ 2018-05-23 20:03 ` David Ahern
0 siblings, 0 replies; 7+ messages in thread
From: David Ahern @ 2018-05-23 20:03 UTC (permalink / raw)
To: Jiri Pirko, netdev
Cc: idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
On 5/20/18 2:15 AM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> devlink/devlink.c | 20 ++++++++++++++++++++
> include/uapi/linux/devlink.h | 12 ++++++++++++
> 2 files changed, 32 insertions(+)
>
>
applied to iproute2-next
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number
2018-05-20 8:15 ` [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number Jiri Pirko
@ 2018-05-23 20:05 ` David Ahern
2018-05-24 6:39 ` Jiri Pirko
0 siblings, 1 reply; 7+ messages in thread
From: David Ahern @ 2018-05-23 20:05 UTC (permalink / raw)
To: Jiri Pirko, netdev
Cc: idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
On 5/20/18 2:15 AM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> devlink/devlink.c | 6 ++++++
> include/uapi/linux/devlink.h | 2 ++
> 2 files changed, 8 insertions(+)
>
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index df2c66dac1c7..b0ae17767dab 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -1737,9 +1737,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
>
> pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
> }
> + if (tb[DEVLINK_ATTR_PORT_NUMBER])
> + pr_out_uint(dl, "number",
> + mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]));
"number" is a label means nothing. "port" is more descriptive.
# ./devlink port
pci/0000:03:00.0/1: type eth netdev swp17 flavour physical number 17
pci/0000:03:00.0/3: type eth netdev swp18 flavour physical number 18
pci/0000:03:00.0/5: type eth netdev swp19 flavour physical number 19
pci/0000:03:00.0/7: type eth netdev swp20 flavour physical number 20
pci/0000:03:00.0/9: type eth netdev swp21 flavour physical number 21
...
pci/0000:03:00.0/61: type eth netdev swp1s0 flavour physical number 1
split_group 1 subport 0
pci/0000:03:00.0/62: type eth netdev swp1s1 flavour physical number 1
split_group 1 subport 1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number
2018-05-23 20:05 ` David Ahern
@ 2018-05-24 6:39 ` Jiri Pirko
2018-05-25 14:19 ` David Ahern
0 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2018-05-24 6:39 UTC (permalink / raw)
To: David Ahern
Cc: netdev, idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
Wed, May 23, 2018 at 10:05:49PM CEST, dsahern@gmail.com wrote:
>On 5/20/18 2:15 AM, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>> devlink/devlink.c | 6 ++++++
>> include/uapi/linux/devlink.h | 2 ++
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/devlink/devlink.c b/devlink/devlink.c
>> index df2c66dac1c7..b0ae17767dab 100644
>> --- a/devlink/devlink.c
>> +++ b/devlink/devlink.c
>> @@ -1737,9 +1737,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
>>
>> pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
>> }
>> + if (tb[DEVLINK_ATTR_PORT_NUMBER])
>> + pr_out_uint(dl, "number",
>> + mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]));
>
>"number" is a label means nothing. "port" is more descriptive.
That attribute name is "port_number". As the other attributes are
named "port_something", and the "something" is printed out here, the
"number" is consistent with it. Each line represents a port with a list
of attributes.
>
># ./devlink port
>pci/0000:03:00.0/1: type eth netdev swp17 flavour physical number 17
>pci/0000:03:00.0/3: type eth netdev swp18 flavour physical number 18
>pci/0000:03:00.0/5: type eth netdev swp19 flavour physical number 19
>pci/0000:03:00.0/7: type eth netdev swp20 flavour physical number 20
>pci/0000:03:00.0/9: type eth netdev swp21 flavour physical number 21
>...
>pci/0000:03:00.0/61: type eth netdev swp1s0 flavour physical number 1
>split_group 1 subport 0
>pci/0000:03:00.0/62: type eth netdev swp1s1 flavour physical number 1
>split_group 1 subport 1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number
2018-05-24 6:39 ` Jiri Pirko
@ 2018-05-25 14:19 ` David Ahern
0 siblings, 0 replies; 7+ messages in thread
From: David Ahern @ 2018-05-25 14:19 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, idosch, jakub.kicinski, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, saeedm, simon.horman,
pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
alexander.h.duyck, ogerlitz, vijaya.guvva, satananda.burla,
raghu.vatsavayi, felix.manlunas, gospo, sathya.perla,
vasundhara-v.volam, tariqt, eranbe, jeffrey.t.kirsher, roopa
On 5/24/18 12:39 AM, Jiri Pirko wrote:
> Wed, May 23, 2018 at 10:05:49PM CEST, dsahern@gmail.com wrote:
>> On 5/20/18 2:15 AM, Jiri Pirko wrote:
>>> From: Jiri Pirko <jiri@mellanox.com>
>>>
>>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>>> ---
>>> devlink/devlink.c | 6 ++++++
>>> include/uapi/linux/devlink.h | 2 ++
>>> 2 files changed, 8 insertions(+)
>>>
>>> diff --git a/devlink/devlink.c b/devlink/devlink.c
>>> index df2c66dac1c7..b0ae17767dab 100644
>>> --- a/devlink/devlink.c
>>> +++ b/devlink/devlink.c
>>> @@ -1737,9 +1737,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
>>>
>>> pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
>>> }
>>> + if (tb[DEVLINK_ATTR_PORT_NUMBER])
>>> + pr_out_uint(dl, "number",
>>> + mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]));
>>
>> "number" is a label means nothing. "port" is more descriptive.
>
> That attribute name is "port_number". As the other attributes are
> named "port_something", and the "something" is printed out here, the
> "number" is consistent with it. Each line represents a port with a list
> of attributes.
The name of the attribute is not relevant here. That's an API that very
few people will see. I am looking at this from a user perspective and
the word "number" followed by a number is not clear.
>
>>
>> # ./devlink port
>> pci/0000:03:00.0/1: type eth netdev swp17 flavour physical number 17
>> pci/0000:03:00.0/3: type eth netdev swp18 flavour physical number 18
>> pci/0000:03:00.0/5: type eth netdev swp19 flavour physical number 19
>> pci/0000:03:00.0/7: type eth netdev swp20 flavour physical number 20
>> pci/0000:03:00.0/9: type eth netdev swp21 flavour physical number 21
>> ...
>> pci/0000:03:00.0/61: type eth netdev swp1s0 flavour physical number 1
>> split_group 1 subport 0
>> pci/0000:03:00.0/62: type eth netdev swp1s1 flavour physical number 1
>> split_group 1 subport 1
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-25 14:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-20 8:15 [patch iproute2/net-next 0/2] devlink: add port flavours/number/split_subport Jiri Pirko
2018-05-20 8:15 ` [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours Jiri Pirko
2018-05-23 20:03 ` David Ahern
2018-05-20 8:15 ` [patch iproute2/net-next 2/2] devlink: introduce support for showing port number and split subport number Jiri Pirko
2018-05-23 20:05 ` David Ahern
2018-05-24 6:39 ` Jiri Pirko
2018-05-25 14:19 ` David Ahern
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.