Skip to content

Commit 413cf5d

Browse files
Michal Swiatkowskianguy11
authored andcommitted
libie, ice: move fwlog admin queue to libie
Copy the code and: - change ICE_AQC to LIBIE_AQC - change ice_aqc to libie_aqc - move definitions outside the structures Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 57d6ec5 commit 413cf5d

File tree

5 files changed

+124
-112
lines changed

5 files changed

+124
-112
lines changed

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,42 +2399,6 @@ struct ice_aqc_event_lan_overflow {
23992399
u8 reserved[8];
24002400
};
24012401

2402-
enum ice_aqc_fw_logging_mod {
2403-
ICE_AQC_FW_LOG_ID_GENERAL = 0,
2404-
ICE_AQC_FW_LOG_ID_CTRL,
2405-
ICE_AQC_FW_LOG_ID_LINK,
2406-
ICE_AQC_FW_LOG_ID_LINK_TOPO,
2407-
ICE_AQC_FW_LOG_ID_DNL,
2408-
ICE_AQC_FW_LOG_ID_I2C,
2409-
ICE_AQC_FW_LOG_ID_SDP,
2410-
ICE_AQC_FW_LOG_ID_MDIO,
2411-
ICE_AQC_FW_LOG_ID_ADMINQ,
2412-
ICE_AQC_FW_LOG_ID_HDMA,
2413-
ICE_AQC_FW_LOG_ID_LLDP,
2414-
ICE_AQC_FW_LOG_ID_DCBX,
2415-
ICE_AQC_FW_LOG_ID_DCB,
2416-
ICE_AQC_FW_LOG_ID_XLR,
2417-
ICE_AQC_FW_LOG_ID_NVM,
2418-
ICE_AQC_FW_LOG_ID_AUTH,
2419-
ICE_AQC_FW_LOG_ID_VPD,
2420-
ICE_AQC_FW_LOG_ID_IOSF,
2421-
ICE_AQC_FW_LOG_ID_PARSER,
2422-
ICE_AQC_FW_LOG_ID_SW,
2423-
ICE_AQC_FW_LOG_ID_SCHEDULER,
2424-
ICE_AQC_FW_LOG_ID_TXQ,
2425-
ICE_AQC_FW_LOG_ID_RSVD,
2426-
ICE_AQC_FW_LOG_ID_POST,
2427-
ICE_AQC_FW_LOG_ID_WATCHDOG,
2428-
ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
2429-
ICE_AQC_FW_LOG_ID_MNG,
2430-
ICE_AQC_FW_LOG_ID_SYNCE,
2431-
ICE_AQC_FW_LOG_ID_HEALTH,
2432-
ICE_AQC_FW_LOG_ID_TSDRV,
2433-
ICE_AQC_FW_LOG_ID_PFREG,
2434-
ICE_AQC_FW_LOG_ID_MDLVER,
2435-
ICE_AQC_FW_LOG_ID_MAX,
2436-
};
2437-
24382402
enum ice_aqc_health_status_mask {
24392403
ICE_AQC_HEALTH_STATUS_SET_PF_SPECIFIC_MASK = BIT(0),
24402404
ICE_AQC_HEALTH_STATUS_SET_ALL_PF_MASK = BIT(1),
@@ -2516,48 +2480,6 @@ struct ice_aqc_health_status_elem {
25162480
__le32 internal_data2;
25172481
};
25182482

2519-
/* Set FW Logging configuration (indirect 0xFF30)
2520-
* Register for FW Logging (indirect 0xFF31)
2521-
* Query FW Logging (indirect 0xFF32)
2522-
* FW Log Event (indirect 0xFF33)
2523-
*/
2524-
struct ice_aqc_fw_log {
2525-
u8 cmd_flags;
2526-
#define ICE_AQC_FW_LOG_CONF_UART_EN BIT(0)
2527-
#define ICE_AQC_FW_LOG_CONF_AQ_EN BIT(1)
2528-
#define ICE_AQC_FW_LOG_QUERY_REGISTERED BIT(2)
2529-
#define ICE_AQC_FW_LOG_CONF_SET_VALID BIT(3)
2530-
#define ICE_AQC_FW_LOG_AQ_REGISTER BIT(0)
2531-
#define ICE_AQC_FW_LOG_AQ_QUERY BIT(2)
2532-
2533-
u8 rsp_flag;
2534-
__le16 fw_rt_msb;
2535-
union {
2536-
struct {
2537-
__le32 fw_rt_lsb;
2538-
} sync;
2539-
struct {
2540-
__le16 log_resolution;
2541-
#define ICE_AQC_FW_LOG_MIN_RESOLUTION (1)
2542-
#define ICE_AQC_FW_LOG_MAX_RESOLUTION (128)
2543-
2544-
__le16 mdl_cnt;
2545-
} cfg;
2546-
} ops;
2547-
__le32 addr_high;
2548-
__le32 addr_low;
2549-
};
2550-
2551-
/* Response Buffer for:
2552-
* Set Firmware Logging Configuration (0xFF30)
2553-
* Query FW Logging (0xFF32)
2554-
*/
2555-
struct ice_aqc_fw_log_cfg_resp {
2556-
__le16 module_identifier;
2557-
u8 log_level;
2558-
u8 rsvd0;
2559-
};
2560-
25612483
/* Admin Queue command opcodes */
25622484
enum ice_adminq_opc {
25632485
/* AQ commands */

drivers/net/ethernet/intel/ice/ice_debugfs.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ static struct dentry *ice_debugfs_root;
1212
/* create a define that has an extra module that doesn't really exist. this
1313
* is so we can add a module 'all' to easily enable/disable all the modules
1414
*/
15-
#define ICE_NR_FW_LOG_MODULES (ICE_AQC_FW_LOG_ID_MAX + 1)
15+
#define ICE_NR_FW_LOG_MODULES (LIBIE_AQC_FW_LOG_ID_MAX + 1)
1616

1717
/* the ordering in this array is important. it matches the ordering of the
18-
* values in the FW so the index is the same value as in ice_aqc_fw_logging_mod
18+
* values in the FW so the index is the same value as in
19+
* libie_aqc_fw_logging_mod
1920
*/
2021
static const char * const ice_fwlog_module_string[] = {
2122
"general",
@@ -84,7 +85,7 @@ ice_fwlog_print_module_cfg(struct ice_fwlog_cfg *cfg, int module,
8485
{
8586
struct ice_fwlog_module_entry *entry;
8687

87-
if (module != ICE_AQC_FW_LOG_ID_MAX) {
88+
if (module != LIBIE_AQC_FW_LOG_ID_MAX) {
8889
entry = &cfg->module_entries[module];
8990

9091
seq_printf(s, "\tModule: %s, Log Level: %s\n",
@@ -93,7 +94,7 @@ ice_fwlog_print_module_cfg(struct ice_fwlog_cfg *cfg, int module,
9394
} else {
9495
int i;
9596

96-
for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) {
97+
for (i = 0; i < LIBIE_AQC_FW_LOG_ID_MAX; i++) {
9798
entry = &cfg->module_entries[i];
9899

99100
seq_printf(s, "\tModule: %s, Log Level: %s\n",
@@ -190,15 +191,15 @@ ice_debugfs_module_write(struct file *filp, const char __user *buf,
190191
return -EINVAL;
191192
}
192193

193-
if (module != ICE_AQC_FW_LOG_ID_MAX) {
194+
if (module != LIBIE_AQC_FW_LOG_ID_MAX) {
194195
fwlog->cfg.module_entries[module].log_level = log_level;
195196
} else {
196197
/* the module 'all' is a shortcut so that we can set
197198
* all of the modules to the same level quickly
198199
*/
199200
int i;
200201

201-
for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++)
202+
for (i = 0; i < LIBIE_AQC_FW_LOG_ID_MAX; i++)
202203
fwlog->cfg.module_entries[i].log_level = log_level;
203204
}
204205

@@ -266,11 +267,11 @@ ice_debugfs_nr_messages_write(struct file *filp, const char __user *buf,
266267
if (ret)
267268
return ret;
268269

269-
if (nr_messages < ICE_AQC_FW_LOG_MIN_RESOLUTION ||
270-
nr_messages > ICE_AQC_FW_LOG_MAX_RESOLUTION) {
270+
if (nr_messages < LIBIE_AQC_FW_LOG_MIN_RESOLUTION ||
271+
nr_messages > LIBIE_AQC_FW_LOG_MAX_RESOLUTION) {
271272
dev_err(dev, "Invalid FW log number of messages %d, value must be between %d - %d\n",
272-
nr_messages, ICE_AQC_FW_LOG_MIN_RESOLUTION,
273-
ICE_AQC_FW_LOG_MAX_RESOLUTION);
273+
nr_messages, LIBIE_AQC_FW_LOG_MIN_RESOLUTION,
274+
LIBIE_AQC_FW_LOG_MAX_RESOLUTION);
274275
return -EINVAL;
275276
}
276277

drivers/net/ethernet/intel/ice/ice_fwlog.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ static bool ice_fwlog_supported(struct ice_fwlog *fwlog)
142142
*/
143143
static int ice_aq_fwlog_get(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg)
144144
{
145-
struct ice_aqc_fw_log_cfg_resp *fw_modules;
146-
struct ice_aqc_fw_log *cmd;
145+
struct libie_aqc_fw_log_cfg_resp *fw_modules;
146+
struct libie_aqc_fw_log *cmd;
147147
struct libie_aq_desc desc;
148148
u16 module_id_cnt;
149149
int status;
@@ -156,10 +156,10 @@ static int ice_aq_fwlog_get(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg)
156156
if (!buf)
157157
return -ENOMEM;
158158

159-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logs_query);
159+
ice_fill_dflt_direct_cmd_desc(&desc, libie_aqc_opc_fw_logs_query);
160160
cmd = libie_aq_raw(&desc);
161161

162-
cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY;
162+
cmd->cmd_flags = LIBIE_AQC_FW_LOG_AQ_QUERY;
163163

164164
status = fwlog->send_cmd(fwlog->priv, &desc, buf, ICE_AQ_MAX_BUF_LEN);
165165
if (status) {
@@ -168,26 +168,26 @@ static int ice_aq_fwlog_get(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg)
168168
}
169169

170170
module_id_cnt = le16_to_cpu(cmd->ops.cfg.mdl_cnt);
171-
if (module_id_cnt < ICE_AQC_FW_LOG_ID_MAX) {
171+
if (module_id_cnt < LIBIE_AQC_FW_LOG_ID_MAX) {
172172
dev_dbg(&fwlog->pdev->dev, "FW returned less than the expected number of FW log module IDs\n");
173-
} else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX) {
173+
} else if (module_id_cnt > LIBIE_AQC_FW_LOG_ID_MAX) {
174174
dev_dbg(&fwlog->pdev->dev, "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n",
175-
ICE_AQC_FW_LOG_ID_MAX);
176-
module_id_cnt = ICE_AQC_FW_LOG_ID_MAX;
175+
LIBIE_AQC_FW_LOG_ID_MAX);
176+
module_id_cnt = LIBIE_AQC_FW_LOG_ID_MAX;
177177
}
178178

179179
cfg->log_resolution = le16_to_cpu(cmd->ops.cfg.log_resolution);
180-
if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_AQ_EN)
180+
if (cmd->cmd_flags & LIBIE_AQC_FW_LOG_CONF_AQ_EN)
181181
cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA;
182-
if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_UART_EN)
182+
if (cmd->cmd_flags & LIBIE_AQC_FW_LOG_CONF_UART_EN)
183183
cfg->options |= ICE_FWLOG_OPTION_UART_ENA;
184-
if (cmd->cmd_flags & ICE_AQC_FW_LOG_QUERY_REGISTERED)
184+
if (cmd->cmd_flags & LIBIE_AQC_FW_LOG_QUERY_REGISTERED)
185185
cfg->options |= ICE_FWLOG_OPTION_IS_REGISTERED;
186186

187-
fw_modules = (struct ice_aqc_fw_log_cfg_resp *)buf;
187+
fw_modules = (struct libie_aqc_fw_log_cfg_resp *)buf;
188188

189189
for (i = 0; i < module_id_cnt; i++) {
190-
struct ice_aqc_fw_log_cfg_resp *fw_module = &fw_modules[i];
190+
struct libie_aqc_fw_log_cfg_resp *fw_module = &fw_modules[i];
191191

192192
cfg->module_entries[i].module_id =
193193
le16_to_cpu(fw_module->module_identifier);
@@ -325,8 +325,8 @@ ice_aq_fwlog_set(struct ice_fwlog *fwlog,
325325
struct ice_fwlog_module_entry *entries, u16 num_entries,
326326
u16 options, u16 log_resolution)
327327
{
328-
struct ice_aqc_fw_log_cfg_resp *fw_modules;
329-
struct ice_aqc_fw_log *cmd;
328+
struct libie_aqc_fw_log_cfg_resp *fw_modules;
329+
struct libie_aqc_fw_log *cmd;
330330
struct libie_aq_desc desc;
331331
int status;
332332
int i;
@@ -341,19 +341,19 @@ ice_aq_fwlog_set(struct ice_fwlog *fwlog,
341341
fw_modules[i].log_level = entries[i].log_level;
342342
}
343343

344-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logs_config);
344+
ice_fill_dflt_direct_cmd_desc(&desc, libie_aqc_opc_fw_logs_config);
345345
desc.flags |= cpu_to_le16(LIBIE_AQ_FLAG_RD);
346346

347347
cmd = libie_aq_raw(&desc);
348348

349-
cmd->cmd_flags = ICE_AQC_FW_LOG_CONF_SET_VALID;
349+
cmd->cmd_flags = LIBIE_AQC_FW_LOG_CONF_SET_VALID;
350350
cmd->ops.cfg.log_resolution = cpu_to_le16(log_resolution);
351351
cmd->ops.cfg.mdl_cnt = cpu_to_le16(num_entries);
352352

353353
if (options & ICE_FWLOG_OPTION_ARQ_ENA)
354-
cmd->cmd_flags |= ICE_AQC_FW_LOG_CONF_AQ_EN;
354+
cmd->cmd_flags |= LIBIE_AQC_FW_LOG_CONF_AQ_EN;
355355
if (options & ICE_FWLOG_OPTION_UART_ENA)
356-
cmd->cmd_flags |= ICE_AQC_FW_LOG_CONF_UART_EN;
356+
cmd->cmd_flags |= LIBIE_AQC_FW_LOG_CONF_UART_EN;
357357

358358
status = fwlog->send_cmd(fwlog->priv, &desc, fw_modules,
359359
sizeof(*fw_modules) * num_entries);
@@ -382,7 +382,7 @@ int ice_fwlog_set(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg)
382382
return -EOPNOTSUPP;
383383

384384
return ice_aq_fwlog_set(fwlog, cfg->module_entries,
385-
ICE_AQC_FW_LOG_ID_MAX, cfg->options,
385+
LIBIE_AQC_FW_LOG_ID_MAX, cfg->options,
386386
cfg->log_resolution);
387387
}
388388

@@ -393,14 +393,14 @@ int ice_fwlog_set(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg)
393393
*/
394394
static int ice_aq_fwlog_register(struct ice_fwlog *fwlog, bool reg)
395395
{
396-
struct ice_aqc_fw_log *cmd;
396+
struct libie_aqc_fw_log *cmd;
397397
struct libie_aq_desc desc;
398398

399-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logs_register);
399+
ice_fill_dflt_direct_cmd_desc(&desc, libie_aqc_opc_fw_logs_register);
400400
cmd = libie_aq_raw(&desc);
401401

402402
if (reg)
403-
cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_REGISTER;
403+
cmd->cmd_flags = LIBIE_AQC_FW_LOG_AQ_REGISTER;
404404

405405
return fwlog->send_cmd(fwlog->priv, &desc, NULL, 0);
406406
}

drivers/net/ethernet/intel/ice/ice_fwlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct ice_fwlog_module_entry {
2929

3030
struct ice_fwlog_cfg {
3131
/* list of modules for configuring log level */
32-
struct ice_fwlog_module_entry module_entries[ICE_AQC_FW_LOG_ID_MAX];
32+
struct ice_fwlog_module_entry module_entries[LIBIE_AQC_FW_LOG_ID_MAX];
3333
/* options used to configure firmware logging */
3434
u16 options;
3535
#define ICE_FWLOG_OPTION_ARQ_ENA BIT(0)

include/linux/net/intel/libie/adminq.h

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,94 @@ struct libie_aqc_list_caps_elem {
222222
};
223223
LIBIE_CHECK_STRUCT_LEN(32, libie_aqc_list_caps_elem);
224224

225+
/* Admin Queue command opcodes */
226+
enum libie_adminq_opc {
227+
/* FW Logging Commands */
228+
libie_aqc_opc_fw_logs_config = 0xFF30,
229+
libie_aqc_opc_fw_logs_register = 0xFF31,
230+
libie_aqc_opc_fw_logs_query = 0xFF32,
231+
libie_aqc_opc_fw_logs_event = 0xFF33,
232+
};
233+
234+
enum libie_aqc_fw_logging_mod {
235+
LIBIE_AQC_FW_LOG_ID_GENERAL = 0,
236+
LIBIE_AQC_FW_LOG_ID_CTRL,
237+
LIBIE_AQC_FW_LOG_ID_LINK,
238+
LIBIE_AQC_FW_LOG_ID_LINK_TOPO,
239+
LIBIE_AQC_FW_LOG_ID_DNL,
240+
LIBIE_AQC_FW_LOG_ID_I2C,
241+
LIBIE_AQC_FW_LOG_ID_SDP,
242+
LIBIE_AQC_FW_LOG_ID_MDIO,
243+
LIBIE_AQC_FW_LOG_ID_ADMINQ,
244+
LIBIE_AQC_FW_LOG_ID_HDMA,
245+
LIBIE_AQC_FW_LOG_ID_LLDP,
246+
LIBIE_AQC_FW_LOG_ID_DCBX,
247+
LIBIE_AQC_FW_LOG_ID_DCB,
248+
LIBIE_AQC_FW_LOG_ID_XLR,
249+
LIBIE_AQC_FW_LOG_ID_NVM,
250+
LIBIE_AQC_FW_LOG_ID_AUTH,
251+
LIBIE_AQC_FW_LOG_ID_VPD,
252+
LIBIE_AQC_FW_LOG_ID_IOSF,
253+
LIBIE_AQC_FW_LOG_ID_PARSER,
254+
LIBIE_AQC_FW_LOG_ID_SW,
255+
LIBIE_AQC_FW_LOG_ID_SCHEDULER,
256+
LIBIE_AQC_FW_LOG_ID_TXQ,
257+
LIBIE_AQC_FW_LOG_ID_RSVD,
258+
LIBIE_AQC_FW_LOG_ID_POST,
259+
LIBIE_AQC_FW_LOG_ID_WATCHDOG,
260+
LIBIE_AQC_FW_LOG_ID_TASK_DISPATCH,
261+
LIBIE_AQC_FW_LOG_ID_MNG,
262+
LIBIE_AQC_FW_LOG_ID_SYNCE,
263+
LIBIE_AQC_FW_LOG_ID_HEALTH,
264+
LIBIE_AQC_FW_LOG_ID_TSDRV,
265+
LIBIE_AQC_FW_LOG_ID_PFREG,
266+
LIBIE_AQC_FW_LOG_ID_MDLVER,
267+
LIBIE_AQC_FW_LOG_ID_MAX,
268+
};
269+
270+
/* Set FW Logging configuration (indirect 0xFF30)
271+
* Register for FW Logging (indirect 0xFF31)
272+
* Query FW Logging (indirect 0xFF32)
273+
* FW Log Event (indirect 0xFF33)
274+
*/
275+
#define LIBIE_AQC_FW_LOG_CONF_UART_EN BIT(0)
276+
#define LIBIE_AQC_FW_LOG_CONF_AQ_EN BIT(1)
277+
#define LIBIE_AQC_FW_LOG_QUERY_REGISTERED BIT(2)
278+
#define LIBIE_AQC_FW_LOG_CONF_SET_VALID BIT(3)
279+
#define LIBIE_AQC_FW_LOG_AQ_REGISTER BIT(0)
280+
#define LIBIE_AQC_FW_LOG_AQ_QUERY BIT(2)
281+
282+
#define LIBIE_AQC_FW_LOG_MIN_RESOLUTION (1)
283+
#define LIBIE_AQC_FW_LOG_MAX_RESOLUTION (128)
284+
285+
struct libie_aqc_fw_log {
286+
u8 cmd_flags;
287+
288+
u8 rsp_flag;
289+
__le16 fw_rt_msb;
290+
union {
291+
struct {
292+
__le32 fw_rt_lsb;
293+
} sync;
294+
struct {
295+
__le16 log_resolution;
296+
__le16 mdl_cnt;
297+
} cfg;
298+
} ops;
299+
__le32 addr_high;
300+
__le32 addr_low;
301+
};
302+
303+
/* Response Buffer for:
304+
* Set Firmware Logging Configuration (0xFF30)
305+
* Query FW Logging (0xFF32)
306+
*/
307+
struct libie_aqc_fw_log_cfg_resp {
308+
__le16 module_identifier;
309+
u8 log_level;
310+
u8 rsvd0;
311+
};
312+
225313
/**
226314
* struct libie_aq_desc - Admin Queue (AQ) descriptor
227315
* @flags: LIBIE_AQ_FLAG_* flags
@@ -253,6 +341,7 @@ struct libie_aq_desc {
253341
struct libie_aqc_driver_ver driver_ver;
254342
struct libie_aqc_req_res res_owner;
255343
struct libie_aqc_list_caps get_cap;
344+
struct libie_aqc_fw_log fw_log;
256345
} params;
257346
};
258347
LIBIE_CHECK_STRUCT_LEN(32, libie_aq_desc);

0 commit comments

Comments
 (0)