staging: wfx: fix endianness of hif API

The chip expects little endian in all structs it sends/receives. This
patch fixes the hif API to reflect this fact. Sparse should now report
meaningful errors.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200406111756.154086-7-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jérôme Pouiller 2020-04-06 13:17:51 +02:00 committed by Greg Kroah-Hartman
parent a3d9682886
commit 31db18cccc
3 changed files with 150 additions and 150 deletions

View File

@ -94,25 +94,25 @@ struct hif_req_reset {
} __packed;
struct hif_req_read_mib {
u16 mib_id;
u16 reserved;
__le16 mib_id;
__le16 reserved;
} __packed;
struct hif_cnf_read_mib {
u32 status;
u16 mib_id;
u16 length;
__le32 status;
__le16 mib_id;
__le16 length;
u8 mib_data[];
} __packed;
struct hif_req_write_mib {
u16 mib_id;
u16 length;
__le16 mib_id;
__le16 length;
u8 mib_data[];
} __packed;
struct hif_cnf_write_mib {
u32 status;
__le32 status;
} __packed;
struct hif_ie_flags {
@ -131,12 +131,12 @@ struct hif_ie_tlv {
struct hif_req_update_ie {
struct hif_ie_flags ie_flags;
u16 num_ies;
__le16 num_ies;
struct hif_ie_tlv ie[];
} __packed;
struct hif_cnf_update_ie {
u32 status;
__le32 status;
} __packed;
struct hif_scan_type {
@ -153,13 +153,13 @@ struct hif_scan_flags {
} __packed;
struct hif_auto_scan_param {
u16 interval;
__le16 interval;
u8 reserved;
s8 rssi_thr;
} __packed;
struct hif_ssid_def {
u32 ssid_length;
__le32 ssid_length;
u8 ssid[HIF_API_SSID_SIZE];
} __packed;
@ -176,19 +176,19 @@ struct hif_req_start_scan_alt {
u8 probe_delay;
u8 num_of_ssids;
u8 num_of_channels;
u32 min_channel_time;
u32 max_channel_time;
s32 tx_power_level;
__le32 min_channel_time;
__le32 max_channel_time;
__le32 tx_power_level; // signed value
struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS];
u8 channel_list[];
} __packed;
struct hif_cnf_start_scan {
u32 status;
__le32 status;
} __packed;
struct hif_cnf_stop_scan {
u32 status;
__le32 status;
} __packed;
enum hif_pm_mode_status {
@ -198,10 +198,10 @@ enum hif_pm_mode_status {
};
struct hif_ind_scan_cmpl {
u32 status;
__le32 status;
u8 pm_mode;
u8 num_channels_completed;
u16 reserved;
__le16 reserved;
} __packed;
enum hif_queue_id {
@ -254,13 +254,13 @@ struct hif_ht_tx_parameters {
} __packed;
struct hif_req_tx {
u32 packet_id;
__le32 packet_id;
u8 max_tx_rate;
struct hif_queue queue_id;
struct hif_data_flags data_flags;
struct hif_tx_flags tx_flags;
u32 reserved;
u32 expire_time;
__le32 reserved;
__le32 expire_time;
struct hif_ht_tx_parameters ht_tx_parameters;
u8 frame[];
} __packed;
@ -282,17 +282,17 @@ struct hif_tx_result_flags {
} __packed;
struct hif_cnf_tx {
u32 status;
u32 packet_id;
__le32 status;
__le32 packet_id;
u8 txed_rate;
u8 ack_failures;
struct hif_tx_result_flags tx_result_flags;
u32 media_delay;
u32 tx_queue_delay;
__le32 media_delay;
__le32 tx_queue_delay;
} __packed;
struct hif_cnf_multi_transmit {
u32 num_tx_confs;
__le32 num_tx_confs;
struct hif_cnf_tx tx_conf_payload[];
} __packed;
@ -331,8 +331,8 @@ struct hif_rx_flags {
} __packed;
struct hif_ind_rx {
u32 status;
u16 channel_number;
__le32 status;
__le16 channel_number;
u8 rxed_rate;
u8 rcpi_rssi;
struct hif_rx_flags rx_flags;
@ -345,15 +345,15 @@ struct hif_req_edca_queue_params {
u8 reserved1;
u8 aifsn;
u8 reserved2;
u16 cw_min;
u16 cw_max;
u16 tx_op_limit;
u16 allowed_medium_time;
u32 reserved3;
__le16 cw_min;
__le16 cw_max;
__le16 tx_op_limit;
__le16 allowed_medium_time;
__le32 reserved3;
} __packed;
struct hif_cnf_edca_queue_params {
u32 status;
__le32 status;
} __packed;
struct hif_join_flags {
@ -367,26 +367,26 @@ struct hif_req_join {
u8 infrastructure_bss_mode:1;
u8 reserved1:7;
u8 band;
u16 channel_number;
__le16 channel_number;
u8 bssid[ETH_ALEN];
u16 atim_window;
__le16 atim_window;
u8 short_preamble:1;
u8 reserved2:7;
u8 probe_for_join;
u8 reserved3;
struct hif_join_flags join_flags;
u32 ssid_length;
__le32 ssid_length;
u8 ssid[HIF_API_SSID_SIZE];
u32 beacon_interval;
u32 basic_rate_set;
__le32 beacon_interval;
__le32 basic_rate_set;
} __packed;
struct hif_cnf_join {
u32 status;
__le32 status;
} __packed;
struct hif_ind_join_complete {
u32 status;
__le32 status;
} __packed;
struct hif_bss_flags {
@ -397,12 +397,12 @@ struct hif_bss_flags {
struct hif_req_set_bss_params {
struct hif_bss_flags bss_flags;
u8 beacon_lost_count;
u16 aid;
u32 operational_rate_set;
__le16 aid;
__le32 operational_rate_set;
} __packed;
struct hif_cnf_set_bss_params {
u32 status;
__le32 status;
} __packed;
struct hif_pm_mode {
@ -419,11 +419,11 @@ struct hif_req_set_pm_mode {
} __packed;
struct hif_cnf_set_pm_mode {
u32 status;
__le32 status;
} __packed;
struct hif_ind_set_pm_mode_cmpl {
u32 status;
__le32 status;
u8 pm_mode;
u8 reserved[3];
} __packed;
@ -432,20 +432,20 @@ struct hif_ind_set_pm_mode_cmpl {
struct hif_req_start {
u8 mode;
u8 band;
u16 channel_number;
u32 reserved1;
u32 beacon_interval;
__le16 channel_number;
__le32 reserved1;
__le32 beacon_interval;
u8 dtim_period;
u8 short_preamble:1;
u8 reserved2:7;
u8 reserved3;
u8 ssid_length;
u8 ssid[HIF_API_SSID_SIZE];
u32 basic_rate_set;
__le32 basic_rate_set;
} __packed;
struct hif_cnf_start {
u32 status;
__le32 status;
} __packed;
enum hif_beacon {
@ -459,7 +459,7 @@ struct hif_req_beacon_transmit {
} __packed;
struct hif_cnf_beacon_transmit {
u32 status;
__le32 status;
} __packed;
#define HIF_LINK_ID_MAX 14
@ -483,7 +483,7 @@ struct hif_req_map_link {
} __packed;
struct hif_cnf_map_link {
u32 status;
__le32 status;
} __packed;
struct hif_suspend_resume_flags {
@ -496,7 +496,7 @@ struct hif_suspend_resume_flags {
struct hif_ind_suspend_resume_tx {
struct hif_suspend_resume_flags suspend_resume_flags;
u16 peer_sta_set;
__le16 peer_sta_set;
} __packed;
@ -612,7 +612,7 @@ struct hif_req_add_key {
} __packed;
struct hif_cnf_add_key {
u32 status;
__le32 status;
} __packed;
struct hif_req_remove_key {
@ -621,7 +621,7 @@ struct hif_req_remove_key {
} __packed;
struct hif_cnf_remove_key {
u32 status;
__le32 status;
} __packed;
enum hif_event_ind {
@ -642,12 +642,12 @@ enum hif_ps_mode_error {
union hif_event_data {
u8 rcpi_rssi;
u32 ps_mode_error;
u32 peer_sta_set;
__le32 ps_mode_error;
__le32 peer_sta_set;
};
struct hif_ind_event {
u32 event_id;
__le32 event_id;
union hif_event_data event_data;
} __packed;

View File

@ -23,7 +23,7 @@
#define HIF_COUNTER_MAX 7
struct hif_msg {
u16 len;
__le16 len;
u8 id;
u8 reserved:1;
u8 interface:2;
@ -136,12 +136,12 @@ struct hif_otp_phy_info {
} __packed;
struct hif_ind_startup {
u32 status;
u16 hardware_id;
__le32 status;
__le16 hardware_id;
u8 opn[14];
u8 uid[8];
u16 num_inp_ch_bufs;
u16 size_inp_ch_buf;
__le16 num_inp_ch_bufs;
__le16 size_inp_ch_buf;
u8 num_links_ap;
u8 num_interfaces;
u8 mac_addr[2][ETH_ALEN];
@ -155,7 +155,7 @@ struct hif_ind_startup {
u8 disabled_channel_list[2];
struct hif_otp_regul_sel_mode_info regul_sel_mode_info;
struct hif_otp_phy_info otp_phy_info;
u32 supported_rate_mask;
__le32 supported_rate_mask;
u8 firmware_label[128];
} __packed;
@ -163,12 +163,12 @@ struct hif_ind_wakeup {
} __packed;
struct hif_req_configuration {
u16 length;
__le16 length;
u8 pds_data[];
} __packed;
struct hif_cnf_configuration {
u32 status;
__le32 status;
} __packed;
enum hif_gpio_mode {
@ -187,8 +187,8 @@ struct hif_req_control_gpio {
} __packed;
struct hif_cnf_control_gpio {
u32 status;
u32 value;
__le32 status;
__le32 value;
} __packed;
enum hif_generic_indication_type {
@ -198,17 +198,17 @@ enum hif_generic_indication_type {
};
struct hif_rx_stats {
u32 nb_rx_frame;
u32 nb_crc_frame;
u32 per_total;
u32 throughput;
u32 nb_rx_by_rate[API_RATE_NUM_ENTRIES];
u16 per[API_RATE_NUM_ENTRIES];
s16 snr[API_RATE_NUM_ENTRIES];
s16 rssi[API_RATE_NUM_ENTRIES];
s16 cfo[API_RATE_NUM_ENTRIES];
u32 date;
u32 pwr_clk_freq;
__le32 nb_rx_frame;
__le32 nb_crc_frame;
__le32 per_total;
__le32 throughput;
__le32 nb_rx_by_rate[API_RATE_NUM_ENTRIES];
__le16 per[API_RATE_NUM_ENTRIES];
__le16 snr[API_RATE_NUM_ENTRIES]; // signed value
__le16 rssi[API_RATE_NUM_ENTRIES]; // signed value
__le16 cfo[API_RATE_NUM_ENTRIES]; // signed value
__le32 date;
__le32 pwr_clk_freq;
u8 is_ext_pwr_clk;
s8 current_temp;
} __packed;
@ -219,7 +219,7 @@ union hif_indication_data {
};
struct hif_ind_generic {
u32 indication_type;
__le32 indication_type;
union hif_indication_data indication_data;
} __packed;
@ -244,7 +244,7 @@ enum hif_error {
};
struct hif_ind_error {
u32 type;
__le32 type;
u8 data[];
} __packed;
@ -269,7 +269,7 @@ struct hif_sl_msg_hdr {
struct hif_sl_msg {
struct hif_sl_msg_hdr hdr;
u16 len;
__le16 len;
u8 payload[];
} __packed;
@ -292,7 +292,7 @@ struct hif_req_set_sl_mac_key {
} __packed;
struct hif_cnf_set_sl_mac_key {
u32 status;
__le32 status;
} __packed;
enum hif_sl_session_key_alg {
@ -312,14 +312,14 @@ struct hif_req_sl_exchange_pub_keys {
} __packed;
struct hif_cnf_sl_exchange_pub_keys {
u32 status;
__le32 status;
} __packed;
#define API_NCP_PUB_KEY_SIZE 32
#define API_NCP_PUB_KEY_MAC_SIZE 64
struct hif_ind_sl_exchange_pub_keys {
u32 status;
__le32 status;
u8 ncp_pub_key[API_NCP_PUB_KEY_SIZE];
u8 ncp_pub_key_mac[API_NCP_PUB_KEY_MAC_SIZE];
} __packed;
@ -332,7 +332,7 @@ struct hif_req_sl_configure {
} __packed;
struct hif_cnf_sl_configure {
u32 status;
__le32 status;
} __packed;
#endif

View File

@ -161,7 +161,7 @@ struct hif_ie_table_entry {
} __packed;
struct hif_mib_bcn_filter_table {
u32 num_of_info_elmts;
__le32 num_of_info_elmts;
struct hif_ie_table_entry ie_table[];
} __packed;
@ -172,68 +172,68 @@ enum hif_beacon_filter {
};
struct hif_mib_bcn_filter_enable {
u32 enable;
u32 bcn_count;
__le32 enable;
__le32 bcn_count;
} __packed;
struct hif_mib_extended_count_table {
u32 count_plcp_errors;
u32 count_fcs_errors;
u32 count_tx_packets;
u32 count_rx_packets;
u32 count_rx_packet_errors;
u32 count_rx_decryption_failures;
u32 count_rx_mic_failures;
u32 count_rx_no_key_failures;
u32 count_tx_multicast_frames;
u32 count_tx_frames_success;
u32 count_tx_frame_failures;
u32 count_tx_frames_retried;
u32 count_tx_frames_multi_retried;
u32 count_rx_frame_duplicates;
u32 count_rts_success;
u32 count_rts_failures;
u32 count_ack_failures;
u32 count_rx_multicast_frames;
u32 count_rx_frames_success;
u32 count_rx_cmacicv_errors;
u32 count_rx_cmac_replays;
u32 count_rx_mgmt_ccmp_replays;
u32 count_rx_bipmic_errors;
u32 count_rx_beacon;
u32 count_miss_beacon;
u32 reserved[15];
__le32 count_plcp_errors;
__le32 count_fcs_errors;
__le32 count_tx_packets;
__le32 count_rx_packets;
__le32 count_rx_packet_errors;
__le32 count_rx_decryption_failures;
__le32 count_rx_mic_failures;
__le32 count_rx_no_key_failures;
__le32 count_tx_multicast_frames;
__le32 count_tx_frames_success;
__le32 count_tx_frame_failures;
__le32 count_tx_frames_retried;
__le32 count_tx_frames_multi_retried;
__le32 count_rx_frame_duplicates;
__le32 count_rts_success;
__le32 count_rts_failures;
__le32 count_ack_failures;
__le32 count_rx_multicast_frames;
__le32 count_rx_frames_success;
__le32 count_rx_cmacicv_errors;
__le32 count_rx_cmac_replays;
__le32 count_rx_mgmt_ccmp_replays;
__le32 count_rx_bipmic_errors;
__le32 count_rx_beacon;
__le32 count_miss_beacon;
__le32 reserved[15];
} __packed;
struct hif_mib_count_table {
u32 count_plcp_errors;
u32 count_fcs_errors;
u32 count_tx_packets;
u32 count_rx_packets;
u32 count_rx_packet_errors;
u32 count_rx_decryption_failures;
u32 count_rx_mic_failures;
u32 count_rx_no_key_failures;
u32 count_tx_multicast_frames;
u32 count_tx_frames_success;
u32 count_tx_frame_failures;
u32 count_tx_frames_retried;
u32 count_tx_frames_multi_retried;
u32 count_rx_frame_duplicates;
u32 count_rts_success;
u32 count_rts_failures;
u32 count_ack_failures;
u32 count_rx_multicast_frames;
u32 count_rx_frames_success;
u32 count_rx_cmacicv_errors;
u32 count_rx_cmac_replays;
u32 count_rx_mgmt_ccmp_replays;
u32 count_rx_bipmic_errors;
__le32 count_plcp_errors;
__le32 count_fcs_errors;
__le32 count_tx_packets;
__le32 count_rx_packets;
__le32 count_rx_packet_errors;
__le32 count_rx_decryption_failures;
__le32 count_rx_mic_failures;
__le32 count_rx_no_key_failures;
__le32 count_tx_multicast_frames;
__le32 count_tx_frames_success;
__le32 count_tx_frame_failures;
__le32 count_tx_frames_retried;
__le32 count_tx_frames_multi_retried;
__le32 count_rx_frame_duplicates;
__le32 count_rts_success;
__le32 count_rts_failures;
__le32 count_ack_failures;
__le32 count_rx_multicast_frames;
__le32 count_rx_frames_success;
__le32 count_rx_cmacicv_errors;
__le32 count_rx_cmac_replays;
__le32 count_rx_mgmt_ccmp_replays;
__le32 count_rx_bipmic_errors;
} __packed;
struct hif_mib_mac_address {
u8 mac_addr[ETH_ALEN];
u16 reserved;
__le16 reserved;
} __packed;
struct hif_mib_wep_default_key_id {
@ -242,15 +242,15 @@ struct hif_mib_wep_default_key_id {
} __packed;
struct hif_mib_dot11_rts_threshold {
u32 threshold;
__le32 threshold;
} __packed;
struct hif_mib_slot_time {
u32 slot_time;
__le32 slot_time;
} __packed;
struct hif_mib_current_tx_power_level {
s32 power_level;
__le32 power_level; // signed value
} __packed;
struct hif_mib_non_erp_protection {
@ -274,7 +274,7 @@ struct hif_mib_template_frame {
u8 frame_type;
u8 init_rate:7;
u8 mode:1;
u16 frame_length;
__le16 frame_length;
u8 frame[700];
} __packed;
@ -328,7 +328,7 @@ struct hif_mib_set_association_mode {
u8 greenfield:1;
u8 reserved3:7;
u8 mpdu_start_spacing;
u32 basic_rate_set;
__le32 basic_rate_set;
} __packed;
struct hif_mib_set_uapsd_information {
@ -342,9 +342,9 @@ struct hif_mib_set_uapsd_information {
u8 deliv_video:1;
u8 deliv_voice:1;
u8 reserved2:4;
u16 min_auto_trigger_interval;
u16 max_auto_trigger_interval;
u16 auto_trigger_step;
__le16 min_auto_trigger_interval;
__le16 max_auto_trigger_interval;
__le16 auto_trigger_step;
} __packed;
struct hif_mib_tx_rate_retry_policy {
@ -384,7 +384,7 @@ struct hif_mib_set_ht_protection {
} __packed;
struct hif_mib_keep_alive_period {
u16 keep_alive_period;
__le16 keep_alive_period;
u8 reserved[2];
} __packed;