forked from morrownr/8821cu-20210916
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtw_roch.c
591 lines (501 loc) · 19.3 KB
/
rtw_roch.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
/******************************************************************************
*
* Copyright(c) 2007 - 2020 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#include <drv_types.h>
#ifdef CONFIG_IOCTL_CFG80211
u8 rtw_roch_stay_in_cur_chan(_adapter *padapter)
{
int i;
_adapter *iface;
struct mlme_priv *pmlmepriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
u8 rst = _FALSE;
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (iface) {
pmlmepriv = &iface->mlmepriv;
if (check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS | WIFI_UNDER_KEY_HANDSHAKE) == _TRUE) {
RTW_INFO(ADPT_FMT"- WIFI_UNDER_LINKING |WIFI_UNDER_WPS | WIFI_UNDER_KEY_HANDSHAKE (mlme state:0x%x)\n",
ADPT_ARG(iface), get_fwstate(&iface->mlmepriv));
rst = _TRUE;
break;
}
#ifdef CONFIG_AP_MODE
if (MLME_IS_AP(iface) || MLME_IS_MESH(iface)) {
if (rtw_ap_sta_states_check(iface) == _TRUE) {
rst = _TRUE;
break;
}
}
#endif
}
}
return rst;
}
static int rtw_ro_ch_handler(_adapter *adapter, u8 *buf)
{
int ret = H2C_SUCCESS;
struct rtw_roch_parm *roch_parm = (struct rtw_roch_parm *)buf;
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
struct roch_info *prochinfo = &adapter->rochinfo;
#ifdef CONFIG_CONCURRENT_MODE
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
#endif
u8 ready_on_channel = _FALSE;
u8 remain_ch;
unsigned int duration;
_enter_critical_mutex(&pwdev_priv->roch_mutex, NULL);
if (rtw_cfg80211_get_is_roch(adapter) != _TRUE)
goto exit;
remain_ch = (u8)ieee80211_frequency_to_channel(roch_parm->ch.center_freq);
duration = roch_parm->duration;
RTW_INFO(FUNC_ADPT_FMT" ch:%u duration:%d, cookie:0x%llx\n"
, FUNC_ADPT_ARG(adapter), remain_ch, roch_parm->duration, roch_parm->cookie);
if (roch_parm->wdev && roch_parm->cookie) {
if (prochinfo->ro_ch_wdev != roch_parm->wdev) {
RTW_WARN(FUNC_ADPT_FMT" ongoing wdev:%p, wdev:%p\n"
, FUNC_ADPT_ARG(adapter), prochinfo->ro_ch_wdev, roch_parm->wdev);
rtw_warn_on(1);
}
if (prochinfo->remain_on_ch_cookie != roch_parm->cookie) {
RTW_WARN(FUNC_ADPT_FMT" ongoing cookie:0x%llx, cookie:0x%llx\n"
, FUNC_ADPT_ARG(adapter), prochinfo->remain_on_ch_cookie, roch_parm->cookie);
rtw_warn_on(1);
}
}
if (rtw_roch_stay_in_cur_chan(adapter) == _TRUE) {
remain_ch = rtw_mi_get_union_chan(adapter);
RTW_INFO(FUNC_ADPT_FMT" stay in union ch:%d\n", FUNC_ADPT_ARG(adapter), remain_ch);
}
#ifdef CONFIG_CONCURRENT_MODE
if (rtw_mi_check_status(adapter, MI_LINKED) && (0 != rtw_mi_get_union_chan(adapter))) {
if ((remain_ch != rtw_mi_get_union_chan(adapter)) && !check_fwstate(&adapter->mlmepriv, WIFI_ASOC_STATE)) {
if (remain_ch != pmlmeext->cur_channel
#ifdef RTW_ROCH_BACK_OP
|| ATOMIC_READ(&pwdev_priv->switch_ch_to) == 1
#endif
) {
rtw_leave_opch(adapter);
#ifdef RTW_ROCH_BACK_OP
RTW_INFO("%s, set switch ch timer, duration=%d\n", __func__, prochinfo->max_away_dur);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
/* remain_ch is not same as union channel. duration is max_away_dur to
* back to AP's channel.
*/
_set_timer(&prochinfo->ap_roch_ch_switch_timer, prochinfo->max_away_dur);
#endif
}
}
ready_on_channel = _TRUE;
} else
#endif /* CONFIG_CONCURRENT_MODE */
{
if (remain_ch != rtw_get_oper_ch(adapter))
ready_on_channel = _TRUE;
}
if (ready_on_channel == _TRUE) {
#ifndef RTW_SINGLE_WIPHY
if (!check_fwstate(&adapter->mlmepriv, WIFI_ASOC_STATE))
#endif
{
#ifdef CONFIG_CONCURRENT_MODE
if (rtw_get_oper_ch(adapter) != remain_ch)
#endif
{
/* if (!padapter->mlmepriv.LinkDetectInfo.bBusyTraffic) */
set_channel_bwmode(adapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
}
}
}
#ifdef CONFIG_BT_COEXIST
rtw_btcoex_ScanNotify(adapter, _TRUE);
#endif
RTW_INFO("%s, set ro ch timer, duration=%d\n", __func__, duration);
_set_timer(&prochinfo->remain_on_ch_timer, duration);
exit:
_exit_critical_mutex(&pwdev_priv->roch_mutex, NULL);
return ret;
}
static int rtw_cancel_ro_ch_handler(_adapter *padapter, u8 *buf)
{
int ret = H2C_SUCCESS;
struct rtw_roch_parm *roch_parm = (struct rtw_roch_parm *)buf;
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
struct roch_info *prochinfo = &padapter->rochinfo;
struct wireless_dev *wdev;
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
#endif
u8 ch, bw, offset;
_enter_critical_mutex(&pwdev_priv->roch_mutex, NULL);
if (rtw_cfg80211_get_is_roch(padapter) != _TRUE)
goto exit;
if (roch_parm->wdev && roch_parm->cookie) {
if (prochinfo->ro_ch_wdev != roch_parm->wdev) {
RTW_WARN(FUNC_ADPT_FMT" ongoing wdev:%p, wdev:%p\n"
, FUNC_ADPT_ARG(padapter), prochinfo->ro_ch_wdev, roch_parm->wdev);
rtw_warn_on(1);
}
if (prochinfo->remain_on_ch_cookie != roch_parm->cookie) {
RTW_WARN(FUNC_ADPT_FMT" ongoing cookie:0x%llx, cookie:0x%llx\n"
, FUNC_ADPT_ARG(padapter), prochinfo->remain_on_ch_cookie, roch_parm->cookie);
rtw_warn_on(1);
}
}
#if defined(RTW_ROCH_BACK_OP) && defined(CONFIG_CONCURRENT_MODE)
_cancel_timer_ex(&prochinfo->ap_roch_ch_switch_timer);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
#endif
if (rtw_mi_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) {
if (0)
RTW_INFO(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n",
FUNC_ADPT_ARG(padapter), ch, bw, offset);
#ifdef CONFIG_P2P
} else if (adapter_wdev_data(padapter)->p2p_enabled && pwdinfo->listen_channel) {
ch = pwdinfo->listen_channel;
bw = CHANNEL_WIDTH_20;
offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
if (0)
RTW_INFO(FUNC_ADPT_FMT" back to listen ch - ch:%u, bw:%u, offset:%u\n",
FUNC_ADPT_ARG(padapter), ch, bw, offset);
#endif
} else {
ch = prochinfo->restore_channel;
bw = CHANNEL_WIDTH_20;
offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
if (0)
RTW_INFO(FUNC_ADPT_FMT" back to restore ch - ch:%u, bw:%u, offset:%u\n",
FUNC_ADPT_ARG(padapter), ch, bw, offset);
}
set_channel_bwmode(padapter, ch, offset, bw);
rtw_back_opch(padapter);
#ifdef CONFIG_P2P
rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
#ifdef CONFIG_DEBUG_CFG80211
RTW_INFO("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo));
#endif
#endif
wdev = prochinfo->ro_ch_wdev;
rtw_cfg80211_set_is_roch(padapter, _FALSE);
prochinfo->ro_ch_wdev = NULL;
rtw_cfg80211_set_last_ro_ch_time(padapter);
rtw_cfg80211_remain_on_channel_expired(wdev
, prochinfo->remain_on_ch_cookie
, &prochinfo->remain_on_ch_channel
, prochinfo->remain_on_ch_type, GFP_KERNEL);
RTW_INFO("cfg80211_remain_on_channel_expired cookie:0x%llx\n"
, prochinfo->remain_on_ch_cookie);
#ifdef CONFIG_BT_COEXIST
rtw_btcoex_ScanNotify(padapter, _FALSE);
#endif
exit:
_exit_critical_mutex(&pwdev_priv->roch_mutex, NULL);
return ret;
}
static void rtw_ro_ch_timer_process(void *FunctionContext)
{
_adapter *adapter = (_adapter *)FunctionContext;
rtw_cancel_roch_cmd(adapter, 0, NULL, 0);
}
#endif /* CONFIG_IOCTL_CFG80211 */
#if (defined(CONFIG_P2P) && defined(CONFIG_CONCURRENT_MODE)) || defined(CONFIG_IOCTL_CFG80211)
s32 rtw_roch_wk_hdl(_adapter *padapter, int intCmdType, u8 *buf)
{
int ret = H2C_SUCCESS;
switch (intCmdType) {
#ifdef CONFIG_IOCTL_CFG80211
case ROCH_RO_CH_WK:
ret = rtw_ro_ch_handler(padapter, buf);
break;
case ROCH_CANCEL_RO_CH_WK:
ret = rtw_cancel_ro_ch_handler(padapter, buf);
break;
#endif
#ifdef CONFIG_CONCURRENT_MODE
case ROCH_AP_ROCH_CH_SWITCH_PROCESS_WK:
rtw_concurrent_handler(padapter);
break;
#endif
default:
rtw_warn_on(1);
break;
}
return ret;
}
static int get_roch_parm_size(struct rtw_roch_parm *roch_parm)
{
#ifdef CONFIG_IOCTL_CFG80211
return (roch_parm ? sizeof(*roch_parm) : 0);
#else
rtw_warn_on(roch_parm);
return 0;
#endif
}
u8 rtw_roch_wk_cmd(_adapter *padapter, int intCmdType, struct rtw_roch_parm *roch_parm, u8 flags)
{
struct cmd_obj *ph2c = NULL;
struct drvextra_cmd_parm *pdrvextra_cmd_parm = NULL;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
struct submit_ctx sctx;
u8 res = _SUCCESS;
if (flags & RTW_CMDF_DIRECTLY) {
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
if (H2C_SUCCESS != rtw_roch_wk_hdl(padapter, intCmdType, (u8 *)roch_parm))
res = _FAIL;
goto free_parm;
} else {
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
if (!ph2c) {
res = _FAIL;
goto free_parm;
}
pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
if (!pdrvextra_cmd_parm) {
res = _FAIL;
goto free_parm;
}
pdrvextra_cmd_parm->ec_id = ROCH_WK_CID;
pdrvextra_cmd_parm->type = intCmdType;
pdrvextra_cmd_parm->size = get_roch_parm_size(roch_parm);
pdrvextra_cmd_parm->pbuf = (u8 *)roch_parm;
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, CMD_SET_DRV_EXTRA);
if (flags & RTW_CMDF_WAIT_ACK) {
ph2c->sctx = &sctx;
rtw_sctx_init(&sctx, 10 * 1000);
}
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
if (res == _SUCCESS && (flags & RTW_CMDF_WAIT_ACK)) {
rtw_sctx_wait(&sctx, __func__);
_enter_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
if (sctx.status == RTW_SCTX_SUBMITTED)
ph2c->sctx = NULL;
_exit_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
if (sctx.status != RTW_SCTX_DONE_SUCCESS)
res = _FAIL;
}
}
return res;
free_parm:
if (roch_parm)
rtw_mfree((u8 *)roch_parm, get_roch_parm_size(roch_parm));
if (ph2c)
rtw_mfree((u8 *)ph2c, sizeof(*ph2c));
return res;
}
#ifdef CONFIG_CONCURRENT_MODE
void rtw_ap_roch_ch_switch_timer_process(void *ctx)
{
_adapter *adapter = (_adapter *)ctx;
#ifdef CONFIG_IOCTL_CFG80211
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
#endif
#ifdef CONFIG_IOCTL_CFG80211
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
#endif
rtw_roch_wk_cmd(adapter, ROCH_AP_ROCH_CH_SWITCH_PROCESS_WK, NULL, 0);
}
static bool chk_need_stay_in_cur_chan(_adapter *padapter)
{
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
/* When CONFIG_FULL_CH_IN_P2P_HANDSHAKE is defined and the
* interface is in the P2P_STATE_GONEGO_OK state, do not let the
* interface switch to the listen channel, because the interface will
* switch to the OP channel after the GO negotiation is successful.
*/
if (padapter->registrypriv.full_ch_in_p2p_handshake == 1 && rtw_p2p_chk_state(pwdinfo , P2P_STATE_GONEGO_OK)) {
RTW_INFO("%s, No linked interface now, but go nego ok, do not back to listen channel\n", __func__);
return _TRUE;
}
#endif
return _FALSE;
}
static bool chk_driver_interface(_adapter *padapter, u8 driver_interface)
{
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
if (pwdinfo->driver_interface == driver_interface)
return _TRUE;
#elif defined(CONFIG_IOCTL_CFG80211)
if (driver_interface == DRIVER_CFG80211)
return _TRUE;
#endif
return _FALSE;
}
static u8 get_remain_ch(_adapter *padapter)
{
struct roch_info *prochinfo = &padapter->rochinfo;
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
#endif
u8 remain_ch;
#ifdef CONFIG_P2P
remain_ch = pwdinfo->listen_channel;
#elif defined(CONFIG_IOCTL_CFG80211)
if (chk_driver_interface(padapter, DRIVER_CFG80211))
remain_ch = ieee80211_frequency_to_channel(prochinfo->remain_on_ch_channel.center_freq);
else
rtw_warn_on(1);
#endif
return remain_ch;
}
void rtw_concurrent_handler(_adapter *padapter)
{
#ifdef CONFIG_IOCTL_CFG80211
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
#endif
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
struct roch_info *prochinfo = &padapter->rochinfo;
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
u8 val8;
#endif
u8 remain_ch = get_remain_ch(padapter);
#ifdef CONFIG_IOCTL_CFG80211
if (chk_driver_interface(padapter, DRIVER_CFG80211)
&& !rtw_cfg80211_get_is_roch(padapter))
return;
#endif
if (rtw_mi_check_status(padapter, MI_LINKED)) {
u8 union_ch = rtw_mi_get_union_chan(padapter);
u8 union_bw = rtw_mi_get_union_bw(padapter);
u8 union_offset = rtw_mi_get_union_offset(padapter);
unsigned int duration;
#ifdef CONFIG_P2P
pwdinfo->operating_channel = union_ch;
#endif
if (chk_driver_interface(padapter, DRIVER_CFG80211)) {
#ifdef CONFIG_IOCTL_CFG80211
_enter_critical_mutex(&pwdev_priv->roch_mutex, NULL);
if (rtw_get_oper_ch(padapter) != union_ch) {
/* Current channel is not AP's channel - switching to AP's channel */
RTW_INFO("%s, switch ch back to union=%u,%u, %u\n"
, __func__, union_ch, union_bw, union_offset);
set_channel_bwmode(padapter, union_ch, union_offset, union_bw);
rtw_back_opch(padapter);
/* Now, the driver stays on AP's channel. We should stay on AP's
* channel for min_home_dur (duration) and next switch channel is
* listen channel.
*/
duration = prochinfo->min_home_dur;
} else {
/* Current channel is AP's channel - switching to listen channel */
RTW_INFO("%s, switch ch to roch=%u\n"
, __func__, remain_ch);
rtw_leave_opch(padapter);
set_channel_bwmode(padapter,
remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
/* Now, the driver stays on listen channel. We should stay on listen
* channel for max_away_dur (duration) and next switch channel is AP's
* channel.
*/
duration = prochinfo->max_away_dur;
}
/* set channel switch timer */
ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
_set_timer(&prochinfo->ap_roch_ch_switch_timer, duration);
RTW_INFO("%s, set switch ch timer, duration=%d\n", __func__, duration);
_exit_critical_mutex(&pwdev_priv->roch_mutex, NULL);
#endif
}
#ifdef CONFIG_P2P
else if (chk_driver_interface(padapter, DRIVER_WEXT)) {
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) {
/* Now, the driver stays on the AP's channel. */
/* If the pwdinfo->ext_listen_period = 0, that means the P2P listen state is not available on listen channel. */
if (pwdinfo->ext_listen_period > 0) {
RTW_INFO("[%s] P2P_STATE_IDLE, ext_listen_period = %d\n", __FUNCTION__, pwdinfo->ext_listen_period);
if (union_ch != pwdinfo->listen_channel) {
rtw_leave_opch(padapter);
set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
}
rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
if (!rtw_mi_check_mlmeinfo_state(padapter, WIFI_FW_AP_STATE)) {
val8 = 1;
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
}
/* Todo: To check the value of pwdinfo->ext_listen_period is equal to 0 or not. */
_set_timer(&prochinfo->ap_roch_ch_switch_timer, pwdinfo->ext_listen_period);
}
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN) ||
rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL) ||
(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) && pwdinfo->nego_req_info.benable == _FALSE) ||
rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) {
/* Now, the driver is in the listen state of P2P mode. */
RTW_INFO("[%s] P2P_STATE_IDLE, ext_listen_interval = %d\n", __FUNCTION__, pwdinfo->ext_listen_interval);
/* Commented by Albert 2012/11/01 */
/* If the AP's channel is the same as the listen channel, we should still be in the listen state */
/* Other P2P device is still able to find this device out even this device is in the AP's channel. */
/* So, configure this device to be able to receive the probe request frame and set it to listen state. */
if (union_ch != pwdinfo->listen_channel) {
set_channel_bwmode(padapter, union_ch, union_offset, union_bw);
if (!rtw_mi_check_status(padapter, MI_AP_MODE)) {
val8 = 0;
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
}
rtw_p2p_set_state(pwdinfo, P2P_STATE_IDLE);
rtw_back_opch(padapter);
}
/* Todo: To check the value of pwdinfo->ext_listen_interval is equal to 0 or not. */
_set_timer(&prochinfo->ap_roch_ch_switch_timer, pwdinfo->ext_listen_interval);
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)) {
/* The driver had finished the P2P handshake successfully. */
val8 = 0;
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
set_channel_bwmode(padapter, union_ch, union_offset, union_bw);
rtw_back_opch(padapter);
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) {
val8 = 1;
set_channel_bwmode(padapter, pwdinfo->tx_prov_disc_info.peer_channel_num[0], HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
issue_probereq_p2p(padapter, NULL);
_set_timer(&pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT);
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) && pwdinfo->nego_req_info.benable == _TRUE) {
val8 = 1;
set_channel_bwmode(padapter, pwdinfo->nego_req_info.peer_channel_num[0], HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
issue_probereq_p2p(padapter, NULL);
_set_timer(&pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT);
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ) && pwdinfo->invitereq_info.benable == _TRUE) {
/*
val8 = 1;
set_channel_bwmode(padapter, , HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
issue_probereq_p2p(padapter, NULL);
_set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT );
*/
}
}
#endif /* CONFIG_P2P */
} else if (!chk_need_stay_in_cur_chan(padapter)) {
set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
}
}
#endif /* CONFIG_CONCURRENT_MODE */
void rtw_init_roch_info(_adapter *padapter)
{
struct roch_info *prochinfo = &padapter->rochinfo;
_rtw_memset(prochinfo, 0x00, sizeof(struct roch_info));
#ifdef CONFIG_CONCURRENT_MODE
rtw_init_timer(&prochinfo->ap_roch_ch_switch_timer, padapter, rtw_ap_roch_ch_switch_timer_process, padapter);
#ifdef CONFIG_IOCTL_CFG80211
prochinfo->min_home_dur = 1500; /* min duration for traffic, home_time */
prochinfo->max_away_dur = 250; /* max acceptable away duration, home_away_time */
#endif
#endif
#ifdef CONFIG_IOCTL_CFG80211
rtw_init_timer(&prochinfo->remain_on_ch_timer, padapter, rtw_ro_ch_timer_process, padapter);
#endif
}
#endif /* (defined(CONFIG_P2P) && defined(CONFIG_CONCURRENT_MODE)) || defined(CONFIG_IOCTL_CFG80211) */