Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michal Swiatkowski and committed by
Tony Nguyen
413cf5db 57d6ec57

+124 -112
-78
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
··· 2399 2399 u8 reserved[8]; 2400 2400 }; 2401 2401 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 - 2438 2402 enum ice_aqc_health_status_mask { 2439 2403 ICE_AQC_HEALTH_STATUS_SET_PF_SPECIFIC_MASK = BIT(0), 2440 2404 ICE_AQC_HEALTH_STATUS_SET_ALL_PF_MASK = BIT(1), ··· 2478 2514 __le16 event_source; 2479 2515 __le32 internal_data1; 2480 2516 __le32 internal_data2; 2481 - }; 2482 - 2483 - /* Set FW Logging configuration (indirect 0xFF30) 2484 - * Register for FW Logging (indirect 0xFF31) 2485 - * Query FW Logging (indirect 0xFF32) 2486 - * FW Log Event (indirect 0xFF33) 2487 - */ 2488 - struct ice_aqc_fw_log { 2489 - u8 cmd_flags; 2490 - #define ICE_AQC_FW_LOG_CONF_UART_EN BIT(0) 2491 - #define ICE_AQC_FW_LOG_CONF_AQ_EN BIT(1) 2492 - #define ICE_AQC_FW_LOG_QUERY_REGISTERED BIT(2) 2493 - #define ICE_AQC_FW_LOG_CONF_SET_VALID BIT(3) 2494 - #define ICE_AQC_FW_LOG_AQ_REGISTER BIT(0) 2495 - #define ICE_AQC_FW_LOG_AQ_QUERY BIT(2) 2496 - 2497 - u8 rsp_flag; 2498 - __le16 fw_rt_msb; 2499 - union { 2500 - struct { 2501 - __le32 fw_rt_lsb; 2502 - } sync; 2503 - struct { 2504 - __le16 log_resolution; 2505 - #define ICE_AQC_FW_LOG_MIN_RESOLUTION (1) 2506 - #define ICE_AQC_FW_LOG_MAX_RESOLUTION (128) 2507 - 2508 - __le16 mdl_cnt; 2509 - } cfg; 2510 - } ops; 2511 - __le32 addr_high; 2512 - __le32 addr_low; 2513 - }; 2514 - 2515 - /* Response Buffer for: 2516 - * Set Firmware Logging Configuration (0xFF30) 2517 - * Query FW Logging (0xFF32) 2518 - */ 2519 - struct ice_aqc_fw_log_cfg_resp { 2520 - __le16 module_identifier; 2521 - u8 log_level; 2522 - u8 rsvd0; 2523 2517 }; 2524 2518 2525 2519 /* Admin Queue command opcodes */
+11 -10
drivers/net/ethernet/intel/ice/ice_debugfs.c
··· 12 12 /* create a define that has an extra module that doesn't really exist. this 13 13 * is so we can add a module 'all' to easily enable/disable all the modules 14 14 */ 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) 16 16 17 17 /* 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 19 20 */ 20 21 static const char * const ice_fwlog_module_string[] = { 21 22 "general", ··· 85 84 { 86 85 struct ice_fwlog_module_entry *entry; 87 86 88 - if (module != ICE_AQC_FW_LOG_ID_MAX) { 87 + if (module != LIBIE_AQC_FW_LOG_ID_MAX) { 89 88 entry = &cfg->module_entries[module]; 90 89 91 90 seq_printf(s, "\tModule: %s, Log Level: %s\n", ··· 94 93 } else { 95 94 int i; 96 95 97 - for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) { 96 + for (i = 0; i < LIBIE_AQC_FW_LOG_ID_MAX; i++) { 98 97 entry = &cfg->module_entries[i]; 99 98 100 99 seq_printf(s, "\tModule: %s, Log Level: %s\n", ··· 191 190 return -EINVAL; 192 191 } 193 192 194 - if (module != ICE_AQC_FW_LOG_ID_MAX) { 193 + if (module != LIBIE_AQC_FW_LOG_ID_MAX) { 195 194 fwlog->cfg.module_entries[module].log_level = log_level; 196 195 } else { 197 196 /* the module 'all' is a shortcut so that we can set ··· 199 198 */ 200 199 int i; 201 200 202 - for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) 201 + for (i = 0; i < LIBIE_AQC_FW_LOG_ID_MAX; i++) 203 202 fwlog->cfg.module_entries[i].log_level = log_level; 204 203 } 205 204 ··· 267 266 if (ret) 268 267 return ret; 269 268 270 - if (nr_messages < ICE_AQC_FW_LOG_MIN_RESOLUTION || 271 - nr_messages > ICE_AQC_FW_LOG_MAX_RESOLUTION) { 269 + if (nr_messages < LIBIE_AQC_FW_LOG_MIN_RESOLUTION || 270 + nr_messages > LIBIE_AQC_FW_LOG_MAX_RESOLUTION) { 272 271 dev_err(dev, "Invalid FW log number of messages %d, value must be between %d - %d\n", 273 - nr_messages, ICE_AQC_FW_LOG_MIN_RESOLUTION, 274 - ICE_AQC_FW_LOG_MAX_RESOLUTION); 272 + nr_messages, LIBIE_AQC_FW_LOG_MIN_RESOLUTION, 273 + LIBIE_AQC_FW_LOG_MAX_RESOLUTION); 275 274 return -EINVAL; 276 275 } 277 276
+23 -23
drivers/net/ethernet/intel/ice/ice_fwlog.c
··· 142 142 */ 143 143 static int ice_aq_fwlog_get(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg) 144 144 { 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; 147 147 struct libie_aq_desc desc; 148 148 u16 module_id_cnt; 149 149 int status; ··· 156 156 if (!buf) 157 157 return -ENOMEM; 158 158 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); 160 160 cmd = libie_aq_raw(&desc); 161 161 162 - cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY; 162 + cmd->cmd_flags = LIBIE_AQC_FW_LOG_AQ_QUERY; 163 163 164 164 status = fwlog->send_cmd(fwlog->priv, &desc, buf, ICE_AQ_MAX_BUF_LEN); 165 165 if (status) { ··· 168 168 } 169 169 170 170 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) { 172 172 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) { 174 174 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; 177 177 } 178 178 179 179 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) 181 181 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) 183 183 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) 185 185 cfg->options |= ICE_FWLOG_OPTION_IS_REGISTERED; 186 186 187 - fw_modules = (struct ice_aqc_fw_log_cfg_resp *)buf; 187 + fw_modules = (struct libie_aqc_fw_log_cfg_resp *)buf; 188 188 189 189 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]; 191 191 192 192 cfg->module_entries[i].module_id = 193 193 le16_to_cpu(fw_module->module_identifier); ··· 325 325 struct ice_fwlog_module_entry *entries, u16 num_entries, 326 326 u16 options, u16 log_resolution) 327 327 { 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; 330 330 struct libie_aq_desc desc; 331 331 int status; 332 332 int i; ··· 341 341 fw_modules[i].log_level = entries[i].log_level; 342 342 } 343 343 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); 345 345 desc.flags |= cpu_to_le16(LIBIE_AQ_FLAG_RD); 346 346 347 347 cmd = libie_aq_raw(&desc); 348 348 349 - cmd->cmd_flags = ICE_AQC_FW_LOG_CONF_SET_VALID; 349 + cmd->cmd_flags = LIBIE_AQC_FW_LOG_CONF_SET_VALID; 350 350 cmd->ops.cfg.log_resolution = cpu_to_le16(log_resolution); 351 351 cmd->ops.cfg.mdl_cnt = cpu_to_le16(num_entries); 352 352 353 353 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; 355 355 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; 357 357 358 358 status = fwlog->send_cmd(fwlog->priv, &desc, fw_modules, 359 359 sizeof(*fw_modules) * num_entries); ··· 382 382 return -EOPNOTSUPP; 383 383 384 384 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, 386 386 cfg->log_resolution); 387 387 } 388 388 ··· 393 393 */ 394 394 static int ice_aq_fwlog_register(struct ice_fwlog *fwlog, bool reg) 395 395 { 396 - struct ice_aqc_fw_log *cmd; 396 + struct libie_aqc_fw_log *cmd; 397 397 struct libie_aq_desc desc; 398 398 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); 400 400 cmd = libie_aq_raw(&desc); 401 401 402 402 if (reg) 403 - cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_REGISTER; 403 + cmd->cmd_flags = LIBIE_AQC_FW_LOG_AQ_REGISTER; 404 404 405 405 return fwlog->send_cmd(fwlog->priv, &desc, NULL, 0); 406 406 }
+1 -1
drivers/net/ethernet/intel/ice/ice_fwlog.h
··· 29 29 30 30 struct ice_fwlog_cfg { 31 31 /* 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]; 33 33 /* options used to configure firmware logging */ 34 34 u16 options; 35 35 #define ICE_FWLOG_OPTION_ARQ_ENA BIT(0)
+89
include/linux/net/intel/libie/adminq.h
··· 222 222 }; 223 223 LIBIE_CHECK_STRUCT_LEN(32, libie_aqc_list_caps_elem); 224 224 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 + 225 313 /** 226 314 * struct libie_aq_desc - Admin Queue (AQ) descriptor 227 315 * @flags: LIBIE_AQ_FLAG_* flags ··· 341 253 struct libie_aqc_driver_ver driver_ver; 342 254 struct libie_aqc_req_res res_owner; 343 255 struct libie_aqc_list_caps get_cap; 256 + struct libie_aqc_fw_log fw_log; 344 257 } params; 345 258 }; 346 259 LIBIE_CHECK_STRUCT_LEN(32, libie_aq_desc);