Commit c20302dd authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Tony Nguyen says:

====================
Fwlog support in ixgbe

Michal Swiatkowski says:

Firmware logging is a feature that allow user to dump firmware log using
debugfs interface. It is supported on device that can handle specific
firmware ops. It is true for ice and ixgbe driver.

Prepare code from ice driver to be moved to the library code and reuse
it in ixgbe driver.

* '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ixgbe: fwlog support for e610
  ice, libie: move fwlog code to libie
  ice: reregister fwlog after driver reinit
  ice: prepare for moving file to libie
  ice: move debugfs code to fwlog
  libie, ice: move fwlog admin queue to libie
  ice: drop driver specific structure from fwlog code
  ice: check for PF number outside the fwlog code
  ice: move out debugfs init from fwlog
  ice: allow calling custom send function in fwlog
  ice: add pdev into fwlog structure and use it for logging
  ice: introduce ice_fwlog structure
  ice: drop ice_pf_fwlog_update_module()
  ice: move get_fwlog_data() to fwlog file
  ice: make fwlog functions static
====================

Link: https://patch.msgid.link/20250911210525.345110-1-anthony.l.nguyen@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 617d53f7 641585bc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ config IXGBE
	tristate "Intel(R) 10GbE PCI Express adapters support"
	depends on PCI
	depends on PTP_1588_CLOCK_OPTIONAL
	select LIBIE_FWLOG
	select MDIO
	select NET_DEVLINK
	select PLDMFW
@@ -297,6 +298,7 @@ config ICE
	select DIMLIB
	select LIBIE
	select LIBIE_ADMINQ
	select LIBIE_FWLOG
	select NET_DEVLINK
	select PACKING
	select PLDMFW
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ ice-y := ice_main.o \
	 ice_ethtool.o  \
	 ice_repr.o	\
	 ice_tc_lib.o	\
	 ice_fwlog.o	\
	 ice_debugfs.o  \
	 ice_adapter.o
ice-$(CONFIG_PCI_IOV) +=	\
+1 −5
Original line number Diff line number Diff line
@@ -568,9 +568,6 @@ struct ice_pf {
	struct ice_sw *first_sw;	/* first switch created by firmware */
	u16 eswitch_mode;		/* current mode of eswitch */
	struct dentry *ice_debugfs_pf;
	struct dentry *ice_debugfs_pf_fwlog;
	/* keep track of all the dentrys for FW log modules */
	struct dentry **ice_debugfs_pf_fwlog_modules;
	struct ice_vfs vfs;
	DECLARE_BITMAP(features, ICE_F_MAX);
	DECLARE_BITMAP(state, ICE_STATE_NBITS);
@@ -908,11 +905,10 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
	return false;
}

void ice_debugfs_fwlog_init(struct ice_pf *pf);
int ice_debugfs_pf_init(struct ice_pf *pf);
void ice_debugfs_pf_deinit(struct ice_pf *pf);
void ice_debugfs_init(void);
void ice_debugfs_exit(void);
void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);

bool netif_is_ice(const struct net_device *dev);
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
+0 −78
Original line number Diff line number Diff line
@@ -2399,42 +2399,6 @@ struct ice_aqc_event_lan_overflow {
	u8 reserved[8];
};

enum ice_aqc_fw_logging_mod {
	ICE_AQC_FW_LOG_ID_GENERAL = 0,
	ICE_AQC_FW_LOG_ID_CTRL,
	ICE_AQC_FW_LOG_ID_LINK,
	ICE_AQC_FW_LOG_ID_LINK_TOPO,
	ICE_AQC_FW_LOG_ID_DNL,
	ICE_AQC_FW_LOG_ID_I2C,
	ICE_AQC_FW_LOG_ID_SDP,
	ICE_AQC_FW_LOG_ID_MDIO,
	ICE_AQC_FW_LOG_ID_ADMINQ,
	ICE_AQC_FW_LOG_ID_HDMA,
	ICE_AQC_FW_LOG_ID_LLDP,
	ICE_AQC_FW_LOG_ID_DCBX,
	ICE_AQC_FW_LOG_ID_DCB,
	ICE_AQC_FW_LOG_ID_XLR,
	ICE_AQC_FW_LOG_ID_NVM,
	ICE_AQC_FW_LOG_ID_AUTH,
	ICE_AQC_FW_LOG_ID_VPD,
	ICE_AQC_FW_LOG_ID_IOSF,
	ICE_AQC_FW_LOG_ID_PARSER,
	ICE_AQC_FW_LOG_ID_SW,
	ICE_AQC_FW_LOG_ID_SCHEDULER,
	ICE_AQC_FW_LOG_ID_TXQ,
	ICE_AQC_FW_LOG_ID_RSVD,
	ICE_AQC_FW_LOG_ID_POST,
	ICE_AQC_FW_LOG_ID_WATCHDOG,
	ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
	ICE_AQC_FW_LOG_ID_MNG,
	ICE_AQC_FW_LOG_ID_SYNCE,
	ICE_AQC_FW_LOG_ID_HEALTH,
	ICE_AQC_FW_LOG_ID_TSDRV,
	ICE_AQC_FW_LOG_ID_PFREG,
	ICE_AQC_FW_LOG_ID_MDLVER,
	ICE_AQC_FW_LOG_ID_MAX,
};

enum ice_aqc_health_status_mask {
	ICE_AQC_HEALTH_STATUS_SET_PF_SPECIFIC_MASK = BIT(0),
	ICE_AQC_HEALTH_STATUS_SET_ALL_PF_MASK      = BIT(1),
@@ -2516,48 +2480,6 @@ struct ice_aqc_health_status_elem {
	__le32 internal_data2;
};

/* Set FW Logging configuration (indirect 0xFF30)
 * Register for FW Logging (indirect 0xFF31)
 * Query FW Logging (indirect 0xFF32)
 * FW Log Event (indirect 0xFF33)
 */
struct ice_aqc_fw_log {
	u8 cmd_flags;
#define ICE_AQC_FW_LOG_CONF_UART_EN	BIT(0)
#define ICE_AQC_FW_LOG_CONF_AQ_EN	BIT(1)
#define ICE_AQC_FW_LOG_QUERY_REGISTERED	BIT(2)
#define ICE_AQC_FW_LOG_CONF_SET_VALID	BIT(3)
#define ICE_AQC_FW_LOG_AQ_REGISTER	BIT(0)
#define ICE_AQC_FW_LOG_AQ_QUERY		BIT(2)

	u8 rsp_flag;
	__le16 fw_rt_msb;
	union {
		struct {
			__le32 fw_rt_lsb;
		} sync;
		struct {
			__le16 log_resolution;
#define ICE_AQC_FW_LOG_MIN_RESOLUTION		(1)
#define ICE_AQC_FW_LOG_MAX_RESOLUTION		(128)

			__le16 mdl_cnt;
		} cfg;
	} ops;
	__le32 addr_high;
	__le32 addr_low;
};

/* Response Buffer for:
 *    Set Firmware Logging Configuration (0xFF30)
 *    Query FW Logging (0xFF32)
 */
struct ice_aqc_fw_log_cfg_resp {
	__le16 module_identifier;
	u8 log_level;
	u8 rsvd0;
};

/* Admin Queue command opcodes */
enum ice_adminq_opc {
	/* AQ commands */
+43 −3
Original line number Diff line number Diff line
@@ -984,6 +984,37 @@ static int ice_wait_for_fw(struct ice_hw *hw, u32 timeout)
	return -ETIMEDOUT;
}

static int __fwlog_send_cmd(void *priv, struct libie_aq_desc *desc, void *buf,
			    u16 size)
{
	struct ice_hw *hw = priv;

	return ice_aq_send_cmd(hw, desc, buf, size, NULL);
}

static int __fwlog_init(struct ice_hw *hw)
{
	struct ice_pf *pf = hw->back;
	struct libie_fwlog_api api = {
		.pdev = pf->pdev,
		.send_cmd = __fwlog_send_cmd,
		.priv = hw,
	};
	int err;

	/* only support fw log commands on PF 0 */
	if (hw->bus.func)
		return -EINVAL;

	err = ice_debugfs_pf_init(pf);
	if (err)
		return err;

	api.debugfs_root = pf->ice_debugfs_pf;

	return libie_fwlog_init(&hw->fwlog, &api);
}

/**
 * ice_init_hw - main hardware initialization routine
 * @hw: pointer to the hardware structure
@@ -1012,7 +1043,7 @@ int ice_init_hw(struct ice_hw *hw)
	if (status)
		goto err_unroll_cqinit;

	status = ice_fwlog_init(hw);
	status = __fwlog_init(hw);
	if (status)
		ice_debug(hw, ICE_DBG_FW_LOG, "Error initializing FW logging: %d\n",
			  status);
@@ -1159,6 +1190,16 @@ int ice_init_hw(struct ice_hw *hw)
	return status;
}

static void __fwlog_deinit(struct ice_hw *hw)
{
	/* only support fw log commands on PF 0 */
	if (hw->bus.func)
		return;

	ice_debugfs_pf_deinit(hw->back);
	libie_fwlog_deinit(&hw->fwlog);
}

/**
 * ice_deinit_hw - unroll initialization operations done by ice_init_hw
 * @hw: pointer to the hardware structure
@@ -1177,8 +1218,7 @@ void ice_deinit_hw(struct ice_hw *hw)
	ice_free_seg(hw);
	ice_free_hw_tbls(hw);
	mutex_destroy(&hw->tnl_lock);

	ice_fwlog_deinit(hw);
	__fwlog_deinit(hw);
	ice_destroy_all_ctrlq(hw);

	/* Clear VSI contexts if not already cleared */
Loading