Skip to content

Commit c246f9b

Browse files
Jiri Pirkodavem330
Jiri Pirko
authored andcommitted
devlink: add support to create line card and expose to user
Extend the devlink API so the driver is going to be able to create and destroy linecard instances. There can be multiple line cards per devlink device. Expose this new type of object over devlink netlink API to the userspace, with notifications. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 843f774 commit c246f9b

File tree

3 files changed

+280
-1
lines changed

3 files changed

+280
-1
lines changed

include/net/devlink.h

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/firmware.h>
2323

2424
struct devlink;
25+
struct devlink_linecard;
2526

2627
struct devlink_port_phys_attrs {
2728
u32 port_number; /* Same value as "split group".
@@ -1536,6 +1537,9 @@ void devlink_port_attrs_pci_sf_set(struct devlink_port *devlink_port,
15361537
int devlink_rate_leaf_create(struct devlink_port *port, void *priv);
15371538
void devlink_rate_leaf_destroy(struct devlink_port *devlink_port);
15381539
void devlink_rate_nodes_destroy(struct devlink *devlink);
1540+
struct devlink_linecard *devlink_linecard_create(struct devlink *devlink,
1541+
unsigned int linecard_index);
1542+
void devlink_linecard_destroy(struct devlink_linecard *linecard);
15391543
int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
15401544
u32 size, u16 ingress_pools_count,
15411545
u16 egress_pools_count, u16 ingress_tc_count,

include/uapi/linux/devlink.h

+7
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ enum devlink_command {
131131
DEVLINK_CMD_RATE_NEW,
132132
DEVLINK_CMD_RATE_DEL,
133133

134+
DEVLINK_CMD_LINECARD_GET, /* can dump */
135+
DEVLINK_CMD_LINECARD_SET,
136+
DEVLINK_CMD_LINECARD_NEW,
137+
DEVLINK_CMD_LINECARD_DEL,
138+
134139
/* add new commands above here */
135140
__DEVLINK_CMD_MAX,
136141
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
@@ -553,6 +558,8 @@ enum devlink_attr {
553558

554559
DEVLINK_ATTR_REGION_MAX_SNAPSHOTS, /* u32 */
555560

561+
DEVLINK_ATTR_LINECARD_INDEX, /* u32 */
562+
556563
/* add new attributes above here, update the policy in devlink.c */
557564

558565
__DEVLINK_ATTR_MAX,

0 commit comments

Comments
 (0)