Commit 02f44dac authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Tony Nguyen
Browse files

ice: prepare for moving file to libie



s/ice/libie

There is no function for filling default descriptor in libie. Zero
descriptor structure and set opcode without calling the function.

Make functions that are caled only in ice_fwlog.c static.

Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 2ab5eb4b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -995,7 +995,7 @@ static int __fwlog_send_cmd(void *priv, struct libie_aq_desc *desc, void *buf,
static int __fwlog_init(struct ice_hw *hw)
{
	struct ice_pf *pf = hw->back;
	struct ice_fwlog_api api = {
	struct libie_fwlog_api api = {
		.pdev = pf->pdev,
		.send_cmd = __fwlog_send_cmd,
		.priv = hw,
@@ -1012,7 +1012,7 @@ static int __fwlog_init(struct ice_hw *hw)

	api.debugfs_root = pf->ice_debugfs_pf;

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

/**
@@ -1197,7 +1197,7 @@ static void __fwlog_deinit(struct ice_hw *hw)
		return;

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

/**
+315 −309

File changed.

Preview size limit exceeded, changes collapsed.

+37 −41
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2022, Intel Corporation. */

#ifndef _ICE_FWLOG_H_
#define _ICE_FWLOG_H_
#ifndef _LIBIE_FWLOG_H_
#define _LIBIE_FWLOG_H_
#include "ice_adminq_cmd.h"

struct ice_hw;

/* Only a single log level should be set and all log levels under the set value
 * are enabled, e.g. if log level is set to ICE_FW_LOG_LEVEL_VERBOSE, then all
 * other log levels are included (except ICE_FW_LOG_LEVEL_NONE)
 * are enabled, e.g. if log level is set to LIBIE_FW_LOG_LEVEL_VERBOSE, then all
 * other log levels are included (except LIBIE_FW_LOG_LEVEL_NONE)
 */
enum ice_fwlog_level {
	ICE_FWLOG_LEVEL_NONE = 0,
	ICE_FWLOG_LEVEL_ERROR = 1,
	ICE_FWLOG_LEVEL_WARNING = 2,
	ICE_FWLOG_LEVEL_NORMAL = 3,
	ICE_FWLOG_LEVEL_VERBOSE = 4,
	ICE_FWLOG_LEVEL_INVALID, /* all values >= this entry are invalid */
enum libie_fwlog_level {
	LIBIE_FWLOG_LEVEL_NONE = 0,
	LIBIE_FWLOG_LEVEL_ERROR = 1,
	LIBIE_FWLOG_LEVEL_WARNING = 2,
	LIBIE_FWLOG_LEVEL_NORMAL = 3,
	LIBIE_FWLOG_LEVEL_VERBOSE = 4,
	LIBIE_FWLOG_LEVEL_INVALID, /* all values >= this entry are invalid */
};

struct ice_fwlog_module_entry {
struct libie_fwlog_module_entry {
	/* module ID for the corresponding firmware logging event */
	u16 module_id;
	/* verbosity level for the module_id */
	u8 log_level;
};

struct ice_fwlog_cfg {
struct libie_fwlog_cfg {
	/* list of modules for configuring log level */
	struct ice_fwlog_module_entry module_entries[LIBIE_AQC_FW_LOG_ID_MAX];
	struct libie_fwlog_module_entry module_entries[LIBIE_AQC_FW_LOG_ID_MAX];
	/* options used to configure firmware logging */
	u16 options;
#define ICE_FWLOG_OPTION_ARQ_ENA		BIT(0)
#define ICE_FWLOG_OPTION_UART_ENA		BIT(1)
	/* set before calling ice_fwlog_init() so the PF registers for firmware
	 * logging on initialization
#define LIBIE_FWLOG_OPTION_ARQ_ENA		BIT(0)
#define LIBIE_FWLOG_OPTION_UART_ENA		BIT(1)
	/* set before calling libie_fwlog_init() so the PF registers for
	 * firmware logging on initialization
	 */
#define ICE_FWLOG_OPTION_REGISTER_ON_INIT	BIT(2)
	/* set in the ice_aq_fwlog_get() response if the PF is registered for FW
	 * logging events over ARQ
#define LIBIE_FWLOG_OPTION_REGISTER_ON_INIT	BIT(2)
	/* set in the libie_aq_fwlog_get() response if the PF is registered for
	 * FW logging events over ARQ
	 */
#define ICE_FWLOG_OPTION_IS_REGISTERED		BIT(3)
#define LIBIE_FWLOG_OPTION_IS_REGISTERED	BIT(3)

	/* minimum number of log events sent per Admin Receive Queue event */
	u16 log_resolution;
};

struct ice_fwlog_data {
struct libie_fwlog_data {
	u16 data_size;
	u8 *data;
};

struct ice_fwlog_ring {
	struct ice_fwlog_data *rings;
struct libie_fwlog_ring {
	struct libie_fwlog_data *rings;
	u16 index;
	u16 size;
	u16 head;
	u16 tail;
};

#define ICE_FWLOG_RING_SIZE_INDEX_DFLT 3
#define ICE_FWLOG_RING_SIZE_DFLT 256
#define ICE_FWLOG_RING_SIZE_MAX 512
#define LIBIE_FWLOG_RING_SIZE_INDEX_DFLT 3
#define LIBIE_FWLOG_RING_SIZE_DFLT 256
#define LIBIE_FWLOG_RING_SIZE_MAX 512

struct ice_fwlog {
	struct ice_fwlog_cfg cfg;
struct libie_fwlog {
	struct libie_fwlog_cfg cfg;
	bool supported; /* does hardware support FW logging? */
	struct ice_fwlog_ring ring;
	struct libie_fwlog_ring ring;
	struct dentry *debugfs;
	/* keep track of all the dentrys for FW log modules */
	struct dentry **debugfs_modules;
	struct_group_tagged(ice_fwlog_api, api,
	struct_group_tagged(libie_fwlog_api, api,
		struct pci_dev *pdev;
		int (*send_cmd)(void *, struct libie_aq_desc *, void *, u16);
		void *priv;
@@ -79,10 +77,8 @@ struct ice_fwlog {
	);
};

int ice_fwlog_init(struct ice_fwlog *fwlog, struct ice_fwlog_api *api);
void ice_fwlog_deinit(struct ice_fwlog *fwlog);
int ice_fwlog_set(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg);
int ice_fwlog_register(struct ice_fwlog *fwlog);
int ice_fwlog_unregister(struct ice_fwlog *fwlog);
void ice_get_fwlog_data(struct ice_fwlog *fwlog, u8 *buf, u16 len);
#endif /* _ICE_FWLOG_H_ */
int libie_fwlog_init(struct libie_fwlog *fwlog, struct libie_fwlog_api *api);
void libie_fwlog_deinit(struct libie_fwlog *fwlog);
int libie_fwlog_register(struct libie_fwlog *fwlog);
void libie_get_fwlog_data(struct libie_fwlog *fwlog, u8 *buf, u16 len);
#endif /* _LIBIE_FWLOG_H_ */
+2 −2
Original line number Diff line number Diff line
@@ -1540,7 +1540,7 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
			}
			break;
		case ice_aqc_opc_fw_logs_event:
			ice_get_fwlog_data(&hw->fwlog, event.msg_buf,
			libie_get_fwlog_data(&hw->fwlog, event.msg_buf,
					     le16_to_cpu(event.desc.datalen));
			break;
		case ice_aqc_opc_lldp_set_mib_change:
+1 −1
Original line number Diff line number Diff line
@@ -948,7 +948,7 @@ struct ice_hw {
	u8 fw_patch;		/* firmware patch version */
	u32 fw_build;		/* firmware build number */

	struct ice_fwlog fwlog;
	struct libie_fwlog fwlog;

/* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL
 * register. Used for determining the ITR/INTRL granularity during
Loading