* [PATCH 1/7] w35und: make functions local to mds.c static
@ 2008-10-30 17:04 Pekka Enberg
2008-10-30 17:04 ` [PATCH 2/7] w35und: make functions local to mlmetxrx.c static Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
The functions have no external references so make them static after shuffling
the code around a bit to avoid forward declarations.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/mds.c | 799 +++++++++++++++++++--------------------
drivers/staging/winbond/mds_f.h | 4 -
2 files changed, 391 insertions(+), 412 deletions(-)
diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
index a4e7300..0dd1eec 100644
--- a/drivers/staging/winbond/mds.c
+++ b/drivers/staging/winbond/mds.c
@@ -7,19 +7,6 @@
#include "wbhal_f.h"
#include "wblinux_f.h"
-void
-Mds_reset_descriptor(struct wbsoft_priv * adapter)
-{
- PMDS pMds = &adapter->Mds;
-
- pMds->TxPause = 0;
- atomic_set(&pMds->TxThreadCount, 0);
- pMds->TxFillIndex = 0;
- pMds->TxDesIndex = 0;
- pMds->ScanTxPause = 0;
- memset(pMds->TxOwner, 0, ((MAX_USB_TX_BUFFER_NUMBER + 3) & ~0x03));
-}
-
unsigned char
Mds_initial(struct wbsoft_priv * adapter)
{
@@ -40,6 +27,397 @@ Mds_Destroy(struct wbsoft_priv * adapter)
vRxTimerStop(adapter);
}
+static void Mds_DurationSet(struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *buffer)
+{
+ PT00_DESCRIPTOR pT00;
+ PT01_DESCRIPTOR pT01;
+ u16 Duration, NextBodyLen, OffsetSize;
+ u8 Rate, i;
+ unsigned char CTS_on = false, RTS_on = false;
+ PT00_DESCRIPTOR pNextT00;
+ u16 BodyLen = 0;
+ unsigned char boGroupAddr = false;
+
+ OffsetSize = pDes->FragmentThreshold + 32 + 3;
+ OffsetSize &= ~0x03;
+ Rate = pDes->TxRate >> 1;
+ if (!Rate)
+ Rate = 1;
+
+ pT00 = (PT00_DESCRIPTOR)buffer;
+ pT01 = (PT01_DESCRIPTOR)(buffer+4);
+ pNextT00 = (PT00_DESCRIPTOR)(buffer+OffsetSize);
+
+ if( buffer[ DOT_11_DA_OFFSET+8 ] & 0x1 ) // +8 for USB hdr
+ boGroupAddr = true;
+
+ //========================================
+ // Set RTS/CTS mechanism
+ //========================================
+ if (!boGroupAddr)
+ {
+ //NOTE : If the protection mode is enabled and the MSDU will be fragmented,
+ // the tx rates of MPDUs will all be DSSS rates. So it will not use
+ // CTS-to-self in this case. CTS-To-self will only be used when without
+ // fragmentation. -- 20050112
+ BodyLen = (u16)pT00->T00_frame_length; //include 802.11 header
+ BodyLen += 4; //CRC
+
+ if( BodyLen >= CURRENT_RTS_THRESHOLD )
+ RTS_on = true; // Using RTS
+ else
+ {
+ if( pT01->T01_modulation_type ) // Is using OFDM
+ {
+ if( CURRENT_PROTECT_MECHANISM ) // Is using protect
+ CTS_on = true; // Using CTS
+ }
+ }
+ }
+
+ if( RTS_on || CTS_on )
+ {
+ if( pT01->T01_modulation_type) // Is using OFDM
+ {
+ //CTS duration
+ // 2 SIFS + DATA transmit time + 1 ACK
+ // ACK Rate : 24 Mega bps
+ // ACK frame length = 14 bytes
+ Duration = 2*DEFAULT_SIFSTIME +
+ 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION +
+ ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym +
+ ((112 + 22 + 95)/96)*Tsym;
+ }
+ else //DSSS
+ {
+ //CTS duration
+ // 2 SIFS + DATA transmit time + 1 ACK
+ // Rate : ?? Mega bps
+ // ACK frame length = 14 bytes
+ if( pT01->T01_plcp_header_length ) //long preamble
+ Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME*2;
+ else
+ Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME*2;
+
+ Duration += ( ((BodyLen + 14)*8 + Rate-1) / Rate +
+ DEFAULT_SIFSTIME*2 );
+ }
+
+ if( RTS_on )
+ {
+ if( pT01->T01_modulation_type ) // Is using OFDM
+ {
+ //CTS + 1 SIFS + CTS duration
+ //CTS Rate : 24 Mega bps
+ //CTS frame length = 14 bytes
+ Duration += (DEFAULT_SIFSTIME +
+ PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION +
+ ((112 + 22 + 95)/96)*Tsym);
+ }
+ else
+ {
+ //CTS + 1 SIFS + CTS duration
+ //CTS Rate : ?? Mega bps
+ //CTS frame length = 14 bytes
+ if( pT01->T01_plcp_header_length ) //long preamble
+ Duration += LONG_PREAMBLE_PLUS_PLCPHEADER_TIME;
+ else
+ Duration += SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME;
+
+ Duration += ( ((112 + Rate-1) / Rate) + DEFAULT_SIFSTIME );
+ }
+ }
+
+ // Set the value into USB descriptor
+ pT01->T01_add_rts = RTS_on ? 1 : 0;
+ pT01->T01_add_cts = CTS_on ? 1 : 0;
+ pT01->T01_rts_cts_duration = Duration;
+ }
+
+ //=====================================
+ // Fill the more fragment descriptor
+ //=====================================
+ if( boGroupAddr )
+ Duration = 0;
+ else
+ {
+ for( i=pDes->FragmentCount-1; i>0; i-- )
+ {
+ NextBodyLen = (u16)pNextT00->T00_frame_length;
+ NextBodyLen += 4; //CRC
+
+ if( pT01->T01_modulation_type )
+ {
+ //OFDM
+ // data transmit time + 3 SIFS + 2 ACK
+ // Rate : ??Mega bps
+ // ACK frame length = 14 bytes, tx rate = 24M
+ Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION * 3;
+ Duration += (((NextBodyLen*8 + 22 + Rate*4 - 1)/(Rate*4)) * Tsym +
+ (((2*14)*8 + 22 + 95)/96)*Tsym +
+ DEFAULT_SIFSTIME*3);
+ }
+ else
+ {
+ //DSSS
+ // data transmit time + 2 ACK + 3 SIFS
+ // Rate : ??Mega bps
+ // ACK frame length = 14 bytes
+ //TODO :
+ if( pT01->T01_plcp_header_length ) //long preamble
+ Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME*3;
+ else
+ Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME*3;
+
+ Duration += ( ((NextBodyLen + (2*14))*8 + Rate-1) / Rate +
+ DEFAULT_SIFSTIME*3 );
+ }
+
+ ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
+
+ //----20061009 add by anson's endian
+ pNextT00->value = cpu_to_le32(pNextT00->value);
+ pT01->value = cpu_to_le32( pT01->value );
+ //----end 20061009 add by anson's endian
+
+ buffer += OffsetSize;
+ pT01 = (PT01_DESCRIPTOR)(buffer+4);
+ if (i != 1) //The last fragment will not have the next fragment
+ pNextT00 = (PT00_DESCRIPTOR)(buffer+OffsetSize);
+ }
+
+ //=====================================
+ // Fill the last fragment descriptor
+ //=====================================
+ if( pT01->T01_modulation_type )
+ {
+ //OFDM
+ // 1 SIFS + 1 ACK
+ // Rate : 24 Mega bps
+ // ACK frame length = 14 bytes
+ Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION;
+ //The Tx rate of ACK use 24M
+ Duration += (((112 + 22 + 95)/96)*Tsym + DEFAULT_SIFSTIME );
+ }
+ else
+ {
+ // DSSS
+ // 1 ACK + 1 SIFS
+ // Rate : ?? Mega bps
+ // ACK frame length = 14 bytes(112 bits)
+ if( pT01->T01_plcp_header_length ) //long preamble
+ Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME;
+ else
+ Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME;
+
+ Duration += ( (112 + Rate-1)/Rate + DEFAULT_SIFSTIME );
+ }
+ }
+
+ ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
+ pT00->value = cpu_to_le32(pT00->value);
+ pT01->value = cpu_to_le32(pT01->value);
+ //--end 20061009 add
+
+}
+
+// The function return the 4n size of usb pk
+static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
+{
+ PT00_DESCRIPTOR pT00;
+ PMDS pMds = &adapter->Mds;
+ u8 *buffer;
+ u8 *src_buffer;
+ u8 *pctmp;
+ u16 Size = 0;
+ u16 SizeLeft, CopySize, CopyLeft, stmp;
+ u8 buf_index, FragmentCount = 0;
+
+
+ // Copy fragment body
+ buffer = TargetBuffer; // shift 8B usb + 24B 802.11
+ SizeLeft = pDes->buffer_total_size;
+ buf_index = pDes->buffer_start_index;
+
+ pT00 = (PT00_DESCRIPTOR)buffer;
+ while (SizeLeft) {
+ pT00 = (PT00_DESCRIPTOR)buffer;
+ CopySize = SizeLeft;
+ if (SizeLeft > pDes->FragmentThreshold) {
+ CopySize = pDes->FragmentThreshold;
+ pT00->T00_frame_length = 24 + CopySize;//Set USB length
+ } else
+ pT00->T00_frame_length = 24 + SizeLeft;//Set USB length
+
+ SizeLeft -= CopySize;
+
+ // 1 Byte operation
+ pctmp = (u8 *)( buffer + 8 + DOT_11_SEQUENCE_OFFSET );
+ *pctmp &= 0xf0;
+ *pctmp |= FragmentCount;//931130.5.m
+ if( !FragmentCount )
+ pT00->T00_first_mpdu = 1;
+
+ buffer += 32; // 8B usb + 24B 802.11 header
+ Size += 32;
+
+ // Copy into buffer
+ stmp = CopySize + 3;
+ stmp &= ~0x03;//4n Alignment
+ Size += stmp;// Current 4n offset of mpdu
+
+ while (CopySize) {
+ // Copy body
+ src_buffer = pDes->buffer_address[buf_index];
+ CopyLeft = CopySize;
+ if (CopySize >= pDes->buffer_size[buf_index]) {
+ CopyLeft = pDes->buffer_size[buf_index];
+
+ // Get the next buffer of descriptor
+ buf_index++;
+ buf_index %= MAX_DESCRIPTOR_BUFFER_INDEX;
+ } else {
+ u8 *pctmp = pDes->buffer_address[buf_index];
+ pctmp += CopySize;
+ pDes->buffer_address[buf_index] = pctmp;
+ pDes->buffer_size[buf_index] -= CopySize;
+ }
+
+ memcpy(buffer, src_buffer, CopyLeft);
+ buffer += CopyLeft;
+ CopySize -= CopyLeft;
+ }
+
+ // 931130.5.n
+ if (pMds->MicAdd) {
+ if (!SizeLeft) {
+ pMds->MicWriteAddress[ pMds->MicWriteIndex ] = buffer - pMds->MicAdd;
+ pMds->MicWriteSize[ pMds->MicWriteIndex ] = pMds->MicAdd;
+ pMds->MicAdd = 0;
+ }
+ else if( SizeLeft < 8 ) //931130.5.p
+ {
+ pMds->MicAdd = SizeLeft;
+ pMds->MicWriteAddress[ pMds->MicWriteIndex ] = buffer - ( 8 - SizeLeft );
+ pMds->MicWriteSize[ pMds->MicWriteIndex ] = 8 - SizeLeft;
+ pMds->MicWriteIndex++;
+ }
+ }
+
+ // Does it need to generate the new header for next mpdu?
+ if (SizeLeft) {
+ buffer = TargetBuffer + Size; // Get the next 4n start address
+ memcpy( buffer, TargetBuffer, 32 );//Copy 8B USB +24B 802.11
+ pT00 = (PT00_DESCRIPTOR)buffer;
+ pT00->T00_first_mpdu = 0;
+ }
+
+ FragmentCount++;
+ }
+
+ pT00->T00_last_mpdu = 1;
+ pT00->T00_IsLastMpdu = 1;
+ buffer = (u8 *)pT00 + 8; // +8 for USB hdr
+ buffer[1] &= ~0x04; // Clear more frag bit of 802.11 frame control
+ pDes->FragmentCount = FragmentCount; // Update the correct fragment number
+ return Size;
+}
+
+static void Mds_HeaderCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
+{
+ PMDS pMds = &adapter->Mds;
+ u8 *src_buffer = pDes->buffer_address[0];//931130.5.g
+ PT00_DESCRIPTOR pT00;
+ PT01_DESCRIPTOR pT01;
+ u16 stmp;
+ u8 i, ctmp1, ctmp2, ctmpf;
+ u16 FragmentThreshold = CURRENT_FRAGMENT_THRESHOLD;
+
+
+ stmp = pDes->buffer_total_size;
+ //
+ // Set USB header 8 byte
+ //
+ pT00 = (PT00_DESCRIPTOR)TargetBuffer;
+ TargetBuffer += 4;
+ pT01 = (PT01_DESCRIPTOR)TargetBuffer;
+ TargetBuffer += 4;
+
+ pT00->value = 0;// Clear
+ pT01->value = 0;// Clear
+
+ pT00->T00_tx_packet_id = pDes->Descriptor_ID;// Set packet ID
+ pT00->T00_header_length = 24;// Set header length
+ pT01->T01_retry_abort_ebable = 1;//921013 931130.5.h
+
+ // Key ID setup
+ pT01->T01_wep_id = 0;
+
+ FragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; //Do not fragment
+ // Copy full data, the 1'st buffer contain all the data 931130.5.j
+ memcpy( TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE );// Copy header
+ pDes->buffer_address[0] = src_buffer + DOT_11_MAC_HEADER_SIZE;
+ pDes->buffer_total_size -= DOT_11_MAC_HEADER_SIZE;
+ pDes->buffer_size[0] = pDes->buffer_total_size;
+
+ // Set fragment threshold
+ FragmentThreshold -= (DOT_11_MAC_HEADER_SIZE + 4);
+ pDes->FragmentThreshold = FragmentThreshold;
+
+ // Set more frag bit
+ TargetBuffer[1] |= 0x04;// Set more frag bit
+
+ //
+ // Set tx rate
+ //
+ stmp = *(u16 *)(TargetBuffer+30); // 2n alignment address
+
+ //Use basic rate
+ ctmp1 = ctmpf = CURRENT_TX_RATE_FOR_MNG;
+
+ pDes->TxRate = ctmp1;
+ #ifdef _PE_TX_DUMP_
+ WBDEBUG(("Tx rate =%x\n", ctmp1));
+ #endif
+
+ pT01->T01_modulation_type = (ctmp1%3) ? 0 : 1;
+
+ for( i=0; i<2; i++ ) {
+ if( i == 1 )
+ ctmp1 = ctmpf;
+
+ pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; // backup the ta rate and fall back rate
+
+ if( ctmp1 == 108) ctmp2 = 7;
+ else if( ctmp1 == 96 ) ctmp2 = 6; // Rate convert for USB
+ else if( ctmp1 == 72 ) ctmp2 = 5;
+ else if( ctmp1 == 48 ) ctmp2 = 4;
+ else if( ctmp1 == 36 ) ctmp2 = 3;
+ else if( ctmp1 == 24 ) ctmp2 = 2;
+ else if( ctmp1 == 18 ) ctmp2 = 1;
+ else if( ctmp1 == 12 ) ctmp2 = 0;
+ else if( ctmp1 == 22 ) ctmp2 = 3;
+ else if( ctmp1 == 11 ) ctmp2 = 2;
+ else if( ctmp1 == 4 ) ctmp2 = 1;
+ else ctmp2 = 0; // if( ctmp1 == 2 ) or default
+
+ if( i == 0 )
+ pT01->T01_transmit_rate = ctmp2;
+ else
+ pT01->T01_fall_back_rate = ctmp2;
+ }
+
+ //
+ // Set preamble type
+ //
+ if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) // RATE_1M
+ pDes->PreambleMode = WLAN_PREAMBLE_TYPE_LONG;
+ else
+ pDes->PreambleMode = CURRENT_PREAMBLE_MODE;
+ pT01->T01_plcp_header_length = pDes->PreambleMode; // Set preamble
+
+}
+
void
Mds_Tx(struct wbsoft_priv * adapter)
{
@@ -234,398 +612,3 @@ Mds_SendComplete(struct wbsoft_priv * adapter, PT02_DESCRIPTOR pT02)
} else
pMds->TxResult[ PacketId ] |= ((u16)(pT02->value & 0x0ffff));
}
-
-void
-Mds_HeaderCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
-{
- PMDS pMds = &adapter->Mds;
- u8 *src_buffer = pDes->buffer_address[0];//931130.5.g
- PT00_DESCRIPTOR pT00;
- PT01_DESCRIPTOR pT01;
- u16 stmp;
- u8 i, ctmp1, ctmp2, ctmpf;
- u16 FragmentThreshold = CURRENT_FRAGMENT_THRESHOLD;
-
-
- stmp = pDes->buffer_total_size;
- //
- // Set USB header 8 byte
- //
- pT00 = (PT00_DESCRIPTOR)TargetBuffer;
- TargetBuffer += 4;
- pT01 = (PT01_DESCRIPTOR)TargetBuffer;
- TargetBuffer += 4;
-
- pT00->value = 0;// Clear
- pT01->value = 0;// Clear
-
- pT00->T00_tx_packet_id = pDes->Descriptor_ID;// Set packet ID
- pT00->T00_header_length = 24;// Set header length
- pT01->T01_retry_abort_ebable = 1;//921013 931130.5.h
-
- // Key ID setup
- pT01->T01_wep_id = 0;
-
- FragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; //Do not fragment
- // Copy full data, the 1'st buffer contain all the data 931130.5.j
- memcpy( TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE );// Copy header
- pDes->buffer_address[0] = src_buffer + DOT_11_MAC_HEADER_SIZE;
- pDes->buffer_total_size -= DOT_11_MAC_HEADER_SIZE;
- pDes->buffer_size[0] = pDes->buffer_total_size;
-
- // Set fragment threshold
- FragmentThreshold -= (DOT_11_MAC_HEADER_SIZE + 4);
- pDes->FragmentThreshold = FragmentThreshold;
-
- // Set more frag bit
- TargetBuffer[1] |= 0x04;// Set more frag bit
-
- //
- // Set tx rate
- //
- stmp = *(u16 *)(TargetBuffer+30); // 2n alignment address
-
- //Use basic rate
- ctmp1 = ctmpf = CURRENT_TX_RATE_FOR_MNG;
-
- pDes->TxRate = ctmp1;
- #ifdef _PE_TX_DUMP_
- WBDEBUG(("Tx rate =%x\n", ctmp1));
- #endif
-
- pT01->T01_modulation_type = (ctmp1%3) ? 0 : 1;
-
- for( i=0; i<2; i++ ) {
- if( i == 1 )
- ctmp1 = ctmpf;
-
- pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; // backup the ta rate and fall back rate
-
- if( ctmp1 == 108) ctmp2 = 7;
- else if( ctmp1 == 96 ) ctmp2 = 6; // Rate convert for USB
- else if( ctmp1 == 72 ) ctmp2 = 5;
- else if( ctmp1 == 48 ) ctmp2 = 4;
- else if( ctmp1 == 36 ) ctmp2 = 3;
- else if( ctmp1 == 24 ) ctmp2 = 2;
- else if( ctmp1 == 18 ) ctmp2 = 1;
- else if( ctmp1 == 12 ) ctmp2 = 0;
- else if( ctmp1 == 22 ) ctmp2 = 3;
- else if( ctmp1 == 11 ) ctmp2 = 2;
- else if( ctmp1 == 4 ) ctmp2 = 1;
- else ctmp2 = 0; // if( ctmp1 == 2 ) or default
-
- if( i == 0 )
- pT01->T01_transmit_rate = ctmp2;
- else
- pT01->T01_fall_back_rate = ctmp2;
- }
-
- //
- // Set preamble type
- //
- if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) // RATE_1M
- pDes->PreambleMode = WLAN_PREAMBLE_TYPE_LONG;
- else
- pDes->PreambleMode = CURRENT_PREAMBLE_MODE;
- pT01->T01_plcp_header_length = pDes->PreambleMode; // Set preamble
-
-}
-
-// The function return the 4n size of usb pk
-u16
-Mds_BodyCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
-{
- PT00_DESCRIPTOR pT00;
- PMDS pMds = &adapter->Mds;
- u8 *buffer;
- u8 *src_buffer;
- u8 *pctmp;
- u16 Size = 0;
- u16 SizeLeft, CopySize, CopyLeft, stmp;
- u8 buf_index, FragmentCount = 0;
-
-
- // Copy fragment body
- buffer = TargetBuffer; // shift 8B usb + 24B 802.11
- SizeLeft = pDes->buffer_total_size;
- buf_index = pDes->buffer_start_index;
-
- pT00 = (PT00_DESCRIPTOR)buffer;
- while (SizeLeft) {
- pT00 = (PT00_DESCRIPTOR)buffer;
- CopySize = SizeLeft;
- if (SizeLeft > pDes->FragmentThreshold) {
- CopySize = pDes->FragmentThreshold;
- pT00->T00_frame_length = 24 + CopySize;//Set USB length
- } else
- pT00->T00_frame_length = 24 + SizeLeft;//Set USB length
-
- SizeLeft -= CopySize;
-
- // 1 Byte operation
- pctmp = (u8 *)( buffer + 8 + DOT_11_SEQUENCE_OFFSET );
- *pctmp &= 0xf0;
- *pctmp |= FragmentCount;//931130.5.m
- if( !FragmentCount )
- pT00->T00_first_mpdu = 1;
-
- buffer += 32; // 8B usb + 24B 802.11 header
- Size += 32;
-
- // Copy into buffer
- stmp = CopySize + 3;
- stmp &= ~0x03;//4n Alignment
- Size += stmp;// Current 4n offset of mpdu
-
- while (CopySize) {
- // Copy body
- src_buffer = pDes->buffer_address[buf_index];
- CopyLeft = CopySize;
- if (CopySize >= pDes->buffer_size[buf_index]) {
- CopyLeft = pDes->buffer_size[buf_index];
-
- // Get the next buffer of descriptor
- buf_index++;
- buf_index %= MAX_DESCRIPTOR_BUFFER_INDEX;
- } else {
- u8 *pctmp = pDes->buffer_address[buf_index];
- pctmp += CopySize;
- pDes->buffer_address[buf_index] = pctmp;
- pDes->buffer_size[buf_index] -= CopySize;
- }
-
- memcpy(buffer, src_buffer, CopyLeft);
- buffer += CopyLeft;
- CopySize -= CopyLeft;
- }
-
- // 931130.5.n
- if (pMds->MicAdd) {
- if (!SizeLeft) {
- pMds->MicWriteAddress[ pMds->MicWriteIndex ] = buffer - pMds->MicAdd;
- pMds->MicWriteSize[ pMds->MicWriteIndex ] = pMds->MicAdd;
- pMds->MicAdd = 0;
- }
- else if( SizeLeft < 8 ) //931130.5.p
- {
- pMds->MicAdd = SizeLeft;
- pMds->MicWriteAddress[ pMds->MicWriteIndex ] = buffer - ( 8 - SizeLeft );
- pMds->MicWriteSize[ pMds->MicWriteIndex ] = 8 - SizeLeft;
- pMds->MicWriteIndex++;
- }
- }
-
- // Does it need to generate the new header for next mpdu?
- if (SizeLeft) {
- buffer = TargetBuffer + Size; // Get the next 4n start address
- memcpy( buffer, TargetBuffer, 32 );//Copy 8B USB +24B 802.11
- pT00 = (PT00_DESCRIPTOR)buffer;
- pT00->T00_first_mpdu = 0;
- }
-
- FragmentCount++;
- }
-
- pT00->T00_last_mpdu = 1;
- pT00->T00_IsLastMpdu = 1;
- buffer = (u8 *)pT00 + 8; // +8 for USB hdr
- buffer[1] &= ~0x04; // Clear more frag bit of 802.11 frame control
- pDes->FragmentCount = FragmentCount; // Update the correct fragment number
- return Size;
-}
-
-
-void
-Mds_DurationSet( struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *buffer )
-{
- PT00_DESCRIPTOR pT00;
- PT01_DESCRIPTOR pT01;
- u16 Duration, NextBodyLen, OffsetSize;
- u8 Rate, i;
- unsigned char CTS_on = false, RTS_on = false;
- PT00_DESCRIPTOR pNextT00;
- u16 BodyLen = 0;
- unsigned char boGroupAddr = false;
-
- OffsetSize = pDes->FragmentThreshold + 32 + 3;
- OffsetSize &= ~0x03;
- Rate = pDes->TxRate >> 1;
- if (!Rate)
- Rate = 1;
-
- pT00 = (PT00_DESCRIPTOR)buffer;
- pT01 = (PT01_DESCRIPTOR)(buffer+4);
- pNextT00 = (PT00_DESCRIPTOR)(buffer+OffsetSize);
-
- if( buffer[ DOT_11_DA_OFFSET+8 ] & 0x1 ) // +8 for USB hdr
- boGroupAddr = true;
-
- //========================================
- // Set RTS/CTS mechanism
- //========================================
- if (!boGroupAddr)
- {
- //NOTE : If the protection mode is enabled and the MSDU will be fragmented,
- // the tx rates of MPDUs will all be DSSS rates. So it will not use
- // CTS-to-self in this case. CTS-To-self will only be used when without
- // fragmentation. -- 20050112
- BodyLen = (u16)pT00->T00_frame_length; //include 802.11 header
- BodyLen += 4; //CRC
-
- if( BodyLen >= CURRENT_RTS_THRESHOLD )
- RTS_on = true; // Using RTS
- else
- {
- if( pT01->T01_modulation_type ) // Is using OFDM
- {
- if( CURRENT_PROTECT_MECHANISM ) // Is using protect
- CTS_on = true; // Using CTS
- }
- }
- }
-
- if( RTS_on || CTS_on )
- {
- if( pT01->T01_modulation_type) // Is using OFDM
- {
- //CTS duration
- // 2 SIFS + DATA transmit time + 1 ACK
- // ACK Rate : 24 Mega bps
- // ACK frame length = 14 bytes
- Duration = 2*DEFAULT_SIFSTIME +
- 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION +
- ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym +
- ((112 + 22 + 95)/96)*Tsym;
- }
- else //DSSS
- {
- //CTS duration
- // 2 SIFS + DATA transmit time + 1 ACK
- // Rate : ?? Mega bps
- // ACK frame length = 14 bytes
- if( pT01->T01_plcp_header_length ) //long preamble
- Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME*2;
- else
- Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME*2;
-
- Duration += ( ((BodyLen + 14)*8 + Rate-1) / Rate +
- DEFAULT_SIFSTIME*2 );
- }
-
- if( RTS_on )
- {
- if( pT01->T01_modulation_type ) // Is using OFDM
- {
- //CTS + 1 SIFS + CTS duration
- //CTS Rate : 24 Mega bps
- //CTS frame length = 14 bytes
- Duration += (DEFAULT_SIFSTIME +
- PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION +
- ((112 + 22 + 95)/96)*Tsym);
- }
- else
- {
- //CTS + 1 SIFS + CTS duration
- //CTS Rate : ?? Mega bps
- //CTS frame length = 14 bytes
- if( pT01->T01_plcp_header_length ) //long preamble
- Duration += LONG_PREAMBLE_PLUS_PLCPHEADER_TIME;
- else
- Duration += SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME;
-
- Duration += ( ((112 + Rate-1) / Rate) + DEFAULT_SIFSTIME );
- }
- }
-
- // Set the value into USB descriptor
- pT01->T01_add_rts = RTS_on ? 1 : 0;
- pT01->T01_add_cts = CTS_on ? 1 : 0;
- pT01->T01_rts_cts_duration = Duration;
- }
-
- //=====================================
- // Fill the more fragment descriptor
- //=====================================
- if( boGroupAddr )
- Duration = 0;
- else
- {
- for( i=pDes->FragmentCount-1; i>0; i-- )
- {
- NextBodyLen = (u16)pNextT00->T00_frame_length;
- NextBodyLen += 4; //CRC
-
- if( pT01->T01_modulation_type )
- {
- //OFDM
- // data transmit time + 3 SIFS + 2 ACK
- // Rate : ??Mega bps
- // ACK frame length = 14 bytes, tx rate = 24M
- Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION * 3;
- Duration += (((NextBodyLen*8 + 22 + Rate*4 - 1)/(Rate*4)) * Tsym +
- (((2*14)*8 + 22 + 95)/96)*Tsym +
- DEFAULT_SIFSTIME*3);
- }
- else
- {
- //DSSS
- // data transmit time + 2 ACK + 3 SIFS
- // Rate : ??Mega bps
- // ACK frame length = 14 bytes
- //TODO :
- if( pT01->T01_plcp_header_length ) //long preamble
- Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME*3;
- else
- Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME*3;
-
- Duration += ( ((NextBodyLen + (2*14))*8 + Rate-1) / Rate +
- DEFAULT_SIFSTIME*3 );
- }
-
- ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
-
- //----20061009 add by anson's endian
- pNextT00->value = cpu_to_le32(pNextT00->value);
- pT01->value = cpu_to_le32( pT01->value );
- //----end 20061009 add by anson's endian
-
- buffer += OffsetSize;
- pT01 = (PT01_DESCRIPTOR)(buffer+4);
- if (i != 1) //The last fragment will not have the next fragment
- pNextT00 = (PT00_DESCRIPTOR)(buffer+OffsetSize);
- }
-
- //=====================================
- // Fill the last fragment descriptor
- //=====================================
- if( pT01->T01_modulation_type )
- {
- //OFDM
- // 1 SIFS + 1 ACK
- // Rate : 24 Mega bps
- // ACK frame length = 14 bytes
- Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION;
- //The Tx rate of ACK use 24M
- Duration += (((112 + 22 + 95)/96)*Tsym + DEFAULT_SIFSTIME );
- }
- else
- {
- // DSSS
- // 1 ACK + 1 SIFS
- // Rate : ?? Mega bps
- // ACK frame length = 14 bytes(112 bits)
- if( pT01->T01_plcp_header_length ) //long preamble
- Duration = LONG_PREAMBLE_PLUS_PLCPHEADER_TIME;
- else
- Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME;
-
- Duration += ( (112 + Rate-1)/Rate + DEFAULT_SIFSTIME );
- }
- }
-
- ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
- pT00->value = cpu_to_le32(pT00->value);
- pT01->value = cpu_to_le32(pT01->value);
- //--end 20061009 add
-
-}
diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h
index a3724ac..8109eba 100644
--- a/drivers/staging/winbond/mds_f.h
+++ b/drivers/staging/winbond/mds_f.h
@@ -7,12 +7,8 @@
unsigned char Mds_initial( struct wbsoft_priv *adapter );
void Mds_Destroy( struct wbsoft_priv *adapter );
void Mds_Tx( struct wbsoft_priv *adapter );
-void Mds_HeaderCopy( struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *TargetBuffer );
-u16 Mds_BodyCopy( struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *TargetBuffer );
-void Mds_DurationSet( struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *TargetBuffer );
void Mds_SendComplete( struct wbsoft_priv *adapter, PT02_DESCRIPTOR pT02 );
void Mds_MpduProcess( struct wbsoft_priv *adapter, PDESCRIPTOR pRxDes );
-void Mds_reset_descriptor( struct wbsoft_priv *adapter );
extern void DataDmp(u8 *pdata, u32 len, u32 offset);
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/7] w35und: make functions local to mlmetxrx.c static
2008-10-30 17:04 [PATCH 1/7] w35und: make functions local to mds.c static Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 17:04 ` [PATCH 3/7] w35und: remove dead code from mto.c Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
Convert functions that don't have external references to static and remove the
ones that are not used at all.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/mlmetxrx.c | 55 +---------------------------------
drivers/staging/winbond/mlmetxrx_f.h | 9 -----
2 files changed, 1 insertions(+), 63 deletions(-)
diff --git a/drivers/staging/winbond/mlmetxrx.c b/drivers/staging/winbond/mlmetxrx.c
index d83795f..643ceb0 100644
--- a/drivers/staging/winbond/mlmetxrx.c
+++ b/drivers/staging/winbond/mlmetxrx.c
@@ -19,59 +19,6 @@
#include "mds_f.h"
-void MLMEResetTxRx(struct wbsoft_priv * adapter)
-{
- s32 i;
-
- // Reset the interface between MDS and MLME
- for (i = 0; i < MAX_NUM_TX_MMPDU; i++)
- adapter->sMlmeFrame.TxMMPDUInUse[i] = false;
- for (i = 0; i < MAX_NUM_RX_MMPDU; i++)
- adapter->sMlmeFrame.SaveRxBufSlotInUse[i] = false;
-
- adapter->sMlmeFrame.wNumRxMMPDUInMLME = 0;
- adapter->sMlmeFrame.wNumRxMMPDUDiscarded = 0;
- adapter->sMlmeFrame.wNumRxMMPDU = 0;
- adapter->sMlmeFrame.wNumTxMMPDUDiscarded = 0;
- adapter->sMlmeFrame.wNumTxMMPDU = 0;
- adapter->sLocalPara.boCCAbusy = false;
- adapter->sLocalPara.iPowerSaveMode = PWR_ACTIVE; // Power active
-}
-
-//=============================================================================
-// Function:
-// MLMEGetMMPDUBuffer()
-//
-// Description:
-// Return the pointer to an available data buffer with
-// the size MAX_MMPDU_SIZE for a MMPDU.
-//
-// Arguments:
-// adapter - pointer to the miniport adapter context.
-//
-// Return value:
-// NULL : No available data buffer available
-// Otherwise: Pointer to the data buffer
-//=============================================================================
-
-/* FIXME: Should this just be replaced with kmalloc() and kfree()? */
-u8 *MLMEGetMMPDUBuffer(struct wbsoft_priv * adapter)
-{
- s32 i;
- u8 *returnVal;
-
- for (i = 0; i< MAX_NUM_TX_MMPDU; i++) {
- if (adapter->sMlmeFrame.TxMMPDUInUse[i] == false)
- break;
- }
- if (i >= MAX_NUM_TX_MMPDU) return NULL;
-
- returnVal = (u8 *)&(adapter->sMlmeFrame.TxMMPDU[i]);
- adapter->sMlmeFrame.TxMMPDUInUse[i] = true;
-
- return returnVal;
-}
-
//=============================================================================
u8 MLMESendFrame(struct wbsoft_priv * adapter, u8 *pMMPDU, u16 len, u8 DataType)
/* DataType : FRAME_TYPE_802_11_MANAGEMENT, FRAME_TYPE_802_11_MANAGEMENT_CHALLENGE,
@@ -109,7 +56,7 @@ void MLME_GetNextPacket(struct wbsoft_priv *adapter, PDESCRIPTOR desc)
desc->Type = adapter->sMlmeFrame.DataType;
}
-void MLMEfreeMMPDUBuffer(struct wbsoft_priv * adapter, s8 *pData)
+static void MLMEfreeMMPDUBuffer(struct wbsoft_priv *adapter, s8 *pData)
{
int i;
diff --git a/drivers/staging/winbond/mlmetxrx_f.h b/drivers/staging/winbond/mlmetxrx_f.h
index 905c301..5f05a6e 100644
--- a/drivers/staging/winbond/mlmetxrx_f.h
+++ b/drivers/staging/winbond/mlmetxrx_f.h
@@ -15,15 +15,6 @@ MLMEProcThread(
struct wbsoft_priv * adapter
);
-void MLMEResetTxRx( struct wbsoft_priv * adapter);
-
-u8 *
-MLMEGetMMPDUBuffer(
- struct wbsoft_priv * adapter
- );
-
-void MLMEfreeMMPDUBuffer( struct wbsoft_priv * adapter, s8 * pData);
-
void MLME_GetNextPacket( struct wbsoft_priv * adapter, PDESCRIPTOR pDes );
u8 MLMESendFrame( struct wbsoft_priv * adapter,
u8 *pMMPDU,
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/7] w35und: remove dead code from mto.c
2008-10-30 17:04 ` [PATCH 2/7] w35und: make functions local to mlmetxrx.c static Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 17:04 ` [PATCH 4/7] w35und: make functions local to wb35rx.c static Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
Remove lots of code that's never used.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/mto.c | 653 +----------------------------------------
drivers/staging/winbond/mto.h | 2 -
2 files changed, 2 insertions(+), 653 deletions(-)
diff --git a/drivers/staging/winbond/mto.c b/drivers/staging/winbond/mto.c
index 22bd603..c9fd113 100644
--- a/drivers/staging/winbond/mto.c
+++ b/drivers/staging/winbond/mto.c
@@ -29,189 +29,17 @@
// Declare SQ3 to rate and fragmentation threshold table
// Declare fragmentation thresholds table
-#define MTO_MAX_SQ3_LEVELS 14
-#define MTO_MAX_FRAG_TH_LEVELS 5
#define MTO_MAX_DATA_RATE_LEVELS 12
-u16 MTO_Frag_Th_Tbl[MTO_MAX_FRAG_TH_LEVELS] =
-{
- 256, 384, 512, 768, 1536
-};
-
-u8 MTO_SQ3_Level[MTO_MAX_SQ3_LEVELS] =
-{
- 0, 26, 30, 32, 34, 35, 37, 42, 44, 46, 54, 62, 78, 81
-};
-u8 MTO_SQ3toRate[MTO_MAX_SQ3_LEVELS] =
-{
- 0, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
-};
-u8 MTO_SQ3toFrag[MTO_MAX_SQ3_LEVELS] =
-{
- 0, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4
-};
-
-// One Exchange Time table
-//
-u16 MTO_One_Exchange_Time_Tbl_l[MTO_MAX_FRAG_TH_LEVELS][MTO_MAX_DATA_RATE_LEVELS] =
-{
- { 2554, 1474, 822, 0, 0, 636, 0, 0, 0, 0, 0, 0},
- { 3578, 1986, 1009, 0, 0, 729, 0, 0, 0, 0, 0, 0},
- { 4602, 2498, 1195, 0, 0, 822, 0, 0, 0, 0, 0, 0},
- { 6650, 3522, 1567, 0, 0, 1009, 0, 0, 0, 0, 0, 0},
- {12794, 6594, 2684, 0, 0, 1567, 0, 0, 0, 0, 0, 0}
-};
-
-u16 MTO_One_Exchange_Time_Tbl_s[MTO_MAX_FRAG_TH_LEVELS][MTO_MAX_DATA_RATE_LEVELS] =
-{
- { 0, 1282, 630, 404, 288, 444, 232, 172, 144, 116, 100, 96},
- { 0, 1794, 817, 572, 400, 537, 316, 228, 188, 144, 124, 116},
- { 0, 2306, 1003, 744, 516, 630, 400, 288, 228, 172, 144, 136},
- { 0, 3330, 1375, 1084, 744, 817, 572, 400, 316, 228, 188, 172},
- { 0, 6402, 2492, 2108, 1424, 1375, 1084, 740, 572, 400, 316, 284}
-};
-
-#define MTO_ONE_EXCHANGE_TIME(preamble_type, frag_th_lvl, data_rate_lvl) \
- (preamble_type) ? MTO_One_Exchange_Time_Tbl_s[frag_th_lvl][data_rate_lvl] : \
- MTO_One_Exchange_Time_Tbl_l[frag_th_lvl][data_rate_lvl]
-
// Declare data rate table
//The following table will be changed at anytime if the opration rate supported by AP don't
//match the table
-u8 MTO_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] =
-{
+static u8 MTO_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] = {
2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108
};
-//The Stardard_Data_Rate_Tbl and Level2PerTbl table is used to indirectly retreive PER
-//information from Rate_PER_TBL
-//The default settings is AP can support full rate set.
-static u8 Stardard_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] =
-{
- 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108
-};
-static u8 Level2PerTbl[MTO_MAX_DATA_RATE_LEVELS] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
-};
-//How many kind of tx rate can be supported by AP
-//DTO will change Rate between MTO_Data_Rate_Tbl[0] and MTO_Data_Rate_Tbl[MTO_DataRateAvailableLevel-1]
-static u8 MTO_DataRateAvailableLevel = MTO_MAX_DATA_RATE_LEVELS;
-//Smoothed PER table for each different RATE based on packet length of 1514
-static int Rate_PER_TBL[91][MTO_MAX_DATA_RATE_LEVELS] = {
-// 1M 2M 5.5M 11M 6M 9M 12M 18M 24M 36M 48M 54M
-/* 0% */{ 93, 177, 420, 538, 690, 774, 1001, 1401, 1768, 2358, 2838, 3039},
-/* 1% */{ 92, 176, 416, 533, 683, 767, 992, 1389, 1752, 2336, 2811, 3010},
-/* 2% */{ 91, 174, 412, 528, 675, 760, 983, 1376, 1735, 2313, 2783, 2979},
-/* 3% */{ 90, 172, 407, 523, 667, 753, 973, 1363, 1719, 2290, 2755, 2948},
-/* 4% */{ 90, 170, 403, 518, 659, 746, 964, 1350, 1701, 2266, 2726, 2916},
-/* 5% */{ 89, 169, 398, 512, 651, 738, 954, 1336, 1684, 2242, 2696, 2884},
-/* 6% */{ 88, 167, 394, 507, 643, 731, 944, 1322, 1666, 2217, 2665, 2851},
-/* 7% */{ 87, 165, 389, 502, 635, 723, 935, 1308, 1648, 2192, 2634, 2817},
-/* 8% */{ 86, 163, 384, 497, 626, 716, 924, 1294, 1629, 2166, 2602, 2782},
-/* 9% */{ 85, 161, 380, 491, 618, 708, 914, 1279, 1611, 2140, 2570, 2747},
-/* 10% */{ 84, 160, 375, 486, 609, 700, 904, 1265, 1591, 2113, 2537, 2711},
-/* 11% */{ 83, 158, 370, 480, 600, 692, 894, 1250, 1572, 2086, 2503, 2675},
-/* 12% */{ 82, 156, 365, 475, 592, 684, 883, 1234, 1552, 2059, 2469, 2638},
-/* 13% */{ 81, 154, 360, 469, 583, 676, 872, 1219, 1532, 2031, 2435, 2600},
-/* 14% */{ 80, 152, 355, 464, 574, 668, 862, 1204, 1512, 2003, 2400, 2562},
-/* 15% */{ 79, 150, 350, 458, 565, 660, 851, 1188, 1492, 1974, 2365, 2524},
-/* 16% */{ 78, 148, 345, 453, 556, 652, 840, 1172, 1471, 1945, 2329, 2485},
-/* 17% */{ 77, 146, 340, 447, 547, 643, 829, 1156, 1450, 1916, 2293, 2446},
-/* 18% */{ 76, 144, 335, 441, 538, 635, 818, 1140, 1429, 1887, 2256, 2406},
-/* 19% */{ 75, 143, 330, 436, 529, 627, 807, 1124, 1408, 1857, 2219, 2366},
-/* 20% */{ 74, 141, 325, 430, 520, 618, 795, 1107, 1386, 1827, 2182, 2326},
-/* 21% */{ 73, 139, 320, 424, 510, 610, 784, 1091, 1365, 1797, 2145, 2285},
-/* 22% */{ 72, 137, 314, 418, 501, 601, 772, 1074, 1343, 1766, 2107, 2244},
-/* 23% */{ 71, 135, 309, 412, 492, 592, 761, 1057, 1321, 1736, 2069, 2203},
-/* 24% */{ 70, 133, 304, 407, 482, 584, 749, 1040, 1299, 1705, 2031, 2161},
-/* 25% */{ 69, 131, 299, 401, 473, 575, 738, 1023, 1277, 1674, 1992, 2120},
-/* 26% */{ 68, 129, 293, 395, 464, 566, 726, 1006, 1254, 1642, 1953, 2078},
-/* 27% */{ 67, 127, 288, 389, 454, 557, 714, 989, 1232, 1611, 1915, 2035},
-/* 28% */{ 66, 125, 283, 383, 445, 549, 703, 972, 1209, 1579, 1876, 1993},
-/* 29% */{ 65, 123, 278, 377, 436, 540, 691, 955, 1187, 1548, 1836, 1951},
-/* 30% */{ 64, 121, 272, 371, 426, 531, 679, 937, 1164, 1516, 1797, 1908},
-/* 31% */{ 63, 119, 267, 365, 417, 522, 667, 920, 1141, 1484, 1758, 1866},
-/* 32% */{ 62, 117, 262, 359, 407, 513, 655, 902, 1118, 1453, 1719, 1823},
-/* 33% */{ 61, 115, 256, 353, 398, 504, 643, 885, 1095, 1421, 1679, 1781},
-/* 34% */{ 60, 113, 251, 347, 389, 495, 631, 867, 1072, 1389, 1640, 1738},
-/* 35% */{ 59, 111, 246, 341, 379, 486, 619, 850, 1049, 1357, 1600, 1695},
-/* 36% */{ 58, 108, 240, 335, 370, 477, 607, 832, 1027, 1325, 1561, 1653},
-/* 37% */{ 57, 106, 235, 329, 361, 468, 595, 815, 1004, 1293, 1522, 1610},
-/* 38% */{ 56, 104, 230, 323, 351, 459, 584, 797, 981, 1261, 1483, 1568},
-/* 39% */{ 55, 102, 224, 317, 342, 450, 572, 780, 958, 1230, 1443, 1526},
-/* 40% */{ 54, 100, 219, 311, 333, 441, 560, 762, 935, 1198, 1404, 1484},
-/* 41% */{ 53, 98, 214, 305, 324, 432, 548, 744, 912, 1166, 1366, 1442},
-/* 42% */{ 52, 96, 209, 299, 315, 423, 536, 727, 889, 1135, 1327, 1400},
-/* 43% */{ 51, 94, 203, 293, 306, 414, 524, 709, 866, 1104, 1289, 1358},
-/* 44% */{ 50, 92, 198, 287, 297, 405, 512, 692, 844, 1072, 1250, 1317},
-/* 45% */{ 49, 90, 193, 281, 288, 396, 500, 675, 821, 1041, 1212, 1276},
-/* 46% */{ 48, 88, 188, 275, 279, 387, 488, 657, 799, 1011, 1174, 1236},
-/* 47% */{ 47, 86, 183, 269, 271, 378, 476, 640, 777, 980, 1137, 1195},
-/* 48% */{ 46, 84, 178, 262, 262, 369, 464, 623, 754, 949, 1100, 1155},
-/* 49% */{ 45, 82, 173, 256, 254, 360, 452, 606, 732, 919, 1063, 1116},
-/* 50% */{ 44, 80, 168, 251, 245, 351, 441, 589, 710, 889, 1026, 1076},
-/* 51% */{ 43, 78, 163, 245, 237, 342, 429, 572, 689, 860, 990, 1038},
-/* 52% */{ 42, 76, 158, 239, 228, 333, 417, 555, 667, 830, 955, 999},
-/* 53% */{ 41, 74, 153, 233, 220, 324, 406, 538, 645, 801, 919, 961},
-/* 54% */{ 40, 72, 148, 227, 212, 315, 394, 522, 624, 773, 884, 924},
-/* 55% */{ 39, 70, 143, 221, 204, 307, 383, 505, 603, 744, 850, 887},
-/* 56% */{ 38, 68, 138, 215, 196, 298, 371, 489, 582, 716, 816, 851},
-/* 57% */{ 37, 67, 134, 209, 189, 289, 360, 473, 562, 688, 783, 815},
-/* 58% */{ 36, 65, 129, 203, 181, 281, 349, 457, 541, 661, 750, 780},
-/* 59% */{ 35, 63, 124, 197, 174, 272, 338, 441, 521, 634, 717, 745},
-/* 60% */{ 34, 61, 120, 192, 166, 264, 327, 425, 501, 608, 686, 712},
-/* 61% */{ 33, 59, 115, 186, 159, 255, 316, 409, 482, 582, 655, 678},
-/* 62% */{ 32, 57, 111, 180, 152, 247, 305, 394, 462, 556, 624, 646},
-/* 63% */{ 31, 55, 107, 174, 145, 238, 294, 379, 443, 531, 594, 614},
-/* 64% */{ 30, 53, 102, 169, 138, 230, 283, 364, 425, 506, 565, 583},
-/* 65% */{ 29, 52, 98, 163, 132, 222, 273, 349, 406, 482, 536, 553},
-/* 66% */{ 28, 50, 94, 158, 125, 214, 262, 334, 388, 459, 508, 523},
-/* 67% */{ 27, 48, 90, 152, 119, 206, 252, 320, 370, 436, 481, 495},
-/* 68% */{ 26, 46, 86, 147, 113, 198, 242, 306, 353, 413, 455, 467},
-/* 69% */{ 26, 44, 82, 141, 107, 190, 231, 292, 336, 391, 429, 440},
-/* 70% */{ 25, 43, 78, 136, 101, 182, 221, 278, 319, 370, 405, 414},
-/* 71% */{ 24, 41, 74, 130, 95, 174, 212, 265, 303, 350, 381, 389},
-/* 72% */{ 23, 39, 71, 125, 90, 167, 202, 252, 287, 329, 358, 365},
-/* 73% */{ 22, 37, 67, 119, 85, 159, 192, 239, 271, 310, 335, 342},
-/* 74% */{ 21, 36, 63, 114, 80, 151, 183, 226, 256, 291, 314, 320},
-/* 75% */{ 20, 34, 60, 109, 75, 144, 174, 214, 241, 273, 294, 298},
-/* 76% */{ 19, 32, 57, 104, 70, 137, 164, 202, 227, 256, 274, 278},
-/* 77% */{ 18, 31, 53, 99, 66, 130, 155, 190, 213, 239, 256, 259},
-/* 78% */{ 17, 29, 50, 94, 62, 122, 146, 178, 200, 223, 238, 241},
-/* 79% */{ 16, 28, 47, 89, 58, 115, 138, 167, 187, 208, 222, 225},
-/* 80% */{ 16, 26, 44, 84, 54, 109, 129, 156, 175, 194, 206, 209},
-/* 81% */{ 15, 24, 41, 79, 50, 102, 121, 146, 163, 180, 192, 194},
-/* 82% */{ 14, 23, 39, 74, 47, 95, 113, 136, 151, 167, 178, 181},
-/* 83% */{ 13, 21, 36, 69, 44, 89, 105, 126, 140, 155, 166, 169},
-/* 84% */{ 12, 20, 33, 64, 41, 82, 97, 116, 130, 144, 155, 158},
-/* 85% */{ 11, 19, 31, 60, 39, 76, 89, 107, 120, 134, 145, 149},
-/* 86% */{ 11, 17, 29, 55, 36, 70, 82, 98, 110, 125, 136, 140},
-/* 87% */{ 10, 16, 26, 51, 34, 64, 75, 90, 102, 116, 128, 133},
-/* 88% */{ 9, 14, 24, 46, 32, 58, 68, 81, 93, 108, 121, 128},
-/* 89% */{ 8, 13, 22, 42, 31, 52, 61, 74, 86, 102, 116, 124},
-/* 90% */{ 7, 12, 21, 37, 29, 46, 54, 66, 79, 96, 112, 121}
-};
-
-#define RSSIBUF_NUM 10
-#define RSSI2RATE_SIZE 9
-
-static TXRETRY_REC TxRateRec={MTO_MAX_DATA_RATE_LEVELS - 1, 0}; //new record=>TxRateRec
-static int TxRetryRate;
-//static int SQ3, BSS_PK_CNT, NIDLESLOT, SLOT_CNT, INTERF_CNT, GAP_CNT, DS_EVM;
-static s32 RSSIBuf[RSSIBUF_NUM]={-70, -70, -70, -70, -70, -70, -70, -70, -70, -70};
-static s32 RSSISmoothed=-700;
-static int RSSIBufIndex=0;
-static u8 max_rssi_rate;
-static int rate_tbl[13] = {0,1,2,5,11,6,9,12,18,24,36,48,54};
-//[WKCHEN]static core_data_t *pMTOcore_data=NULL;
-
static int TotalTxPkt = 0;
static int TotalTxPktRetry = 0;
-static int TxPktPerAnt[3] = {0,0,0};
-static int TxPktRetryPerAnt[3] = {0,0,0};
-//static int TxDominateFlag=false;
-static u8 old_antenna[4]={1 ,0 ,1 ,0};
static int retryrate_rec[MTO_MAX_DATA_RATE_LEVELS];//this record the retry rate at different data rate
static int PeriodTotalTxPkt = 0;
@@ -223,123 +51,14 @@ typedef struct
u8 TxRate;
}RSSI2RATE;
-static RSSI2RATE RSSI2RateTbl[RSSI2RATE_SIZE] =
-{
- {-740, 108}, // 54M
- {-760, 96}, // 48M
- {-820, 72}, // 36M
- {-850, 48}, // 24M
- {-870, 36}, // 18M
- {-890, 24}, // 12M
- {-900, 12}, // 6M
- {-920, 11}, // 5.5M
- {-950, 4}, // 2M
-};
-static u8 last_rate_ant; //this is used for antenna backoff-hh
-
-u8 boSparseTxTraffic = false;
+static u8 boSparseTxTraffic = false;
void MTO_Init(MTO_FUNC_INPUT);
-void GetFreshAntennaData(MTO_FUNC_INPUT);
void TxRateReductionCtrl(MTO_FUNC_INPUT);
/** 1.1.31.1000 Turbo modify */
-//void MTO_SetDTORateRange(int type);
-void MTO_SetDTORateRange(MTO_FUNC_INPUT, u8 *pRateArray, u8 ArraySize);
void MTO_SetTxCount(MTO_FUNC_INPUT, u8 t0, u8 index);
void MTO_TxFailed(MTO_FUNC_INPUT);
-void SmoothRSSI(s32 new_rssi);
void hal_get_dto_para(MTO_FUNC_INPUT, char *buffer);
-u8 CalcNewRate(MTO_FUNC_INPUT, u8 old_rate, u32 retry_cnt, u32 tx_frag_cnt);
-u8 GetMaxRateLevelFromRSSI(void);
-u8 MTO_GetTxFallbackRate(MTO_FUNC_INPUT);
-int Divide(int a, int b);
-
-//===========================================================================
-// MTO_Init --
-//
-// Description:
-// Set DTO Tx Rate Scope because different AP could have different Rate set.
-// After our staion join with AP, LM core will call this function to initialize
-// Tx Rate table.
-//
-// Arguments:
-// pRateArray - The pointer to the Tx Rate Array by the following order
-// - 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108
-// - DTO won't check whether rate order is invalid or not
-// ArraySize - The array size to indicate how many tx rate we can choose
-//
-// sample code:
-// {
-// u8 RateArray[4] = {2, 4, 11, 22};
-// MTO_SetDTORateRange(RateArray, 4);
-// }
-//
-// Return Value:
-// None
-//============================================================================
-void MTO_SetDTORateRange(MTO_FUNC_INPUT,u8 *pRateArray, u8 ArraySize)
-{
- u8 i, j=0;
-
- for(i=0;i<ArraySize;i++)
- {
- if(pRateArray[i] == 22)
- break;
- }
- if(i < ArraySize) //we need adjust the order of rate list because 11Mbps rate exists
- {
- for(;i>0;i--)
- {
- if(pRateArray[i-1] <= 11)
- break;
- pRateArray[i] = pRateArray[i-1];
- }
- pRateArray[i] = 22;
- MTO_OFDM_RATE_LEVEL() = i;
- }
- else
- {
- for(i=0; i<ArraySize; i++)
- {
- if (pRateArray[i] >= 12)
- break;
- }
- MTO_OFDM_RATE_LEVEL() = i;
- }
-
- for(i=0;i<ArraySize;i++)
- {
- MTO_Data_Rate_Tbl[i] = pRateArray[i];
- for(;j<MTO_MAX_DATA_RATE_LEVELS;j++)
- {
- if(Stardard_Data_Rate_Tbl[j] == pRateArray[i])
- break;
- }
- Level2PerTbl[i] = j;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[MTO]:Op Rate[%d]: %d\n",i, MTO_Data_Rate_Tbl[i]));
- #endif
- }
- MTO_DataRateAvailableLevel = ArraySize;
- if( MTO_DATA().RatePolicy ) // 0 means that no registry setting
- {
- if( MTO_DATA().RatePolicy == 1 )
- TxRateRec.tx_rate = 0; //ascent
- else
- TxRateRec.tx_rate = MTO_DataRateAvailableLevel -1 ; //descent
- }
- else
- {
- if( MTO_INITTXRATE_MODE )
- TxRateRec.tx_rate = 0; //ascent
- else
- TxRateRec.tx_rate = MTO_DataRateAvailableLevel -1 ; //descent
- }
- TxRateRec.tx_retry_rate = 0;
- //set default rate for initial use
- MTO_RATE_LEVEL() = TxRateRec.tx_rate;
- MTO_FALLBACK_RATE_LEVEL() = MTO_RATE_LEVEL();
-}
//===========================================================================
// MTO_Init --
@@ -399,7 +118,6 @@ void MTO_Init(MTO_FUNC_INPUT)
//
//MTO_RATE_LEVEL() = 10;
MTO_RATE_LEVEL() = 0;
- MTO_FALLBACK_RATE_LEVEL() = MTO_RATE_LEVEL();
MTO_FRAG_TH_LEVEL() = 4;
/** 1.1.23.1000 Turbo modify from -1 to +1
MTO_RTS_THRESHOLD() = MTO_FRAG_TH() - 1;
@@ -467,340 +185,6 @@ void MTO_Init(MTO_FUNC_INPUT)
MTO_DATA().RSSI_low = -60;
}
-//---------------------------------------------------------------------------//
-static u32 DTO_Rx_Info[13][3];
-static u32 DTO_RxCRCFail_Info[13][3];
-static u32 AntennaToggleBkoffTimer=5;
-typedef struct{
- int RxRate;
- int RxRatePkts;
- int index;
-}RXRATE_ANT;
-RXRATE_ANT RxRatePeakAnt[3];
-
-#define ANT0 0
-#define ANT1 1
-#define OLD_ANT 2
-
-void SearchPeakRxRate(int index)
-{
- int i;
- RxRatePeakAnt[index].RxRatePkts=0;
- //Find out the best rx rate which is used on different antenna
- for(i=1;i<13;i++)
- {
- if(DTO_Rx_Info[i][index] > (u32) RxRatePeakAnt[index].RxRatePkts)
- {
- RxRatePeakAnt[index].RxRatePkts = DTO_Rx_Info[i][index];
- RxRatePeakAnt[index].RxRate = rate_tbl[i];
- RxRatePeakAnt[index].index = i;
- }
- }
-}
-
-void ResetDTO_RxInfo(int index, MTO_FUNC_INPUT)
-{
- int i;
-
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("ResetDTOrx\n"));
- #endif
-
- for(i=0;i<13;i++)
- DTO_Rx_Info[i][index] = MTO_HAL()->rx_ok_count[i];
-
- for(i=0;i<13;i++)
- DTO_RxCRCFail_Info[i][index] = MTO_HAL()->rx_err_count[i];
-
- TotalTxPkt = 0;
- TotalTxPktRetry = 0;
-}
-
-void GetDTO_RxInfo(int index, MTO_FUNC_INPUT)
-{
- int i;
-
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("GetDTOrx\n"));
- #endif
-
- //PDEBUG(("[MTO]:DTO_Rx_Info[%d]=%d, rx_ok_count=%d\n", index, DTO_Rx_Info[0][index], phw_data->rx_ok_count[0]));
- for(i=0;i<13;i++)
- DTO_Rx_Info[i][index] = abs(MTO_HAL()->rx_ok_count[i] - DTO_Rx_Info[i][index]);
- if(DTO_Rx_Info[0][index]==0) DTO_Rx_Info[0][index] = 1;
-
- for(i=0;i<13;i++)
- DTO_RxCRCFail_Info[i][index] = MTO_HAL()->rx_err_count[i] - DTO_RxCRCFail_Info[i][index];
-
- TxPktPerAnt[index] = TotalTxPkt;
- TxPktRetryPerAnt[index] = TotalTxPktRetry;
- TotalTxPkt = 0;
- TotalTxPktRetry = 0;
-}
-
-unsigned char TxDominate(int index)
-{
- int tmp;
-
- tmp = TxPktPerAnt[index] + DTO_Rx_Info[0][index];
-
- if(Divide(TxPktPerAnt[index]*100, tmp) > 40)
- return true;
- else
- return false;
-}
-
-unsigned char CmpTxRetryRate(int index1, int index2)
-{
- int tx_retry_rate1, tx_retry_rate2;
- tx_retry_rate1 = Divide((TxPktRetryPerAnt[index1] - TxPktPerAnt[index1])*100, TxPktRetryPerAnt[index1]);
- tx_retry_rate2 = Divide((TxPktRetryPerAnt[index2] - TxPktPerAnt[index2])*100, TxPktRetryPerAnt[index2]);
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[MTO]:TxRetry Ant0: (%d%%) Ant1: (%d%%) \n ", tx_retry_rate1, tx_retry_rate2));
- #endif
-
- if(tx_retry_rate1 > tx_retry_rate2)
- return true;
- else
- return false;
-}
-
-void GetFreshAntennaData(MTO_FUNC_INPUT)
-{
- u8 x;
-
- x = hal_get_antenna_number(MTO_HAL());
- //hal_get_bss_pk_cnt(MTO_HAL());
- //hal_get_est_sq3(MTO_HAL(), 1);
- old_antenna[0] = x;
- //if this is the function for timer
- ResetDTO_RxInfo(x, MTO_FUNC_INPUT_DATA);
- if(AntennaToggleBkoffTimer)
- AntennaToggleBkoffTimer--;
- if (abs(last_rate_ant-MTO_RATE_LEVEL())>1) //backoff timer reset
- AntennaToggleBkoffTimer=0;
-
- if (MTO_ANT_DIVERSITY() != MTO_ANTENNA_DIVERSITY_ON ||
- MTO_ANT_DIVERSITY_ENABLE() != 1)
- AntennaToggleBkoffTimer=1;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[HHDTO]:**last data rate=%d,now data rate=%d**antenna toggle timer=%d",last_rate_ant,MTO_RATE_LEVEL(),AntennaToggleBkoffTimer));
- #endif
- last_rate_ant=MTO_RATE_LEVEL();
- if(AntennaToggleBkoffTimer==0)
- {
- MTO_TOGGLE_STATE() = TOGGLE_STATE_WAIT0;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[HHDTO]:===state is starting==for antenna toggle==="));
- #endif
- }
- else
- MTO_TOGGLE_STATE() = TOGGLE_STATE_IDLE;
-
- if ((MTO_BACKOFF_TMR()!=0)&&(MTO_RATE_LEVEL()>MTO_DataRateAvailableLevel - 3))
- {
- MTO_TOGGLE_STATE() = TOGGLE_STATE_IDLE;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[HHDTO]:===the data rate is %d (good)and will not toogle ===",MTO_DATA_RATE()>>1));
- #endif
- }
-
-
-}
-
-int WB_PCR[2]; //packet correct rate
-
-u8 CalcNewRate(MTO_FUNC_INPUT, u8 old_rate, u32 retry_cnt, u32 tx_frag_cnt)
-{
- int i;
- u8 new_rate;
- u32 retry_rate;
- int TxThrouput1, TxThrouput2, TxThrouput3, BestThroupht;
-
- if(tx_frag_cnt < MTOPARA_TXCOUNT_TH_FOR_CALC_RATE()) //too few packets transmit
- {
- return 0xff;
- }
- retry_rate = Divide(retry_cnt * 100, tx_frag_cnt);
-
- if(retry_rate > 90) retry_rate = 90; //always truncate to 90% due to lookup table size
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("##### Current level =%d, Retry count =%d, Frag count =%d\n",
- old_rate, retry_cnt, tx_frag_cnt));
- WBDEBUG(("*##* Retry rate =%d, throughput =%d\n",
- retry_rate, Rate_PER_TBL[retry_rate][old_rate]));
- WBDEBUG(("TxRateRec.tx_rate =%d, Retry rate = %d, throughput = %d\n",
- TxRateRec.tx_rate, TxRateRec.tx_retry_rate,
- Rate_PER_TBL[TxRateRec.tx_retry_rate][Level2PerTbl[TxRateRec.tx_rate]]));
- WBDEBUG(("old_rate-1 =%d, Retry rate = %d, throughput = %d\n",
- old_rate-1, retryrate_rec[old_rate-1],
- Rate_PER_TBL[retryrate_rec[old_rate-1]][old_rate-1]));
- WBDEBUG(("old_rate+1 =%d, Retry rate = %d, throughput = %d\n",
- old_rate+1, retryrate_rec[old_rate+1],
- Rate_PER_TBL[retryrate_rec[old_rate+1]][old_rate+1]));
- #endif
-
- //following is for record the retry rate at the different data rate
- if (abs(retry_rate-retryrate_rec[old_rate])<50)//---the per TH
- retryrate_rec[old_rate] = retry_rate; //update retry rate
- else
- {
- for (i=0;i<MTO_DataRateAvailableLevel;i++) //reset all retry rate
- retryrate_rec[i]=0;
- retryrate_rec[old_rate] = retry_rate;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("Reset retry rate table\n"));
- #endif
- }
-
- if(TxRateRec.tx_rate > old_rate) //Decrease Tx Rate
- {
- TxThrouput1 = Rate_PER_TBL[TxRateRec.tx_retry_rate][Level2PerTbl[TxRateRec.tx_rate]];
- TxThrouput2 = Rate_PER_TBL[retry_rate][Level2PerTbl[old_rate]];
- if(TxThrouput1 > TxThrouput2)
- {
- new_rate = TxRateRec.tx_rate;
- BestThroupht = TxThrouput1;
- }
- else
- {
- new_rate = old_rate;
- BestThroupht = TxThrouput2;
- }
- if((old_rate > 0) &&(retry_rate>MTOPARA_TXRATE_DEC_TH())) //Min Rate
- {
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate-1]][Level2PerTbl[old_rate-1]];
- if(BestThroupht < TxThrouput3)
- {
- new_rate = old_rate - 1;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("--------\n"));
- #endif
- BestThroupht = TxThrouput3;
- }
- }
- }
- else if(TxRateRec.tx_rate < old_rate) //Increase Tx Rate
- {
- TxThrouput1 = Rate_PER_TBL[TxRateRec.tx_retry_rate][Level2PerTbl[TxRateRec.tx_rate]];
- TxThrouput2 = Rate_PER_TBL[retry_rate][Level2PerTbl[old_rate]];
- if(TxThrouput1 > TxThrouput2)
- {
- new_rate = TxRateRec.tx_rate;
- BestThroupht = TxThrouput1;
- }
- else
- {
- new_rate = old_rate;
- BestThroupht = TxThrouput2;
- }
- if ((old_rate < MTO_DataRateAvailableLevel - 1)&&(retry_rate<MTOPARA_TXRATE_INC_TH()))
- {
- //TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]][Level2PerTbl[old_rate+1]];
- if (retryrate_rec[old_rate+1] > MTOPARA_TXRETRYRATE_REDUCE())
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]-MTOPARA_TXRETRYRATE_REDUCE()][Level2PerTbl[old_rate+1]];
- else
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]][Level2PerTbl[old_rate+1]];
- if(BestThroupht < TxThrouput3)
- {
- new_rate = old_rate + 1;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("++++++++++\n"));
- #endif
- BestThroupht = TxThrouput3;
- }
- }
- }
- else //Tx Rate no change
- {
- TxThrouput2 = Rate_PER_TBL[retry_rate][Level2PerTbl[old_rate]];
- new_rate = old_rate;
- BestThroupht = TxThrouput2;
-
- if (retry_rate <MTOPARA_TXRATE_EQ_TH()) //th for change higher rate
- {
- if(old_rate < MTO_DataRateAvailableLevel - 1)
- {
- //TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]][Level2PerTbl[old_rate+1]];
- if (retryrate_rec[old_rate+1] > MTOPARA_TXRETRYRATE_REDUCE())
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]-MTOPARA_TXRETRYRATE_REDUCE()][Level2PerTbl[old_rate+1]];
- else
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate+1]][Level2PerTbl[old_rate+1]];
- if(BestThroupht < TxThrouput3)
- {
- new_rate = old_rate + 1;
- BestThroupht = TxThrouput3;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("=++++++++++\n"));
- #endif
- }
- }
- }
- else
- if(old_rate > 0) //Min Rate
- {
- TxThrouput3 = Rate_PER_TBL[retryrate_rec[old_rate-1]][Level2PerTbl[old_rate-1]];
- if(BestThroupht < TxThrouput3)
- {
- new_rate = old_rate - 1;
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("=--------\n"));
- #endif
- BestThroupht = TxThrouput3;
- }
- }
- }
-
- if (!LOCAL_IS_IBSS_MODE())
- {
- max_rssi_rate = GetMaxRateLevelFromRSSI();
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[MTO]:RSSI2Rate=%d\n", MTO_Data_Rate_Tbl[max_rssi_rate]));
- #endif
- if(new_rate > max_rssi_rate)
- new_rate = max_rssi_rate;
- }
-
- //save new rate;
- TxRateRec.tx_rate = old_rate;
- TxRateRec.tx_retry_rate = (u8) retry_rate;
- TxRetryRate = retry_rate;
- return new_rate;
-}
-
-void SmoothRSSI(s32 new_rssi)
-{
- RSSISmoothed = RSSISmoothed + new_rssi - RSSIBuf[RSSIBufIndex];
- RSSIBuf[RSSIBufIndex] = new_rssi;
- RSSIBufIndex = (RSSIBufIndex + 1) % 10;
-}
-
-u8 GetMaxRateLevelFromRSSI(void)
-{
- u8 i;
- u8 TxRate;
-
- for(i=0;i<RSSI2RATE_SIZE;i++)
- {
- if(RSSISmoothed > RSSI2RateTbl[i].RSSI)
- break;
- }
- #ifdef _PE_DTO_DUMP_
- WBDEBUG(("[MTO]:RSSI=%d\n", Divide(RSSISmoothed, 10)));
- #endif
- if(i < RSSI2RATE_SIZE)
- TxRate = RSSI2RateTbl[i].TxRate;
- else
- TxRate = 2; //divided by 2 = 1Mbps
-
- for(i=MTO_DataRateAvailableLevel-1;i>0;i--)
- {
- if(TxRate >=MTO_Data_Rate_Tbl[i])
- break;
- }
- return i;
-}
-
//===========================================================================
// Description:
// If we enable DTO, we will ignore the tx count with different tx rate from
@@ -862,36 +246,3 @@ void MTO_SetTxCount(MTO_FUNC_INPUT, u8 tx_rate, u8 index)
PeriodTotalTxPkt ++;
PeriodTotalTxPktRetry += (index+1);
}
-
-u8 MTO_GetTxFallbackRate(MTO_FUNC_INPUT)
-{
- return MTO_DATA_FALLBACK_RATE();
-}
-
-
-//===========================================================================
-// MTO_TxFailed --
-//
-// Description:
-// Failure of transmitting a packet indicates that certain MTO parmeters
-// may need to be adjusted. This function is called when NIC just failed
-// to transmit a packet or when MSDULifeTime expired.
-//
-// Arguments:
-// adapter - The pointer to the Miniport adapter Context
-//
-// Return Value:
-// None
-//============================================================================
-void MTO_TxFailed(MTO_FUNC_INPUT)
-{
- return;
-}
-
-int Divide(int a, int b)
-{
- if (b==0) b=1;
- return a/b;
-}
-
-
diff --git a/drivers/staging/winbond/mto.h b/drivers/staging/winbond/mto.h
index 536c4f1..63d8328 100644
--- a/drivers/staging/winbond/mto.h
+++ b/drivers/staging/winbond/mto.h
@@ -168,7 +168,6 @@ typedef struct _MTO_PARAMETERS
#define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
#define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
-#define MTO_FALLBACK_RATE_LEVEL() MTO_DATA().FallbackRateLevel
#define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
#define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
#define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
@@ -205,7 +204,6 @@ extern u8 MTO_Data_Rate_Tbl[];
extern u16 MTO_Frag_Th_Tbl[];
#define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
-#define MTO_DATA_FALLBACK_RATE() MTO_Data_Rate_Tbl[MTO_FALLBACK_RATE_LEVEL()] //next level
#define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
typedef struct {
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/7] w35und: make functions local to wb35rx.c static
2008-10-30 17:04 ` [PATCH 3/7] w35und: remove dead code from mto.c Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 17:04 ` [PATCH 5/7] w35und: make functions local to wb35tx.c static Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
While there are no functional changes, the diff is quite large because we need
to shuffle code around to avoid forward declarations.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/wb35rx.c | 425 ++++++++++++++++++------------------
drivers/staging/winbond/wb35rx_f.h | 6 -
2 files changed, 213 insertions(+), 218 deletions(-)
diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c
index 85b861c..7f8b6d7 100644
--- a/drivers/staging/winbond/wb35rx.c
+++ b/drivers/staging/winbond/wb35rx.c
@@ -14,85 +14,150 @@
#include "sysdef.h"
#include "wb35rx_f.h"
-void Wb35Rx_start(struct ieee80211_hw *hw)
+static void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize)
{
struct wbsoft_priv *priv = hw->priv;
- phw_data_t pHwData = &priv->sHwData;
- PWB35RX pWb35Rx = &pHwData->Wb35Rx;
+ struct sk_buff *skb;
+ struct ieee80211_rx_status rx_status = {0};
- // Allow only one thread to run into the Wb35Rx() function
- if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
- pWb35Rx->EP3vm_state = VM_RUNNING;
- Wb35Rx(hw);
- } else
- atomic_dec(&pWb35Rx->RxFireCounter);
+ if (!priv->enabled)
+ return;
+
+ skb = dev_alloc_skb(PacketSize);
+ if (!skb) {
+ printk("Not enough memory for packet, FIXME\n");
+ return;
+ }
+
+ memcpy(skb_put(skb, PacketSize),
+ pRxBufferAddress,
+ PacketSize);
+
+/*
+ rx_status.rate = 10;
+ rx_status.channel = 1;
+ rx_status.freq = 12345;
+ rx_status.phymode = MODE_IEEE80211B;
+*/
+
+ ieee80211_rx_irqsafe(hw, skb, &rx_status);
}
-// This function cannot reentrain
-void Wb35Rx(struct ieee80211_hw *hw)
+static void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
+{
+ u32 * pRxBufferAddress;
+ u32 DecryptionMethod;
+ u32 i;
+ u16 BufferSize;
+
+ DecryptionMethod = pRxDes->R01.R01_decryption_method;
+ pRxBufferAddress = pRxDes->buffer_address[0];
+ BufferSize = pRxDes->buffer_size[0];
+
+ // Adjust the last part of data. Only data left
+ BufferSize -= 4; // For CRC-32
+ if (DecryptionMethod)
+ BufferSize -= 4;
+ if (DecryptionMethod == 3) // For CCMP
+ BufferSize -= 4;
+
+ // Adjust the IV field which after 802.11 header and ICV field.
+ if (DecryptionMethod == 1) // For WEP
+ {
+ for( i=6; i>0; i-- )
+ pRxBufferAddress[i] = pRxBufferAddress[i-1];
+ pRxDes->buffer_address[0] = pRxBufferAddress + 1;
+ BufferSize -= 4; // 4 byte for IV
+ }
+ else if( DecryptionMethod ) // For TKIP and CCMP
+ {
+ for (i=7; i>1; i--)
+ pRxBufferAddress[i] = pRxBufferAddress[i-2];
+ pRxDes->buffer_address[0] = pRxBufferAddress + 2;//Update the descriptor, shift 8 byte
+ BufferSize -= 8; // 8 byte for IV + ICV
+ }
+ pRxDes->buffer_size[0] = BufferSize;
+}
+
+static u16 Wb35Rx_indicate(struct ieee80211_hw *hw)
{
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
+ DESCRIPTOR RxDes;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- u8 * pRxBufferAddress;
- struct urb *urb = pWb35Rx->RxUrb;
- int retv;
- u32 RxBufferId;
+ u8 * pRxBufferAddress;
+ u16 PacketSize;
+ u16 stmp, BufferSize, stmp2 = 0;
+ u32 RxBufferId;
- //
- // Issuing URB
- //
- if (pHwData->SurpriseRemove || pHwData->HwStop)
- goto error;
+ // Only one thread be allowed to run into the following
+ do {
+ RxBufferId = pWb35Rx->RxProcessIndex;
+ if (pWb35Rx->RxOwner[ RxBufferId ]) //Owner by VM
+ break;
- if (pWb35Rx->rx_halt)
- goto error;
+ pWb35Rx->RxProcessIndex++;
+ pWb35Rx->RxProcessIndex %= MAX_USB_RX_BUFFER_NUMBER;
- // Get RxBuffer's ID
- RxBufferId = pWb35Rx->RxBufferId;
- if (!pWb35Rx->RxOwner[RxBufferId]) {
- // It's impossible to run here.
- #ifdef _PE_RX_DUMP_
- WBDEBUG(("Rx driver fifo unavailable\n"));
- #endif
- goto error;
- }
+ pRxBufferAddress = pWb35Rx->pDRx;
+ BufferSize = pWb35Rx->RxBufferSize[ RxBufferId ];
- // Update buffer point, then start to bulkin the data from USB
- pWb35Rx->RxBufferId++;
- pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER;
+ // Parse the bulkin buffer
+ while (BufferSize >= 4) {
+ if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a
+ break;
- pWb35Rx->CurrentRxBufferId = RxBufferId;
+ // Get the R00 R01 first
+ RxDes.R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
+ PacketSize = (u16)RxDes.R00.R00_receive_byte_count;
+ RxDes.R01.value = le32_to_cpu(*((u32 *)(pRxBufferAddress+4)));
+ // For new DMA 4k
+ if ((PacketSize & 0x03) > 0)
+ PacketSize -= 4;
- pWb35Rx->pDRx = kzalloc(MAX_USB_RX_BUFFER, GFP_ATOMIC);
- if (!pWb35Rx->pDRx) {
- printk("w35und: Rx memory alloc failed\n");
- goto error;
- }
- pRxBufferAddress = pWb35Rx->pDRx;
+ // Basic check for Rx length. Is length valid?
+ if (PacketSize > MAX_PACKET_SIZE) {
+ #ifdef _PE_RX_DUMP_
+ WBDEBUG(("Serious ERROR : Rx data size too long, size =%d\n", PacketSize));
+ #endif
- usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
- usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
- pRxBufferAddress, MAX_USB_RX_BUFFER,
- Wb35Rx_Complete, hw);
+ pWb35Rx->EP3vm_state = VM_STOP;
+ pWb35Rx->Ep3ErrorCount2++;
+ break;
+ }
- pWb35Rx->EP3vm_state = VM_RUNNING;
+ // Start to process Rx buffer
+// RxDes.Descriptor_ID = RxBufferId; // Due to synchronous indicate, the field doesn't necessary to use.
+ BufferSize -= 8; //subtract 8 byte for 35's USB header length
+ pRxBufferAddress += 8;
- retv = usb_submit_urb(urb, GFP_ATOMIC);
+ RxDes.buffer_address[0] = pRxBufferAddress;
+ RxDes.buffer_size[0] = PacketSize;
+ RxDes.buffer_number = 1;
+ RxDes.buffer_start_index = 0;
+ RxDes.buffer_total_size = RxDes.buffer_size[0];
+ Wb35Rx_adjust(&RxDes);
- if (retv != 0) {
- printk("Rx URB sending error\n");
- goto error;
- }
- return;
+ packet_came(hw, pRxBufferAddress, PacketSize);
-error:
- // VM stop
- pWb35Rx->EP3vm_state = VM_STOP;
- atomic_dec(&pWb35Rx->RxFireCounter);
+ // Move RxBuffer point to the next
+ stmp = PacketSize + 3;
+ stmp &= ~0x03; // 4n alignment
+ pRxBufferAddress += stmp;
+ BufferSize -= stmp;
+ stmp2 += stmp;
+ }
+
+ // Reclaim resource
+ pWb35Rx->RxOwner[ RxBufferId ] = 1;
+ } while (true);
+
+ return stmp2;
}
-void Wb35Rx_Complete(struct urb *urb)
+static void Wb35Rx(struct ieee80211_hw *hw);
+
+static void Wb35Rx_Complete(struct urb *urb)
{
struct ieee80211_hw *hw = urb->context;
struct wbsoft_priv *priv = hw->priv;
@@ -170,49 +235,86 @@ error:
pWb35Rx->EP3vm_state = VM_STOP;
}
-//=====================================================================================
-unsigned char Wb35Rx_initial(phw_data_t pHwData)
+// This function cannot reentrain
+static void Wb35Rx(struct ieee80211_hw *hw)
{
- PWB35RX pWb35Rx = &pHwData->Wb35Rx;
-
- // Initial the Buffer Queue
- Wb35Rx_reset_descriptor( pHwData );
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
+ PWB35RX pWb35Rx = &pHwData->Wb35Rx;
+ u8 * pRxBufferAddress;
+ struct urb *urb = pWb35Rx->RxUrb;
+ int retv;
+ u32 RxBufferId;
- pWb35Rx->RxUrb = usb_alloc_urb(0, GFP_ATOMIC);
- return (!!pWb35Rx->RxUrb);
-}
+ //
+ // Issuing URB
+ //
+ if (pHwData->SurpriseRemove || pHwData->HwStop)
+ goto error;
-void Wb35Rx_stop(phw_data_t pHwData)
-{
- PWB35RX pWb35Rx = &pHwData->Wb35Rx;
+ if (pWb35Rx->rx_halt)
+ goto error;
- // Canceling the Irp if already sends it out.
- if (pWb35Rx->EP3vm_state == VM_RUNNING) {
- usb_unlink_urb( pWb35Rx->RxUrb ); // Only use unlink, let Wb35Rx_destroy to free them
+ // Get RxBuffer's ID
+ RxBufferId = pWb35Rx->RxBufferId;
+ if (!pWb35Rx->RxOwner[RxBufferId]) {
+ // It's impossible to run here.
#ifdef _PE_RX_DUMP_
- WBDEBUG(("EP3 Rx stop\n"));
+ WBDEBUG(("Rx driver fifo unavailable\n"));
#endif
+ goto error;
+ }
+
+ // Update buffer point, then start to bulkin the data from USB
+ pWb35Rx->RxBufferId++;
+ pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER;
+
+ pWb35Rx->CurrentRxBufferId = RxBufferId;
+
+ pWb35Rx->pDRx = kzalloc(MAX_USB_RX_BUFFER, GFP_ATOMIC);
+ if (!pWb35Rx->pDRx) {
+ printk("w35und: Rx memory alloc failed\n");
+ goto error;
+ }
+ pRxBufferAddress = pWb35Rx->pDRx;
+
+ usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
+ usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
+ pRxBufferAddress, MAX_USB_RX_BUFFER,
+ Wb35Rx_Complete, hw);
+
+ pWb35Rx->EP3vm_state = VM_RUNNING;
+
+ retv = usb_submit_urb(urb, GFP_ATOMIC);
+
+ if (retv != 0) {
+ printk("Rx URB sending error\n");
+ goto error;
}
+ return;
+
+error:
+ // VM stop
+ pWb35Rx->EP3vm_state = VM_STOP;
+ atomic_dec(&pWb35Rx->RxFireCounter);
}
-// Needs process context
-void Wb35Rx_destroy(phw_data_t pHwData)
+void Wb35Rx_start(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- do {
- msleep(10); // Delay for waiting function enter 940623.1.a
- } while (pWb35Rx->EP3vm_state != VM_STOP);
- msleep(10); // Delay for waiting function exit 940623.1.b
-
- if (pWb35Rx->RxUrb)
- usb_free_urb( pWb35Rx->RxUrb );
- #ifdef _PE_RX_DUMP_
- WBDEBUG(("Wb35Rx_destroy OK\n"));
- #endif
+ // Allow only one thread to run into the Wb35Rx() function
+ if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
+ pWb35Rx->EP3vm_state = VM_RUNNING;
+ Wb35Rx(hw);
+ } else
+ atomic_dec(&pWb35Rx->RxFireCounter);
}
-void Wb35Rx_reset_descriptor( phw_data_t pHwData )
+//=====================================================================================
+static void Wb35Rx_reset_descriptor( phw_data_t pHwData )
{
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u32 i;
@@ -228,145 +330,44 @@ void Wb35Rx_reset_descriptor( phw_data_t pHwData )
pWb35Rx->RxOwner[i] = 1;
}
-void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
+unsigned char Wb35Rx_initial(phw_data_t pHwData)
{
- u32 * pRxBufferAddress;
- u32 DecryptionMethod;
- u32 i;
- u16 BufferSize;
-
- DecryptionMethod = pRxDes->R01.R01_decryption_method;
- pRxBufferAddress = pRxDes->buffer_address[0];
- BufferSize = pRxDes->buffer_size[0];
+ PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- // Adjust the last part of data. Only data left
- BufferSize -= 4; // For CRC-32
- if (DecryptionMethod)
- BufferSize -= 4;
- if (DecryptionMethod == 3) // For CCMP
- BufferSize -= 4;
+ // Initial the Buffer Queue
+ Wb35Rx_reset_descriptor( pHwData );
- // Adjust the IV field which after 802.11 header and ICV field.
- if (DecryptionMethod == 1) // For WEP
- {
- for( i=6; i>0; i-- )
- pRxBufferAddress[i] = pRxBufferAddress[i-1];
- pRxDes->buffer_address[0] = pRxBufferAddress + 1;
- BufferSize -= 4; // 4 byte for IV
- }
- else if( DecryptionMethod ) // For TKIP and CCMP
- {
- for (i=7; i>1; i--)
- pRxBufferAddress[i] = pRxBufferAddress[i-2];
- pRxDes->buffer_address[0] = pRxBufferAddress + 2;//Update the descriptor, shift 8 byte
- BufferSize -= 8; // 8 byte for IV + ICV
- }
- pRxDes->buffer_size[0] = BufferSize;
+ pWb35Rx->RxUrb = usb_alloc_urb(0, GFP_ATOMIC);
+ return (!!pWb35Rx->RxUrb);
}
-static void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize)
+void Wb35Rx_stop(phw_data_t pHwData)
{
- struct wbsoft_priv *priv = hw->priv;
- struct sk_buff *skb;
- struct ieee80211_rx_status rx_status = {0};
-
- if (!priv->enabled)
- return;
+ PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- skb = dev_alloc_skb(PacketSize);
- if (!skb) {
- printk("Not enough memory for packet, FIXME\n");
- return;
+ // Canceling the Irp if already sends it out.
+ if (pWb35Rx->EP3vm_state == VM_RUNNING) {
+ usb_unlink_urb( pWb35Rx->RxUrb ); // Only use unlink, let Wb35Rx_destroy to free them
+ #ifdef _PE_RX_DUMP_
+ WBDEBUG(("EP3 Rx stop\n"));
+ #endif
}
-
- memcpy(skb_put(skb, PacketSize),
- pRxBufferAddress,
- PacketSize);
-
-/*
- rx_status.rate = 10;
- rx_status.channel = 1;
- rx_status.freq = 12345;
- rx_status.phymode = MODE_IEEE80211B;
-*/
-
- ieee80211_rx_irqsafe(hw, skb, &rx_status);
}
-u16 Wb35Rx_indicate(struct ieee80211_hw *hw)
+// Needs process context
+void Wb35Rx_destroy(phw_data_t pHwData)
{
- struct wbsoft_priv *priv = hw->priv;
- phw_data_t pHwData = &priv->sHwData;
- DESCRIPTOR RxDes;
- PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- u8 * pRxBufferAddress;
- u16 PacketSize;
- u16 stmp, BufferSize, stmp2 = 0;
- u32 RxBufferId;
+ PWB35RX pWb35Rx = &pHwData->Wb35Rx;
- // Only one thread be allowed to run into the following
do {
- RxBufferId = pWb35Rx->RxProcessIndex;
- if (pWb35Rx->RxOwner[ RxBufferId ]) //Owner by VM
- break;
-
- pWb35Rx->RxProcessIndex++;
- pWb35Rx->RxProcessIndex %= MAX_USB_RX_BUFFER_NUMBER;
-
- pRxBufferAddress = pWb35Rx->pDRx;
- BufferSize = pWb35Rx->RxBufferSize[ RxBufferId ];
-
- // Parse the bulkin buffer
- while (BufferSize >= 4) {
- if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a
- break;
-
- // Get the R00 R01 first
- RxDes.R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
- PacketSize = (u16)RxDes.R00.R00_receive_byte_count;
- RxDes.R01.value = le32_to_cpu(*((u32 *)(pRxBufferAddress+4)));
- // For new DMA 4k
- if ((PacketSize & 0x03) > 0)
- PacketSize -= 4;
-
- // Basic check for Rx length. Is length valid?
- if (PacketSize > MAX_PACKET_SIZE) {
- #ifdef _PE_RX_DUMP_
- WBDEBUG(("Serious ERROR : Rx data size too long, size =%d\n", PacketSize));
- #endif
-
- pWb35Rx->EP3vm_state = VM_STOP;
- pWb35Rx->Ep3ErrorCount2++;
- break;
- }
-
- // Start to process Rx buffer
-// RxDes.Descriptor_ID = RxBufferId; // Due to synchronous indicate, the field doesn't necessary to use.
- BufferSize -= 8; //subtract 8 byte for 35's USB header length
- pRxBufferAddress += 8;
-
- RxDes.buffer_address[0] = pRxBufferAddress;
- RxDes.buffer_size[0] = PacketSize;
- RxDes.buffer_number = 1;
- RxDes.buffer_start_index = 0;
- RxDes.buffer_total_size = RxDes.buffer_size[0];
- Wb35Rx_adjust(&RxDes);
-
- packet_came(hw, pRxBufferAddress, PacketSize);
-
- // Move RxBuffer point to the next
- stmp = PacketSize + 3;
- stmp &= ~0x03; // 4n alignment
- pRxBufferAddress += stmp;
- BufferSize -= stmp;
- stmp2 += stmp;
- }
-
- // Reclaim resource
- pWb35Rx->RxOwner[ RxBufferId ] = 1;
- } while (true);
+ msleep(10); // Delay for waiting function enter 940623.1.a
+ } while (pWb35Rx->EP3vm_state != VM_STOP);
+ msleep(10); // Delay for waiting function exit 940623.1.b
- return stmp2;
+ if (pWb35Rx->RxUrb)
+ usb_free_urb( pWb35Rx->RxUrb );
+ #ifdef _PE_RX_DUMP_
+ WBDEBUG(("Wb35Rx_destroy OK\n"));
+ #endif
}
-
diff --git a/drivers/staging/winbond/wb35rx_f.h b/drivers/staging/winbond/wb35rx_f.h
index 5585b55..d993041 100644
--- a/drivers/staging/winbond/wb35rx_f.h
+++ b/drivers/staging/winbond/wb35rx_f.h
@@ -7,15 +7,9 @@
//====================================
// Interface function declare
//====================================
-void Wb35Rx_reset_descriptor( phw_data_t pHwData );
unsigned char Wb35Rx_initial( phw_data_t pHwData );
void Wb35Rx_destroy( phw_data_t pHwData );
void Wb35Rx_stop( phw_data_t pHwData );
-u16 Wb35Rx_indicate(struct ieee80211_hw *hw);
-void Wb35Rx_adjust( PDESCRIPTOR pRxDes );
void Wb35Rx_start(struct ieee80211_hw *hw);
-void Wb35Rx(struct ieee80211_hw *hw);
-void Wb35Rx_Complete(struct urb *urb);
-
#endif
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/7] w35und: make functions local to wb35tx.c static
2008-10-30 17:04 ` [PATCH 4/7] w35und: make functions local to wb35rx.c static Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 17:04 ` [PATCH 6/7] w35und: remove dead code from wbhal.c Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
While there are no functional changes, the diff is quite large because we need
to shuffle code around to avoid forward declarations.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/wb35tx.c | 199 +++++++++++++++++-------------------
drivers/staging/winbond/wb35tx_f.h | 5 -
2 files changed, 95 insertions(+), 109 deletions(-)
diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
index 32ee391..b9b4456 100644
--- a/drivers/staging/winbond/wb35tx.c
+++ b/drivers/staging/winbond/wb35tx.c
@@ -23,21 +23,46 @@ Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
return true;
}
-void Wb35Tx_start(struct wbsoft_priv *adapter)
+static void Wb35Tx(struct wbsoft_priv *adapter);
+
+static void Wb35Tx_complete(struct urb * pUrb)
{
- phw_data_t pHwData = &adapter->sHwData;
- PWB35TX pWb35Tx = &pHwData->Wb35Tx;
+ struct wbsoft_priv *adapter = pUrb->context;
+ phw_data_t pHwData = &adapter->sHwData;
+ PWB35TX pWb35Tx = &pHwData->Wb35Tx;
+ PMDS pMds = &adapter->Mds;
- // Allow only one thread to run into function
- if (atomic_inc_return(&pWb35Tx->TxFireCounter) == 1) {
- pWb35Tx->EP4vm_state = VM_RUNNING;
- Wb35Tx(adapter);
- } else
- atomic_dec(&pWb35Tx->TxFireCounter);
-}
+ printk("wb35: tx complete\n");
+ // Variable setting
+ pWb35Tx->EP4vm_state = VM_COMPLETED;
+ pWb35Tx->EP4VM_status = pUrb->status; //Store the last result of Irp
+ pMds->TxOwner[ pWb35Tx->TxSendIndex ] = 0;// Set the owner. Free the owner bit always.
+ pWb35Tx->TxSendIndex++;
+ pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER;
+ if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove
+ goto error;
-void Wb35Tx(struct wbsoft_priv *adapter)
+ if (pWb35Tx->tx_halt)
+ goto error;
+
+ // The URB is completed, check the result
+ if (pWb35Tx->EP4VM_status != 0) {
+ printk("URB submission failed\n");
+ pWb35Tx->EP4vm_state = VM_STOP;
+ goto error;
+ }
+
+ Mds_Tx(adapter);
+ Wb35Tx(adapter);
+ return;
+
+error:
+ atomic_dec(&pWb35Tx->TxFireCounter);
+ pWb35Tx->EP4vm_state = VM_STOP;
+}
+
+static void Wb35Tx(struct wbsoft_priv *adapter)
{
phw_data_t pHwData = &adapter->sHwData;
PWB35TX pWb35Tx = &pHwData->Wb35Tx;
@@ -88,50 +113,17 @@ void Wb35Tx(struct wbsoft_priv *adapter)
atomic_dec(&pWb35Tx->TxFireCounter);
}
-
-void Wb35Tx_complete(struct urb * pUrb)
-{
- struct wbsoft_priv *adapter = pUrb->context;
- phw_data_t pHwData = &adapter->sHwData;
- PWB35TX pWb35Tx = &pHwData->Wb35Tx;
- PMDS pMds = &adapter->Mds;
-
- printk("wb35: tx complete\n");
- // Variable setting
- pWb35Tx->EP4vm_state = VM_COMPLETED;
- pWb35Tx->EP4VM_status = pUrb->status; //Store the last result of Irp
- pMds->TxOwner[ pWb35Tx->TxSendIndex ] = 0;// Set the owner. Free the owner bit always.
- pWb35Tx->TxSendIndex++;
- pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER;
-
- if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove
- goto error;
-
- if (pWb35Tx->tx_halt)
- goto error;
-
- // The URB is completed, check the result
- if (pWb35Tx->EP4VM_status != 0) {
- printk("URB submission failed\n");
- pWb35Tx->EP4vm_state = VM_STOP;
- goto error;
- }
-
- Mds_Tx(adapter);
- Wb35Tx(adapter);
- return;
-
-error:
- atomic_dec(&pWb35Tx->TxFireCounter);
- pWb35Tx->EP4vm_state = VM_STOP;
-}
-
-void Wb35Tx_reset_descriptor( phw_data_t pHwData )
+void Wb35Tx_start(struct wbsoft_priv *adapter)
{
+ phw_data_t pHwData = &adapter->sHwData;
PWB35TX pWb35Tx = &pHwData->Wb35Tx;
- pWb35Tx->TxSendIndex = 0;
- pWb35Tx->tx_halt = 0;
+ // Allow only one thread to run into function
+ if (atomic_inc_return(&pWb35Tx->TxFireCounter) == 1) {
+ pWb35Tx->EP4vm_state = VM_RUNNING;
+ Wb35Tx(adapter);
+ } else
+ atomic_dec(&pWb35Tx->TxFireCounter);
}
unsigned char Wb35Tx_initial(phw_data_t pHwData)
@@ -211,59 +203,9 @@ void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount)
}
}
-void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter)
-{
- phw_data_t pHwData = &adapter->sHwData;
- PWB35TX pWb35Tx = &pHwData->Wb35Tx;
-
- // Allow only one thread to run into function
- if (atomic_inc_return(&pWb35Tx->TxResultCount) == 1) {
- pWb35Tx->EP2vm_state = VM_RUNNING;
- Wb35Tx_EP2VM(adapter);
- }
- else
- atomic_dec(&pWb35Tx->TxResultCount);
-}
-
+static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter);
-void Wb35Tx_EP2VM(struct wbsoft_priv *adapter)
-{
- phw_data_t pHwData = &adapter->sHwData;
- PWB35TX pWb35Tx = &pHwData->Wb35Tx;
- struct urb * pUrb = (struct urb *)pWb35Tx->Tx2Urb;
- u32 * pltmp = (u32 *)pWb35Tx->EP2_buf;
- int retv;
-
- if (pHwData->SurpriseRemove || pHwData->HwStop)
- goto error;
-
- if (pWb35Tx->tx_halt)
- goto error;
-
- //
- // Issuing URB
- //
- usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2),
- pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, adapter, 32);
-
- pWb35Tx->EP2vm_state = VM_RUNNING;
- retv = usb_submit_urb(pUrb, GFP_ATOMIC);
-
- if (retv < 0) {
- #ifdef _PE_TX_DUMP_
- WBDEBUG(("EP2 Tx Irp sending error\n"));
- #endif
- goto error;
- }
-
- return;
-error:
- pWb35Tx->EP2vm_state = VM_STOP;
- atomic_dec(&pWb35Tx->TxResultCount);
-}
-
-
-void Wb35Tx_EP2VM_complete(struct urb * pUrb)
+static void Wb35Tx_EP2VM_complete(struct urb * pUrb)
{
struct wbsoft_priv *adapter = pUrb->context;
phw_data_t pHwData = &adapter->sHwData;
@@ -312,3 +254,52 @@ error:
pWb35Tx->EP2vm_state = VM_STOP;
}
+static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter)
+{
+ phw_data_t pHwData = &adapter->sHwData;
+ PWB35TX pWb35Tx = &pHwData->Wb35Tx;
+ struct urb * pUrb = (struct urb *)pWb35Tx->Tx2Urb;
+ u32 * pltmp = (u32 *)pWb35Tx->EP2_buf;
+ int retv;
+
+ if (pHwData->SurpriseRemove || pHwData->HwStop)
+ goto error;
+
+ if (pWb35Tx->tx_halt)
+ goto error;
+
+ //
+ // Issuing URB
+ //
+ usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2),
+ pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, adapter, 32);
+
+ pWb35Tx->EP2vm_state = VM_RUNNING;
+ retv = usb_submit_urb(pUrb, GFP_ATOMIC);
+
+ if (retv < 0) {
+ #ifdef _PE_TX_DUMP_
+ WBDEBUG(("EP2 Tx Irp sending error\n"));
+ #endif
+ goto error;
+ }
+
+ return;
+error:
+ pWb35Tx->EP2vm_state = VM_STOP;
+ atomic_dec(&pWb35Tx->TxResultCount);
+}
+
+void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter)
+{
+ phw_data_t pHwData = &adapter->sHwData;
+ PWB35TX pWb35Tx = &pHwData->Wb35Tx;
+
+ // Allow only one thread to run into function
+ if (atomic_inc_return(&pWb35Tx->TxResultCount) == 1) {
+ pWb35Tx->EP2vm_state = VM_RUNNING;
+ Wb35Tx_EP2VM(adapter);
+ }
+ else
+ atomic_dec(&pWb35Tx->TxResultCount);
+}
diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h
index 277faa7..4222fa8 100644
--- a/drivers/staging/winbond/wb35tx_f.h
+++ b/drivers/staging/winbond/wb35tx_f.h
@@ -11,15 +11,10 @@ unsigned char Wb35Tx_initial( phw_data_t pHwData );
void Wb35Tx_destroy( phw_data_t pHwData );
unsigned char Wb35Tx_get_tx_buffer( phw_data_t pHwData, u8 **pBuffer );
-void Wb35Tx_EP2VM(struct wbsoft_priv *adapter);
void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter);
-void Wb35Tx_EP2VM_complete(struct urb *urb);
void Wb35Tx_start(struct wbsoft_priv *adapter);
void Wb35Tx_stop( phw_data_t pHwData );
-void Wb35Tx(struct wbsoft_priv *adapter);
-void Wb35Tx_complete(struct urb *urb);
-void Wb35Tx_reset_descriptor( phw_data_t pHwData );
void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount);
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/7] w35und: remove dead code from wbhal.c
2008-10-30 17:04 ` [PATCH 5/7] w35und: make functions local to wb35tx.c static Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 17:04 ` [PATCH 7/7] w35und: remove rxisr.c as dead code Pekka Enberg
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
Remove tons of unused code from wbhal.c.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/wbhal.c | 311 +------------------------------------
drivers/staging/winbond/wbhal_f.h | 22 ---
2 files changed, 1 insertions(+), 332 deletions(-)
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 7ab5300..d7bbb9a 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -2,13 +2,6 @@
#include "wbhal_f.h"
#include "wblinux_f.h"
-void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address )
-{
- if( pHwData->SurpriseRemove ) return;
-
- memcpy( current_address, pHwData->CurrentMacAddress, ETH_LENGTH_OF_ADDRESS );
-}
-
void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address )
{
u32 ltmp[2];
@@ -377,92 +370,6 @@ void hal_halt(phw_data_t pHwData, void *ppa_data)
}
//---------------------------------------------------------------------------------------------------
-void hal_set_rates(phw_data_t pHwData, u8 *pbss_rates,
- u8 length, unsigned char basic_rate_set)
-{
- struct wb35_reg *reg = &pHwData->reg;
- u32 tmp, tmp1;
- u8 Rate[12]={ 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
- u8 SupportedRate[16];
- u8 i, j, k, Count1, Count2, Byte;
-
- if( pHwData->SurpriseRemove ) return;
-
- if (basic_rate_set) {
- reg->M28_MacControl &= ~0x000fff00;
- tmp1 = 0x00000100;
- } else {
- reg->M28_MacControl &= ~0xfff00000;
- tmp1 = 0x00100000;
- }
-
- tmp = 0;
- for (i=0; i<length; i++) {
- Byte = pbss_rates[i] & 0x7f;
- for (j=0; j<12; j++) {
- if( Byte == Rate[j] )
- break;
- }
-
- if (j < 12)
- tmp |= (tmp1<<j);
- }
-
- reg->M28_MacControl |= tmp;
- Wb35Reg_Write( pHwData, 0x0828, reg->M28_MacControl );
-
- // 930206.2.c M78 setting
- j = k = Count1 = Count2 = 0;
- memset( SupportedRate, 0, 16 );
- tmp = 0x00100000;
- tmp1 = 0x00000100;
- for (i=0; i<12; i++) { // Get the supported rate
- if (tmp & reg->M28_MacControl) {
- SupportedRate[j] = Rate[i];
-
- if (tmp1 & reg->M28_MacControl)
- SupportedRate[j] |= 0x80;
-
- if (k)
- Count2++;
- else
- Count1++;
-
- j++;
- }
-
- if (i==4 && k==0) {
- if( !(reg->M28_MacControl & 0x000ff000) ) // if basic rate in 11g domain)
- {
- k = 1;
- j = 8;
- }
- }
-
- tmp <<= 1;
- tmp1 <<= 1;
- }
-
- // Fill data into support rate until buffer full
- //---20060926 add by anson's endian
- for (i=0; i<4; i++)
- *(u32 *)(SupportedRate+(i<<2)) = cpu_to_le32( *(u32 *)(SupportedRate+(i<<2)) );
- //--- end 20060926 add by anson's endian
- Wb35Reg_BurstWrite( pHwData,0x087c, (u32 *)SupportedRate, 4, AUTO_INCREMENT );
- reg->M7C_MacControl = ((u32 *)SupportedRate)[0];
- reg->M80_MacControl = ((u32 *)SupportedRate)[1];
- reg->M84_MacControl = ((u32 *)SupportedRate)[2];
- reg->M88_MacControl = ((u32 *)SupportedRate)[3];
-
- // Fill length
- tmp = Count1<<28 | Count2<<24;
- reg->M78_ERPInformation &= ~0xff000000;
- reg->M78_ERPInformation |= tmp;
- Wb35Reg_Write( pHwData, 0x0878, reg->M78_ERPInformation );
-}
-
-
-//---------------------------------------------------------------------------------------------------
void hal_set_beacon_period( phw_data_t pHwData, u16 beacon_period )
{
u32 tmp;
@@ -476,7 +383,7 @@ void hal_set_beacon_period( phw_data_t pHwData, u16 beacon_period )
}
-void hal_set_current_channel_ex( phw_data_t pHwData, ChanInfo channel )
+static void hal_set_current_channel_ex( phw_data_t pHwData, ChanInfo channel )
{
struct wb35_reg *reg = &pHwData->reg;
@@ -502,12 +409,6 @@ void hal_set_current_channel( phw_data_t pHwData, ChanInfo channel )
hal_set_current_channel_ex( pHwData, channel );
}
//---------------------------------------------------------------------------------------------------
-void hal_get_current_channel( phw_data_t pHwData, ChanInfo *channel )
-{
- channel->ChanNo = pHwData->Channel;
- channel->band = pHwData->band;
-}
-//---------------------------------------------------------------------------------------------------
void hal_set_accept_broadcast( phw_data_t pHwData, u8 enable )
{
struct wb35_reg *reg = &pHwData->reg;
@@ -565,46 +466,6 @@ void hal_set_accept_beacon( phw_data_t pHwData, u8 enable )
Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
}
//---------------------------------------------------------------------------------------------------
-void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number )
-{
- struct wb35_reg *reg = &pHwData->reg;
- u8 Byte, Bit;
-
- if( pHwData->SurpriseRemove ) return;
-
- //Erases and refills the card multicast registers. Used when an address
- // has been deleted and all bits must be recomputed.
- reg->M04_MulticastAddress1 = 0;
- reg->M08_MulticastAddress2 = 0;
-
- while( number )
- {
- number--;
- CardGetMulticastBit( (address+(number*ETH_LENGTH_OF_ADDRESS)), &Byte, &Bit);
- reg->Multicast[Byte] |= Bit;
- }
-
- // Updating register
- Wb35Reg_BurstWrite( pHwData, 0x0804, (u32 *)reg->Multicast, 2, AUTO_INCREMENT );
-}
-//---------------------------------------------------------------------------------------------------
-u8 hal_get_accept_beacon( phw_data_t pHwData )
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if( pHwData->SurpriseRemove ) return 0;
-
- if( reg->M00_MacControl & 0x04000000 )
- return 1;
- else
- return 0;
-}
-
-unsigned char hal_reset_hardware( phw_data_t pHwData, void* ppa )
-{
- // Not implement yet
- return true;
-}
void hal_stop( phw_data_t pHwData )
{
@@ -631,115 +492,11 @@ unsigned char hal_idle(phw_data_t pHwData)
return true;
}
//---------------------------------------------------------------------------------------------------
-void hal_set_cwmin( phw_data_t pHwData, u8 cwin_min )
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if( pHwData->SurpriseRemove ) return;
-
- pHwData->cwmin = cwin_min;
- reg->M2C_MacControl &= ~0x7c00; //bit 10 ~ 14
- reg->M2C_MacControl |= (pHwData->cwmin<<10);
- Wb35Reg_Write( pHwData, 0x082c, reg->M2C_MacControl );
-}
-
-s32 hal_get_rssi( phw_data_t pHwData, u32 *HalRssiArry, u8 Count )
-{
- struct wb35_reg *reg = &pHwData->reg;
- R01_DESCRIPTOR r01;
- s32 ltmp = 0, tmp;
- u8 i;
-
- if( pHwData->SurpriseRemove ) return -200;
- if( Count > MAX_ACC_RSSI_COUNT ) // Because the TS may use this funtion
- Count = MAX_ACC_RSSI_COUNT;
-
- // RSSI = C1 + C2 * (agc_state[7:0] + offset_map(lna_state[1:0]))
- // C1 = -195, C2 = 0.66 = 85/128
- for (i=0; i<Count; i++)
- {
- r01.value = HalRssiArry[i];
- tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
- ltmp += tmp;
- }
- ltmp /= Count;
- if( pHwData->phy_type == RF_AIROHA_2230 ) ltmp -= 5; // 10;
- if( pHwData->phy_type == RF_AIROHA_2230S ) ltmp -= 5; // 10; 20060420 Add this
-
- //if( ltmp < -200 ) ltmp = -200;
- if( ltmp < -110 ) ltmp = -110;// 1.0.24.0 For NJRC
-
- return ltmp;
-}
-//----------------------------------------------------------------------------------------------------
-s32 hal_get_rssi_bss(struct wbsoft_priv *adapter, u16 idx, u8 Count)
-{
- phw_data_t pHwData = &adapter->sHwData;
- struct wb35_reg *reg = &pHwData->reg;
- R01_DESCRIPTOR r01;
- s32 ltmp = 0, tmp;
- u8 i, j;
-// u32 *HalRssiArry = psBSS(idx)->HalRssi;
-
- if( pHwData->SurpriseRemove ) return -200;
- if( Count > MAX_ACC_RSSI_COUNT ) // Because the TS may use this funtion
- Count = MAX_ACC_RSSI_COUNT;
-
- // RSSI = C1 + C2 * (agc_state[7:0] + offset_map(lna_state[1:0]))
- // C1 = -195, C2 = 0.66 = 85/128
-#if 0
- for (i=0; i<Count; i++)
- {
- r01.value = HalRssiArry[i];
- tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
- ltmp += tmp;
- }
-#else
- if (psBSS(idx)->HalRssiIndex == 0)
- psBSS(idx)->HalRssiIndex = MAX_ACC_RSSI_COUNT;
- j = (u8)psBSS(idx)->HalRssiIndex-1;
-
- for (i=0; i<Count; i++)
- {
- r01.value = psBSS(idx)->HalRssi[j];
- tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
- ltmp += tmp;
- if (j == 0)
- {
- j = MAX_ACC_RSSI_COUNT;
- }
- j--;
- }
-#endif
- ltmp /= Count;
- if( pHwData->phy_type == RF_AIROHA_2230 ) ltmp -= 5; // 10;
- if( pHwData->phy_type == RF_AIROHA_2230S ) ltmp -= 5; // 10; 20060420 Add this
-
- //if( ltmp < -200 ) ltmp = -200;
- if( ltmp < -110 ) ltmp = -110;// 1.0.24.0 For NJRC
-
- return ltmp;
-}
-
-//---------------------------------------------------------------------------
-
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);
-}
-
void hal_set_radio_mode( phw_data_t pHwData, unsigned char radio_off)
{
struct wb35_reg *reg = &pHwData->reg;
@@ -769,22 +526,6 @@ u8 hal_get_antenna_number( phw_data_t pHwData )
return 1;
}
-void hal_set_antenna_number( phw_data_t pHwData, u8 number )
-{
-
- struct wb35_reg *reg = &pHwData->reg;
-
- if (number == 1) {
- reg->BB2C |= BIT(11);
- } else {
- reg->BB2C &= ~BIT(11);
- }
- Wb35Reg_Write( pHwData, 0x102c, reg->BB2C );
-#ifdef _PE_STATE_DUMP_
- WBDEBUG(("Current antenna number : %d\n", number));
-#endif
-}
-
//----------------------------------------------------------------------------------------------------
//0 : radio on; 1: radio off
u8 hal_get_hw_radio_off( phw_data_t pHwData )
@@ -821,57 +562,7 @@ unsigned char hal_set_dxx_reg( phw_data_t pHwData, u16 number, u32 value )
return ret;
}
-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)
-{
- if( PowerState != 0 )
- {
- pHwData->SurpriseRemove = 1;
- if( pHwData->WbUsb.IsUsb20 )
- hal_stop( pHwData );
- }
- else
- {
- if( !pHwData->WbUsb.IsUsb20 )
- hal_stop( pHwData );
- }
-}
-
-void hal_surprise_remove(struct wbsoft_priv *adapter)
-{
- phw_data_t pHwData = &adapter->sHwData;
-
- if (atomic_inc_return( &pHwData->SurpriseRemoveCount ) == 1) {
- #ifdef _PE_STATE_DUMP_
- WBDEBUG(("Calling hal_surprise_remove\n"));
- #endif
- }
-}
-
-void hal_rate_change(struct wbsoft_priv *adapter) // Notify the HAL rate is changing 20060613.1
-{
- phw_data_t pHwData = &adapter->sHwData;
- u8 rate = CURRENT_TX_RATE;
-
- BBProcessor_RateChanging( pHwData, rate );
-}
-
void hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
{
RFSynthesizer_SetPowerIndex( pHwData, PowerIndex );
}
-
-unsigned char hal_set_LED(phw_data_t pHwData, u32 Mode) // 20061108 for WPS led control
-{
- pHwData->LED_Blinking = 0;
- pHwData->LED_control = Mode;
- pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(10);
- add_timer(&pHwData->LEDTimer);
- return true;
-}
-
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index dc5709f..e805f40 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -26,9 +26,6 @@ void hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, u
void hal_get_power_save_mode( phw_data_t pHwData, u8 *pin_pwr_save );
void hal_set_slot_time( phw_data_t pHwData, u8 type );
#define hal_set_atim_window( _A, _ATM )
-void hal_set_rates( phw_data_t pHwData, u8 *pbss_rates, u8 length, unsigned char basic_rate_set );
-#define hal_set_basic_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, TRUE )
-#define hal_set_op_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, FALSE )
void hal_start_bss( phw_data_t pHwData, u8 mac_op_mode );
void hal_join_request( phw_data_t pHwData, u8 bss_type ); // 0:BSS STA 1:IBSS STA//
void hal_stop_sync_bss( phw_data_t pHwData );
@@ -41,35 +38,23 @@ void hal_set_listen_interval( phw_data_t pHwData, u16 listen_interval );
void hal_set_cap_info( phw_data_t pHwData, u16 capability_info );
void hal_set_ssid( phw_data_t pHwData, u8 *pssid, u8 ssid_len );
void hal_set_current_channel( phw_data_t pHwData, ChanInfo channel );
-void hal_set_current_channel_ex( phw_data_t pHwData, ChanInfo channel );
-void hal_get_current_channel( phw_data_t pHwData, ChanInfo *channel );
void hal_set_accept_broadcast( phw_data_t pHwData, u8 enable );
void hal_set_accept_multicast( phw_data_t pHwData, u8 enable );
void hal_set_accept_beacon( phw_data_t pHwData, u8 enable );
-void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number );
-u8 hal_get_accept_beacon( phw_data_t pHwData );
void hal_stop( phw_data_t pHwData );
void hal_halt( phw_data_t pHwData, void *ppa_data );
void hal_start_tx0( phw_data_t pHwData );
void hal_set_phy_type( phw_data_t pHwData, u8 PhyType );
-void hal_get_phy_type( phw_data_t pHwData, u8 *PhyType );
-unsigned char hal_reset_hardware( phw_data_t pHwData, void* ppa );
-void hal_set_cwmin( phw_data_t pHwData, u8 cwin_min );
#define hal_get_cwmin( _A ) ( (_A)->cwmin )
void hal_set_cwmax( phw_data_t pHwData, u16 cwin_max );
#define hal_get_cwmax( _A ) ( (_A)->cwmax )
void hal_set_rsn_wpa( phw_data_t pHwData, u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
-//s32 hal_get_rssi( phw_data_t pHwData, u32 HalRssi );
-s32 hal_get_rssi( phw_data_t pHwData, u32 *HalRssiArry, u8 Count );
-s32 hal_get_rssi_bss(struct wbsoft_priv *adapter, u16 idx, u8 Count);
void hal_set_connect_info( phw_data_t pHwData, unsigned char boConnect );
u8 hal_get_est_sq3( phw_data_t pHwData, u8 Count );
void hal_set_rf_power( phw_data_t pHwData, u8 PowerIndex ); // 20060621 Modify
-void hal_reset_counter( phw_data_t pHwData );
void hal_set_radio_mode( phw_data_t pHwData, unsigned char boValue);
void hal_descriptor_indicate( phw_data_t pHwData, PDESCRIPTOR pDes );
u8 hal_get_antenna_number( phw_data_t pHwData );
-void hal_set_antenna_number( phw_data_t pHwData, u8 number );
u32 hal_get_bss_pk_cnt( phw_data_t pHwData );
#define hal_get_region_from_EEPROM( _A ) ( (_A)->reg.EEPROMRegion )
void hal_set_accept_promiscuous ( phw_data_t pHwData, u8 enable);
@@ -80,20 +65,13 @@ u8 hal_get_hw_radio_off ( phw_data_t pHwData );
#define hal_rssi_boundary_high( _A ) (_A->RSSI_high)
#define hal_rssi_boundary_low( _A ) (_A->RSSI_low)
#define hal_scan_interval( _A ) (_A->Scan_Interval)
-void hal_scan_status_indicate( phw_data_t pHwData, u8 status); // 0: complete, 1: in progress
-void hal_system_power_change( phw_data_t pHwData, u32 PowerState ); // 20051230 -=D0 1=D1 ..
-void hal_surprise_remove(struct wbsoft_priv *adapter);
#define PHY_DEBUG( msg, args... )
-
-
-void hal_rate_change(struct wbsoft_priv *adapter); // Notify the HAL rate is changing 20060613.1
unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, u32 * pValue );
unsigned char hal_set_dxx_reg( phw_data_t pHwData, u16 number, u32 value );
#define hal_get_time_count( _P ) (_P->time_count/10) // return 100ms count
#define hal_detect_error( _P ) (_P->WbUsb.DetectCount)
-unsigned char hal_set_LED( phw_data_t pHwData, u32 Mode ); // 20061108 for WPS led control
//-------------------------------------------------------------------------
// The follow function is unused for IS89C35
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/7] w35und: remove rxisr.c as dead code
2008-10-30 17:04 ` [PATCH 6/7] w35und: remove dead code from wbhal.c Pekka Enberg
@ 2008-10-30 17:04 ` Pekka Enberg
2008-10-30 19:29 ` Pavel Machek
0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 17:04 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek
The vRxTimerStart() function is never called nor does the timer do anything
useful so remove the code.
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/Makefile | 1 -
drivers/staging/winbond/mds.c | 3 ---
drivers/staging/winbond/mds_f.h | 5 -----
drivers/staging/winbond/mds_s.h | 2 --
drivers/staging/winbond/rxisr.c | 28 ----------------------------
drivers/staging/winbond/sysdef.h | 3 ---
6 files changed, 0 insertions(+), 42 deletions(-)
delete mode 100644 drivers/staging/winbond/rxisr.c
diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile
index d337571..b49c973 100644
--- a/drivers/staging/winbond/Makefile
+++ b/drivers/staging/winbond/Makefile
@@ -4,7 +4,6 @@ w35und-objs := \
mto.o \
phy_calibration.o \
reg.o \
- rxisr.o \
wb35reg.o \
wb35rx.o \
wb35tx.o \
diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
index 0dd1eec..8b638d7 100644
--- a/drivers/staging/winbond/mds.c
+++ b/drivers/staging/winbond/mds.c
@@ -16,15 +16,12 @@ Mds_initial(struct wbsoft_priv * adapter)
pMds->TxRTSThreshold = DEFAULT_RTSThreshold;
pMds->TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
- vRxTimerInit(adapter);//for WPA countermeasure
-
return hal_get_tx_buffer( &adapter->sHwData, &pMds->pTxBuffer );
}
void
Mds_Destroy(struct wbsoft_priv * adapter)
{
- vRxTimerStop(adapter);
}
static void Mds_DurationSet(struct wbsoft_priv *adapter, PDESCRIPTOR pDes, u8 *buffer)
diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h
index 8109eba..ee0f120 100644
--- a/drivers/staging/winbond/mds_f.h
+++ b/drivers/staging/winbond/mds_f.h
@@ -11,11 +11,6 @@ void Mds_SendComplete( struct wbsoft_priv *adapter, PT02_DESCRIPTOR pT02 );
void Mds_MpduProcess( struct wbsoft_priv *adapter, PDESCRIPTOR pRxDes );
extern void DataDmp(u8 *pdata, u32 len, u32 offset);
-
-void vRxTimerInit(struct wbsoft_priv *adapter);
-void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value);
-void vRxTimerStop(struct wbsoft_priv *adapter);
-
// For Asynchronous indicating. The routine collocates with USB.
void Mds_MsduProcess( struct wbsoft_priv *adapter, PRXLAYER1 pRxLayer1, u8 SlotIndex);
diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h
index 29f1568..ebf61e3 100644
--- a/drivers/staging/winbond/mds_s.h
+++ b/drivers/staging/winbond/mds_s.h
@@ -142,8 +142,6 @@ typedef struct _MDS
u8 boCounterMeasureBlock;
u8 reserved_4[2];
- struct timer_list timer;
-
u32 TxTsc; // 20060214
u32 TxTsc_2; // 20060214
diff --git a/drivers/staging/winbond/rxisr.c b/drivers/staging/winbond/rxisr.c
deleted file mode 100644
index f4619d9..0000000
--- a/drivers/staging/winbond/rxisr.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "sysdef.h"
-#include "core.h"
-
-static void RxTimerHandler(unsigned long data)
-{
- WARN_ON(1);
-}
-
-void vRxTimerInit(struct wbsoft_priv *adapter)
-{
- init_timer(&adapter->Mds.timer);
- adapter->Mds.timer.function = RxTimerHandler;
- adapter->Mds.timer.data = (unsigned long) adapter;
-}
-
-void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value)
-{
- if (timeout_value < MIN_TIMEOUT_VAL)
- timeout_value = MIN_TIMEOUT_VAL;
-
- adapter->Mds.timer.expires = jiffies + msecs_to_jiffies(timeout_value);
- add_timer(&adapter->Mds.timer);
-}
-
-void vRxTimerStop(struct wbsoft_priv *adapter)
-{
- del_timer_sync(&adapter->Mds.timer);
-}
diff --git a/drivers/staging/winbond/sysdef.h b/drivers/staging/winbond/sysdef.h
index 60e4c04..251b9c5 100644
--- a/drivers/staging/winbond/sysdef.h
+++ b/drivers/staging/winbond/sysdef.h
@@ -37,7 +37,4 @@
#define _PE_USB_INI_DUMP_
#endif
-// Kernel Timer resolution, NDIS is 10ms, 10000us
-#define MIN_TIMEOUT_VAL (10) //ms
-
#endif
--
1.5.3.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 7/7] w35und: remove rxisr.c as dead code
2008-10-30 17:04 ` [PATCH 7/7] w35und: remove rxisr.c as dead code Pekka Enberg
@ 2008-10-30 19:29 ` Pavel Machek
2008-11-12 21:58 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2008-10-30 19:29 UTC (permalink / raw)
To: Pekka Enberg; +Cc: greg, linux-kernel
On Thu 2008-10-30 19:04:56, Pekka Enberg wrote:
> The vRxTimerStart() function is never called nor does the timer do anything
> useful so remove the code.
Whole series:
Acked-by: Pavel Machek <pavel@suse.cz>
...and thanks for doing that. The driver really needed it.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 7/7] w35und: remove rxisr.c as dead code
2008-10-30 19:29 ` Pavel Machek
@ 2008-11-12 21:58 ` Greg KH
0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2008-11-12 21:58 UTC (permalink / raw)
To: Pavel Machek; +Cc: Pekka Enberg, linux-kernel
On Thu, Oct 30, 2008 at 08:29:03PM +0100, Pavel Machek wrote:
> On Thu 2008-10-30 19:04:56, Pekka Enberg wrote:
> > The vRxTimerStart() function is never called nor does the timer do anything
> > useful so remove the code.
>
> Whole series:
>
> Acked-by: Pavel Machek <pavel@suse.cz>
>
> ...and thanks for doing that. The driver really needed it.
I concur, thanks a lot for this work. I should now be all caught up
with the patches you have sent me. If I've missed any, please let me
know.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-11-12 22:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-30 17:04 [PATCH 1/7] w35und: make functions local to mds.c static Pekka Enberg
2008-10-30 17:04 ` [PATCH 2/7] w35und: make functions local to mlmetxrx.c static Pekka Enberg
2008-10-30 17:04 ` [PATCH 3/7] w35und: remove dead code from mto.c Pekka Enberg
2008-10-30 17:04 ` [PATCH 4/7] w35und: make functions local to wb35rx.c static Pekka Enberg
2008-10-30 17:04 ` [PATCH 5/7] w35und: make functions local to wb35tx.c static Pekka Enberg
2008-10-30 17:04 ` [PATCH 6/7] w35und: remove dead code from wbhal.c Pekka Enberg
2008-10-30 17:04 ` [PATCH 7/7] w35und: remove rxisr.c as dead code Pekka Enberg
2008-10-30 19:29 ` Pavel Machek
2008-11-12 21:58 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.