blob: 13c018340ff2710f85d97cb906937080547cb578 [file] [log] [blame]
Larry Finger2865d422010-08-20 10:15:30 -05001/******************************************************************************
2 * rtl8712_cmd.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 _RTL8712_CMD_C_
30
Ali Bahar359140a2011-09-04 03:14:11 +080031#include <linux/compiler.h>
32#include <linux/kernel.h>
33#include <linux/errno.h>
Ali Bahar359140a2011-09-04 03:14:11 +080034#include <linux/slab.h>
35#include <linux/module.h>
36#include <linux/kref.h>
37#include <linux/netdevice.h>
38#include <linux/skbuff.h>
39#include <linux/usb.h>
40#include <linux/usb/ch9.h>
41#include <linux/circ_buf.h>
42#include <linux/uaccess.h>
43#include <asm/byteorder.h>
44#include <linux/atomic.h>
45#include <linux/semaphore.h>
46#include <linux/rtnetlink.h>
47
Larry Finger2865d422010-08-20 10:15:30 -050048#include "osdep_service.h"
49#include "drv_types.h"
50#include "recv_osdep.h"
51#include "mlme_osdep.h"
Larry Finger2865d422010-08-20 10:15:30 -050052#include "rtl871x_ioctl_set.h"
53
54static void check_hw_pbc(struct _adapter *padapter)
55{
56 u8 tmp1byte;
57
58 r8712_write8(padapter, MAC_PINMUX_CTRL, (GPIOMUX_EN | GPIOSEL_GPIO));
59 tmp1byte = r8712_read8(padapter, GPIO_IO_SEL);
60 tmp1byte &= ~(HAL_8192S_HW_GPIO_WPS_BIT);
61 r8712_write8(padapter, GPIO_IO_SEL, tmp1byte);
62 tmp1byte = r8712_read8(padapter, GPIO_CTRL);
63 if (tmp1byte == 0xff)
Thomas Cort77e73e82013-10-01 11:26:55 -040064 return;
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +010065 if (tmp1byte & HAL_8192S_HW_GPIO_WPS_BIT) {
Larry Finger2865d422010-08-20 10:15:30 -050066 /* Here we only set bPbcPressed to true
Punit Varaed9c8382015-10-08 01:25:20 +053067 * After trigger PBC, the variable will be set to false
68 */
Larry Finger2865d422010-08-20 10:15:30 -050069 DBG_8712("CheckPbcGPIO - PBC is pressed !!!!\n");
70 /* 0 is the default value and it means the application monitors
Punit Varaed9c8382015-10-08 01:25:20 +053071 * the HW PBC doesn't provide its pid to driver.
72 */
Larry Finger2865d422010-08-20 10:15:30 -050073 if (padapter->pid == 0)
74 return;
75 kill_pid(find_vpid(padapter->pid), SIGUSR1, 1);
76 }
77}
78
79/* query rx phy status from fw.
80 * Adhoc mode: beacon.
Punit Varaed9c8382015-10-08 01:25:20 +053081 * Infrastructure mode: beacon , data.
82 */
Larry Finger2865d422010-08-20 10:15:30 -050083static void query_fw_rx_phy_status(struct _adapter *padapter)
84{
85 u32 val32 = 0;
86 int pollingcnts = 50;
87
Luis de Bethencourt1ca96882015-10-19 18:14:29 +010088 if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
Larry Finger2865d422010-08-20 10:15:30 -050089 r8712_write32(padapter, IOCMD_CTRL_REG, 0xf4000001);
90 msleep(100);
91 /* Wait FW complete IO Cmd */
92 while ((r8712_read32(padapter, IOCMD_CTRL_REG)) &&
93 (pollingcnts > 0)) {
94 pollingcnts--;
95 msleep(20);
96 }
97 if (pollingcnts != 0)
98 val32 = r8712_read32(padapter, IOCMD_DATA_REG);
99 else /* time out */
100 val32 = 0;
Aya Mahfouzae52e522015-02-26 11:38:12 +0200101 val32 >>= 4;
Larry Finger2865d422010-08-20 10:15:30 -0500102 padapter->recvpriv.fw_rssi =
103 (u8)r8712_signal_scale_mapping(val32);
104 }
105}
106
107/* check mlme, hw, phy, or dynamic algorithm status. */
108static void StatusWatchdogCallback(struct _adapter *padapter)
109{
110 check_hw_pbc(padapter);
111 query_fw_rx_phy_status(padapter);
112}
113
114static void r871x_internal_cmd_hdl(struct _adapter *padapter, u8 *pbuf)
115{
116 struct drvint_cmd_parm *pdrvcmd;
117
118 if (!pbuf)
119 return;
120 pdrvcmd = (struct drvint_cmd_parm *)pbuf;
121 switch (pdrvcmd->i_cid) {
122 case WDG_WK_CID:
123 StatusWatchdogCallback(padapter);
124 break;
125 default:
126 break;
127 }
128 kfree(pdrvcmd->pbuf);
129}
130
131static u8 read_macreg_hdl(struct _adapter *padapter, u8 *pbuf)
132{
133 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
134 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
135
136 /* invoke cmd->callback function */
137 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300138 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500139 r8712_free_cmd_obj(pcmd);
140 else
141 pcmd_callback(padapter, pcmd);
142 return H2C_SUCCESS;
143}
144
145static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf)
146{
147 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
148 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
149
150 /* invoke cmd->callback function */
151 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300152 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500153 r8712_free_cmd_obj(pcmd);
154 else
155 pcmd_callback(padapter, pcmd);
156 return H2C_SUCCESS;
157}
158
159static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
160{
161 u32 val;
162 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
Larry Finger2865d422010-08-20 10:15:30 -0500163 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
164
Larry Finger2865d422010-08-20 10:15:30 -0500165 if (pcmd->rsp && pcmd->rspsz > 0)
166 memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);
167 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300168 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500169 r8712_free_cmd_obj(pcmd);
170 else
171 pcmd_callback(padapter, pcmd);
172 return H2C_SUCCESS;
173}
174
175static u8 write_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
176{
177 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
Larry Finger2865d422010-08-20 10:15:30 -0500178 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
179
Larry Finger2865d422010-08-20 10:15:30 -0500180 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300181 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500182 r8712_free_cmd_obj(pcmd);
183 else
184 pcmd_callback(padapter, pcmd);
185 return H2C_SUCCESS;
186}
187
188static u8 read_rfreg_hdl(struct _adapter *padapter, u8 *pbuf)
189{
190 u32 val;
191 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
Larry Finger2865d422010-08-20 10:15:30 -0500192 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
193
Larry Finger2865d422010-08-20 10:15:30 -0500194 if (pcmd->rsp && pcmd->rspsz > 0)
195 memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);
196 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300197 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500198 r8712_free_cmd_obj(pcmd);
199 else
200 pcmd_callback(padapter, pcmd);
201 return H2C_SUCCESS;
202}
203
204static u8 write_rfreg_hdl(struct _adapter *padapter, u8 *pbuf)
205{
206 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
Larry Finger2865d422010-08-20 10:15:30 -0500207 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
208
Larry Finger2865d422010-08-20 10:15:30 -0500209 pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300210 if (!pcmd_callback)
Larry Finger2865d422010-08-20 10:15:30 -0500211 r8712_free_cmd_obj(pcmd);
212 else
213 pcmd_callback(padapter, pcmd);
214 return H2C_SUCCESS;
215}
216
217static u8 sys_suspend_hdl(struct _adapter *padapter, u8 *pbuf)
218{
219 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
Larry Finger2865d422010-08-20 10:15:30 -0500220
Larry Finger2865d422010-08-20 10:15:30 -0500221 r8712_free_cmd_obj(pcmd);
222 return H2C_SUCCESS;
223}
224
225static struct cmd_obj *cmd_hdl_filter(struct _adapter *padapter,
226 struct cmd_obj *pcmd)
227{
228 struct cmd_obj *pcmd_r;
229
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300230 if (!pcmd)
Larry Finger2865d422010-08-20 10:15:30 -0500231 return pcmd;
232 pcmd_r = NULL;
233
234 switch (pcmd->cmdcode) {
235 case GEN_CMD_CODE(_Read_MACREG):
236 read_macreg_hdl(padapter, (u8 *)pcmd);
237 pcmd_r = pcmd;
238 break;
239 case GEN_CMD_CODE(_Write_MACREG):
240 write_macreg_hdl(padapter, (u8 *)pcmd);
241 pcmd_r = pcmd;
242 break;
243 case GEN_CMD_CODE(_Read_BBREG):
244 read_bbreg_hdl(padapter, (u8 *)pcmd);
245 break;
246 case GEN_CMD_CODE(_Write_BBREG):
247 write_bbreg_hdl(padapter, (u8 *)pcmd);
248 break;
249 case GEN_CMD_CODE(_Read_RFREG):
250 read_rfreg_hdl(padapter, (u8 *)pcmd);
251 break;
252 case GEN_CMD_CODE(_Write_RFREG):
253 write_rfreg_hdl(padapter, (u8 *)pcmd);
254 break;
255 case GEN_CMD_CODE(_SetUsbSuspend):
256 sys_suspend_hdl(padapter, (u8 *)pcmd);
257 break;
258 case GEN_CMD_CODE(_JoinBss):
259 r8712_joinbss_reset(padapter);
260 /* Before set JoinBss_CMD to FW, driver must ensure FW is in
261 * PS_MODE_ACTIVE. Directly write rpwm to radio on and assign
262 * new pwr_mode to Driver, instead of use workitem to change
Punit Varaed9c8382015-10-08 01:25:20 +0530263 * state.
264 */
Larry Finger2865d422010-08-20 10:15:30 -0500265 if (padapter->pwrctrlpriv.pwr_mode > PS_MODE_ACTIVE) {
266 padapter->pwrctrlpriv.pwr_mode = PS_MODE_ACTIVE;
267 _enter_pwrlock(&(padapter->pwrctrlpriv.lock));
268 r8712_set_rpwm(padapter, PS_STATE_S4);
269 up(&(padapter->pwrctrlpriv.lock));
270 }
271 pcmd_r = pcmd;
272 break;
273 case _DRV_INT_CMD_:
274 r871x_internal_cmd_hdl(padapter, pcmd->parmbuf);
275 r8712_free_cmd_obj(pcmd);
276 pcmd_r = NULL;
277 break;
278 default:
279 pcmd_r = pcmd;
280 break;
281 }
282 return pcmd_r; /* if returning pcmd_r == NULL, pcmd must be free. */
283}
284
285static u8 check_cmd_fifo(struct _adapter *padapter, uint sz)
286{
Peter Senna Tschudin8ffca9e2014-05-20 12:33:41 +0200287 return _SUCCESS;
Larry Finger2865d422010-08-20 10:15:30 -0500288}
289
290u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd)
291{
292 int pollingcnts = 50;
293
294 r8712_write32(pAdapter, IOCMD_CTRL_REG, cmd);
295 msleep(100);
Rakhi Sharma97e2ba92016-01-29 12:37:06 +0530296 while ((r8712_read32(pAdapter, IOCMD_CTRL_REG != 0)) &&
Larry Finger2865d422010-08-20 10:15:30 -0500297 (pollingcnts > 0)) {
298 pollingcnts--;
299 msleep(20);
300 }
301 if (pollingcnts == 0)
302 return false;
303 return true;
304}
305
306void r8712_fw_cmd_data(struct _adapter *pAdapter, u32 *value, u8 flag)
307{
308 if (flag == 0) /* set */
309 r8712_write32(pAdapter, IOCMD_DATA_REG, *value);
310 else /* query */
311 *value = r8712_read32(pAdapter, IOCMD_DATA_REG);
312}
313
314int r8712_cmd_thread(void *context)
315{
316 struct cmd_obj *pcmd;
Sudip Mukherjeee29d3eb2014-10-27 17:42:25 +0530317 unsigned int cmdsz, wr_sz, *pcmdbuf;
Larry Finger2865d422010-08-20 10:15:30 -0500318 struct tx_desc *pdesc;
319 void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
Bhaktipriya Shridhar56238e42016-02-21 12:51:32 +0530320 struct _adapter *padapter = context;
Larry Finger2865d422010-08-20 10:15:30 -0500321 struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
322
James A Shacklefordfee51242014-07-09 15:26:23 -0400323 allow_signal(SIGTERM);
Larry Finger2865d422010-08-20 10:15:30 -0500324 while (1) {
325 if ((_down_sema(&(pcmdpriv->cmd_queue_sema))) == _FAIL)
326 break;
Luis de Bethencourt1ca96882015-10-19 18:14:29 +0100327 if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
Larry Finger2865d422010-08-20 10:15:30 -0500328 break;
329 if (r8712_register_cmd_alive(padapter) != _SUCCESS)
330 continue;
331_next:
332 pcmd = r8712_dequeue_cmd(&(pcmdpriv->cmd_queue));
333 if (!(pcmd)) {
334 r8712_unregister_cmd_alive(padapter);
335 continue;
336 }
337 pcmdbuf = (unsigned int *)pcmdpriv->cmd_buf;
Larry Finger2865d422010-08-20 10:15:30 -0500338 pdesc = (struct tx_desc *)pcmdbuf;
339 memset(pdesc, 0, TXDESC_SIZE);
340 pcmd = cmd_hdl_filter(padapter, pcmd);
341 if (pcmd) { /* if pcmd != NULL, cmd will be handled by f/w */
Shivani Bhardwajadc08cc2015-10-14 17:38:23 +0530342 struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
Larry Finger2865d422010-08-20 10:15:30 -0500343 u8 blnPending = 0;
Tapasweni Pathak02a29d22014-09-24 16:34:56 +0530344
Larry Finger2865d422010-08-20 10:15:30 -0500345 pcmdpriv->cmd_issued_cnt++;
James A Shacklefordd913e542014-06-22 20:27:55 -0400346 cmdsz = round_up(pcmd->cmdsz, 8);
Larry Finger2865d422010-08-20 10:15:30 -0500347 wr_sz = TXDESC_SIZE + 8 + cmdsz;
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100348 pdesc->txdw0 |= cpu_to_le32((wr_sz - TXDESC_SIZE) &
Larry Finger2865d422010-08-20 10:15:30 -0500349 0x0000ffff);
350 if (pdvobj->ishighspeed) {
351 if ((wr_sz % 512) == 0)
352 blnPending = 1;
353 } else {
354 if ((wr_sz % 64) == 0)
355 blnPending = 1;
356 }
357 if (blnPending) /* 32 bytes for TX Desc - 8 offset */
358 pdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE +
359 OFFSET_SZ + 8) << OFFSET_SHT) &
360 0x00ff0000);
361 else {
362 pdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE +
363 OFFSET_SZ) <<
364 OFFSET_SHT) &
365 0x00ff0000);
366 }
367 pdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
368 pdesc->txdw1 |= cpu_to_le32((0x13 << QSEL_SHT) &
369 0x00001f00);
370 pcmdbuf += (TXDESC_SIZE >> 2);
371 *pcmdbuf = cpu_to_le32((cmdsz & 0x0000ffff) |
372 (pcmd->cmdcode << 16) |
373 (pcmdpriv->cmd_seq << 24));
Thomas Cort77e73e82013-10-01 11:26:55 -0400374 pcmdbuf += 2; /* 8 bytes alignment */
Larry Finger2865d422010-08-20 10:15:30 -0500375 memcpy((u8 *)pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
376 while (check_cmd_fifo(padapter, wr_sz) == _FAIL) {
Luis de Bethencourt1ca96882015-10-19 18:14:29 +0100377 if (padapter->bDriverStopped ||
378 padapter->bSurpriseRemoved)
Larry Finger2865d422010-08-20 10:15:30 -0500379 break;
380 msleep(100);
381 continue;
382 }
383 if (blnPending)
384 wr_sz += 8; /* Append 8 bytes */
385 r8712_write_mem(padapter, RTL8712_DMA_H2CCMD, wr_sz,
386 (u8 *)pdesc);
387 pcmdpriv->cmd_seq++;
388 if (pcmd->cmdcode == GEN_CMD_CODE(_CreateBss)) {
389 pcmd->res = H2C_SUCCESS;
390 pcmd_callback = cmd_callback[pcmd->
391 cmdcode].callback;
392 if (pcmd_callback)
393 pcmd_callback(padapter, pcmd);
394 continue;
395 }
396 if (pcmd->cmdcode == GEN_CMD_CODE(_SetPwrMode)) {
397 if (padapter->pwrctrlpriv.bSleep) {
398 _enter_pwrlock(&(padapter->
399 pwrctrlpriv.lock));
400 r8712_set_rpwm(padapter, PS_STATE_S2);
401 up(&padapter->pwrctrlpriv.lock);
402 }
403 }
404 r8712_free_cmd_obj(pcmd);
James A Shackleforddf353f62014-06-24 22:52:40 -0400405 if (list_empty(&pcmdpriv->cmd_queue.queue)) {
Larry Finger2865d422010-08-20 10:15:30 -0500406 r8712_unregister_cmd_alive(padapter);
407 continue;
Luis de Bethencourt168a2c12015-10-19 18:15:29 +0100408 } else {
Larry Finger2865d422010-08-20 10:15:30 -0500409 goto _next;
Luis de Bethencourt168a2c12015-10-19 18:15:29 +0100410 }
411 } else {
Larry Finger2865d422010-08-20 10:15:30 -0500412 goto _next;
Luis de Bethencourt168a2c12015-10-19 18:15:29 +0100413 }
Larry Finger2865d422010-08-20 10:15:30 -0500414 flush_signals_thread();
415 }
416 /* free all cmd_obj resources */
417 do {
418 pcmd = r8712_dequeue_cmd(&(pcmdpriv->cmd_queue));
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300419 if (!pcmd)
Larry Finger2865d422010-08-20 10:15:30 -0500420 break;
421 r8712_free_cmd_obj(pcmd);
422 } while (1);
423 up(&pcmdpriv->terminate_cmdthread_sema);
424 thread_exit();
425}
426
427void r8712_event_handle(struct _adapter *padapter, uint *peventbuf)
428{
429 u8 evt_code, evt_seq;
430 u16 evt_sz;
431 void (*event_callback)(struct _adapter *dev, u8 *pbuf);
432 struct evt_priv *pevt_priv = &(padapter->evtpriv);
433
Juliana Rodrigues7fcf92c2016-03-13 15:30:57 -0300434 if (!peventbuf)
Larry Finger2865d422010-08-20 10:15:30 -0500435 goto _abort_event_;
436 evt_sz = (u16)(le32_to_cpu(*peventbuf) & 0xffff);
437 evt_seq = (u8)((le32_to_cpu(*peventbuf) >> 24) & 0x7f);
438 evt_code = (u8)((le32_to_cpu(*peventbuf) >> 16) & 0xff);
439 /* checking event sequence... */
440 if ((evt_seq & 0x7f) != pevt_priv->event_seq) {
441 pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
442 goto _abort_event_;
443 }
444 /* checking if event code is valid */
445 if (evt_code >= MAX_C2HEVT) {
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100446 pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
Larry Finger2865d422010-08-20 10:15:30 -0500447 goto _abort_event_;
448 } else if ((evt_code == GEN_EVT_CODE(_Survey)) &&
449 (evt_sz > sizeof(struct wlan_bssid_ex))) {
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100450 pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
Larry Finger2865d422010-08-20 10:15:30 -0500451 goto _abort_event_;
452 }
453 /* checking if event size match the event parm size */
454 if ((wlanevents[evt_code].parmsize) &&
455 (wlanevents[evt_code].parmsize != evt_sz)) {
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100456 pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
Larry Finger2865d422010-08-20 10:15:30 -0500457 goto _abort_event_;
458 } else if ((evt_sz == 0) && (evt_code != GEN_EVT_CODE(_WPS_PBC))) {
Luis de Bethencourt4ef2de52015-10-19 18:16:01 +0100459 pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
Larry Finger2865d422010-08-20 10:15:30 -0500460 goto _abort_event_;
461 }
462 pevt_priv->event_seq++; /* update evt_seq */
463 if (pevt_priv->event_seq > 127)
464 pevt_priv->event_seq = 0;
Tapasweni Pathak57b66862014-09-21 06:42:21 +0530465 /* move to event content, 8 bytes alignment */
466 peventbuf = peventbuf + 2;
Dan Carpentera3769322013-09-28 12:58:33 +0300467 event_callback = wlanevents[evt_code].event_callback;
468 if (event_callback)
469 event_callback(padapter, (u8 *)peventbuf);
Larry Finger2865d422010-08-20 10:15:30 -0500470 pevt_priv->evt_done_cnt++;
471_abort_event_:
472 return;
473}