@@ -933,216 +933,6 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
933
933
devm_kfree (ice_hw_to_dev (hw ), sw );
934
934
}
935
935
936
- /**
937
- * ice_get_fw_log_cfg - get FW logging configuration
938
- * @hw: pointer to the HW struct
939
- */
940
- static int ice_get_fw_log_cfg (struct ice_hw * hw )
941
- {
942
- struct ice_aq_desc desc ;
943
- __le16 * config ;
944
- int status ;
945
- u16 size ;
946
-
947
- size = sizeof (* config ) * ICE_AQC_FW_LOG_ID_MAX ;
948
- config = kzalloc (size , GFP_KERNEL );
949
- if (!config )
950
- return - ENOMEM ;
951
-
952
- ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_fw_logging_info );
953
-
954
- status = ice_aq_send_cmd (hw , & desc , config , size , NULL );
955
- if (!status ) {
956
- u16 i ;
957
-
958
- /* Save FW logging information into the HW structure */
959
- for (i = 0 ; i < ICE_AQC_FW_LOG_ID_MAX ; i ++ ) {
960
- u16 v , m , flgs ;
961
-
962
- v = le16_to_cpu (config [i ]);
963
- m = (v & ICE_AQC_FW_LOG_ID_M ) >> ICE_AQC_FW_LOG_ID_S ;
964
- flgs = (v & ICE_AQC_FW_LOG_EN_M ) >> ICE_AQC_FW_LOG_EN_S ;
965
-
966
- if (m < ICE_AQC_FW_LOG_ID_MAX )
967
- hw -> fw_log .evnts [m ].cur = flgs ;
968
- }
969
- }
970
-
971
- kfree (config );
972
-
973
- return status ;
974
- }
975
-
976
- /**
977
- * ice_cfg_fw_log - configure FW logging
978
- * @hw: pointer to the HW struct
979
- * @enable: enable certain FW logging events if true, disable all if false
980
- *
981
- * This function enables/disables the FW logging via Rx CQ events and a UART
982
- * port based on predetermined configurations. FW logging via the Rx CQ can be
983
- * enabled/disabled for individual PF's. However, FW logging via the UART can
984
- * only be enabled/disabled for all PFs on the same device.
985
- *
986
- * To enable overall FW logging, the "cq_en" and "uart_en" enable bits in
987
- * hw->fw_log need to be set accordingly, e.g. based on user-provided input,
988
- * before initializing the device.
989
- *
990
- * When re/configuring FW logging, callers need to update the "cfg" elements of
991
- * the hw->fw_log.evnts array with the desired logging event configurations for
992
- * modules of interest. When disabling FW logging completely, the callers can
993
- * just pass false in the "enable" parameter. On completion, the function will
994
- * update the "cur" element of the hw->fw_log.evnts array with the resulting
995
- * logging event configurations of the modules that are being re/configured. FW
996
- * logging modules that are not part of a reconfiguration operation retain their
997
- * previous states.
998
- *
999
- * Before resetting the device, it is recommended that the driver disables FW
1000
- * logging before shutting down the control queue. When disabling FW logging
1001
- * ("enable" = false), the latest configurations of FW logging events stored in
1002
- * hw->fw_log.evnts[] are not overridden to allow them to be reconfigured after
1003
- * a device reset.
1004
- *
1005
- * When enabling FW logging to emit log messages via the Rx CQ during the
1006
- * device's initialization phase, a mechanism alternative to interrupt handlers
1007
- * needs to be used to extract FW log messages from the Rx CQ periodically and
1008
- * to prevent the Rx CQ from being full and stalling other types of control
1009
- * messages from FW to SW. Interrupts are typically disabled during the device's
1010
- * initialization phase.
1011
- */
1012
- static int ice_cfg_fw_log (struct ice_hw * hw , bool enable )
1013
- {
1014
- struct ice_aqc_fw_logging * cmd ;
1015
- u16 i , chgs = 0 , len = 0 ;
1016
- struct ice_aq_desc desc ;
1017
- __le16 * data = NULL ;
1018
- u8 actv_evnts = 0 ;
1019
- void * buf = NULL ;
1020
- int status = 0 ;
1021
-
1022
- if (!hw -> fw_log .cq_en && !hw -> fw_log .uart_en )
1023
- return 0 ;
1024
-
1025
- /* Disable FW logging only when the control queue is still responsive */
1026
- if (!enable &&
1027
- (!hw -> fw_log .actv_evnts || !ice_check_sq_alive (hw , & hw -> adminq )))
1028
- return 0 ;
1029
-
1030
- /* Get current FW log settings */
1031
- status = ice_get_fw_log_cfg (hw );
1032
- if (status )
1033
- return status ;
1034
-
1035
- ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_fw_logging );
1036
- cmd = & desc .params .fw_logging ;
1037
-
1038
- /* Indicate which controls are valid */
1039
- if (hw -> fw_log .cq_en )
1040
- cmd -> log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID ;
1041
-
1042
- if (hw -> fw_log .uart_en )
1043
- cmd -> log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID ;
1044
-
1045
- if (enable ) {
1046
- /* Fill in an array of entries with FW logging modules and
1047
- * logging events being reconfigured.
1048
- */
1049
- for (i = 0 ; i < ICE_AQC_FW_LOG_ID_MAX ; i ++ ) {
1050
- u16 val ;
1051
-
1052
- /* Keep track of enabled event types */
1053
- actv_evnts |= hw -> fw_log .evnts [i ].cfg ;
1054
-
1055
- if (hw -> fw_log .evnts [i ].cfg == hw -> fw_log .evnts [i ].cur )
1056
- continue ;
1057
-
1058
- if (!data ) {
1059
- data = devm_kcalloc (ice_hw_to_dev (hw ),
1060
- ICE_AQC_FW_LOG_ID_MAX ,
1061
- sizeof (* data ),
1062
- GFP_KERNEL );
1063
- if (!data )
1064
- return - ENOMEM ;
1065
- }
1066
-
1067
- val = i << ICE_AQC_FW_LOG_ID_S ;
1068
- val |= hw -> fw_log .evnts [i ].cfg << ICE_AQC_FW_LOG_EN_S ;
1069
- data [chgs ++ ] = cpu_to_le16 (val );
1070
- }
1071
-
1072
- /* Only enable FW logging if at least one module is specified.
1073
- * If FW logging is currently enabled but all modules are not
1074
- * enabled to emit log messages, disable FW logging altogether.
1075
- */
1076
- if (actv_evnts ) {
1077
- /* Leave if there is effectively no change */
1078
- if (!chgs )
1079
- goto out ;
1080
-
1081
- if (hw -> fw_log .cq_en )
1082
- cmd -> log_ctrl |= ICE_AQC_FW_LOG_AQ_EN ;
1083
-
1084
- if (hw -> fw_log .uart_en )
1085
- cmd -> log_ctrl |= ICE_AQC_FW_LOG_UART_EN ;
1086
-
1087
- buf = data ;
1088
- len = sizeof (* data ) * chgs ;
1089
- desc .flags |= cpu_to_le16 (ICE_AQ_FLAG_RD );
1090
- }
1091
- }
1092
-
1093
- status = ice_aq_send_cmd (hw , & desc , buf , len , NULL );
1094
- if (!status ) {
1095
- /* Update the current configuration to reflect events enabled.
1096
- * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW
1097
- * logging mode is enabled for the device. They do not reflect
1098
- * actual modules being enabled to emit log messages. So, their
1099
- * values remain unchanged even when all modules are disabled.
1100
- */
1101
- u16 cnt = enable ? chgs : (u16 )ICE_AQC_FW_LOG_ID_MAX ;
1102
-
1103
- hw -> fw_log .actv_evnts = actv_evnts ;
1104
- for (i = 0 ; i < cnt ; i ++ ) {
1105
- u16 v , m ;
1106
-
1107
- if (!enable ) {
1108
- /* When disabling all FW logging events as part
1109
- * of device's de-initialization, the original
1110
- * configurations are retained, and can be used
1111
- * to reconfigure FW logging later if the device
1112
- * is re-initialized.
1113
- */
1114
- hw -> fw_log .evnts [i ].cur = 0 ;
1115
- continue ;
1116
- }
1117
-
1118
- v = le16_to_cpu (data [i ]);
1119
- m = (v & ICE_AQC_FW_LOG_ID_M ) >> ICE_AQC_FW_LOG_ID_S ;
1120
- hw -> fw_log .evnts [m ].cur = hw -> fw_log .evnts [m ].cfg ;
1121
- }
1122
- }
1123
-
1124
- out :
1125
- devm_kfree (ice_hw_to_dev (hw ), data );
1126
-
1127
- return status ;
1128
- }
1129
-
1130
- /**
1131
- * ice_output_fw_log
1132
- * @hw: pointer to the HW struct
1133
- * @desc: pointer to the AQ message descriptor
1134
- * @buf: pointer to the buffer accompanying the AQ message
1135
- *
1136
- * Formats a FW Log message and outputs it via the standard driver logs.
1137
- */
1138
- void ice_output_fw_log (struct ice_hw * hw , struct ice_aq_desc * desc , void * buf )
1139
- {
1140
- ice_debug (hw , ICE_DBG_FW_LOG , "[ FW Log Msg Start ]\n" );
1141
- ice_debug_array (hw , ICE_DBG_FW_LOG , 16 , 1 , (u8 * )buf ,
1142
- le16_to_cpu (desc -> datalen ));
1143
- ice_debug (hw , ICE_DBG_FW_LOG , "[ FW Log Msg End ]\n" );
1144
- }
1145
-
1146
936
/**
1147
937
* ice_get_itr_intrl_gran
1148
938
* @hw: pointer to the HW struct
@@ -1200,11 +990,6 @@ int ice_init_hw(struct ice_hw *hw)
1200
990
if (status )
1201
991
goto err_unroll_cqinit ;
1202
992
1203
- /* Enable FW logging. Not fatal if this fails. */
1204
- status = ice_cfg_fw_log (hw , true);
1205
- if (status )
1206
- ice_debug (hw , ICE_DBG_INIT , "Failed to enable FW logging.\n" );
1207
-
1208
993
status = ice_clear_pf_cfg (hw );
1209
994
if (status )
1210
995
goto err_unroll_cqinit ;
@@ -1354,8 +1139,6 @@ void ice_deinit_hw(struct ice_hw *hw)
1354
1139
ice_free_hw_tbls (hw );
1355
1140
mutex_destroy (& hw -> tnl_lock );
1356
1141
1357
- /* Attempt to disable FW logging before shutting down control queues */
1358
- ice_cfg_fw_log (hw , false);
1359
1142
ice_destroy_all_ctrlq (hw );
1360
1143
1361
1144
/* Clear VSI contexts if not already cleared */
0 commit comments