Merge branch 'for-linus' into for-next
[linux-2.6-microblaze.git] / drivers / staging / wfx / hif_api_mib.h
1 /* SPDX-License-Identifier: Apache-2.0 */
2 /*
3  * WFx hardware interface definitions
4  *
5  * Copyright (c) 2018-2019, Silicon Laboratories Inc.
6  */
7
8 #ifndef WFX_HIF_API_MIB_H
9 #define WFX_HIF_API_MIB_H
10
11 #include "hif_api_general.h"
12
13 #define HIF_API_IPV4_ADDRESS_SIZE                       4
14 #define HIF_API_IPV6_ADDRESS_SIZE                       16
15
16 enum hif_mib_ids {
17         HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE       = 0x2000,
18         HIF_MIB_ID_GL_BLOCK_ACK_INFO               = 0x2001,
19         HIF_MIB_ID_GL_SET_MULTI_MSG                = 0x2002,
20         HIF_MIB_ID_CCA_CONFIG                      = 0x2003,
21         HIF_MIB_ID_ETHERTYPE_DATAFRAME_CONDITION   = 0x2010,
22         HIF_MIB_ID_PORT_DATAFRAME_CONDITION        = 0x2011,
23         HIF_MIB_ID_MAGIC_DATAFRAME_CONDITION       = 0x2012,
24         HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION    = 0x2013,
25         HIF_MIB_ID_IPV4_ADDR_DATAFRAME_CONDITION   = 0x2014,
26         HIF_MIB_ID_IPV6_ADDR_DATAFRAME_CONDITION   = 0x2015,
27         HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION    = 0x2016,
28         HIF_MIB_ID_CONFIG_DATA_FILTER              = 0x2017,
29         HIF_MIB_ID_SET_DATA_FILTERING              = 0x2018,
30         HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE          = 0x2019,
31         HIF_MIB_ID_NS_IP_ADDRESSES_TABLE           = 0x201A,
32         HIF_MIB_ID_RX_FILTER                       = 0x201B,
33         HIF_MIB_ID_BEACON_FILTER_TABLE             = 0x201C,
34         HIF_MIB_ID_BEACON_FILTER_ENABLE            = 0x201D,
35         HIF_MIB_ID_GRP_SEQ_COUNTER                 = 0x2030,
36         HIF_MIB_ID_TSF_COUNTER                     = 0x2031,
37         HIF_MIB_ID_STATISTICS_TABLE                = 0x2032,
38         HIF_MIB_ID_COUNTERS_TABLE                  = 0x2033,
39         HIF_MIB_ID_MAX_TX_POWER_LEVEL              = 0x2034,
40         HIF_MIB_ID_EXTENDED_COUNTERS_TABLE         = 0x2035,
41         HIF_MIB_ID_DOT11_MAC_ADDRESS               = 0x2040,
42         HIF_MIB_ID_DOT11_MAX_TRANSMIT_MSDU_LIFETIME = 0x2041,
43         HIF_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME      = 0x2042,
44         HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID        = 0x2043,
45         HIF_MIB_ID_DOT11_RTS_THRESHOLD             = 0x2044,
46         HIF_MIB_ID_SLOT_TIME                       = 0x2045,
47         HIF_MIB_ID_CURRENT_TX_POWER_LEVEL          = 0x2046,
48         HIF_MIB_ID_NON_ERP_PROTECTION              = 0x2047,
49         HIF_MIB_ID_TEMPLATE_FRAME                  = 0x2048,
50         HIF_MIB_ID_BEACON_WAKEUP_PERIOD            = 0x2049,
51         HIF_MIB_ID_RCPI_RSSI_THRESHOLD             = 0x204A,
52         HIF_MIB_ID_BLOCK_ACK_POLICY                = 0x204B,
53         HIF_MIB_ID_OVERRIDE_INTERNAL_TX_RATE       = 0x204C,
54         HIF_MIB_ID_SET_ASSOCIATION_MODE            = 0x204D,
55         HIF_MIB_ID_SET_UAPSD_INFORMATION           = 0x204E,
56         HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY        = 0x204F,
57         HIF_MIB_ID_PROTECTED_MGMT_POLICY           = 0x2050,
58         HIF_MIB_ID_SET_HT_PROTECTION               = 0x2051,
59         HIF_MIB_ID_KEEP_ALIVE_PERIOD               = 0x2052,
60         HIF_MIB_ID_ARP_KEEP_ALIVE_PERIOD           = 0x2053,
61         HIF_MIB_ID_INACTIVITY_TIMER                = 0x2054,
62         HIF_MIB_ID_INTERFACE_PROTECTION            = 0x2055,
63         HIF_MIB_ID_BEACON_STATS                    = 0x2056,
64 };
65
66 #define HIF_OP_POWER_MODE_MASK                     0xf
67
68 enum hif_op_power_mode {
69         HIF_OP_POWER_MODE_ACTIVE                   = 0x0,
70         HIF_OP_POWER_MODE_DOZE                     = 0x1,
71         HIF_OP_POWER_MODE_QUIESCENT                = 0x2
72 };
73
74 struct hif_mib_gl_operational_power_mode {
75         u8    power_mode:4;
76         u8    reserved1:3;
77         u8    wup_ind_activation:1;
78         u8    reserved2[3];
79 } __packed;
80
81 struct hif_mib_gl_block_ack_info {
82         u8    rx_buffer_size;
83         u8    rx_max_num_agreements;
84         u8    tx_buffer_size;
85         u8    tx_max_num_agreements;
86 } __packed;
87
88 struct hif_mib_gl_set_multi_msg {
89         u8    enable_multi_tx_conf:1;
90         u8    reserved1:7;
91         u8    reserved2[3];
92 } __packed;
93
94 enum hif_cca_thr_mode {
95         HIF_CCA_THR_MODE_RELATIVE = 0x0,
96         HIF_CCA_THR_MODE_ABSOLUTE = 0x1
97 };
98
99 struct hif_mib_gl_cca_config {
100         u8  cca_thr_mode;
101         u8  reserved[3];
102 } __packed;
103
104 #define MAX_NUMBER_DATA_FILTERS             0xA
105
106 #define MAX_NUMBER_IPV4_ADDR_CONDITIONS     0x4
107 #define MAX_NUMBER_IPV6_ADDR_CONDITIONS     0x4
108 #define MAX_NUMBER_MAC_ADDR_CONDITIONS      0x4
109 #define MAX_NUMBER_UC_MC_BC_CONDITIONS      0x4
110 #define MAX_NUMBER_ETHER_TYPE_CONDITIONS    0x4
111 #define MAX_NUMBER_PORT_CONDITIONS          0x4
112 #define MAX_NUMBER_MAGIC_CONDITIONS         0x4
113 #define MAX_NUMBER_ARP_CONDITIONS           0x2
114 #define MAX_NUMBER_NS_CONDITIONS            0x2
115
116 struct hif_mib_ethertype_data_frame_condition {
117         u8    condition_idx;
118         u8    reserved;
119         u16   ether_type;
120 } __packed;
121
122 enum hif_udp_tcp_protocol {
123         HIF_PROTOCOL_UDP                       = 0x0,
124         HIF_PROTOCOL_TCP                       = 0x1,
125         HIF_PROTOCOL_BOTH_UDP_TCP              = 0x2
126 };
127
128 enum hif_which_port {
129         HIF_PORT_DST                           = 0x0,
130         HIF_PORT_SRC                           = 0x1,
131         HIF_PORT_SRC_OR_DST                    = 0x2
132 };
133
134 struct hif_mib_ports_data_frame_condition {
135         u8    condition_idx;
136         u8    protocol;
137         u8    which_port;
138         u8    reserved1;
139         u16   port_number;
140         u8    reserved2[2];
141 } __packed;
142
143 #define HIF_API_MAGIC_PATTERN_SIZE                 32
144
145 struct hif_mib_magic_data_frame_condition {
146         u8    condition_idx;
147         u8    offset;
148         u8    magic_pattern_length;
149         u8    reserved;
150         u8    magic_pattern[HIF_API_MAGIC_PATTERN_SIZE];
151 } __packed;
152
153 enum hif_mac_addr_type {
154         HIF_MAC_ADDR_A1                            = 0x0,
155         HIF_MAC_ADDR_A2                            = 0x1,
156         HIF_MAC_ADDR_A3                            = 0x2
157 };
158
159 struct hif_mib_mac_addr_data_frame_condition {
160         u8    condition_idx;
161         u8    address_type;
162         u8    mac_address[ETH_ALEN];
163 } __packed;
164
165 enum hif_ip_addr_mode {
166         HIF_IP_ADDR_SRC                            = 0x0,
167         HIF_IP_ADDR_DST                            = 0x1
168 };
169
170 struct hif_mib_ipv4_addr_data_frame_condition {
171         u8    condition_idx;
172         u8    address_mode;
173         u8    reserved[2];
174         u8    i_pv4_address[HIF_API_IPV4_ADDRESS_SIZE];
175 } __packed;
176
177 struct hif_mib_ipv6_addr_data_frame_condition {
178         u8    condition_idx;
179         u8    address_mode;
180         u8    reserved[2];
181         u8    i_pv6_address[HIF_API_IPV6_ADDRESS_SIZE];
182 } __packed;
183
184 union hif_addr_type {
185         u8 value;
186         struct {
187                 u8    type_unicast:1;
188                 u8    type_multicast:1;
189                 u8    type_broadcast:1;
190                 u8    reserved:5;
191         } bits;
192 };
193
194 struct hif_mib_uc_mc_bc_data_frame_condition {
195         u8    condition_idx;
196         union hif_addr_type param;
197         u8    reserved[2];
198 } __packed;
199
200 struct hif_mib_config_data_filter {
201         u8    filter_idx;
202         u8    enable;
203         u8    reserved1[2];
204         u8    eth_type_cond;
205         u8    port_cond;
206         u8    magic_cond;
207         u8    mac_cond;
208         u8    ipv4_cond;
209         u8    ipv6_cond;
210         u8    uc_mc_bc_cond;
211         u8    reserved2;
212 } __packed;
213
214 struct hif_mib_set_data_filtering {
215         u8    default_filter;
216         u8    enable;
217         u8    reserved[2];
218 } __packed;
219
220 enum hif_arp_ns_frame_treatment {
221         HIF_ARP_NS_FILTERING_DISABLE                  = 0x0,
222         HIF_ARP_NS_FILTERING_ENABLE                   = 0x1,
223         HIF_ARP_NS_REPLY_ENABLE                       = 0x2
224 };
225
226 struct hif_mib_arp_ip_addr_table {
227         u8    condition_idx;
228         u8    arp_enable;
229         u8    reserved[2];
230         u8    ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
231 } __packed;
232
233 struct hif_mib_ns_ip_addr_table {
234         u8    condition_idx;
235         u8    ns_enable;
236         u8    reserved[2];
237         u8    ipv6_address[HIF_API_IPV6_ADDRESS_SIZE];
238 } __packed;
239
240 struct hif_mib_rx_filter {
241         u8    reserved1:1;
242         u8    bssid_filter:1;
243         u8    reserved2:1;
244         u8    fwd_probe_req:1;
245         u8    keep_alive_filter:1;
246         u8    reserved3:3;
247         u8    reserved4[3];
248 } __packed;
249
250 #define HIF_API_OUI_SIZE                                3
251 #define HIF_API_MATCH_DATA_SIZE                         3
252
253 struct hif_ie_table_entry {
254         u8    ie_id;
255         u8    has_changed:1;
256         u8    no_longer:1;
257         u8    has_appeared:1;
258         u8    reserved:1;
259         u8    num_match_data:4;
260         u8    oui[HIF_API_OUI_SIZE];
261         u8    match_data[HIF_API_MATCH_DATA_SIZE];
262 } __packed;
263
264 struct hif_mib_bcn_filter_table {
265         u32   num_of_info_elmts;
266         struct hif_ie_table_entry ie_table[];
267 } __packed;
268
269 enum hif_beacon_filter {
270         HIF_BEACON_FILTER_DISABLE                  = 0x0,
271         HIF_BEACON_FILTER_ENABLE                   = 0x1,
272         HIF_BEACON_FILTER_AUTO_ERP                 = 0x2
273 };
274
275 struct hif_mib_bcn_filter_enable {
276         u32   enable;
277         u32   bcn_count;
278 } __packed;
279
280 struct hif_mib_group_seq_counter {
281         u32   bits4716;
282         u16   bits1500;
283         u16   reserved;
284 } __packed;
285
286 struct hif_mib_tsf_counter {
287         u32   tsf_counterlo;
288         u32   tsf_counterhi;
289 } __packed;
290
291 struct hif_mib_stats_table {
292         s16    latest_snr;
293         u8    latest_rcpi;
294         s8     latest_rssi;
295 } __packed;
296
297 struct hif_mib_extended_count_table {
298         u32   count_plcp_errors;
299         u32   count_fcs_errors;
300         u32   count_tx_packets;
301         u32   count_rx_packets;
302         u32   count_rx_packet_errors;
303         u32   count_rx_decryption_failures;
304         u32   count_rx_mic_failures;
305         u32   count_rx_no_key_failures;
306         u32   count_tx_multicast_frames;
307         u32   count_tx_frames_success;
308         u32   count_tx_frame_failures;
309         u32   count_tx_frames_retried;
310         u32   count_tx_frames_multi_retried;
311         u32   count_rx_frame_duplicates;
312         u32   count_rts_success;
313         u32   count_rts_failures;
314         u32   count_ack_failures;
315         u32   count_rx_multicast_frames;
316         u32   count_rx_frames_success;
317         u32   count_rx_cmacicv_errors;
318         u32   count_rx_cmac_replays;
319         u32   count_rx_mgmt_ccmp_replays;
320         u32   count_rx_bipmic_errors;
321         u32   count_rx_beacon;
322         u32   count_miss_beacon;
323         u32   reserved[15];
324 } __packed;
325
326 struct hif_mib_count_table {
327         u32   count_plcp_errors;
328         u32   count_fcs_errors;
329         u32   count_tx_packets;
330         u32   count_rx_packets;
331         u32   count_rx_packet_errors;
332         u32   count_rx_decryption_failures;
333         u32   count_rx_mic_failures;
334         u32   count_rx_no_key_failures;
335         u32   count_tx_multicast_frames;
336         u32   count_tx_frames_success;
337         u32   count_tx_frame_failures;
338         u32   count_tx_frames_retried;
339         u32   count_tx_frames_multi_retried;
340         u32   count_rx_frame_duplicates;
341         u32   count_rts_success;
342         u32   count_rts_failures;
343         u32   count_ack_failures;
344         u32   count_rx_multicast_frames;
345         u32   count_rx_frames_success;
346         u32   count_rx_cmacicv_errors;
347         u32   count_rx_cmac_replays;
348         u32   count_rx_mgmt_ccmp_replays;
349         u32   count_rx_bipmic_errors;
350 } __packed;
351
352 struct hif_mib_max_tx_power_level {
353         s32       max_tx_power_level_rf_port1;
354         s32       max_tx_power_level_rf_port2;
355 } __packed;
356
357 struct hif_mib_beacon_stats {
358         s32     latest_tbtt_diff;
359         u32    reserved[4];
360 } __packed;
361
362 struct hif_mib_mac_address {
363         u8    mac_addr[ETH_ALEN];
364         u16   reserved;
365 } __packed;
366
367 struct hif_mib_dot11_max_transmit_msdu_lifetime {
368         u32   max_life_time;
369 } __packed;
370
371 struct hif_mib_dot11_max_receive_lifetime {
372         u32   max_life_time;
373 } __packed;
374
375 struct hif_mib_wep_default_key_id {
376         u8    wep_default_key_id;
377         u8    reserved[3];
378 } __packed;
379
380 struct hif_mib_dot11_rts_threshold {
381         u32   threshold;
382 } __packed;
383
384 struct hif_mib_slot_time {
385         u32   slot_time;
386 } __packed;
387
388 struct hif_mib_current_tx_power_level {
389         s32   power_level;
390 } __packed;
391
392 struct hif_mib_non_erp_protection {
393         u8   use_cts_to_self:1;
394         u8   reserved1:7;
395         u8   reserved2[3];
396 } __packed;
397
398 enum hif_tx_mode {
399         HIF_TX_MODE_MIXED                        = 0x0,
400         HIF_TX_MODE_GREENFIELD                   = 0x1
401 };
402
403 enum hif_tmplt {
404         HIF_TMPLT_PRBREQ                           = 0x0,
405         HIF_TMPLT_BCN                              = 0x1,
406         HIF_TMPLT_NULL                             = 0x2,
407         HIF_TMPLT_QOSNUL                           = 0x3,
408         HIF_TMPLT_PSPOLL                           = 0x4,
409         HIF_TMPLT_PRBRES                           = 0x5,
410         HIF_TMPLT_ARP                              = 0x6,
411         HIF_TMPLT_NA                               = 0x7
412 };
413
414 #define HIF_API_MAX_TEMPLATE_FRAME_SIZE                              700
415
416 struct hif_mib_template_frame {
417         u8    frame_type;
418         u8    init_rate:7;
419         u8    mode:1;
420         u16   frame_length;
421         u8    frame[HIF_API_MAX_TEMPLATE_FRAME_SIZE];
422 } __packed;
423
424 struct hif_mib_beacon_wake_up_period {
425         u8    wakeup_period_min;
426         u8    receive_dtim:1;
427         u8    reserved1:7;
428         u8    wakeup_period_max;
429         u8    reserved2;
430 } __packed;
431
432 struct hif_mib_rcpi_rssi_threshold {
433         u8    detection:1;
434         u8    rcpi_rssi:1;
435         u8    upperthresh:1;
436         u8    lowerthresh:1;
437         u8    reserved:4;
438         u8    lower_threshold;
439         u8    upper_threshold;
440         u8    rolling_average_count;
441 } __packed;
442
443 #define DEFAULT_BA_MAX_RX_BUFFER_SIZE 16
444
445 struct hif_mib_block_ack_policy {
446         u8    block_ack_tx_tid_policy;
447         u8    reserved1;
448         u8    block_ack_rx_tid_policy;
449         u8    block_ack_rx_max_buffer_size;
450 } __packed;
451
452 struct hif_mib_override_int_rate {
453         u8    internal_tx_rate;
454         u8    non_erp_internal_tx_rate;
455         u8    reserved[2];
456 } __packed;
457
458 enum hif_mpdu_start_spacing {
459         HIF_MPDU_START_SPACING_NO_RESTRIC          = 0x0,
460         HIF_MPDU_START_SPACING_QUARTER             = 0x1,
461         HIF_MPDU_START_SPACING_HALF                = 0x2,
462         HIF_MPDU_START_SPACING_ONE                 = 0x3,
463         HIF_MPDU_START_SPACING_TWO                 = 0x4,
464         HIF_MPDU_START_SPACING_FOUR                = 0x5,
465         HIF_MPDU_START_SPACING_EIGHT               = 0x6,
466         HIF_MPDU_START_SPACING_SIXTEEN             = 0x7
467 };
468
469 struct hif_mib_set_association_mode {
470         u8    preambtype_use:1;
471         u8    mode:1;
472         u8    rateset:1;
473         u8    spacing:1;
474         u8    reserved:4;
475         u8    preamble_type;
476         u8    mixed_or_greenfield_type;
477         u8    mpdu_start_spacing;
478         u32   basic_rate_set;
479 } __packed;
480
481 struct hif_mib_set_uapsd_information {
482         u8    trig_bckgrnd:1;
483         u8    trig_be:1;
484         u8    trig_video:1;
485         u8    trig_voice:1;
486         u8    reserved1:4;
487         u8    deliv_bckgrnd:1;
488         u8    deliv_be:1;
489         u8    deliv_video:1;
490         u8    deliv_voice:1;
491         u8    reserved2:4;
492         u16   min_auto_trigger_interval;
493         u16   max_auto_trigger_interval;
494         u16   auto_trigger_step;
495 } __packed;
496
497 struct hif_mib_tx_rate_retry_policy {
498         u8    policy_index;
499         u8    short_retry_count;
500         u8    long_retry_count;
501         u8    first_rate_sel:2;
502         u8    terminate:1;
503         u8    count_init:1;
504         u8    reserved1:4;
505         u8    rate_recovery_count;
506         u8    reserved2[3];
507         u8    rates[12];
508 } __packed;
509
510 #define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES    15
511
512 struct hif_mib_set_tx_rate_retry_policy {
513         u8    num_tx_rate_policies;
514         u8    reserved[3];
515         struct hif_mib_tx_rate_retry_policy tx_rate_retry_policy[];
516 } __packed;
517
518 struct hif_mib_protected_mgmt_policy {
519         u8   pmf_enable:1;
520         u8   unpmf_allowed:1;
521         u8   host_enc_auth_frames:1;
522         u8   reserved1:5;
523         u8   reserved2[3];
524 } __packed;
525
526 struct hif_mib_set_ht_protection {
527         u8   dual_cts_prot:1;
528         u8   reserved1:7;
529         u8   reserved2[3];
530 } __packed;
531
532 struct hif_mib_keep_alive_period {
533         u16   keep_alive_period;
534         u8    reserved[2];
535 } __packed;
536
537 struct hif_mib_arp_keep_alive_period {
538         u16   arp_keep_alive_period;
539         u8    encr_type;
540         u8    reserved;
541         u8    sender_ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
542         u8    target_ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
543 } __packed;
544
545 struct hif_mib_inactivity_timer {
546         u8    min_active_time;
547         u8    max_active_time;
548         u16   reserved;
549 } __packed;
550
551 struct hif_mib_interface_protection {
552         u8   use_cts_prot:1;
553         u8   reserved1:7;
554         u8   reserved2[3];
555 } __packed;
556
557 #endif