diff mbox series

[iproute2-next,v2,4/5] devlink: print nested handle for port function

Message ID 20230919115644.1157890-5-jiri@resnulli.us (mailing list archive)
State Changes Requested
Delegated to: David Ahern
Headers show
Series expose devlink instances relationships | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Jiri Pirko Sept. 19, 2023, 11:56 a.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

If port function contains nested handle attribute, print it.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 devlink/devlink.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/devlink/devlink.c b/devlink/devlink.c
index cf5d466bfc9d..b30e4fd8e282 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -772,6 +772,7 @@  static const enum mnl_attr_data_type
 devlink_function_policy[DEVLINK_PORT_FUNCTION_ATTR_MAX + 1] = {
 	[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR ] = MNL_TYPE_BINARY,
 	[DEVLINK_PORT_FN_ATTR_STATE] = MNL_TYPE_U8,
+	[DEVLINK_PORT_FN_ATTR_DEVLINK] = MNL_TYPE_NESTED,
 };
 
 static int function_attr_cb(const struct nlattr *attr, void *data)
@@ -4830,6 +4831,8 @@  static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
 				     port_fn_caps->value & DEVLINK_PORT_FN_CAP_MIGRATABLE ?
 				     "enable" : "disable");
 	}
+	if (tb[DEVLINK_PORT_FN_ATTR_DEVLINK])
+		pr_out_nested_handle(tb[DEVLINK_PORT_FN_ATTR_DEVLINK]);
 
 	if (!dl->json_output)
 		__pr_out_indent_dec();