All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danielle Ratson <danieller@mellanox.com>
To: netdev@vger.kernel.org
Cc: dsahern@gmail.com, stephen@networkplumber.org,
	mlxsw@mellanox.com, Danielle Ratson <danieller@mellanox.com>
Subject: [PATCH iproute2-next v2 2/2] devlink: Expose port split ability
Date: Thu, 30 Jul 2020 17:33:18 +0300	[thread overview]
Message-ID: <20200730143318.1203-3-danieller@mellanox.com> (raw)
In-Reply-To: <20200730143318.1203-1-danieller@mellanox.com>

Add a new attribute that indicates the port split ability to devlink port.

Expose the attribute to user space as RO value, for example:

$devlink port show swp1
pci/0000:03:00.0/61: type eth netdev swp1 flavour physical port 1
splittable false lanes 1

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
---
 devlink/devlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 39bc1119..a22e931e 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -582,6 +582,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
 	[DEVLINK_ATTR_PORT_NETDEV_NAME] = MNL_TYPE_NUL_STRING,
 	[DEVLINK_ATTR_PORT_IBDEV_NAME] = MNL_TYPE_NUL_STRING,
 	[DEVLINK_ATTR_PORT_LANES] = MNL_TYPE_U32,
+	[DEVLINK_ATTR_PORT_SPLITTABLE] = MNL_TYPE_U8,
 	[DEVLINK_ATTR_SB_INDEX] = MNL_TYPE_U32,
 	[DEVLINK_ATTR_SB_SIZE] = MNL_TYPE_U32,
 	[DEVLINK_ATTR_SB_INGRESS_POOL_COUNT] = MNL_TYPE_U16,
@@ -3424,6 +3425,9 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
 	if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
 		print_uint(PRINT_ANY, "split_group", " split_group %u",
 			   mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));
+	if (tb[DEVLINK_ATTR_PORT_SPLITTABLE])
+		print_bool(PRINT_ANY, "splittable", " splittable %s",
+			   mnl_attr_get_u8(tb[DEVLINK_ATTR_PORT_SPLITTABLE]));
 	if (tb[DEVLINK_ATTR_PORT_LANES])
 		print_uint(PRINT_ANY, "lanes", " lanes %u",
 			   mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_LANES]));
-- 
2.20.1


  parent reply	other threads:[~2020-07-30 14:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 14:33 [PATCH iproute2-next v2 0/2] Expose port attributes Danielle Ratson
2020-07-30 14:33 ` [PATCH iproute2-next v2 1/2] devlink: Expose number of port lanes Danielle Ratson
2020-07-30 14:33 ` Danielle Ratson [this message]
2020-08-03 14:38 ` [PATCH iproute2-next v2 0/2] Expose port attributes 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=20200730143318.1203-3-danieller@mellanox.com \
    --to=danieller@mellanox.com \
    --cc=dsahern@gmail.com \
    --cc=mlxsw@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 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.