2 * Copyright (c) 2014 Redpine Signals Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/etherdevice.h>
18 #include "rsi_debugfs.h"
21 #include "rsi_common.h"
24 static const struct ieee80211_channel rsi_2ghz_channels
[] = {
25 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2412,
26 .hw_value
= 1 }, /* Channel 1 */
27 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2417,
28 .hw_value
= 2 }, /* Channel 2 */
29 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2422,
30 .hw_value
= 3 }, /* Channel 3 */
31 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2427,
32 .hw_value
= 4 }, /* Channel 4 */
33 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2432,
34 .hw_value
= 5 }, /* Channel 5 */
35 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2437,
36 .hw_value
= 6 }, /* Channel 6 */
37 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2442,
38 .hw_value
= 7 }, /* Channel 7 */
39 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2447,
40 .hw_value
= 8 }, /* Channel 8 */
41 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2452,
42 .hw_value
= 9 }, /* Channel 9 */
43 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2457,
44 .hw_value
= 10 }, /* Channel 10 */
45 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2462,
46 .hw_value
= 11 }, /* Channel 11 */
47 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2467,
48 .hw_value
= 12 }, /* Channel 12 */
49 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2472,
50 .hw_value
= 13 }, /* Channel 13 */
51 { .band
= NL80211_BAND_2GHZ
, .center_freq
= 2484,
52 .hw_value
= 14 }, /* Channel 14 */
55 static const struct ieee80211_channel rsi_5ghz_channels
[] = {
56 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5180,
57 .hw_value
= 36, }, /* Channel 36 */
58 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5200,
59 .hw_value
= 40, }, /* Channel 40 */
60 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5220,
61 .hw_value
= 44, }, /* Channel 44 */
62 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5240,
63 .hw_value
= 48, }, /* Channel 48 */
64 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5260,
65 .hw_value
= 52, }, /* Channel 52 */
66 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5280,
67 .hw_value
= 56, }, /* Channel 56 */
68 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5300,
69 .hw_value
= 60, }, /* Channel 60 */
70 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5320,
71 .hw_value
= 64, }, /* Channel 64 */
72 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5500,
73 .hw_value
= 100, }, /* Channel 100 */
74 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5520,
75 .hw_value
= 104, }, /* Channel 104 */
76 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5540,
77 .hw_value
= 108, }, /* Channel 108 */
78 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5560,
79 .hw_value
= 112, }, /* Channel 112 */
80 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5580,
81 .hw_value
= 116, }, /* Channel 116 */
82 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5600,
83 .hw_value
= 120, }, /* Channel 120 */
84 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5620,
85 .hw_value
= 124, }, /* Channel 124 */
86 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5640,
87 .hw_value
= 128, }, /* Channel 128 */
88 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5660,
89 .hw_value
= 132, }, /* Channel 132 */
90 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5680,
91 .hw_value
= 136, }, /* Channel 136 */
92 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5700,
93 .hw_value
= 140, }, /* Channel 140 */
94 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5745,
95 .hw_value
= 149, }, /* Channel 149 */
96 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5765,
97 .hw_value
= 153, }, /* Channel 153 */
98 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5785,
99 .hw_value
= 157, }, /* Channel 157 */
100 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5805,
101 .hw_value
= 161, }, /* Channel 161 */
102 { .band
= NL80211_BAND_5GHZ
, .center_freq
= 5825,
103 .hw_value
= 165, }, /* Channel 165 */
106 struct ieee80211_rate rsi_rates
[12] = {
107 { .bitrate
= STD_RATE_01
* 5, .hw_value
= RSI_RATE_1
},
108 { .bitrate
= STD_RATE_02
* 5, .hw_value
= RSI_RATE_2
},
109 { .bitrate
= STD_RATE_5_5
* 5, .hw_value
= RSI_RATE_5_5
},
110 { .bitrate
= STD_RATE_11
* 5, .hw_value
= RSI_RATE_11
},
111 { .bitrate
= STD_RATE_06
* 5, .hw_value
= RSI_RATE_6
},
112 { .bitrate
= STD_RATE_09
* 5, .hw_value
= RSI_RATE_9
},
113 { .bitrate
= STD_RATE_12
* 5, .hw_value
= RSI_RATE_12
},
114 { .bitrate
= STD_RATE_18
* 5, .hw_value
= RSI_RATE_18
},
115 { .bitrate
= STD_RATE_24
* 5, .hw_value
= RSI_RATE_24
},
116 { .bitrate
= STD_RATE_36
* 5, .hw_value
= RSI_RATE_36
},
117 { .bitrate
= STD_RATE_48
* 5, .hw_value
= RSI_RATE_48
},
118 { .bitrate
= STD_RATE_54
* 5, .hw_value
= RSI_RATE_54
},
121 const u16 rsi_mcsrates
[8] = {
122 RSI_RATE_MCS0
, RSI_RATE_MCS1
, RSI_RATE_MCS2
, RSI_RATE_MCS3
,
123 RSI_RATE_MCS4
, RSI_RATE_MCS5
, RSI_RATE_MCS6
, RSI_RATE_MCS7
126 static const u32 rsi_max_ap_stas
[16] = {
127 32, /* 1 - Wi-Fi alone */
130 0, /* 4 - BT EDR alone */
131 4, /* 5 - STA + BT EDR */
132 32, /* 6 - AP + BT EDR */
134 0, /* 8 - BT LE alone */
135 4, /* 9 - STA + BE LE */
139 1, /* 13 - STA + BT Dual */
140 4, /* 14 - AP + BT Dual */
143 static const struct ieee80211_iface_limit rsi_iface_limits
[] = {
146 .types
= BIT(NL80211_IFTYPE_STATION
),
150 .types
= BIT(NL80211_IFTYPE_AP
) |
151 BIT(NL80211_IFTYPE_P2P_CLIENT
) |
152 BIT(NL80211_IFTYPE_P2P_GO
),
156 .types
= BIT(NL80211_IFTYPE_P2P_DEVICE
),
160 static const struct ieee80211_iface_combination rsi_iface_combinations
[] = {
162 .num_different_channels
= 1,
164 .limits
= rsi_iface_limits
,
165 .n_limits
= ARRAY_SIZE(rsi_iface_limits
),
170 * rsi_is_cipher_wep() - This function determines if the cipher is WEP or not.
171 * @common: Pointer to the driver private structure.
173 * Return: If cipher type is WEP, a value of 1 is returned, else 0.
176 bool rsi_is_cipher_wep(struct rsi_common
*common
)
178 if (((common
->secinfo
.gtk_cipher
== WLAN_CIPHER_SUITE_WEP104
) ||
179 (common
->secinfo
.gtk_cipher
== WLAN_CIPHER_SUITE_WEP40
)) &&
180 (!common
->secinfo
.ptk_cipher
))
187 * rsi_register_rates_channels() - This function registers channels and rates.
188 * @adapter: Pointer to the adapter structure.
189 * @band: Operating band to be set.
193 static void rsi_register_rates_channels(struct rsi_hw
*adapter
, int band
)
195 struct ieee80211_supported_band
*sbands
= &adapter
->sbands
[band
];
196 void *channels
= NULL
;
198 if (band
== NL80211_BAND_2GHZ
) {
199 channels
= kmalloc(sizeof(rsi_2ghz_channels
), GFP_KERNEL
);
202 sizeof(rsi_2ghz_channels
));
203 sbands
->band
= NL80211_BAND_2GHZ
;
204 sbands
->n_channels
= ARRAY_SIZE(rsi_2ghz_channels
);
205 sbands
->bitrates
= rsi_rates
;
206 sbands
->n_bitrates
= ARRAY_SIZE(rsi_rates
);
208 channels
= kmalloc(sizeof(rsi_5ghz_channels
), GFP_KERNEL
);
211 sizeof(rsi_5ghz_channels
));
212 sbands
->band
= NL80211_BAND_5GHZ
;
213 sbands
->n_channels
= ARRAY_SIZE(rsi_5ghz_channels
);
214 sbands
->bitrates
= &rsi_rates
[4];
215 sbands
->n_bitrates
= ARRAY_SIZE(rsi_rates
) - 4;
218 sbands
->channels
= channels
;
220 memset(&sbands
->ht_cap
, 0, sizeof(struct ieee80211_sta_ht_cap
));
221 sbands
->ht_cap
.ht_supported
= true;
222 sbands
->ht_cap
.cap
= (IEEE80211_HT_CAP_SUP_WIDTH_20_40
|
223 IEEE80211_HT_CAP_SGI_20
|
224 IEEE80211_HT_CAP_SGI_40
);
225 sbands
->ht_cap
.ampdu_factor
= IEEE80211_HT_MAX_AMPDU_16K
;
226 sbands
->ht_cap
.ampdu_density
= IEEE80211_HT_MPDU_DENSITY_NONE
;
227 sbands
->ht_cap
.mcs
.rx_mask
[0] = 0xff;
228 sbands
->ht_cap
.mcs
.tx_params
= IEEE80211_HT_MCS_TX_DEFINED
;
229 /* sbands->ht_cap.mcs.rx_highest = 0x82; */
233 * rsi_mac80211_detach() - This function is used to de-initialize the
235 * @adapter: Pointer to the adapter structure.
239 void rsi_mac80211_detach(struct rsi_hw
*adapter
)
241 struct ieee80211_hw
*hw
= adapter
->hw
;
242 enum nl80211_band band
;
245 ieee80211_stop_queues(hw
);
246 ieee80211_unregister_hw(hw
);
247 ieee80211_free_hw(hw
);
251 for (band
= 0; band
< NUM_NL80211_BANDS
; band
++) {
252 struct ieee80211_supported_band
*sband
=
253 &adapter
->sbands
[band
];
255 kfree(sband
->channels
);
258 #ifdef CONFIG_RSI_DEBUGFS
259 rsi_remove_dbgfs(adapter
);
260 kfree(adapter
->dfsentry
);
263 EXPORT_SYMBOL_GPL(rsi_mac80211_detach
);
266 * rsi_indicate_tx_status() - This function indicates the transmit status.
267 * @adapter: Pointer to the adapter structure.
268 * @skb: Pointer to the socket buffer structure.
273 void rsi_indicate_tx_status(struct rsi_hw
*adapter
,
277 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(skb
);
278 struct skb_info
*tx_params
;
281 rsi_dbg(ERR_ZONE
, "##### No MAC #####\n");
286 info
->flags
|= IEEE80211_TX_STAT_ACK
;
288 tx_params
= (struct skb_info
*)info
->driver_data
;
289 skb_pull(skb
, tx_params
->internal_hdr_size
);
290 memset(info
->driver_data
, 0, IEEE80211_TX_INFO_DRIVER_DATA_SIZE
);
292 ieee80211_tx_status_irqsafe(adapter
->hw
, skb
);
296 * rsi_mac80211_tx() - This is the handler that 802.11 module calls for each
297 * transmitted frame.SKB contains the buffer starting
298 * from the IEEE 802.11 header.
299 * @hw: Pointer to the ieee80211_hw structure.
300 * @control: Pointer to the ieee80211_tx_control structure
301 * @skb: Pointer to the socket buffer structure.
305 static void rsi_mac80211_tx(struct ieee80211_hw
*hw
,
306 struct ieee80211_tx_control
*control
,
309 struct rsi_hw
*adapter
= hw
->priv
;
310 struct rsi_common
*common
= adapter
->priv
;
312 rsi_core_xmit(common
, skb
);
316 * rsi_mac80211_start() - This is first handler that 802.11 module calls, since
317 * the driver init is complete by then, just
319 * @hw: Pointer to the ieee80211_hw structure.
321 * Return: 0 as success.
323 static int rsi_mac80211_start(struct ieee80211_hw
*hw
)
325 struct rsi_hw
*adapter
= hw
->priv
;
326 struct rsi_common
*common
= adapter
->priv
;
328 rsi_dbg(ERR_ZONE
, "===> Interface UP <===\n");
329 mutex_lock(&common
->mutex
);
330 if (common
->hibernate_resume
) {
331 common
->reinit_hw
= true;
332 adapter
->host_intf_ops
->reinit_device(adapter
);
333 wait_for_completion(&adapter
->priv
->wlan_init_completion
);
335 common
->iface_down
= false;
336 wiphy_rfkill_start_polling(hw
->wiphy
);
337 rsi_send_rx_filter_frame(common
, 0);
338 mutex_unlock(&common
->mutex
);
344 * rsi_mac80211_stop() - This is the last handler that 802.11 module calls.
345 * @hw: Pointer to the ieee80211_hw structure.
349 static void rsi_mac80211_stop(struct ieee80211_hw
*hw
)
351 struct rsi_hw
*adapter
= hw
->priv
;
352 struct rsi_common
*common
= adapter
->priv
;
354 rsi_dbg(ERR_ZONE
, "===> Interface DOWN <===\n");
355 mutex_lock(&common
->mutex
);
356 common
->iface_down
= true;
357 wiphy_rfkill_stop_polling(hw
->wiphy
);
359 /* Block all rx frames */
360 rsi_send_rx_filter_frame(common
, 0xffff);
362 mutex_unlock(&common
->mutex
);
365 static int rsi_map_intf_mode(enum nl80211_iftype vif_type
)
368 case NL80211_IFTYPE_STATION
:
369 return RSI_OPMODE_STA
;
370 case NL80211_IFTYPE_AP
:
371 return RSI_OPMODE_AP
;
372 case NL80211_IFTYPE_P2P_DEVICE
:
373 return RSI_OPMODE_P2P_CLIENT
;
374 case NL80211_IFTYPE_P2P_CLIENT
:
375 return RSI_OPMODE_P2P_CLIENT
;
376 case NL80211_IFTYPE_P2P_GO
:
377 return RSI_OPMODE_P2P_GO
;
379 return RSI_OPMODE_UNSUPPORTED
;
384 * rsi_mac80211_add_interface() - This function is called when a netdevice
385 * attached to the hardware is enabled.
386 * @hw: Pointer to the ieee80211_hw structure.
387 * @vif: Pointer to the ieee80211_vif structure.
389 * Return: ret: 0 on success, negative error code on failure.
391 static int rsi_mac80211_add_interface(struct ieee80211_hw
*hw
,
392 struct ieee80211_vif
*vif
)
394 struct rsi_hw
*adapter
= hw
->priv
;
395 struct rsi_common
*common
= adapter
->priv
;
396 struct vif_priv
*vif_info
= (struct vif_priv
*)vif
->drv_priv
;
397 enum opmode intf_mode
;
398 enum vap_status vap_status
;
401 vif
->driver_flags
|= IEEE80211_VIF_SUPPORTS_UAPSD
;
402 mutex_lock(&common
->mutex
);
404 intf_mode
= rsi_map_intf_mode(vif
->type
);
405 if (intf_mode
== RSI_OPMODE_UNSUPPORTED
) {
407 "%s: Interface type %d not supported\n", __func__
,
409 mutex_unlock(&common
->mutex
);
412 if ((vif
->type
== NL80211_IFTYPE_P2P_DEVICE
) ||
413 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
) ||
414 (vif
->type
== NL80211_IFTYPE_P2P_GO
))
415 common
->p2p_enabled
= true;
417 /* Get free vap index */
418 for (i
= 0; i
< RSI_MAX_VIFS
; i
++) {
419 if (!adapter
->vifs
[i
]) {
425 rsi_dbg(ERR_ZONE
, "Reject: Max VAPs reached\n");
426 mutex_unlock(&common
->mutex
);
429 vif_info
->vap_id
= vap_idx
;
430 adapter
->vifs
[vap_idx
] = vif
;
432 vap_status
= VAP_ADD
;
434 if (rsi_set_vap_capabilities(common
, intf_mode
, vif
->addr
,
435 vif_info
->vap_id
, vap_status
)) {
436 rsi_dbg(ERR_ZONE
, "Failed to set VAP capabilities\n");
437 mutex_unlock(&common
->mutex
);
441 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
442 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
443 rsi_send_rx_filter_frame(common
, DISALLOW_BEACONS
);
444 common
->min_rate
= RSI_RATE_AUTO
;
445 for (i
= 0; i
< common
->max_stations
; i
++)
446 common
->stations
[i
].sta
= NULL
;
449 mutex_unlock(&common
->mutex
);
455 * rsi_mac80211_remove_interface() - This function notifies driver that an
456 * interface is going down.
457 * @hw: Pointer to the ieee80211_hw structure.
458 * @vif: Pointer to the ieee80211_vif structure.
462 static void rsi_mac80211_remove_interface(struct ieee80211_hw
*hw
,
463 struct ieee80211_vif
*vif
)
465 struct rsi_hw
*adapter
= hw
->priv
;
466 struct rsi_common
*common
= adapter
->priv
;
470 rsi_dbg(INFO_ZONE
, "Remove Interface Called\n");
472 mutex_lock(&common
->mutex
);
474 if (adapter
->sc_nvifs
<= 0) {
475 mutex_unlock(&common
->mutex
);
479 opmode
= rsi_map_intf_mode(vif
->type
);
480 if (opmode
== RSI_OPMODE_UNSUPPORTED
) {
481 rsi_dbg(ERR_ZONE
, "Opmode error : %d\n", opmode
);
482 mutex_unlock(&common
->mutex
);
485 for (i
= 0; i
< RSI_MAX_VIFS
; i
++) {
486 if (!adapter
->vifs
[i
])
488 if (vif
== adapter
->vifs
[i
]) {
489 rsi_set_vap_capabilities(common
, opmode
, vif
->addr
,
492 adapter
->vifs
[i
] = NULL
;
495 mutex_unlock(&common
->mutex
);
499 * rsi_channel_change() - This function is a performs the checks
500 * required for changing a channel and sets
501 * the channel accordingly.
502 * @hw: Pointer to the ieee80211_hw structure.
504 * Return: 0 on success, negative error code on failure.
506 static int rsi_channel_change(struct ieee80211_hw
*hw
)
508 struct rsi_hw
*adapter
= hw
->priv
;
509 struct rsi_common
*common
= adapter
->priv
;
510 int status
= -EOPNOTSUPP
;
511 struct ieee80211_channel
*curchan
= hw
->conf
.chandef
.chan
;
512 u16 channel
= curchan
->hw_value
;
513 struct ieee80211_vif
*vif
;
514 struct ieee80211_bss_conf
*bss
;
519 "%s: Set channel: %d MHz type: %d channel_no %d\n",
520 __func__
, curchan
->center_freq
,
521 curchan
->flags
, channel
);
523 for (i
= 0; i
< RSI_MAX_VIFS
; i
++) {
524 vif
= adapter
->vifs
[i
];
527 if (vif
->type
== NL80211_IFTYPE_STATION
) {
528 bss
= &vif
->bss_conf
;
536 if (!common
->hw_data_qs_blocked
&&
537 (rsi_get_connected_channel(vif
) != channel
)) {
538 rsi_dbg(INFO_ZONE
, "blk data q %d\n", channel
);
539 if (!rsi_send_block_unblock_frame(common
, true))
540 common
->hw_data_qs_blocked
= true;
544 status
= rsi_band_check(common
, curchan
);
546 status
= rsi_set_channel(adapter
->priv
, curchan
);
549 if (common
->hw_data_qs_blocked
&&
550 (rsi_get_connected_channel(vif
) == channel
)) {
551 rsi_dbg(INFO_ZONE
, "unblk data q %d\n", channel
);
552 if (!rsi_send_block_unblock_frame(common
, false))
553 common
->hw_data_qs_blocked
= false;
561 * rsi_config_power() - This function configures tx power to device
562 * @hw: Pointer to the ieee80211_hw structure.
564 * Return: 0 on success, negative error code on failure.
566 static int rsi_config_power(struct ieee80211_hw
*hw
)
568 struct rsi_hw
*adapter
= hw
->priv
;
569 struct rsi_common
*common
= adapter
->priv
;
570 struct ieee80211_conf
*conf
= &hw
->conf
;
572 if (adapter
->sc_nvifs
<= 0) {
573 rsi_dbg(ERR_ZONE
, "%s: No virtual interface found\n", __func__
);
578 "%s: Set tx power: %d dBM\n", __func__
, conf
->power_level
);
580 if (conf
->power_level
== common
->tx_power
)
583 common
->tx_power
= conf
->power_level
;
585 return rsi_send_radio_params_update(common
);
589 * rsi_mac80211_config() - This function is a handler for configuration
590 * requests. The stack calls this function to
591 * change hardware configuration, e.g., channel.
592 * @hw: Pointer to the ieee80211_hw structure.
593 * @changed: Changed flags set.
595 * Return: 0 on success, negative error code on failure.
597 static int rsi_mac80211_config(struct ieee80211_hw
*hw
,
600 struct rsi_hw
*adapter
= hw
->priv
;
601 struct rsi_common
*common
= adapter
->priv
;
602 struct ieee80211_conf
*conf
= &hw
->conf
;
603 int status
= -EOPNOTSUPP
;
605 mutex_lock(&common
->mutex
);
607 if (changed
& IEEE80211_CONF_CHANGE_CHANNEL
)
608 status
= rsi_channel_change(hw
);
611 if (changed
& IEEE80211_CONF_CHANGE_POWER
) {
612 rsi_dbg(INFO_ZONE
, "%s: Configuring Power\n", __func__
);
613 status
= rsi_config_power(hw
);
616 /* Power save parameters */
617 if (changed
& IEEE80211_CONF_CHANGE_PS
) {
618 struct ieee80211_vif
*vif
, *sta_vif
= NULL
;
622 for (i
= 0; i
< RSI_MAX_VIFS
; i
++) {
623 vif
= adapter
->vifs
[i
];
626 /* Don't go to power save if AP vap exists */
627 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
628 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
632 if ((vif
->type
== NL80211_IFTYPE_STATION
||
633 vif
->type
== NL80211_IFTYPE_P2P_CLIENT
) &&
634 (!sta_vif
|| vif
->bss_conf
.assoc
))
637 if (set_ps
&& sta_vif
) {
638 spin_lock_irqsave(&adapter
->ps_lock
, flags
);
639 if (conf
->flags
& IEEE80211_CONF_PS
)
640 rsi_enable_ps(adapter
, sta_vif
);
642 rsi_disable_ps(adapter
, sta_vif
);
643 spin_unlock_irqrestore(&adapter
->ps_lock
, flags
);
648 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
649 rsi_dbg(INFO_ZONE
, "RTS threshold\n");
650 if ((common
->rts_threshold
) <= IEEE80211_MAX_RTS_THRESHOLD
) {
652 "%s: Sending vap updates....\n", __func__
);
653 status
= rsi_send_vap_dynamic_update(common
);
656 mutex_unlock(&common
->mutex
);
662 * rsi_get_connected_channel() - This function is used to get the current
663 * connected channel number.
664 * @adapter: Pointer to the adapter structure.
666 * Return: Current connected AP's channel number is returned.
668 u16
rsi_get_connected_channel(struct ieee80211_vif
*vif
)
670 struct ieee80211_bss_conf
*bss
;
671 struct ieee80211_channel
*channel
;
676 bss
= &vif
->bss_conf
;
677 channel
= bss
->chandef
.chan
;
682 return channel
->hw_value
;
685 static void rsi_switch_channel(struct rsi_hw
*adapter
,
686 struct ieee80211_vif
*vif
)
688 struct rsi_common
*common
= adapter
->priv
;
689 struct ieee80211_channel
*channel
;
691 if (common
->iface_down
)
696 channel
= vif
->bss_conf
.chandef
.chan
;
701 rsi_band_check(common
, channel
);
702 rsi_set_channel(common
, channel
);
703 rsi_dbg(INFO_ZONE
, "Switched to channel - %d\n", channel
->hw_value
);
707 * rsi_mac80211_bss_info_changed() - This function is a handler for config
708 * requests related to BSS parameters that
709 * may vary during BSS's lifespan.
710 * @hw: Pointer to the ieee80211_hw structure.
711 * @vif: Pointer to the ieee80211_vif structure.
712 * @bss_conf: Pointer to the ieee80211_bss_conf structure.
713 * @changed: Changed flags set.
717 static void rsi_mac80211_bss_info_changed(struct ieee80211_hw
*hw
,
718 struct ieee80211_vif
*vif
,
719 struct ieee80211_bss_conf
*bss_conf
,
722 struct rsi_hw
*adapter
= hw
->priv
;
723 struct rsi_common
*common
= adapter
->priv
;
724 struct ieee80211_bss_conf
*bss
= &vif
->bss_conf
;
725 struct ieee80211_conf
*conf
= &hw
->conf
;
726 u16 rx_filter_word
= 0;
728 mutex_lock(&common
->mutex
);
729 if (changed
& BSS_CHANGED_ASSOC
) {
730 rsi_dbg(INFO_ZONE
, "%s: Changed Association status: %d\n",
731 __func__
, bss_conf
->assoc
);
732 if (bss_conf
->assoc
) {
733 /* Send the RX filter frame */
734 rx_filter_word
= (ALLOW_DATA_ASSOC_PEER
|
735 ALLOW_CTRL_ASSOC_PEER
|
736 ALLOW_MGMT_ASSOC_PEER
);
737 rsi_send_rx_filter_frame(common
, rx_filter_word
);
739 rsi_inform_bss_status(common
,
746 bss_conf
->assoc_capability
, vif
);
747 adapter
->ps_info
.dtim_interval_duration
= bss
->dtim_period
;
748 adapter
->ps_info
.listen_interval
= conf
->listen_interval
;
750 /* If U-APSD is updated, send ps parameters to firmware */
752 if (common
->uapsd_bitmap
) {
753 rsi_dbg(INFO_ZONE
, "Configuring UAPSD\n");
754 rsi_conf_uapsd(adapter
, vif
);
757 common
->uapsd_bitmap
= 0;
761 if (changed
& BSS_CHANGED_CQM
) {
762 common
->cqm_info
.last_cqm_event_rssi
= 0;
763 common
->cqm_info
.rssi_thold
= bss_conf
->cqm_rssi_thold
;
764 common
->cqm_info
.rssi_hyst
= bss_conf
->cqm_rssi_hyst
;
765 rsi_dbg(INFO_ZONE
, "RSSI throld & hysteresis are: %d %d\n",
766 common
->cqm_info
.rssi_thold
,
767 common
->cqm_info
.rssi_hyst
);
770 if ((changed
& BSS_CHANGED_BEACON_ENABLED
) &&
771 ((vif
->type
== NL80211_IFTYPE_AP
) ||
772 (vif
->type
== NL80211_IFTYPE_P2P_GO
))) {
773 if (bss
->enable_beacon
) {
774 rsi_dbg(INFO_ZONE
, "===> BEACON ENABLED <===\n");
775 common
->beacon_enabled
= 1;
777 rsi_dbg(INFO_ZONE
, "===> BEACON DISABLED <===\n");
778 common
->beacon_enabled
= 0;
782 mutex_unlock(&common
->mutex
);
786 * rsi_mac80211_conf_filter() - This function configure the device's RX filter.
787 * @hw: Pointer to the ieee80211_hw structure.
788 * @changed: Changed flags set.
789 * @total_flags: Total initial flags set.
790 * @multicast: Multicast.
794 static void rsi_mac80211_conf_filter(struct ieee80211_hw
*hw
,
799 /* Not doing much here as of now */
800 *total_flags
&= RSI_SUPP_FILTERS
;
804 * rsi_mac80211_conf_tx() - This function configures TX queue parameters
805 * (EDCF (aifs, cw_min, cw_max), bursting)
806 * for a hardware TX queue.
807 * @hw: Pointer to the ieee80211_hw structure
808 * @vif: Pointer to the ieee80211_vif structure.
809 * @queue: Queue number.
810 * @params: Pointer to ieee80211_tx_queue_params structure.
812 * Return: 0 on success, negative error code on failure.
814 static int rsi_mac80211_conf_tx(struct ieee80211_hw
*hw
,
815 struct ieee80211_vif
*vif
, u16 queue
,
816 const struct ieee80211_tx_queue_params
*params
)
818 struct rsi_hw
*adapter
= hw
->priv
;
819 struct rsi_common
*common
= adapter
->priv
;
822 if (queue
>= IEEE80211_NUM_ACS
)
826 "%s: Conf queue %d, aifs: %d, cwmin: %d cwmax: %d, txop: %d\n",
827 __func__
, queue
, params
->aifs
,
828 params
->cw_min
, params
->cw_max
, params
->txop
);
830 mutex_lock(&common
->mutex
);
831 /* Map into the way the f/w expects */
833 case IEEE80211_AC_VO
:
836 case IEEE80211_AC_VI
:
839 case IEEE80211_AC_BE
:
842 case IEEE80211_AC_BK
:
850 memcpy(&common
->edca_params
[idx
],
852 sizeof(struct ieee80211_tx_queue_params
));
855 common
->uapsd_bitmap
|= idx
;
857 common
->uapsd_bitmap
&= (~idx
);
859 mutex_unlock(&common
->mutex
);
865 * rsi_hal_key_config() - This function loads the keys into the firmware.
866 * @hw: Pointer to the ieee80211_hw structure.
867 * @vif: Pointer to the ieee80211_vif structure.
868 * @key: Pointer to the ieee80211_key_conf structure.
870 * Return: status: 0 on success, negative error codes on failure.
872 static int rsi_hal_key_config(struct ieee80211_hw
*hw
,
873 struct ieee80211_vif
*vif
,
874 struct ieee80211_key_conf
*key
,
875 struct ieee80211_sta
*sta
)
877 struct rsi_hw
*adapter
= hw
->priv
;
878 struct rsi_sta
*rsta
= NULL
;
883 if (key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
)
884 key_type
= RSI_PAIRWISE_KEY
;
886 key_type
= RSI_GROUP_KEY
;
888 rsi_dbg(ERR_ZONE
, "%s: Cipher 0x%x key_type: %d key_len: %d\n",
889 __func__
, key
->cipher
, key_type
, key
->keylen
);
891 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
892 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
894 rsta
= rsi_find_sta(adapter
->priv
, sta
->addr
);
896 sta_id
= rsta
->sta_id
;
898 adapter
->priv
->key
= key
;
900 if ((key
->cipher
== WLAN_CIPHER_SUITE_WEP104
) ||
901 (key
->cipher
== WLAN_CIPHER_SUITE_WEP40
)) {
902 status
= rsi_hal_load_key(adapter
->priv
,
915 status
= rsi_hal_load_key(adapter
->priv
,
926 if (vif
->type
== NL80211_IFTYPE_STATION
&& key
->key
&&
927 (key
->cipher
== WLAN_CIPHER_SUITE_WEP104
||
928 key
->cipher
== WLAN_CIPHER_SUITE_WEP40
)) {
929 if (!rsi_send_block_unblock_frame(adapter
->priv
, false))
930 adapter
->priv
->hw_data_qs_blocked
= false;
937 * rsi_mac80211_set_key() - This function sets type of key to be loaded.
938 * @hw: Pointer to the ieee80211_hw structure.
939 * @cmd: enum set_key_cmd.
940 * @vif: Pointer to the ieee80211_vif structure.
941 * @sta: Pointer to the ieee80211_sta structure.
942 * @key: Pointer to the ieee80211_key_conf structure.
944 * Return: status: 0 on success, negative error code on failure.
946 static int rsi_mac80211_set_key(struct ieee80211_hw
*hw
,
947 enum set_key_cmd cmd
,
948 struct ieee80211_vif
*vif
,
949 struct ieee80211_sta
*sta
,
950 struct ieee80211_key_conf
*key
)
952 struct rsi_hw
*adapter
= hw
->priv
;
953 struct rsi_common
*common
= adapter
->priv
;
954 struct security_info
*secinfo
= &common
->secinfo
;
957 mutex_lock(&common
->mutex
);
960 secinfo
->security_enable
= true;
961 status
= rsi_hal_key_config(hw
, vif
, key
, sta
);
963 mutex_unlock(&common
->mutex
);
967 if (key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
)
968 secinfo
->ptk_cipher
= key
->cipher
;
970 secinfo
->gtk_cipher
= key
->cipher
;
972 key
->hw_key_idx
= key
->keyidx
;
973 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_IV
;
975 rsi_dbg(ERR_ZONE
, "%s: RSI set_key\n", __func__
);
979 if (vif
->type
== NL80211_IFTYPE_STATION
)
980 secinfo
->security_enable
= false;
981 rsi_dbg(ERR_ZONE
, "%s: RSI del key\n", __func__
);
982 memset(key
, 0, sizeof(struct ieee80211_key_conf
));
983 status
= rsi_hal_key_config(hw
, vif
, key
, sta
);
987 status
= -EOPNOTSUPP
;
991 mutex_unlock(&common
->mutex
);
996 * rsi_mac80211_ampdu_action() - This function selects the AMPDU action for
997 * the corresponding mlme_action flag and
998 * informs the f/w regarding this.
999 * @hw: Pointer to the ieee80211_hw structure.
1000 * @vif: Pointer to the ieee80211_vif structure.
1001 * @params: Pointer to A-MPDU action parameters
1003 * Return: status: 0 on success, negative error code on failure.
1005 static int rsi_mac80211_ampdu_action(struct ieee80211_hw
*hw
,
1006 struct ieee80211_vif
*vif
,
1007 struct ieee80211_ampdu_params
*params
)
1009 int status
= -EOPNOTSUPP
;
1010 struct rsi_hw
*adapter
= hw
->priv
;
1011 struct rsi_common
*common
= adapter
->priv
;
1012 struct rsi_sta
*rsta
= NULL
;
1013 u16 seq_no
= 0, seq_start
= 0;
1015 struct ieee80211_sta
*sta
= params
->sta
;
1017 enum ieee80211_ampdu_mlme_action action
= params
->action
;
1018 u16 tid
= params
->tid
;
1019 u16
*ssn
= ¶ms
->ssn
;
1020 u8 buf_size
= params
->buf_size
;
1022 for (ii
= 0; ii
< RSI_MAX_VIFS
; ii
++) {
1023 if (vif
== adapter
->vifs
[ii
])
1027 mutex_lock(&common
->mutex
);
1032 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1033 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
1034 rsta
= rsi_find_sta(common
, sta
->addr
);
1036 rsi_dbg(ERR_ZONE
, "No station mapped\n");
1040 sta_id
= rsta
->sta_id
;
1044 "%s: AMPDU action tid=%d ssn=0x%x, buf_size=%d sta_id=%d\n",
1045 __func__
, tid
, seq_no
, buf_size
, sta_id
);
1048 case IEEE80211_AMPDU_RX_START
:
1049 status
= rsi_send_aggregation_params_frame(common
,
1057 case IEEE80211_AMPDU_RX_STOP
:
1058 status
= rsi_send_aggregation_params_frame(common
,
1066 case IEEE80211_AMPDU_TX_START
:
1067 if ((vif
->type
== NL80211_IFTYPE_STATION
) ||
1068 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
))
1069 common
->vif_info
[ii
].seq_start
= seq_no
;
1070 else if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1071 (vif
->type
== NL80211_IFTYPE_P2P_GO
))
1072 rsta
->seq_start
[tid
] = seq_no
;
1073 ieee80211_start_tx_ba_cb_irqsafe(vif
, sta
->addr
, tid
);
1077 case IEEE80211_AMPDU_TX_STOP_CONT
:
1078 case IEEE80211_AMPDU_TX_STOP_FLUSH
:
1079 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT
:
1080 status
= rsi_send_aggregation_params_frame(common
,
1087 ieee80211_stop_tx_ba_cb_irqsafe(vif
, sta
->addr
, tid
);
1090 case IEEE80211_AMPDU_TX_OPERATIONAL
:
1091 if ((vif
->type
== NL80211_IFTYPE_STATION
) ||
1092 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
))
1093 seq_start
= common
->vif_info
[ii
].seq_start
;
1094 else if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1095 (vif
->type
== NL80211_IFTYPE_P2P_GO
))
1096 seq_start
= rsta
->seq_start
[tid
];
1097 status
= rsi_send_aggregation_params_frame(common
,
1106 rsi_dbg(ERR_ZONE
, "%s: Unknown AMPDU action\n", __func__
);
1111 mutex_unlock(&common
->mutex
);
1116 * rsi_mac80211_set_rts_threshold() - This function sets rts threshold value.
1117 * @hw: Pointer to the ieee80211_hw structure.
1118 * @value: Rts threshold value.
1120 * Return: 0 on success.
1122 static int rsi_mac80211_set_rts_threshold(struct ieee80211_hw
*hw
,
1125 struct rsi_hw
*adapter
= hw
->priv
;
1126 struct rsi_common
*common
= adapter
->priv
;
1128 mutex_lock(&common
->mutex
);
1129 common
->rts_threshold
= value
;
1130 mutex_unlock(&common
->mutex
);
1136 * rsi_mac80211_set_rate_mask() - This function sets bitrate_mask to be used.
1137 * @hw: Pointer to the ieee80211_hw structure
1138 * @vif: Pointer to the ieee80211_vif structure.
1139 * @mask: Pointer to the cfg80211_bitrate_mask structure.
1141 * Return: 0 on success.
1143 static int rsi_mac80211_set_rate_mask(struct ieee80211_hw
*hw
,
1144 struct ieee80211_vif
*vif
,
1145 const struct cfg80211_bitrate_mask
*mask
)
1147 struct rsi_hw
*adapter
= hw
->priv
;
1148 struct rsi_common
*common
= adapter
->priv
;
1149 enum nl80211_band band
= hw
->conf
.chandef
.chan
->band
;
1151 mutex_lock(&common
->mutex
);
1152 common
->fixedrate_mask
[band
] = 0;
1154 if (mask
->control
[band
].legacy
== 0xfff) {
1155 common
->fixedrate_mask
[band
] =
1156 (mask
->control
[band
].ht_mcs
[0] << 12);
1158 common
->fixedrate_mask
[band
] =
1159 mask
->control
[band
].legacy
;
1161 mutex_unlock(&common
->mutex
);
1167 * rsi_perform_cqm() - This function performs cqm.
1168 * @common: Pointer to the driver private structure.
1169 * @bssid: pointer to the bssid.
1170 * @rssi: RSSI value.
1172 static void rsi_perform_cqm(struct rsi_common
*common
,
1175 struct ieee80211_vif
*vif
)
1177 s8 last_event
= common
->cqm_info
.last_cqm_event_rssi
;
1178 int thold
= common
->cqm_info
.rssi_thold
;
1179 u32 hyst
= common
->cqm_info
.rssi_hyst
;
1180 enum nl80211_cqm_rssi_threshold_event event
;
1182 if (rssi
< thold
&& (last_event
== 0 || rssi
< (last_event
- hyst
)))
1183 event
= NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW
;
1184 else if (rssi
> thold
&&
1185 (last_event
== 0 || rssi
> (last_event
+ hyst
)))
1186 event
= NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH
;
1190 common
->cqm_info
.last_cqm_event_rssi
= rssi
;
1191 rsi_dbg(INFO_ZONE
, "CQM: Notifying event: %d\n", event
);
1192 ieee80211_cqm_rssi_notify(vif
, event
, rssi
, GFP_KERNEL
);
1198 * rsi_fill_rx_status() - This function fills rx status in
1199 * ieee80211_rx_status structure.
1200 * @hw: Pointer to the ieee80211_hw structure.
1201 * @skb: Pointer to the socket buffer structure.
1202 * @common: Pointer to the driver private structure.
1203 * @rxs: Pointer to the ieee80211_rx_status structure.
1207 static void rsi_fill_rx_status(struct ieee80211_hw
*hw
,
1208 struct sk_buff
*skb
,
1209 struct rsi_common
*common
,
1210 struct ieee80211_rx_status
*rxs
)
1212 struct rsi_hw
*adapter
= common
->priv
;
1213 struct ieee80211_vif
*vif
;
1214 struct ieee80211_bss_conf
*bss
= NULL
;
1215 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(skb
);
1216 struct skb_info
*rx_params
= (struct skb_info
*)info
->driver_data
;
1217 struct ieee80211_hdr
*hdr
;
1218 char rssi
= rx_params
->rssi
;
1220 u8 channel
= rx_params
->channel
;
1224 hdr
= ((struct ieee80211_hdr
*)(skb
->data
));
1225 hdrlen
= ieee80211_hdrlen(hdr
->frame_control
);
1227 memset(info
, 0, sizeof(struct ieee80211_tx_info
));
1229 rxs
->signal
= -(rssi
);
1231 rxs
->band
= common
->band
;
1233 freq
= ieee80211_channel_to_frequency(channel
, rxs
->band
);
1238 if (ieee80211_has_protected(hdr
->frame_control
)) {
1239 if (rsi_is_cipher_wep(common
)) {
1240 memmove(skb
->data
+ 4, skb
->data
, hdrlen
);
1243 memmove(skb
->data
+ 8, skb
->data
, hdrlen
);
1245 rxs
->flag
|= RX_FLAG_MMIC_STRIPPED
;
1247 rxs
->flag
|= RX_FLAG_DECRYPTED
;
1248 rxs
->flag
|= RX_FLAG_IV_STRIPPED
;
1251 for (i
= 0; i
< RSI_MAX_VIFS
; i
++) {
1252 vif
= adapter
->vifs
[i
];
1255 if (vif
->type
== NL80211_IFTYPE_STATION
) {
1256 bss
= &vif
->bss_conf
;
1262 /* CQM only for connected AP beacons, the RSSI is a weighted avg */
1263 if (bss
->assoc
&& !(memcmp(bss
->bssid
, hdr
->addr2
, ETH_ALEN
))) {
1264 if (ieee80211_is_beacon(hdr
->frame_control
))
1265 rsi_perform_cqm(common
, hdr
->addr2
, rxs
->signal
, vif
);
1272 * rsi_indicate_pkt_to_os() - This function sends recieved packet to mac80211.
1273 * @common: Pointer to the driver private structure.
1274 * @skb: Pointer to the socket buffer structure.
1278 void rsi_indicate_pkt_to_os(struct rsi_common
*common
,
1279 struct sk_buff
*skb
)
1281 struct rsi_hw
*adapter
= common
->priv
;
1282 struct ieee80211_hw
*hw
= adapter
->hw
;
1283 struct ieee80211_rx_status
*rx_status
= IEEE80211_SKB_RXCB(skb
);
1285 if ((common
->iface_down
) || (!adapter
->sc_nvifs
)) {
1290 /* filling in the ieee80211_rx_status flags */
1291 rsi_fill_rx_status(hw
, skb
, common
, rx_status
);
1293 ieee80211_rx_irqsafe(hw
, skb
);
1296 static void rsi_set_min_rate(struct ieee80211_hw
*hw
,
1297 struct ieee80211_sta
*sta
,
1298 struct rsi_common
*common
)
1300 u8 band
= hw
->conf
.chandef
.chan
->band
;
1303 bool matched
= false;
1305 common
->bitrate_mask
[band
] = sta
->supp_rates
[band
];
1307 rate_bitmap
= (common
->fixedrate_mask
[band
] & sta
->supp_rates
[band
]);
1309 if (rate_bitmap
& 0xfff) {
1310 /* Find out the min rate */
1311 for (ii
= 0; ii
< ARRAY_SIZE(rsi_rates
); ii
++) {
1312 if (rate_bitmap
& BIT(ii
)) {
1313 common
->min_rate
= rsi_rates
[ii
].hw_value
;
1320 common
->vif_info
[0].is_ht
= sta
->ht_cap
.ht_supported
;
1322 if ((common
->vif_info
[0].is_ht
) && (rate_bitmap
>> 12)) {
1323 for (ii
= 0; ii
< ARRAY_SIZE(rsi_mcsrates
); ii
++) {
1324 if ((rate_bitmap
>> 12) & BIT(ii
)) {
1325 common
->min_rate
= rsi_mcsrates
[ii
];
1333 common
->min_rate
= 0xffff;
1337 * rsi_mac80211_sta_add() - This function notifies driver about a peer getting
1339 * @hw: pointer to the ieee80211_hw structure.
1340 * @vif: Pointer to the ieee80211_vif structure.
1341 * @sta: Pointer to the ieee80211_sta structure.
1343 * Return: 0 on success, negative error codes on failure.
1345 static int rsi_mac80211_sta_add(struct ieee80211_hw
*hw
,
1346 struct ieee80211_vif
*vif
,
1347 struct ieee80211_sta
*sta
)
1349 struct rsi_hw
*adapter
= hw
->priv
;
1350 struct rsi_common
*common
= adapter
->priv
;
1351 bool sta_exist
= false;
1352 struct rsi_sta
*rsta
;
1355 rsi_dbg(INFO_ZONE
, "Station Add: %pM\n", sta
->addr
);
1357 mutex_lock(&common
->mutex
);
1359 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1360 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
1363 int free_index
= -1;
1365 /* Check if max stations reached */
1366 if (common
->num_stations
>= common
->max_stations
) {
1367 rsi_dbg(ERR_ZONE
, "Reject: Max Stations exists\n");
1368 status
= -EOPNOTSUPP
;
1371 for (cnt
= 0; cnt
< common
->max_stations
; cnt
++) {
1372 rsta
= &common
->stations
[cnt
];
1379 if (!memcmp(rsta
->sta
->addr
, sta
->addr
, ETH_ALEN
)) {
1380 rsi_dbg(INFO_ZONE
, "Station exists\n");
1387 if (free_index
>= 0)
1388 sta_idx
= free_index
;
1392 "%s: Some problem reaching here...\n",
1397 rsta
= &common
->stations
[sta_idx
];
1399 rsta
->sta_id
= sta_idx
;
1400 for (cnt
= 0; cnt
< IEEE80211_NUM_TIDS
; cnt
++)
1401 rsta
->start_tx_aggr
[cnt
] = false;
1402 for (cnt
= 0; cnt
< IEEE80211_NUM_TIDS
; cnt
++)
1403 rsta
->seq_start
[cnt
] = 0;
1405 rsi_dbg(INFO_ZONE
, "New Station\n");
1407 /* Send peer notify to device */
1408 rsi_dbg(INFO_ZONE
, "Indicate bss status to device\n");
1409 rsi_inform_bss_status(common
, RSI_OPMODE_AP
, 1,
1410 sta
->addr
, sta
->wme
, sta
->aid
,
1411 sta
, sta_idx
, 0, vif
);
1414 struct ieee80211_key_conf
*key
= common
->key
;
1416 if ((key
->cipher
== WLAN_CIPHER_SUITE_WEP104
) ||
1417 (key
->cipher
== WLAN_CIPHER_SUITE_WEP40
))
1418 rsi_hal_load_key(adapter
->priv
,
1428 common
->num_stations
++;
1432 if ((vif
->type
== NL80211_IFTYPE_STATION
) ||
1433 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
)) {
1434 rsi_set_min_rate(hw
, sta
, common
);
1435 if (sta
->ht_cap
.ht_supported
) {
1436 common
->vif_info
[0].is_ht
= true;
1437 common
->bitrate_mask
[NL80211_BAND_2GHZ
] =
1438 sta
->supp_rates
[NL80211_BAND_2GHZ
];
1439 if ((sta
->ht_cap
.cap
& IEEE80211_HT_CAP_SGI_20
) ||
1440 (sta
->ht_cap
.cap
& IEEE80211_HT_CAP_SGI_40
))
1441 common
->vif_info
[0].sgi
= true;
1442 ieee80211_start_tx_ba_session(sta
, 0, 0);
1447 mutex_unlock(&common
->mutex
);
1453 * rsi_mac80211_sta_remove() - This function notifies driver about a peer
1454 * getting disconnected.
1455 * @hw: Pointer to the ieee80211_hw structure.
1456 * @vif: Pointer to the ieee80211_vif structure.
1457 * @sta: Pointer to the ieee80211_sta structure.
1459 * Return: 0 on success, negative error codes on failure.
1461 static int rsi_mac80211_sta_remove(struct ieee80211_hw
*hw
,
1462 struct ieee80211_vif
*vif
,
1463 struct ieee80211_sta
*sta
)
1465 struct rsi_hw
*adapter
= hw
->priv
;
1466 struct rsi_common
*common
= adapter
->priv
;
1467 struct ieee80211_bss_conf
*bss
= &vif
->bss_conf
;
1468 struct rsi_sta
*rsta
;
1470 rsi_dbg(INFO_ZONE
, "Station Remove: %pM\n", sta
->addr
);
1472 mutex_lock(&common
->mutex
);
1474 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1475 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
1478 /* Send peer notify to device */
1479 rsi_dbg(INFO_ZONE
, "Indicate bss status to device\n");
1480 for (sta_idx
= 0; sta_idx
< common
->max_stations
; sta_idx
++) {
1481 rsta
= &common
->stations
[sta_idx
];
1485 if (!memcmp(rsta
->sta
->addr
, sta
->addr
, ETH_ALEN
)) {
1486 rsi_inform_bss_status(common
, RSI_OPMODE_AP
, 0,
1487 sta
->addr
, sta
->wme
,
1488 sta
->aid
, sta
, sta_idx
,
1492 for (cnt
= 0; cnt
< IEEE80211_NUM_TIDS
; cnt
++)
1493 rsta
->start_tx_aggr
[cnt
] = false;
1494 if (common
->num_stations
> 0)
1495 common
->num_stations
--;
1499 if (sta_idx
>= common
->max_stations
)
1500 rsi_dbg(ERR_ZONE
, "%s: No station found\n", __func__
);
1503 if ((vif
->type
== NL80211_IFTYPE_STATION
) ||
1504 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
)) {
1505 /* Resetting all the fields to default values */
1506 memcpy((u8
*)bss
->bssid
, (u8
*)sta
->addr
, ETH_ALEN
);
1507 bss
->qos
= sta
->wme
;
1508 common
->bitrate_mask
[NL80211_BAND_2GHZ
] = 0;
1509 common
->bitrate_mask
[NL80211_BAND_5GHZ
] = 0;
1510 common
->min_rate
= 0xffff;
1511 common
->vif_info
[0].is_ht
= false;
1512 common
->vif_info
[0].sgi
= false;
1513 common
->vif_info
[0].seq_start
= 0;
1514 common
->secinfo
.ptk_cipher
= 0;
1515 common
->secinfo
.gtk_cipher
= 0;
1516 if (!common
->iface_down
)
1517 rsi_send_rx_filter_frame(common
, 0);
1519 mutex_unlock(&common
->mutex
);
1525 * rsi_mac80211_set_antenna() - This function is used to configure
1526 * tx and rx antennas.
1527 * @hw: Pointer to the ieee80211_hw structure.
1528 * @tx_ant: Bitmap for tx antenna
1529 * @rx_ant: Bitmap for rx antenna
1531 * Return: 0 on success, Negative error code on failure.
1533 static int rsi_mac80211_set_antenna(struct ieee80211_hw
*hw
,
1534 u32 tx_ant
, u32 rx_ant
)
1536 struct rsi_hw
*adapter
= hw
->priv
;
1537 struct rsi_common
*common
= adapter
->priv
;
1540 if (tx_ant
> 1 || rx_ant
> 1) {
1542 "Invalid antenna selection (tx: %d, rx:%d)\n",
1545 "Use 0 for int_ant, 1 for ext_ant\n");
1549 rsi_dbg(INFO_ZONE
, "%s: Antenna map Tx %x Rx %d\n",
1550 __func__
, tx_ant
, rx_ant
);
1552 mutex_lock(&common
->mutex
);
1554 antenna
= tx_ant
? ANTENNA_SEL_UFL
: ANTENNA_SEL_INT
;
1555 if (common
->ant_in_use
!= antenna
)
1556 if (rsi_set_antenna(common
, antenna
))
1557 goto fail_set_antenna
;
1559 rsi_dbg(INFO_ZONE
, "(%s) Antenna path configured successfully\n",
1560 tx_ant
? "UFL" : "INT");
1562 common
->ant_in_use
= antenna
;
1564 mutex_unlock(&common
->mutex
);
1569 rsi_dbg(ERR_ZONE
, "%s: Failed.\n", __func__
);
1570 mutex_unlock(&common
->mutex
);
1575 * rsi_mac80211_get_antenna() - This function is used to configure
1576 * tx and rx antennas.
1578 * @hw: Pointer to the ieee80211_hw structure.
1579 * @tx_ant: Bitmap for tx antenna
1580 * @rx_ant: Bitmap for rx antenna
1582 * Return: 0 on success, negative error codes on failure.
1584 static int rsi_mac80211_get_antenna(struct ieee80211_hw
*hw
,
1585 u32
*tx_ant
, u32
*rx_ant
)
1587 struct rsi_hw
*adapter
= hw
->priv
;
1588 struct rsi_common
*common
= adapter
->priv
;
1590 mutex_lock(&common
->mutex
);
1592 *tx_ant
= (common
->ant_in_use
== ANTENNA_SEL_UFL
) ? 1 : 0;
1595 mutex_unlock(&common
->mutex
);
1600 static int rsi_map_region_code(enum nl80211_dfs_regions region_code
)
1602 switch (region_code
) {
1603 case NL80211_DFS_FCC
:
1604 return RSI_REGION_FCC
;
1605 case NL80211_DFS_ETSI
:
1606 return RSI_REGION_ETSI
;
1607 case NL80211_DFS_JP
:
1608 return RSI_REGION_TELEC
;
1609 case NL80211_DFS_UNSET
:
1610 return RSI_REGION_WORLD
;
1612 return RSI_REGION_WORLD
;
1615 static void rsi_reg_notify(struct wiphy
*wiphy
,
1616 struct regulatory_request
*request
)
1618 struct ieee80211_supported_band
*sband
;
1619 struct ieee80211_channel
*ch
;
1620 struct ieee80211_hw
*hw
= wiphy_to_ieee80211_hw(wiphy
);
1621 struct rsi_hw
* adapter
= hw
->priv
;
1622 struct rsi_common
*common
= adapter
->priv
;
1625 mutex_lock(&common
->mutex
);
1627 rsi_dbg(INFO_ZONE
, "country = %s dfs_region = %d\n",
1628 request
->alpha2
, request
->dfs_region
);
1630 if (common
->num_supp_bands
> 1) {
1631 sband
= wiphy
->bands
[NL80211_BAND_5GHZ
];
1633 for (i
= 0; i
< sband
->n_channels
; i
++) {
1634 ch
= &sband
->channels
[i
];
1635 if (ch
->flags
& IEEE80211_CHAN_DISABLED
)
1638 if (ch
->flags
& IEEE80211_CHAN_RADAR
)
1639 ch
->flags
|= IEEE80211_CHAN_NO_IR
;
1642 adapter
->dfs_region
= rsi_map_region_code(request
->dfs_region
);
1643 rsi_dbg(INFO_ZONE
, "RSI region code = %d\n", adapter
->dfs_region
);
1645 adapter
->country
[0] = request
->alpha2
[0];
1646 adapter
->country
[1] = request
->alpha2
[1];
1648 mutex_unlock(&common
->mutex
);
1651 static void rsi_mac80211_rfkill_poll(struct ieee80211_hw
*hw
)
1653 struct rsi_hw
*adapter
= hw
->priv
;
1654 struct rsi_common
*common
= adapter
->priv
;
1656 mutex_lock(&common
->mutex
);
1657 if (common
->fsm_state
!= FSM_MAC_INIT_DONE
)
1658 wiphy_rfkill_set_hw_state(hw
->wiphy
, true);
1660 wiphy_rfkill_set_hw_state(hw
->wiphy
, false);
1661 mutex_unlock(&common
->mutex
);
1664 static void rsi_resume_conn_channel(struct rsi_common
*common
)
1666 struct rsi_hw
*adapter
= common
->priv
;
1667 struct ieee80211_vif
*vif
;
1670 for (cnt
= 0; cnt
< RSI_MAX_VIFS
; cnt
++) {
1671 vif
= adapter
->vifs
[cnt
];
1675 if ((vif
->type
== NL80211_IFTYPE_AP
) ||
1676 (vif
->type
== NL80211_IFTYPE_P2P_GO
)) {
1677 rsi_switch_channel(adapter
, vif
);
1680 if (((vif
->type
== NL80211_IFTYPE_STATION
) ||
1681 (vif
->type
== NL80211_IFTYPE_P2P_CLIENT
)) &&
1682 vif
->bss_conf
.assoc
) {
1683 rsi_switch_channel(adapter
, vif
);
1689 void rsi_roc_timeout(struct timer_list
*t
)
1691 struct rsi_common
*common
= from_timer(common
, t
, roc_timer
);
1693 rsi_dbg(INFO_ZONE
, "Remain on channel expired\n");
1695 mutex_lock(&common
->mutex
);
1696 ieee80211_remain_on_channel_expired(common
->priv
->hw
);
1698 if (timer_pending(&common
->roc_timer
))
1699 del_timer(&common
->roc_timer
);
1701 rsi_resume_conn_channel(common
);
1702 mutex_unlock(&common
->mutex
);
1705 static int rsi_mac80211_roc(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
1706 struct ieee80211_channel
*chan
, int duration
,
1707 enum ieee80211_roc_type type
)
1709 struct rsi_hw
*adapter
= (struct rsi_hw
*)hw
->priv
;
1710 struct rsi_common
*common
= (struct rsi_common
*)adapter
->priv
;
1713 rsi_dbg(INFO_ZONE
, "***** Remain on channel *****\n");
1715 mutex_lock(&common
->mutex
);
1716 rsi_dbg(INFO_ZONE
, "%s: channel: %d duration: %dms\n",
1717 __func__
, chan
->hw_value
, duration
);
1719 if (timer_pending(&common
->roc_timer
)) {
1720 rsi_dbg(INFO_ZONE
, "Stop on-going ROC\n");
1721 del_timer(&common
->roc_timer
);
1723 common
->roc_timer
.expires
= msecs_to_jiffies(duration
) + jiffies
;
1724 add_timer(&common
->roc_timer
);
1726 /* Configure band */
1727 if (rsi_band_check(common
, chan
)) {
1728 rsi_dbg(ERR_ZONE
, "Failed to set band\n");
1733 /* Configure channel */
1734 if (rsi_set_channel(common
, chan
)) {
1735 rsi_dbg(ERR_ZONE
, "Failed to set the channel\n");
1740 common
->roc_vif
= vif
;
1741 ieee80211_ready_on_channel(hw
);
1742 rsi_dbg(INFO_ZONE
, "%s: Ready on channel :%d\n",
1743 __func__
, chan
->hw_value
);
1746 mutex_unlock(&common
->mutex
);
1751 static int rsi_mac80211_cancel_roc(struct ieee80211_hw
*hw
)
1753 struct rsi_hw
*adapter
= hw
->priv
;
1754 struct rsi_common
*common
= adapter
->priv
;
1756 rsi_dbg(INFO_ZONE
, "Cancel remain on channel\n");
1758 mutex_lock(&common
->mutex
);
1759 if (!timer_pending(&common
->roc_timer
)) {
1760 mutex_unlock(&common
->mutex
);
1764 del_timer(&common
->roc_timer
);
1766 rsi_resume_conn_channel(common
);
1767 mutex_unlock(&common
->mutex
);
1773 static const struct wiphy_wowlan_support rsi_wowlan_support
= {
1774 .flags
= WIPHY_WOWLAN_ANY
|
1775 WIPHY_WOWLAN_MAGIC_PKT
|
1776 WIPHY_WOWLAN_DISCONNECT
|
1777 WIPHY_WOWLAN_GTK_REKEY_FAILURE
|
1778 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY
|
1779 WIPHY_WOWLAN_EAP_IDENTITY_REQ
|
1780 WIPHY_WOWLAN_4WAY_HANDSHAKE
,
1783 static u16
rsi_wow_map_triggers(struct rsi_common
*common
,
1784 struct cfg80211_wowlan
*wowlan
)
1786 u16 wow_triggers
= 0;
1788 rsi_dbg(INFO_ZONE
, "Mapping wowlan triggers\n");
1791 wow_triggers
|= RSI_WOW_ANY
;
1792 if (wowlan
->magic_pkt
)
1793 wow_triggers
|= RSI_WOW_MAGIC_PKT
;
1794 if (wowlan
->disconnect
)
1795 wow_triggers
|= RSI_WOW_DISCONNECT
;
1796 if (wowlan
->gtk_rekey_failure
|| wowlan
->eap_identity_req
||
1797 wowlan
->four_way_handshake
)
1798 wow_triggers
|= RSI_WOW_GTK_REKEY
;
1800 return wow_triggers
;
1803 int rsi_config_wowlan(struct rsi_hw
*adapter
, struct cfg80211_wowlan
*wowlan
)
1805 struct rsi_common
*common
= adapter
->priv
;
1807 u16 rx_filter_word
= 0;
1808 struct ieee80211_bss_conf
*bss
= NULL
;
1810 rsi_dbg(INFO_ZONE
, "Config WoWLAN to device\n");
1812 if (!adapter
->vifs
[0])
1815 bss
= &adapter
->vifs
[0]->bss_conf
;
1817 if (WARN_ON(!wowlan
)) {
1818 rsi_dbg(ERR_ZONE
, "WoW triggers not enabled\n");
1822 common
->wow_flags
|= RSI_WOW_ENABLED
;
1823 triggers
= rsi_wow_map_triggers(common
, wowlan
);
1825 rsi_dbg(ERR_ZONE
, "%s:No valid WoW triggers\n", __func__
);
1830 "Cannot configure WoWLAN (Station not connected)\n");
1831 common
->wow_flags
|= RSI_WOW_NO_CONNECTION
;
1834 rsi_dbg(INFO_ZONE
, "TRIGGERS %x\n", triggers
);
1835 rsi_send_wowlan_request(common
, triggers
, 1);
1838 * Increase the beacon_miss threshold & keep-alive timers in
1841 rsi_send_vap_dynamic_update(common
);
1843 rx_filter_word
= (ALLOW_DATA_ASSOC_PEER
| DISALLOW_BEACONS
);
1844 rsi_send_rx_filter_frame(common
, rx_filter_word
);
1848 EXPORT_SYMBOL(rsi_config_wowlan
);
1850 static int rsi_mac80211_suspend(struct ieee80211_hw
*hw
,
1851 struct cfg80211_wowlan
*wowlan
)
1853 struct rsi_hw
*adapter
= hw
->priv
;
1854 struct rsi_common
*common
= adapter
->priv
;
1856 rsi_dbg(INFO_ZONE
, "%s: mac80211 suspend\n", __func__
);
1857 mutex_lock(&common
->mutex
);
1858 if (rsi_config_wowlan(adapter
, wowlan
)) {
1859 rsi_dbg(ERR_ZONE
, "Failed to configure WoWLAN\n");
1860 mutex_unlock(&common
->mutex
);
1863 mutex_unlock(&common
->mutex
);
1868 static int rsi_mac80211_resume(struct ieee80211_hw
*hw
)
1870 u16 rx_filter_word
= 0;
1871 struct rsi_hw
*adapter
= hw
->priv
;
1872 struct rsi_common
*common
= adapter
->priv
;
1874 common
->wow_flags
= 0;
1876 rsi_dbg(INFO_ZONE
, "%s: mac80211 resume\n", __func__
);
1878 if (common
->hibernate_resume
)
1881 mutex_lock(&common
->mutex
);
1882 rsi_send_wowlan_request(common
, 0, 0);
1884 rx_filter_word
= (ALLOW_DATA_ASSOC_PEER
| ALLOW_CTRL_ASSOC_PEER
|
1885 ALLOW_MGMT_ASSOC_PEER
);
1886 rsi_send_rx_filter_frame(common
, rx_filter_word
);
1887 mutex_unlock(&common
->mutex
);
1894 static const struct ieee80211_ops mac80211_ops
= {
1895 .tx
= rsi_mac80211_tx
,
1896 .start
= rsi_mac80211_start
,
1897 .stop
= rsi_mac80211_stop
,
1898 .add_interface
= rsi_mac80211_add_interface
,
1899 .remove_interface
= rsi_mac80211_remove_interface
,
1900 .config
= rsi_mac80211_config
,
1901 .bss_info_changed
= rsi_mac80211_bss_info_changed
,
1902 .conf_tx
= rsi_mac80211_conf_tx
,
1903 .configure_filter
= rsi_mac80211_conf_filter
,
1904 .set_key
= rsi_mac80211_set_key
,
1905 .set_rts_threshold
= rsi_mac80211_set_rts_threshold
,
1906 .set_bitrate_mask
= rsi_mac80211_set_rate_mask
,
1907 .ampdu_action
= rsi_mac80211_ampdu_action
,
1908 .sta_add
= rsi_mac80211_sta_add
,
1909 .sta_remove
= rsi_mac80211_sta_remove
,
1910 .set_antenna
= rsi_mac80211_set_antenna
,
1911 .get_antenna
= rsi_mac80211_get_antenna
,
1912 .rfkill_poll
= rsi_mac80211_rfkill_poll
,
1913 .remain_on_channel
= rsi_mac80211_roc
,
1914 .cancel_remain_on_channel
= rsi_mac80211_cancel_roc
,
1916 .suspend
= rsi_mac80211_suspend
,
1917 .resume
= rsi_mac80211_resume
,
1922 * rsi_mac80211_attach() - This function is used to initialize Mac80211 stack.
1923 * @common: Pointer to the driver private structure.
1925 * Return: 0 on success, negative error codes on failure.
1927 int rsi_mac80211_attach(struct rsi_common
*common
)
1930 struct ieee80211_hw
*hw
= NULL
;
1931 struct wiphy
*wiphy
= NULL
;
1932 struct rsi_hw
*adapter
= common
->priv
;
1933 u8 addr_mask
[ETH_ALEN
] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x3};
1935 rsi_dbg(INIT_ZONE
, "%s: Performing mac80211 attach\n", __func__
);
1937 hw
= ieee80211_alloc_hw(sizeof(struct rsi_hw
), &mac80211_ops
);
1939 rsi_dbg(ERR_ZONE
, "%s: ieee80211 hw alloc failed\n", __func__
);
1945 SET_IEEE80211_DEV(hw
, adapter
->device
);
1950 ieee80211_hw_set(hw
, SIGNAL_DBM
);
1951 ieee80211_hw_set(hw
, HAS_RATE_CONTROL
);
1952 ieee80211_hw_set(hw
, AMPDU_AGGREGATION
);
1953 ieee80211_hw_set(hw
, SUPPORTS_PS
);
1954 ieee80211_hw_set(hw
, SUPPORTS_DYNAMIC_PS
);
1956 hw
->queues
= MAX_HW_QUEUES
;
1957 hw
->extra_tx_headroom
= RSI_NEEDED_HEADROOM
;
1960 hw
->max_rate_tries
= MAX_RETRIES
;
1961 hw
->uapsd_queues
= RSI_IEEE80211_UAPSD_QUEUES
;
1962 hw
->uapsd_max_sp_len
= IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
;
1964 hw
->max_tx_aggregation_subframes
= RSI_MAX_TX_AGGR_FRMS
;
1965 hw
->max_rx_aggregation_subframes
= RSI_MAX_RX_AGGR_FRMS
;
1966 hw
->rate_control_algorithm
= "AARF";
1968 SET_IEEE80211_PERM_ADDR(hw
, common
->mac_addr
);
1969 ether_addr_copy(hw
->wiphy
->addr_mask
, addr_mask
);
1971 wiphy
->interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
1972 BIT(NL80211_IFTYPE_AP
) |
1973 BIT(NL80211_IFTYPE_P2P_DEVICE
) |
1974 BIT(NL80211_IFTYPE_P2P_CLIENT
) |
1975 BIT(NL80211_IFTYPE_P2P_GO
);
1977 wiphy
->signal_type
= CFG80211_SIGNAL_TYPE_MBM
;
1978 wiphy
->retry_short
= RETRY_SHORT
;
1979 wiphy
->retry_long
= RETRY_LONG
;
1980 wiphy
->frag_threshold
= IEEE80211_MAX_FRAG_THRESHOLD
;
1981 wiphy
->rts_threshold
= IEEE80211_MAX_RTS_THRESHOLD
;
1984 wiphy
->available_antennas_rx
= 1;
1985 wiphy
->available_antennas_tx
= 1;
1987 rsi_register_rates_channels(adapter
, NL80211_BAND_2GHZ
);
1988 wiphy
->bands
[NL80211_BAND_2GHZ
] =
1989 &adapter
->sbands
[NL80211_BAND_2GHZ
];
1990 if (common
->num_supp_bands
> 1) {
1991 rsi_register_rates_channels(adapter
, NL80211_BAND_5GHZ
);
1992 wiphy
->bands
[NL80211_BAND_5GHZ
] =
1993 &adapter
->sbands
[NL80211_BAND_5GHZ
];
1997 wiphy
->max_ap_assoc_sta
= rsi_max_ap_stas
[common
->oper_mode
- 1];
1998 common
->max_stations
= wiphy
->max_ap_assoc_sta
;
1999 rsi_dbg(ERR_ZONE
, "Max Stations Allowed = %d\n", common
->max_stations
);
2000 hw
->sta_data_size
= sizeof(struct rsi_sta
);
2001 wiphy
->flags
= WIPHY_FLAG_REPORTS_OBSS
;
2002 wiphy
->flags
|= WIPHY_FLAG_AP_UAPSD
;
2003 wiphy
->features
|= NL80211_FEATURE_INACTIVITY_TIMER
;
2004 wiphy
->reg_notifier
= rsi_reg_notify
;
2007 wiphy
->wowlan
= &rsi_wowlan_support
;
2010 wiphy_ext_feature_set(wiphy
, NL80211_EXT_FEATURE_CQM_RSSI_LIST
);
2012 /* Wi-Fi direct parameters */
2013 wiphy
->flags
|= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL
;
2014 wiphy
->flags
|= WIPHY_FLAG_OFFCHAN_TX
;
2015 wiphy
->max_remain_on_channel_duration
= 10000;
2016 hw
->max_listen_interval
= 10;
2017 wiphy
->iface_combinations
= rsi_iface_combinations
;
2018 wiphy
->n_iface_combinations
= ARRAY_SIZE(rsi_iface_combinations
);
2020 if (common
->coex_mode
> 1)
2021 wiphy
->flags
|= WIPHY_FLAG_PS_ON_BY_DEFAULT
;
2023 status
= ieee80211_register_hw(hw
);
2027 return rsi_init_dbgfs(adapter
);