Message ID | 20210113121222.733517-4-jiri@resnulli.us (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | introduce line card support for modular switch | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 1 maintainers not CCed: jiri@nvidia.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | fail | Errors and warnings before: 492 this patch: 492 |
netdev/kdoc | fail | Errors and warnings before: 25 this patch: 31 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 75 lines checked |
netdev/build_allmodconfig_warn | fail | Errors and warnings before: 682 this patch: 682 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Wed, Jan 13, 2021 at 01:12:15PM +0100, Jiri Pirko wrote: > +/** > + * devlink_linecard_deactivate - Set linecard deactive Set linecard as inactive > + * > + * @devlink_linecard: devlink linecard > + */ > +void devlink_linecard_deactivate(struct devlink_linecard *linecard) > +{ > + mutex_lock(&linecard->devlink->lock); > + WARN_ON(linecard->state != DEVLINK_LINECARD_STATE_ACTIVE); > + linecard->state = DEVLINK_LINECARD_STATE_PROVISIONED; > + devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW); > + mutex_unlock(&linecard->devlink->lock); > +} > +EXPORT_SYMBOL_GPL(devlink_linecard_deactivate); > + > +/** > + * devlink_linecard_is_active - Check if active > + * > + * @devlink_linecard: devlink linecard > + */ > +bool devlink_linecard_is_active(struct devlink_linecard *linecard) > +{ > + bool active; > + > + mutex_lock(&linecard->devlink->lock); > + active = linecard->state == DEVLINK_LINECARD_STATE_ACTIVE; > + mutex_unlock(&linecard->devlink->lock); > + return active; > +} > +EXPORT_SYMBOL_GPL(devlink_linecard_is_active); > + > int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, > u32 size, u16 ingress_pools_count, > u16 egress_pools_count, u16 ingress_tc_count, > -- > 2.26.2 >
Fri, Jan 15, 2021 at 05:06:08PM CET, idosch@idosch.org wrote: >On Wed, Jan 13, 2021 at 01:12:15PM +0100, Jiri Pirko wrote: >> +/** >> + * devlink_linecard_deactivate - Set linecard deactive > >Set linecard as inactive Okay. > >> + * >> + * @devlink_linecard: devlink linecard >> + */ >> +void devlink_linecard_deactivate(struct devlink_linecard *linecard) >> +{ >> + mutex_lock(&linecard->devlink->lock); >> + WARN_ON(linecard->state != DEVLINK_LINECARD_STATE_ACTIVE); >> + linecard->state = DEVLINK_LINECARD_STATE_PROVISIONED; >> + devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW); >> + mutex_unlock(&linecard->devlink->lock); >> +} >> +EXPORT_SYMBOL_GPL(devlink_linecard_deactivate); >> + >> +/** >> + * devlink_linecard_is_active - Check if active >> + * >> + * @devlink_linecard: devlink linecard >> + */ >> +bool devlink_linecard_is_active(struct devlink_linecard *linecard) >> +{ >> + bool active; >> + >> + mutex_lock(&linecard->devlink->lock); >> + active = linecard->state == DEVLINK_LINECARD_STATE_ACTIVE; >> + mutex_unlock(&linecard->devlink->lock); >> + return active; >> +} >> +EXPORT_SYMBOL_GPL(devlink_linecard_is_active); >> + >> int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, >> u32 size, u16 ingress_pools_count, >> u16 egress_pools_count, u16 ingress_tc_count, >> -- >> 2.26.2 >>
diff --git a/include/net/devlink.h b/include/net/devlink.h index 854abd53e9ea..ec00cd94c626 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -149,6 +149,7 @@ struct devlink_linecard { void *priv; enum devlink_linecard_state state; const char *provisioned_type; + bool active; }; /** @@ -1444,6 +1445,9 @@ void devlink_linecard_destroy(struct devlink_linecard *linecard); void devlink_linecard_provision_set(struct devlink_linecard *linecard, u32 type_index); void devlink_linecard_provision_clear(struct devlink_linecard *linecard); +void devlink_linecard_activate(struct devlink_linecard *linecard); +void devlink_linecard_deactivate(struct devlink_linecard *linecard); +bool devlink_linecard_is_active(struct devlink_linecard *linecard); int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, u32 size, u16 ingress_pools_count, u16 egress_pools_count, u16 ingress_tc_count, diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 4111ddcc000b..d961d31fe288 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -338,6 +338,7 @@ enum devlink_linecard_state { DEVLINK_LINECARD_STATE_UNPROVISIONING, DEVLINK_LINECARD_STATE_PROVISIONING, DEVLINK_LINECARD_STATE_PROVISIONED, + DEVLINK_LINECARD_STATE_ACTIVE, __DEVLINK_LINECARD_STATE_MAX, DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1 diff --git a/net/core/devlink.c b/net/core/devlink.c index 434eecc310c3..9c76edf8c8af 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -8790,6 +8790,52 @@ void devlink_linecard_provision_clear(struct devlink_linecard *linecard) } EXPORT_SYMBOL_GPL(devlink_linecard_provision_clear); +/** + * devlink_linecard_activate - Set linecard active + * + * @devlink_linecard: devlink linecard + */ +void devlink_linecard_activate(struct devlink_linecard *linecard) +{ + mutex_lock(&linecard->devlink->lock); + WARN_ON(linecard->state != DEVLINK_LINECARD_STATE_PROVISIONED); + linecard->state = DEVLINK_LINECARD_STATE_ACTIVE; + devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW); + mutex_unlock(&linecard->devlink->lock); +} +EXPORT_SYMBOL_GPL(devlink_linecard_activate); + +/** + * devlink_linecard_deactivate - Set linecard deactive + * + * @devlink_linecard: devlink linecard + */ +void devlink_linecard_deactivate(struct devlink_linecard *linecard) +{ + mutex_lock(&linecard->devlink->lock); + WARN_ON(linecard->state != DEVLINK_LINECARD_STATE_ACTIVE); + linecard->state = DEVLINK_LINECARD_STATE_PROVISIONED; + devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW); + mutex_unlock(&linecard->devlink->lock); +} +EXPORT_SYMBOL_GPL(devlink_linecard_deactivate); + +/** + * devlink_linecard_is_active - Check if active + * + * @devlink_linecard: devlink linecard + */ +bool devlink_linecard_is_active(struct devlink_linecard *linecard) +{ + bool active; + + mutex_lock(&linecard->devlink->lock); + active = linecard->state == DEVLINK_LINECARD_STATE_ACTIVE; + mutex_unlock(&linecard->devlink->lock); + return active; +} +EXPORT_SYMBOL_GPL(devlink_linecard_is_active); + int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, u32 size, u16 ingress_pools_count, u16 egress_pools_count, u16 ingress_tc_count,