net/ice/base: remove debug code
authorQi Zhang <qi.z.zhang@intel.com>
Thu, 29 Aug 2019 02:36:01 +0000 (10:36 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:53 +0000 (15:00 +0200)
Remove firmware logging debug code.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
drivers/net/ice/base/ice_adminq_cmd.h
drivers/net/ice/base/ice_common.c
drivers/net/ice/base/ice_common.h
drivers/net/ice/base/ice_type.h

index b5faa5b..9e5853c 100644 (file)
@@ -2176,87 +2176,6 @@ struct ice_aqc_event_lan_overflow {
 
 
 
-/* Configure Firmware Logging Command (indirect 0xFF09)
- * Logging Information Read Response (indirect 0xFF10)
- * Note: The 0xFF10 command has no input parameters.
- */
-struct ice_aqc_fw_logging {
-       u8 log_ctrl;
-#define ICE_AQC_FW_LOG_AQ_EN           BIT(0)
-#define ICE_AQC_FW_LOG_UART_EN         BIT(1)
-       u8 rsvd0;
-       u8 log_ctrl_valid; /* Not used by 0xFF10 Response */
-#define ICE_AQC_FW_LOG_AQ_VALID                BIT(0)
-#define ICE_AQC_FW_LOG_UART_VALID      BIT(1)
-       u8 rsvd1[5];
-       __le32 addr_high;
-       __le32 addr_low;
-};
-
-
-enum ice_aqc_fw_logging_mod {
-       ICE_AQC_FW_LOG_ID_GENERAL = 0,
-       ICE_AQC_FW_LOG_ID_CTRL,
-       ICE_AQC_FW_LOG_ID_LINK,
-       ICE_AQC_FW_LOG_ID_LINK_TOPO,
-       ICE_AQC_FW_LOG_ID_DNL,
-       ICE_AQC_FW_LOG_ID_I2C,
-       ICE_AQC_FW_LOG_ID_SDP,
-       ICE_AQC_FW_LOG_ID_MDIO,
-       ICE_AQC_FW_LOG_ID_ADMINQ,
-       ICE_AQC_FW_LOG_ID_HDMA,
-       ICE_AQC_FW_LOG_ID_LLDP,
-       ICE_AQC_FW_LOG_ID_DCBX,
-       ICE_AQC_FW_LOG_ID_DCB,
-       ICE_AQC_FW_LOG_ID_NETPROXY,
-       ICE_AQC_FW_LOG_ID_NVM,
-       ICE_AQC_FW_LOG_ID_AUTH,
-       ICE_AQC_FW_LOG_ID_VPD,
-       ICE_AQC_FW_LOG_ID_IOSF,
-       ICE_AQC_FW_LOG_ID_PARSER,
-       ICE_AQC_FW_LOG_ID_SW,
-       ICE_AQC_FW_LOG_ID_SCHEDULER,
-       ICE_AQC_FW_LOG_ID_TXQ,
-       ICE_AQC_FW_LOG_ID_RSVD,
-       ICE_AQC_FW_LOG_ID_POST,
-       ICE_AQC_FW_LOG_ID_WATCHDOG,
-       ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
-       ICE_AQC_FW_LOG_ID_MNG,
-       ICE_AQC_FW_LOG_ID_SYNCE,
-       ICE_AQC_FW_LOG_ID_MAX,
-};
-
-/* This is the buffer for both of the logging commands.
- * The entry array size depends on the datalen parameter in the descriptor.
- * There will be a total of datalen / 2 entries.
- */
-struct ice_aqc_fw_logging_data {
-       __le16 entry[1];
-#define ICE_AQC_FW_LOG_ID_S            0
-#define ICE_AQC_FW_LOG_ID_M            (0xFFF << ICE_AQC_FW_LOG_ID_S)
-
-#define ICE_AQC_FW_LOG_CONF_SUCCESS    0       /* Used by response */
-#define ICE_AQC_FW_LOG_CONF_BAD_INDX   BIT(12) /* Used by response */
-
-#define ICE_AQC_FW_LOG_EN_S            12
-#define ICE_AQC_FW_LOG_EN_M            (0xF << ICE_AQC_FW_LOG_EN_S)
-#define ICE_AQC_FW_LOG_INFO_EN         BIT(12) /* Used by command */
-#define ICE_AQC_FW_LOG_INIT_EN         BIT(13) /* Used by command */
-#define ICE_AQC_FW_LOG_FLOW_EN         BIT(14) /* Used by command */
-#define ICE_AQC_FW_LOG_ERR_EN          BIT(15) /* Used by command */
-};
-
-
-/* Get/Clear FW Log (indirect 0xFF11) */
-struct ice_aqc_get_clear_fw_log {
-       u8 flags;
-#define ICE_AQC_FW_LOG_CLEAR           BIT(0)
-#define ICE_AQC_FW_LOG_MORE_DATA_AVAIL BIT(1)
-       u8 rsvd1[7];
-       __le32 addr_high;
-       __le32 addr_low;
-};
-
 
 /**
  * struct ice_aq_desc - Admin Queue (AQ) descriptor
@@ -2337,8 +2256,6 @@ struct ice_aq_desc {
                struct ice_aqc_get_vsi_resp get_vsi_resp;
                struct ice_aqc_download_pkg download_pkg;
                struct ice_aqc_get_pkg_info_list get_pkg_info_list;
-               struct ice_aqc_fw_logging fw_logging;
-               struct ice_aqc_get_clear_fw_log get_clear_fw_log;
                struct ice_aqc_set_mac_lb set_mac_lb;
                struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
                struct ice_aqc_get_res_alloc get_res;
@@ -2558,11 +2475,6 @@ enum ice_adminq_opc {
 
        /* Standalone Commands/Events */
        ice_aqc_opc_event_lan_overflow                  = 0x1001,
-
-       /* debug commands */
-       ice_aqc_opc_fw_logging                          = 0xFF09,
-       ice_aqc_opc_fw_logging_info                     = 0xFF10,
-       ice_aqc_opc_get_clear_fw_log                    = 0xFF11
 };
 
 #endif /* _ICE_ADMINQ_CMD_H_ */
index b4f0b96..43c0694 100644 (file)
@@ -653,223 +653,6 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
        ice_free(hw, sw);
 }
 
-#define ICE_FW_LOG_DESC_SIZE(n)        (sizeof(struct ice_aqc_fw_logging_data) + \
-       (((n) - 1) * sizeof(((struct ice_aqc_fw_logging_data *)0)->entry)))
-#define ICE_FW_LOG_DESC_SIZE_MAX       \
-       ICE_FW_LOG_DESC_SIZE(ICE_AQC_FW_LOG_ID_MAX)
-
-/**
- * ice_get_fw_log_cfg - get FW logging configuration
- * @hw: pointer to the HW struct
- */
-static enum ice_status ice_get_fw_log_cfg(struct ice_hw *hw)
-{
-       struct ice_aqc_fw_logging_data *config;
-       struct ice_aq_desc desc;
-       enum ice_status status;
-       u16 size;
-
-       size = ICE_FW_LOG_DESC_SIZE_MAX;
-       config = (struct ice_aqc_fw_logging_data *)ice_malloc(hw, size);
-       if (!config)
-               return ICE_ERR_NO_MEMORY;
-
-       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging_info);
-
-       desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_BUF);
-       desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
-
-       status = ice_aq_send_cmd(hw, &desc, config, size, NULL);
-       if (!status) {
-               u16 i;
-
-               /* Save fw logging information into the HW structure */
-               for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) {
-                       u16 v, m, flgs;
-
-                       v = LE16_TO_CPU(config->entry[i]);
-                       m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S;
-                       flgs = (v & ICE_AQC_FW_LOG_EN_M) >> ICE_AQC_FW_LOG_EN_S;
-
-                       if (m < ICE_AQC_FW_LOG_ID_MAX)
-                               hw->fw_log.evnts[m].cur = flgs;
-               }
-       }
-
-       ice_free(hw, config);
-
-       return status;
-}
-
-/**
- * ice_cfg_fw_log - configure FW logging
- * @hw: pointer to the HW struct
- * @enable: enable certain FW logging events if true, disable all if false
- *
- * This function enables/disables the FW logging via Rx CQ events and a UART
- * port based on predetermined configurations. FW logging via the Rx CQ can be
- * enabled/disabled for individual PF's. However, FW logging via the UART can
- * only be enabled/disabled for all PFs on the same device.
- *
- * To enable overall FW logging, the "cq_en" and "uart_en" enable bits in
- * hw->fw_log need to be set accordingly, e.g. based on user-provided input,
- * before initializing the device.
- *
- * When re/configuring FW logging, callers need to update the "cfg" elements of
- * the hw->fw_log.evnts array with the desired logging event configurations for
- * modules of interest. When disabling FW logging completely, the callers can
- * just pass false in the "enable" parameter. On completion, the function will
- * update the "cur" element of the hw->fw_log.evnts array with the resulting
- * logging event configurations of the modules that are being re/configured. FW
- * logging modules that are not part of a reconfiguration operation retain their
- * previous states.
- *
- * Before resetting the device, it is recommended that the driver disables FW
- * logging before shutting down the control queue. When disabling FW logging
- * ("enable" = false), the latest configurations of FW logging events stored in
- * hw->fw_log.evnts[] are not overridden to allow them to be reconfigured after
- * a device reset.
- *
- * When enabling FW logging to emit log messages via the Rx CQ during the
- * device's initialization phase, a mechanism alternative to interrupt handlers
- * needs to be used to extract FW log messages from the Rx CQ periodically and
- * to prevent the Rx CQ from being full and stalling other types of control
- * messages from FW to SW. Interrupts are typically disabled during the device's
- * initialization phase.
- */
-static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable)
-{
-       struct ice_aqc_fw_logging_data *data = NULL;
-       struct ice_aqc_fw_logging *cmd;
-       enum ice_status status = ICE_SUCCESS;
-       u16 i, chgs = 0, len = 0;
-       struct ice_aq_desc desc;
-       u8 actv_evnts = 0;
-       void *buf = NULL;
-
-       if (!hw->fw_log.cq_en && !hw->fw_log.uart_en)
-               return ICE_SUCCESS;
-
-       /* Disable FW logging only when the control queue is still responsive */
-       if (!enable &&
-           (!hw->fw_log.actv_evnts || !ice_check_sq_alive(hw, &hw->adminq)))
-               return ICE_SUCCESS;
-
-       /* Get current FW log settings */
-       status = ice_get_fw_log_cfg(hw);
-       if (status)
-               return status;
-
-       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging);
-       cmd = &desc.params.fw_logging;
-
-       /* Indicate which controls are valid */
-       if (hw->fw_log.cq_en)
-               cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID;
-
-       if (hw->fw_log.uart_en)
-               cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID;
-
-       if (enable) {
-               /* Fill in an array of entries with FW logging modules and
-                * logging events being reconfigured.
-                */
-               for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) {
-                       u16 val;
-
-                       /* Keep track of enabled event types */
-                       actv_evnts |= hw->fw_log.evnts[i].cfg;
-
-                       if (hw->fw_log.evnts[i].cfg == hw->fw_log.evnts[i].cur)
-                               continue;
-
-                       if (!data) {
-                               data = (struct ice_aqc_fw_logging_data *)
-                                       ice_malloc(hw,
-                                                  ICE_FW_LOG_DESC_SIZE_MAX);
-                               if (!data)
-                                       return ICE_ERR_NO_MEMORY;
-                       }
-
-                       val = i << ICE_AQC_FW_LOG_ID_S;
-                       val |= hw->fw_log.evnts[i].cfg << ICE_AQC_FW_LOG_EN_S;
-                       data->entry[chgs++] = CPU_TO_LE16(val);
-               }
-
-               /* Only enable FW logging if at least one module is specified.
-                * If FW logging is currently enabled but all modules are not
-                * enabled to emit log messages, disable FW logging altogether.
-                */
-               if (actv_evnts) {
-                       /* Leave if there is effectively no change */
-                       if (!chgs)
-                               goto out;
-
-                       if (hw->fw_log.cq_en)
-                               cmd->log_ctrl |= ICE_AQC_FW_LOG_AQ_EN;
-
-                       if (hw->fw_log.uart_en)
-                               cmd->log_ctrl |= ICE_AQC_FW_LOG_UART_EN;
-
-                       buf = data;
-                       len = ICE_FW_LOG_DESC_SIZE(chgs);
-                       desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
-               }
-       }
-
-       status = ice_aq_send_cmd(hw, &desc, buf, len, NULL);
-       if (!status) {
-               /* Update the current configuration to reflect events enabled.
-                * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW
-                * logging mode is enabled for the device. They do not reflect
-                * actual modules being enabled to emit log messages. So, their
-                * values remain unchanged even when all modules are disabled.
-                */
-               u16 cnt = enable ? chgs : (u16)ICE_AQC_FW_LOG_ID_MAX;
-
-               hw->fw_log.actv_evnts = actv_evnts;
-               for (i = 0; i < cnt; i++) {
-                       u16 v, m;
-
-                       if (!enable) {
-                               /* When disabling all FW logging events as part
-                                * of device's de-initialization, the original
-                                * configurations are retained, and can be used
-                                * to reconfigure FW logging later if the device
-                                * is re-initialized.
-                                */
-                               hw->fw_log.evnts[i].cur = 0;
-                               continue;
-                       }
-
-                       v = LE16_TO_CPU(data->entry[i]);
-                       m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S;
-                       hw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg;
-               }
-       }
-
-out:
-       if (data)
-               ice_free(hw, data);
-
-       return status;
-}
-
-/**
- * ice_output_fw_log
- * @hw: pointer to the HW struct
- * @desc: pointer to the AQ message descriptor
- * @buf: pointer to the buffer accompanying the AQ message
- *
- * Formats a FW Log message and outputs it via the standard driver logs.
- */
-void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf)
-{
-       ice_debug(hw, ICE_DBG_FW_LOG, "[ FW Log Msg Start ]\n");
-       ice_debug_array(hw, ICE_DBG_FW_LOG, 16, 1, (u8 *)buf,
-                       LE16_TO_CPU(desc->datalen));
-       ice_debug(hw, ICE_DBG_FW_LOG, "[ FW Log Msg End ]\n");
-}
 
 /**
  * ice_get_itr_intrl_gran - determine int/intrl granularity
@@ -979,10 +762,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
        if (ice_get_fw_mode(hw) == ICE_FW_MODE_ROLLBACK)
                ice_print_rollback_msg(hw);
 
-       /* Enable FW logging. Not fatal if this fails. */
-       status = ice_cfg_fw_log(hw, true);
-       if (status)
-               ice_debug(hw, ICE_DBG_INIT, "Failed to enable FW logging.\n");
 
        status = ice_clear_pf_cfg(hw);
        if (status)
@@ -1136,8 +915,6 @@ void ice_deinit_hw(struct ice_hw *hw)
                hw->port_info = NULL;
        }
 
-       /* Attempt to disable FW logging before shutting down control queues */
-       ice_cfg_fw_log(hw, false);
        ice_destroy_all_ctrlq(hw);
 
        /* Clear VSI contexts if not already cleared */
index 4ecfa6b..4e44c2f 100644 (file)
@@ -194,7 +194,6 @@ enum ice_status
 ice_cfg_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
                         enum ice_rl_type rl_type, u8 bw_alloc);
 enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes);
-void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
 void
 ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
                  u64 *prev_stat, u64 *cur_stat);
index d8cb8ee..7194cb9 100644 (file)
@@ -690,25 +690,6 @@ struct ice_switch_info {
        struct ice_sw_recipe *recp_list;
 };
 
-/* FW logging configuration */
-struct ice_fw_log_evnt {
-       u8 cfg : 4;     /* New event enables to configure */
-       u8 cur : 4;     /* Current/active event enables */
-};
-
-struct ice_fw_log_cfg {
-       u8 cq_en : 1;    /* FW logging is enabled via the control queue */
-       u8 uart_en : 1;  /* FW logging is enabled via UART for all PFs */
-       u8 actv_evnts;   /* Cumulation of currently enabled log events */
-
-#define ICE_FW_LOG_EVNT_INFO   (ICE_AQC_FW_LOG_INFO_EN >> ICE_AQC_FW_LOG_EN_S)
-#define ICE_FW_LOG_EVNT_INIT   (ICE_AQC_FW_LOG_INIT_EN >> ICE_AQC_FW_LOG_EN_S)
-#define ICE_FW_LOG_EVNT_FLOW   (ICE_AQC_FW_LOG_FLOW_EN >> ICE_AQC_FW_LOG_EN_S)
-#define ICE_FW_LOG_EVNT_ERR    (ICE_AQC_FW_LOG_ERR_EN >> ICE_AQC_FW_LOG_EN_S)
-#define ICE_FW_LOG_EVNT_ALL    (ICE_FW_LOG_EVNT_INFO | ICE_FW_LOG_EVNT_INIT | \
-                                ICE_FW_LOG_EVNT_FLOW | ICE_FW_LOG_EVNT_ERR)
-       struct ice_fw_log_evnt evnts[ICE_AQC_FW_LOG_ID_MAX];
-};
 
 /* Port hardware description */
 struct ice_hw {
@@ -767,7 +748,6 @@ struct ice_hw {
        u8 fw_patch;            /* firmware patch version */
        u32 fw_build;           /* firmware build number */
 
-       struct ice_fw_log_cfg fw_log;
 
 /* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL
  * register. Used for determining the itr/intrl granularity during