Skip to content

Commit b18af88

Browse files
committed
Merge branch 'mlxsw-Introduce-fw_fatal-health-reporter-and-test-cmd-to
-trigger-test-event' Ido Schimmel says: ==================== mlxsw: Introduce fw_fatal health reporter and test cmd to trigger test event Jiri says: This patch set introduces a health reporter for mlxsw that reports FW fatal events. Alongside that, it introduces a test command that is used to trigger a dummy FW fatal event by user: $ sudo devlink health test pci/0000:03:00.0 reporter fw_fatal $ devlink health pci/0000:03:00.0: reporter fw_fatal state error error 1 recover 0 last_dump_date 2020-07-27 last_dump_time 16:33:27 auto_dump true $ sudo devlink health dump show pci/0000:03:00.0 reporter fw_fatal -j -p { "irisc_id": 0, "event": [ "id": 3 ], "method": "query", "long_process": false, "command_type": "mad", "reg_attr_id": 0 } As a dependency, the FW validation and flashing is moved to core.c. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents ef8e692 + 7d83ee1 commit b18af88

File tree

9 files changed

+742
-383
lines changed

9 files changed

+742
-383
lines changed

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

Lines changed: 576 additions & 29 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ struct mlxsw_driver {
280280
struct list_head list;
281281
const char *kind;
282282
size_t priv_size;
283+
const struct mlxsw_fw_rev *fw_req_rev;
284+
const char *fw_filename;
283285
int (*init)(struct mlxsw_core *mlxsw_core,
284286
const struct mlxsw_bus_info *mlxsw_bus_info,
285287
struct netlink_ext_ack *extack);
@@ -324,9 +326,6 @@ struct mlxsw_driver {
324326
unsigned int sb_index, u16 tc_index,
325327
enum devlink_sb_pool_type pool_type,
326328
u32 *p_cur, u32 *p_max);
327-
int (*flash_update)(struct mlxsw_core *mlxsw_core,
328-
const char *file_name, const char *component,
329-
struct netlink_ext_ack *extack);
330329
int (*trap_init)(struct mlxsw_core *mlxsw_core,
331330
const struct devlink_trap *trap, void *trap_ctx);
332331
void (*trap_fini)(struct mlxsw_core *mlxsw_core,
@@ -371,16 +370,14 @@ struct mlxsw_driver {
371370
u8 txhdr_len;
372371
const struct mlxsw_config_profile *profile;
373372
bool res_query_enabled;
373+
bool fw_fatal_enabled;
374374
};
375375

376376
int mlxsw_core_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
377377
const struct mlxsw_config_profile *profile,
378378
u64 *p_single_size, u64 *p_double_size,
379379
u64 *p_linear_size);
380380

381-
void mlxsw_core_fw_flash_start(struct mlxsw_core *mlxsw_core);
382-
void mlxsw_core_fw_flash_end(struct mlxsw_core *mlxsw_core);
383-
384381
u32 mlxsw_core_read_frc_h(struct mlxsw_core *mlxsw_core);
385382
u32 mlxsw_core_read_frc_l(struct mlxsw_core *mlxsw_core);
386383

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5579,6 +5579,7 @@ MLXSW_ITEM32(reg, htgt, type, 0x00, 8, 4);
55795579

55805580
enum mlxsw_reg_htgt_trap_group {
55815581
MLXSW_REG_HTGT_TRAP_GROUP_EMAD,
5582+
MLXSW_REG_HTGT_TRAP_GROUP_MFDE,
55825583
MLXSW_REG_HTGT_TRAP_GROUP_SP_STP,
55835584
MLXSW_REG_HTGT_TRAP_GROUP_SP_LACP,
55845585
MLXSW_REG_HTGT_TRAP_GROUP_SP_LLDP,
@@ -9821,6 +9822,26 @@ static inline void mlxsw_reg_mtptptp_pack(char *payload,
98219822
mlxsw_reg_mtptpt_message_type_set(payload, message_type);
98229823
}
98239824

9825+
/* MFGD - Monitoring FW General Debug Register
9826+
* -------------------------------------------
9827+
*/
9828+
#define MLXSW_REG_MFGD_ID 0x90F0
9829+
#define MLXSW_REG_MFGD_LEN 0x0C
9830+
9831+
MLXSW_REG_DEFINE(mfgd, MLXSW_REG_MFGD_ID, MLXSW_REG_MFGD_LEN);
9832+
9833+
/* reg_mfgd_fw_fatal_event_mode
9834+
* 0 - don't check FW fatal (default)
9835+
* 1 - check FW fatal - enable MFDE trap
9836+
* Access: RW
9837+
*/
9838+
MLXSW_ITEM32(reg, mfgd, fatal_event_mode, 0x00, 9, 2);
9839+
9840+
/* reg_mfgd_trigger_test
9841+
* Access: WO
9842+
*/
9843+
MLXSW_ITEM32(reg, mfgd, trigger_test, 0x00, 11, 1);
9844+
98249845
/* MGPIR - Management General Peripheral Information Register
98259846
* ----------------------------------------------------------
98269847
* MGPIR register allows software to query the hardware and
@@ -9880,6 +9901,84 @@ mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
98809901
*num_of_modules = mlxsw_reg_mgpir_num_of_modules_get(payload);
98819902
}
98829903

9904+
/* MFDE - Monitoring FW Debug Register
9905+
* -----------------------------------
9906+
*/
9907+
#define MLXSW_REG_MFDE_ID 0x9200
9908+
#define MLXSW_REG_MFDE_LEN 0x18
9909+
9910+
MLXSW_REG_DEFINE(mfde, MLXSW_REG_MFDE_ID, MLXSW_REG_MFDE_LEN);
9911+
9912+
/* reg_mfde_irisc_id
9913+
* Which irisc triggered the event
9914+
* Access: RO
9915+
*/
9916+
MLXSW_ITEM32(reg, mfde, irisc_id, 0x00, 8, 4);
9917+
9918+
enum mlxsw_reg_mfde_event_id {
9919+
MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO = 1,
9920+
/* KVD insertion machine stopped */
9921+
MLXSW_REG_MFDE_EVENT_ID_KVD_IM_STOP,
9922+
};
9923+
9924+
/* reg_mfde_event_id
9925+
* Access: RO
9926+
*/
9927+
MLXSW_ITEM32(reg, mfde, event_id, 0x00, 0, 8);
9928+
9929+
enum mlxsw_reg_mfde_method {
9930+
MLXSW_REG_MFDE_METHOD_QUERY,
9931+
MLXSW_REG_MFDE_METHOD_WRITE,
9932+
};
9933+
9934+
/* reg_mfde_method
9935+
* Access: RO
9936+
*/
9937+
MLXSW_ITEM32(reg, mfde, method, 0x04, 29, 1);
9938+
9939+
/* reg_mfde_long_process
9940+
* Indicates if the command is in long_process mode.
9941+
* Access: RO
9942+
*/
9943+
MLXSW_ITEM32(reg, mfde, long_process, 0x04, 28, 1);
9944+
9945+
enum mlxsw_reg_mfde_command_type {
9946+
MLXSW_REG_MFDE_COMMAND_TYPE_MAD,
9947+
MLXSW_REG_MFDE_COMMAND_TYPE_EMAD,
9948+
MLXSW_REG_MFDE_COMMAND_TYPE_CMDIF,
9949+
};
9950+
9951+
/* reg_mfde_command_type
9952+
* Access: RO
9953+
*/
9954+
MLXSW_ITEM32(reg, mfde, command_type, 0x04, 24, 2);
9955+
9956+
/* reg_mfde_reg_attr_id
9957+
* EMAD - register id, MAD - attibute id
9958+
* Access: RO
9959+
*/
9960+
MLXSW_ITEM32(reg, mfde, reg_attr_id, 0x04, 0, 16);
9961+
9962+
/* reg_mfde_log_address
9963+
* crspace address accessed, which resulted in timeout.
9964+
* Valid in case event_id == MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO
9965+
* Access: RO
9966+
*/
9967+
MLXSW_ITEM32(reg, mfde, log_address, 0x10, 0, 32);
9968+
9969+
/* reg_mfde_log_id
9970+
* Which irisc triggered the timeout.
9971+
* Valid in case event_id == MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO
9972+
* Access: RO
9973+
*/
9974+
MLXSW_ITEM32(reg, mfde, log_id, 0x14, 0, 4);
9975+
9976+
/* reg_mfde_pipes_mask
9977+
* Bit per kvh pipe.
9978+
* Access: RO
9979+
*/
9980+
MLXSW_ITEM32(reg, mfde, pipes_mask, 0x10, 0, 16);
9981+
98839982
/* TNGCR - Tunneling NVE General Configuration Register
98849983
* ----------------------------------------------------
98859984
* The TNGCR register is used for setting up the NVE Tunneling configuration.
@@ -10993,7 +11092,9 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
1099311092
MLXSW_REG(mtpppc),
1099411093
MLXSW_REG(mtpptr),
1099511094
MLXSW_REG(mtptpt),
11095+
MLXSW_REG(mfgd),
1099611096
MLXSW_REG(mgpir),
11097+
MLXSW_REG(mfde),
1099711098
MLXSW_REG(tngcr),
1099811099
MLXSW_REG(tnumt),
1099911100
MLXSW_REG(tnqcr),

0 commit comments

Comments
 (0)