cmdsend.c
来自「marvell8385 GSPI开发驱动」· C语言 代码 · 共 1,764 行 · 第 1/5 页
C
1,764 行
case Ndis802_11AuthModeWPAPSK:
case Ndis802_11AuthModeWPA:
case Ndis802_11AuthModeOpen:
case Ndis802_11AuthModeWPA2:
case Ndis802_11AuthModeWPA2PSK:
pAuthenticate->AuthType = 0; // open authentication
break;
case Ndis802_11AuthModeShared:
pAuthenticate->AuthType = 1; // shared authentication
break;
default:
DBGPRINT(DBG_WARNING, ("Received unsupported authentication mode: %d\n",
ucAuth));
return NDIS_STATUS_FAILURE;
}
// set AP MAC address
#ifdef DEBUG_PARA_ROAMING
#ifdef PARA_WPA_1X
if(!priv.bHandoffViaBSSID||IsRoamingWantWZCWorkProperly()){
#else
if(!priv.bHandoffViaBSSID){
#endif
#endif
//NdisMoveMemory(pAuthenticate->MacAddr, Adapter->CurrentBSSID, MRVDRV_ETH_ADDR_LEN);
NdisMoveMemory(pAuthenticate->MacAddr, priv.HandoffBSSID, MRVDRV_ETH_ADDR_LEN);
#ifdef DEBUG_PARA_ROAMING
}
else{
priv.bAuthenticated = FALSE;
NdisMoveMemory(pAuthenticate->MacAddr, priv.HandoffBSSID, MRVDRV_ETH_ADDR_LEN);
}
#endif
}
break;
case HostCmd_CMD_802_11_ASSOCIATE_EXT:
case HostCmd_CMD_802_11_ASSOCIATE:
case HostCmd_CMD_802_11_REASSOCIATE:
//dralee 081105, V4
//Size = (USHORT)(sizeof(HostCmd_DS_802_11_ASSOCIATE_EXT));
pAsso = (PHostCmd_DS_802_11_ASSOCIATE_EXT)pCmdPtr;
if ( Adapter->bIsAssociateInProgress == TRUE )
{
DBGPRINT(DBG_CMDRESP | DBG_WARNING,
("There is already an association command pending, "
"fail the current request!\n"));
NdisAcquireSpinLock(&Adapter->FreeQSpinLock);
CleanUpCmdCtrlNode(pTempCmd);
InsertQNodeAtTail(&Adapter->CmdFreeQ, (PQ_NODE)pTempCmd);
NdisReleaseSpinLock(&Adapter->FreeQSpinLock);
#ifdef REASSOCIATE
if (Adapter->bIsReconnectEnable == TRUE)
Adapter->bIsReConnectNow = FALSE;
Adapter->bIsSystemConnectNow = FALSE;
#endif //REASSOCIATE
return NDIS_STATUS_NOT_ACCEPTED;
}
Status = SetupAssociationExt(
(PHostCmd_DS_802_11_ASSOCIATE_EXT)pCmdPtr,
PendingInfo,
Adapter,
pTempCmd,
InformationBuffer
);
Size = pAsso->Size;
DBGPRINT(DBG_ALLEN, ("HostCmd_CMD_802_11_ASSOCIATE_EXT size = %d \n",Size));
if (Status != NDIS_STATUS_SUCCESS)
{
#ifdef REASSOCIATE
if (Adapter->bIsReconnectEnable == TRUE)
Adapter->bIsReConnectNow = FALSE;
Adapter->bIsSystemConnectNow = FALSE;
#endif //REASSOCIATE
return Status;
}
//HexDump(DBG_CMDRESP, "ASSO_EXT CMD Buffer: ",
// (PUCHAR)pCmdPtr, sizeof(HostCmd_DS_802_11_ASSOCIATE_EXT));
// DBGPRINT(DBG_CMDRESP,("HWAC - ASSOCIATION_EXT command to %2x-%2x-%2x-"
// "%2x-%2x-%2x is ready\n",
// pAsso->DestMacAddr[0],
// pAsso->DestMacAddr[1],
// pAsso->DestMacAddr[2],
// pAsso->DestMacAddr[3],
// pAsso->DestMacAddr[4],
// pAsso->DestMacAddr[5]));
break;
case HostCmd_CMD_802_11_AD_HOC_START:
Size = (USHORT)(sizeof(HostCmd_DS_802_11_AD_HOC_START));
pAdHocStart = (PHostCmd_DS_802_11_AD_HOC_START)pCmdPtr;
if (Adapter->ulPSNumOfBSSIDs >= MRVDRV_MAX_BSSID_LIST)
{
ReturnCmdNode(Adapter, pTempCmd);
return NDIS_STATUS_FAILURE;
}
SetupAdHocStart( pAdHocStart,
PendingInfo,
Adapter,
pTempCmd,
InformationBuffer
);
DBGPRINT(DBG_CMDRESP,("HWAC - AD HOC Start command is ready\n"));
break;
case HostCmd_CMD_802_11_AD_HOC_JOIN:
// The command structure is HostCmd_CMD_802_11_AD_HOC_JOIN
Size = (USHORT)(sizeof(HostCmd_DS_802_11_AD_HOC_JOIN));
pAdHocJoin = (PHostCmd_DS_802_11_AD_HOC_JOIN)pCmdPtr;
SetupAdHocJoin( pAdHocJoin,
PendingInfo,
Adapter,
pTempCmd,
InformationBuffer
);
DBGPRINT(DBG_CMDRESP,("HWAC - AD HOC Join command is ready\n"));
break;
case HostCmd_CMD_802_11_DEAUTHENTICATE:
case HostCmd_CMD_802_11_DISASSOCIATE:
if (Cmd == HostCmd_CMD_802_11_DEAUTHENTICATE)
{
Size = (USHORT)(sizeof(HostCmd_DS_802_11_DEAUTHENTICATE));
pDeAuthenticate = (PHostCmd_DS_802_11_DEAUTHENTICATE) pCmdPtr;
// set AP MAC address
NdisMoveMemory(pDeAuthenticate->MacAddr,Adapter->CurrentBSSID, MRVDRV_ETH_ADDR_LEN);
// Reason code 3 = Station is leaving
pDeAuthenticate->ReasonCode = 3;
}
else if (Cmd == HostCmd_CMD_802_11_DISASSOCIATE)
{
Size = (USHORT)(sizeof(HostCmd_DS_802_11_DISASSOCIATE));
pDisasso = (PHostCmd_DS_802_11_DISASSOCIATE)pCmdPtr;
NdisMoveMemory(pDisasso->DestMacAddr, Adapter->CurrentBSSID, MRVDRV_ETH_ADDR_LEN);
pDisasso->ReasonCode = 0;
}
#if 0
#ifdef DEBUG_PARA_ROAMING
if((!priv.bAutoRoamingInProcess) && (!priv.bManualRoamingInProcess))
{
#endif
#endif
#ifdef DEBUG_PARA_ROAMING
#ifdef PARA_WPA_1X
if(IsRoamingWantWZCWorkProperly()){
// need to clean up Rx and Tx first
CleanUpSingleTxBuffer(Adapter);
ResetRxPDQ(Adapter);
//dralee++ for test
//MrvPrintFile("\ntxqused:%d",Adapter->txqnodeused);
// need to report disconnect event if currently associated
if ( Adapter->CurrentSSID.SsidLength !=0 )
{
//memorize the previous SSID and BSSID
NdisMoveMemory( &(Adapter->PreviousSSID),
&(Adapter->CurrentSSID),
sizeof(NDIS_802_11_SSID));
NdisMoveMemory( Adapter->PreviousBSSID,
Adapter->CurrentBSSID,
MRVDRV_ETH_ADDR_LEN);
// need to erase the current SSID and BSSID info
Adapter->ulCurrentBSSIDIndex =0;
NdisZeroMemory(&(Adapter->CurrentSSID), sizeof(NDIS_802_11_SSID));
NdisZeroMemory(Adapter->CurrentBSSID, MRVDRV_ETH_ADDR_LEN);
NdisZeroMemory(&(Adapter->CurrentBSSIDDesciptor), sizeof(NDIS_WLAN_BSSID_EX));
NdisZeroMemory(&(Adapter->CurrentBssDesciptor), sizeof(BSS_DESCRIPTION_SET_ALL_FIELDS));
}
}
#else
#endif
#else
// need to clean up Rx and Tx first
CleanUpSingleTxBuffer(Adapter);
ResetRxPDQ(Adapter);
//dralee++ for test
//MrvPrintFile("\ntxqused:%d",Adapter->txqnodeused);
// need to report disconnect event if currently associated
if ( Adapter->CurrentSSID.SsidLength !=0 )
{
//memorize the previous SSID and BSSID
NdisMoveMemory( &(Adapter->PreviousSSID),
&(Adapter->CurrentSSID),
sizeof(NDIS_802_11_SSID));
NdisMoveMemory( Adapter->PreviousBSSID,
Adapter->CurrentBSSID,
MRVDRV_ETH_ADDR_LEN);
// need to erase the current SSID and BSSID info
Adapter->ulCurrentBSSIDIndex =0;
NdisZeroMemory(&(Adapter->CurrentSSID), sizeof(NDIS_802_11_SSID));
NdisZeroMemory(Adapter->CurrentBSSID, MRVDRV_ETH_ADDR_LEN);
NdisZeroMemory(&(Adapter->CurrentBSSIDDesciptor), sizeof(NDIS_WLAN_BSSID_EX));
NdisZeroMemory(&(Adapter->CurrentBssDesciptor), sizeof(BSS_DESCRIPTION_SET_ALL_FIELDS));
}
#endif
#if 0
#ifdef DEBUG_PARA_ROAMING
}
#endif
#endif
break;
case HostCmd_CMD_802_11_RF_ANTENNA:
Size = (USHORT)(sizeof(HostCmd_DS_802_11_RF_ANTENNA));
pAntenna = (PHostCmd_DS_802_11_RF_ANTENNA)pCmdPtr;
pAntenna->Action = CmdOption;
if( (CmdOption ==HostCmd_ACT_SET_RX) || (CmdOption==HostCmd_ACT_SET_TX))
pAntenna->AntennaMode=(USHORT)(*(NDIS_802_11_ANTENNA *)InformationBuffer);
break;
case HostCmd_CMD_802_11_RF_TX_POWER:
Size = (USHORT)(sizeof(HostCmd_DS_802_11_RF_TX_POWER));
pRTP = (PHostCmd_DS_802_11_RF_TX_POWER)pCmdPtr;
if ( InformationBuffer != NULL )
{
// OID command
switch (CmdOption)
{
case HostCmd_ACT_TX_POWER_OPT_SET :
{
ULONG usDesiredPowerInDbm = *((ULONG *)InformationBuffer);
#ifdef MRV_CHIP_8385PN
if ( (usDesiredPowerInDbm < 5) || (usDesiredPowerInDbm > 17) )
#elif defined(MRV_CHIP_8381PN)
if ( (usDesiredPowerInDbm < 0) || (usDesiredPowerInDbm > 15) )
#elif defined(MRV_CHIP_8381P)
if ( (usDesiredPowerInDbm < 0) || (usDesiredPowerInDbm > 15) )
#elif defined(MRV_CHIP_8305)
if ( (usDesiredPowerInDbm < 3) || (usDesiredPowerInDbm > 19) )
#elif defined(MRV_CHIP_8385H)
if ( (usDesiredPowerInDbm < 10) || (usDesiredPowerInDbm > 17) )
#elif defined(MRV_CHIP_8399)
if ( (usDesiredPowerInDbm < 5) || (usDesiredPowerInDbm > 17) )
#elif defined(MRV_CHIP_8686PN) //dralee_1209
if ( (usDesiredPowerInDbm < 5) || (usDesiredPowerInDbm > 17) )
#else
if ( (usDesiredPowerInDbm < 5) || (usDesiredPowerInDbm > 17) )
#endif
{
return NDIS_STATUS_NOT_SUPPORTED;
}
pRTP->SupportTxPowerLevel=(USHORT)usDesiredPowerInDbm;
pRTP->CurrentTxPowerLevel=(USHORT)usDesiredPowerInDbm;
pRTP->PowerLevelList[0] = (USHORT)usDesiredPowerInDbm;
pRTP->Action=(USHORT)HostCmd_ACT_TX_POWER_OPT_SET;
DBGPRINT(DBG_OID,("****SendCommand -HostCmd_CMD_802_11_RF_TX_POWER- pRTP->SupportTxPowerLevel=%d\n",pRTP->SupportTxPowerLevel));
}
break;
case HostCmd_ACT_TX_POWER_OPT_GET:
{
DBGPRINT(DBG_OID,("****SendCommand -HostCmd_CMD_802_11_RF_TX_POWER- HostCmd_ACT_TX_POWER_OPT_GET\n"));
pRTP->Action = HostCmd_ACT_GEN_GET;
pRTP->SupportTxPowerLevel = MRVDRV_TX_POWER_LEVEL_TOTAL;
pRTP->CurrentTxPowerLevel = HostCmd_ACT_TX_POWER_INDEX_LOW;
pRTP->Action=(USHORT)HostCmd_ACT_TX_POWER_OPT_GET;
}
break;
case HostCmd_ACT_TX_POWER_OPT_SET_HIGH:
pRTP->Action = HostCmd_ACT_GEN_SET;
pRTP->SupportTxPowerLevel = MRVDRV_TX_POWER_LEVEL_HIGH;
break;
case HostCmd_ACT_TX_POWER_OPT_SET_MID:
pRTP->Action = HostCmd_ACT_GEN_SET;
pRTP->SupportTxPowerLevel = MRVDRV_TX_POWER_LEVEL_MID;
break;
case HostCmd_ACT_TX_POWER_OPT_SET_LOW:
pRTP->Action = HostCmd_ACT_GEN_SET;
pRTP->SupportTxPowerLevel = MRVDRV_TX_POWER_LEVEL_LOW;
break;
case HostCmd_ACT_TX_POWER_OPT_SET_TPC:
pRTP->Action = HostCmd_ACT_GEN_SET;
pRTP->SupportTxPowerLevel = HostCmd_ACT_TX_POWER_INDEX_TPC;
DBGPRINT(DBG_OID,("\n**** TPC %d****\n\n", *((ULONG *)InformationBuffer)));
break;
default:
return NDIS_STATUS_NOT_SUPPORTED;
}
}
break;
case HostCmd_CMD_802_11_RADIO_CONTROL:
Size = (USHORT)(sizeof(HostCmd_DS_802_11_RADIO_CONTROL));
pRadioControl = (PHostCmd_DS_802_11_RADIO_CONTROL)pCmdPtr;
pRadioControl->Action = CmdOption;
switch((UCHAR)(Adapter->Preamble))
{
case HostCmd_TYPE_SHORT_PREAMBLE:
pRadioControl->Control=SET_SHORT_PREAMBLE;
break;
case HostCmd_TYPE_LONG_PREAMBLE:
pRadioControl->Control=SET_LONG_PREAMBLE;
break;
default:
case HostCmd_TYPE_AUTO_PREAMBLE:
pRadioControl->Control=SET_AUTO_PREAMBLE;
break;
}
#ifdef MRVL_SET_RF_RADIO
if ( CmdOption == HostCmd_ACT_SET
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?