Skip to content

Commit 365014f

Browse files
committed
Merge branch 'mlxsw-line-card-status-tracking'
Ido Schimmel says: ==================== mlxsw: Line cards status tracking When a line card is provisioned, netdevs corresponding to the ports found on the line card are registered. User space can then perform various logical configurations (e.g., splitting, setting MTU) on these netdevs. However, since the line card is not present / powered on (i.e., it is not in 'active' state), user space cannot access the various components found on the line card. For example, user space cannot read the temperature of gearboxes or transceiver modules found on the line card via hwmon / thermal. Similarly, it cannot dump the EEPROM contents of these transceiver modules. The above is only possible when the line card becomes active. This patchset solves the problem by tracking the status of each line card and invoking callbacks from interested parties when a line card becomes active / inactive. Patchset overview: Patch #1 adds the infrastructure in the line cards core that allows users to registers a set of callbacks that are invoked when a line card becomes active / inactive. To avoid races, if a line card is already active during registration, the got_active() callback is invoked. Patches #2-#3 are preparations. Patch #4 changes the port module core to register a set of callbacks with the line cards core. See detailed description with examples in the commit message. Patches #5-#6 do the same with regards to thermal / hwmon support, so that user space will be able to monitor the temperature of various components on the line card when it becomes active. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 85ef87b + 99a03b3 commit 365014f

File tree

7 files changed

+513
-18
lines changed

7 files changed

+513
-18
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
21752175
if (err)
21762176
goto err_thermal_init;
21772177

2178-
err = mlxsw_env_init(mlxsw_core, &mlxsw_core->env);
2178+
err = mlxsw_env_init(mlxsw_core, mlxsw_bus_info, &mlxsw_core->env);
21792179
if (err)
21802180
goto err_env_init;
21812181

drivers/net/ethernet/mellanox/mlxsw/core.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ struct mlxsw_linecards {
590590
const struct mlxsw_bus_info *bus_info;
591591
u8 count;
592592
struct mlxsw_linecard_types_info *types_info;
593+
struct list_head event_ops_list;
594+
struct mutex event_ops_list_lock; /* Locks accesses to event ops list */
593595
struct mlxsw_linecard linecards[];
594596
};
595597

@@ -603,4 +605,19 @@ int mlxsw_linecards_init(struct mlxsw_core *mlxsw_core,
603605
const struct mlxsw_bus_info *bus_info);
604606
void mlxsw_linecards_fini(struct mlxsw_core *mlxsw_core);
605607

608+
typedef void mlxsw_linecards_event_op_t(struct mlxsw_core *mlxsw_core,
609+
u8 slot_index, void *priv);
610+
611+
struct mlxsw_linecards_event_ops {
612+
mlxsw_linecards_event_op_t *got_active;
613+
mlxsw_linecards_event_op_t *got_inactive;
614+
};
615+
616+
int mlxsw_linecards_event_ops_register(struct mlxsw_core *mlxsw_core,
617+
struct mlxsw_linecards_event_ops *ops,
618+
void *priv);
619+
void mlxsw_linecards_event_ops_unregister(struct mlxsw_core *mlxsw_core,
620+
struct mlxsw_linecards_event_ops *ops,
621+
void *priv);
622+
606623
#endif

0 commit comments

Comments
 (0)