]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: make fwlog functions static
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tue, 12 Aug 2025 04:23:22 +0000 (06:23 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 11 Sep 2025 19:08:48 +0000 (12:08 -0700)
ice_fwlog_supported(), ice_fwlog_get() and ice_fwlog_supported() aren't
called outside the ice_fwlog.c file. Make it static and move in the file
to allow clean build.

Drop ice_fwlog_get(). It is called only from ice_fwlog_init() function
where the fwlog support is already checked. There is no need to check it
again, call ice_aq_fwlog_get() instead.

Drop no longer valid comment from ice_fwlog_get_supported().

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_fwlog.c
drivers/net/ethernet/intel/ice/ice_fwlog.h

index a31bb026ad34489b42f9a8c9f278519b3fd69994..e488562066489c912dd281416097a5436a5ad41c 100644 (file)
@@ -123,6 +123,113 @@ void ice_fwlog_realloc_rings(struct ice_hw *hw, int index)
        hw->fwlog_ring.tail = 0;
 }
 
+/**
+ * ice_fwlog_supported - Cached for whether FW supports FW logging or not
+ * @hw: pointer to the HW structure
+ *
+ * This will always return false if called before ice_init_hw(), so it must be
+ * called after ice_init_hw().
+ */
+static bool ice_fwlog_supported(struct ice_hw *hw)
+{
+       return hw->fwlog_supported;
+}
+
+/**
+ * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32)
+ * @hw: pointer to the HW structure
+ * @cfg: firmware logging configuration to populate
+ */
+static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
+{
+       struct ice_aqc_fw_log_cfg_resp *fw_modules;
+       struct ice_aqc_fw_log *cmd;
+       struct libie_aq_desc desc;
+       u16 module_id_cnt;
+       int status;
+       void *buf;
+       int i;
+
+       memset(cfg, 0, sizeof(*cfg));
+
+       buf = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logs_query);
+       cmd = libie_aq_raw(&desc);
+
+       cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY;
+
+       status = ice_aq_send_cmd(hw, &desc, buf, ICE_AQ_MAX_BUF_LEN, NULL);
+       if (status) {
+               ice_debug(hw, ICE_DBG_FW_LOG, "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) {
+               ice_debug(hw, ICE_DBG_FW_LOG, "FW returned less than the expected number of FW log module IDs\n");
+       } else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX) {
+               ice_debug(hw, ICE_DBG_FW_LOG, "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;
+       }
+
+       cfg->log_resolution = le16_to_cpu(cmd->ops.cfg.log_resolution);
+       if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_AQ_EN)
+               cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA;
+       if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_UART_EN)
+               cfg->options |= ICE_FWLOG_OPTION_UART_ENA;
+       if (cmd->cmd_flags & ICE_AQC_FW_LOG_QUERY_REGISTERED)
+               cfg->options |= ICE_FWLOG_OPTION_IS_REGISTERED;
+
+       fw_modules = (struct ice_aqc_fw_log_cfg_resp *)buf;
+
+       for (i = 0; i < module_id_cnt; i++) {
+               struct ice_aqc_fw_log_cfg_resp *fw_module = &fw_modules[i];
+
+               cfg->module_entries[i].module_id =
+                       le16_to_cpu(fw_module->module_identifier);
+               cfg->module_entries[i].log_level = fw_module->log_level;
+       }
+
+status_out:
+       kfree(buf);
+       return status;
+}
+
+/**
+ * ice_fwlog_set_supported - Set if FW logging is supported by FW
+ * @hw: pointer to the HW struct
+ *
+ * If FW returns success to the ice_aq_fwlog_get call then it supports FW
+ * logging, else it doesn't. Set the fwlog_supported flag accordingly.
+ *
+ * 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_cfg *cfg;
+       int status;
+
+       hw->fwlog_supported = false;
+
+       cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+       if (!cfg)
+               return;
+
+       status = ice_aq_fwlog_get(hw, cfg);
+       if (status)
+               ice_debug(hw, ICE_DBG_FW_LOG, "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n",
+                         status);
+       else
+               hw->fwlog_supported = true;
+
+       kfree(cfg);
+}
+
 /**
  * ice_fwlog_init - Initialize FW logging configuration
  * @hw: pointer to the HW structure
@@ -142,7 +249,7 @@ int ice_fwlog_init(struct ice_hw *hw)
                int status;
 
                /* read the current config from the FW and store it */
-               status = ice_fwlog_get(hw, &hw->fwlog_cfg);
+               status = ice_aq_fwlog_get(hw, &hw->fwlog_cfg);
                if (status)
                        return status;
 
@@ -214,18 +321,6 @@ void ice_fwlog_deinit(struct ice_hw *hw)
        }
 }
 
-/**
- * ice_fwlog_supported - Cached for whether FW supports FW logging or not
- * @hw: pointer to the HW structure
- *
- * This will always return false if called before ice_init_hw(), so it must be
- * called after ice_init_hw().
- */
-bool ice_fwlog_supported(struct ice_hw *hw)
-{
-       return hw->fwlog_supported;
-}
-
 /**
  * ice_aq_fwlog_set - Set FW logging configuration AQ command (0xFF30)
  * @hw: pointer to the HW structure
@@ -300,83 +395,6 @@ int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
                                cfg->log_resolution);
 }
 
-/**
- * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32)
- * @hw: pointer to the HW structure
- * @cfg: firmware logging configuration to populate
- */
-static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
-{
-       struct ice_aqc_fw_log_cfg_resp *fw_modules;
-       struct ice_aqc_fw_log *cmd;
-       struct libie_aq_desc desc;
-       u16 module_id_cnt;
-       int status;
-       void *buf;
-       int i;
-
-       memset(cfg, 0, sizeof(*cfg));
-
-       buf = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
-       if (!buf)
-               return -ENOMEM;
-
-       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logs_query);
-       cmd = libie_aq_raw(&desc);
-
-       cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY;
-
-       status = ice_aq_send_cmd(hw, &desc, buf, ICE_AQ_MAX_BUF_LEN, NULL);
-       if (status) {
-               ice_debug(hw, ICE_DBG_FW_LOG, "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) {
-               ice_debug(hw, ICE_DBG_FW_LOG, "FW returned less than the expected number of FW log module IDs\n");
-       } else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX) {
-               ice_debug(hw, ICE_DBG_FW_LOG, "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;
-       }
-
-       cfg->log_resolution = le16_to_cpu(cmd->ops.cfg.log_resolution);
-       if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_AQ_EN)
-               cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA;
-       if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_UART_EN)
-               cfg->options |= ICE_FWLOG_OPTION_UART_ENA;
-       if (cmd->cmd_flags & ICE_AQC_FW_LOG_QUERY_REGISTERED)
-               cfg->options |= ICE_FWLOG_OPTION_IS_REGISTERED;
-
-       fw_modules = (struct ice_aqc_fw_log_cfg_resp *)buf;
-
-       for (i = 0; i < module_id_cnt; i++) {
-               struct ice_aqc_fw_log_cfg_resp *fw_module = &fw_modules[i];
-
-               cfg->module_entries[i].module_id =
-                       le16_to_cpu(fw_module->module_identifier);
-               cfg->module_entries[i].log_level = fw_module->log_level;
-       }
-
-status_out:
-       kfree(buf);
-       return status;
-}
-
-/**
- * ice_fwlog_get - Get the firmware logging settings
- * @hw: pointer to the HW structure
- * @cfg: config to populate based on current firmware logging settings
- */
-int ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
-{
-       if (!ice_fwlog_supported(hw))
-               return -EOPNOTSUPP;
-
-       return ice_aq_fwlog_get(hw, cfg);
-}
-
 /**
  * ice_aq_fwlog_register - Register PF for firmware logging events (0xFF31)
  * @hw: pointer to the HW structure
@@ -438,37 +456,3 @@ int ice_fwlog_unregister(struct ice_hw *hw)
 
        return status;
 }
-
-/**
- * ice_fwlog_set_supported - Set if FW logging is supported by FW
- * @hw: pointer to the HW struct
- *
- * If FW returns success to the ice_aq_fwlog_get call then it supports FW
- * logging, else it doesn't. Set the fwlog_supported flag accordingly.
- *
- * This function is only meant to be called during driver init to determine if
- * the FW support FW logging.
- */
-void ice_fwlog_set_supported(struct ice_hw *hw)
-{
-       struct ice_fwlog_cfg *cfg;
-       int status;
-
-       hw->fwlog_supported = false;
-
-       cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
-       if (!cfg)
-               return;
-
-       /* don't call ice_fwlog_get() because that would check to see if FW
-        * logging is supported which is what the driver is determining now
-        */
-       status = ice_aq_fwlog_get(hw, cfg);
-       if (status)
-               ice_debug(hw, ICE_DBG_FW_LOG, "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n",
-                         status);
-       else
-               hw->fwlog_supported = true;
-
-       kfree(cfg);
-}
index 287e71fa4b8624813654db9235681ffa0cc77fed..7d95d11b6ef9349cb709938b43bdd0c765933877 100644 (file)
@@ -38,7 +38,7 @@ struct ice_fwlog_cfg {
         * logging on initialization
         */
 #define ICE_FWLOG_OPTION_REGISTER_ON_INIT      BIT(2)
-       /* set in the ice_fwlog_get() response if the PF is registered for FW
+       /* set in the ice_aq_fwlog_get() response if the PF is registered for FW
         * logging events over ARQ
         */
 #define ICE_FWLOG_OPTION_IS_REGISTERED         BIT(3)
@@ -67,12 +67,9 @@ struct ice_fwlog_ring {
 bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings);
 bool ice_fwlog_ring_empty(struct ice_fwlog_ring *rings);
 void ice_fwlog_ring_increment(u16 *item, u16 size);
-void ice_fwlog_set_supported(struct ice_hw *hw);
-bool ice_fwlog_supported(struct ice_hw *hw);
 int ice_fwlog_init(struct ice_hw *hw);
 void ice_fwlog_deinit(struct ice_hw *hw);
 int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
-int ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
 int ice_fwlog_register(struct ice_hw *hw);
 int ice_fwlog_unregister(struct ice_hw *hw);
 void ice_fwlog_realloc_rings(struct ice_hw *hw, int index);