diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_fwlog.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_fwlog.c | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_fwlog.c b/drivers/net/ethernet/intel/ice/ice_fwlog.c index b1c1359d5ab5..172905187a3e 100644 --- a/drivers/net/ethernet/intel/ice/ice_fwlog.c +++ b/drivers/net/ethernet/intel/ice/ice_fwlog.c @@ -137,10 +137,10 @@ static bool ice_fwlog_supported(struct ice_fwlog *fwlog) /** * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32) - * @hw: pointer to the HW structure + * @fwlog: pointer to the fwlog structure * @cfg: firmware logging configuration to populate */ -static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) +static int ice_aq_fwlog_get(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg) { struct ice_aqc_fw_log_cfg_resp *fw_modules; struct ice_aqc_fw_log *cmd; @@ -161,17 +161,17 @@ static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY; - status = ice_aq_send_cmd(hw, &desc, buf, ICE_AQ_MAX_BUF_LEN, NULL); + status = fwlog->send_cmd(fwlog->priv, &desc, buf, ICE_AQ_MAX_BUF_LEN); if (status) { - dev_dbg(&hw->fwlog.pdev->dev, "Failed to get FW log configuration\n"); + dev_dbg(&fwlog->pdev->dev, "Failed to get FW log configuration\n"); goto status_out; } module_id_cnt = le16_to_cpu(cmd->ops.cfg.mdl_cnt); if (module_id_cnt < ICE_AQC_FW_LOG_ID_MAX) { - dev_dbg(&hw->fwlog.pdev->dev, "FW returned less than the expected number of FW log module IDs\n"); + dev_dbg(&fwlog->pdev->dev, "FW returned less than the expected number of FW log module IDs\n"); } else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX) { - dev_dbg(&hw->fwlog.pdev->dev, "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n", + 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", ICE_AQC_FW_LOG_ID_MAX); module_id_cnt = ICE_AQC_FW_LOG_ID_MAX; } @@ -201,7 +201,6 @@ status_out: /** * ice_fwlog_set_supported - Set if FW logging is supported by FW - * @hw: pointer to the HW struct * @fwlog: pointer to the fwlog structure * * If FW returns success to the ice_aq_fwlog_get call then it supports FW @@ -210,7 +209,7 @@ status_out: * This function is only meant to be called during driver init to determine if * the FW support FW logging. */ -static void ice_fwlog_set_supported(struct ice_hw *hw, struct ice_fwlog *fwlog) +static void ice_fwlog_set_supported(struct ice_fwlog *fwlog) { struct ice_fwlog_cfg *cfg; int status; @@ -221,7 +220,7 @@ static void ice_fwlog_set_supported(struct ice_hw *hw, struct ice_fwlog *fwlog) if (!cfg) return; - status = ice_aq_fwlog_get(hw, cfg); + status = ice_aq_fwlog_get(fwlog, cfg); if (status) dev_dbg(&fwlog->pdev->dev, "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n", status); @@ -235,26 +234,26 @@ static void ice_fwlog_set_supported(struct ice_hw *hw, struct ice_fwlog *fwlog) * ice_fwlog_init - Initialize FW logging configuration * @hw: pointer to the HW structure * @fwlog: pointer to the fwlog structure - * @pdev: pointer to the pci dev used in dev_warn() + * @api: api structure to init fwlog * * This function should be called on driver initialization during * ice_init_hw(). */ int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog, - struct pci_dev *pdev) + struct ice_fwlog_api *api) { /* only support fw log commands on PF 0 */ if (hw->bus.func) return -EINVAL; - ice_fwlog_set_supported(hw, fwlog); - fwlog->pdev = pdev; + fwlog->api = *api; + ice_fwlog_set_supported(fwlog); if (ice_fwlog_supported(fwlog)) { int status; /* read the current config from the FW and store it */ - status = ice_aq_fwlog_get(hw, &fwlog->cfg); + status = ice_aq_fwlog_get(fwlog, &fwlog->cfg); if (status) return status; @@ -307,7 +306,7 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog) * for the next driver load */ fwlog->cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA; - status = ice_fwlog_set(hw, &fwlog->cfg); + status = ice_fwlog_set(fwlog, &fwlog->cfg); if (status) dev_warn(&fwlog->pdev->dev, "Unable to turn off FW logging, status: %d\n", status); @@ -316,7 +315,7 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog) pf->ice_debugfs_pf_fwlog_modules = NULL; - status = ice_fwlog_unregister(hw, fwlog); + status = ice_fwlog_unregister(fwlog); if (status) dev_warn(&fwlog->pdev->dev, "Unable to unregister FW logging, status: %d\n", status); @@ -329,15 +328,16 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog) /** * ice_aq_fwlog_set - Set FW logging configuration AQ command (0xFF30) - * @hw: pointer to the HW structure + * @fwlog: pointer to the fwlog structure * @entries: entries to configure * @num_entries: number of @entries * @options: options from ice_fwlog_cfg->options structure * @log_resolution: logging resolution */ static int -ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries, - u16 num_entries, u16 options, u16 log_resolution) +ice_aq_fwlog_set(struct ice_fwlog *fwlog, + struct ice_fwlog_module_entry *entries, u16 num_entries, + u16 options, u16 log_resolution) { struct ice_aqc_fw_log_cfg_resp *fw_modules; struct ice_aqc_fw_log *cmd; @@ -369,9 +369,8 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries, if (options & ICE_FWLOG_OPTION_UART_ENA) cmd->cmd_flags |= ICE_AQC_FW_LOG_CONF_UART_EN; - status = ice_aq_send_cmd(hw, &desc, fw_modules, - sizeof(*fw_modules) * num_entries, - NULL); + status = fwlog->send_cmd(fwlog->priv, &desc, fw_modules, + sizeof(*fw_modules) * num_entries); kfree(fw_modules); @@ -380,7 +379,7 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries, /** * ice_fwlog_set - Set the firmware logging settings - * @hw: pointer to the HW structure + * @fwlog: pointer to the fwlog structure * @cfg: config used to set firmware logging * * This function should be called whenever the driver needs to set the firmware @@ -391,22 +390,22 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries, * ice_fwlog_register. Note, that ice_fwlog_register does not need to be called * for init. */ -int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) +int ice_fwlog_set(struct ice_fwlog *fwlog, struct ice_fwlog_cfg *cfg) { - if (!ice_fwlog_supported(&hw->fwlog)) + if (!ice_fwlog_supported(fwlog)) return -EOPNOTSUPP; - return ice_aq_fwlog_set(hw, cfg->module_entries, + return ice_aq_fwlog_set(fwlog, cfg->module_entries, ICE_AQC_FW_LOG_ID_MAX, cfg->options, cfg->log_resolution); } /** * ice_aq_fwlog_register - Register PF for firmware logging events (0xFF31) - * @hw: pointer to the HW structure + * @fwlog: pointer to the fwlog structure * @reg: true to register and false to unregister */ -static int ice_aq_fwlog_register(struct ice_hw *hw, bool reg) +static int ice_aq_fwlog_register(struct ice_fwlog *fwlog, bool reg) { struct ice_aqc_fw_log *cmd; struct libie_aq_desc desc; @@ -417,25 +416,24 @@ static int ice_aq_fwlog_register(struct ice_hw *hw, bool reg) if (reg) cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_REGISTER; - return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL); + return fwlog->send_cmd(fwlog->priv, &desc, NULL, 0); } /** * ice_fwlog_register - Register the PF for firmware logging - * @hw: pointer to the HW structure * @fwlog: pointer to the fwlog structure * * After this call the PF will start to receive firmware logging based on the * configuration set in ice_fwlog_set. */ -int ice_fwlog_register(struct ice_hw *hw, struct ice_fwlog *fwlog) +int ice_fwlog_register(struct ice_fwlog *fwlog) { int status; if (!ice_fwlog_supported(fwlog)) return -EOPNOTSUPP; - status = ice_aq_fwlog_register(hw, true); + status = ice_aq_fwlog_register(fwlog, true); if (status) dev_dbg(&fwlog->pdev->dev, "Failed to register for firmware logging events over ARQ\n"); else @@ -446,17 +444,16 @@ int ice_fwlog_register(struct ice_hw *hw, struct ice_fwlog *fwlog) /** * ice_fwlog_unregister - Unregister the PF from firmware logging - * @hw: pointer to the HW structure * @fwlog: pointer to the fwlog structure */ -int ice_fwlog_unregister(struct ice_hw *hw, struct ice_fwlog *fwlog) +int ice_fwlog_unregister(struct ice_fwlog *fwlog) { int status; if (!ice_fwlog_supported(fwlog)) return -EOPNOTSUPP; - status = ice_aq_fwlog_register(hw, false); + status = ice_aq_fwlog_register(fwlog, false); if (status) dev_dbg(&fwlog->pdev->dev, "Failed to unregister from firmware logging events over ARQ\n"); else |