mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: devlink: add port_init/fini() helpers to allow pre-register/post-unregister functions
Lifetime of some of the devlink objects, like regions, is currently forced to be different for devlink instance and devlink port instance (per-port regions). The reason is that for devlink ports, the internal structures initialization happens only after devlink_port_register() is called. To resolve this inconsistency, introduce new set of helpers to allow driver to initialize devlink pointer and region list before devlink_register() is called. That allows port regions to be created before devlink port registration and destroyed after devlink port unregistration. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
081adcfe93
commit
ae3bbc04d4
@@ -130,7 +130,8 @@ struct devlink_port {
|
||||
struct devlink_port_attrs attrs;
|
||||
u8 attrs_set:1,
|
||||
switch_port:1,
|
||||
registered:1;
|
||||
registered:1,
|
||||
initialized:1;
|
||||
struct delayed_work type_warn_dw;
|
||||
struct list_head reporter_list;
|
||||
struct mutex reporters_lock; /* Protects reporter_list */
|
||||
@@ -1563,6 +1564,9 @@ void devlink_set_features(struct devlink *devlink, u64 features);
|
||||
void devlink_register(struct devlink *devlink);
|
||||
void devlink_unregister(struct devlink *devlink);
|
||||
void devlink_free(struct devlink *devlink);
|
||||
void devlink_port_init(struct devlink *devlink,
|
||||
struct devlink_port *devlink_port);
|
||||
void devlink_port_fini(struct devlink_port *devlink_port);
|
||||
int devl_port_register(struct devlink *devlink,
|
||||
struct devlink_port *devlink_port,
|
||||
unsigned int port_index);
|
||||
|
||||
Reference in New Issue
Block a user