Beispiel #1
0
VOID AndesInitCmdMsg(struct cmd_msg *msg, UINT16 pq_id, UINT8 cmd_type, UINT8 set_query, UINT8 ExtCmdType, BOOLEAN need_wait, UINT16 timeout, BOOLEAN need_retransmit, BOOLEAN need_rsp, UINT16 rsp_payload_len, char *rsp_payload, MSG_RSP_HANDLER rsp_handler)
{
	msg->pq_id = pq_id;
	msg->cmd_type = cmd_type;
	msg->set_query = set_query;
	msg->ext_cmd_type = ExtCmdType;
	msg->need_wait= need_wait;
	msg->timeout = timeout;

	if (need_wait) {
		RTMP_OS_INIT_COMPLETION(&msg->ack_done);
	}

	msg->need_retransmit = 0;

		msg->retransmit_times = 0;

	msg->need_rsp = need_rsp;
	msg->rsp_payload_len = rsp_payload_len;
	msg->rsp_payload = rsp_payload;
	msg->rsp_handler = rsp_handler;

#ifdef RTMP_SDIO_SUPPORT
	RTMP_OS_INIT_COMPLETION(&msg->tx_sdio_done);
#endif
}
Beispiel #2
0
VOID AndesInitCmdMsg(struct cmd_msg *msg, UINT16 pq_id, UINT8 cmd_type, UINT8 set_query, UINT8 ExtCmdType, BOOLEAN need_wait, UINT16 timeout, BOOLEAN need_retransmit, BOOLEAN need_rsp, UINT16 rsp_payload_len, char *rsp_payload, MSG_RSP_HANDLER rsp_handler)
{
#ifdef CONFIG_DVT_MODE
	MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s::cmd_type(%x), ExtCmdType(%x)\n", __FUNCTION__, cmd_type, ExtCmdType));
#endif /* CONFIG_DVT_MODE */
	msg->pq_id = pq_id;
	msg->cmd_type = cmd_type;
	msg->set_query = set_query;
	msg->ext_cmd_type = ExtCmdType;
	msg->need_wait= need_wait;
	msg->timeout = timeout;

	if (need_wait) {
		RTMP_OS_INIT_COMPLETION(&msg->ack_done);
	}

	msg->need_retransmit = 0;

		msg->retransmit_times = 0;

	msg->need_rsp = need_rsp;
	msg->rsp_payload_len = rsp_payload_len;
	msg->rsp_payload = rsp_payload;
	msg->rsp_handler = rsp_handler;

}
INT CFG80211_SendMgmtFrame(RTMP_ADAPTER *pAd, VOID *pData, ULONG Data)
{
	struct ieee80211_mgmt *mgmt = NULL;

#ifdef CONFIG_MULTI_CHANNEL

	if (pAd->MCC_InfraConnect_Protect == TRUE)
	{
		return;
	}
	if (pAd->Mlme.bStartMcc == TRUE)
	{
//		return;
	}
#endif /* CONFIG_MULTI_CHANNEL */

	if (pData != NULL) 
	{
		PCFG80211_CTRL pCfg80211_ctrl = &pAd->cfg80211_ctrl;
		pCfg80211_ctrl->TxStatusInUsed = TRUE;
		pCfg80211_ctrl->TxStatusSeq = pAd->Sequence;
		RTMP_OS_INIT_COMPLETION(&pCfg80211_ctrl->fw_event_done);
		if (pCfg80211_ctrl->pTxStatusBuf != NULL)
		{
			os_free_mem(NULL, pCfg80211_ctrl->pTxStatusBuf);
			pCfg80211_ctrl->pTxStatusBuf = NULL;
		}

		os_alloc_mem(NULL, (UCHAR **)&pCfg80211_ctrl->pTxStatusBuf, Data);
		if (pCfg80211_ctrl->pTxStatusBuf != NULL)
		{
			NdisCopyMemory(pCfg80211_ctrl->pTxStatusBuf, pData, Data);
			pCfg80211_ctrl->TxStatusBufLen = Data;
		}
		else
		{
			pCfg80211_ctrl->TxStatusBufLen = 0;
			DBGPRINT(RT_DEBUG_ERROR, ("CFG_TX_STATUS: MEM ALLOC ERROR\n"));
			return NDIS_STATUS_FAILURE;
		}
		
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)	
		CFG80211_IsNeedTxStatus(pAd, pData, Data);
#else
		pAd->cfg80211_ctrl.IsNeedTxStatus = CFG80211_IsNeedTxStatus(pAd, pData, Data);
#endif

		if(TRUE == pAd->cfg80211_ctrl.IsNeedTxStatus)
		{				
			int ret = 0;
			// send fw cmd to FW
			ret = CFG80211_TxStatusCmd(pAd, TXS_TIMEOUT, (UCHAR)pCfg80211_ctrl->TxStatusSeq, TXS_P2P_WCID, TXS_P2P_MgmtID, Data);
			DBGPRINT(RT_DEBUG_INFO, ("%s, send tx status cmd status(%d)\n", __FUNCTION__, ret));								
		}

//Parser probe rsp to remove WPS IE
#ifdef CONFIG_P2P_AUTO_GO_AS_SOFTAP		
		if (pAd->p2pForceGOAsSoftAP)
		{
			PP2P_PUBLIC_FRAME	pFrame = (PP2P_PUBLIC_FRAME)pData;
			mgmt = (struct ieee80211_mgmt *)pData;
			UINT Elemlen, Offset;
			PMULTISSID_STRUCT pMbss = &pAd->ApCfg.MBSSID[MAIN_MBSSID];
			struct wifi_dev *pWdev = &pMbss->wdev;	
			
			DBGPRINT(RT_DEBUG_TRACE, ("SubType: pFrame->p80211Header.FC.SubType: %d\n", pFrame->p80211Header.FC.SubType));
			if (pFrame->p80211Header.FC.SubType == SUBTYPE_PROBE_RSP)
			{							
				Offset = offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
				Elemlen = Data - Offset;
				if (mgmt && Elemlen > 0)
				{
					
					//DBGPRINT(RT_DEBUG_ERROR, ("IELen %d, lk added\n", Elemlen));
			
					//hex_dump("probe_resp: variable:", (UCHAR *)mgmt->u.probe_resp.variable, Elemlen);						
					#if 1
					if (mgmt->u.probe_resp.variable)
					{			
						//DBGPRINT(RT_DEBUG_TRACE,("Remove P2P IE done, lk added\n"));
						PUCHAR pVendorIE = NULL, pPreVendorIE = NULL, pIEData = NULL;
						UINT VendorIELen;

						pIEData = (PUCHAR)mgmt->u.probe_resp.variable;
						pVendorIE = pIEData;
						if ((pWdev->AuthMode == Ndis802_11AuthModeWPA2PSK) || (pWdev->AuthMode == Ndis802_11AuthModeOpen))
						{
							while (pVendorIE < pIEData + Elemlen)
							{		
								//Remove WPS IE
								extern UCHAR WPS_OUI[];
								if (RTMPEqualMemory(pVendorIE + 2/*EID + Length*/, WPS_OUI, 4))
								{		
									VendorIELen = *(pVendorIE + 1); 
									//hex_dump("pDest WPS IE 2:", pVendorIE, VendorIELen);
									RTMPZeroMemory(pVendorIE + 2, VendorIELen);				
									pPreVendorIE = pVendorIE;
									pVendorIE += VendorIELen + 2; //Next Vendor IE address pointer
									  
									if (pVendorIE < pIEData + Elemlen)
									{					
										RTMPMoveMemory(pPreVendorIE, pVendorIE, pIEData + Elemlen - pVendorIE);						
									}

									//Reset probe resp length	
									Elemlen -= (VendorIELen + 2);

									pVendorIE = pPreVendorIE;
									break;
								}
								else 
								{
									pVendorIE += *(pVendorIE + 1) + 2;
								}		
							}
						}
						
						while (pVendorIE < pIEData + Elemlen)
						{
							if (RTMPEqualMemory(pVendorIE + 2/*EID + Length*/, P2POUIBYTE, 4))	//Remove P2P IE
							{		
								VendorIELen = *(pVendorIE + 1);
								//hex_dump("pDest p2p IE 2:", pVendorIE, VendorIELen);
								RTMPZeroMemory(pVendorIE + 2, VendorIELen);				
								pPreVendorIE = pVendorIE;
								pVendorIE += VendorIELen + 2; //Next Vendor IE address pointer
								
								if (pVendorIE < pIEData + Elemlen)
								{					
									RTMPMoveMemory(pPreVendorIE, pVendorIE, pIEData + Elemlen - pVendorIE);						
								}

								//Reset probe resp length	
								Elemlen -= (VendorIELen + 2);
								pVendorIE = pPreVendorIE;
								break;
							}
							else 
							{
								pVendorIE += *(pVendorIE + 1) + 2;
							}					
						}
						Data = Elemlen + Offset;
						DBGPRINT(RT_DEBUG_TRACE,("Remove P2P IE RTMPZeroMemory done, lk added\n"));

					}
					#endif
				}
			}