linux-loongson/drivers/net/ethernet/intel/ice/devlink/health.h
Konrad Knitter 85d6164ec5 ice: add fw and port health reporters
Firmware generates events for global events or port specific events.

Driver shall subscribe for health status events from firmware on supported
FW versions >= 1.7.6.
Driver shall expose those under specific health reporter, two new
reporters are introduced:
- FW health reporter shall represent global events (problems with the
image, recovery mode);
- Port health reporter shall represent port-specific events (module
failure).

Firmware only reports problems when those are detected, it does not store
active fault list.
Driver will hold only last global and last port-specific event.
Driver will report all events via devlink health report,
so in case of multiple events of the same source they can be reviewed
using devlink autodump feature.

$ devlink health

pci/0000:b1:00.3:
  reporter fw
    state healthy error 0 recover 0 auto_dump true
  reporter port
    state error error 1 recover 0 last_dump_date 2024-03-17
	last_dump_time 09:29:29 auto_dump true

$ devlink health diagnose pci/0000:b1:00.3 reporter port

  Syndrome: 262
  Description: Module is not present.
  Possible Solution: Check that the module is inserted correctly.
  Port Number: 0

Tested on Intel Corporation Ethernet Controller E810-C for SFP

Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Co-developed-by: Sharon Haroni <sharon.haroni@intel.com>
Signed-off-by: Sharon Haroni <sharon.haroni@intel.com>
Co-developed-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Co-developed-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Konrad Knitter <konrad.knitter@intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2025-01-14 14:37:34 -08:00

72 lines
2.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2024, Intel Corporation. */
#ifndef _HEALTH_H_
#define _HEALTH_H_
#include <linux/types.h>
/**
* DOC: health.h
*
* This header file stores everything that is needed for broadly understood
* devlink health mechanism for ice driver.
*/
struct ice_aqc_health_status_elem;
struct ice_pf;
struct ice_tx_ring;
struct ice_rq_event_info;
enum ice_mdd_src {
ICE_MDD_SRC_TX_PQM,
ICE_MDD_SRC_TX_TCLAN,
ICE_MDD_SRC_TX_TDPU,
ICE_MDD_SRC_RX,
};
/**
* struct ice_health - stores ice devlink health reporters and accompanied data
* @fw: devlink health reporter for FW Health Status events
* @mdd: devlink health reporter for MDD detection event
* @port: devlink health reporter for Port Health Status events
* @tx_hang: devlink health reporter for tx_hang event
* @tx_hang_buf: pre-allocated place to put info for Tx hang reporter from
* non-sleeping context
* @tx_ring: ring that the hang occurred on
* @head: descriptor head
* @intr: interrupt register value
* @vsi_num: VSI owning the queue that the hang occurred on
* @fw_status: buffer for last received FW Status event
* @port_status: buffer for last received Port Status event
*/
struct ice_health {
struct devlink_health_reporter *fw;
struct devlink_health_reporter *mdd;
struct devlink_health_reporter *port;
struct devlink_health_reporter *tx_hang;
struct_group_tagged(ice_health_tx_hang_buf, tx_hang_buf,
struct ice_tx_ring *tx_ring;
u32 head;
u32 intr;
u16 vsi_num;
);
struct ice_aqc_health_status_elem fw_status;
struct ice_aqc_health_status_elem port_status;
};
void ice_process_health_status_event(struct ice_pf *pf,
struct ice_rq_event_info *event);
void ice_health_init(struct ice_pf *pf);
void ice_health_deinit(struct ice_pf *pf);
void ice_health_clear(struct ice_pf *pf);
void ice_prep_tx_hang_report(struct ice_pf *pf, struct ice_tx_ring *tx_ring,
u16 vsi_num, u32 head, u32 intr);
void ice_report_mdd_event(struct ice_pf *pf, enum ice_mdd_src src, u8 pf_num,
u16 vf_num, u8 event, u16 queue);
void ice_report_tx_hang(struct ice_pf *pf);
#endif /* _HEALTH_H_ */