blob: cbe4de05d26b9a83d1beec9e72d427244f1552e7 [file] [log] [blame]
Larry Finger2865d422010-08-20 10:15:30 -05001/******************************************************************************
2 * os_intfs.c
3 *
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
22 *
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
26 *
27 ******************************************************************************/
28
29#define _OS_INTFS_C_
30
31#include <linux/module.h>
Larry Finger2865d422010-08-20 10:15:30 -050032#include <linux/kthread.h>
Larry Finger8c213fa592012-02-05 21:12:26 -060033#include <linux/firmware.h>
Larry Finger2865d422010-08-20 10:15:30 -050034#include "osdep_service.h"
35#include "drv_types.h"
36#include "xmit_osdep.h"
37#include "recv_osdep.h"
38#include "rtl871x_ioctl.h"
39#include "usb_osintf.h"
40
41MODULE_LICENSE("GPL");
42MODULE_DESCRIPTION("rtl871x wireless lan driver");
43MODULE_AUTHOR("Larry Finger");
44
45static char ifname[IFNAMSIZ] = "wlan%d";
46
47/* module param defaults */
48static int chip_version = RTL8712_2ndCUT;
49static int rfintfs = HWPI;
50static int lbkmode = RTL8712_AIR_TRX;
51static int hci = RTL8712_USB;
52static int ampdu_enable = 1;/*for enable tx_ampdu*/
53
Justin P. Mattockbe10ac22012-05-07 07:38:22 -070054/* The video_mode variable is for video mode.*/
Larry Finger2865d422010-08-20 10:15:30 -050055/* It may be specify when inserting module with video_mode=1 parameter.*/
56static int video_mode = 1; /* enable video mode*/
57
58/*Ndis802_11Infrastructure; infra, ad-hoc, auto*/
59static int network_mode = Ndis802_11IBSS;
60static int channel = 1;/*ad-hoc support requirement*/
61static int wireless_mode = WIRELESS_11BG;
62static int vrtl_carrier_sense = AUTO_VCS;
63static int vcs_type = RTS_CTS;
64static int frag_thresh = 2346;
65static int preamble = PREAMBLE_LONG;/*long, short, auto*/
66static int scan_mode = 1;/*active, passive*/
67static int adhoc_tx_pwr = 1;
68static int soft_ap;
69static int smart_ps = 1;
70static int power_mgnt = PS_MODE_ACTIVE;
71static int radio_enable = 1;
72static int long_retry_lmt = 7;
73static int short_retry_lmt = 7;
74static int busy_thresh = 40;
75static int ack_policy = NORMAL_ACK;
76static int mp_mode;
77static int software_encrypt;
78static int software_decrypt;
79
80static int wmm_enable;/* default is set to disable the wmm.*/
81static int uapsd_enable;
82static int uapsd_max_sp = NO_LIMIT;
83static int uapsd_acbk_en;
84static int uapsd_acbe_en;
85static int uapsd_acvi_en;
86static int uapsd_acvo_en;
87
88static int ht_enable = 1;
89static int cbw40_enable = 1;
90static int rf_config = RTL8712_RF_1T2R; /* 1T2R*/
91static int low_power;
92/* mac address to use instead of the one stored in Efuse */
93char *r8712_initmac;
94static char *initmac;
Larry Fingerd19b8642010-08-30 22:51:58 -050095/* if wifi_test = 1, driver will disable the turbo mode and pass it to
96 * firmware private.
97 */
Devendra Nagae1656642012-09-23 12:57:21 -040098static int wifi_test;
Larry Finger2865d422010-08-20 10:15:30 -050099
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100100module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO | S_IWUSR);
Larry Fingerd19b8642010-08-30 22:51:58 -0500101module_param(wifi_test, int, 0644);
Larry Finger2865d422010-08-20 10:15:30 -0500102module_param(initmac, charp, 0644);
103module_param(video_mode, int, 0644);
104module_param(chip_version, int, 0644);
105module_param(rfintfs, int, 0644);
106module_param(lbkmode, int, 0644);
107module_param(hci, int, 0644);
108module_param(network_mode, int, 0644);
109module_param(channel, int, 0644);
110module_param(mp_mode, int, 0644);
111module_param(wmm_enable, int, 0644);
112module_param(vrtl_carrier_sense, int, 0644);
113module_param(vcs_type, int, 0644);
114module_param(busy_thresh, int, 0644);
115module_param(ht_enable, int, 0644);
116module_param(cbw40_enable, int, 0644);
117module_param(ampdu_enable, int, 0644);
118module_param(rf_config, int, 0644);
119module_param(power_mgnt, int, 0644);
120module_param(low_power, int, 0644);
121
122MODULE_PARM_DESC(ifname, " Net interface name, wlan%d=default");
123MODULE_PARM_DESC(initmac, "MAC-Address, default: use FUSE");
124
Larry Finger2865d422010-08-20 10:15:30 -0500125static int netdev_open(struct net_device *pnetdev);
126static int netdev_close(struct net_device *pnetdev);
127
Luca Ceresoli73b42762015-05-19 11:35:19 +0200128static void loadparam(struct _adapter *padapter, struct net_device *pnetdev)
Larry Finger2865d422010-08-20 10:15:30 -0500129{
Larry Finger2865d422010-08-20 10:15:30 -0500130 struct registry_priv *registry_par = &padapter->registrypriv;
131
132 registry_par->chip_version = (u8)chip_version;
133 registry_par->rfintfs = (u8)rfintfs;
134 registry_par->lbkmode = (u8)lbkmode;
135 registry_par->hci = (u8)hci;
136 registry_par->network_mode = (u8)network_mode;
137 memcpy(registry_par->ssid.Ssid, "ANY", 3);
138 registry_par->ssid.SsidLength = 3;
139 registry_par->channel = (u8)channel;
140 registry_par->wireless_mode = (u8)wireless_mode;
Thomas Cort77e73e82013-10-01 11:26:55 -0400141 registry_par->vrtl_carrier_sense = (u8)vrtl_carrier_sense;
Larry Finger2865d422010-08-20 10:15:30 -0500142 registry_par->vcs_type = (u8)vcs_type;
143 registry_par->frag_thresh = (u16)frag_thresh;
144 registry_par->preamble = (u8)preamble;
145 registry_par->scan_mode = (u8)scan_mode;
146 registry_par->adhoc_tx_pwr = (u8)adhoc_tx_pwr;
147 registry_par->soft_ap = (u8)soft_ap;
148 registry_par->smart_ps = (u8)smart_ps;
149 registry_par->power_mgnt = (u8)power_mgnt;
150 registry_par->radio_enable = (u8)radio_enable;
151 registry_par->long_retry_lmt = (u8)long_retry_lmt;
152 registry_par->short_retry_lmt = (u8)short_retry_lmt;
153 registry_par->busy_thresh = (u16)busy_thresh;
154 registry_par->ack_policy = (u8)ack_policy;
155 registry_par->mp_mode = (u8)mp_mode;
156 registry_par->software_encrypt = (u8)software_encrypt;
157 registry_par->software_decrypt = (u8)software_decrypt;
158 /*UAPSD*/
159 registry_par->wmm_enable = (u8)wmm_enable;
160 registry_par->uapsd_enable = (u8)uapsd_enable;
161 registry_par->uapsd_max_sp = (u8)uapsd_max_sp;
162 registry_par->uapsd_acbk_en = (u8)uapsd_acbk_en;
163 registry_par->uapsd_acbe_en = (u8)uapsd_acbe_en;
164 registry_par->uapsd_acvi_en = (u8)uapsd_acvi_en;
165 registry_par->uapsd_acvo_en = (u8)uapsd_acvo_en;
166 registry_par->ht_enable = (u8)ht_enable;
167 registry_par->cbw40_enable = (u8)cbw40_enable;
168 registry_par->ampdu_enable = (u8)ampdu_enable;
169 registry_par->rf_config = (u8)rf_config;
170 registry_par->low_power = (u8)low_power;
Larry Fingerd19b8642010-08-30 22:51:58 -0500171 registry_par->wifi_test = (u8) wifi_test;
Larry Finger2865d422010-08-20 10:15:30 -0500172 r8712_initmac = initmac;
Larry Finger2865d422010-08-20 10:15:30 -0500173}
174
175static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
176{
Julia Lawall8f47c282015-03-29 14:54:12 +0200177 struct _adapter *padapter = netdev_priv(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500178 struct sockaddr *addr = p;
179
Luis de Bethencourt1ca96882015-10-19 18:14:29 +0100180 if (!padapter->bup)
Jagan Teki71d667b2015-05-18 22:02:45 +0530181 ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
Larry Finger2865d422010-08-20 10:15:30 -0500182 return 0;
183}
184
185static struct net_device_stats *r871x_net_get_stats(struct net_device *pnetdev)
186{
Julia Lawall8f47c282015-03-29 14:54:12 +0200187 struct _adapter *padapter = netdev_priv(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500188 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
189 struct recv_priv *precvpriv = &(padapter->recvpriv);
190
191 padapter->stats.tx_packets = pxmitpriv->tx_pkts;
192 padapter->stats.rx_packets = precvpriv->rx_pkts;
193 padapter->stats.tx_dropped = pxmitpriv->tx_drop;
194 padapter->stats.rx_dropped = precvpriv->rx_drop;
195 padapter->stats.tx_bytes = pxmitpriv->tx_bytes;
196 padapter->stats.rx_bytes = precvpriv->rx_bytes;
197 return &padapter->stats;
198}
199
200static const struct net_device_ops rtl8712_netdev_ops = {
201 .ndo_open = netdev_open,
202 .ndo_stop = netdev_close,
203 .ndo_start_xmit = r8712_xmit_entry,
204 .ndo_set_mac_address = r871x_net_set_mac_address,
205 .ndo_get_stats = r871x_net_get_stats,
206 .ndo_do_ioctl = r871x_ioctl,
207};
208
209struct net_device *r8712_init_netdev(void)
210{
211 struct _adapter *padapter;
212 struct net_device *pnetdev;
213
214 pnetdev = alloc_etherdev(sizeof(struct _adapter));
215 if (!pnetdev)
216 return NULL;
217 if (dev_alloc_name(pnetdev, ifname) < 0) {
218 strcpy(ifname, "wlan%d");
219 dev_alloc_name(pnetdev, ifname);
220 }
Julia Lawall8f47c282015-03-29 14:54:12 +0200221 padapter = netdev_priv(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500222 padapter->pnetdev = pnetdev;
Przemo Firszt87a573a2012-12-10 23:21:21 +0000223 pr_info("r8712u: register rtl8712_netdev_ops to netdev_ops\n");
Larry Finger2865d422010-08-20 10:15:30 -0500224 pnetdev->netdev_ops = &rtl8712_netdev_ops;
225 pnetdev->watchdog_timeo = HZ; /* 1 second timeout */
226 pnetdev->wireless_handlers = (struct iw_handler_def *)
227 &r871x_handlers_def;
Larry Finger2865d422010-08-20 10:15:30 -0500228 loadparam(padapter, pnetdev);
229 netif_carrier_off(pnetdev);
230 padapter->pid = 0; /* Initial the PID value used for HW PBC.*/
231 return pnetdev;
232}
233
234static u32 start_drv_threads(struct _adapter *padapter)
235{
Kees Cookf1701682013-07-03 15:04:58 -0700236 padapter->cmdThread = kthread_run(r8712_cmd_thread, padapter, "%s",
Larry Finger2865d422010-08-20 10:15:30 -0500237 padapter->pnetdev->name);
Dan Carpenterb16aad32014-03-05 11:43:19 +0300238 if (IS_ERR(padapter->cmdThread))
Larry Finger2865d422010-08-20 10:15:30 -0500239 return _FAIL;
240 return _SUCCESS;
241}
242
243void r8712_stop_drv_threads(struct _adapter *padapter)
244{
Justin P. Mattockbe10ac22012-05-07 07:38:22 -0700245 /*Below is to terminate r8712_cmd_thread & event_thread...*/
Binoy Jayan0f890542016-06-02 09:54:07 +0530246 complete(&padapter->cmdpriv.cmd_queue_comp);
Larry Finger2865d422010-08-20 10:15:30 -0500247 if (padapter->cmdThread)
Binoy Jayan204a8ac2016-06-02 09:54:08 +0530248 wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp);
Larry Finger2865d422010-08-20 10:15:30 -0500249 padapter->cmdpriv.cmd_seq = 1;
250}
251
252static void start_drv_timers(struct _adapter *padapter)
253{
Vaishali Thakkarc703c752015-02-27 23:25:48 +0530254 mod_timer(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
255 jiffies + msecs_to_jiffies(5000));
256 mod_timer(&padapter->mlmepriv.wdg_timer,
257 jiffies + msecs_to_jiffies(2000));
Larry Finger2865d422010-08-20 10:15:30 -0500258}
259
Ali Bahar6c19d862011-09-04 03:14:14 +0800260void r8712_stop_drv_timers(struct _adapter *padapter)
Larry Finger2865d422010-08-20 10:15:30 -0500261{
Vaishali Thakkar6501c8e2015-03-06 16:23:35 +0530262 del_timer_sync(&padapter->mlmepriv.assoc_timer);
263 del_timer_sync(&padapter->securitypriv.tkip_timer);
264 del_timer_sync(&padapter->mlmepriv.scan_to_timer);
265 del_timer_sync(&padapter->mlmepriv.dhcp_timer);
266 del_timer_sync(&padapter->mlmepriv.wdg_timer);
267 del_timer_sync(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer);
Larry Finger2865d422010-08-20 10:15:30 -0500268}
269
270static u8 init_default_value(struct _adapter *padapter)
271{
Larry Finger2865d422010-08-20 10:15:30 -0500272 struct registry_priv *pregistrypriv = &padapter->registrypriv;
273 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
274 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
275 struct security_priv *psecuritypriv = &padapter->securitypriv;
276
277 /*xmit_priv*/
278 pxmitpriv->vcs_setting = pregistrypriv->vrtl_carrier_sense;
279 pxmitpriv->vcs = pregistrypriv->vcs_type;
280 pxmitpriv->vcs_type = pregistrypriv->vcs_type;
281 pxmitpriv->rts_thresh = pregistrypriv->rts_thresh;
282 pxmitpriv->frag_len = pregistrypriv->frag_thresh;
Ali Baharee5b1aa2011-09-04 03:14:21 +0800283 /* mlme_priv */
284 /* Maybe someday we should rename this variable to "active_mode"(Jeff)*/
285 pmlmepriv->passive_mode = 1; /* 1: active, 0: passive. */
Larry Finger2865d422010-08-20 10:15:30 -0500286 /*ht_priv*/
287 {
288 int i;
289 struct ht_priv *phtpriv = &pmlmepriv->htpriv;
290
291 phtpriv->ampdu_enable = false;/*set to disabled*/
292 for (i = 0; i < 16; i++)
293 phtpriv->baddbareq_issued[i] = false;
294 }
295 /*security_priv*/
296 psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt;
297 psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt;
298 psecuritypriv->binstallGrpkey = _FAIL;
299 /*pwrctrl_priv*/
300 /*registry_priv*/
301 r8712_init_registrypriv_dev_network(padapter);
302 r8712_update_registrypriv_dev_network(padapter);
303 /*misc.*/
Joseph Bischaf090542016-02-14 16:57:27 -0500304 return _SUCCESS;
Larry Finger2865d422010-08-20 10:15:30 -0500305}
306
307u8 r8712_init_drv_sw(struct _adapter *padapter)
308{
309 if ((r8712_init_cmd_priv(&padapter->cmdpriv)) == _FAIL)
310 return _FAIL;
311 padapter->cmdpriv.padapter = padapter;
312 if ((r8712_init_evt_priv(&padapter->evtpriv)) == _FAIL)
313 return _FAIL;
314 if (r8712_init_mlme_priv(padapter) == _FAIL)
315 return _FAIL;
316 _r8712_init_xmit_priv(&padapter->xmitpriv, padapter);
317 _r8712_init_recv_priv(&padapter->recvpriv, padapter);
318 memset((unsigned char *)&padapter->securitypriv, 0,
319 sizeof(struct security_priv));
Vaishali Thakkare922df72015-03-03 22:34:22 +0530320 setup_timer(&padapter->securitypriv.tkip_timer,
321 r8712_use_tkipkey_handler, (unsigned long)padapter);
Larry Finger2865d422010-08-20 10:15:30 -0500322 _r8712_init_sta_priv(&padapter->stapriv);
323 padapter->stapriv.padapter = padapter;
324 r8712_init_bcmc_stainfo(padapter);
325 r8712_init_pwrctrl_priv(padapter);
Larry Finger2865d422010-08-20 10:15:30 -0500326 mp871xinit(padapter);
327 if (init_default_value(padapter) != _SUCCESS)
328 return _FAIL;
329 r8712_InitSwLeds(padapter);
330 return _SUCCESS;
331}
332
333u8 r8712_free_drv_sw(struct _adapter *padapter)
334{
Shivani Bhardwajadc6b372015-10-14 17:32:58 +0530335 struct net_device *pnetdev = padapter->pnetdev;
Larry Finger2865d422010-08-20 10:15:30 -0500336
337 r8712_free_cmd_priv(&padapter->cmdpriv);
338 r8712_free_evt_priv(&padapter->evtpriv);
339 r8712_DeInitSwLeds(padapter);
340 r8712_free_mlme_priv(&padapter->mlmepriv);
341 r8712_free_io_queue(padapter);
342 _free_xmit_priv(&padapter->xmitpriv);
Thomas Vegas22649bb2014-06-01 14:34:40 +0200343 _r8712_free_sta_priv(&padapter->stapriv);
Larry Finger2865d422010-08-20 10:15:30 -0500344 _r8712_free_recv_priv(&padapter->recvpriv);
345 mp871xdeinit(padapter);
346 if (pnetdev)
Ali Bahar7bcd9ce2011-09-04 03:14:06 +0800347 free_netdev(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500348 return _SUCCESS;
349}
350
351
352static void enable_video_mode(struct _adapter *padapter, int cbw40_value)
353{
354 /* bit 8:
355 * 1 -> enable video mode to 96B AP
356 * 0 -> disable video mode to 96B AP
357 * bit 9:
358 * 1 -> enable 40MHz mode
359 * 0 -> disable 40MHz mode
360 * bit 10:
361 * 1 -> enable STBC
362 * 0 -> disable STBC
363 */
364 u32 intcmd = 0xf4000500; /* enable bit8, bit10*/
365
366 if (cbw40_value) {
367 /* if the driver supports the 40M bandwidth,
Punit Vara852681e2015-10-08 01:25:18 +0530368 * we can enable the bit 9.
369 */
Larry Finger2865d422010-08-20 10:15:30 -0500370 intcmd |= 0x200;
371 }
372 r8712_fw_cmd(padapter, intcmd);
373}
374
Ali Bahara5ee6522011-07-12 23:10:56 +0800375/**
376 *
377 * This function intends to handle the activation of an interface
378 * i.e. when it is brought Up/Active from a Down state.
379 *
380 */
Larry Finger2865d422010-08-20 10:15:30 -0500381static int netdev_open(struct net_device *pnetdev)
382{
Julia Lawall8f47c282015-03-29 14:54:12 +0200383 struct _adapter *padapter = netdev_priv(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500384
Larry Finger8c213fa592012-02-05 21:12:26 -0600385 mutex_lock(&padapter->mutex_start);
Luis de Bethencourt1ca96882015-10-19 18:14:29 +0100386 if (!padapter->bup) {
Larry Finger2865d422010-08-20 10:15:30 -0500387 padapter->bDriverStopped = false;
388 padapter->bSurpriseRemoved = false;
389 padapter->bup = true;
390 if (rtl871x_hal_init(padapter) != _SUCCESS)
391 goto netdev_open_error;
Bhaktipriya Shridharb7af4e62016-03-21 01:23:17 +0530392 if (!r8712_initmac)
Larry Finger2865d422010-08-20 10:15:30 -0500393 /* Use the mac address stored in the Efuse */
394 memcpy(pnetdev->dev_addr,
395 padapter->eeprompriv.mac_addr, ETH_ALEN);
396 else {
397 /* We have to inform f/w to use user-supplied MAC
398 * address.
399 */
400 msleep(200);
401 r8712_setMacAddr_cmd(padapter, (u8 *)pnetdev->dev_addr);
402 /*
403 * The "myid" function will get the wifi mac address
404 * from eeprompriv structure instead of netdev
405 * structure. So, we have to overwrite the mac_addr
406 * stored in the eeprompriv structure. In this case,
407 * the real mac address won't be used anymore. So that,
408 * the eeprompriv.mac_addr should store the mac which
409 * users specify.
410 */
411 memcpy(padapter->eeprompriv.mac_addr,
412 pnetdev->dev_addr, ETH_ALEN);
413 }
414 if (start_drv_threads(padapter) != _SUCCESS)
415 goto netdev_open_error;
Bhaktipriya Shridharb7af4e62016-03-21 01:23:17 +0530416 if (!padapter->dvobjpriv.inirp_init)
Larry Finger2865d422010-08-20 10:15:30 -0500417 goto netdev_open_error;
418 else
419 padapter->dvobjpriv.inirp_init(padapter);
420 r8712_set_ps_mode(padapter, padapter->registrypriv.power_mgnt,
421 padapter->registrypriv.smart_ps);
422 }
423 if (!netif_queue_stopped(pnetdev))
424 netif_start_queue(pnetdev);
425 else
426 netif_wake_queue(pnetdev);
427
Louie Lu8f8064e2016-09-02 18:15:07 +0800428 if (video_mode)
Larry Finger2865d422010-08-20 10:15:30 -0500429 enable_video_mode(padapter, cbw40_enable);
430 /* start driver mlme relation timer */
431 start_drv_timers(padapter);
432 padapter->ledpriv.LedControlHandler(padapter, LED_CTL_NO_LINK);
Larry Finger8c213fa592012-02-05 21:12:26 -0600433 mutex_unlock(&padapter->mutex_start);
Larry Finger2865d422010-08-20 10:15:30 -0500434 return 0;
435netdev_open_error:
436 padapter->bup = false;
437 netif_carrier_off(pnetdev);
438 netif_stop_queue(pnetdev);
Larry Finger8c213fa592012-02-05 21:12:26 -0600439 mutex_unlock(&padapter->mutex_start);
Larry Finger2865d422010-08-20 10:15:30 -0500440 return -1;
441}
442
Ali Bahara5ee6522011-07-12 23:10:56 +0800443/**
444 *
445 * This function intends to handle the shutdown of an interface
446 * i.e. when it is brought Down from an Up/Active state.
447 *
448 */
Larry Finger2865d422010-08-20 10:15:30 -0500449static int netdev_close(struct net_device *pnetdev)
450{
Julia Lawall8f47c282015-03-29 14:54:12 +0200451 struct _adapter *padapter = netdev_priv(pnetdev);
Larry Finger2865d422010-08-20 10:15:30 -0500452
453 /* Close LED*/
454 padapter->ledpriv.LedControlHandler(padapter, LED_CTL_POWER_OFF);
455 msleep(200);
456
457 /*s1.*/
458 if (pnetdev) {
459 if (!netif_queue_stopped(pnetdev))
460 netif_stop_queue(pnetdev);
461 }
462 /*s2.*/
463 /*s2-1. issue disassoc_cmd to fw*/
464 r8712_disassoc_cmd(padapter);
465 /*s2-2. indicate disconnect to os*/
466 r8712_ind_disconnect(padapter);
467 /*s2-3.*/
468 r8712_free_assoc_resources(padapter);
469 /*s2-4.*/
470 r8712_free_network_queue(padapter);
Larry Finger2865d422010-08-20 10:15:30 -0500471 return 0;
472}
473
474#include "mlme_osdep.h"