|
@@ -453,6 +453,25 @@ static void devlink_notify(struct devlink *devlink, enum devlink_command cmd)
|
|
|
msg, 0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
|
|
|
}
|
|
|
|
|
|
+static int devlink_nl_port_attrs_put(struct sk_buff *msg,
|
|
|
+ struct devlink_port *devlink_port)
|
|
|
+{
|
|
|
+ struct devlink_port_attrs *attrs = &devlink_port->attrs;
|
|
|
+
|
|
|
+ if (!attrs->set)
|
|
|
+ return 0;
|
|
|
+ if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER, attrs->port_number))
|
|
|
+ return -EMSGSIZE;
|
|
|
+ if (!attrs->split)
|
|
|
+ return 0;
|
|
|
+ if (nla_put_u32(msg, DEVLINK_ATTR_PORT_SPLIT_GROUP, attrs->port_number))
|
|
|
+ return -EMSGSIZE;
|
|
|
+ if (nla_put_u32(msg, DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER,
|
|
|
+ attrs->split_subport_number))
|
|
|
+ return -EMSGSIZE;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int devlink_nl_port_fill(struct sk_buff *msg, struct devlink *devlink,
|
|
|
struct devlink_port *devlink_port,
|
|
|
enum devlink_command cmd, u32 portid,
|
|
@@ -492,9 +511,7 @@ static int devlink_nl_port_fill(struct sk_buff *msg, struct devlink *devlink,
|
|
|
ibdev->name))
|
|
|
goto nla_put_failure;
|
|
|
}
|
|
|
- if (devlink_port->split &&
|
|
|
- nla_put_u32(msg, DEVLINK_ATTR_PORT_SPLIT_GROUP,
|
|
|
- devlink_port->split_group))
|
|
|
+ if (devlink_nl_port_attrs_put(msg, devlink_port))
|
|
|
goto nla_put_failure;
|
|
|
|
|
|
genlmsg_end(msg, hdr);
|
|
@@ -2971,19 +2988,28 @@ void devlink_port_type_clear(struct devlink_port *devlink_port)
|
|
|
EXPORT_SYMBOL_GPL(devlink_port_type_clear);
|
|
|
|
|
|
/**
|
|
|
- * devlink_port_split_set - Set port is split
|
|
|
+ * devlink_port_attrs_set - Set port attributes
|
|
|
*
|
|
|
* @devlink_port: devlink port
|
|
|
- * @split_group: split group - identifies group split port is part of
|
|
|
+ * @port_number: number of the port that is facing user, for example
|
|
|
+ * the front panel port number
|
|
|
+ * @split: indicates if this is split port
|
|
|
+ * @split_subport_number: if the port is split, this is the number
|
|
|
+ * of subport.
|
|
|
*/
|
|
|
-void devlink_port_split_set(struct devlink_port *devlink_port,
|
|
|
- u32 split_group)
|
|
|
+void devlink_port_attrs_set(struct devlink_port *devlink_port,
|
|
|
+ u32 port_number, bool split,
|
|
|
+ u32 split_subport_number)
|
|
|
{
|
|
|
- devlink_port->split = true;
|
|
|
- devlink_port->split_group = split_group;
|
|
|
+ struct devlink_port_attrs *attrs = &devlink_port->attrs;
|
|
|
+
|
|
|
+ attrs->set = true;
|
|
|
+ attrs->port_number = port_number;
|
|
|
+ attrs->split = split;
|
|
|
+ attrs->split_subport_number = split_subport_number;
|
|
|
devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
|
|
|
}
|
|
|
-EXPORT_SYMBOL_GPL(devlink_port_split_set);
|
|
|
+EXPORT_SYMBOL_GPL(devlink_port_attrs_set);
|
|
|
|
|
|
int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
|
|
|
u32 size, u16 ingress_pools_count,
|