* w35und: some more cleanups
@ 2008-04-07 22:00 Pavel Machek
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2008-04-07 22:00 UTC (permalink / raw)
To: kernel list, kaszak, lcostantino
Some more cleanups for w35und...
Signed-off-by: Pavel Machek <pavel@suse.cz>
diff --git a/drivers/net/wireless/winbond/winbondport/knl.c b/drivers/net/wireless/winbond/winbondport/knl.c
index 4e8dad9..442435c 100644
--- a/drivers/net/wireless/winbond/winbondport/knl.c
+++ b/drivers/net/wireless/winbond/winbondport/knl.c
@@ -1,15 +1,15 @@
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// knl.c
// Kernel module
// history -- 01/14/03' created
//
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "os_common.h"
void vKNL_StateMachine(PWB32_ADAPTER Adapter, const K_TRANS** psStateMachineTable,
u16 wStateData, pK_MSG psMsg)
{
- const K_TRANS* psStateTableEntry;
+ const K_TRANS* psStateTableEntry;
if (wStateData == K_NULL_STATE)
return;
diff --git a/drivers/net/wireless/winbond/winbondport/linux/common.h b/drivers/net/wireless/winbond/winbondport/linux/common.h
index 66b9c7c..a9884e1 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/common.h
+++ b/drivers/net/wireless/winbond/winbondport/linux/common.h
@@ -110,10 +110,8 @@ #define OS_ATOMIC u32
#define OS_ATOMIC_READ( _A, _V ) _V
#define OS_ATOMIC_INC( _A, _V ) EncapAtomicInc( _A, (void*)_V )
#define OS_ATOMIC_DEC( _A, _V ) EncapAtomicDec( _A, (void*)_V )
-#define OS_MEMORY_FREE( _V, _S ) kfree( _V )
#define OS_MEMORY_CLEAR( _A, _S ) memset( (PUCHAR)_A,0,_S)
#define OS_MEMORY_COMPARE( _A, _B, _S ) (memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different
-#define OS_DELAY( _MT ) //NdisStallExecution( _MT ) _MT : microsecond
#define OS_SPIN_LOCK spinlock_t
diff --git a/drivers/net/wireless/winbond/winbondport/linux/new_wireless.c b/drivers/net/wireless/winbond/winbondport/linux/new_wireless.c
index 512b58c..cbe23f6 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/new_wireless.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/new_wireless.c
@@ -611,92 +611,67 @@ int test_get_txpow(struct net_device *de
DEBUG("END TXPOWER");
return 0;
}
-/* VER ORIGINAL -> Faltan cosas del WEP */
+
int test_set_essid(struct net_device *dev,
- struct iw_request_info *info, struct iw_point *data, char *essid)
+ struct iw_request_info *info, struct iw_point *data, char *essid)
{
+ u8 SSID[32]={0};
+ PWB32_ADAPTER Adapter=(PWB32_ADAPTER)dev->priv;
- u8 SSID[32]={0};
- PWB32_ADAPTER Adapter=(PWB32_ADAPTER)dev->priv;
+ DEBUG("SIOCSIWESSID test\n");
- DEBUG("SIOCSIWESSID test\n");
+ if(psSME->encrypt_status >= ENCRYPT_TKIP) {
+ //To add the 64 HEX WPA
+ u32 PasswordLength=strlen(pGlobal_STA_Wpa->WPAPassword);
+ u8* Password=pGlobal_STA_Wpa->WPAPassword;
+ u32 count=0;
- //SIN CRYPTO por ahora......
-# if 0
- if (pWblinux->boWepKeyOk)
- {
- {
- //restore the WEP keys
- for (i=0; i<4; i++)
- {
- if ((pWblinux->WepKeyValid[i] == 1) && (i != pWblinux->WepKeyIndex))
- sme_set_add_wep( Adapter, i, pWblinux->WepKeyLen, NULL,
- pWblinux->WepKeyValue[i]);
- }
- sme_set_add_wep( Adapter, pWblinux->WepKeyIndex|0x80000000, pWblinux->WepKeyLen,
- NULL, pWblinux->WepKeyValue[pWblinux->WepKeyIndex]);
- }
-
- }
-# endif
-
- if(psSME->encrypt_status >= ENCRYPT_TKIP)
- {
- //////////////////////////////////////////////////
- //Added by WangJS 2006.8.22
- //To add the 64 HEX WPA
- u32 PasswordLength=strlen(pGlobal_STA_Wpa->WPAPassword);
- u8* Password=pGlobal_STA_Wpa->WPAPassword;
- u32 count=0;
-
- if(PasswordLength >= 64)
- {
+ if(PasswordLength >= 64)
+ {
# ifdef _WPA_PSK_DEBUG
- WBDEBUG(("The Password is too large \n"));
- //////////////////////////////////////////////
- //For Test
- WBDEBUG(("Dump password(1)\n"));
- DataDmp(Password,64,0);
+ WBDEBUG(("The Password is too large \n"));
+ //////////////////////////////////////////////
+ //For Test
+ WBDEBUG(("Dump password(1)\n"));
+ DataDmp(Password,64,0);
# endif
- //////////////////////////////////////////////
-
- if(PasswordLength>64)
- {WBDEBUG(("The Password is >64 HEX \n"));return -EFAULT;}
- else
- {
- WBDEBUG(("The Password is =64 HEX \n"));
- for(count=0;count<32;count++)
- {
- Password[count]=((CharToBin(Password[count*2])<<4) | (CharToBin(Password[count*2+1])) );
- }
- OS_MEMORY_CLEAR(Password+32,32);
-
- }
-
- //////////////////////////////////////////////
- //For Test
+ //////////////////////////////////////////////
+
+ if(PasswordLength>64)
+ {WBDEBUG(("The Password is >64 HEX \n"));return -EFAULT;}
+ else
+ {
+ WBDEBUG(("The Password is =64 HEX \n"));
+ for(count=0;count<32;count++)
+ {
+ Password[count]=((CharToBin(Password[count*2])<<4) | (CharToBin(Password[count*2+1])) );
+ }
+ OS_MEMORY_CLEAR(Password+32,32);
+
+ }
+
+ //////////////////////////////////////////////
+ //For Test
# ifdef _WPA_PSK_DEBUG
- WBDEBUG(("Dump password(2)\n"));
- DataDmp(Password,64,0);
+ WBDEBUG(("Dump password(2)\n"));
+ DataDmp(Password,64,0);
# endif
- //////////////////////////////////////////////
-
- //Copy the 64 Byte to pmk
- memcpy(pSTA->PMK.m_pmk, Password,32);
- //////////////////////////////////////////////////
- }
- else
- {
- memcpy(SSID,essid, data->length);
- AP_PrePasswordHash( Adapter, SSID, strlen(SSID) );
- }
- }
+ //////////////////////////////////////////////
+
+ //Copy the 64 Byte to pmk
+ memcpy(pSTA->PMK.m_pmk, Password,32);
+ //////////////////////////////////////////////////
+ } else {
+ memcpy(SSID,essid, data->length);
+ AP_PrePasswordHash( Adapter, SSID, strlen(SSID) );
+ }
+ }
- sme_set_desired_ssid(Adapter,
- essid,
- data->length);
- return 0;
+ sme_set_desired_ssid(Adapter,
+ essid,
+ data->length);
+ return 0;
}
/* Segun el original no reporta el ssid conectado, veri los comentarios de codigo ahi */
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c b/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
index 19f3ec6..ea70d84 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
@@ -153,7 +153,7 @@ void Wb35Rx_Complete(PURB pUrb)
if (!pWb35Rx->RxOwner[ RxBufferId ])
Wb35Rx_indicate( pHwData );
- OS_MEMORY_FREE( pWb35Rx->pDRx, MAX_USB_RX_BUFFER);
+ kfree(pWb35Rx->pDRx);
// Do the next receive
Wb35Rx(pHwData);
return;
diff --git a/drivers/net/wireless/winbond/winbondport/mlmetask.c b/drivers/net/wireless/winbond/winbondport/mlmetask.c
index 771a039..9496f65 100644
--- a/drivers/net/wireless/winbond/winbondport/mlmetask.c
+++ b/drivers/net/wireless/winbond/winbondport/mlmetask.c
@@ -405,17 +405,14 @@ void MLME_Halt( PWB32_ADAPTER Adapter)
}
for (i=MAX_BSS_DESCRIPT_ELEMENT-1; i>0; i--)
{
- while (psBSS(i)->boInTimerHandler == TRUE)
- {
- ///NdisMSleep(10000);//10ms
- OS_SLEEP( 10000 );
+ while (psBSS(i)->boInTimerHandler == TRUE) {
+ OS_SLEEP(10000);
}
}
- if( Adapter->asBSSDescriptElement )
- {
- OS_MEMORY_FREE( Adapter->asBSSDescriptElement, sizeof(WB_BSSDESCRIPTION) * MAX_BSS_DESCRIPT_ELEMENT );
- Adapter->asBSSDescriptElement = NULL; //[WK 20060626]
+ if (Adapter->asBSSDescriptElement) {
+ kfree(Adapter->asBSSDescriptElement);
+ Adapter->asBSSDescriptElement = NULL;
}
#ifdef _PE_STATE_DUMP_
WBDEBUG(("STATE: Mlme halt.\n"));
@@ -426,10 +423,9 @@ void MLME_Halt( PWB32_ADAPTER Adapter)
void MLME_Stop( PWB32_ADAPTER Adapter)
{
- u16 i;
+ u16 i;
- for (i=MAX_BSS_DESCRIPT_ELEMENT-1; i>0; i--)
- {
+ for (i=MAX_BSS_DESCRIPT_ELEMENT-1; i>0; i--) {
vMlmeTimerStop(Adapter, i);
}
}
@@ -500,9 +496,9 @@ void MLME_Entry(PWB32_ADAPTER Adapter, p
#endif
}
-//======================================================================================
+//==========================================================================
// Action Function of MLME / ESS State Transition Table
-//======================================================================================
+//==========================================================================
void vMlmeProc_EssAuthReq(PWB32_ADAPTER Adapter, pK_MSG psMlmeMsg)
{
u16 i;
diff --git a/drivers/net/wireless/winbond/winbondport/os_common.h b/drivers/net/wireless/winbond/winbondport/os_common.h
index b75e4fe..e24ff41 100644
--- a/drivers/net/wireless/winbond/winbondport/os_common.h
+++ b/drivers/net/wireless/winbond/winbondport/os_common.h
@@ -1,5 +1,2 @@
-#ifndef NDIS_MINIPORT_DRIVER
#include "linux/sysdef.h"
-#else
-#include "sysdef.h"
-#endif
+
diff --git a/drivers/net/wireless/winbond/winbondport/rxisr.c b/drivers/net/wireless/winbond/winbondport/rxisr.c
index 009e851..f1397b1 100644
--- a/drivers/net/wireless/winbond/winbondport/rxisr.c
+++ b/drivers/net/wireless/winbond/winbondport/rxisr.c
@@ -1,6 +1,5 @@
#include "os_common.h"
-//#ifdef _PE_RX_DUMP_
void DataDmp(u8 *pdata, u32 len, u32 offset)
{
u8 dbg_str[140];
@@ -8,81 +7,77 @@ void DataDmp(u8 *pdata, u32 len, u32 off
u8 c;
u8 *p;
- //WBDEBUG((" addr of pdata = %p\n", pdata));
- for (i = 0; i < len; i += 16)
- {
- p = dbg_str;
+ for (i = 0; i < len; i += 16)
+ {
+ p = dbg_str;
- //--------------------------------------------------------------------
- // Output the offset header
- n = offset + i;
+ //--------------------------------------------------------------------
+ // Output the offset header
+ n = offset + i;
- for (j=0; j<4; j++)
- {
+ for (j=0; j<4; j++)
+ {
c = (u8) (n % 16);
- p[3-j] = (c >= 10) ? 'A'+(c-10) : '0'+c;
+ p[3-j] = (c >= 10) ? 'A'+(c-10) : '0'+c;
n >>= 4 ;
}
- p+= 4;
-
- *p++ = ':';
- *p++ = ' ';
-
- //--------------------------------------------------------------------
- // Output the hex bytes
- for (j = i; j < (i+16); j++)
- {
- if (j < len)
- {
- c = *(pdata+j) / 16 ;
- *p++ = (c >= 10) ? 'A'+(c-10) : '0'+c;
-
- c = *(pdata+j) % 16 ;
- *p++ = (c >= 10) ? 'A'+(c-10) : '0'+c;
-
- *p++ = ' ';
- }
- else
- {
- *p++ = ' ';
- *p++ = ' ';
- *p++ = ' ';
- }
- }
-
- *p++ = ' ';
- *p++ = ' ';
-
- //--------------------------------------------------------------------
- // Output the ASCII bytes
- for (j = i; j < (i+16); j++)
- {
- if (j < len)
- {
- c = *(pdata+j);
- *p++ = (! isprint(c)) ? '.' : c;
-
- }
- else
- {
- *p++ = ' ';
- }
- }
-
- *p++ = '\n';
- *p++ = '\0';
-
- //PDEBUG(( "%s", dbg_str));
+ p+= 4;
+
+ *p++ = ':';
+ *p++ = ' ';
+
+ //--------------------------------------------------------------------
+ // Output the hex bytes
+ for (j = i; j < (i+16); j++)
+ {
+ if (j < len)
+ {
+ c = *(pdata+j) / 16 ;
+ *p++ = (c >= 10) ? 'A'+(c-10) : '0'+c;
+
+ c = *(pdata+j) % 16 ;
+ *p++ = (c >= 10) ? 'A'+(c-10) : '0'+c;
+
+ *p++ = ' ';
+ }
+ else
+ {
+ *p++ = ' ';
+ *p++ = ' ';
+ *p++ = ' ';
+ }
+ }
+
+ *p++ = ' ';
+ *p++ = ' ';
+
+ //--------------------------------------------------------------------
+ // Output the ASCII bytes
+ for (j = i; j < (i+16); j++)
+ {
+ if (j < len)
+ {
+ c = *(pdata+j);
+ *p++ = (! isprint(c)) ? '.' : c;
+
+ }
+ else
+ {
+ *p++ = ' ';
+ }
+ }
+
+ *p++ = '\n';
+ *p++ = '\0';
+
WBDEBUG(("%s", dbg_str));
- }
+ }
}
-//#endif
void Mds_MsduProcess( PWB32_ADAPTER Adapter, PRXLAYER1 pRxLayer1, u8 SlotIndex)
{
-// phw_data_t pHwData = &Adapter->sHwData;
struct MAC_frame_control frame_control;
struct Data_Frame* pDFrame;
PUCHAR SourceAddress;
@@ -95,28 +90,23 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
PUCHAR mic_key = NULL, pframe_mic;
u8 LastBufIdx;
-
// Is management frame??
- if( pRxLayer1->FrameType != MAC_TYPE_DATA )
- {
+ if( pRxLayer1->FrameType != MAC_TYPE_DATA ) {
// Call MLME function
MLMERcvFrame( Adapter, pRxLayer1->BufferQueue, pRxLayer1->BufferNumber, SlotIndex );//The last parameter is needed for SME.
return;
}
// Checking this packet(802.3), if valid for Filter. Just discard the frame if the media is disconnected.
- if ( !CURRENT_LINK_ON )
+ if (!CURRENT_LINK_ON)
return;
pDFrame = (struct Data_Frame*)pRxLayer1->BufferQueue[0].pBufferAddress;
- //Temp = cpu_to_le16(*(PUSHORT)pRxLayer1->BufferQueue[0].pBufferAddress);
Temp = (*(PUSHORT)pRxLayer1->BufferQueue[0].pBufferAddress); //anson's endian
memcpy( &frame_control, &Temp, sizeof(u16) ); // YY's endian
WEPed = frame_control.WEP ? TRUE : FALSE;
if( (!WEPed && !MLMEGetExcludeUnencrypted(Adapter)) ||
- (WEPed && Adapter->sSmePara._dot11PrivacyOptionImplemented != FALSE) )
- {
- //#ifdef _WPA_
+ (WEPed && Adapter->sSmePara._dot11PrivacyOptionImplemented != FALSE) ) {
//TODO: check if there is a MIC err
/**/
if( WEPed && (pRxLayer1->DecryptionMethod==2) ) //TKIP
@@ -218,11 +208,7 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
else
{
- // #ifdef _PE_RX_DUMP_
WBDEBUG(("!!!!!! MIC error !!!!!!\n"));
- // #endif
-
-// MDS_EVENT_AUTH_REQUEST_PAIRWISE_ERROR( Adapter );
#ifdef NDIS51_MINIPORT
if (mic_key == psSME->rx_mic_key)
@@ -242,7 +228,6 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
}
if (Adapter->Mds.bMICfailCount == 2)
{
- //Adapter->Mds.bMICfailCount = 0;
Adapter->Mds.boCounterMeasureBlock = 1;
#ifdef _PE_RX_DUMP_
WBDEBUG(("!!!!!! Countermeasure Block !!!!!!\n"));
@@ -256,7 +241,6 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
return;
}
}
- //#endif // End of _WPA_
//--------------------------------------------
// Convert 802.11 frame to 802.3 frame
@@ -277,9 +261,6 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
BufAddr += (DOT_11_TYPE_OFFSET - ETH_LENGTH_OF_ADDRESS); // offset 24 is 4n alignment @@
// PD43 20021220 Added for Type/Length encapsulation adjust
-// if( *(PULONG)BufAddr==0x0003aaaa && // little endian
-// *(PULONG)(BufAddr+4)!=0x37810000 && //PD43 20030418 Modified for HCT 11
-// (*(PUSHORT)(BufAddr+4)==0 || *(PUSHORT)(BufAddr+4)==0xf800) )
// YY's endian
if( *(PULONG)BufAddr==cpu_to_le32(0x0003aaaa) && // little endian // @@ 4n alignment here
*(PULONG)(BufAddr+4)!=cpu_to_le32(0x37810000) && //PD43 20030418 Modified for HCT 11 // @@ 4n alignment here
@@ -339,14 +320,12 @@ void Mds_MsduProcess( PWB32_ADAPTER Ada
void vRxTimerInit(PWB32_ADAPTER Adapter)
{
- OS_TIMER_INITIAL( &(Adapter->Mds.nTimer),
- (void*) RxTimerHandler,
- (void*) Adapter);
+ OS_TIMER_INITIAL(&(Adapter->Mds.nTimer), (void*) RxTimerHandler, (void*) Adapter);
}
void vRxTimerStart(PWB32_ADAPTER Adapter, int timeout_value)
{
- if (timeout_value<MIN_TIMEOUT_VAL)
+ if (timeout_value<MIN_TIMEOUT_VAL)
timeout_value=MIN_TIMEOUT_VAL;
OS_TIMER_SET( &(Adapter->Mds.nTimer), timeout_value );
@@ -354,10 +333,6 @@ void vRxTimerStart(PWB32_ADAPTER Adapter
void vRxTimerStop(PWB32_ADAPTER Adapter)
{
-// unsigned char boValue=TRUE;
-
-//For clean compile
-// OS_TIMER_CANCEL( &(Adapter->Mds.nTimer), &boValue );
OS_TIMER_CANCEL( &(Adapter->Mds.nTimer), 0 );
}
@@ -365,27 +340,23 @@ void RxTimerHandler_1a( PADAPTER Adapter
{
RxTimerHandler(NULL, Adapter, NULL, NULL);
}
-void RxTimerHandler( void* SystemSpecific1,
- PWB32_ADAPTER Adapter,
- void* SystemSpecific2,
- void* SystemSpecific3)
+
+void RxTimerHandler(void* SystemSpecific1, PWB32_ADAPTER Adapter,
+ void* SystemSpecific2, void* SystemSpecific3)
{
K_MSG sMsg;
- u16 wReasonCode;
+ u16 wReasonCode;
- if (Adapter->Mds.bMICfailCount == 1)
- {
+ if (Adapter->Mds.bMICfailCount == 1) {
sMsg.wMsgType = SMEMSG_COUNTERMEASURE_MICFAIL_TIMEOUT;
}
- if (Adapter->Mds.boCounterMeasureBlock == 1)
- {
- if (psLOCAL->wConnectedSTAindex != 0)
- {
+ if (Adapter->Mds.boCounterMeasureBlock == 1) {
+ if (psLOCAL->wConnectedSTAindex != 0) {
//Wait for NDIS to send MIC error EAPOL packet, and then disassoc.
//But it doesn't appear.
- #ifdef _PE_STATE_DUMP_
+#ifdef _PE_STATE_DUMP_
WBDEBUG(("!!Countermeasure, block timeout, disassoc !!\n"));
- #endif
+#endif
FillEventLog(Adapter, EVENT_COUNTERMEASURE);
@@ -394,7 +365,7 @@ void RxTimerHandler( void* SystemSpeci
sMsg.pMsgPtr = &wReasonCode;
SME_Entry(Adapter, &sMsg);
}
- sMsg.wMsgType = SMEMSG_COUNTERMEASURE_BLOCK_TIMEOUT;
+ sMsg.wMsgType = SMEMSG_COUNTERMEASURE_BLOCK_TIMEOUT;
}
sMsg.pMsgPtr = NULL;
SME_Entry(Adapter, &sMsg);
@@ -418,11 +389,7 @@ void Mds_MpduProcess( PWB32_ADAPTER Ada
u8 i;
#ifdef _PE_RX_DUMP_
- //[WK DUMP]
- //if ((*((PUCHAR)pRxDes->buffer_address[0]) != 0x80) &&
- // (*((PUCHAR)pRxDes->buffer_address[0]) != 0x40))
- if ( *((PUCHAR)pRxDes->buffer_address[0]) == 0x08)
- {
+ if ( *((PUCHAR)pRxDes->buffer_address[0]) == 0x08) {
ChanInfo ChanTmp;
WBDEBUG(("$$$$$ DUMP RX MPDU $$$$$\n"));
diff --git a/drivers/net/wireless/winbond/winbondport/wbhal.c b/drivers/net/wireless/winbond/winbondport/wbhal.c
index dc3ef0f..596bf0b 100644
--- a/drivers/net/wireless/winbond/winbondport/wbhal.c
+++ b/drivers/net/wireless/winbond/winbondport/wbhal.c
@@ -1,12 +1,13 @@
#include "os_common.h"
-//---------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
void hal_start_tx0( phw_data_t pHwData )
{
if( !pHwData->SurpriseRemove ) Wb35Tx_start( pHwData );
}
-//---------------------------------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------------
void hal_remove_mapping_key( phw_data_t pHwData, PUCHAR pmac_addr )
{
u32 i;
@@ -95,46 +96,38 @@ unsigned char hal_set_mapping_key( phw_d
*pValue |= (key_type << 2); //bit 2~3
*pValue |= (wep_on << 4); //bit 4
pValue += 2;
- memcpy( pValue, pmac_addr, sizeof(u16) ); //addr 1
+ memcpy(pValue, pmac_addr, sizeof(u16)); //addr 1
memcpy( &(pKey->DW1_Address2), pmac_addr + 2, sizeof(u32) );
- if( prx_tsc )
- {
-
-
+ if( prx_tsc ) {
pValue = (u8 *)pKey +8 ; //20060926 anson's endian
memcpy( pValue, prx_tsc, 6 ); //20060926 anson's endian
}
- if( ptx_tsc )
- {
-
+ if( ptx_tsc ) {
pValue = (u8 *)pKey +16; //20060926 anson's endian
memcpy( pValue, ptx_tsc, 6 ); //20060926 anson's endian
}
+
//fill key content [20060623]
memcpy( ((PUCHAR)pKey+sizeof(KEY_TABLE)), pkey_data, key_len );
j = 0xff;
- for( i=MAPPING_KEY_START_INDEX; i<MAX_KEY_TABLE; i++ )
- {
-
+ for( i=MAPPING_KEY_START_INDEX; i<MAX_KEY_TABLE; i++ ) {
pValue = (u8 *)pKey + 2; //20060926 anson's endian
- if ( OS_MEMORY_COMPARE(pValue, pHwData->Key_slot[i], 6) ) //20060926 anson's endian
- {
+ if (!memcpy(pValue, pHwData->Key_slot[i], 6)) {
pHwData->mapping_key_replace_index = i + 1;
if( pHwData->mapping_key_replace_index == MAX_KEY_TABLE )
pHwData->mapping_key_replace_index = MAPPING_KEY_START_INDEX;
break;
}
- if( OS_MEMORY_COMPARE( pHwData->Key_slot[i], "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH ) )
+ if (!memcpy(pHwData->Key_slot[i], "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH ))
if( j == 0xff )
j = i;//Storing the index which can be used
}
- if( i == MAX_KEY_TABLE ) //Not found the entry, get one to use
- {
+ if (i == MAX_KEY_TABLE) { //Not found the entry, get one to use
if( j == 0xff )//Is out of resource? If yes, get an elder one index to be replaced
i = pHwData->mapping_key_replace_index;
else
@@ -207,37 +200,26 @@ unsigned char hal_set_default_key( phw_d
#endif
// Set key table contain
- OS_MEMORY_CLEAR( Key_content, sizeof(KEY_TABLE) + 16 + 8 ); // 8 bytes for burst writing
+ memset( Key_content, 0, sizeof(KEY_TABLE) + 16 + 8 ); // 8 bytes for burst writing
pKey = (PKEY_TABLE)(Key_content + 4 );
-// //20060926 anson's endian
-// pKey->DW0_Valid = 1; // Valid bit
-// pKey->DW0_NullKey = null_key ? 0 : 1; // 35 hardware different with 33
-// pKey->DW0_Security_Mode = key_type;
-// pKey->DW0_WEPON = wep_on;
+
pValue = (u8 *)pKey;
*pValue = 0x01; //bit 0
*pValue |= ((null_key ? 0: 1) << 1); //bit 1, 35 hardware different with 33
*pValue |= (key_type << 2); //bit 2~3
*pValue |= (wep_on << 4); //bit 4
- if( prx_tsc )
- {
- //20060926 anson's endian
- //pKey->DW2_RxSequenceCount1 = *(PULONG)prx_tsc; // 4n Alignment
- //pKey->DW3_RxSequenceCount2 = *(PUSHORT)(prx_tsc+4); // 2n Alignment
+ if (prx_tsc) {
pValue = (u8 *)pKey +8; //20060926 anson's endian
memcpy( pValue, prx_tsc, 6 ); //20060926 anson's endian
}
- if( ptx_tsc )
- {
- //20060926 anson's endian
- //pKey->DW4_TxSequenceCount1 = *(PULONG)ptx_tsc; // 4n Alignment
- //pKey->DW5_TxSequenceCount2 = *(PUSHORT)(ptx_tsc+4); // 2n Alignment
+ if( ptx_tsc ) {
pValue = (u8 *)pKey+ 16; //20060926 anson's endian
memcpy( pValue, ptx_tsc, 6 ); //20060926 anson's endian
}
+
//fill key content [20060623]
- memcpy( ((PUCHAR)pKey+sizeof(KEY_TABLE)), pkey_data, key_len );
+ memcpy(((PUCHAR)pKey+sizeof(KEY_TABLE)), pkey_data, key_len );
// 950301.3.a modify
pHwData->CurrentDefaultKeyIndex = index;// Backup default key 941130.2
@@ -251,7 +233,7 @@ unsigned char hal_set_default_key( phw_d
pltmp[0] = ltmp; // Burst command
pltmp[11] = pltmp[1]; // The last, valid bit set
pltmp[1] = 0;// The first, clear the valid bit
- memcpy( pHwData->Key_content[index], pltmp, sizeof(u32)*12 ); // 20060214 for recover
+ memcpy( pHwData->Key_content[index], pltmp, sizeof(u32)*12 );
//---20060926 add by anson's endian
pltmp[0] = cpu_to_le32( ltmp );
for( i=0; i<=11; i++)
@@ -265,7 +247,8 @@ unsigned char hal_set_default_key( phw_d
return TRUE;
}
-//---------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------
void hal_clear_all_default_key( phw_data_t pHwData )
{
u32 pltmp[GROUP_KEY_START_INDEX];
@@ -280,16 +263,16 @@ void hal_clear_all_default_key( phw_data
// M20 KEY data, set to 0
Wb35Reg_Write( pHwData, 0x0820, 0 );
// M1c KEY write operation
- for( i=0; i<GROUP_KEY_START_INDEX; i++ )
- {
+ for( i=0; i<GROUP_KEY_START_INDEX; i++ ) {
pltmp[i] = i<<4;
pltmp[i] |= 0x4000000;
}
Wb35Reg_BurstWrite( pHwData, 0x081c, pltmp, GROUP_KEY_START_INDEX, NO_INCREMENT );
- OS_MEMORY_CLEAR( pHwData->Key_slot[0], GROUP_KEY_START_INDEX*8 ); // 20060214 for recover
+ memset( pHwData->Key_slot[0], 0, GROUP_KEY_START_INDEX*8 ); // 20060214 for recover
}
-//---------------------------------------------------------------------------------------------------
-void hal_clear_all_group_key( phw_data_t pHwData )
+
+//------------------------------------------------------------------------------------
+void hal_clear_all_group_key(phw_data_t pHwData)
{
u32 pltmp[MAPPING_KEY_START_INDEX-GROUP_KEY_START_INDEX];
u8 i;
@@ -309,7 +292,7 @@ void hal_clear_all_group_key( phw_data_t
pltmp[i-GROUP_KEY_START_INDEX] |= 0x4000000;
}
Wb35Reg_BurstWrite( pHwData, 0x081c, pltmp, MAPPING_KEY_START_INDEX-GROUP_KEY_START_INDEX, NO_INCREMENT );
- OS_MEMORY_CLEAR( pHwData->Key_slot[GROUP_KEY_START_INDEX], (MAPPING_KEY_START_INDEX-GROUP_KEY_START_INDEX)*8 ); // 20060214 for recover
+ memset( pHwData->Key_slot[GROUP_KEY_START_INDEX], 0, (MAPPING_KEY_START_INDEX-GROUP_KEY_START_INDEX)*8 );
}
//---------------------------------------------------------------------------------------------------
void hal_clear_all_mapping_key( phw_data_t pHwData )
@@ -334,7 +317,7 @@ void hal_clear_all_mapping_key( phw_data
Wb35Reg_BurstWrite( pHwData, 0x081c, pltmp, MAX_KEY_TABLE-MAPPING_KEY_START_INDEX, NO_INCREMENT );
pHwData->mapping_key_replace_index = MAPPING_KEY_START_INDEX;
- OS_MEMORY_CLEAR( pHwData->Key_slot[MAPPING_KEY_START_INDEX], (MAX_KEY_TABLE-MAPPING_KEY_START_INDEX)*8 ); // Modify due to enlarge data struct 6 -> 8
+ memset( pHwData->Key_slot[MAPPING_KEY_START_INDEX], 0, (MAX_KEY_TABLE-MAPPING_KEY_START_INDEX)*8 ); // Modify due to enlarge data struct 6 -> 8
}
//---------------------------------------------------------------------------------------------------
void hal_clear_all_key( phw_data_t pHwData )
@@ -358,7 +341,7 @@ void hal_clear_all_key( phw_data_t pHwDa
}
Wb35Reg_BurstWrite( pHwData, 0x081c, pltmp, 16, NO_INCREMENT );
Wb35Reg_BurstWrite( pHwData, 0x081c, pltmp+16, MAX_KEY_TABLE-16, NO_INCREMENT );
- OS_MEMORY_CLEAR( pHwData->Key_slot[0], MAX_KEY_TABLE*8 ); // 20060214 for recover
+ memset( pHwData->Key_slot[0], 0, MAX_KEY_TABLE*8 ); // 20060214 for recover
}
//---------------------------------------------------------------------------------------------------
void hal_get_ethernet_address( phw_data_t pHwData, PUCHAR current_address )
@@ -400,17 +383,13 @@ u8 hal_init_hardware( phw_data_t pHwDat
pHwData->MaxReceiveLifeTime = DEFAULT_MSDU_LIFE_TIME; // Setting Rx maximum MSDU life time
pHwData->FragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; // Setting default fragment threshold
- if( WbUsb_initial( pHwData ) )
- {
+ if (WbUsb_initial(pHwData)) {
pHwData->InitialResource = 1;
- if( Wb35Reg_initial( pHwData ) )
- {
+ if( Wb35Reg_initial(pHwData)) {
pHwData->InitialResource = 2;
- if( Wb35Tx_initial( pHwData ) )
- {
+ if (Wb35Tx_initial(pHwData)) {
pHwData->InitialResource = 3;
- if( Wb35Rx_initial( pHwData ) )
- {
+ if (Wb35Rx_initial(pHwData)) {
pHwData->InitialResource = 4;
OS_TIMER_INITIAL( &pHwData->LEDTimer, hal_led_control, pHwData );
OS_TIMER_SET( &pHwData->LEDTimer, 1000 ); // 20060623
@@ -440,25 +419,23 @@ u8 hal_init_hardware( phw_data_t pHwDat
pHwData->SurpriseRemove = 1;
return FALSE;
}
-//---------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------
void hal_halt( phw_data_t pHwData, void *ppa_data )
{
-// PADAPTER Adapter = pHwData->Adapter;
-// PWB35REG pWb35Reg = &pHwData->Wb35Reg;
-// unsigned char cancel;
-
switch( pHwData->InitialResource )
{
case 4:
case 3: OS_TIMER_CANCEL( &pHwData->LEDTimer, &cancel );
- OS_SLEEP(100000); // Wait for Timer DPC exit 940623.2
- Wb35Rx_destroy( pHwData ); // Release the Rx
+ OS_SLEEP(100000); // Wait for Timer DPC exit 940623.2
+ Wb35Rx_destroy( pHwData ); // Release the Rx
case 2: Wb35Tx_destroy( pHwData ); // Release the Tx
case 1: Wb35Reg_destroy( pHwData ); // Release the Wb35 Regisster resources
WbUsb_destroy( pHwData );// Release the WbUsb
}
}
-//---------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------
void
hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim )
{
@@ -471,13 +448,9 @@ hal_set_power_save_mode( phw_data_t pHw
//pHwData->desired_power_save = power_save;
pWb35Reg->M24_MacControl &= ~0x0200c000; //clear ps-poll and pwr active/save bits
- if( power_save )
- {
+ if( power_save ) {
pWb35Reg->M24_MacControl |= 0x02004000; //enable ps-poll and pwr save
- }
- else
- {
- //if( pWb35Reg->mac_power_save )
+ } else {
// Force MAC active
pWb35Reg->M24_MacControl |= 0x8000;
dtim = 0; // Reset dtim set
@@ -486,7 +459,7 @@ hal_set_power_save_mode( phw_data_t pHw
// Receive DTIM set
pHwData->dtim = dtim;
pWb35Reg->M24_MacControl &= ~0x00002000;
- if( pHwData->dtim )
+ if (pHwData->dtim)
pWb35Reg->M24_MacControl |= 0x00002000;
Value = pWb35Reg->M24_MacControl;
@@ -497,7 +470,8 @@ hal_set_power_save_mode( phw_data_t pHw
// Writing into M24
Wb35Reg_Write( pHwData, 0x0824, Value );
}
-//---------------------------------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------------
void hal_get_power_save_mode( phw_data_t pHwData, PBOOLEAN pin_pwr_save )
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
@@ -570,7 +544,7 @@ void hal_set_rates( phw_data_t pHwData,
// 930206.2.c M78 setting
j = k = Count1 = Count2 = 0;
- OS_MEMORY_CLEAR( SupportedRate, 16 );
+ memset( SupportedRate, 0, 16 );
tmp = 0x00100000;
tmp1 = 0x00000100;
for( i=0; i<12; i++ ) // Get the supproted rate
@@ -775,7 +749,7 @@ void hal_set_ssid( phw_data_t pHwData,
if( pHwData->SurpriseRemove ) return;
memcpy( pHwData->ssid, pssid, ssid_len );
- OS_MEMORY_CLEAR( (PUCHAR)pltmp, 36 );
+ memset( (PUCHAR)pltmp, 0, 36 );
//NOTE [WK endian]: ssid values will be tranfered by cpu_to_le32 in Wb35Reg_BurstWrite().
// The ssid values must be tranfered first but burst cmd is not necessary.
//memcpy( (PUCHAR)(pltmp+1), pssid, ssid_len );
@@ -1110,30 +1084,30 @@ #endif
return ltmp;
}
-//----------------------------------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
//Info the hardware connection or disconnection
void hal_set_connect_info( phw_data_t pHwData, unsigned char boConnect )
{
if( pHwData->SurpriseRemove ) return;
- if( boConnect )
- {
+ if (boConnect) {
pHwData->LED_LinkOn = 1;
pHwData->NullPacketCount = 0;
- }
- else
+ } else
pHwData->LED_LinkOn = 0;
}
-//----------------------------------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
void hal_led_control_1a( phw_data_t pHwData )
{
hal_led_control( NULL, pHwData, NULL, NULL );
}
+
void hal_led_control( void* S1, phw_data_t pHwData, void* S3, void* S4 )
{
PADAPTER Adapter = pHwData->Adapter;
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
-// PTESTSTA pTestSta = &Adapter->sTestSta;
u32 LEDSet = (pHwData->SoftwareSet & HAL_LED_SET_MASK) >> HAL_LED_SET_SHIFT;
u8 LEDgray[20] = { 0,3,4,6,8,10,11,12,13,14,15,14,13,12,11,10,8,6,4,2 };
u8 LEDgray2[30] = { 7,8,9,10,11,12,13,14,15,0,0,0,0,0,0,0,0,0,0,0,0,0,15,14,13,12,11,10,9,8 };
@@ -1142,8 +1116,7 @@ void hal_led_control( void* S1, phw_da
if( pHwData->SurpriseRemove ) return;
- if( pHwData->LED_control )
- {
+ if( pHwData->LED_control ) {
ltmp2 = pHwData->LED_control & 0xff;
if( ltmp2 < 5 ) // 1 ~ 4 is TS mode
{
@@ -1419,7 +1392,8 @@ void hal_led_control( void* S1, phw_da
Wb35Tx_CurrentTime( pHwData, pHwData->time_count ); // 20060928 add
OS_TIMER_SET( &pHwData->LEDTimer, TimeInterval ); // 20060623.1
}
-//----------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------
u8 hal_get_est_sq3( phw_data_t pHwData, u8 Count )
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
@@ -1446,33 +1420,31 @@ u8 hal_get_est_sq3( phw_data_t pHwData,
return (u8)(ltmp/Count);
}
-//----------------------------------------------------------------------------------------------------
+
void hal_set_phy_type( phw_data_t pHwData, u8 PhyType )
{
pHwData->phy_type = PhyType;
}
-//----------------------------------------------------------------------------------------------------
+
void hal_get_phy_type( phw_data_t pHwData, u8 *PhyType )
{
*PhyType = pHwData->phy_type;
}
-//----------------------------------------------------------------------------------------------------
+
void hal_reset_counter( phw_data_t pHwData )
{
pHwData->dto_tx_retry_count = 0;
pHwData->dto_tx_frag_count = 0;
memset( pHwData->tx_retry_count, 0, 8);
}
-//----------------------------------------------------------------------------------------------------
-//boValue = 1 : radio off
-// 0 : radio on
-void hal_set_radio_mode( phw_data_t pHwData, unsigned char boValue)
+
+void hal_set_radio_mode( phw_data_t pHwData, unsigned char radio_off)
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
if( pHwData->SurpriseRemove ) return;
- if (boValue) //disable Baseband receive off
+ if (radio_off) //disable Baseband receive off
{
pHwData->CurrentRadioSw = 1; // off
pWb35Reg->M24_MacControl &= 0xffffffbf;
@@ -1484,11 +1456,10 @@ void hal_set_radio_mode( phw_data_t pHwD
}
Wb35Reg_Write( pHwData, 0x0824, pWb35Reg->M24_MacControl );
}
-//----------------------------------------------------------------------------------------------------
+
void hal_descriptor_indicate( phw_data_t pHwData, PDESCRIPTOR pRxDes )
{
PADAPTER Adapter = pHwData->Adapter;
-// PWB35REG pWb35Reg = &pHwData->Wb35Reg;
if( !pHwData->IsInitOK ) // 20060717.3 Add
return;
@@ -1499,7 +1470,6 @@ void hal_descriptor_indicate( phw_data_
{ Mds_MpduProcess( Adapter, pRxDes ); }
}
-//----------------------------------------------------------------------------------------------------
u8 hal_get_antenna_number( phw_data_t pHwData )
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
@@ -1509,26 +1479,23 @@ u8 hal_get_antenna_number( phw_data_t p
else
return 1;
}
-//----------------------------------------------------------------------------------------------------
+
void hal_set_antenna_number( phw_data_t pHwData, u8 number )
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
- if (number == 1)
- {
- pWb35Reg->BB2C |= BIT(11);
- }
- else
- {
- pWb35Reg->BB2C &= ~BIT(11);
- }
+ if (number == 1) {
+ pWb35Reg->BB2C |= BIT(11);
+ } else {
+ pWb35Reg->BB2C &= ~BIT(11);
+ }
Wb35Reg_Write( pHwData, 0x102c, pWb35Reg->BB2C );
- #ifdef _PE_STATE_DUMP_
+#ifdef _PE_STATE_DUMP_
WBDEBUG(("Current antenna number : %d\n", number));
- #endif
+#endif
}
-//----------------------------------------------------------------------------------------------------
+
u32 hal_get_bss_pk_cnt( phw_data_t pHwData )
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
@@ -1545,6 +1512,7 @@ u32 hal_get_bss_pk_cnt( phw_data_t pHwD
Wb35Reg_Read( pHwData, 0x1060, &pWb35Reg->BB60 );
return (pWb35Reg->BB60);
}
+
//----------------------------------------------------------------------------------------------------
//0 : radio on; 1: radio off
u8 hal_get_hw_radio_off( phw_data_t pHwData )
@@ -1555,34 +1523,24 @@ u8 hal_get_hw_radio_off( phw_data_t pHw
//read the bit16 of register U1B0
Wb35Reg_Read( pHwData, 0x3b0, &pWb35Reg->U1B0 );
- if ((pWb35Reg->U1B0 & 0x00010000))
- {
+ if ((pWb35Reg->U1B0 & 0x00010000)) {
pHwData->CurrentRadioHw = 1;
return 1;
- }
- else
- {
+ } else {
pHwData->CurrentRadioHw = 0;
return 0;
}
}
-//----------------------------------------------------------------------------------------------------
+
unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, PULONG pValue )
{
-// PADAPTER Adapter = pHwData->Adapter;
-// PWB35REG pWb35Reg = &pHwData->Wb35Reg;
- unsigned char ret;
-
if( number < 0x1000 )
number += 0x1000;
- ret = Wb35Reg_ReadSync( pHwData, number, pValue );
- return ret;
+ return Wb35Reg_ReadSync( pHwData, number, pValue );
}
-//----------------------------------------------------------------------------------------------------
+
unsigned char hal_set_dxx_reg( phw_data_t pHwData, u16 number, u32 value )
{
-// PADAPTER Adapter = pHwData->Adapter;
-// PWB35REG pWb35Reg = &pHwData->Wb35Reg;
unsigned char ret;
if( number < 0x1000 )
@@ -1590,14 +1548,14 @@ unsigned char hal_set_dxx_reg( phw_data
ret = Wb35Reg_WriteSync( pHwData, number, value );
return ret;
}
-//----------------------------------------------------------------------------------------------------
-void hal_scan_status_indicate( phw_data_t pHwData, unsigned char IsOnProgress )
+
+void hal_scan_status_indicate(phw_data_t pHwData, unsigned char IsOnProgress)
{
if( pHwData->SurpriseRemove ) return;
pHwData->LED_Scanning = IsOnProgress ? 1 : 0;
}
-//----------------------------------------------------------------------------------------------------
-void hal_system_power_change( phw_data_t pHwData, u32 PowerState )
+
+void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
{
if( PowerState != 0 )
{
@@ -1611,39 +1569,37 @@ void hal_system_power_change( phw_data
hal_stop( pHwData );
}
}
-//----------------------------------------------------------------------------------------------------
+
void hal_surprise_remove( phw_data_t pHwData )
{
PADAPTER Adapter = pHwData->Adapter;
- if( OS_ATOMIC_INC( Adapter, &pHwData->SurpriseRemoveCount ) == 1 )
- {
+ if (OS_ATOMIC_INC( Adapter, &pHwData->SurpriseRemoveCount ) == 1) {
#ifdef _PE_STATE_DUMP_
WBDEBUG(("Calling hal_surprise_remove\n"));
#endif
OS_STOP( Adapter );
}
}
-//----------------------------------------------------------------------------------------------------
+
void hal_rate_change( phw_data_t pHwData ) // Notify the HAL rate is changing 20060613.1
{
PADAPTER Adapter = pHwData->Adapter;
u8 rate = CURRENT_TX_RATE;
BBProcessor_RateChanging( pHwData, rate );
-// RF_RateChanging( pHwData, rate );
}
-//----------------------------------------------------------------------------------------------------
-void hal_set_rf_power( phw_data_t pHwData, u8 PowerIndex )
+
+void hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
{
- PADAPTER Adapter = pHwData->Adapter;
+ PADAPTER Adapter = pHwData->Adapter;
- if( TS_RUNNING_IN_TESTSTA_MODE )
+ if (TS_RUNNING_IN_TESTSTA_MODE)
return; // Ignore setting if access right is not owned by NDIS
RFSynthesizer_SetPowerIndex( pHwData, PowerIndex );
}
-//----------------------------------------------------------------------------------------------------
-unsigned char hal_set_LED( phw_data_t pHwData, u32 Mode ) // 20061108 for WPS led control
+
+unsigned char hal_set_LED(phw_data_t pHwData, u32 Mode) // 20061108 for WPS led control
{
pHwData->LED_Blinking = 0;
pHwData->LED_control = Mode;
diff --git a/drivers/net/wireless/winbond/winbondport/wbndis.c b/drivers/net/wireless/winbond/winbondport/wbndis.c
index d9f3a77..36013b7 100644
--- a/drivers/net/wireless/winbond/winbondport/wbndis.c
+++ b/drivers/net/wireless/winbond/winbondport/wbndis.c
@@ -560,10 +560,10 @@ void WBNDIS_ConnectStatus( PADAPTER Ada
#ifdef NDIS50_MINIPORT
void WbInitializeString( PNDIS_STRING DestinationString, PUCHAR SourceString )
{
- u16 i, len;
+ u16 i, len;
len = (u16)strlen( SourceString );
- if( (OS_MEMORY_ALLOC( (void* *)&DestinationString->Buffer, 100 ) != 1) || // 100 byte maximum
+ if ((OS_MEMORY_ALLOC( (void* *)&DestinationString->Buffer, 100 ) != 1) || // 100 byte maximum
(len >= 50 ) )
{
DestinationString->MaximumLength = 0;
@@ -578,10 +578,9 @@ void WbInitializeString( PNDIS_STRING
DestinationString->Buffer[i] = SourceString[i];
}
-void WbFreeString( NDIS_STRING String )
+void WbFreeString( NDIS_STRING String)
{
- if( String.Buffer )
- OS_MEMORY_FREE( String.Buffer, 100 );
+ kfree(String.Buffer);
String.Buffer = NULL;
}
#endif
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 2+ messages in thread* w35und: some more cleanups
@ 2008-04-07 22:41 Pavel Machek
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2008-04-07 22:41 UTC (permalink / raw)
To: kernel list, kaszak, lcostantino
Some more cleanups for today. I took a look at transmit/receive paths,
and they seem to be reasonably simple, maybe softmac conversion will
not be that hard to do...?
Signed-off-by: Pavel Machek <pavel@suse.cz>
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wb35reg.c b/drivers/net/wireless/winbond/winbondport/linux/wb35reg.c
index 3fa841f..9809139 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wb35reg.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/wb35reg.c
@@ -10,7 +10,7 @@ extern void phy_calibration_winbond(hw_d
// Flag : AUTO_INCREMENT - RegisterNo will auto increment 4
// NO_INCREMENT - Function will write data into the same register
unsigned char
-Wb35Reg_BurstWrite( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 NumberOfData, u8 Flag )
+Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 NumberOfData, u8 Flag)
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
PURB pUrb = NULL;
@@ -70,7 +70,7 @@ Wb35Reg_BurstWrite( phw_data_t pHwData,
}
void
-Wb35Reg_Update( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue )
+Wb35Reg_Update(phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue)
{
PWB35REG pWb35Reg = &pHwData->Wb35Reg;
switch (RegisterNo) {
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c b/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
index ea70d84..f9d2b82 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/wb35rx.c
@@ -26,11 +26,11 @@ void Wb35Rx_start(phw_data_t pHwData)
// This function cannot reentrain
void Wb35Rx( phw_data_t pHwData )
{
- PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- PUCHAR pRxBufferAddress;
- PURB pUrb = (PURB)pWb35Rx->RxUrb;
- int retv;
- u32 RxBufferId;
+ PWB35RX pWb35Rx = &pHwData->Wb35Rx;
+ PUCHAR pRxBufferAddress;
+ PURB pUrb = (PURB)pWb35Rx->RxUrb;
+ int retv;
+ u32 RxBufferId;
//
// Issuing URB
@@ -183,14 +183,14 @@ void Wb35Rx_stop(phw_data_t pHwData)
// Canceling the Irp if already sends it out.
if (pWb35Rx->EP3vm_state == VM_RUNNING) {
- usb_unlink_urb( pWb35Rx->RxUrb ); // Only use unlink, let Wb35Rx_destrot to free them
+ usb_unlink_urb( pWb35Rx->RxUrb ); // Only use unlink, let Wb35Rx_destroy to free them
#ifdef _PE_RX_DUMP_
WBDEBUG(("EP3 Rx stop\n"));
#endif
}
}
-// Only can be run in passive-level
+// Needs process context
void Wb35Rx_destroy(phw_data_t pHwData)
{
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
@@ -200,7 +200,7 @@ void Wb35Rx_destroy(phw_data_t pHwData)
} while (pWb35Rx->EP3vm_state != VM_STOP);
OS_SLEEP(10000); // Delay for waiting function exit 940623.1.b
- if( pWb35Rx->RxUrb )
+ if (pWb35Rx->RxUrb)
usb_free_urb( pWb35Rx->RxUrb );
#ifdef _PE_RX_DUMP_
WBDEBUG(("Wb35Rx_destroy OK\n"));
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wb35tx.c b/drivers/net/wireless/winbond/winbondport/linux/wb35tx.c
index 401ddbf..a5b26ec 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wb35tx.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/wb35tx.c
@@ -25,9 +25,9 @@ void Wb35Tx_start(phw_data_t pHwData)
PWB35TX pWb35Tx = &pHwData->Wb35Tx;
// Allow only one thread to run into function
- if( OS_ATOMIC_INC( pHwData->Adapter, &pWb35Tx->TxFireCounter ) == 1 ) {
+ if (OS_ATOMIC_INC(pHwData->Adapter, &pWb35Tx->TxFireCounter) == 1) {
pWb35Tx->EP4vm_state = VM_RUNNING;
- Wb35Tx( pHwData );
+ Wb35Tx(pHwData);
} else
OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxFireCounter );
}
@@ -39,56 +39,55 @@ void Wb35Tx(phw_data_t pHwData)
PADAPTER Adapter = pHwData->Adapter;
PUCHAR pTxBufferAddress;
PMDS pMds = &Adapter->Mds;
- PURB pUrb = (PURB)pWb35Tx->Tx4Urb;
+ struct urb * pUrb = (struct urb *)pWb35Tx->Tx4Urb;
int retv;
u32 SendIndex;
- do {
- if (pHwData->SurpriseRemove || pHwData->HwStop)
- break;
-
- if (pWb35Tx->tx_halt)
- break;
-
- // Ownership checking
- SendIndex = pWb35Tx->TxSendIndex;
- if (!pMds->TxOwner[SendIndex]) //No more data need to be sent, return immediately
- break;
-
- pTxBufferAddress = pWb35Tx->TxBuffer[SendIndex];
- //
- // Issuing URB
- //
- usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
- usb_sndbulkpipe(pHwData->WbUsb.udev, 4),
- pTxBufferAddress, pMds->TxBufferSize[ SendIndex ],
- Wb35Tx_complete, pHwData);
-
- pWb35Tx->EP4vm_state = VM_RUNNING;
- retv = wb_usb_submit_urb( pUrb );
- if (retv<0) {
- #ifdef _PE_TX_DUMP_
- WBDEBUG(("EP4 Tx Irp sending error\n"));
- #endif
- break;
- }
+ if (pHwData->SurpriseRemove || pHwData->HwStop)
+ goto cleanup;
+
+ if (pWb35Tx->tx_halt)
+ goto cleanup;
+
+ // Ownership checking
+ SendIndex = pWb35Tx->TxSendIndex;
+ if (!pMds->TxOwner[SendIndex]) //No more data need to be sent, return immediately
+ goto cleanup;
+
+ pTxBufferAddress = pWb35Tx->TxBuffer[SendIndex];
+ //
+ // Issuing URB
+ //
+ usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
+ usb_sndbulkpipe(pHwData->WbUsb.udev, 4),
+ pTxBufferAddress, pMds->TxBufferSize[ SendIndex ],
+ Wb35Tx_complete, pHwData);
+
+ pWb35Tx->EP4vm_state = VM_RUNNING;
+ retv = wb_usb_submit_urb( pUrb );
+ if (retv<0) {
+#ifdef _PE_TX_DUMP_
+ WBDEBUG(("EP4 Tx Irp sending error\n"));
+#endif
+ goto cleanup;
+ }
- // Check if driver needs issue Irp for EP2
- pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex];
- if( pWb35Tx->TxFillCount > 12 ) // Fixed to 12. 20060928
- Wb35Tx_EP2VM_start( pHwData );
+ // Check if driver needs issue Irp for EP2
+ pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex];
+ if( pWb35Tx->TxFillCount > 12 ) // Fixed to 12. 20060928
+ Wb35Tx_EP2VM_start( pHwData );
- pWb35Tx->ByteTransfer += pMds->TxBufferSize[SendIndex];
- return;
- } while(FALSE);
+ pWb35Tx->ByteTransfer += pMds->TxBufferSize[SendIndex];
+ return;
+ cleanup:
pWb35Tx->EP4vm_state = VM_STOP;
OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxFireCounter );
}
-void Wb35Tx_complete( PURB pUrb )
+void Wb35Tx_complete(struct urb * pUrb)
{
phw_data_t pHwData = pUrb->context;
PADAPTER Adapter = (PADAPTER)pHwData->Adapter;
@@ -232,8 +231,8 @@ void Wb35Tx_EP2VM_start( phw_data_t pHw
void Wb35Tx_EP2VM(phw_data_t pHwData)
{
- PWB35TX pWb35Tx = &pHwData->Wb35Tx;
- PURB pUrb = (PURB)pWb35Tx->Tx2Urb;
+ PWB35TX pWb35Tx = &pHwData->Wb35Tx;
+ struct urb * pUrb = (struct urb *)pWb35Tx->Tx2Urb;
PULONG pltmp = (PULONG)pWb35Tx->EP2_buf;
int retv;
@@ -275,7 +274,7 @@ void Wb35Tx_EP2VM(phw_data_t pHwData)
}
-void Wb35Tx_EP2VM_complete( PURB pUrb )
+void Wb35Tx_EP2VM_complete(struct urb * pUrb)
{
phw_data_t pHwData = pUrb->context;
T02_DESCRIPTOR T02, TSTATUS;
@@ -290,8 +289,7 @@ void Wb35Tx_EP2VM_complete( PURB pUrb )
pWb35Tx->EP2vm_state = VM_COMPLETED;
pWb35Tx->EP2VM_status = pUrb->status;
- do
- {
+ do {
// For Linux 2.4. Interrupt will always trigger
if( pHwData->SurpriseRemove || pHwData->HwStop ) // Let WbWlanHalt to handle surprise remove
break;
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wbusb.c b/drivers/net/wireless/winbond/winbondport/linux/wbusb.c
index 4a980e6..62d3e49 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wbusb.c
+++ b/drivers/net/wireless/winbond/winbondport/linux/wbusb.c
@@ -130,10 +130,6 @@ int wb35_probe( struct usb_interface *in
pWbUsb = &Adapter->sHwData.WbUsb;
pWbUsb->udev = udev;
- //set the interface name for this device.
- //dev_alloc_name( netdev, "wlan%d");
-
-
//Cambiado
interface = intf->cur_altsetting;
endpoint = &interface->endpoint[0].desc;
diff --git a/drivers/net/wireless/winbond/winbondport/linux/wbusb_s.h b/drivers/net/wireless/winbond/winbondport/linux/wbusb_s.h
index 7a775c0..74d72bd 100644
--- a/drivers/net/wireless/winbond/winbondport/linux/wbusb_s.h
+++ b/drivers/net/wireless/winbond/winbondport/linux/wbusb_s.h
@@ -12,7 +12,7 @@
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define OS_SLEEP( _MT ) { set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout( _MT*HZ/1000000 ); }
+ schedule_timeout( _MT*HZ/1000000 ); }
//---------------------------------------------------------------------------
@@ -22,7 +22,7 @@ #define OS_SLEEP( _MT ) { set_current_st
//---------------------------------------------------------------------------
typedef struct _RW_CONTEXT
{
- void* pHwData;
+ void* pHwData;
PURB pUrb;
void* pCallBackFunctionParameter;
} RW_CONTEXT, *PRW_CONTEXT;
@@ -30,27 +30,13 @@ typedef struct _RW_CONTEXT
-#define DRIVER_AUTHOR "Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>"
-#define DRIVER_DESC "IS89C35 802.11bg WLAN USB Driver"
+#define DRIVER_AUTHOR "Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>"
+#define DRIVER_DESC "IS89C35 802.11bg WLAN USB Driver"
-typedef struct _WBUSB
-{
- // Is USB 2.0
+typedef struct _WBUSB {
u32 IsUsb20;
- struct usb_device * udev;
+ struct usb_device *udev;
u32 DetectCount;
-
} WBUSB, *PWBUSB;
-
-#if 0 //some Linux don't have usb_ctrlrequest
-struct usb_ctrlrequest {
- __u8 bRequestType;
- __u8 bRequest;
- __u16 wValue;
- __u16 wIndex;
- __u16 wLength;
-} __attribute__ ((packed));
-#endif
-
diff --git a/drivers/net/wireless/winbond/winbondport/mds.c b/drivers/net/wireless/winbond/winbondport/mds.c
index 3cb7d4a..2d06cd9 100644
--- a/drivers/net/wireless/winbond/winbondport/mds.c
+++ b/drivers/net/wireless/winbond/winbondport/mds.c
@@ -43,7 +43,7 @@ Mds_Tx(PADAPTER Adapter)
PUCHAR XmitBufAddress;
u16 XmitBufSize, PacketSize, stmp, CurrentSize, FragmentThreshold;
u8 FillIndex, TxDesIndex, PacketFrom, FragmentCount, FillCount;
- unsigned char BufferFilled = FALSE, MICAdd;
+ unsigned char BufferFilled = FALSE, MICAdd;
//931130.5.a
@@ -54,14 +54,11 @@ Mds_Tx(PADAPTER Adapter)
return;
//Only one thread can be run here
- if( OS_ATOMIC_INC( Adapter, &pMds->TxThreadCount ) == 1 )
- {
+ if (OS_ATOMIC_INC( Adapter, &pMds->TxThreadCount) == 1) {
// Start to fill the data
- do
- {
+ do {
FillIndex = pMds->TxFillIndex;
- if( pMds->TxOwner[FillIndex] ) // Is owned by software 0:Yes 1:No
- {
+ if (pMds->TxOwner[FillIndex]) { // Is owned by software 0:Yes 1:No
#ifdef _PE_TX_DUMP_
WBDEBUG(("[Mds_Tx] Tx Owner is H/W.\n"));
#endif
@@ -71,25 +68,22 @@ Mds_Tx(PADAPTER Adapter)
XmitBufAddress = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex); //Get buffer
XmitBufSize = 0;
FillCount = 0;
- do
- {
+ do {
// Sending packet path
PacketFrom = 1;
PacketSize = QUERY_SIZE_FIRST( Adapter );
- if( !PacketSize )
- {
+ if (!PacketSize) {
if( !TS_RUNNING_IN_TESTSTA_MODE ) // If driver doesn't run in test mode, send MLME and normal data frame
{
PacketFrom = 2;
- PacketSize = QUERY_SIZE_SECOND( Adapter );
- if( !PacketSize )
- {
+ PacketSize = QUERY_SIZE_SECOND(Adapter);
+ if( !PacketSize ) {
if( pMds->ScanTxPause ) //No management frames to transmit.
break; //The scanning is progressing, so stop the data
//frames transmission
PacketFrom = 3;
PacketSize = QUERY_SIZE_THIRD( Adapter );
- if( !PacketSize )
+ if (!PacketSize)
break;
}
}
@@ -102,8 +96,7 @@ Mds_Tx(PADAPTER Adapter)
//931130.5.b
FragmentCount = PacketSize/FragmentThreshold + 1;
stmp = PacketSize + FragmentCount*32 + 8;//931130.5.c 8:MIC
- if( (XmitBufSize + stmp) >= MAX_USB_TX_BUFFER )
- {
+ if ((XmitBufSize + stmp) >= MAX_USB_TX_BUFFER) {
#ifdef _PE_TX_DUMP_
WBDEBUG(("[Mds_Tx] Excess max tx buffer.\n"));
#endif
@@ -124,19 +117,18 @@ Mds_Tx(PADAPTER Adapter)
pMds->TxDesIndex %= MAX_USB_TX_DESCRIPTOR;
// Get packet to transmit, 1:TESTSTA 2:MLME 3: Ndis data
- if( PacketFrom == 3 )
+ if (PacketFrom == 3)
{ GET_DESCRIPTOR_THIRD( Adapter, pTxDes ); }
- else if( PacketFrom == 2 )
+ else if (PacketFrom == 2)
{ GET_DESCRIPTOR_SECOND( Adapter, pTxDes ); }
- else if( PacketFrom == 1 )
+ else if (PacketFrom == 1)
{ GET_DESCRIPTOR_FIRST( Adapter, pTxDes ); }
// Copy header. 8byte USB + 24byte 802.11Hdr. Set TxRate, Preamble type
Mds_HeaderCopy( Adapter, pTxDes, XmitBufAddress );
// For speed up Key setting
- if( pTxDes->EapFix )
- {
+ if (pTxDes->EapFix) {
#ifdef _PE_TX_DUMP_
WBDEBUG(("35: EPA 4th frame detected. Size = %d\n", PacketSize));
#endif
@@ -146,8 +138,7 @@ Mds_Tx(PADAPTER Adapter)
//
// Add MIC redundant 8 byte in pTxDes, assume that TKIP encryption and wep bit = 1
MICAdd = (CURRENT_ENCRYPT_STATUS==ENCRYPT_TKIP) && (XmitBufAddress[9]&0x40);
- if( MICAdd )
- {
+ if (MICAdd) {
pMds->MicAdd = 8;
pMds->MicWriteIndex = 0;
DESCRIPTOR_ADD_BUFFER( pTxDes, pMds->MicRedundant, 8 );
@@ -176,17 +167,16 @@ Mds_Tx(PADAPTER Adapter)
//---------------------
//Check Power save
- if (psSME->bDesiredPowerSave)
- {
+ if (psSME->bDesiredPowerSave) {
if ((psLOCAL->wConnectedSTAindex == 0) ||
- ((psLOCAL->wConnectedSTAindex != 0) &&
- (psBSS(psLOCAL->wConnectedSTAindex)->bBssType == ESS_NET)))
+ ((psLOCAL->wConnectedSTAindex != 0) &&
+ (psBSS(psLOCAL->wConnectedSTAindex)->bBssType == ESS_NET)))
{
psLOCAL->boHasTxActivity = 1;
if (psLOCAL->iPowerSaveMode == PWR_SAVE)
{
K_MSG sSmeMsg;
- u8 PsMode;
+ u8 PsMode;
//wake up the H/W
PsMode = PWR_ACTIVE;
@@ -199,8 +189,7 @@ Mds_Tx(PADAPTER Adapter)
#ifdef _PE_TX_DUMP_
WBDEBUG((">>Send MSDU\n"));
- if (XmitBufSize > 0)
- {
+ if (XmitBufSize > 0) {
PUCHAR ptr;
ptr = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex);
@@ -210,11 +199,11 @@ Mds_Tx(PADAPTER Adapter)
#endif
// Get packet to transmit completed, 1:TESTSTA 2:MLME 3: Ndis data
- if( PacketFrom == 3 )
+ if (PacketFrom == 3)
{ GET_DESCRIPTOR_THIRD_COMPLETED( Adapter, pTxDes ); }
- else if( PacketFrom == 2 )
+ else if (PacketFrom == 2)
{ GET_DESCRIPTOR_SECOND_COMPLETED( Adapter, pTxDes ); }
- else if( PacketFrom == 1 )
+ else if (PacketFrom == 1)
{ GET_DESCRIPTOR_FIRST_COMPLETED( Adapter, pTxDes ); }
// Software TSC count 20060214
@@ -224,11 +213,10 @@ Mds_Tx(PADAPTER Adapter)
FillCount++; // 20060928
- }while( HAL_USB_MODE_BURST(pHwData) );// End of multiple MSDU copy loop. FALSE = single TRUE = multiple sending
+ } while (HAL_USB_MODE_BURST(pHwData)); // End of multiple MSDU copy loop. FALSE = single TRUE = multiple sending
// Move to the next one, if necessary
- if( BufferFilled )
- {
+ if (BufferFilled) {
// size setting
pMds->TxBufferSize[ FillIndex ] = XmitBufSize;
@@ -245,16 +233,16 @@ Mds_Tx(PADAPTER Adapter)
else
break;
- if( !PacketSize )// No more pk for transmitting
+ if (!PacketSize) // No more pk for transmitting
break;
- }while(TRUE);
+ } while(TRUE);
//
// Start to send by lower module
//
- if( !pHwData->IsKeyPreSet )
- Wb35Tx_start( pHwData );
+ if (!pHwData->IsKeyPreSet)
+ Wb35Tx_start(pHwData);
}
OS_ATOMIC_DEC( Adapter, &pMds->TxThreadCount );
diff --git a/drivers/net/wireless/winbond/winbondport/reg.c b/drivers/net/wireless/winbond/winbondport/reg.c
index 34d963a..2a30f32 100644
--- a/drivers/net/wireless/winbond/winbondport/reg.c
+++ b/drivers/net/wireless/winbond/winbondport/reg.c
@@ -1043,10 +1043,8 @@ void Set_ChanIndep_RfData_al7230_50( ph
// RFSynthesizer_initial --
//=============================================================================================================
void
-RFSynthesizer_initial( phw_data_t pHwData )
+RFSynthesizer_initial(phw_data_t pHwData)
{
-// PADAPTER Adapter = pHwData->Adapter;
-// PWB35REG pWb35Reg = &pHwData->Wb35Reg;
u32 altmp[32];
PULONG pltmp = altmp;
u32 ltmp;
diff --git a/drivers/net/wireless/winbond/winbondport/sme_api.c b/drivers/net/wireless/winbond/winbondport/sme_api.c
index b0726dd..00cb7f0 100644
--- a/drivers/net/wireless/winbond/winbondport/sme_api.c
+++ b/drivers/net/wireless/winbond/winbondport/sme_api.c
@@ -27,8 +27,7 @@ s8 sme_get_bssid(void *pcore_data, u8 *p
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if(psLOCAL->wConnectedSTAindex) {
memcpy( pbssid, psBSS(psLOCAL->wConnectedSTAindex)->abBssID, MAC_ADDR_LENGTH );
return 0;
}
@@ -39,7 +38,7 @@ s8 sme_get_desired_bssid(void *pcore_dat
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- memcpy( pbssid, psSME->abDesiredBSSID, MAC_ADDR_LENGTH );
+ memcpy(pbssid, psSME->abDesiredBSSID, MAC_ADDR_LENGTH);
return 0;
}
@@ -47,7 +46,7 @@ s8 sme_set_desired_bssid(void *pcore_dat
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- memcpy( psSME->abDesiredBSSID, pbssid, MAC_ADDR_LENGTH );
+ memcpy(psSME->abDesiredBSSID, pbssid, MAC_ADDR_LENGTH);
return 0;
}
@@ -55,8 +54,7 @@ s8 sme_get_ssid(void *pcore_data, u8 *ps
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if(psLOCAL->wConnectedSTAindex) {
*pssid_len = psBSS(psLOCAL->wConnectedSTAindex)->SSID.Length;
memcpy( pssid, psBSS(psLOCAL->wConnectedSTAindex)->SSID.SSID, *pssid_len );
return 0;
@@ -225,8 +223,7 @@ s8 sme_get_atim_window(void *pcore_data,
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if (psLOCAL->wConnectedSTAindex) {
*patim_window = *(u16 *)psBSS(psLOCAL->wConnectedSTAindex)->IBSS_Parameter_Set.ATIM_Window;
return 0;
}
@@ -245,8 +242,7 @@ s8 sme_get_current_channel(void *pcore_d
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if (psLOCAL->wConnectedSTAindex) {
*pcurrent_channel = psBSS(psLOCAL->wConnectedSTAindex)->DS_Parameter_Set.Current_Channel;
return 0;
}
@@ -257,8 +253,7 @@ s8 sme_get_current_band(void *pcore_data
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if (psLOCAL->wConnectedSTAindex) {
*pcurrent_band = psBSS(psLOCAL->wConnectedSTAindex)->band;
return 0;
}
@@ -267,9 +262,6 @@ s8 sme_get_current_band(void *pcore_data
s8 sme_set_current_channel(void *pcore_data, u8 current_channel)
{
- //PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
-
- //psSME->bCurrentChannel = current_channel;
return 0;
}
@@ -295,8 +287,7 @@ s8 sme_get_connected_bss(void *pcore_dat
{
PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
- if(psLOCAL->wConnectedSTAindex)
- {
+ if(psLOCAL->wConnectedSTAindex) {
*ppbss_now = psBSS(psLOCAL->wConnectedSTAindex);
return 0;
}
@@ -319,32 +310,6 @@ s8 sme_set_auth_mode(void *pcore_data, u
return 0;
}
-//replace by sme_get_encryption_status and sme_set_encryption_status
-/*
-s8 sme_get_wep_mode(void *pcore_data, u8 *pwep_mode)
-{
- PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
-
- *pwep_mode = psSME->_dot11PrivacyInvoked;
- return 0;
-}
-
-s8 sme_set_wep_mode(void *pcore_data, u8 wep_mode)
-{
- PWB32_ADAPTER Adapter = (PWB32_ADAPTER)pcore_data;
-
- psSME->_dot11PrivacyInvoked = wep_mode;
- psSME->_dot11PrivacyOptionImplemented = wep_mode;
- if(wep_mode)
- psSME->_WEPKeyLength = (psSME->key_length==5) ? WEPKEY_64 : WEPKEY_128;
- else
- psSME->_WEPKeyLength = WEPKEY_DISABLED;
-
- //??clear WEP table or not because WEP mode change??
- return 0;
-}
-*/
-
s8 sme_set_add_wep(void *pcore_data, u32 key_index, u32 key_len,
u8 *address, u8 *key)
{
@@ -353,8 +318,7 @@ s8 sme_set_add_wep(void *pcore_data, u32
s8 ret = -1;
u8 key_type;
- do
- {
+ do {
#ifdef _PE_STATE_DUMP_
WBDEBUG(("OID Key idx =[%x] length = %d Content = ", key_index, key_len));
for(i=0; i<key_len; i++)
diff --git a/drivers/net/wireless/winbond/winbondport/wblinux.c b/drivers/net/wireless/winbond/winbondport/wblinux.c
index f095534..9220e80 100644
--- a/drivers/net/wireless/winbond/winbondport/wblinux.c
+++ b/drivers/net/wireless/winbond/winbondport/wblinux.c
@@ -12,7 +12,7 @@ #include "os_common.h"
#include "linux/new_wireless.h"
u32
-WBLINUX_MemoryAlloc( void* *VirtualAddress, u32 Length )
+WBLINUX_MemoryAlloc(void* *VirtualAddress, u32 Length)
{
*VirtualAddress = kmalloc( Length, GFP_ATOMIC ); //GFP_KERNEL is not suitable
@@ -22,20 +22,20 @@ WBLINUX_MemoryAlloc( void* *VirtualAddr
}
s32
- EncapAtomicInc( PADAPTER Adapter, void* pAtomic )
+EncapAtomicInc( PADAPTER Adapter, void* pAtomic )
{
- PWBLINUX pWbLinux = &Adapter->WbLinux;
- u32 ltmp;
- PULONG pltmp = (PULONG)pAtomic;
- OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
- (*pltmp)++;
- ltmp = (*pltmp);
- OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
- return ltmp;
+ PWBLINUX pWbLinux = &Adapter->WbLinux;
+ u32 ltmp;
+ PULONG pltmp = (PULONG)pAtomic;
+ OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
+ (*pltmp)++;
+ ltmp = (*pltmp);
+ OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
+ return ltmp;
}
s32
- EncapAtomicDec( PADAPTER Adapter, void* pAtomic )
+EncapAtomicDec( PADAPTER Adapter, void* pAtomic )
{
PWBLINUX pWbLinux = &Adapter->WbLinux;
u32 ltmp;
@@ -48,137 +48,128 @@ s32
}
unsigned char
- WBLINUX_Initial( PADAPTER Adapter )
+WBLINUX_Initial( PADAPTER Adapter )
{
- PWBLINUX pWbLinux = &Adapter->WbLinux;
+ PWBLINUX pWbLinux = &Adapter->WbLinux;
- OS_SPIN_LOCK_ALLOCATE( &pWbLinux->SpinLock );
- OS_SPIN_LOCK_ALLOCATE( &pWbLinux->AtomicSpinLock );
- pWbLinux->netdev->open = wb35_open;
- pWbLinux->netdev->stop = wb35_close;
- pWbLinux->netdev->hard_start_xmit = wb35_start_xmit;
- pWbLinux->netdev->set_multicast_list = wb35_set_multicast;
- pWbLinux->netdev->get_stats = wb35_netdev_stats;
- pWbLinux->netdev->wireless_handlers = (struct iw_handler_def *)&test_iw_handlers;
+ OS_SPIN_LOCK_ALLOCATE( &pWbLinux->SpinLock );
+ OS_SPIN_LOCK_ALLOCATE( &pWbLinux->AtomicSpinLock );
+ pWbLinux->netdev->open = wb35_open;
+ pWbLinux->netdev->stop = wb35_close;
+ pWbLinux->netdev->hard_start_xmit = wb35_start_xmit;
+ pWbLinux->netdev->set_multicast_list = wb35_set_multicast;
+ pWbLinux->netdev->get_stats = wb35_netdev_stats;
+ pWbLinux->netdev->wireless_handlers = (struct iw_handler_def *)&test_iw_handlers;
- return TRUE;
+ return TRUE;
}
void
- WBLinux_ReceivePacket( PADAPTER Adapter, PRXLAYER1 pRxLayer1 )
+WBLinux_ReceivePacket(PADAPTER Adapter, PRXLAYER1 pRxLayer1)
{
- PWBLINUX pWbLinux = &Adapter->WbLinux;
- struct sk_buff *skb = NULL;
- PUCHAR BufAddr;
- u32 ByteCount = 0;
- u32 i;
- u16 BufSize;
-
- for( i=0; i<pRxLayer1->BufferNumber; i++ )
- {
- BufSize = pRxLayer1->BufferQueue[i].BufferSize;
- ByteCount += BufSize;
- }
+ PWBLINUX pWbLinux = &Adapter->WbLinux;
+ struct sk_buff *skb = NULL;
+ PUCHAR BufAddr;
+ u32 ByteCount = 0;
+ u32 i;
+ u16 BufSize;
+
+ for( i=0; i<pRxLayer1->BufferNumber; i++ ) {
+ BufSize = pRxLayer1->BufferQueue[i].BufferSize;
+ ByteCount += BufSize;
+ }
#ifdef _PE_RX_DUMP_
- WBDEBUG(( "[w35und]---> Rx total length =%d BuffNum=%d\n", ByteCount, pRxLayer1->BufferNumber ));
+ WBDEBUG(( "[w35und]---> Rx total length =%d BuffNum=%d\n", ByteCount, pRxLayer1->BufferNumber ));
#endif
- if( (skb = dev_alloc_skb( ByteCount + 2 )) != NULL )
- {
- skb->dev = pWbLinux->netdev;
- skb_reserve( skb, 2 );
+ if ((skb = dev_alloc_skb( ByteCount + 2 )) != NULL) {
+ skb->dev = pWbLinux->netdev;
+ skb_reserve( skb, 2 );
- for( i=0; i<pRxLayer1->BufferNumber; i++ )
- {
- BufSize = pRxLayer1->BufferQueue[i].BufferSize;
- BufAddr = pRxLayer1->BufferQueue[i].pBufferAddress;
- // I Think this fits better - Scythe -
- memcpy(skb->data,BufAddr,BufSize);
- skb_put( skb, BufSize );
- }
-
- skb->protocol = eth_type_trans( skb, pWbLinux->netdev );
-
- netif_rx( skb );
- pWbLinux->netdev->last_rx = jiffies;
- pWbLinux->stats.rx_packets ++;
- pWbLinux->stats.rx_bytes += ByteCount;
- }
- else
- {
+ for (i=0; i<pRxLayer1->BufferNumber; i++) {
+ BufSize = pRxLayer1->BufferQueue[i].BufferSize;
+ BufAddr = pRxLayer1->BufferQueue[i].pBufferAddress;
+ // I Think this fits better - Scythe -
+ memcpy(skb->data, BufAddr, BufSize);
+ skb_put( skb, BufSize );
+ }
+
+ skb->protocol = eth_type_trans( skb, pWbLinux->netdev );
+
+ netif_rx( skb );
+ pWbLinux->netdev->last_rx = jiffies;
+ pWbLinux->stats.rx_packets ++;
+ pWbLinux->stats.rx_bytes += ByteCount;
+ } else {
#ifdef _PE_RX_DUMP_
- WBDEBUG(( "[w35und]RX SKB ALLOCATE IS FAILED !\n" ));
+ WBDEBUG(( "[w35und]RX SKB ALLOCATE IS FAILED !\n" ));
#endif
- }
+ }
}
-int wb35_start_xmit( struct sk_buff *skb, struct net_device *netdev )
+int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev)
{
- PADAPTER Adapter = netdev->priv;
- PWBLINUX pWbLinux = &Adapter->WbLinux;
- PUCHAR pBufAddress = (PUCHAR)skb->data;
- unsigned char IsStop = FALSE;
+ PADAPTER Adapter = netdev->priv;
+ PWBLINUX pWbLinux = &Adapter->WbLinux;
+ PUCHAR pBufAddress = (PUCHAR)skb->data;
+ unsigned char IsStop = FALSE;
#ifdef _PE_TX_DUMP_
- WBDEBUG(( "[w35und]wb35_start_xmit->\n" ));
- WBDEBUG(( "[w35und]skb=%x size=%d\n", skb, skb->len ));
+ WBDEBUG(( "[w35und]wb35_start_xmit->\n" ));
+ WBDEBUG(( "[w35und]skb=%x size=%d\n", skb, skb->len ));
#endif
- // Basic check ---------------------------------------------------
- if( !skb || (skb->len<(DOT_3_TYPE_OFFSET+2)) || pWbLinux->shutdown || !CURRENT_LINK_ON ||
- (
+ // Basic check ---------------------------------------------------
+ if (!skb || (skb->len<(DOT_3_TYPE_OFFSET+2)) || pWbLinux->shutdown || !CURRENT_LINK_ON ||
+ (
#ifdef _WPA2_
- CURRENT_DESIRED_WPA2_ENABLE &&
-#endif //end def _WPA2_
- CURRENT_DESIRED_WPA_ENABLE && CURRENT_CONTROL_PORT_BLOCK && (*(PUSHORT)(pBufAddress+12) != cpu_to_le16(0x8e88)) ) || \
- ((psLOCAL->RadioOffStatus.boHwRadioOff == TRUE) || (psLOCAL->RadioOffStatus.boSwRadioOff == TRUE)) )
- {
+ CURRENT_DESIRED_WPA2_ENABLE &&
+#endif
+ CURRENT_DESIRED_WPA_ENABLE && CURRENT_CONTROL_PORT_BLOCK && (*(PUSHORT)(pBufAddress+12) != cpu_to_le16(0x8e88)) ) || \
+ ((psLOCAL->RadioOffStatus.boHwRadioOff == TRUE) || (psLOCAL->RadioOffStatus.boSwRadioOff == TRUE))) {
#ifdef _PE_TX_DUMP_
- WBDEBUG(( "[w35und] wb35_start_xmit SK_BUFF IS NOT OK ! len=%d\n", skb->len ));
+ WBDEBUG(( "[w35und] wb35_start_xmit SK_BUFF IS NOT OK ! len=%d\n", skb->len ));
#endif
- dev_kfree_skb( skb );
- return 0; // Ignore this packet
- }
-
- // Check room space ---------------------------------------------
- if( pWbLinux->skb_array[ pWbLinux->skb_SetIndex ] )
- return -EBUSY;
-
- // Storing skb into skb_array and move point --------------------
- pWbLinux->skb_array[ pWbLinux->skb_SetIndex ] = skb;
- pWbLinux->skb_SetIndex++;
- pWbLinux->skb_SetIndex %= WBLINUX_PACKET_ARRAY_SIZE;
-
- // Does driver need to stop OS sending?
- if( (pWbLinux->skb_array[pWbLinux->skb_SetIndex]!=NULL) && !pWbLinux->netif_state_stop )
- {
- OS_SPIN_LOCK_ACQUIRED( &pWbLinux->SpinLock );
- if( !pWbLinux->netif_state_stop )
- {
- pWbLinux->netif_state_stop = 1;
- IsStop = TRUE;
- }
- OS_SPIN_LOCK_RELEASED( &pWbLinux->SpinLock );
-
- if( IsStop )
- {
+ dev_kfree_skb( skb );
+ return 0; // Ignore this packet
+ }
+
+ // Check room space ---------------------------------------------
+ if (pWbLinux->skb_array[pWbLinux->skb_SetIndex])
+ return -EBUSY;
+
+ // Storing skb into skb_array and move point --------------------
+ pWbLinux->skb_array[ pWbLinux->skb_SetIndex ] = skb;
+ pWbLinux->skb_SetIndex++;
+ pWbLinux->skb_SetIndex %= WBLINUX_PACKET_ARRAY_SIZE;
+
+ // Does driver need to stop OS sending?
+ if ((pWbLinux->skb_array[pWbLinux->skb_SetIndex]!=NULL) && !pWbLinux->netif_state_stop) {
+ OS_SPIN_LOCK_ACQUIRED( &pWbLinux->SpinLock );
+ if (!pWbLinux->netif_state_stop) {
+ pWbLinux->netif_state_stop = 1;
+ IsStop = TRUE;
+ }
+ OS_SPIN_LOCK_RELEASED( &pWbLinux->SpinLock );
+
+ if (IsStop) {
#ifdef _PE_TX_DUMP_
- WBDEBUG(("[w35und] tx netif stop"));
+ WBDEBUG(("[w35und] tx netif stop"));
#endif
- netif_stop_queue( netdev );
- }
- }
+ netif_stop_queue( netdev );
+ }
+ }
- // Calling Mds for sending packet --------------------
- Adapter->sLocalPara._NumTxMSDU++;
- netdev->trans_start=jiffies;
- Mds_Tx( Adapter );
+ // Calling Mds for sending packet --------------------
+ Adapter->sLocalPara._NumTxMSDU++;
+ netdev->trans_start=jiffies;
+ Mds_Tx( Adapter );
- return 0;// return 1 if asking kernel retry to send sk-buffer.
+ return 0;// return 1 if asking kernel retry to send sk-buffer.
}
void
- WBLINUX_GetNextPacket( PADAPTER Adapter, PDESCRIPTOR pDes )
+WBLINUX_GetNextPacket( PADAPTER Adapter, PDESCRIPTOR pDes )
{
PWBLINUX pWbLinux = &Adapter->WbLinux;
struct sk_buff *pSkb;
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-07 22:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-07 22:00 w35und: some more cleanups Pavel Machek
2008-04-07 22:41 Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®