netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: dsahern@gmail.com, idosch@mellanox.com,
	jakub.kicinski@netronome.com, mlxsw@mellanox.com, andrew@lunn.ch,
	vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com,
	michael.chan@broadcom.com, ganeshgr@chelsio.com,
	saeedm@mellanox.com, simon.horman@netronome.com,
	pieter.jansenvanvuuren@netronome.com, john.hurley@netronome.com,
	dirk.vandermerwe@netronome.com, alexander.h.duyck@intel.com,
	ogerlitz@mellanox.com, vijaya.guvva@cavium.com,
	satananda.burla@cavium.com, raghu.vatsavayi@cavium.com,
	felix.manlunas@cavium.com, gospo@broadcom.com,
	sathya.perla@broadcom.com, vasundhara-v.volam@broadcom.com,
	tariqt@mellanox.com, eranbe@mellanox.com,
	jeffrey.t.kirsher@intel.com, roopa@cumulusnetworks.com
Subject: [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours
Date: Sun, 20 May 2018 10:15:38 +0200	[thread overview]
Message-ID: <20180520081539.1372-2-jiri@resnulli.us> (raw)
In-Reply-To: <20180520081539.1372-1-jiri@resnulli.us>

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

  reply	other threads:[~2018-05-20  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-05-23 20:03   ` [patch iproute2/net-next 1/2] devlink: introduce support for showing port flavours 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

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=20180520081539.1372-2-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=alexander.h.duyck@intel.com \
    --cc=andrew@lunn.ch \
    --cc=dirk.vandermerwe@netronome.com \
    --cc=dsahern@gmail.com \
    --cc=eranbe@mellanox.com \
    --cc=f.fainelli@gmail.com \
    --cc=felix.manlunas@cavium.com \
    --cc=ganeshgr@chelsio.com \
    --cc=gospo@broadcom.com \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.hurley@netronome.com \
    --cc=michael.chan@broadcom.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=pieter.jansenvanvuuren@netronome.com \
    --cc=raghu.vatsavayi@cavium.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=saeedm@mellanox.com \
    --cc=satananda.burla@cavium.com \
    --cc=sathya.perla@broadcom.com \
    --cc=simon.horman@netronome.com \
    --cc=tariqt@mellanox.com \
    --cc=vasundhara-v.volam@broadcom.com \
    --cc=vijaya.guvva@cavium.com \
    --cc=vivien.didelot@savoirfairelinux.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: 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).