2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _RTW_CMD_C_
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
#include <recv_osdep.h>
|
|
|
|
#include <cmd_osdep.h>
|
|
|
|
#include <mlme_osdep.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <rtw_byteorder.h>
|
|
|
|
#ifdef CONFIG_BR_EXT
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <rtw_br_ext.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_BR_EXT
|
|
|
|
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
#include <rtl8723a_hal.h>
|
|
|
|
#endif // CONFIG_BT_COEXIST
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
|
|
|
|
No irqsave is necessary.
|
|
|
|
*/
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
sint res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0);
|
2014-12-11 21:15:04 +00:00
|
|
|
//_rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0);
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_queue(&(pcmdpriv->cmd_queue));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmdpriv->cmd_seq = 1;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pcmdpriv->cmd_allocated_buf == NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ( (SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pcmdpriv->rsp_allocated_buf == NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ( (SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
}
|
2013-07-21 15:35:02 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_C2H_WK
|
|
|
|
static void c2h_wk_callback(_workitem *work);
|
|
|
|
#endif
|
|
|
|
sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
sint res=_SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_H2CLBK
|
|
|
|
_rtw_init_sema(&(pevtpriv->lbkevt_done), 0);
|
|
|
|
pevtpriv->lbkevt_limit = 0;
|
|
|
|
pevtpriv->lbkevt_num = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
pevtpriv->cmdevt_parm = NULL;
|
|
|
|
#endif
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf
|
2013-05-08 21:45:39 +00:00
|
|
|
ATOMIC_SET(&pevtpriv->event_seq, 0);
|
|
|
|
pevtpriv->evt_done_cnt = 0;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_EVENT_THREAD_MODE
|
|
|
|
|
|
|
|
_rtw_init_sema(&(pevtpriv->evt_notify), 0);
|
|
|
|
_rtw_init_sema(&(pevtpriv->terminate_evtthread_sema), 0);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
pevtpriv->evt_allocated_buf = rtw_zmalloc(MAX_EVTSZ + 4);
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pevtpriv->evt_allocated_buf == NULL){
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
pevtpriv->evt_buf = pevtpriv->evt_allocated_buf + 4 - ((unsigned int)(pevtpriv->evt_allocated_buf) & 3);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_init_queue(&(pevtpriv->evt_queue));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
exit:
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#endif //end of CONFIG_EVENT_THREAD_MODE
|
|
|
|
|
|
|
|
#ifdef CONFIG_C2H_WK
|
2013-05-08 21:45:39 +00:00
|
|
|
_init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL);
|
2014-12-11 21:15:04 +00:00
|
|
|
pevtpriv->c2h_wk_alive = _FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void _rtw_free_evt_priv (struct evt_priv *pevtpriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("+_rtw_free_evt_priv \n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_EVENT_THREAD_MODE
|
|
|
|
_rtw_free_sema(&(pevtpriv->evt_notify));
|
|
|
|
_rtw_free_sema(&(pevtpriv->terminate_evtthread_sema));
|
|
|
|
|
|
|
|
|
|
|
|
if (pevtpriv->evt_allocated_buf)
|
|
|
|
rtw_mfree(pevtpriv->evt_allocated_buf, MAX_EVTSZ + 4);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_C2H_WK
|
2013-05-08 21:45:39 +00:00
|
|
|
_cancel_workitem_sync(&pevtpriv->c2h_wk);
|
2014-12-11 21:15:04 +00:00
|
|
|
while(pevtpriv->c2h_wk_alive)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_msleep_os(10);
|
|
|
|
|
|
|
|
while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
|
2014-12-11 21:15:04 +00:00
|
|
|
void *c2h;
|
|
|
|
if ((c2h = rtw_cbuf_pop(pevtpriv->c2h_queue)) != NULL
|
|
|
|
&& c2h != (void *)pevtpriv) {
|
|
|
|
rtw_mfree(c2h, 16);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_cbuf_free(pevtpriv->c2h_queue);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("-_rtw_free_evt_priv \n"));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv)
|
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pcmdpriv){
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_spinlock_free(&(pcmdpriv->cmd_queue.lock));
|
|
|
|
_rtw_free_sema(&(pcmdpriv->cmd_queue_sema));
|
2014-12-11 21:15:04 +00:00
|
|
|
//_rtw_free_sema(&(pcmdpriv->cmd_done_sema));
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_free_sema(&(pcmdpriv->terminate_cmdthread_sema));
|
|
|
|
|
|
|
|
if (pcmdpriv->cmd_allocated_buf)
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree(pcmdpriv->cmd_allocated_buf, MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pcmdpriv->rsp_allocated_buf)
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree(pcmdpriv->rsp_allocated_buf, MAX_RSPSZ + 4);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Calling Context:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_enqueue_cmd can only be called between kernel thread,
|
2013-05-08 21:45:39 +00:00
|
|
|
since only spin_lock is used.
|
|
|
|
|
|
|
|
ISR/Call-Back functions can't call this sub-function.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
|
|
|
|
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (obj == NULL)
|
|
|
|
goto exit;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//_enter_critical_bh(&queue->lock, &irqL);
|
2014-12-19 06:59:46 +00:00
|
|
|
_enter_critical(&queue->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_list_insert_tail(&obj->list, &queue->queue);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//_exit_critical_bh(&queue->lock, &irqL);
|
2014-12-11 21:15:04 +00:00
|
|
|
_exit_critical(&queue->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
exit:
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj *_rtw_dequeue_cmd(_queue *queue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_obj *obj;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
//_enter_critical_bh(&(queue->lock), &irqL);
|
|
|
|
_enter_critical(&queue->lock, &irqL);
|
|
|
|
if (rtw_is_list_empty(&(queue->queue)))
|
2013-05-08 21:45:39 +00:00
|
|
|
obj = NULL;
|
2014-12-11 21:15:04 +00:00
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
obj = LIST_CONTAINOR(get_next(&(queue->queue)), struct cmd_obj, list);
|
|
|
|
rtw_list_delete(&obj->list);
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//_exit_critical_bh(&(queue->lock), &irqL);
|
|
|
|
_exit_critical(&queue->lock, &irqL);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
|
|
|
|
{
|
|
|
|
u32 res;
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _rtw_init_cmd_priv (pcmdpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
return res;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 rtw_init_evt_priv (struct evt_priv *pevtpriv)
|
|
|
|
{
|
|
|
|
int res;
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _rtw_init_evt_priv(pevtpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void rtw_free_evt_priv (struct evt_priv *pevtpriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("rtw_free_evt_priv\n"));
|
|
|
|
_rtw_free_evt_priv(pevtpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
}
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void rtw_free_cmd_priv (struct cmd_priv *pcmdpriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("rtw_free_cmd_priv\n"));
|
|
|
|
_rtw_free_cmd_priv(pcmdpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj);
|
|
|
|
int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
|
|
|
|
{
|
|
|
|
u8 bAllow = _FALSE; //set to _TRUE to allow enqueuing cmd when hw_init_completed is _FALSE
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef SUPPORT_HW_RFOFF_DETECTED
|
|
|
|
//To decide allow or not
|
|
|
|
if( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect)
|
|
|
|
&&(!pcmdpriv->padapter->registrypriv.usbss_enable)
|
2014-12-19 06:59:46 +00:00
|
|
|
)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
if(cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) )
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf;
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
//DBG_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n");
|
2014-12-19 06:59:46 +00:00
|
|
|
bAllow = _TRUE;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if(cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan))
|
|
|
|
bAllow = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if( (pcmdpriv->padapter->hw_init_completed ==_FALSE && bAllow == _FALSE)
|
|
|
|
|| pcmdpriv->cmdthd_running== _FALSE //com_thread not running
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__,
|
|
|
|
// cmd_obj->cmdcode,
|
|
|
|
// pcmdpriv->padapter->hw_init_completed,
|
|
|
|
// pcmdpriv->cmdthd_running
|
|
|
|
//);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
|
|
|
|
{
|
|
|
|
int res = _FAIL;
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = pcmdpriv->padapter;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (cmd_obj == NULL) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
cmd_obj->padapter = padapter;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
//change pcmdpriv to primary's pcmdpriv
|
|
|
|
if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter)
|
|
|
|
pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
if( _FAIL == (res=rtw_cmd_filter(pcmdpriv, cmd_obj)) ) {
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(cmd_obj);
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(res == _SUCCESS)
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_up_sema(&pcmdpriv->cmd_queue_sema);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv)
|
|
|
|
{
|
|
|
|
struct cmd_obj *cmd_obj;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return cmd_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv)
|
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmdpriv->cmd_done_cnt++;
|
2014-12-11 21:15:04 +00:00
|
|
|
//_rtw_up_sema(&(pcmdpriv->cmd_done_sema));
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rtw_free_cmd_obj(struct cmd_obj *pcmd)
|
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_))
|
|
|
|
{
|
|
|
|
//free parmbuf in cmd_obj
|
|
|
|
rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pcmd->rsp!=NULL)
|
|
|
|
{
|
|
|
|
if(pcmd->rspsz!= 0)
|
|
|
|
{
|
|
|
|
//free rsp in cmd_obj
|
|
|
|
rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//free cmd_obj
|
|
|
|
rtw_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_stop_cmd_thread(struct adapter *adapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
if(adapter->cmdThread && adapter->cmdpriv.cmdthd_running == _TRUE
|
|
|
|
&& adapter->cmdpriv.stop_req == 0)
|
|
|
|
{
|
|
|
|
adapter->cmdpriv.stop_req = 1;
|
|
|
|
_rtw_up_sema(&adapter->cmdpriv.cmd_queue_sema);
|
|
|
|
_rtw_down_sema(&adapter->cmdpriv.terminate_cmdthread_sema);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
thread_return rtw_cmd_thread(thread_context context)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 ret;
|
|
|
|
struct cmd_obj *pcmd;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 *pcmdbuf, *prspbuf;
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 (*cmd_hdl)(struct adapter *padapter, u8* pbuf);
|
|
|
|
void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd);
|
|
|
|
struct adapter *padapter = (struct adapter *)context;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
thread_enter("RTW_CMD_THREAD");
|
|
|
|
|
|
|
|
pcmdbuf = pcmdpriv->cmd_buf;
|
2014-12-11 21:15:04 +00:00
|
|
|
prspbuf = pcmdpriv->rsp_buf;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdpriv->stop_req = 0;
|
|
|
|
pcmdpriv->cmdthd_running=_TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("start r871x rtw_cmd_thread !!!!\n"));
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL) {
|
|
|
|
DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" _rtw_down_sema(&pcmdpriv->cmd_queue_sema) return _FAIL, break\n", FUNC_ADPT_ARG(padapter));
|
|
|
|
break;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if ((padapter->bDriverStopped == _TRUE)||(padapter->bSurpriseRemoved == _TRUE))
|
|
|
|
{
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n",
|
|
|
|
__FUNCTION__, padapter->bDriverStopped, padapter->bSurpriseRemoved, __LINE__);
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pcmdpriv->stop_req) {
|
|
|
|
DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" stop_req:%u, break\n", FUNC_ADPT_ARG(padapter), pcmdpriv->stop_req);
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue)))
|
|
|
|
{
|
|
|
|
//DBG_871X("%s: cmd queue is empty!\n", __func__);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_LPS_LCLK
|
|
|
|
if (rtw_register_cmd_alive(padapter) != _SUCCESS)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_hal_xmit_c_, _drv_notice_,
|
|
|
|
("%s: wait to leave LPS_LCLK\n", __FUNCTION__));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_next:
|
2014-12-11 21:15:04 +00:00
|
|
|
if ((padapter->bDriverStopped == _TRUE)||(padapter->bSurpriseRemoved== _TRUE))
|
|
|
|
{
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n",
|
|
|
|
__FUNCTION__, padapter->bDriverStopped, padapter->bSurpriseRemoved, __LINE__);
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!(pcmd = rtw_dequeue_cmd(pcmdpriv))) {
|
|
|
|
#ifdef CONFIG_LPS_LCLK
|
|
|
|
rtw_unregister_cmd_alive(padapter);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if( _FAIL == rtw_cmd_filter(pcmdpriv, pcmd) )
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd->res = H2C_DROPPED;
|
|
|
|
goto post_process;
|
|
|
|
}
|
|
|
|
|
|
|
|
pcmdpriv->cmd_issued_cnt++;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd->cmdsz = _RND4((pcmd->cmdsz));//_RND4
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pcmd->cmdcode <= (sizeof(wlancmds) /sizeof(struct cmd_hdl)))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (cmd_hdl)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = cmd_hdl(pcmd->padapter, pcmdbuf);
|
|
|
|
pcmd->res = ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
pcmdpriv->cmd_seq++;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd->res = H2C_PARAMETERS_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_hdl = NULL;
|
|
|
|
|
|
|
|
post_process:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//call callback function for post-processed
|
|
|
|
if(pcmd->cmdcode <= (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback)))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pcmd_callback == NULL)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("mlme_cmd_hdl(): pcmd_callback=0x%p, cmdcode=0x%x\n", pcmd_callback, pcmd->cmdcode));
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
//todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!=NULL)
|
|
|
|
pcmd_callback(pcmd->padapter, pcmd);//need conider that free cmd_obj in rtw_cmd_callback
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("%s: cmdcode=0x%x callback not defined!\n", __FUNCTION__, pcmd->cmdcode));
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
flush_signals_thread();
|
|
|
|
|
|
|
|
goto _next;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdpriv->cmdthd_running=_FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
// free all cmd_obj resources
|
|
|
|
do{
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd = rtw_dequeue_cmd(pcmdpriv);
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pcmd==NULL) {
|
|
|
|
#ifdef CONFIG_LPS_LCLK
|
|
|
|
rtw_unregister_cmd_alive(padapter);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//DBG_871X("%s: leaving... drop cmdcode:%u\n", __FUNCTION__, pcmd->cmdcode);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
2014-12-11 21:15:04 +00:00
|
|
|
}while(1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
thread_exit();
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_EVENT_THREAD_MODE
|
|
|
|
u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
|
|
|
int res;
|
|
|
|
_queue *queue = &pevtpriv->evt_queue;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
res = _SUCCESS;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
if (obj == NULL) {
|
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
_enter_critical_bh(&queue->lock, &irqL);
|
|
|
|
|
|
|
|
rtw_list_insert_tail(&obj->list, &queue->queue);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_exit_critical_bh(&queue->lock, &irqL);
|
|
|
|
|
|
|
|
//rtw_evt_notify_isr(pevtpriv);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct evt_obj *rtw_dequeue_evt(_queue *queue)
|
|
|
|
{
|
|
|
|
_irqL irqL;
|
|
|
|
struct evt_obj *pevtobj;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
_enter_critical_bh(&queue->lock, &irqL);
|
|
|
|
|
|
|
|
if (rtw_is_list_empty(&(queue->queue)))
|
|
|
|
pevtobj = NULL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pevtobj = LIST_CONTAINOR(get_next(&(queue->queue)), struct evt_obj, list);
|
|
|
|
rtw_list_delete(&pevtobj->list);
|
|
|
|
}
|
|
|
|
|
|
|
|
_exit_critical_bh(&queue->lock, &irqL);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
|
|
|
return pevtobj;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rtw_free_evt_obj(struct evt_obj *pevtobj)
|
|
|
|
{
|
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
if(pevtobj->parmbuf)
|
|
|
|
rtw_mfree((unsigned char*)pevtobj->parmbuf, pevtobj->evtsz);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((unsigned char*)pevtobj, sizeof(struct evt_obj));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rtw_evt_notify_isr(struct evt_priv *pevtpriv)
|
|
|
|
{
|
|
|
|
_func_enter_;
|
|
|
|
pevtpriv->evt_done_cnt++;
|
|
|
|
_rtw_up_sema(&(pevtpriv->evt_notify));
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 rtw_setstandby_cmd(unsigned char *adapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
*/
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setstandby_cmd(struct adapter *padapter, uint action)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct usb_suspend_parm* psetusbsuspend;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
u8 ret = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ph2c == NULL) {
|
|
|
|
ret = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
psetusbsuspend = (struct usb_suspend_parm*)rtw_zmalloc(sizeof(struct usb_suspend_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (psetusbsuspend == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
psetusbsuspend->action = action;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetusbsuspend, GEN_CMD_CODE(_SetUsbSuspend));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
ret = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
rtw_sitesurvey_cmd(~)
|
|
|
|
### NOTE:#### (!!!!)
|
|
|
|
MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
|
|
|
|
*/
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num,
|
2013-05-08 21:45:39 +00:00
|
|
|
struct rtw_ieee80211_channel *ch, int ch_num)
|
|
|
|
{
|
|
|
|
u8 res = _FAIL;
|
|
|
|
struct cmd_obj *ph2c;
|
|
|
|
struct sitesurvey_parm *psurveyPara;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_P2P
|
|
|
|
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
|
|
|
|
#endif //CONFIG_P2P
|
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_LPS
|
|
|
|
if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE){
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_P2P_PS
|
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
|
2013-05-08 21:45:39 +00:00
|
|
|
p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1);
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_P2P_PS
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ph2c == NULL)
|
|
|
|
return _FAIL;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (psurveyPara == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((unsigned char*) ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_free_network_queue(padapter, _FALSE);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("%s: flush network queue\n", __FUNCTION__));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));
|
|
|
|
|
|
|
|
/* psurveyPara->bsslimit = 48; */
|
|
|
|
psurveyPara->scan_mode = pmlmepriv->scan_mode;
|
|
|
|
|
|
|
|
/* prepare ssid list */
|
|
|
|
if (ssid) {
|
|
|
|
int i;
|
2014-12-11 21:15:04 +00:00
|
|
|
for (i=0; i<ssid_num && i< RTW_SSID_SCAN_AMOUNT; i++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ssid[i].SsidLength) {
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(NDIS_802_11_SSID));
|
2013-05-08 21:45:39 +00:00
|
|
|
psurveyPara->ssid_num++;
|
|
|
|
if (0)
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X(FUNC_ADPT_FMT" ssid:(%s, %d)\n", FUNC_ADPT_ARG(padapter),
|
2013-05-08 21:45:39 +00:00
|
|
|
psurveyPara->ssid[i].Ssid, psurveyPara->ssid[i].SsidLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepare channel list */
|
|
|
|
if (ch) {
|
|
|
|
int i;
|
2014-12-11 21:15:04 +00:00
|
|
|
for (i=0; i<ch_num && i< RTW_CHANNEL_SCAN_AMOUNT; i++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) {
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel));
|
2013-05-08 21:45:39 +00:00
|
|
|
psurveyPara->ch_num++;
|
|
|
|
if (0)
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter),
|
2013-05-08 21:45:39 +00:00
|
|
|
psurveyPara->ch[i].hw_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(res == _SUCCESS) {
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pmlmepriv->scan_start_time = rtw_get_current_time();
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
|
|
|
|
if((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE)
|
|
|
|
_set_timer(&pmlmepriv->scan_to_timer, SURVEY_TO * ( padapter->mlmeextpriv.max_chan_nums + ( padapter->mlmeextpriv.max_chan_nums / RTW_SCAN_NUM_OF_CH ) * RTW_STAY_AP_CH_MILLISECOND ) + 1000 );
|
|
|
|
else
|
|
|
|
#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
|
|
|
|
_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_led_control(padapter, LED_CTL_SITE_SURVEY);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
|
|
|
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct setdatarate_parm* pbsetdataratepara;
|
|
|
|
struct cmd_priv* pcmdpriv = &padapter->cmdpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ph2c == NULL) {
|
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
pbsetdataratepara = (struct setdatarate_parm*)rtw_zmalloc(sizeof(struct setdatarate_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pbsetdataratepara == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, GEN_CMD_CODE(_SetDataRate));
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef MP_FIRMWARE_OFFLOAD
|
|
|
|
pbsetdataratepara->curr_rateidx = *(u32*)rateset;
|
|
|
|
// _rtw_memcpy(pbsetdataratepara, rateset, sizeof(u32));
|
|
|
|
#else
|
2013-05-08 21:45:39 +00:00
|
|
|
pbsetdataratepara->mac_id = 5;
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(pbsetdataratepara->datarates, rateset, NumRates);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct setbasicrate_parm* pssetbasicratepara;
|
|
|
|
struct cmd_priv* pcmdpriv=&padapter->cmdpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ph2c == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
pssetbasicratepara = (struct setbasicrate_parm*)rtw_zmalloc(sizeof(struct setbasicrate_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (pssetbasicratepara == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8*) ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, _SetBasicRate_CMD_);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_rtw_memcpy(pssetbasicratepara->basicrates, rateset, NumRates);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
exit:
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
/*
|
2014-12-19 06:59:46 +00:00
|
|
|
unsigned char rtw_setphy_cmd(unsigned char *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
1. be called only after rtw_update_registrypriv_dev_network( ~) or mp testing program
|
2013-05-08 21:45:39 +00:00
|
|
|
2. for AdHoc/Ap mode or mp mode?
|
|
|
|
|
|
|
|
*/
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct setphy_parm* psetphypara;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
// struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
// struct registry_priv* pregistry_priv = &padapter->registrypriv;
|
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
psetphypara = (struct setphy_parm*)rtw_zmalloc(sizeof(struct setphy_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psetphypara==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetphypara, _SetPhy_CMD_);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("CH=%d, modem=%d", ch, modem));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
psetphypara->modem = modem;
|
|
|
|
psetphypara->rfchannel = ch;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
exit:
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setbbreg_cmd(struct adapter*padapter, u8 offset, u8 val)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct writeBB_parm* pwritebbparm;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
_func_enter_;
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
pwritebbparm = (struct writeBB_parm*)rtw_zmalloc(sizeof(struct writeBB_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pwritebbparm==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pwritebbparm, GEN_CMD_CODE(_SetBBReg));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pwritebbparm->offset = offset;
|
|
|
|
pwritebbparm->value = val;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
exit:
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct readBB_parm* prdbbparm;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
prdbbparm = (struct readBB_parm*)rtw_zmalloc(sizeof(struct readBB_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(prdbbparm ==NULL){
|
|
|
|
rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_init_listhead(&ph2c->list);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->cmdcode =GEN_CMD_CODE(_GetBBReg);
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->parmbuf = (unsigned char *)prdbbparm;
|
|
|
|
ph2c->cmdsz = sizeof(struct readBB_parm);
|
|
|
|
ph2c->rsp = pval;
|
|
|
|
ph2c->rspsz = sizeof(struct readBB_rsp);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
prdbbparm ->offset = offset;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct writeRF_parm* pwriterfparm;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
_func_enter_;
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
2014-12-19 06:59:46 +00:00
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
pwriterfparm = (struct writeRF_parm*)rtw_zmalloc(sizeof(struct writeRF_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pwriterfparm==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pwriterfparm->offset = offset;
|
|
|
|
pwriterfparm->value = val;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct readRF_parm* prdrfparm;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
prdrfparm = (struct readRF_parm*)rtw_zmalloc(sizeof(struct readRF_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(prdrfparm ==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_init_listhead(&ph2c->list);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->cmdcode =GEN_CMD_CODE(_GetRFReg);
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->parmbuf = (unsigned char *)prdrfparm;
|
|
|
|
ph2c->cmdsz = sizeof(struct readRF_parm);
|
|
|
|
ph2c->rsp = pval;
|
|
|
|
ph2c->rspsz = sizeof(struct readRF_rsp);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
prdrfparm ->offset = offset;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_getbbrfreg_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
_func_enter_;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//rtw_free_cmd_obj(pcmd);
|
|
|
|
rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz);
|
|
|
|
rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_readtssi_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz);
|
|
|
|
rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_createbss_cmd(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* pcmd;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
WLAN_BSSID_EX *pdev_network = &padapter->registrypriv.dev_network;
|
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_led_control(padapter, LED_CTL_START_TO_LINK);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pmlmepriv->assoc_ssid.SsidLength == 0){
|
2014-12-19 06:59:46 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,(" createbss for Any SSid:%s\n",pmlmepriv->assoc_ssid.Ssid));
|
2014-12-11 21:15:04 +00:00
|
|
|
} else {
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,(" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid));
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmd==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_init_listhead(&pcmd->list);
|
|
|
|
pcmd->cmdcode = _CreateBss_CMD_;
|
|
|
|
pcmd->parmbuf = (unsigned char *)pdev_network;
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd->cmdsz = get_WLAN_BSSID_EX_sz((WLAN_BSSID_EX*)pdev_network);
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd->rsp = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
pcmd->rspsz = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
pdev_network->Length = pcmd->cmdsz;
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned int sz)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* pcmd;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmd==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_init_listhead(&pcmd->list);
|
|
|
|
pcmd->cmdcode = GEN_CMD_CODE(_CreateBss);
|
|
|
|
pcmd->parmbuf = pbss;
|
|
|
|
pcmd->cmdsz = sz;
|
|
|
|
pcmd->rsp = NULL;
|
|
|
|
pcmd->rspsz = 0;
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
|
|
|
return res;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 *auth, res = _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
uint t_len = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
WLAN_BSSID_EX *psecnetwork;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_obj *pcmd;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct qos_priv *pqospriv= &pmlmepriv->qospriv;
|
|
|
|
struct security_priv *psecuritypriv=&padapter->securitypriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_80211N_HT
|
|
|
|
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
|
|
|
|
#endif //CONFIG_80211N_HT
|
|
|
|
NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_led_control(padapter, LED_CTL_START_TO_LINK);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pmlmepriv->assoc_ssid.SsidLength == 0){
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n"));
|
|
|
|
} else {
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid=[%s]\n", pmlmepriv->assoc_ssid.Ssid));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmd==NULL){
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n"));
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
/* // for IEs is pointer
|
|
|
|
t_len = sizeof (ULONG) + sizeof (NDIS_802_11_MAC_ADDRESS) + 2 +
|
|
|
|
sizeof (NDIS_802_11_SSID) + sizeof (ULONG) +
|
|
|
|
sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) +
|
|
|
|
sizeof (NDIS_802_11_CONFIGURATION) +
|
|
|
|
sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE) +
|
2014-12-11 21:15:04 +00:00
|
|
|
sizeof (NDIS_802_11_RATES_EX)+ sizeof(WLAN_PHY_INFO)+ sizeof (ULONG) + MAX_IE_SZ;
|
|
|
|
*/
|
|
|
|
//for IEs is fix buf size
|
|
|
|
t_len = sizeof(WLAN_BSSID_EX);
|
|
|
|
|
|
|
|
|
|
|
|
//for hidden ap to set fw_state here
|
|
|
|
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != _TRUE)
|
|
|
|
{
|
|
|
|
switch(ndis_network_mode)
|
|
|
|
{
|
|
|
|
case Ndis802_11IBSS:
|
|
|
|
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
case Ndis802_11Infrastructure:
|
|
|
|
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
|
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
case Ndis802_11APMode:
|
|
|
|
case Ndis802_11AutoUnknown:
|
|
|
|
case Ndis802_11InfrastructureMax:
|
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psecnetwork=(WLAN_BSSID_EX *)&psecuritypriv->sec_bss;
|
|
|
|
if(psecnetwork==NULL)
|
|
|
|
{
|
|
|
|
if(pcmd !=NULL)
|
|
|
|
rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
res=_FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork==NULL!!!\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_memset(psecnetwork, 0, t_len);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(psecnetwork, &pnetwork->network, get_WLAN_BSSID_EX_sz(&pnetwork->network));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
auth=&psecuritypriv->authenticator_ie[0];
|
|
|
|
psecuritypriv->authenticator_ie[0]=(unsigned char)psecnetwork->IELength;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if((psecnetwork->IELength-12) < (256-1)) {
|
|
|
|
_rtw_memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12);
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psecnetwork->IELength = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
// Added by Albert 2009/02/18
|
|
|
|
// If the the driver wants to use the bssid to create the connection.
|
|
|
|
// If not, we have to copy the connecting AP's MAC address to it so that
|
|
|
|
// the driver just has the bssid information for PMKIDList searching.
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if ( pmlmepriv->assoc_by_bssid == _FALSE )
|
|
|
|
{
|
|
|
|
_rtw_memcpy( &pmlmepriv->assoc_bssid[ 0 ], &pnetwork->network.MacAddress[ 0 ], ETH_ALEN );
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
psecnetwork->IELength = rtw_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength);
|
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pqospriv->qos_option = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
if(pregistrypriv->wmm_enable)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 tmp_len;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
tmp_len = rtw_restruct_wmm_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, psecnetwork->IELength);
|
|
|
|
|
|
|
|
if (psecnetwork->IELength != tmp_len)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
psecnetwork->IELength = tmp_len;
|
2014-12-11 21:15:04 +00:00
|
|
|
pqospriv->qos_option = 1; //There is WMM IE in this corresp. beacon
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
pqospriv->qos_option = 0;//There is no WMM IE in this corresp. beacon
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_80211N_HT
|
|
|
|
phtpriv->ht_option = _FALSE;
|
|
|
|
if(pregistrypriv->ht_enable)
|
|
|
|
{
|
|
|
|
// Added by Albert 2010/06/23
|
|
|
|
// For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue.
|
|
|
|
// Especially for Realtek 8192u SoftAP.
|
|
|
|
if ( ( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_ ) &&
|
|
|
|
( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_ ) &&
|
|
|
|
( padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_ ))
|
|
|
|
{
|
|
|
|
//rtw_restructure_ht_ie
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0],
|
|
|
|
pnetwork->network.IELength, &psecnetwork->IELength);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->network.IEs, pnetwork->network.IELength);
|
|
|
|
|
|
|
|
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_TENDA)
|
2014-12-11 21:15:04 +00:00
|
|
|
adapter_to_pwrctl(padapter)->smart_ps = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
adapter_to_pwrctl(padapter)->smart_ps = padapter->registrypriv.smart_ps;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X("%s: smart_ps=%d\n", __func__, adapter_to_pwrctl(padapter)->smart_ps);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#if 0
|
|
|
|
psecuritypriv->supplicant_ie[0]=(u8)psecnetwork->IELength;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psecnetwork->IELength < (256-1))
|
|
|
|
{
|
|
|
|
_rtw_memcpy(&psecuritypriv->supplicant_ie[1], &psecnetwork->IEs[0], psecnetwork->IELength);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_rtw_memcpy(&psecuritypriv->supplicant_ie[1], &psecnetwork->IEs[0], (256-1));
|
|
|
|
}
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd->cmdsz = get_WLAN_BSSID_EX_sz(psecnetwork);//get cmdsz before endian conversion
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_listhead(&pcmd->list);
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmd->cmdcode = _JoinBss_CMD_;//GEN_CMD_CODE(_JoinBss)
|
2013-05-08 21:45:39 +00:00
|
|
|
pcmd->parmbuf = (unsigned char *)psecnetwork;
|
|
|
|
pcmd->rsp = NULL;
|
|
|
|
pcmd->rspsz = 0;
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
|
|
|
|
|
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_disassoc_cmd(struct adapter*padapter, u32 deauth_timeout_ms, bool enqueue) /* for sta_mode */
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *cmdobj = NULL;
|
|
|
|
struct disconnect_parm *param = NULL;
|
|
|
|
struct cmd_priv *cmdpriv = &padapter->cmdpriv;
|
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_disassoc_cmd\n"));
|
|
|
|
|
|
|
|
/* prepare cmd parameter */
|
|
|
|
param = (struct disconnect_parm *)rtw_zmalloc(sizeof(*param));
|
|
|
|
if (param == NULL) {
|
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
param->deauth_timeout_ms = deauth_timeout_ms;
|
|
|
|
|
|
|
|
if (enqueue) {
|
|
|
|
/* need enqueue, prepare cmd_obj and enqueue */
|
|
|
|
cmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(*cmdobj));
|
|
|
|
if (cmdobj == NULL) {
|
|
|
|
res = _FAIL;
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *)param, sizeof(*param));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(cmdobj, param, _DisConnect_CMD_);
|
|
|
|
res = rtw_enqueue_cmd(cmdpriv, cmdobj);
|
|
|
|
} else {
|
|
|
|
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
|
|
|
|
if (H2C_SUCCESS != disconnect_hdl(padapter, (u8 *)param))
|
|
|
|
res = _FAIL;
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *)param, sizeof(*param));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setopmode_cmd(struct adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct setopmode_parm* psetop;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv= &padapter->cmdpriv;
|
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-19 06:59:46 +00:00
|
|
|
psetop = (struct setopmode_parm*)rtw_zmalloc(sizeof(struct setopmode_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
if(psetop==NULL){
|
2014-12-11 21:15:04 +00:00
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
psetop->mode = (u8)networktype;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(enqueue){
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *)psetop, sizeof(*psetop));
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_);
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
setopmode_hdl(padapter, (u8 *)psetop);
|
|
|
|
rtw_mfree((u8 *)psetop, sizeof(*psetop));
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct set_stakey_parm *psetstakey_para;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct set_stakey_rsp *psetstakey_rsp = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
|
|
|
struct sta_info* sta = (struct sta_info* )psta;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm));
|
2014-12-19 06:59:46 +00:00
|
|
|
if(psetstakey_para==NULL){
|
2014-12-11 21:15:04 +00:00
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(psetstakey_para->addr, sta->hwaddr,ETH_ALEN);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)){
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_TDLS
|
2014-12-11 21:15:04 +00:00
|
|
|
if(sta->tdls_sta_state&TDLS_LINKED_STATE)
|
|
|
|
psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy;
|
|
|
|
else
|
|
|
|
#endif //CONFIG_TDLS
|
|
|
|
psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm;
|
|
|
|
}else{
|
|
|
|
GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, _FALSE);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (unicast_key == _TRUE) {
|
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
if((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE)
|
|
|
|
_rtw_memcpy(&psetstakey_para->key, sta->tpk.tk, 16);
|
|
|
|
else
|
|
|
|
#endif //CONFIG_TDLS
|
|
|
|
_rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
_rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
//jeff: set this becasue at least sw key is ready
|
|
|
|
padapter->securitypriv.busetkipkey=_TRUE;
|
|
|
|
|
|
|
|
if(enqueue)
|
|
|
|
{
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if ( ph2c == NULL){
|
|
|
|
rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psetstakey_rsp == NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
|
|
|
|
res=_FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
|
|
|
|
ph2c->rsp = (u8 *) psetstakey_rsp;
|
|
|
|
ph2c->rspsz = sizeof(struct set_stakey_rsp);
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
set_stakey_hdl(padapter, (u8 *)psetstakey_para);
|
|
|
|
rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct set_stakey_parm *psetstakey_para;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
struct set_stakey_rsp *psetstakey_rsp = NULL;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
|
|
|
struct sta_info* sta = (struct sta_info* )psta;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!enqueue)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
clear_cam_entry(padapter, entry);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if ( ph2c == NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm));
|
|
|
|
if(psetstakey_para==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psetstakey_rsp == NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->rsp = (u8 *) psetstakey_rsp;
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->rspsz = sizeof(struct set_stakey_rsp);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
psetstakey_para->algorithm = _NO_PRIVACY_;
|
|
|
|
|
|
|
|
psetstakey_para->id = entry;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_table)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct setratable_parm * psetrttblparm;
|
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
psetrttblparm = (struct setratable_parm*)rtw_zmalloc(sizeof(struct setratable_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psetrttblparm==NULL){
|
|
|
|
rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable));
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(psetrttblparm,prate_table,sizeof(struct setratable_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct getratable_parm * pgetrttblparm;
|
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
pgetrttblparm = (struct getratable_parm*)rtw_zmalloc(sizeof(struct getratable_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pgetrttblparm==NULL){
|
|
|
|
rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_init_listhead(&ph2c->list);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->cmdcode =GEN_CMD_CODE(_GetRaTable);
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->parmbuf = (unsigned char *)pgetrttblparm;
|
|
|
|
ph2c->cmdsz = sizeof(struct getratable_parm);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->rsp = (u8*)pval;
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->rspsz = sizeof(struct getratable_rsp);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pgetrttblparm ->rsvd = 0x0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct set_assocsta_parm *psetassocsta_para;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct set_stakey_rsp *psetassocsta_rsp = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psetassocsta_para = (struct set_assocsta_parm*)rtw_zmalloc(sizeof(struct set_assocsta_parm));
|
|
|
|
if(psetassocsta_para==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
psetassocsta_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_assocsta_rsp));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psetassocsta_rsp==NULL){
|
|
|
|
rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj));
|
|
|
|
rtw_mfree((u8 *) psetassocsta_para, sizeof(struct set_assocsta_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_);
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c->rsp = (u8 *) psetassocsta_rsp;
|
2013-05-08 21:45:39 +00:00
|
|
|
ph2c->rspsz = sizeof(struct set_assocsta_rsp);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(psetassocsta_para->addr, mac_addr,ETH_ALEN);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_addbareq_cmd(struct adapter*padapter, u8 tid, u8 *addr)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
struct cmd_obj* ph2c;
|
|
|
|
struct addBaReq_parm *paddbareq_parm;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
paddbareq_parm = (struct addBaReq_parm*)rtw_zmalloc(sizeof(struct addBaReq_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(paddbareq_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
paddbareq_parm->tid = tid;
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(paddbareq_parm->addr, addr, ETH_ALEN);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, GEN_CMD_CODE(_AddBAReq));
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//DBG_871X("rtw_addbareq_cmd, tid=%d\n", tid);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
//add for CONFIG_IEEE80211W, none 11w can use it
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_reset_securitypriv_cmd(struct adapter*padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = RESET_SECURITYPRIV;
|
|
|
|
pdrvextra_cmd_parm->type_size = 0;
|
|
|
|
pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_free_assoc_resources_cmd(struct adapter*padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
u8 res=_SUCCESS;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm->ec_id = FREE_ASSOC_RESOURCES;
|
|
|
|
pdrvextra_cmd_parm->type_size = 0;
|
|
|
|
pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_dynamic_chk_wk_cmd(struct adapter*padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
u8 res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter)
|
|
|
|
pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv);
|
|
|
|
#endif
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = DYNAMIC_CHK_WK_CID;
|
|
|
|
pdrvextra_cmd_parm->type_size = 0;
|
|
|
|
pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2013-05-08 21:45:39 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_set_ch_cmd(struct adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *pcmdobj;
|
|
|
|
struct set_ch_parm *set_ch_parm;
|
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n",
|
2013-05-08 21:45:39 +00:00
|
|
|
FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset);
|
|
|
|
|
|
|
|
/* check input parameter */
|
|
|
|
|
|
|
|
/* prepare cmd parameter */
|
|
|
|
set_ch_parm = (struct set_ch_parm *)rtw_zmalloc(sizeof(*set_ch_parm));
|
|
|
|
if (set_ch_parm == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
set_ch_parm->ch = ch;
|
|
|
|
set_ch_parm->bw = bw;
|
|
|
|
set_ch_parm->ch_offset = ch_offset;
|
|
|
|
|
|
|
|
if (enqueue) {
|
|
|
|
/* need enqueue, prepare cmd_obj and enqueue */
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmdobj == NULL){
|
|
|
|
rtw_mfree((u8 *)set_ch_parm, sizeof(*set_ch_parm));
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(pcmdobj, set_ch_parm, GEN_CMD_CODE(_SetChannel));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
|
|
|
|
} else {
|
|
|
|
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
|
2014-12-11 21:15:04 +00:00
|
|
|
if( H2C_SUCCESS !=set_ch_hdl(padapter, (u8 *)set_ch_parm) )
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *)set_ch_parm, sizeof(*set_ch_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* do something based on res... */
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X(FUNC_NDEV_FMT" res:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), res);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* pcmdobj;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct SetChannelPlan_param *setChannelPlan_param;
|
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n"));
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//check input parameter
|
|
|
|
if(!rtw_is_channel_plan_valid(chplan)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//prepare cmd parameter
|
2013-05-08 21:45:39 +00:00
|
|
|
setChannelPlan_param = (struct SetChannelPlan_param *)rtw_zmalloc(sizeof(struct SetChannelPlan_param));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(setChannelPlan_param == NULL) {
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
setChannelPlan_param->channel_plan=chplan;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(enqueue)
|
|
|
|
{
|
|
|
|
//need enqueue, prepare cmd_obj and enqueue
|
|
|
|
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmdobj == NULL){
|
|
|
|
rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param));
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//no need to enqueue, do the cmd hdl directly and free cmd parameter
|
|
|
|
if( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) )
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//do something based on res...
|
|
|
|
if(res == _SUCCESS)
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter->mlmepriv.ChannelPlan = chplan;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_led_blink_cmd(struct adapter*padapter, PLED_871x pLed)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* pcmdobj;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct LedBlink_param *ledBlink_param;
|
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmdobj == NULL){
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
ledBlink_param = (struct LedBlink_param *)rtw_zmalloc(sizeof(struct LedBlink_param));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ledBlink_param == NULL) {
|
|
|
|
rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ledBlink_param->pLed=pLed;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(pcmdobj, ledBlink_param, GEN_CMD_CODE(_LedBlink));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_set_csa_cmd(struct adapter*padapter, u8 new_ch_no)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* pcmdobj;
|
|
|
|
struct SetChannelSwitch_param*setChannelSwitch_param;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 res=_SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmdobj == NULL){
|
|
|
|
res=_FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
setChannelSwitch_param = (struct SetChannelSwitch_param *)rtw_zmalloc(sizeof(struct SetChannelSwitch_param));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(setChannelSwitch_param == NULL) {
|
|
|
|
rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
setChannelSwitch_param->new_ch_no=new_ch_no;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelSwitch_param, GEN_CMD_CODE(_SetChannelSwitch));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj* pcmdobj;
|
|
|
|
struct TDLSoption_param *TDLSoption;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_tdls_cmd\n"));
|
|
|
|
|
|
|
|
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
|
|
|
if(pcmdobj == NULL){
|
|
|
|
res=_FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
TDLSoption= (struct TDLSoption_param *)rtw_zmalloc(sizeof(struct TDLSoption_param));
|
|
|
|
if(TDLSoption == NULL) {
|
|
|
|
rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_rtw_spinlock(&(padapter->tdlsinfo.cmd_lock));
|
2014-12-19 06:59:46 +00:00
|
|
|
_rtw_memcpy(TDLSoption->addr, addr, 6);
|
2014-12-11 21:15:04 +00:00
|
|
|
TDLSoption->option = option;
|
|
|
|
_rtw_spinunlock(&(padapter->tdlsinfo.cmd_lock));
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_TDLS
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_DETECT_C2H_BY_POLLING
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_event_polling_cmd(struct adapter*padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_obj* ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
|
|
|
|
u8 res=_SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_CONCURRENT_MODE)
|
|
|
|
if (padapter->adapter_type != PRIMARY_ADAPTER)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = EVENT_POLLING_CID;
|
|
|
|
pdrvextra_cmd_parm->type_size = 0;
|
|
|
|
pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
|
|
|
return res;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void traffic_status_watchdog(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_LPS
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 bEnterPS;
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
u16 BusyThreshold = 200;// 100;
|
|
|
|
u8 bBusyTraffic = _FALSE, bTxBusyTraffic = _FALSE, bRxBusyTraffic = _FALSE;
|
|
|
|
u8 bHigherBusyTraffic = _FALSE, bHigherBusyRxTraffic = _FALSE, bHigherBusyTxTraffic = _FALSE;
|
|
|
|
#ifdef CONFIG_FTP_PROTECT
|
|
|
|
u16 bPktCount = 0;
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
|
|
|
|
#endif //CONFIG_TDLS
|
|
|
|
|
|
|
|
RT_LINK_DETECT_T * link_detect = &pmlmepriv->LinkDetectInfo;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Determine if our traffic is busy now
|
|
|
|
//
|
2014-12-19 06:59:46 +00:00
|
|
|
if((check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
|
2014-12-11 21:15:04 +00:00
|
|
|
/*&& !MgntInitAdapterInProgress(pMgntInfo)*/)
|
|
|
|
{
|
|
|
|
// if we raise bBusyTraffic in last watchdog, using lower threshold.
|
|
|
|
if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
|
|
|
|
BusyThreshold =180; // 75;
|
|
|
|
if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold ||
|
|
|
|
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold )
|
|
|
|
{
|
|
|
|
bBusyTraffic = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
|
2014-12-11 21:15:04 +00:00
|
|
|
bRxBusyTraffic = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
bTxBusyTraffic = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// Higher Tx/Rx data.
|
|
|
|
if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
|
|
|
|
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000 )
|
|
|
|
{
|
|
|
|
bHigherBusyTraffic = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
|
2014-12-11 21:15:04 +00:00
|
|
|
bHigherBusyRxTraffic = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
bHigherBusyTxTraffic = _TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_FTP_PROTECT
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_871X("RX in period:%d, TX in period:%d, ftp_lock_flag:%d\n",
|
2014-12-11 21:15:04 +00:00
|
|
|
pmlmepriv->LinkDetectInfo.NumRxOkInPeriod,
|
|
|
|
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,
|
|
|
|
pmlmepriv->ftp_lock_flag);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
bPktCount = pmlmepriv->LinkDetectInfo.NumRxOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod;
|
|
|
|
if (bPktCount > 20 && !pmlmepriv->ftp_lock_flag) {
|
|
|
|
pmlmepriv->ftp_lock_flag = 1;
|
|
|
|
rtw_lock_suspend();
|
|
|
|
} else if(bPktCount == 0 && pmlmepriv->ftp_lock_flag) {
|
|
|
|
pmlmepriv->ftp_lock_flag = 0;
|
|
|
|
rtw_unlock_suspend();
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_KEEP_FTP_TRANSMIT
|
|
|
|
|
|
|
|
#ifdef CONFIG_TRAFFIC_PROTECT
|
|
|
|
#define TX_ACTIVE_TH 2
|
|
|
|
#define RX_ACTIVE_TH 1
|
|
|
|
#define TRAFFIC_PROTECT_PERIOD_MS 4500
|
|
|
|
|
|
|
|
if (link_detect->NumTxOkInPeriod > TX_ACTIVE_TH
|
|
|
|
|| link_detect->NumRxUnicastOkInPeriod > RX_ACTIVE_TH) {
|
|
|
|
|
|
|
|
DBG_871X_LEVEL(_drv_info_, FUNC_ADPT_FMT" acqiure wake_lock for %u ms(tx:%d,rx_unicast:%d)\n",
|
|
|
|
FUNC_ADPT_ARG(padapter),
|
|
|
|
TRAFFIC_PROTECT_PERIOD_MS,
|
|
|
|
link_detect->NumTxOkInPeriod,
|
|
|
|
link_detect->NumRxUnicastOkInPeriod);
|
|
|
|
|
|
|
|
rtw_lock_suspend_timeout(TRAFFIC_PROTECT_PERIOD_MS);
|
|
|
|
}
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
#ifdef CONFIG_TDLS_AUTOSETUP
|
|
|
|
if( ( ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0 ) //10 * 2sec, periodically sending
|
|
|
|
issue_tdls_dis_req( padapter, NULL );
|
|
|
|
ptdlsinfo->watchdog_count++;
|
|
|
|
#endif //CONFIG_TDLS_AUTOSETUP
|
|
|
|
#endif //CONFIG_TDLS
|
|
|
|
|
|
|
|
#ifdef CONFIG_LPS
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
if (BT_1Ant(padapter) == _FALSE)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
// check traffic for powersaving.
|
|
|
|
if( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) ||
|
|
|
|
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2) )
|
|
|
|
{
|
|
|
|
//DBG_871X("Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod);
|
|
|
|
bEnterPS= _FALSE;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
bEnterPS= _TRUE;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// LeisurePS only work in infra mode.
|
|
|
|
if(bEnterPS)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
LPS_Enter(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
LPS_Leave(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // CONFIG_LPS
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_LPS
|
2013-05-08 21:45:39 +00:00
|
|
|
LPS_Leave(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pmlmepriv->LinkDetectInfo.NumRxOkInPeriod = 0;
|
|
|
|
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod = 0;
|
|
|
|
pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod = 0;
|
|
|
|
pmlmepriv->LinkDetectInfo.bBusyTraffic = bBusyTraffic;
|
|
|
|
pmlmepriv->LinkDetectInfo.bTxBusyTraffic = bTxBusyTraffic;
|
|
|
|
pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic;
|
|
|
|
pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic;
|
|
|
|
pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic;
|
|
|
|
pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz);
|
|
|
|
void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct mlme_priv *pmlmepriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
padapter = (struct adapter *)pbuf;
|
2013-05-08 21:45:39 +00:00
|
|
|
pmlmepriv = &(padapter->mlmepriv);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
|
|
|
|
#ifdef CONFIG_AP_MODE
|
|
|
|
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
expire_timeout_chk(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
#endif
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef DBG_CONFIG_ERROR_DETECT
|
|
|
|
rtw_hal_sreset_xmit_status_check(padapter);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==_FALSE)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
linked_status_chk(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
traffic_status_watchdog(padapter);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_hal_dm_watchdog(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
//
|
|
|
|
// BT-Coexist
|
|
|
|
//
|
|
|
|
BT_CoexistMechanism(padapter);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_LPS
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type);
|
|
|
|
void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
|
|
|
u8 mstatus;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)
|
|
|
|
|| (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
switch(lps_ctrl_type)
|
|
|
|
{
|
|
|
|
case LPS_CTRL_SCAN:
|
|
|
|
//DBG_871X("LPS_CTRL_SCAN \n");
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
BT_WifiScanNotify(padapter, _TRUE);
|
|
|
|
if (BT_1Ant(padapter) == _FALSE)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
|
|
|
{ //connect
|
|
|
|
LPS_Leave(padapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LPS_CTRL_JOINBSS:
|
|
|
|
//DBG_871X("LPS_CTRL_JOINBSS \n");
|
2013-10-19 17:45:47 +00:00
|
|
|
LPS_Leave(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
case LPS_CTRL_CONNECT:
|
|
|
|
//DBG_871X("LPS_CTRL_CONNECT \n");
|
|
|
|
mstatus = 1;//connect
|
|
|
|
// Reset LPS Setting
|
|
|
|
pwrpriv->LpsIdleCount = 0;
|
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus));
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
BT_WifiMediaStatusNotify(padapter, mstatus);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case LPS_CTRL_DISCONNECT:
|
|
|
|
//DBG_871X("LPS_CTRL_DISCONNECT \n");
|
|
|
|
mstatus = 0;//disconnect
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
BT_WifiMediaStatusNotify(padapter, mstatus);
|
|
|
|
if (BT_1Ant(padapter) == _FALSE)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
LPS_Leave(padapter);
|
|
|
|
}
|
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus));
|
|
|
|
break;
|
|
|
|
case LPS_CTRL_SPECIAL_PACKET:
|
|
|
|
//DBG_871X("LPS_CTRL_SPECIAL_PACKET \n");
|
|
|
|
pwrpriv->DelayLPSLastTimeStamp = rtw_get_current_time();
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
BT_SpecialPacketNotify(padapter);
|
|
|
|
if (BT_1Ant(padapter) == _FALSE)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
LPS_Leave(padapter);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LPS_CTRL_LEAVE:
|
|
|
|
//DBG_871X("LPS_CTRL_LEAVE \n");
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
BT_LpsLeave(padapter);
|
|
|
|
if (BT_1Ant(padapter) == _FALSE)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
LPS_Leave(padapter);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_lps_ctrl_wk_cmd(struct adapter*padapter, u8 lps_ctrl_type, u8 enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
//struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 res = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//if(!pwrctrlpriv->bLeisurePs)
|
|
|
|
// return res;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if (padapter->iface_type != IFACE_PORT0)
|
|
|
|
return res;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(enqueue)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = LPS_CTRL_WK_CID;
|
|
|
|
pdrvextra_cmd_parm->type_size = lps_ctrl_type;
|
|
|
|
pdrvextra_cmd_parm->pbuf = NULL;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
lps_ctrl_wk_hdl(padapter, lps_ctrl_type);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (RATE_ADAPTIVE_SUPPORT==1)
|
2014-12-17 23:13:53 +00:00
|
|
|
void rpt_timer_setting_wk_hdl(struct adapter *padapter, u16 minRptTime)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_RPT_TIMER_SETTING, (u8 *)(&minRptTime));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_rpt_timer_cfg_cmd(struct adapter*padapter, u16 minRptTime)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
|
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = RTP_TIMER_CFG_WK_CID;
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm->type_size = minRptTime;
|
2013-05-08 21:45:39 +00:00
|
|
|
pdrvextra_cmd_parm->pbuf = NULL;
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
2014-12-17 23:13:53 +00:00
|
|
|
void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_SELECT, (u8 *)(&antenna));
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_antenna_select_cmd(struct adapter*padapter, u8 antenna,u8 enqueue)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 bSupportAntDiv = _FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
rtw_hal_get_def_var(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv));
|
|
|
|
if(_FALSE == bSupportAntDiv ) return res;
|
2013-07-27 19:49:25 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(_TRUE == enqueue)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = ANT_SELECT_WK_CID;
|
|
|
|
pdrvextra_cmd_parm->type_size = antenna;
|
|
|
|
pdrvextra_cmd_parm->pbuf = NULL;
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
antenna_select_wk_hdl(padapter,antenna );
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
exit:
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void power_saving_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz);
|
|
|
|
void power_saving_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
rtw_ps_processor(padapter);
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//add for CONFIG_IEEE80211W, none 11w can use it
|
2014-12-17 23:13:53 +00:00
|
|
|
void reset_securitypriv_hdl(struct adapter *padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
rtw_reset_securitypriv(padapter);
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void free_assoc_resources_hdl(struct adapter *padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
rtw_free_assoc_resources(padapter, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_P2P
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType )
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
u8 res = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID;
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm->type_size = intCmdType; // As the command tppe.
|
|
|
|
pdrvextra_cmd_parm->pbuf = NULL; // Must be NULL here
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_P2P
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_ps_cmd(struct adapter*padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ppscmd;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 res = _SUCCESS;
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if (padapter->adapter_type != PRIMARY_ADAPTER)
|
|
|
|
goto exit;
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
ppscmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ppscmd==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ppscmd, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
pdrvextra_cmd_parm->ec_id = POWER_SAVING_CTRL_WK_CID;
|
2013-05-08 21:45:39 +00:00
|
|
|
pdrvextra_cmd_parm->pbuf = NULL;
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ppscmd, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ppscmd);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_AP_MODE
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
int cnt=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_info *psta_bmc;
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
|
|
|
|
psta_bmc = rtw_get_bcmc_stainfo(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!psta_bmc)
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psta_bmc->sleepq_len==0)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 val = 0;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//while((rtw_read32(padapter, 0x414)&0x00ffff00)!=0)
|
|
|
|
//while((rtw_read32(padapter, 0x414)&0x0000ff00)!=0)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
while(_FALSE == val)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_msleep_os(100);
|
|
|
|
|
|
|
|
cnt++;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(cnt>10)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val);
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(cnt<=10)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->tim_bitmap &= ~BIT(0);
|
|
|
|
pstapriv->sta_dz_bitmap &= ~BIT(0);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
update_beacon(padapter, _TIM_IE_, NULL, _FALSE);
|
|
|
|
}
|
|
|
|
else //re check again
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_chk_hi_queue_cmd(padapter);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_chk_hi_queue_cmd(struct adapter*padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
u8 res = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(ph2c==NULL){
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2014-12-11 21:15:04 +00:00
|
|
|
if(pdrvextra_cmd_parm==NULL){
|
|
|
|
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
|
|
|
|
res= _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = CHECK_HIQ_WK_CID;
|
|
|
|
pdrvextra_cmd_parm->type_size = 0;
|
|
|
|
pdrvextra_cmd_parm->pbuf = NULL;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct cmd_obj *ph2c;
|
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
|
|
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
|
|
|
u8 res = _SUCCESS;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (ph2c == NULL) {
|
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pdrvextra_cmd_parm == NULL) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj));
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdrvextra_cmd_parm->ec_id = C2H_WK_CID;
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd_parm->type_size = c2h_evt?16:0;
|
2013-05-08 21:45:39 +00:00
|
|
|
pdrvextra_cmd_parm->pbuf = c2h_evt;
|
|
|
|
|
|
|
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
|
|
|
|
|
|
|
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 ret = _FAIL;
|
|
|
|
u8 buf[16];
|
|
|
|
|
|
|
|
if (!c2h_evt) {
|
|
|
|
/* No c2h event in cmd_obj, read c2h event before handling*/
|
|
|
|
if (c2h_evt_read(adapter, buf) == _SUCCESS) {
|
|
|
|
c2h_evt = (struct c2h_evt_hdr *)buf;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (filter && filter(c2h_evt->id) == _FALSE)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
|
|
|
|
ret = rtw_hal_c2h_handler(adapter, c2h_evt);
|
|
|
|
}
|
|
|
|
} else {
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
if (filter && filter(c2h_evt->id) == _FALSE)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
|
|
|
|
ret = rtw_hal_c2h_handler(adapter, c2h_evt);
|
|
|
|
}
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_C2H_WK
|
|
|
|
static void c2h_wk_callback(_workitem *work)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct evt_priv *evtpriv = container_of(work, struct evt_priv, c2h_wk);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *adapter = container_of(evtpriv, struct adapter, evtpriv);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct c2h_evt_hdr *c2h_evt;
|
|
|
|
c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(adapter);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
evtpriv->c2h_wk_alive = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
while (!rtw_cbuf_empty(evtpriv->c2h_queue)) {
|
|
|
|
if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) {
|
|
|
|
/* This C2H event is read, clear it */
|
|
|
|
c2h_evt_clear(adapter);
|
|
|
|
} else if ((c2h_evt = (struct c2h_evt_hdr *)rtw_malloc(16)) != NULL) {
|
|
|
|
/* This C2H event is not read, read & clear now */
|
2014-12-11 21:15:04 +00:00
|
|
|
if (c2h_evt_read(adapter, (u8*)c2h_evt) != _SUCCESS)
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Special pointer to trigger c2h_evt_clear only */
|
|
|
|
if ((void *)c2h_evt == (void *)evtpriv)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!c2h_evt_exist(c2h_evt)) {
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8*)c2h_evt, 16);
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (ccx_id_filter(c2h_evt->id) == _TRUE) {
|
2013-05-08 21:45:39 +00:00
|
|
|
/* Handle CCX report here */
|
|
|
|
rtw_hal_c2h_handler(adapter, c2h_evt);
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_mfree((u8*)c2h_evt, 16);
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
|
|
|
/* Enqueue into cmd_thread for others */
|
|
|
|
rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
evtpriv->c2h_wk_alive = _FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_DETECT_C2H_BY_POLLING
|
2014-12-17 23:13:53 +00:00
|
|
|
void event_polling_hdl(struct adapter *padapter, u8 *pbuf, int sz)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 check_c2hcmd, check_ccx;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
//check_c2hcmd = rtw_read8(padapter, REG_C2HEVT_CLEAR);
|
|
|
|
//check_ccx= rtw_read8(padapter, REG_C2HEVT_MSG_NORMAL);
|
|
|
|
|
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_CLEAR, (u8 *)(&check_c2hcmd));
|
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_MSG_NORMAL, (u8 *)(&check_ccx));
|
|
|
|
|
|
|
|
if (check_c2hcmd != 0)
|
|
|
|
{
|
|
|
|
struct c2h_evt_hdr *c2h_evt;
|
|
|
|
|
|
|
|
if (check_c2hcmd != 0xFF)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
c2h_evt_clear(padapter);
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else if (ccx_id_filter(check_ccx & 0x0F) == _FALSE)
|
|
|
|
{
|
|
|
|
if ((c2h_evt = (struct c2h_evt_hdr *)rtw_zmalloc(16)) != NULL) {
|
|
|
|
if (c2h_evt_read(padapter, (u8 *)c2h_evt) == _SUCCESS) {
|
|
|
|
rtw_hal_c2h_handler(padapter, c2h_evt);
|
|
|
|
}
|
|
|
|
rtw_mfree((u8*)c2h_evt, 16);
|
|
|
|
} else {
|
|
|
|
/* Error handling for malloc fail */
|
|
|
|
if (rtw_cbuf_push(padapter->evtpriv.c2h_queue, (void*)NULL) != _SUCCESS)
|
|
|
|
DBG_871X("%s rtw_cbuf_push fail\n", __func__);
|
|
|
|
_set_workitem(&padapter->evtpriv.c2h_wk);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (padapter->xmitpriv.ack_tx == _FALSE)
|
|
|
|
{
|
|
|
|
c2h_evt_clear(padapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct drvextra_cmd_parm *pdrvextra_cmd;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!pbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
return H2C_PARAMETERS_ERROR;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pdrvextra_cmd = (struct drvextra_cmd_parm*)pbuf;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
switch(pdrvextra_cmd->ec_id)
|
|
|
|
{
|
|
|
|
case DYNAMIC_CHK_WK_CID:
|
|
|
|
dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
|
|
|
|
break;
|
|
|
|
case POWER_SAVING_CTRL_WK_CID:
|
2014-12-19 06:59:46 +00:00
|
|
|
power_saving_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
#ifdef CONFIG_LPS
|
|
|
|
case LPS_CTRL_WK_CID:
|
|
|
|
lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type_size);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if (RATE_ADAPTIVE_SUPPORT==1)
|
|
|
|
case RTP_TIMER_CFG_WK_CID:
|
|
|
|
rpt_timer_setting_wk_hdl(padapter, pdrvextra_cmd->type_size);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
|
|
|
case ANT_SELECT_WK_CID:
|
|
|
|
antenna_select_wk_hdl(padapter, pdrvextra_cmd->type_size);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_P2P_PS
|
|
|
|
case P2P_PS_WK_CID:
|
|
|
|
p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size);
|
|
|
|
break;
|
|
|
|
#endif // CONFIG_P2P_PS
|
|
|
|
case P2P_PROTO_WK_CID:
|
|
|
|
// Commented by Albert 2011/07/01
|
|
|
|
// I used the type_size as the type command
|
|
|
|
p2p_protocol_wk_hdl( padapter, pdrvextra_cmd->type_size );
|
|
|
|
break;
|
|
|
|
#ifdef CONFIG_AP_MODE
|
|
|
|
case CHECK_HIQ_WK_CID:
|
|
|
|
rtw_chk_hi_queue_hdl(padapter);
|
|
|
|
break;
|
|
|
|
#endif //CONFIG_AP_MODE
|
|
|
|
#ifdef CONFIG_INTEL_WIDI
|
|
|
|
case INTEl_WIDI_WK_CID:
|
|
|
|
intel_widi_wk_hdl(padapter, pdrvextra_cmd->type_size, pdrvextra_cmd->pbuf);
|
|
|
|
break;
|
|
|
|
#endif //CONFIG_INTEL_WIDI
|
|
|
|
//add for CONFIG_IEEE80211W, none 11w can use it
|
|
|
|
case RESET_SECURITYPRIV:
|
|
|
|
reset_securitypriv_hdl(padapter);
|
|
|
|
break;
|
|
|
|
case FREE_ASSOC_RESOURCES:
|
|
|
|
free_assoc_resources_hdl(padapter);
|
|
|
|
break;
|
|
|
|
case C2H_WK_CID:
|
|
|
|
c2h_evt_hdl(padapter, (struct c2h_evt_hdr *)pdrvextra_cmd->pbuf, NULL);
|
|
|
|
break;
|
|
|
|
#ifdef CONFIG_DETECT_C2H_BY_POLLING
|
|
|
|
case EVENT_POLLING_CID:
|
|
|
|
event_polling_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
|
|
|
|
break;
|
2013-10-19 17:45:47 +00:00
|
|
|
#endif
|
2014-12-11 21:15:04 +00:00
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pdrvextra_cmd->pbuf && pdrvextra_cmd->type_size>0)
|
|
|
|
{
|
|
|
|
rtw_mfree(pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return H2C_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
if(pcmd->res == H2C_DROPPED)
|
|
|
|
{
|
|
|
|
//TODO: cancel timer and do timeout handler directly...
|
|
|
|
//need to make timeout handlerOS independent
|
2013-05-08 21:45:39 +00:00
|
|
|
_set_timer(&pmlmepriv->scan_to_timer, 1);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else if (pcmd->res != H2C_SUCCESS) {
|
|
|
|
_set_timer(&pmlmepriv->scan_to_timer, 1);
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n."));
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// free cmd
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_disassoc_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
|
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (pcmd->res != H2C_SUCCESS)
|
|
|
|
{
|
|
|
|
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
set_fwstate(pmlmepriv, _FW_LINKED);
|
2014-12-11 21:15:04 +00:00
|
|
|
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ***Error: disconnect_cmd_callback Fail ***\n."));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
#ifdef CONFIG_BR_EXT
|
|
|
|
else //clear bridge database
|
2013-05-08 21:45:39 +00:00
|
|
|
nat25_db_cleanup(padapter);
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif //CONFIG_BR_EXT
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
// free cmd
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_joinbss_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
if(pcmd->res == H2C_DROPPED)
|
|
|
|
{
|
|
|
|
//TODO: cancel timer and do timeout handler directly...
|
|
|
|
//need to make timeout handlerOS independent
|
2013-05-19 04:28:07 +00:00
|
|
|
_set_timer(&pmlmepriv->assoc_timer, 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else if(pcmd->res != H2C_SUCCESS)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
_set_timer(&pmlmepriv->assoc_timer, 1);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 timer_cancelled;
|
|
|
|
struct sta_info *psta = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct wlan_network *pwlan = NULL;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)pcmd->parmbuf;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct wlan_network *tgt_network = &(pmlmepriv->cur_network);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if((pcmd->res != H2C_SUCCESS))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n."));
|
2014-12-19 06:59:46 +00:00
|
|
|
_set_timer(&pmlmepriv->assoc_timer, 1 );
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_FW_MLMLE
|
|
|
|
//endian_convert
|
|
|
|
pnetwork->Length = le32_to_cpu(pnetwork->Length);
|
2014-12-19 06:59:46 +00:00
|
|
|
pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength);
|
2014-12-11 21:15:04 +00:00
|
|
|
pnetwork->Privacy =le32_to_cpu(pnetwork->Privacy);
|
|
|
|
pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi);
|
2014-12-19 06:59:46 +00:00
|
|
|
pnetwork->NetworkTypeInUse =le32_to_cpu(pnetwork->NetworkTypeInUse);
|
2014-12-11 21:15:04 +00:00
|
|
|
pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->Configuration.ATIMWindow);
|
|
|
|
//pnetwork->Configuration.BeaconPeriod = le32_to_cpu(pnetwork->Configuration.BeaconPeriod);
|
|
|
|
pnetwork->Configuration.DSConfig =le32_to_cpu(pnetwork->Configuration.DSConfig);
|
|
|
|
pnetwork->Configuration.FHConfig.DwellTime=le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime);
|
|
|
|
pnetwork->Configuration.FHConfig.HopPattern=le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern);
|
|
|
|
pnetwork->Configuration.FHConfig.HopSet=le32_to_cpu(pnetwork->Configuration.FHConfig.HopSet);
|
2014-12-19 06:59:46 +00:00
|
|
|
pnetwork->Configuration.FHConfig.Length=le32_to_cpu(pnetwork->Configuration.FHConfig.Length);
|
2014-12-11 21:15:04 +00:00
|
|
|
pnetwork->Configuration.Length = le32_to_cpu(pnetwork->Configuration.Length);
|
|
|
|
pnetwork->InfrastructureMode = le32_to_cpu(pnetwork->InfrastructureMode);
|
|
|
|
pnetwork->IELength = le32_to_cpu(pnetwork->IELength);
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) )
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress);
|
2014-12-11 21:15:04 +00:00
|
|
|
if(!psta)
|
|
|
|
{
|
|
|
|
psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress);
|
2014-12-19 06:59:46 +00:00
|
|
|
if (psta == NULL)
|
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nCan't alloc sta_info when createbss_cmd_callback\n"));
|
|
|
|
goto createbss_cmd_fail ;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_indicate_connect( padapter);
|
|
|
|
}
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pwlan = _rtw_alloc_network(pmlmepriv);
|
2014-12-11 21:15:04 +00:00
|
|
|
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
|
|
if ( pwlan == NULL)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue);
|
2014-12-11 21:15:04 +00:00
|
|
|
if( pwlan == NULL)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n Error: can't get pwlan in rtw_joinbss_event_callback \n"));
|
|
|
|
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto createbss_cmd_fail;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
pwlan->last_scanned = rtw_get_current_time();
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork);
|
|
|
|
_rtw_memcpy(&(pwlan->network), pnetwork, pnetwork->Length);
|
|
|
|
//pwlan->fixed = _TRUE;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
// copy pdev_network information to pmlmepriv->cur_network
|
2014-12-11 21:15:04 +00:00
|
|
|
_rtw_memcpy(&tgt_network->network, pnetwork, (get_WLAN_BSSID_EX_sz(pnetwork)));
|
|
|
|
|
|
|
|
// reset DSConfig
|
|
|
|
//tgt_network->network.Configuration.DSConfig = (u32)rtw_ch2freq(pnetwork->Configuration.DSConfig);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#if 0
|
2014-12-11 21:15:04 +00:00
|
|
|
if((pmlmepriv->fw_state) & WIFI_AP_STATE)
|
|
|
|
{
|
|
|
|
psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress);
|
|
|
|
|
|
|
|
if (psta == NULL) { // for AP Mode & Adhoc Master Mode
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nCan't alloc sta_info when createbss_cmd_callback\n"));
|
|
|
|
goto createbss_cmd_fail ;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_indicate_connect( padapter);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
//rtw_indicate_disconnect(dev);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
#endif
|
|
|
|
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
|
|
// we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
createbss_cmd_fail:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_free_cmd_obj(pcmd);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_setstaKey_cmdrsp_callback(struct adapter* padapter , struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
struct sta_priv * pstapriv = &padapter->stapriv;
|
|
|
|
struct set_stakey_rsp* psetstakey_rsp = (struct set_stakey_rsp*) (pcmd->rsp);
|
|
|
|
struct sta_info* psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psta==NULL)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info \n\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
//psta->aid = psta->mac_id = psetstakey_rsp->keyid; //CAM_ID(CAM_ENTRY)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
exit:
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_cmd_obj(pcmd);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
_func_exit_;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
_irqL irqL;
|
|
|
|
struct sta_priv * pstapriv = &padapter->stapriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct set_assocsta_parm* passocsta_parm = (struct set_assocsta_parm*)(pcmd->parmbuf);
|
2014-12-19 06:59:46 +00:00
|
|
|
struct set_assocsta_rsp* passocsta_rsp = (struct set_assocsta_rsp*) (pcmd->rsp);
|
2014-12-11 21:15:04 +00:00
|
|
|
struct sta_info* psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_func_enter_;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if(psta==NULL)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info \n\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psta->aid = psta->mac_id = passocsta_rsp->cam_id;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE))
|
2013-05-08 21:45:39 +00:00
|
|
|
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
|
|
|
|
|
|
|
set_fwstate(pmlmepriv, _FW_LINKED);
|
2014-12-11 21:15:04 +00:00
|
|
|
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
rtw_free_cmd_obj(pcmd);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
_func_exit_;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_getrttbl_cmd_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd);
|
|
|
|
void rtw_getrttbl_cmd_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
_func_enter_;
|
|
|
|
|
|
|
|
rtw_free_cmd_obj(pcmd);
|
|
|
|
_func_exit_;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|