Staging: rt28x0: run *.c files through Lindent
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
460bb8df1e
commit
66cd8d6ec9
@ -39,12 +39,10 @@
|
||||
|
||||
#include "../rt_config.h"
|
||||
|
||||
|
||||
#ifndef RTMP_RF_RW_SUPPORT
|
||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||
#endif // RTMP_RF_RW_SUPPORT //
|
||||
|
||||
|
||||
VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT i;
|
||||
@ -52,61 +50,55 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
|
||||
// Driver must read EEPROM to get RfIcType before initial RF registers
|
||||
// Initialize RF register to default value
|
||||
if (IS_RT3070(pAd) || IS_RT3071(pAd))
|
||||
{
|
||||
if (IS_RT3070(pAd) || IS_RT3071(pAd)) {
|
||||
// Init RF calibration
|
||||
// Driver should toggle RF R30 bit7 before init RF registers
|
||||
UINT32 RfReg = 0;
|
||||
UINT32 data;
|
||||
|
||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
|
||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg);
|
||||
RfReg |= 0x80;
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||
RTMPusecDelay(1000);
|
||||
RfReg &= 0x7F;
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||
|
||||
// Initialize RF register to default value
|
||||
for (i = 0; i < NUM_RF_REG_PARMS; i++)
|
||||
{
|
||||
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
|
||||
for (i = 0; i < NUM_RF_REG_PARMS; i++) {
|
||||
RT30xxWriteRFRegister(pAd,
|
||||
RT30xx_RFRegTable[i].Register,
|
||||
RT30xx_RFRegTable[i].Value);
|
||||
}
|
||||
|
||||
// add by johnli
|
||||
if (IS_RT3070(pAd))
|
||||
{
|
||||
if (IS_RT3070(pAd)) {
|
||||
//
|
||||
// The DAC issue(LDO_CFG0) has been fixed in RT3070(F).
|
||||
// The voltage raising patch is no longer needed for RT3070(F)
|
||||
//
|
||||
if ((pAd->MACVersion & 0xffff) < 0x0201)
|
||||
{
|
||||
if ((pAd->MACVersion & 0xffff) < 0x0201) {
|
||||
// Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate
|
||||
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
||||
data = ((data & 0xF0FFFFFF) | 0x0D000000);
|
||||
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
|
||||
}
|
||||
}
|
||||
else if (IS_RT3071(pAd))
|
||||
{
|
||||
} else if (IS_RT3071(pAd)) {
|
||||
// Driver should set RF R6 bit6 on before init RF registers
|
||||
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
|
||||
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg);
|
||||
RfReg |= 0x40;
|
||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg);
|
||||
|
||||
// init R31
|
||||
RT30xxWriteRFRegister(pAd, RF_R31, 0x14);
|
||||
|
||||
// RT3071 version E has fixed this issue
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
|
||||
{
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1)
|
||||
&& ((pAd->MACVersion & 0xffff) < 0x0211)) {
|
||||
// patch tx EVM issue temporarily
|
||||
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
||||
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
||||
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||
@ -117,7 +109,6 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
data &= ~(0x20);
|
||||
RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data);
|
||||
}
|
||||
|
||||
//For RF filter Calibration
|
||||
RTMPFilterCalibration(pAd);
|
||||
|
||||
@ -126,15 +117,12 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||
// Raising RF voltage is no longer needed for RT3070(F)
|
||||
//
|
||||
if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201))
|
||||
{
|
||||
if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) {
|
||||
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
|
||||
} else if ((IS_RT3071(pAd))
|
||||
&& ((pAd->MACVersion & 0xffff) < 0x0211)) {
|
||||
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
|
||||
}
|
||||
else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211))
|
||||
{
|
||||
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
|
||||
}
|
||||
|
||||
// set led open drain enable
|
||||
RTUSBReadMACRegister(pAd, OPT_14, &data);
|
||||
data |= 0x01;
|
||||
@ -145,29 +133,25 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
|
||||
RFValue &= (~0x08);
|
||||
// to fix rx long range issue
|
||||
if (pAd->NicConfig2.field.ExternalLNAForG == 0)
|
||||
{
|
||||
if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd))
|
||||
{
|
||||
if (pAd->NicConfig2.field.ExternalLNAForG == 0) {
|
||||
if ((IS_RT3071(pAd)
|
||||
&& ((pAd->MACVersion & 0xffff) >= 0x0211))
|
||||
|| IS_RT3070(pAd)) {
|
||||
RFValue |= 0x20;
|
||||
}
|
||||
}
|
||||
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
|
||||
if (pAd->TxMixerGain24G >= 1)
|
||||
{
|
||||
if (pAd->TxMixerGain24G >= 1) {
|
||||
RFValue &= (~0x7); // clean bit [2:0]
|
||||
RFValue |= pAd->TxMixerGain24G;
|
||||
}
|
||||
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
|
||||
|
||||
if (IS_RT3071(pAd))
|
||||
{
|
||||
if (IS_RT3071(pAd)) {
|
||||
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
|
||||
RT30xxLoadRFNormalModeSetup(pAd);
|
||||
}
|
||||
else if (IS_RT3070(pAd))
|
||||
{
|
||||
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/
|
||||
} else if (IS_RT3070(pAd)) {
|
||||
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */
|
||||
// LDORF_VC, RF R27 register Bit 2 to 0
|
||||
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||
|
@ -39,44 +39,39 @@
|
||||
|
||||
#include "../rt_config.h"
|
||||
|
||||
|
||||
#ifndef RTMP_RF_RW_SUPPORT
|
||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||
#endif // RTMP_RF_RW_SUPPORT //
|
||||
|
||||
|
||||
VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT i;
|
||||
// Driver must read EEPROM to get RfIcType before initial RF registers
|
||||
// Initialize RF register to default value
|
||||
if (IS_RT3090(pAd))
|
||||
{
|
||||
if (IS_RT3090(pAd)) {
|
||||
// Init RF calibration
|
||||
// Driver should toggle RF R30 bit7 before init RF registers
|
||||
UINT32 RfReg = 0, data;
|
||||
|
||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
|
||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg);
|
||||
RfReg |= 0x80;
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||
RTMPusecDelay(1000);
|
||||
RfReg &= 0x7F;
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||
|
||||
// init R24, R31
|
||||
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
|
||||
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
|
||||
|
||||
// RT309x version E has fixed this issue
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
|
||||
{
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1)
|
||||
&& ((pAd->MACVersion & 0xffff) < 0x0211)) {
|
||||
// patch tx EVM issue temporarily
|
||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||
@ -88,15 +83,16 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
|
||||
|
||||
// Initialize RF register to default value
|
||||
for (i = 0; i < NUM_RF_REG_PARMS; i++)
|
||||
{
|
||||
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
|
||||
for (i = 0; i < NUM_RF_REG_PARMS; i++) {
|
||||
RT30xxWriteRFRegister(pAd,
|
||||
RT30xx_RFRegTable[i].Register,
|
||||
RT30xx_RFRegTable[i].Value);
|
||||
}
|
||||
|
||||
// Driver should set RF R6 bit6 on before calibration
|
||||
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
|
||||
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg);
|
||||
RfReg |= 0x40;
|
||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
|
||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg);
|
||||
|
||||
//For RF filter Calibration
|
||||
RTMPFilterCalibration(pAd);
|
||||
|
@ -35,55 +35,67 @@
|
||||
-------- ---------- ----------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifdef RT30xx
|
||||
|
||||
|
||||
#ifndef RTMP_RF_RW_SUPPORT
|
||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||
#endif // RTMP_RF_RW_SUPPORT //
|
||||
|
||||
#include "../rt_config.h"
|
||||
|
||||
|
||||
//
|
||||
// RF register initialization set
|
||||
//
|
||||
REG_PAIR RT30xx_RFRegTable[] = {
|
||||
{RF_R04, 0x40},
|
||||
{RF_R05, 0x03},
|
||||
{RF_R06, 0x02},
|
||||
{RF_R07, 0x70},
|
||||
{RF_R09, 0x0F},
|
||||
{RF_R10, 0x41},
|
||||
{RF_R11, 0x21},
|
||||
{RF_R12, 0x7B},
|
||||
{RF_R14, 0x90},
|
||||
{RF_R15, 0x58},
|
||||
{RF_R16, 0xB3},
|
||||
{RF_R17, 0x92},
|
||||
{RF_R18, 0x2C},
|
||||
{RF_R19, 0x02},
|
||||
{RF_R20, 0xBA},
|
||||
{RF_R21, 0xDB},
|
||||
{RF_R24, 0x16},
|
||||
{RF_R25, 0x01},
|
||||
{RF_R29, 0x1F},
|
||||
{RF_R04, 0x40}
|
||||
,
|
||||
{RF_R05, 0x03}
|
||||
,
|
||||
{RF_R06, 0x02}
|
||||
,
|
||||
{RF_R07, 0x70}
|
||||
,
|
||||
{RF_R09, 0x0F}
|
||||
,
|
||||
{RF_R10, 0x41}
|
||||
,
|
||||
{RF_R11, 0x21}
|
||||
,
|
||||
{RF_R12, 0x7B}
|
||||
,
|
||||
{RF_R14, 0x90}
|
||||
,
|
||||
{RF_R15, 0x58}
|
||||
,
|
||||
{RF_R16, 0xB3}
|
||||
,
|
||||
{RF_R17, 0x92}
|
||||
,
|
||||
{RF_R18, 0x2C}
|
||||
,
|
||||
{RF_R19, 0x02}
|
||||
,
|
||||
{RF_R20, 0xBA}
|
||||
,
|
||||
{RF_R21, 0xDB}
|
||||
,
|
||||
{RF_R24, 0x16}
|
||||
,
|
||||
{RF_R25, 0x01}
|
||||
,
|
||||
{RF_R29, 0x1F}
|
||||
,
|
||||
};
|
||||
|
||||
UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR));
|
||||
|
||||
|
||||
|
||||
// Antenna divesity use GPIO3 and EESK pin for control
|
||||
// Antenna and EEPROM access are both using EESK pin,
|
||||
// Therefor we should avoid accessing EESK at the same time
|
||||
// Then restore antenna after EEPROM access
|
||||
// The original name of this function is AsicSetRxAnt(), now change to
|
||||
//VOID AsicSetRxAnt(
|
||||
VOID RT30xxSetRxAnt(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR Ant)
|
||||
VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant)
|
||||
{
|
||||
UINT32 Value;
|
||||
#ifdef RTMP_MAC_PCI
|
||||
@ -94,14 +106,11 @@ VOID RT30xxSetRxAnt(
|
||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) ||
|
||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) ||
|
||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) ||
|
||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
|
||||
{
|
||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// the antenna selection is through firmware and MAC register(GPIO3)
|
||||
if (Ant == 0)
|
||||
{
|
||||
if (Ant == 0) {
|
||||
// Main antenna
|
||||
#ifdef RTMP_MAC_PCI
|
||||
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
||||
@ -114,10 +123,9 @@ VOID RT30xxSetRxAnt(
|
||||
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
|
||||
Value &= ~(0x0808);
|
||||
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("AsicSetRxAnt, switch to main antenna\n"));
|
||||
} else {
|
||||
// Aux antenna
|
||||
#ifdef RTMP_MAC_PCI
|
||||
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
||||
@ -130,11 +138,11 @@ VOID RT30xxSetRxAnt(
|
||||
Value &= ~(0x0808);
|
||||
Value |= 0x08;
|
||||
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n"));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("AsicSetRxAnt, switch to aux antenna\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@ -151,10 +159,9 @@ VOID RT30xxSetRxAnt(
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
VOID RTMPFilterCalibration(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0;
|
||||
UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue = 0;
|
||||
UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0;
|
||||
UCHAR RF_R24_Value = 0;
|
||||
|
||||
@ -162,35 +169,33 @@ VOID RTMPFilterCalibration(
|
||||
pAd->Mlme.CaliBW20RfR24 = 0x1F;
|
||||
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
if (loop == 1) //BandWidth = 40 MHz
|
||||
{
|
||||
// Write 0x27 to RF_R24 to program filter
|
||||
RF_R24_Value = 0x27;
|
||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
|
||||
if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))
|
||||
FilterTarget = 0x15;
|
||||
else
|
||||
FilterTarget = 0x19;
|
||||
|
||||
// when calibrate BW40, BBP mask must set to BW40.
|
||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
|
||||
BBPValue&= (~0x18);
|
||||
BBPValue|= (0x10);
|
||||
BBPValue &= (~0x18);
|
||||
BBPValue |= (0x10);
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
|
||||
|
||||
// set to BW40
|
||||
RT30xxReadRFRegister(pAd, RF_R31, &value);
|
||||
value |= 0x20;
|
||||
RT30xxWriteRFRegister(pAd, RF_R31, value);
|
||||
}
|
||||
else //BandWidth = 20 MHz
|
||||
} else //BandWidth = 20 MHz
|
||||
{
|
||||
// Write 0x07 to RF_R24 to program filter
|
||||
RF_R24_Value = 0x07;
|
||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
|
||||
if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))
|
||||
FilterTarget = 0x13;
|
||||
else
|
||||
FilterTarget = 0x16;
|
||||
@ -209,8 +214,7 @@ VOID RTMPFilterCalibration(
|
||||
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
// Write 0x90 to BBP_R25 to transmit test tone
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
|
||||
|
||||
@ -224,8 +228,7 @@ VOID RTMPFilterCalibration(
|
||||
// Write 0x06 to BBP_R24 to set power & frequency of stopband test tone
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
while (TRUE) {
|
||||
// Write 0x90 to BBP_R25 to transmit test tone
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
|
||||
|
||||
@ -233,59 +236,47 @@ VOID RTMPFilterCalibration(
|
||||
RTMPusecDelay(1000);
|
||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
|
||||
value &= 0xFF;
|
||||
if ((R55x - value) < FilterTarget)
|
||||
{
|
||||
RF_R24_Value ++;
|
||||
}
|
||||
else if ((R55x - value) == FilterTarget)
|
||||
{
|
||||
RF_R24_Value ++;
|
||||
count ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((R55x - value) < FilterTarget) {
|
||||
RF_R24_Value++;
|
||||
} else if ((R55x - value) == FilterTarget) {
|
||||
RF_R24_Value++;
|
||||
count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
// prevent infinite loop cause driver hang.
|
||||
if (loopcnt++ > 100)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt));
|
||||
if (loopcnt++ > 100) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating",
|
||||
loopcnt));
|
||||
break;
|
||||
}
|
||||
|
||||
// Write RF_R24 to program filter
|
||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (count > 0) {
|
||||
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
|
||||
}
|
||||
|
||||
// Store for future usage
|
||||
if (loopcnt < 100)
|
||||
{
|
||||
if (loop++ == 0)
|
||||
{
|
||||
if (loopcnt < 100) {
|
||||
if (loop++ == 0) {
|
||||
//BandWidth = 20 MHz
|
||||
pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
pAd->Mlme.CaliBW20RfR24 = (UCHAR) RF_R24_Value;
|
||||
} else {
|
||||
//BandWidth = 40 MHz
|
||||
pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value;
|
||||
pAd->Mlme.CaliBW40RfR24 = (UCHAR) RF_R24_Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
break;
|
||||
|
||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||
|
||||
// reset count
|
||||
count = 0;
|
||||
} while(TRUE);
|
||||
} while (TRUE);
|
||||
|
||||
//
|
||||
// Set back to initial state
|
||||
@ -298,13 +289,14 @@ VOID RTMPFilterCalibration(
|
||||
|
||||
// set BBP back to BW20
|
||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
|
||||
BBPValue&= (~0x18);
|
||||
BBPValue &= (~0x18);
|
||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n",
|
||||
pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
|
||||
}
|
||||
|
||||
|
||||
// add by johnli, RF power sequence setup
|
||||
/*
|
||||
==========================================================================
|
||||
@ -314,8 +306,7 @@ VOID RTMPFilterCalibration(
|
||||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID RT30xxLoadRFNormalModeSetup(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR RFValue;
|
||||
|
||||
@ -357,7 +348,7 @@ VOID RT30xxLoadRFNormalModeSetup(
|
||||
RFValue &= (~0x08);
|
||||
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
|
||||
|
||||
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/
|
||||
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */
|
||||
// LDORF_VC, RF R27 register Bit 2 to 0
|
||||
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||
@ -381,15 +372,13 @@ VOID RT30xxLoadRFNormalModeSetup(
|
||||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID RT30xxLoadRFSleepModeSetup(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR RFValue;
|
||||
UINT32 MACValue;
|
||||
|
||||
|
||||
#ifdef RTMP_MAC_USB
|
||||
if(!IS_RT3572(pAd))
|
||||
if (!IS_RT3572(pAd))
|
||||
#endif // RTMP_MAC_USB //
|
||||
{
|
||||
// RF_BLOCK_en. RF R1 register Bit 0 to 0
|
||||
@ -415,8 +404,7 @@ VOID RT30xxLoadRFSleepModeSetup(
|
||||
|
||||
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
||||
IS_RT3572(pAd) ||
|
||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
|
||||
{
|
||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) {
|
||||
#ifdef RTMP_MAC_USB
|
||||
if (!IS_RT3572(pAd))
|
||||
#endif // RTMP_MAC_USB //
|
||||
@ -440,14 +428,13 @@ VOID RT30xxLoadRFSleepModeSetup(
|
||||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID RT30xxReverseRFSleepModeSetup(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR RFValue;
|
||||
UINT32 MACValue;
|
||||
|
||||
#ifdef RTMP_MAC_USB
|
||||
if(!IS_RT3572(pAd))
|
||||
if (!IS_RT3572(pAd))
|
||||
#endif // RTMP_MAC_USB //
|
||||
{
|
||||
// RF_BLOCK_en, RF R1 register Bit 0 to 1
|
||||
@ -474,8 +461,7 @@ VOID RT30xxReverseRFSleepModeSetup(
|
||||
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
||||
IS_RT3572(pAd) ||
|
||||
IS_RT3390(pAd) ||
|
||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
|
||||
{
|
||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) {
|
||||
#ifdef RTMP_MAC_USB
|
||||
if (!IS_RT3572(pAd))
|
||||
#endif // RTMP_MAC_USB //
|
||||
@ -487,48 +473,41 @@ VOID RT30xxReverseRFSleepModeSetup(
|
||||
RFValue = (RFValue & (~0x77));
|
||||
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
|
||||
}
|
||||
|
||||
// RT3071 version E has fixed this issue
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
|
||||
{
|
||||
if ((pAd->NicConfig2.field.DACTestBit == 1)
|
||||
&& ((pAd->MACVersion & 0xffff) < 0x0211)) {
|
||||
// patch tx EVM issue temporarily
|
||||
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
||||
MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000);
|
||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
||||
MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000);
|
||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
||||
}
|
||||
}
|
||||
|
||||
if(IS_RT3572(pAd))
|
||||
if (IS_RT3572(pAd))
|
||||
RT30xxWriteRFRegister(pAd, RF_R08, 0x80);
|
||||
}
|
||||
|
||||
// end johnli
|
||||
|
||||
VOID RT30xxHaltAction(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UINT32 TxPinCfg = 0x00050F0F;
|
||||
|
||||
//
|
||||
// Turn off LNA_PE or TRSW_POL
|
||||
//
|
||||
if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd))
|
||||
{
|
||||
if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) {
|
||||
if ((IS_RT3071(pAd) || IS_RT3572(pAd))
|
||||
#ifdef RTMP_EFUSE_SUPPORT
|
||||
&& (pAd->bUseEfuse)
|
||||
#endif // RTMP_EFUSE_SUPPORT //
|
||||
)
|
||||
{
|
||||
) {
|
||||
TxPinCfg &= 0xFFFBF0F0; // bit18 off
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
TxPinCfg &= 0xFFFFF0F0;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -37,17 +37,14 @@
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Private Variables Used */
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
PSTRING mac = ""; // default 00:00:00:00:00:00
|
||||
PSTRING hostname = ""; // default CMPC
|
||||
module_param (mac, charp, 0);
|
||||
MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr");
|
||||
|
||||
module_param(mac, charp, 0);
|
||||
MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr");
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Prototypes of Functions Used */
|
||||
@ -58,12 +55,12 @@ int rt28xx_close(IN struct net_device *net_dev);
|
||||
int rt28xx_open(struct net_device *net_dev);
|
||||
|
||||
// private function prototype
|
||||
static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
|
||||
|
||||
|
||||
static struct net_device_stats *RT28xx_get_ether_stats(
|
||||
static INT rt28xx_send_packets(IN struct sk_buff *skb_p,
|
||||
IN struct net_device *net_dev);
|
||||
|
||||
static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device
|
||||
*net_dev);
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -101,26 +98,33 @@ int MainVirtualIF_close(IN struct net_device *net_dev)
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
if (INFRA_ON(pAd) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
|
||||
{
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) {
|
||||
MLME_DISASSOC_REQ_STRUCT DisReq;
|
||||
MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
|
||||
MLME_QUEUE_ELEM *MsgElem =
|
||||
(MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM),
|
||||
MEM_ALLOC_FLAG);
|
||||
|
||||
if (MsgElem)
|
||||
{
|
||||
COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid);
|
||||
if (MsgElem) {
|
||||
COPY_MAC_ADDR(DisReq.Addr,
|
||||
pAd->CommonCfg.Bssid);
|
||||
DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
|
||||
|
||||
MsgElem->Machine = ASSOC_STATE_MACHINE;
|
||||
MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
|
||||
MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT);
|
||||
NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT));
|
||||
MsgElem->MsgLen =
|
||||
sizeof(MLME_DISASSOC_REQ_STRUCT);
|
||||
NdisMoveMemory(MsgElem->Msg, &DisReq,
|
||||
sizeof
|
||||
(MLME_DISASSOC_REQ_STRUCT));
|
||||
|
||||
// Prevent to connect AP again in STAMlmePeriodicExec
|
||||
pAd->MlmeAux.AutoReconnectSsidLen= 32;
|
||||
NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen);
|
||||
pAd->MlmeAux.AutoReconnectSsidLen = 32;
|
||||
NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid,
|
||||
pAd->MlmeAux.
|
||||
AutoReconnectSsidLen);
|
||||
|
||||
pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC;
|
||||
pAd->Mlme.CntlMachine.CurrState =
|
||||
CNTL_WAIT_OID_DISASSOC;
|
||||
MlmeDisassocReqAction(pAd, MsgElem);
|
||||
kfree(MsgElem);
|
||||
}
|
||||
@ -128,8 +132,10 @@ int MainVirtualIF_close(IN struct net_device *net_dev)
|
||||
RTMPusecDelay(1000);
|
||||
}
|
||||
|
||||
RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled);
|
||||
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
|
||||
RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer,
|
||||
&Cancelled);
|
||||
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer,
|
||||
&Cancelled);
|
||||
}
|
||||
|
||||
VIRTUAL_IF_DOWN(pAd);
|
||||
@ -204,7 +210,7 @@ Note:
|
||||
*/
|
||||
int rt28xx_close(IN PNET_DEV dev)
|
||||
{
|
||||
struct net_device * net_dev = (struct net_device *)dev;
|
||||
struct net_device *net_dev = (struct net_device *)dev;
|
||||
RTMP_ADAPTER *pAd = NULL;
|
||||
BOOLEAN Cancelled;
|
||||
UINT32 i = 0;
|
||||
@ -230,11 +236,9 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
|
||||
// If dirver doesn't wake up firmware here,
|
||||
// NICLoadFirmware will hang forever when interface is up again.
|
||||
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
|
||||
{
|
||||
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) {
|
||||
AsicForceWakeup(pAd, TRUE);
|
||||
}
|
||||
|
||||
#ifdef RTMP_MAC_USB
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
|
||||
#endif // RTMP_MAC_USB //
|
||||
@ -247,30 +251,28 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
||||
|
||||
for (i = 0 ; i < NUM_OF_TX_RING; i++)
|
||||
{
|
||||
while (pAd->DeQueueRunning[i] == TRUE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i));
|
||||
for (i = 0; i < NUM_OF_TX_RING; i++) {
|
||||
while (pAd->DeQueueRunning[i] == TRUE) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("Waiting for TxQueue[%d] done..........\n",
|
||||
i));
|
||||
RTMPusecDelay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RTMP_MAC_USB
|
||||
// ensure there are no more active urbs.
|
||||
add_wait_queue (&unlink_wakeup, &wait);
|
||||
add_wait_queue(&unlink_wakeup, &wait);
|
||||
pAd->wait = &unlink_wakeup;
|
||||
|
||||
// maybe wait for deletions to finish.
|
||||
i = 0;
|
||||
//while((i < 25) && atomic_read(&pAd->PendingRx) > 0)
|
||||
while(i < 25)
|
||||
{
|
||||
while (i < 25) {
|
||||
unsigned long IrqFlags;
|
||||
|
||||
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
||||
if (pAd->PendingRx == 0)
|
||||
{
|
||||
if (pAd->PendingRx == 0) {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
||||
break;
|
||||
}
|
||||
@ -280,7 +282,7 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
i++;
|
||||
}
|
||||
pAd->wait = NULL;
|
||||
remove_wait_queue (&unlink_wakeup, &wait);
|
||||
remove_wait_queue(&unlink_wakeup, &wait);
|
||||
#endif // RTMP_MAC_USB //
|
||||
|
||||
// Stop Mlme state machine
|
||||
@ -293,11 +295,9 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
MacTableReset(pAd);
|
||||
}
|
||||
|
||||
|
||||
MeasureReqTabExit(pAd);
|
||||
TpcReqTabExit(pAd);
|
||||
|
||||
|
||||
// Close kernel threads
|
||||
RtmpMgmtTaskExit(pAd);
|
||||
|
||||
@ -306,29 +306,26 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
BOOLEAN brc;
|
||||
// ULONG Value;
|
||||
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) {
|
||||
RTMP_ASIC_INTERRUPT_DISABLE(pAd);
|
||||
}
|
||||
|
||||
// Receive packets to clear DMA index after disable interrupt.
|
||||
//RTMPHandleRxDoneInterrupt(pAd);
|
||||
// put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all
|
||||
// register access before Radio off.
|
||||
|
||||
|
||||
brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0);
|
||||
brc = RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0);
|
||||
|
||||
//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff
|
||||
pAd->bPCIclkOff = FALSE;
|
||||
|
||||
if (brc==FALSE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__));
|
||||
if (brc == FALSE) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s call RT28xxPciAsicRadioOff fail !!\n",
|
||||
__func__));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
|
||||
{
|
||||
@ -341,15 +338,13 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
#endif // RTMP_MAC_PCI //
|
||||
|
||||
// Free IRQ
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) {
|
||||
#ifdef RTMP_MAC_PCI
|
||||
// Deregister interrupt function
|
||||
RtmpOSIRQRelease(net_dev);
|
||||
#endif // RTMP_MAC_PCI //
|
||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
|
||||
}
|
||||
|
||||
// Free Ring or USB buffers
|
||||
RTMPFreeTxRxRingMemory(pAd);
|
||||
|
||||
@ -358,7 +353,6 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
// Free BA reorder resource
|
||||
ba_reordering_resource_release(pAd);
|
||||
|
||||
|
||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
|
||||
|
||||
/*+++Modify by woody to solve the bulk fail+++*/
|
||||
@ -369,7 +363,6 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||
return 0; // close ok
|
||||
} /* End of rt28xx_close */
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -387,7 +380,7 @@ Note:
|
||||
*/
|
||||
int rt28xx_open(IN PNET_DEV dev)
|
||||
{
|
||||
struct net_device * net_dev = (struct net_device *)dev;
|
||||
struct net_device *net_dev = (struct net_device *)dev;
|
||||
PRTMP_ADAPTER pAd = NULL;
|
||||
int retval = 0;
|
||||
//POS_COOKIE pObj;
|
||||
@ -395,24 +388,21 @@ int rt28xx_open(IN PNET_DEV dev)
|
||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||
|
||||
// Sanity check for pAd
|
||||
if (pAd == NULL)
|
||||
{
|
||||
if (pAd == NULL) {
|
||||
/* if 1st open fail, pAd will be free;
|
||||
So the net_dev->ml_priv will be NULL in 2rd open */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (net_dev->priv_flags == INT_MAIN)
|
||||
{
|
||||
if (net_dev->priv_flags == INT_MAIN) {
|
||||
if (pAd->OpMode == OPMODE_STA)
|
||||
net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def;
|
||||
net_dev->wireless_handlers =
|
||||
(struct iw_handler_def *)&rt28xx_iw_handler_def;
|
||||
}
|
||||
|
||||
// Request interrupt service routine for PCI device
|
||||
// register the interrupt routine with the os
|
||||
RtmpOSIRQRequest(net_dev);
|
||||
|
||||
|
||||
// Init IRQ parameters stored in pAd
|
||||
RTMP_IRQ_INIT(pAd);
|
||||
|
||||
@ -420,7 +410,6 @@ int rt28xx_open(IN PNET_DEV dev)
|
||||
if (rt28xx_init(pAd, mac, hostname) == FALSE)
|
||||
goto err;
|
||||
|
||||
|
||||
// Enable Interrupt
|
||||
RTMP_IRQ_ENABLE(pAd);
|
||||
|
||||
@ -470,26 +459,28 @@ static const struct net_device_ops rt2860_netdev_ops = {
|
||||
.ndo_start_xmit = rt28xx_send_packets,
|
||||
};
|
||||
|
||||
PNET_DEV RtmpPhyNetDevInit(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook)
|
||||
PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd,
|
||||
IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook)
|
||||
{
|
||||
struct net_device *net_dev = NULL;
|
||||
// NDIS_STATUS Status;
|
||||
|
||||
net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME);
|
||||
if (net_dev == NULL)
|
||||
{
|
||||
printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n");
|
||||
net_dev =
|
||||
RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER),
|
||||
INF_MAIN_DEV_NAME);
|
||||
if (net_dev == NULL) {
|
||||
printk
|
||||
("RtmpPhyNetDevInit(): creation failed for main physical net device!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK));
|
||||
NdisZeroMemory((unsigned char *)pNetDevHook,
|
||||
sizeof(RTMP_OS_NETDEV_OP_HOOK));
|
||||
pNetDevHook->netdev_ops = &rt2860_netdev_ops;
|
||||
pNetDevHook->priv_flags = INT_MAIN;
|
||||
pNetDevHook->needProtcted = FALSE;
|
||||
|
||||
net_dev->ml_priv = (PVOID)pAd;
|
||||
net_dev->ml_priv = (PVOID) pAd;
|
||||
pAd->net_dev = net_dev;
|
||||
|
||||
netif_stop_queue(net_dev);
|
||||
@ -498,7 +489,6 @@ PNET_DEV RtmpPhyNetDevInit(
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -529,16 +519,14 @@ int rt28xx_packet_xmit(struct sk_buff *skb)
|
||||
|
||||
{
|
||||
// Drop send request since we are in monitor mode
|
||||
if (MONITOR_ON(pAd))
|
||||
{
|
||||
if (MONITOR_ON(pAd)) {
|
||||
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
// EapolStart size is 18
|
||||
if (skb->len < 14)
|
||||
{
|
||||
if (skb->len < 14) {
|
||||
//printk("bad packet size: %d\n", pkt->len);
|
||||
hex_dump("bad packet", skb->data, skb->len);
|
||||
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
||||
@ -546,7 +534,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
RTMP_SET_PACKET_5VT(pPacket, 0);
|
||||
STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1);
|
||||
STASendPackets((NDIS_HANDLE) pAd, (PPNDIS_PACKET) & pPacket, 1);
|
||||
|
||||
status = NETDEV_TX_OK;
|
||||
done:
|
||||
@ -554,7 +542,6 @@ done:
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -571,30 +558,27 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
static int rt28xx_send_packets(
|
||||
IN struct sk_buff *skb_p,
|
||||
static int rt28xx_send_packets(IN struct sk_buff *skb_p,
|
||||
IN struct net_device *net_dev)
|
||||
{
|
||||
RTMP_ADAPTER *pAd = NULL;
|
||||
|
||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||
|
||||
if (!(net_dev->flags & IFF_UP))
|
||||
{
|
||||
RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE);
|
||||
if (!(net_dev->flags & IFF_UP)) {
|
||||
RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET) skb_p,
|
||||
NDIS_STATUS_FAILURE);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15);
|
||||
NdisZeroMemory((PUCHAR) & skb_p->cb[CB_OFF], 15);
|
||||
RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID);
|
||||
|
||||
return rt28xx_packet_xmit(skb_p);
|
||||
}
|
||||
|
||||
|
||||
// This function will be called when query /proc
|
||||
struct iw_statistics *rt28xx_get_wireless_stats(
|
||||
IN struct net_device *net_dev)
|
||||
struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev)
|
||||
{
|
||||
PRTMP_ADAPTER pAd = NULL;
|
||||
|
||||
@ -606,13 +590,13 @@ struct iw_statistics *rt28xx_get_wireless_stats(
|
||||
|
||||
// link quality
|
||||
if (pAd->OpMode == OPMODE_STA)
|
||||
pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10);
|
||||
pAd->iw_stats.qual.qual =
|
||||
((pAd->Mlme.ChannelQuality * 12) / 10 + 10);
|
||||
|
||||
if(pAd->iw_stats.qual.qual > 100)
|
||||
if (pAd->iw_stats.qual.qual > 100)
|
||||
pAd->iw_stats.qual.qual = 100;
|
||||
|
||||
if (pAd->OpMode == OPMODE_STA)
|
||||
{
|
||||
if (pAd->OpMode == OPMODE_STA) {
|
||||
pAd->iw_stats.qual.level =
|
||||
RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0,
|
||||
pAd->StaCfg.RssiSample.LastRssi1,
|
||||
@ -634,7 +618,6 @@ struct iw_statistics *rt28xx_get_wireless_stats(
|
||||
return &pAd->iw_stats;
|
||||
}
|
||||
|
||||
|
||||
void tbtt_tasklet(unsigned long data)
|
||||
{
|
||||
//#define MAX_TX_IN_TBTT (16)
|
||||
@ -657,19 +640,20 @@ void tbtt_tasklet(unsigned long data)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
static struct net_device_stats *RT28xx_get_ether_stats(
|
||||
IN struct net_device *net_dev)
|
||||
static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device
|
||||
*net_dev)
|
||||
{
|
||||
RTMP_ADAPTER *pAd = NULL;
|
||||
|
||||
if (net_dev)
|
||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||
|
||||
if (pAd)
|
||||
{
|
||||
if (pAd) {
|
||||
|
||||
pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
|
||||
pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
|
||||
pAd->stats.rx_packets =
|
||||
pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
|
||||
pAd->stats.tx_packets =
|
||||
pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
|
||||
|
||||
pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
|
||||
pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
|
||||
@ -685,7 +669,7 @@ static struct net_device_stats *RT28xx_get_ether_stats(
|
||||
|
||||
pAd->stats.rx_length_errors = 0;
|
||||
pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow
|
||||
pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error
|
||||
pAd->stats.rx_crc_errors = 0; //pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error
|
||||
pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error
|
||||
pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun
|
||||
pAd->stats.rx_missed_errors = 0; // receiver missed packet
|
||||
@ -702,23 +686,18 @@ static struct net_device_stats *RT28xx_get_ether_stats(
|
||||
pAd->stats.tx_compressed = 0;
|
||||
|
||||
return &pAd->stats;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN RtmpPhyNetDevExit(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN PNET_DEV net_dev)
|
||||
BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev)
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Unregister network device
|
||||
if (net_dev != NULL)
|
||||
{
|
||||
printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name);
|
||||
if (net_dev != NULL) {
|
||||
printk
|
||||
("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n",
|
||||
net_dev->name);
|
||||
RtmpOSNetDevDetach(net_dev);
|
||||
}
|
||||
|
||||
@ -726,7 +705,6 @@ BOOLEAN RtmpPhyNetDevExit(
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -743,17 +721,14 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
NDIS_STATUS AdapterBlockAllocateMemory(
|
||||
IN PVOID handle,
|
||||
OUT PVOID *ppAd)
|
||||
NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd)
|
||||
{
|
||||
|
||||
*ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr);
|
||||
*ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr);
|
||||
|
||||
if (*ppAd)
|
||||
{
|
||||
if (*ppAd) {
|
||||
NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER));
|
||||
((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle;
|
||||
((PRTMP_ADAPTER) * ppAd)->OS_Cookie = handle;
|
||||
return (NDIS_STATUS_SUCCESS);
|
||||
} else {
|
||||
return (NDIS_STATUS_FAILURE);
|
||||
|
@ -48,8 +48,6 @@ static void ac2_dma_done_tasklet(unsigned long data);
|
||||
static void ac3_dma_done_tasklet(unsigned long data);
|
||||
static void fifo_statistic_full_tasklet(unsigned long data);
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Symbol & Macro Definitions */
|
||||
/*---------------------------------------------------------------------*/
|
||||
@ -72,7 +70,6 @@ static void fifo_statistic_full_tasklet(unsigned long data);
|
||||
#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||
#define INT_MGMT_DLY RT2860_INT_MGMT_DONE
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Interface-depended memory allocation/Free related procedures.
|
||||
@ -80,92 +77,90 @@ static void fifo_statistic_full_tasklet(unsigned long data);
|
||||
*
|
||||
**************************************************************************/
|
||||
// Function for TxDesc Memory allocation.
|
||||
void RTMP_AllocateTxDescMemory(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd,
|
||||
IN UINT Index,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
*VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress);
|
||||
*VirtualAddress =
|
||||
(PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length,
|
||||
PhysicalAddress);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Function for MgmtDesc Memory allocation.
|
||||
void RTMP_AllocateMgmtDescMemory(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
*VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress);
|
||||
*VirtualAddress =
|
||||
(PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length,
|
||||
PhysicalAddress);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Function for RxDesc Memory allocation.
|
||||
void RTMP_AllocateRxDescMemory(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
*VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress);
|
||||
*VirtualAddress =
|
||||
(PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length,
|
||||
PhysicalAddress);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Function for free allocated Desc Memory.
|
||||
void RTMP_FreeDescMemory(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN PVOID VirtualAddress,
|
||||
IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress);
|
||||
pci_free_consistent(pObj->pci_dev, Length, VirtualAddress,
|
||||
PhysicalAddress);
|
||||
}
|
||||
|
||||
|
||||
// Function for TxData DMA Memory allocation.
|
||||
void RTMP_AllocateFirstTxBuffer(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd,
|
||||
IN UINT Index,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
*VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress);
|
||||
*VirtualAddress =
|
||||
(PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length,
|
||||
PhysicalAddress);
|
||||
}
|
||||
|
||||
|
||||
void RTMP_FreeFirstTxBuffer(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
IN PVOID VirtualAddress,
|
||||
IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress);
|
||||
pci_free_consistent(pObj->pci_dev, Length, VirtualAddress,
|
||||
PhysicalAddress);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocate a common buffer for DMA
|
||||
* ARGUMENTS:
|
||||
@ -175,19 +170,19 @@ void RTMP_FreeFirstTxBuffer(
|
||||
* VirtualAddress: Pointer to memory is returned here
|
||||
* PhysicalAddress: Physical address corresponding to virtual address
|
||||
*/
|
||||
void RTMP_AllocateSharedMemory(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
*VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress);
|
||||
*VirtualAddress =
|
||||
(PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length,
|
||||
PhysicalAddress);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocate a packet buffer for DMA
|
||||
* ARGUMENTS:
|
||||
@ -199,25 +194,28 @@ void RTMP_AllocateSharedMemory(
|
||||
* Notes:
|
||||
* Cached is ignored: always cached memory
|
||||
*/
|
||||
PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Length,
|
||||
IN BOOLEAN Cached,
|
||||
OUT PVOID *VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||
OUT PVOID * VirtualAddress,
|
||||
OUT PNDIS_PHYSICAL_ADDRESS
|
||||
PhysicalAddress)
|
||||
{
|
||||
struct sk_buff *pkt;
|
||||
|
||||
pkt = dev_alloc_skb(Length);
|
||||
|
||||
if (pkt == NULL) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("can't allocate rx %ld size packet\n",Length));
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("can't allocate rx %ld size packet\n", Length));
|
||||
}
|
||||
|
||||
if (pkt) {
|
||||
RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS);
|
||||
*VirtualAddress = (PVOID) pkt->data;
|
||||
*PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE);
|
||||
*PhysicalAddress =
|
||||
PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
} else {
|
||||
*VirtualAddress = (PVOID) NULL;
|
||||
*PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL;
|
||||
@ -226,36 +224,40 @@ PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
|
||||
return (PNDIS_PACKET) pkt;
|
||||
}
|
||||
|
||||
|
||||
VOID Invalid_Remaining_Packet(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG VirtualAddress)
|
||||
VOID Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, IN ULONG VirtualAddress)
|
||||
{
|
||||
NDIS_PHYSICAL_ADDRESS PhysicalAddress;
|
||||
|
||||
PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE);
|
||||
PhysicalAddress =
|
||||
PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress + 1600),
|
||||
RX_BUFFER_NORMSIZE - 1600, -1, PCI_DMA_FROMDEVICE);
|
||||
}
|
||||
|
||||
NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd)
|
||||
NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
POS_COOKIE pObj;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->fifo_statistic_full_task,
|
||||
fifo_statistic_full_tasklet, (unsigned long)pAd);
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
||||
void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
POS_COOKIE pObj;
|
||||
|
||||
@ -271,15 +273,12 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
||||
tasklet_kill(&pObj->fifo_statistic_full_task);
|
||||
}
|
||||
|
||||
|
||||
NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER *pAd)
|
||||
NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -294,15 +293,12 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID RtmpMgmtTaskExit(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||
{
|
||||
u32 regValue;
|
||||
@ -320,7 +316,6 @@ static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
||||
}
|
||||
|
||||
|
||||
static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||
{
|
||||
u32 regValue;
|
||||
@ -329,13 +324,11 @@ static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||
regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask);
|
||||
RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable
|
||||
|
||||
if (regValue == 0)
|
||||
{
|
||||
if (regValue == 0) {
|
||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* tasklet related procedures.
|
||||
@ -350,7 +343,8 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -368,8 +362,7 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid lose of interrupts
|
||||
*/
|
||||
if (pAd->int_pending & INT_MGMT_DLY)
|
||||
{
|
||||
if (pAd->int_pending & INT_MGMT_DLY) {
|
||||
tasklet_hi_schedule(&pObj->mgmt_dma_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -380,7 +373,6 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
static void rx_done_tasklet(unsigned long data)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -390,7 +382,8 @@ static void rx_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -402,8 +395,7 @@ static void rx_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid rotting packet
|
||||
*/
|
||||
if (pAd->int_pending & INT_RX || bReschedule)
|
||||
{
|
||||
if (pAd->int_pending & INT_RX || bReschedule) {
|
||||
tasklet_hi_schedule(&pObj->rx_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -415,7 +407,6 @@ static void rx_done_tasklet(unsigned long data)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void fifo_statistic_full_tasklet(unsigned long data)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -424,7 +415,8 @@ void fifo_statistic_full_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -436,8 +428,7 @@ void fifo_statistic_full_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid rotting packet
|
||||
*/
|
||||
if (pAd->int_pending & FifoStaFullInt)
|
||||
{
|
||||
if (pAd->int_pending & FifoStaFullInt) {
|
||||
tasklet_hi_schedule(&pObj->fifo_statistic_full_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -460,7 +451,8 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -476,8 +468,7 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid lose of interrupts
|
||||
*/
|
||||
if ((pAd->int_pending & INT_AC3_DLY) || bReschedule)
|
||||
{
|
||||
if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) {
|
||||
tasklet_hi_schedule(&pObj->ac3_dma_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -488,7 +479,6 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
static void ac2_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -499,7 +489,8 @@ static void ac2_dma_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -515,8 +506,7 @@ static void ac2_dma_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid lose of interrupts
|
||||
*/
|
||||
if ((pAd->int_pending & INT_AC2_DLY) || bReschedule)
|
||||
{
|
||||
if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) {
|
||||
tasklet_hi_schedule(&pObj->ac2_dma_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -527,7 +517,6 @@ static void ac2_dma_done_tasklet(unsigned long data)
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
static void ac1_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -538,7 +527,8 @@ static void ac1_dma_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -554,8 +544,7 @@ static void ac1_dma_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid lose of interrupts
|
||||
*/
|
||||
if ((pAd->int_pending & INT_AC1_DLY) || bReschedule)
|
||||
{
|
||||
if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) {
|
||||
tasklet_hi_schedule(&pObj->ac1_dma_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -566,7 +555,6 @@ static void ac1_dma_done_tasklet(unsigned long data)
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
static void ac0_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -577,7 +565,8 @@ static void ac0_dma_done_tasklet(unsigned long data)
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
@ -594,8 +583,7 @@ static void ac0_dma_done_tasklet(unsigned long data)
|
||||
/*
|
||||
* double check to avoid lose of interrupts
|
||||
*/
|
||||
if ((pAd->int_pending & INT_AC0_DLY) || bReschedule)
|
||||
{
|
||||
if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) {
|
||||
tasklet_hi_schedule(&pObj->ac0_dma_done_task);
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
return;
|
||||
@ -606,9 +594,6 @@ static void ac0_dma_done_tasklet(unsigned long data)
|
||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* interrupt handler related procedures.
|
||||
@ -618,7 +603,7 @@ int print_int_count;
|
||||
|
||||
IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
{
|
||||
struct net_device *net_dev = (struct net_device *) dev_instance;
|
||||
struct net_device *net_dev = (struct net_device *)dev_instance;
|
||||
PRTMP_ADAPTER pAd = NULL;
|
||||
INT_SOURCE_CSR_STRUC IntSource;
|
||||
POS_COOKIE pObj;
|
||||
@ -627,13 +612,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
|
||||
/* Note 03312008: we can not return here before
|
||||
RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word);
|
||||
RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word);
|
||||
Or kernel will panic after ifconfig ra0 down sometimes */
|
||||
|
||||
|
||||
//
|
||||
// Inital the Interrupt source.
|
||||
//
|
||||
@ -669,11 +652,12 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear));
|
||||
|
||||
// Do nothing if Reset in progress
|
||||
if (RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |fRTMP_ADAPTER_HALT_IN_PROGRESS)))
|
||||
{
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd,
|
||||
(fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS))) {
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle interrupt, walk through all bits
|
||||
// Should start from highest priority interrupt
|
||||
@ -684,7 +668,6 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
pAd->bPCIclkOff = FALSE;
|
||||
|
||||
// If required spinlock, each interrupt service routine has to acquire
|
||||
@ -692,28 +675,25 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
//
|
||||
|
||||
// Do nothing if NIC doesn't exist
|
||||
if (IntSource.word == 0xffffffff)
|
||||
{
|
||||
RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS));
|
||||
if (IntSource.word == 0xffffffff) {
|
||||
RTMP_SET_FLAG(pAd,
|
||||
(fRTMP_ADAPTER_NIC_NOT_EXIST |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS));
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
if (IntSource.word & TxCoherent)
|
||||
{
|
||||
if (IntSource.word & TxCoherent) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n"));
|
||||
RTMPHandleRxCoherentInterrupt(pAd);
|
||||
}
|
||||
|
||||
if (IntSource.word & RxCoherent)
|
||||
{
|
||||
if (IntSource.word & RxCoherent) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n"));
|
||||
RTMPHandleRxCoherentInterrupt(pAd);
|
||||
}
|
||||
|
||||
if (IntSource.word & FifoStaFullInt)
|
||||
{
|
||||
if ((pAd->int_disable_mask & FifoStaFullInt) == 0)
|
||||
{
|
||||
if (IntSource.word & FifoStaFullInt) {
|
||||
if ((pAd->int_disable_mask & FifoStaFullInt) == 0) {
|
||||
/* mask FifoStaFullInt */
|
||||
rt2860_int_disable(pAd, FifoStaFullInt);
|
||||
tasklet_hi_schedule(&pObj->fifo_statistic_full_task);
|
||||
@ -721,20 +701,16 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
pAd->int_pending |= FifoStaFullInt;
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_MGMT_DLY)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 )
|
||||
{
|
||||
if (IntSource.word & INT_MGMT_DLY) {
|
||||
if ((pAd->int_disable_mask & INT_MGMT_DLY) == 0) {
|
||||
rt2860_int_disable(pAd, INT_MGMT_DLY);
|
||||
tasklet_hi_schedule(&pObj->mgmt_dma_done_task);
|
||||
}
|
||||
pAd->int_pending |= INT_MGMT_DLY ;
|
||||
pAd->int_pending |= INT_MGMT_DLY;
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_RX)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_RX) == 0)
|
||||
{
|
||||
if (IntSource.word & INT_RX) {
|
||||
if ((pAd->int_disable_mask & INT_RX) == 0) {
|
||||
|
||||
/* mask RxINT */
|
||||
rt2860_int_disable(pAd, INT_RX);
|
||||
@ -743,11 +719,9 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
pAd->int_pending |= INT_RX;
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_AC3_DLY)
|
||||
{
|
||||
if (IntSource.word & INT_AC3_DLY) {
|
||||
|
||||
if ((pAd->int_disable_mask & INT_AC3_DLY) == 0)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) {
|
||||
/* mask TxDataInt */
|
||||
rt2860_int_disable(pAd, INT_AC3_DLY);
|
||||
tasklet_hi_schedule(&pObj->ac3_dma_done_task);
|
||||
@ -755,11 +729,9 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
pAd->int_pending |= INT_AC3_DLY;
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_AC2_DLY)
|
||||
{
|
||||
if (IntSource.word & INT_AC2_DLY) {
|
||||
|
||||
if ((pAd->int_disable_mask & INT_AC2_DLY) == 0)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) {
|
||||
/* mask TxDataInt */
|
||||
rt2860_int_disable(pAd, INT_AC2_DLY);
|
||||
tasklet_hi_schedule(&pObj->ac2_dma_done_task);
|
||||
@ -767,13 +739,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
pAd->int_pending |= INT_AC2_DLY;
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_AC1_DLY)
|
||||
{
|
||||
if (IntSource.word & INT_AC1_DLY) {
|
||||
|
||||
pAd->int_pending |= INT_AC1_DLY;
|
||||
|
||||
if ((pAd->int_disable_mask & INT_AC1_DLY) == 0)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) {
|
||||
/* mask TxDataInt */
|
||||
rt2860_int_disable(pAd, INT_AC1_DLY);
|
||||
tasklet_hi_schedule(&pObj->ac1_dma_done_task);
|
||||
@ -781,8 +751,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
|
||||
}
|
||||
|
||||
if (IntSource.word & INT_AC0_DLY)
|
||||
{
|
||||
if (IntSource.word & INT_AC0_DLY) {
|
||||
|
||||
/*
|
||||
if (IntSource.word & 0x2) {
|
||||
@ -793,8 +762,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
*/
|
||||
pAd->int_pending |= INT_AC0_DLY;
|
||||
|
||||
if ((pAd->int_disable_mask & INT_AC0_DLY) == 0)
|
||||
{
|
||||
if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) {
|
||||
/* mask TxDataInt */
|
||||
rt2860_int_disable(pAd, INT_AC0_DLY);
|
||||
tasklet_hi_schedule(&pObj->ac0_dma_done_task);
|
||||
@ -802,14 +770,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (IntSource.word & PreTBTTInt)
|
||||
{
|
||||
if (IntSource.word & PreTBTTInt) {
|
||||
RTMPHandlePreTBTTInterrupt(pAd);
|
||||
}
|
||||
|
||||
if (IntSource.word & TBTTInt)
|
||||
{
|
||||
if (IntSource.word & TBTTInt) {
|
||||
RTMPHandleTBTTInterrupt(pAd);
|
||||
}
|
||||
|
||||
@ -825,7 +790,8 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||
* invaild or writeback cache
|
||||
* and convert virtual address to physical address
|
||||
*/
|
||||
dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction)
|
||||
dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size,
|
||||
int sd_idx, int direction)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
POS_COOKIE pObj;
|
||||
@ -846,29 +812,28 @@ dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx
|
||||
sd_idx = -1
|
||||
*/
|
||||
|
||||
pAd = (PRTMP_ADAPTER)handle;
|
||||
pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
pAd = (PRTMP_ADAPTER) handle;
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
if (sd_idx == 1)
|
||||
{
|
||||
if (sd_idx == 1) {
|
||||
PTX_BLK pTxBlk;
|
||||
pTxBlk = (PTX_BLK)ptr;
|
||||
return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
pTxBlk = (PTX_BLK) ptr;
|
||||
return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData,
|
||||
pTxBlk->SrcBufLen, direction);
|
||||
} else {
|
||||
return pci_map_single(pObj->pci_dev, ptr, size, direction);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction)
|
||||
void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size,
|
||||
int direction)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
POS_COOKIE pObj;
|
||||
|
||||
pAd=(PRTMP_ADAPTER)handle;
|
||||
pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
pAd = (PRTMP_ADAPTER) handle;
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pci_unmap_single(pObj->pci_dev, dma_addr, size, direction);
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
void dump_urb(struct urb* purb)
|
||||
void dump_urb(struct urb *purb)
|
||||
{
|
||||
printk("urb :0x%08lx\n", (unsigned long)purb);
|
||||
printk("\tdev :0x%08lx\n", (unsigned long)purb->dev);
|
||||
@ -46,16 +46,20 @@
|
||||
printk("\tpipe :0x%08x\n", purb->pipe);
|
||||
printk("\tstatus :%d\n", purb->status);
|
||||
printk("\ttransfer_flags :0x%08x\n", purb->transfer_flags);
|
||||
printk("\ttransfer_buffer :0x%08lx\n", (unsigned long)purb->transfer_buffer);
|
||||
printk("\ttransfer_buffer :0x%08lx\n",
|
||||
(unsigned long)purb->transfer_buffer);
|
||||
printk("\ttransfer_buffer_length:%d\n", purb->transfer_buffer_length);
|
||||
printk("\tactual_length :%d\n", purb->actual_length);
|
||||
printk("\tsetup_packet :0x%08lx\n", (unsigned long)purb->setup_packet);
|
||||
printk("\tsetup_packet :0x%08lx\n",
|
||||
(unsigned long)purb->setup_packet);
|
||||
printk("\tstart_frame :%d\n", purb->start_frame);
|
||||
printk("\tnumber_of_packets :%d\n", purb->number_of_packets);
|
||||
printk("\tinterval :%d\n", purb->interval);
|
||||
printk("\terror_count :%d\n", purb->error_count);
|
||||
printk("\tcontext :0x%08lx\n", (unsigned long)purb->context);
|
||||
printk("\tcomplete :0x%08lx\n\n", (unsigned long)purb->complete);
|
||||
printk("\tcontext :0x%08lx\n",
|
||||
(unsigned long)purb->context);
|
||||
printk("\tcomplete :0x%08lx\n\n",
|
||||
(unsigned long)purb->complete);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -73,8 +77,7 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
NDIS_STATUS RtmpMgmtTaskInit(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
RTMP_OS_TASK *pTask;
|
||||
NDIS_STATUS status;
|
||||
@ -87,9 +90,9 @@ NDIS_STATUS RtmpMgmtTaskInit(
|
||||
pTask = &pAd->timerTask;
|
||||
RtmpOSTaskInit(pTask, "RtmpTimerTask", pAd);
|
||||
status = RtmpOSTaskAttach(pTask, RtmpTimerQThread, pTask);
|
||||
if (status == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
printk (KERN_WARNING "%s: unable to start RtmpTimerQThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
if (status == NDIS_STATUS_FAILURE) {
|
||||
printk(KERN_WARNING "%s: unable to start RtmpTimerQThread\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
@ -97,9 +100,9 @@ NDIS_STATUS RtmpMgmtTaskInit(
|
||||
pTask = &pAd->mlmeTask;
|
||||
RtmpOSTaskInit(pTask, "RtmpMlmeTask", pAd);
|
||||
status = RtmpOSTaskAttach(pTask, MlmeThread, pTask);
|
||||
if (status == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
printk (KERN_WARNING "%s: unable to start MlmeThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
if (status == NDIS_STATUS_FAILURE) {
|
||||
printk(KERN_WARNING "%s: unable to start MlmeThread\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
@ -107,18 +110,15 @@ NDIS_STATUS RtmpMgmtTaskInit(
|
||||
pTask = &pAd->cmdQTask;
|
||||
RtmpOSTaskInit(pTask, "RtmpCmdQTask", pAd);
|
||||
status = RtmpOSTaskAttach(pTask, RTUSBCmdThread, pTask);
|
||||
if (status == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
printk (KERN_WARNING "%s: unable to start RTUSBCmdThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
if (status == NDIS_STATUS_FAILURE) {
|
||||
printk(KERN_WARNING "%s: unable to start RTUSBCmdThread\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -133,8 +133,7 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID RtmpMgmtTaskExit(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
INT ret;
|
||||
RTMP_OS_TASK *pTask;
|
||||
@ -153,10 +152,11 @@ VOID RtmpMgmtTaskExit(
|
||||
/* Terminate Mlme Thread */
|
||||
pTask = &pAd->mlmeTask;
|
||||
ret = RtmpOSTaskKill(pTask);
|
||||
if (ret == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
if (ret == NDIS_STATUS_FAILURE) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName));
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->
|
||||
net_dev),
|
||||
pTask->taskName));
|
||||
}
|
||||
|
||||
/* Terminate cmdQ thread */
|
||||
@ -174,10 +174,11 @@ VOID RtmpMgmtTaskExit(
|
||||
mb();
|
||||
//RTUSBCMDUp(pAd);
|
||||
ret = RtmpOSTaskKill(pTask);
|
||||
if (ret == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
if (ret == NDIS_STATUS_FAILURE) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName));
|
||||
RTMP_OS_NETDEV_GET_DEVNAME
|
||||
(pAd->net_dev),
|
||||
pTask->taskName));
|
||||
}
|
||||
pAd->CmdQ.CmdQState = RTMP_TASK_STAT_UNKNOWN;
|
||||
}
|
||||
@ -185,16 +186,15 @@ VOID RtmpMgmtTaskExit(
|
||||
/* Terminate timer thread */
|
||||
pTask = &pAd->timerTask;
|
||||
ret = RtmpOSTaskKill(pTask);
|
||||
if (ret == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
if (ret == NDIS_STATUS_FAILURE) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName));
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pAd->
|
||||
net_dev),
|
||||
pTask->taskName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_dataout_complete(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -205,9 +205,8 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||
NTSTATUS Status;
|
||||
unsigned long IrqFlags;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||
pAd = pHTTXContext->pAd;
|
||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
Status = pUrb->status;
|
||||
@ -224,8 +223,7 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||
pHTTXContext->IRPPending = FALSE;
|
||||
pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0;
|
||||
|
||||
if (Status == USB_ST_NOERROR)
|
||||
{
|
||||
if (Status == USB_ST_NOERROR) {
|
||||
pAd->BulkOutComplete++;
|
||||
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
||||
@ -235,30 +233,37 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||
FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext);
|
||||
//RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
|
||||
|
||||
}
|
||||
else // STATUS_OTHER
|
||||
} else // STATUS_OTHER
|
||||
{
|
||||
PUCHAR pBuf;
|
||||
|
||||
pAd->BulkOutCompleteOther++;
|
||||
|
||||
pBuf = &pHTTXContext->TransferBuffer->field.WirelessPacket[pHTTXContext->NextBulkOutPosition];
|
||||
pBuf =
|
||||
&pHTTXContext->TransferBuffer->field.
|
||||
WirelessPacket[pHTTXContext->NextBulkOutPosition];
|
||||
|
||||
if (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST |
|
||||
fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
{
|
||||
fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||
pAd->bulkResetPipeid = BulkOutPipeId;
|
||||
pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq;
|
||||
}
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
||||
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkOutDataPacket failed: ReasonCode=%d!\n", Status));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7]));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("BulkOutDataPacket failed: ReasonCode=%d!\n",
|
||||
Status));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n",
|
||||
pAd->BulkOutReq, pAd->BulkOutComplete,
|
||||
pAd->BulkOutCompleteOther));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n",
|
||||
pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4],
|
||||
pBuf[5], pBuf[6], pBuf[7]));
|
||||
//DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther));
|
||||
|
||||
}
|
||||
@ -268,12 +273,17 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||
// bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out.
|
||||
//
|
||||
//RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) &&
|
||||
(pHTTXContext->ENextBulkOutPosition != (pHTTXContext->CurWritePosition+8)) &&
|
||||
!RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)))
|
||||
{
|
||||
if ((pHTTXContext->ENextBulkOutPosition !=
|
||||
pHTTXContext->CurWritePosition)
|
||||
&& (pHTTXContext->ENextBulkOutPosition !=
|
||||
(pHTTXContext->CurWritePosition + 8))
|
||||
&& !RTUSB_TEST_BULK_FLAG(pAd,
|
||||
(fRTUSB_BULK_OUT_DATA_FRAG <<
|
||||
BulkOutPipeId))) {
|
||||
// Indicate There is data avaliable
|
||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||
BulkOutPipeId));
|
||||
}
|
||||
//RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
|
||||
@ -282,7 +292,6 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -291,9 +300,8 @@ static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||
NTSTATUS Status;
|
||||
unsigned long irqFlag;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pNullContext = (PTX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pNullContext = (PTX_CONTEXT) pUrb->context;
|
||||
pAd = pNullContext->pAd;
|
||||
Status = pUrb->status;
|
||||
|
||||
@ -304,27 +312,26 @@ static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||
pAd->BulkOutPending[0] = FALSE;
|
||||
pAd->watchDogTxPendingCnt[0] = 0;
|
||||
|
||||
if (Status == USB_ST_NOERROR)
|
||||
{
|
||||
if (Status == USB_ST_NOERROR) {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
|
||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
||||
}
|
||||
else // STATUS_OTHER
|
||||
} else // STATUS_OTHER
|
||||
{
|
||||
if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", Status));
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("Bulk Out Null Frame Failed, ReasonCode=%d!\n",
|
||||
Status));
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
pAd->bulkResetPipeid =
|
||||
(MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
}
|
||||
}
|
||||
@ -334,7 +341,6 @@ static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -343,9 +349,8 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||
NTSTATUS Status;
|
||||
unsigned long irqFlag;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pRTSContext = (PTX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pRTSContext = (PTX_CONTEXT) pUrb->context;
|
||||
pAd = pRTSContext->pAd;
|
||||
Status = pUrb->status;
|
||||
|
||||
@ -354,26 +359,24 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||
pRTSContext->IRPPending = FALSE;
|
||||
pRTSContext->InUse = FALSE;
|
||||
|
||||
if (Status == USB_ST_NOERROR)
|
||||
{
|
||||
if (Status == USB_ST_NOERROR) {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
||||
}
|
||||
else // STATUS_OTHER
|
||||
} else // STATUS_OTHER
|
||||
{
|
||||
if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out RTS Frame Failed\n"));
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("Bulk Out RTS Frame Failed\n"));
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
pAd->bulkResetPipeid =
|
||||
(MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||
}
|
||||
}
|
||||
@ -386,10 +389,8 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||
// The protectioon of rest bulk should be in BulkOut routine
|
||||
RTUSBKickBulkOut(pAd);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -397,10 +398,8 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
||||
purbb_t pUrb;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pPsPollContext = (PTX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pPsPollContext = (PTX_CONTEXT) pUrb->context;
|
||||
pAd = pPsPollContext->pAd;
|
||||
Status = pUrb->status;
|
||||
|
||||
@ -409,21 +408,21 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
||||
pPsPollContext->InUse = FALSE;
|
||||
pAd->watchDogTxPendingCnt[0] = 0;
|
||||
|
||||
if (Status == USB_ST_NOERROR)
|
||||
{
|
||||
if (Status == USB_ST_NOERROR) {
|
||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
||||
}
|
||||
else // STATUS_OTHER
|
||||
} else // STATUS_OTHER
|
||||
{
|
||||
if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out PSPoll Failed\n"));
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("Bulk Out PSPoll Failed\n"));
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
pAd->bulkResetPipeid =
|
||||
(MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -437,7 +436,6 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -460,12 +458,11 @@ static void rx_done_tasklet(unsigned long data)
|
||||
NTSTATUS Status;
|
||||
unsigned int IrqFlags;
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pRxContext = (PRX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pRxContext = (PRX_CONTEXT) pUrb->context;
|
||||
pAd = pRxContext->pAd;
|
||||
Status = pUrb->status;
|
||||
|
||||
|
||||
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
||||
pRxContext->InUse = FALSE;
|
||||
pRxContext->IRPPending = FALSE;
|
||||
@ -473,8 +470,7 @@ static void rx_done_tasklet(unsigned long data)
|
||||
//NdisInterlockedDecrement(&pAd->PendingRx);
|
||||
pAd->PendingRx--;
|
||||
|
||||
if (Status == USB_ST_NOERROR)
|
||||
{
|
||||
if (Status == USB_ST_NOERROR) {
|
||||
pAd->BulkInComplete++;
|
||||
pAd->NextRxBulkInPosition = 0;
|
||||
if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero.
|
||||
@ -483,8 +479,7 @@ static void rx_done_tasklet(unsigned long data)
|
||||
INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE);
|
||||
}
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
||||
}
|
||||
else // STATUS_OTHER
|
||||
} else // STATUS_OTHER
|
||||
{
|
||||
pAd->BulkInCompleteFail++;
|
||||
// Still read this packet although it may comtain wrong bytes.
|
||||
@ -495,14 +490,17 @@ static void rx_done_tasklet(unsigned long data)
|
||||
if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_BULKIN_RESET |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n",
|
||||
Status, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pRxContext->pUrb->actual_length));
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n",
|
||||
Status, pAd->NextRxBulkInIndex,
|
||||
pAd->NextRxBulkInReadIndex,
|
||||
pRxContext->pUrb->actual_length));
|
||||
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN,
|
||||
NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -510,12 +508,10 @@ static void rx_done_tasklet(unsigned long data)
|
||||
|
||||
RTUSBBulkReceive(pAd);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -526,9 +522,8 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||
NTSTATUS Status;
|
||||
unsigned long IrqFlags;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pMLMEContext = (PTX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pMLMEContext = (PTX_CONTEXT) pUrb->context;
|
||||
pAd = pMLMEContext->pAd;
|
||||
Status = pUrb->status;
|
||||
index = pMLMEContext->SelfIdx;
|
||||
@ -537,19 +532,19 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||
|
||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
|
||||
|
||||
|
||||
if (Status != USB_ST_NOERROR)
|
||||
{
|
||||
if (Status != USB_ST_NOERROR) {
|
||||
//Bulk-Out fail status handle
|
||||
if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status));
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||
("Bulk Out MLME Failed, Status=%d!\n",
|
||||
Status));
|
||||
// TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt?
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
pAd->bulkResetPipeid =
|
||||
(MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
@ -577,31 +572,25 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||
|
||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
// do nothing and return directly.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) &&
|
||||
((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG))
|
||||
{ // For Mgmt Bulk-Out failed, ignore it now.
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) { // For Mgmt Bulk-Out failed, ignore it now.
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
|
||||
// Always call Bulk routine, even reset bulk.
|
||||
// The protectioon of rest bulk should be in BulkOut routine
|
||||
if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */)
|
||||
{
|
||||
if (pAd->MgmtRing.TxSwFreeIdx <
|
||||
MGMT_RING_SIZE
|
||||
/* pMLMEContext->bWaitingBulkOut == TRUE */ ) {
|
||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME);
|
||||
}
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void rtusb_ac3_dma_done_tasklet(unsigned long data)
|
||||
@ -611,45 +600,39 @@ static void rtusb_ac3_dma_done_tasklet(unsigned long data)
|
||||
UCHAR BulkOutPipeId = 3;
|
||||
purbb_t pUrb;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||
pAd = pHTTXContext->pAd;
|
||||
|
||||
rtusb_dataout_complete((unsigned long)pUrb);
|
||||
|
||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
// do nothing and return directly.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
} else {
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||
(pHTTXContext->bCurWriting == FALSE))
|
||||
{
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
||||
(pHTTXContext->bCurWriting == FALSE)) {
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||
MAX_TX_PROCESS);
|
||||
}
|
||||
|
||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<3);
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
fRTUSB_BULK_OUT_DATA_NORMAL << 3);
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_ac2_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -657,45 +640,39 @@ static void rtusb_ac2_dma_done_tasklet(unsigned long data)
|
||||
UCHAR BulkOutPipeId = 2;
|
||||
purbb_t pUrb;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||
pAd = pHTTXContext->pAd;
|
||||
|
||||
rtusb_dataout_complete((unsigned long)pUrb);
|
||||
|
||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
// do nothing and return directly.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
} else {
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||
(pHTTXContext->bCurWriting == FALSE))
|
||||
{
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
||||
(pHTTXContext->bCurWriting == FALSE)) {
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||
MAX_TX_PROCESS);
|
||||
}
|
||||
|
||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<2);
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
fRTUSB_BULK_OUT_DATA_NORMAL << 2);
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -703,36 +680,32 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
||||
UCHAR BulkOutPipeId = 1;
|
||||
purbb_t pUrb;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||
pAd = pHTTXContext->pAd;
|
||||
|
||||
rtusb_dataout_complete((unsigned long)pUrb);
|
||||
|
||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
// do nothing and return directly.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
} else {
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||
(pHTTXContext->bCurWriting == FALSE))
|
||||
{
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
||||
(pHTTXContext->bCurWriting == FALSE)) {
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||
MAX_TX_PROCESS);
|
||||
}
|
||||
|
||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<1);
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
fRTUSB_BULK_OUT_DATA_NORMAL << 1);
|
||||
RTUSBKickBulkOut(pAd);
|
||||
}
|
||||
}
|
||||
@ -740,7 +713,6 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_ac0_dma_done_tasklet(unsigned long data)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
@ -748,33 +720,28 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data)
|
||||
UCHAR BulkOutPipeId = 0;
|
||||
purbb_t pUrb;
|
||||
|
||||
|
||||
pUrb = (purbb_t)data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
||||
pUrb = (purbb_t) data;
|
||||
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||
pAd = pHTTXContext->pAd;
|
||||
|
||||
rtusb_dataout_complete((unsigned long)pUrb);
|
||||
|
||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
// do nothing and return directly.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
||||
{
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
||||
}
|
||||
else
|
||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
} else {
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||
NULL, 0);
|
||||
} else {
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||
/* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||
(pHTTXContext->bCurWriting == FALSE))
|
||||
{
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
||||
(pHTTXContext->bCurWriting == FALSE)) {
|
||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||
MAX_TX_PROCESS);
|
||||
}
|
||||
|
||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL);
|
||||
@ -782,34 +749,38 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
NDIS_STATUS RtmpNetTaskInit(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
// Create receive tasklet
|
||||
tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG)pAd);
|
||||
tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_dma_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG) pAd);
|
||||
tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_dma_done_tasklet,
|
||||
(unsigned long)pAd);
|
||||
tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->null_frame_complete_task, rtusb_null_frame_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->rts_frame_complete_task, rtusb_rts_frame_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->pspoll_frame_complete_task, rtusb_pspoll_frame_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->null_frame_complete_task,
|
||||
rtusb_null_frame_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->rts_frame_complete_task,
|
||||
rtusb_rts_frame_done_tasklet, (unsigned long)pAd);
|
||||
tasklet_init(&pObj->pspoll_frame_complete_task,
|
||||
rtusb_pspoll_frame_done_tasklet, (unsigned long)pAd);
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
||||
void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
POS_COOKIE pObj;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26,7 +26,6 @@
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
|
||||
// Following information will be show when you run 'modinfo'
|
||||
// *** If you have a solution for the bug in current version of driver, please mail to me.
|
||||
// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. ***
|
||||
@ -37,141 +36,135 @@ MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(STA_DRIVER_VERSION);
|
||||
#endif
|
||||
|
||||
|
||||
/* module table */
|
||||
struct usb_device_id rtusb_usb_id[] = {
|
||||
#ifdef RT2870
|
||||
{USB_DEVICE(0x148F,0x2770)}, /* Ralink */
|
||||
{USB_DEVICE(0x148F,0x2870)}, /* Ralink */
|
||||
{USB_DEVICE(0x07B8,0x2870)}, /* AboCom */
|
||||
{USB_DEVICE(0x07B8,0x2770)}, /* AboCom */
|
||||
{USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom 2770 */
|
||||
{USB_DEVICE(0x083A,0x7512)}, /* Arcadyan 2770 */
|
||||
{USB_DEVICE(0x0789,0x0162)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x0789,0x0163)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x0789,0x0164)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x177f,0x0302)}, /* lsusb */
|
||||
{USB_DEVICE(0x0B05,0x1731)}, /* Asus */
|
||||
{USB_DEVICE(0x0B05,0x1732)}, /* Asus */
|
||||
{USB_DEVICE(0x0B05,0x1742)}, /* Asus */
|
||||
{USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */
|
||||
{USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */
|
||||
{USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */
|
||||
{USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */
|
||||
{USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */
|
||||
{USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */
|
||||
{USB_DEVICE(0x14B2,0x3C07)}, /* AL */
|
||||
{USB_DEVICE(0x050D,0x8053)}, /* Belkin */
|
||||
{USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */
|
||||
{USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */
|
||||
{USB_DEVICE(0x07AA,0x002F)}, /* Corega */
|
||||
{USB_DEVICE(0x07AA,0x003C)}, /* Corega */
|
||||
{USB_DEVICE(0x07AA,0x003F)}, /* Corega */
|
||||
{USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */
|
||||
{USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */
|
||||
{USB_DEVICE(0x083A,0xB522)}, /* SMC */
|
||||
{USB_DEVICE(0x083A,0xA618)}, /* SMC */
|
||||
{USB_DEVICE(0x083A,0x8522)}, /* Arcadyan */
|
||||
{USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */
|
||||
{USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */
|
||||
{USB_DEVICE(0x0586,0x3416)}, /* Zyxel */
|
||||
{USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */
|
||||
{USB_DEVICE(0x1740,0x9701)}, /* EnGenius */
|
||||
{USB_DEVICE(0x1740,0x9702)}, /* EnGenius */
|
||||
{USB_DEVICE(0x0471,0x200f)}, /* Philips */
|
||||
{USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */
|
||||
{USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */
|
||||
{USB_DEVICE(0x083A,0x6618)}, /* Accton */
|
||||
{USB_DEVICE(0x15c5,0x0008)}, /* Amit */
|
||||
{USB_DEVICE(0x0E66,0x0001)}, /* Hawking */
|
||||
{USB_DEVICE(0x0E66,0x0003)}, /* Hawking */
|
||||
{USB_DEVICE(0x129B,0x1828)}, /* Siemens */
|
||||
{USB_DEVICE(0x157E,0x300E)}, /* U-Media */
|
||||
{USB_DEVICE(0x050d,0x805c)},
|
||||
{USB_DEVICE(0x050d,0x815c)},
|
||||
{USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/
|
||||
{USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */
|
||||
{USB_DEVICE(0x04E8,0x2018)}, /* samsung */
|
||||
{USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */
|
||||
{USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */
|
||||
{USB_DEVICE(0x7392,0x7718)},
|
||||
{USB_DEVICE(0x7392,0x7717)},
|
||||
{USB_DEVICE(0x1737,0x0070)}, /* Linksys WUSB100 */
|
||||
{USB_DEVICE(0x1737,0x0071)}, /* Linksys WUSB600N */
|
||||
{USB_DEVICE(0x0411,0x00e8)}, /* Buffalo WLI-UC-G300N*/
|
||||
{USB_DEVICE(0x050d,0x815c)}, /* Belkin F5D8053 */
|
||||
{USB_DEVICE(0x148F, 0x2770)}, /* Ralink */
|
||||
{USB_DEVICE(0x148F, 0x2870)}, /* Ralink */
|
||||
{USB_DEVICE(0x07B8, 0x2870)}, /* AboCom */
|
||||
{USB_DEVICE(0x07B8, 0x2770)}, /* AboCom */
|
||||
{USB_DEVICE(0x0DF6, 0x0039)}, /* Sitecom 2770 */
|
||||
{USB_DEVICE(0x083A, 0x7512)}, /* Arcadyan 2770 */
|
||||
{USB_DEVICE(0x0789, 0x0162)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x0789, 0x0163)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x0789, 0x0164)}, /* Logitec 2870 */
|
||||
{USB_DEVICE(0x177f, 0x0302)}, /* lsusb */
|
||||
{USB_DEVICE(0x0B05, 0x1731)}, /* Asus */
|
||||
{USB_DEVICE(0x0B05, 0x1732)}, /* Asus */
|
||||
{USB_DEVICE(0x0B05, 0x1742)}, /* Asus */
|
||||
{USB_DEVICE(0x0DF6, 0x0017)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6, 0x002B)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6, 0x002C)}, /* Sitecom */
|
||||
{USB_DEVICE(0x0DF6, 0x002D)}, /* Sitecom */
|
||||
{USB_DEVICE(0x14B2, 0x3C06)}, /* Conceptronic */
|
||||
{USB_DEVICE(0x14B2, 0x3C28)}, /* Conceptronic */
|
||||
{USB_DEVICE(0x2019, 0xED06)}, /* Planex Communications, Inc. */
|
||||
{USB_DEVICE(0x07D1, 0x3C09)}, /* D-Link */
|
||||
{USB_DEVICE(0x07D1, 0x3C11)}, /* D-Link */
|
||||
{USB_DEVICE(0x14B2, 0x3C07)}, /* AL */
|
||||
{USB_DEVICE(0x050D, 0x8053)}, /* Belkin */
|
||||
{USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */
|
||||
{USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */
|
||||
{USB_DEVICE(0x07AA, 0x002F)}, /* Corega */
|
||||
{USB_DEVICE(0x07AA, 0x003C)}, /* Corega */
|
||||
{USB_DEVICE(0x07AA, 0x003F)}, /* Corega */
|
||||
{USB_DEVICE(0x1044, 0x800B)}, /* Gigabyte */
|
||||
{USB_DEVICE(0x15A9, 0x0006)}, /* Sparklan */
|
||||
{USB_DEVICE(0x083A, 0xB522)}, /* SMC */
|
||||
{USB_DEVICE(0x083A, 0xA618)}, /* SMC */
|
||||
{USB_DEVICE(0x083A, 0x8522)}, /* Arcadyan */
|
||||
{USB_DEVICE(0x083A, 0x7522)}, /* Arcadyan */
|
||||
{USB_DEVICE(0x0CDE, 0x0022)}, /* ZCOM */
|
||||
{USB_DEVICE(0x0586, 0x3416)}, /* Zyxel */
|
||||
{USB_DEVICE(0x0CDE, 0x0025)}, /* Zyxel */
|
||||
{USB_DEVICE(0x1740, 0x9701)}, /* EnGenius */
|
||||
{USB_DEVICE(0x1740, 0x9702)}, /* EnGenius */
|
||||
{USB_DEVICE(0x0471, 0x200f)}, /* Philips */
|
||||
{USB_DEVICE(0x14B2, 0x3C25)}, /* Draytek */
|
||||
{USB_DEVICE(0x13D3, 0x3247)}, /* AzureWave */
|
||||
{USB_DEVICE(0x083A, 0x6618)}, /* Accton */
|
||||
{USB_DEVICE(0x15c5, 0x0008)}, /* Amit */
|
||||
{USB_DEVICE(0x0E66, 0x0001)}, /* Hawking */
|
||||
{USB_DEVICE(0x0E66, 0x0003)}, /* Hawking */
|
||||
{USB_DEVICE(0x129B, 0x1828)}, /* Siemens */
|
||||
{USB_DEVICE(0x157E, 0x300E)}, /* U-Media */
|
||||
{USB_DEVICE(0x050d, 0x805c)},
|
||||
{USB_DEVICE(0x050d, 0x815c)},
|
||||
{USB_DEVICE(0x1482, 0x3C09)}, /* Abocom */
|
||||
{USB_DEVICE(0x14B2, 0x3C09)}, /* Alpha */
|
||||
{USB_DEVICE(0x04E8, 0x2018)}, /* samsung */
|
||||
{USB_DEVICE(0x5A57, 0x0280)}, /* Zinwell */
|
||||
{USB_DEVICE(0x5A57, 0x0282)}, /* Zinwell */
|
||||
{USB_DEVICE(0x7392, 0x7718)},
|
||||
{USB_DEVICE(0x7392, 0x7717)},
|
||||
{USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */
|
||||
{USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */
|
||||
{USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */
|
||||
{USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */
|
||||
#endif // RT2870 //
|
||||
#ifdef RT3070
|
||||
{USB_DEVICE(0x148F,0x3070)}, /* Ralink 3070 */
|
||||
{USB_DEVICE(0x148F,0x3071)}, /* Ralink 3071 */
|
||||
{USB_DEVICE(0x148F,0x3072)}, /* Ralink 3072 */
|
||||
{USB_DEVICE(0x0DB0,0x3820)}, /* Ralink 3070 */
|
||||
{USB_DEVICE(0x0DF6,0x003E)}, /* Sitecom 3070 */
|
||||
{USB_DEVICE(0x0DF6,0x0042)}, /* Sitecom 3072 */
|
||||
{USB_DEVICE(0x14B2,0x3C12)}, /* AL 3070 */
|
||||
{USB_DEVICE(0x18C5,0x0012)}, /* Corega 3070 */
|
||||
{USB_DEVICE(0x083A,0x7511)}, /* Arcadyan 3070 */
|
||||
{USB_DEVICE(0x1740,0x9703)}, /* EnGenius 3070 */
|
||||
{USB_DEVICE(0x1740,0x9705)}, /* EnGenius 3071 */
|
||||
{USB_DEVICE(0x1740,0x9706)}, /* EnGenius 3072 */
|
||||
{USB_DEVICE(0x13D3,0x3273)}, /* AzureWave 3070*/
|
||||
{USB_DEVICE(0x1044,0x800D)}, /* Gigabyte GN-WB32L 3070 */
|
||||
{USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */
|
||||
{USB_DEVICE(0x07B8,0x3070)}, /* AboCom 3070 */
|
||||
{USB_DEVICE(0x07B8,0x3071)}, /* AboCom 3071 */
|
||||
{USB_DEVICE(0x07B8,0x3072)}, /* Abocom 3072 */
|
||||
{USB_DEVICE(0x7392,0x7711)}, /* Edimax 3070 */
|
||||
{USB_DEVICE(0x1A32,0x0304)}, /* Quanta 3070 */
|
||||
{USB_DEVICE(0x1EDA,0x2310)}, /* AirTies 3070 */
|
||||
{USB_DEVICE(0x07D1,0x3C0A)}, /* D-Link 3072 */
|
||||
{USB_DEVICE(0x07D1,0x3C0D)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x07D1,0x3C0E)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x07D1,0x3C0F)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x1D4D,0x000C)}, /* Pegatron Corporation 3070 */
|
||||
{USB_DEVICE(0x1D4D,0x000E)}, /* Pegatron Corporation 3070 */
|
||||
{USB_DEVICE(0x5A57,0x5257)}, /* Zinwell 3070 */
|
||||
{USB_DEVICE(0x5A57,0x0283)}, /* Zinwell 3072 */
|
||||
{USB_DEVICE(0x04BB,0x0945)}, /* I-O DATA 3072 */
|
||||
{USB_DEVICE(0x203D,0x1480)}, /* Encore 3070 */
|
||||
{USB_DEVICE(0x148F, 0x3070)}, /* Ralink 3070 */
|
||||
{USB_DEVICE(0x148F, 0x3071)}, /* Ralink 3071 */
|
||||
{USB_DEVICE(0x148F, 0x3072)}, /* Ralink 3072 */
|
||||
{USB_DEVICE(0x0DB0, 0x3820)}, /* Ralink 3070 */
|
||||
{USB_DEVICE(0x0DF6, 0x003E)}, /* Sitecom 3070 */
|
||||
{USB_DEVICE(0x0DF6, 0x0042)}, /* Sitecom 3072 */
|
||||
{USB_DEVICE(0x14B2, 0x3C12)}, /* AL 3070 */
|
||||
{USB_DEVICE(0x18C5, 0x0012)}, /* Corega 3070 */
|
||||
{USB_DEVICE(0x083A, 0x7511)}, /* Arcadyan 3070 */
|
||||
{USB_DEVICE(0x1740, 0x9703)}, /* EnGenius 3070 */
|
||||
{USB_DEVICE(0x1740, 0x9705)}, /* EnGenius 3071 */
|
||||
{USB_DEVICE(0x1740, 0x9706)}, /* EnGenius 3072 */
|
||||
{USB_DEVICE(0x13D3, 0x3273)}, /* AzureWave 3070 */
|
||||
{USB_DEVICE(0x1044, 0x800D)}, /* Gigabyte GN-WB32L 3070 */
|
||||
{USB_DEVICE(0x2019, 0xAB25)}, /* Planex Communications, Inc. RT3070 */
|
||||
{USB_DEVICE(0x07B8, 0x3070)}, /* AboCom 3070 */
|
||||
{USB_DEVICE(0x07B8, 0x3071)}, /* AboCom 3071 */
|
||||
{USB_DEVICE(0x07B8, 0x3072)}, /* Abocom 3072 */
|
||||
{USB_DEVICE(0x7392, 0x7711)}, /* Edimax 3070 */
|
||||
{USB_DEVICE(0x1A32, 0x0304)}, /* Quanta 3070 */
|
||||
{USB_DEVICE(0x1EDA, 0x2310)}, /* AirTies 3070 */
|
||||
{USB_DEVICE(0x07D1, 0x3C0A)}, /* D-Link 3072 */
|
||||
{USB_DEVICE(0x07D1, 0x3C0D)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x07D1, 0x3C0E)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x07D1, 0x3C0F)}, /* D-Link 3070 */
|
||||
{USB_DEVICE(0x1D4D, 0x000C)}, /* Pegatron Corporation 3070 */
|
||||
{USB_DEVICE(0x1D4D, 0x000E)}, /* Pegatron Corporation 3070 */
|
||||
{USB_DEVICE(0x5A57, 0x5257)}, /* Zinwell 3070 */
|
||||
{USB_DEVICE(0x5A57, 0x0283)}, /* Zinwell 3072 */
|
||||
{USB_DEVICE(0x04BB, 0x0945)}, /* I-O DATA 3072 */
|
||||
{USB_DEVICE(0x203D, 0x1480)}, /* Encore 3070 */
|
||||
#endif // RT3070 //
|
||||
{ USB_DEVICE(0x0DF6, 0x003F) }, /* Sitecom WL-608 */
|
||||
{ USB_DEVICE(0x1737, 0x0077) }, /* Linksys WUSB54GC-EU v3 */
|
||||
{ USB_DEVICE(0x2001, 0x3C09) }, /* D-Link */
|
||||
{ USB_DEVICE(0x2001, 0x3C0A) }, /* D-Link 3072*/
|
||||
{ USB_DEVICE(0x2019, 0xED14) }, /* Planex Communications, Inc. */
|
||||
{ }/* Terminating entry */
|
||||
{USB_DEVICE(0x0DF6, 0x003F)}, /* Sitecom WL-608 */
|
||||
{USB_DEVICE(0x1737, 0x0077)}, /* Linksys WUSB54GC-EU v3 */
|
||||
{USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */
|
||||
{USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */
|
||||
{USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */
|
||||
{} /* Terminating entry */
|
||||
};
|
||||
|
||||
INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
|
||||
INT const rtusb_usb_id_len =
|
||||
sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
|
||||
|
||||
MODULE_DEVICE_TABLE(usb, rtusb_usb_id);
|
||||
|
||||
static void rt2870_disconnect(
|
||||
IN struct usb_device *dev,
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
static void rt2870_disconnect(IN struct usb_device *dev, IN PRTMP_ADAPTER pAd);
|
||||
|
||||
static int __devinit rt2870_probe(
|
||||
IN struct usb_interface *intf,
|
||||
static int __devinit rt2870_probe(IN struct usb_interface *intf,
|
||||
IN struct usb_device *usb_dev,
|
||||
IN const struct usb_device_id *dev_id,
|
||||
IN RTMP_ADAPTER **ppAd);
|
||||
IN RTMP_ADAPTER ** ppAd);
|
||||
|
||||
#ifndef PF_NOFREEZE
|
||||
#define PF_NOFREEZE 0
|
||||
#endif
|
||||
|
||||
|
||||
extern int rt28xx_close(IN struct net_device *net_dev);
|
||||
extern int rt28xx_open(struct net_device *net_dev);
|
||||
|
||||
static BOOLEAN USBDevConfigInit(
|
||||
IN struct usb_device *dev,
|
||||
static BOOLEAN USBDevConfigInit(IN struct usb_device *dev,
|
||||
IN struct usb_interface *intf,
|
||||
IN RTMP_ADAPTER *pAd);
|
||||
|
||||
IN RTMP_ADAPTER * pAd);
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
@ -188,27 +181,23 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
BOOLEAN RT28XXChipsetCheck(
|
||||
IN void *_dev_p)
|
||||
BOOLEAN RT28XXChipsetCheck(IN void *_dev_p)
|
||||
{
|
||||
struct usb_interface *intf = (struct usb_interface *)_dev_p;
|
||||
struct usb_device *dev_p = interface_to_usbdev(intf);
|
||||
UINT32 i;
|
||||
|
||||
|
||||
for(i=0; i<rtusb_usb_id_len; i++)
|
||||
{
|
||||
for (i = 0; i < rtusb_usb_id_len; i++) {
|
||||
if (dev_p->descriptor.idVendor == rtusb_usb_id[i].idVendor &&
|
||||
dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct)
|
||||
{
|
||||
dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) {
|
||||
printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n",
|
||||
dev_p->descriptor.idVendor, dev_p->descriptor.idProduct);
|
||||
dev_p->descriptor.idVendor,
|
||||
dev_p->descriptor.idProduct);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == rtusb_usb_id_len)
|
||||
{
|
||||
if (i == rtusb_usb_id_len) {
|
||||
printk("rt2870: Error! Device Descriptor not matching!\n");
|
||||
return FALSE;
|
||||
}
|
||||
@ -227,61 +216,76 @@ static int rt2870_suspend(struct usb_interface *intf, pm_message_t state);
|
||||
static int rt2870_resume(struct usb_interface *intf);
|
||||
#endif // CONFIG_PM //
|
||||
|
||||
static int rtusb_probe (struct usb_interface *intf,
|
||||
static int rtusb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id);
|
||||
static void rtusb_disconnect(struct usb_interface *intf);
|
||||
|
||||
static BOOLEAN USBDevConfigInit(
|
||||
IN struct usb_device *dev,
|
||||
static BOOLEAN USBDevConfigInit(IN struct usb_device *dev,
|
||||
IN struct usb_interface *intf,
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
struct usb_host_interface *iface_desc;
|
||||
ULONG BulkOutIdx;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* get the active interface descriptor */
|
||||
iface_desc = intf->cur_altsetting;
|
||||
|
||||
/* get # of enpoints */
|
||||
pAd->NumberOfPipes = iface_desc->desc.bNumEndpoints;
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints));
|
||||
|
||||
/* Configure Pipes */
|
||||
BulkOutIdx = 0;
|
||||
|
||||
for(i=0; i<pAd->NumberOfPipes; i++)
|
||||
{
|
||||
for (i = 0; i < pAd->NumberOfPipes; i++) {
|
||||
if ((iface_desc->endpoint[i].desc.bmAttributes ==
|
||||
USB_ENDPOINT_XFER_BULK) &&
|
||||
((iface_desc->endpoint[i].desc.bEndpointAddress &
|
||||
USB_ENDPOINT_DIR_MASK) == USB_DIR_IN))
|
||||
{
|
||||
pAd->BulkInEpAddr = iface_desc->endpoint[i].desc.bEndpointAddress;
|
||||
pAd->BulkInMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize);
|
||||
USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) {
|
||||
pAd->BulkInEpAddr =
|
||||
iface_desc->endpoint[i].desc.bEndpointAddress;
|
||||
pAd->BulkInMaxPacketSize =
|
||||
le2cpu16(iface_desc->endpoint[i].desc.
|
||||
wMaxPacketSize);
|
||||
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK IN MaxPacketSize = %d\n", pAd->BulkInMaxPacketSize));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x\n", iface_desc->endpoint[i].desc.bEndpointAddress));
|
||||
}
|
||||
else if ((iface_desc->endpoint[i].desc.bmAttributes ==
|
||||
USB_ENDPOINT_XFER_BULK) &&
|
||||
((iface_desc->endpoint[i].desc.bEndpointAddress &
|
||||
USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT))
|
||||
{
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("BULK IN MaxPacketSize = %d\n",
|
||||
pAd->BulkInMaxPacketSize));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("EP address = 0x%2x\n",
|
||||
iface_desc->endpoint[i].desc.
|
||||
bEndpointAddress));
|
||||
} else
|
||||
if ((iface_desc->endpoint[i].desc.bmAttributes ==
|
||||
USB_ENDPOINT_XFER_BULK)
|
||||
&&
|
||||
((iface_desc->endpoint[i].desc.
|
||||
bEndpointAddress & USB_ENDPOINT_DIR_MASK) ==
|
||||
USB_DIR_OUT)) {
|
||||
// there are 6 bulk out EP. EP6 highest priority.
|
||||
// EP1-4 is EDCA. EP5 is HCCA.
|
||||
pAd->BulkOutEpAddr[BulkOutIdx++] = iface_desc->endpoint[i].desc.bEndpointAddress;
|
||||
pAd->BulkOutMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize);
|
||||
pAd->BulkOutEpAddr[BulkOutIdx++] =
|
||||
iface_desc->endpoint[i].desc.bEndpointAddress;
|
||||
pAd->BulkOutMaxPacketSize =
|
||||
le2cpu16(iface_desc->endpoint[i].desc.
|
||||
wMaxPacketSize);
|
||||
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK OUT MaxPacketSize = %d\n", pAd->BulkOutMaxPacketSize));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x \n", iface_desc->endpoint[i].desc.bEndpointAddress));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("BULK OUT MaxPacketSize = %d\n",
|
||||
pAd->BulkOutMaxPacketSize));
|
||||
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||
("EP address = 0x%2x \n",
|
||||
iface_desc->endpoint[i].desc.
|
||||
bEndpointAddress));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0]))
|
||||
{
|
||||
printk("%s: Could not find both bulk-in and bulk-out endpoints\n", __FUNCTION__);
|
||||
if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) {
|
||||
printk
|
||||
("%s: Could not find both bulk-in and bulk-out endpoints\n",
|
||||
__FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -292,9 +296,7 @@ static BOOLEAN USBDevConfigInit(
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int rtusb_probe (struct usb_interface *intf,
|
||||
static int rtusb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
RTMP_ADAPTER *pAd;
|
||||
@ -311,49 +313,42 @@ static int rtusb_probe (struct usb_interface *intf,
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static void rtusb_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct usb_device *dev = interface_to_usbdev(intf);
|
||||
PRTMP_ADAPTER pAd;
|
||||
|
||||
|
||||
pAd = usb_get_intfdata(intf);
|
||||
usb_set_intfdata(intf, NULL);
|
||||
|
||||
rt2870_disconnect(dev, pAd);
|
||||
}
|
||||
|
||||
|
||||
struct usb_driver rtusb_driver = {
|
||||
.name="rt2870",
|
||||
.probe=rtusb_probe,
|
||||
.disconnect=rtusb_disconnect,
|
||||
.id_table=rtusb_usb_id,
|
||||
.name = "rt2870",
|
||||
.probe = rtusb_probe,
|
||||
.disconnect = rtusb_disconnect,
|
||||
.id_table = rtusb_usb_id,
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
suspend: rt2870_suspend,
|
||||
resume: rt2870_resume,
|
||||
suspend:rt2870_suspend,
|
||||
resume:rt2870_resume,
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
VOID RT2870RejectPendingPackets(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
// clear PS packets
|
||||
// clear TxSw packets
|
||||
}
|
||||
|
||||
static int rt2870_suspend(
|
||||
struct usb_interface *intf,
|
||||
pm_message_t state)
|
||||
static int rt2870_suspend(struct usb_interface *intf, pm_message_t state)
|
||||
{
|
||||
struct net_device *net_dev;
|
||||
PRTMP_ADAPTER pAd = usb_get_intfdata(intf);
|
||||
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_suspend()\n"));
|
||||
net_dev = pAd->net_dev;
|
||||
netif_device_detach(net_dev);
|
||||
@ -367,13 +362,11 @@ static int rt2870_suspend(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rt2870_resume(
|
||||
struct usb_interface *intf)
|
||||
static int rt2870_resume(struct usb_interface *intf)
|
||||
{
|
||||
struct net_device *net_dev;
|
||||
PRTMP_ADAPTER pAd = usb_get_intfdata(intf);
|
||||
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_resume()\n"));
|
||||
|
||||
pAd->PM_FlgSuspend = 0;
|
||||
@ -405,9 +398,6 @@ VOID __exit rtusb_exit(void)
|
||||
module_init(rtusb_init);
|
||||
module_exit(rtusb_exit);
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
/* function declarations */
|
||||
/*--------------------------------------------------------------------- */
|
||||
@ -426,35 +416,32 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT MlmeThread(
|
||||
IN void *Context)
|
||||
INT MlmeThread(IN void *Context)
|
||||
{
|
||||
RTMP_ADAPTER *pAd;
|
||||
RTMP_OS_TASK *pTask;
|
||||
int status;
|
||||
status = 0;
|
||||
|
||||
pTask = (RTMP_OS_TASK *)Context;
|
||||
pAd = (PRTMP_ADAPTER)pTask->priv;
|
||||
pTask = (RTMP_OS_TASK *) Context;
|
||||
pAd = (PRTMP_ADAPTER) pTask->priv;
|
||||
|
||||
RtmpOSTaskCustomize(pTask);
|
||||
|
||||
while(!pTask->task_killed)
|
||||
{
|
||||
while (!pTask->task_killed) {
|
||||
#ifdef KTHREAD_SUPPORT
|
||||
RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask);
|
||||
#else
|
||||
RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status);
|
||||
|
||||
/* unlock the device pointers */
|
||||
if (status != 0)
|
||||
{
|
||||
if (status != 0) {
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* lock the device pointers , need to check if required*/
|
||||
/* lock the device pointers , need to check if required */
|
||||
//down(&(pAd->usbdev_semaphore));
|
||||
|
||||
if (!pAd->PM_FlgSuspend)
|
||||
@ -475,16 +462,15 @@ INT MlmeThread(
|
||||
* This is important in preemption kernels, which transfer the flow
|
||||
* of execution immediately upon a complete().
|
||||
*/
|
||||
DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__FUNCTION__));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("<---%s\n", __FUNCTION__));
|
||||
#ifndef KTHREAD_SUPPORT
|
||||
pTask->taskPID = THREAD_PID_INIT_VALUE;
|
||||
complete_and_exit (&pTask->taskComplete, 0);
|
||||
complete_and_exit(&pTask->taskComplete, 0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
@ -499,16 +485,15 @@ Return Value:
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT RTUSBCmdThread(
|
||||
IN void * Context)
|
||||
INT RTUSBCmdThread(IN void *Context)
|
||||
{
|
||||
RTMP_ADAPTER *pAd;
|
||||
RTMP_OS_TASK *pTask;
|
||||
int status;
|
||||
status = 0;
|
||||
|
||||
pTask = (RTMP_OS_TASK *)Context;
|
||||
pAd = (PRTMP_ADAPTER)pTask->priv;
|
||||
pTask = (RTMP_OS_TASK *) Context;
|
||||
pAd = (PRTMP_ADAPTER) pTask->priv;
|
||||
|
||||
RtmpOSTaskCustomize(pTask);
|
||||
|
||||
@ -516,16 +501,14 @@ INT RTUSBCmdThread(
|
||||
pAd->CmdQ.CmdQState = RTMP_TASK_STAT_RUNNING;
|
||||
NdisReleaseSpinLock(&pAd->CmdQLock);
|
||||
|
||||
while (pAd && pAd->CmdQ.CmdQState == RTMP_TASK_STAT_RUNNING)
|
||||
{
|
||||
while (pAd && pAd->CmdQ.CmdQState == RTMP_TASK_STAT_RUNNING) {
|
||||
#ifdef KTHREAD_SUPPORT
|
||||
RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask);
|
||||
#else
|
||||
/* lock the device pointers */
|
||||
RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
if (status != 0) {
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
||||
break;
|
||||
}
|
||||
@ -538,28 +521,25 @@ INT RTUSBCmdThread(
|
||||
CMDHandler(pAd);
|
||||
}
|
||||
|
||||
if (pAd && !pAd->PM_FlgSuspend)
|
||||
{ // Clear the CmdQElements.
|
||||
if (pAd && !pAd->PM_FlgSuspend) { // Clear the CmdQElements.
|
||||
CmdQElmt *pCmdQElmt = NULL;
|
||||
|
||||
NdisAcquireSpinLock(&pAd->CmdQLock);
|
||||
pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED;
|
||||
while(pAd->CmdQ.size)
|
||||
{
|
||||
while (pAd->CmdQ.size) {
|
||||
RTUSBDequeueCmd(&pAd->CmdQ, &pCmdQElmt);
|
||||
if (pCmdQElmt)
|
||||
{
|
||||
if (pCmdQElmt->CmdFromNdis == TRUE)
|
||||
{
|
||||
if (pCmdQElmt) {
|
||||
if (pCmdQElmt->CmdFromNdis == TRUE) {
|
||||
if (pCmdQElmt->buffer != NULL)
|
||||
os_free_mem(pAd, pCmdQElmt->buffer);
|
||||
os_free_mem(pAd, (PUCHAR)pCmdQElmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pCmdQElmt->buffer != NULL) && (pCmdQElmt->bufferlength != 0))
|
||||
os_free_mem(pAd, pCmdQElmt->buffer);
|
||||
os_free_mem(pAd, (PUCHAR)pCmdQElmt);
|
||||
os_free_mem(pAd,
|
||||
pCmdQElmt->buffer);
|
||||
os_free_mem(pAd, (PUCHAR) pCmdQElmt);
|
||||
} else {
|
||||
if ((pCmdQElmt->buffer != NULL)
|
||||
&& (pCmdQElmt->bufferlength != 0))
|
||||
os_free_mem(pAd,
|
||||
pCmdQElmt->buffer);
|
||||
os_free_mem(pAd, (PUCHAR) pCmdQElmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -580,18 +560,17 @@ INT RTUSBCmdThread(
|
||||
* This is important in preemption kernels, which transfer the flow
|
||||
* of execution immediately upon a complete().
|
||||
*/
|
||||
DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n"));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("<---RTUSBCmdThread\n"));
|
||||
|
||||
#ifndef KTHREAD_SUPPORT
|
||||
pTask->taskPID = THREAD_PID_INIT_VALUE;
|
||||
complete_and_exit (&pTask->taskComplete, 0);
|
||||
complete_and_exit(&pTask->taskComplete, 0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd)
|
||||
VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd)
|
||||
{
|
||||
PHT_TX_CONTEXT pHTTXContext;
|
||||
int idx;
|
||||
@ -603,29 +582,32 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd)
|
||||
|
||||
idx = 0;
|
||||
RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue);
|
||||
if ((MACValue & 0xff) !=0 )
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", MACValue));
|
||||
if ((MACValue & 0xff) != 0) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n",
|
||||
MACValue));
|
||||
RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40012);
|
||||
while((MACValue &0xff) != 0 && (idx++ < 10))
|
||||
{
|
||||
while ((MACValue & 0xff) != 0 && (idx++ < 10)) {
|
||||
RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue);
|
||||
RTMPusecDelay(1);
|
||||
}
|
||||
RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006);
|
||||
}
|
||||
|
||||
if (pAd->watchDogRxOverFlowCnt >= 2)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n"));
|
||||
if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
if (pAd->watchDogRxOverFlowCnt >= 2) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n"));
|
||||
if ((!RTMP_TEST_FLAG
|
||||
(pAd,
|
||||
(fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_BULKIN_RESET |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n"));
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n"));
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0);
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN,
|
||||
NULL, 0);
|
||||
needDumpSeq = TRUE;
|
||||
}
|
||||
pAd->watchDogRxOverFlowCnt = 0;
|
||||
@ -633,105 +615,114 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd)
|
||||
|
||||
RTUSBReadMACRegister(pAd, 0x438, &TxRxQ_Pcnt);
|
||||
|
||||
for (idx = 0; idx < NUM_OF_TX_RING; idx++)
|
||||
{
|
||||
for (idx = 0; idx < NUM_OF_TX_RING; idx++) {
|
||||
pUrb = NULL;
|
||||
|
||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[idx], irqFlags);
|
||||
if ((pAd->BulkOutPending[idx] == TRUE) && pAd->watchDogTxPendingCnt)
|
||||
{
|
||||
INT actual_length=0,transfer_buffer_length=0;
|
||||
BOOLEAN isDataPacket=FALSE;
|
||||
if ((pAd->BulkOutPending[idx] == TRUE)
|
||||
&& pAd->watchDogTxPendingCnt) {
|
||||
INT actual_length = 0, transfer_buffer_length = 0;
|
||||
BOOLEAN isDataPacket = FALSE;
|
||||
pAd->watchDogTxPendingCnt[idx]++;
|
||||
|
||||
if ((pAd->watchDogTxPendingCnt[idx] > 2) &&
|
||||
(!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
)
|
||||
{
|
||||
(!RTMP_TEST_FLAG
|
||||
(pAd,
|
||||
(fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||
fRTMP_ADAPTER_NIC_NOT_EXIST |
|
||||
fRTMP_ADAPTER_BULKOUT_RESET)))
|
||||
) {
|
||||
// FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it!
|
||||
pHTTXContext = (PHT_TX_CONTEXT)(&pAd->TxContext[idx]);
|
||||
if (pHTTXContext->IRPPending)
|
||||
{ // Check TxContext.
|
||||
pHTTXContext =
|
||||
(PHT_TX_CONTEXT) (&pAd->TxContext[idx]);
|
||||
if (pHTTXContext->IRPPending) { // Check TxContext.
|
||||
pUrb = pHTTXContext->pUrb;
|
||||
|
||||
actual_length=pUrb->actual_length;
|
||||
transfer_buffer_length=pUrb->transfer_buffer_length;
|
||||
isDataPacket=TRUE;
|
||||
}
|
||||
else if (idx == MGMTPIPEIDX)
|
||||
{
|
||||
PTX_CONTEXT pMLMEContext, pNULLContext, pPsPollContext;
|
||||
actual_length = pUrb->actual_length;
|
||||
transfer_buffer_length =
|
||||
pUrb->transfer_buffer_length;
|
||||
isDataPacket = TRUE;
|
||||
} else if (idx == MGMTPIPEIDX) {
|
||||
PTX_CONTEXT pMLMEContext, pNULLContext,
|
||||
pPsPollContext;
|
||||
|
||||
//Check MgmtContext.
|
||||
pMLMEContext = (PTX_CONTEXT)(pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa);
|
||||
pPsPollContext = (PTX_CONTEXT)(&pAd->PsPollContext);
|
||||
pNULLContext = (PTX_CONTEXT)(&pAd->NullContext);
|
||||
pMLMEContext =
|
||||
(PTX_CONTEXT) (pAd->MgmtRing.
|
||||
Cell[pAd->MgmtRing.
|
||||
TxDmaIdx].
|
||||
AllocVa);
|
||||
pPsPollContext =
|
||||
(PTX_CONTEXT) (&pAd->PsPollContext);
|
||||
pNULLContext =
|
||||
(PTX_CONTEXT) (&pAd->NullContext);
|
||||
|
||||
if (pMLMEContext->IRPPending)
|
||||
{
|
||||
ASSERT(pMLMEContext->IRPPending);
|
||||
if (pMLMEContext->IRPPending) {
|
||||
ASSERT(pMLMEContext->
|
||||
IRPPending);
|
||||
pUrb = pMLMEContext->pUrb;
|
||||
}
|
||||
else if (pNULLContext->IRPPending)
|
||||
{
|
||||
ASSERT(pNULLContext->IRPPending);
|
||||
} else if (pNULLContext->IRPPending) {
|
||||
ASSERT(pNULLContext->
|
||||
IRPPending);
|
||||
pUrb = pNULLContext->pUrb;
|
||||
}
|
||||
else if (pPsPollContext->IRPPending)
|
||||
{
|
||||
ASSERT(pPsPollContext->IRPPending);
|
||||
} else if (pPsPollContext->IRPPending) {
|
||||
ASSERT(pPsPollContext->
|
||||
IRPPending);
|
||||
pUrb = pPsPollContext->pUrb;
|
||||
}
|
||||
}
|
||||
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags);
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx],
|
||||
irqFlags);
|
||||
|
||||
printk(KERN_INFO "%d:%lu LTL=%d , TL=%d L:%d\n",
|
||||
idx, pAd->watchDogTxPendingCnt[idx],
|
||||
pAd->TransferedLength[idx],
|
||||
actual_length, transfer_buffer_length);
|
||||
|
||||
if (pUrb)
|
||||
{
|
||||
if (pUrb) {
|
||||
if ((isDataPacket
|
||||
&& pAd->TransferedLength[idx]==actual_length
|
||||
&& pAd->TransferedLength[idx]<transfer_buffer_length
|
||||
&& actual_length!=0
|
||||
&& pAd->TransferedLength[idx] ==
|
||||
actual_length
|
||||
&& pAd->TransferedLength[idx] <
|
||||
transfer_buffer_length
|
||||
&& actual_length != 0
|
||||
// && TxRxQ_Pcnt==0
|
||||
&& pAd->watchDogTxPendingCnt[idx]>3)
|
||||
|| isDataPacket==FALSE || pAd->watchDogTxPendingCnt[idx]>6)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n", idx));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Unlink the pending URB!\n"));
|
||||
&& pAd->watchDogTxPendingCnt[idx] >
|
||||
3)
|
||||
|| isDataPacket == FALSE
|
||||
|| pAd->watchDogTxPendingCnt[idx] >
|
||||
6) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n",
|
||||
idx));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("Unlink the pending URB!\n"));
|
||||
// unlink it now
|
||||
RTUSB_UNLINK_URB(pUrb);
|
||||
// Sleep 200 microseconds to give cancellation time to work
|
||||
//RTMPusecDelay(200);
|
||||
needDumpSeq = TRUE;
|
||||
}
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags);
|
||||
} else {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx],
|
||||
irqFlags);
|
||||
}
|
||||
|
||||
if (isDataPacket==TRUE)
|
||||
pAd->TransferedLength[idx]=actual_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isDataPacket == TRUE)
|
||||
pAd->TransferedLength[idx] = actual_length;
|
||||
} else {
|
||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags);
|
||||
}
|
||||
}
|
||||
|
||||
// For Sigma debug, dump the ba_reordering sequence.
|
||||
if((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0))
|
||||
{
|
||||
if ((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) {
|
||||
USHORT Idx;
|
||||
PBA_REC_ENTRY pBAEntry = NULL;
|
||||
UCHAR count = 0;
|
||||
@ -740,19 +731,23 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd)
|
||||
Idx = pAd->MacTab.Content[BSSID_WCID].BARecWcidArray[0];
|
||||
|
||||
pBAEntry = &pAd->BATable.BARecEntry[Idx];
|
||||
if((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n"));
|
||||
if ((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL)) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n"));
|
||||
NdisAcquireSpinLock(&pBAEntry->RxReRingLock);
|
||||
mpdu_blk = pBAEntry->list.next;
|
||||
while (mpdu_blk)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("\t%d:Seq-%d, bAMSDU-%d!\n", count, mpdu_blk->Sequence, mpdu_blk->bAMSDU));
|
||||
while (mpdu_blk) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("\t%d:Seq-%d, bAMSDU-%d!\n", count,
|
||||
mpdu_blk->Sequence,
|
||||
mpdu_blk->bAMSDU));
|
||||
mpdu_blk = mpdu_blk->next;
|
||||
count++;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("\npBAEntry->LastIndSeq=%d!\n", pBAEntry->LastIndSeq));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("\npBAEntry->LastIndSeq=%d!\n",
|
||||
pBAEntry->LastIndSeq));
|
||||
NdisReleaseSpinLock(&pBAEntry->RxReRingLock);
|
||||
}
|
||||
}
|
||||
@ -775,10 +770,10 @@ Note:
|
||||
*/
|
||||
static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s\n",
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("rtusb_disconnect: unregister usbnet usb-%s-%s\n",
|
||||
dev->bus->bus_name, dev->devpath));
|
||||
if (!pAd)
|
||||
{
|
||||
if (!pAd) {
|
||||
usb_put_dev(dev);
|
||||
printk("rtusb_disconnect: pAd == NULL!\n");
|
||||
return;
|
||||
@ -788,7 +783,6 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
|
||||
// for debug, wait to show some messages to /proc system
|
||||
udelay(1);
|
||||
|
||||
|
||||
RtmpPhyNetDevExit(pAd, pAd->net_dev);
|
||||
|
||||
// FIXME: Shall we need following delay and flush the schedule??
|
||||
@ -808,12 +802,10 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
|
||||
DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n"));
|
||||
}
|
||||
|
||||
|
||||
static int __devinit rt2870_probe(
|
||||
IN struct usb_interface *intf,
|
||||
static int __devinit rt2870_probe(IN struct usb_interface *intf,
|
||||
IN struct usb_device *usb_dev,
|
||||
IN const struct usb_device_id *dev_id,
|
||||
IN RTMP_ADAPTER **ppAd)
|
||||
IN RTMP_ADAPTER ** ppAd)
|
||||
{
|
||||
struct net_device *net_dev = NULL;
|
||||
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL;
|
||||
@ -821,7 +813,6 @@ static int __devinit rt2870_probe(
|
||||
PVOID handle;
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevHook;
|
||||
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n"));
|
||||
|
||||
// Check chipset vendor/product ID
|
||||
@ -831,20 +822,18 @@ static int __devinit rt2870_probe(
|
||||
//RtmpDevInit=============================================
|
||||
// Allocate RTMP_ADAPTER adapter structure
|
||||
handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL);
|
||||
if (handle == NULL)
|
||||
{
|
||||
printk("rt2870_probe(): Allocate memory for os handle failed!\n");
|
||||
if (handle == NULL) {
|
||||
printk
|
||||
("rt2870_probe(): Allocate memory for os handle failed!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
((POS_COOKIE)handle)->pUsb_Dev = usb_dev;
|
||||
((POS_COOKIE) handle)->pUsb_Dev = usb_dev;
|
||||
|
||||
rv = RTMPAllocAdapterBlock(handle, &pAd);
|
||||
if (rv != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
if (rv != NDIS_STATUS_SUCCESS) {
|
||||
kfree(handle);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
//USBDevInit==============================================
|
||||
if (USBDevConfigInit(usb_dev, intf, pAd) == FALSE)
|
||||
goto err_out_free_radev;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,16 +39,13 @@
|
||||
|
||||
#ifdef RTMP_MAC_USB
|
||||
|
||||
|
||||
#include "../rt_config.h"
|
||||
|
||||
extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c
|
||||
extern UCHAR EpToQueue[];
|
||||
|
||||
VOID REPORT_AMSDU_FRAMES_TO_LLC(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pData,
|
||||
IN ULONG DataSize)
|
||||
VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pData, IN ULONG DataSize)
|
||||
{
|
||||
PNDIS_PACKET pPacket;
|
||||
UINT nMSDU;
|
||||
@ -57,22 +54,18 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC(
|
||||
nMSDU = 0;
|
||||
/* allocate a rx packet */
|
||||
pSkb = dev_alloc_skb(RX_BUFFER_AGGRESIZE);
|
||||
pPacket = (PNDIS_PACKET)OSPKT_TO_RTPKT(pSkb);
|
||||
if (pSkb)
|
||||
{
|
||||
pPacket = (PNDIS_PACKET) OSPKT_TO_RTPKT(pSkb);
|
||||
if (pSkb) {
|
||||
|
||||
/* convert 802.11 to 802.3 packet */
|
||||
pSkb->dev = get_netdev_from_bssid(pAd, BSS0);
|
||||
RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS);
|
||||
deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR,("Can't allocate skb\n"));
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("Can't allocate skb\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@ -92,8 +85,7 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC(
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
NDIS_STATUS RTUSBFreeDescriptorRequest(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR BulkOutPipeId,
|
||||
IN UINT32 NumberRequired)
|
||||
{
|
||||
@ -103,35 +95,39 @@ NDIS_STATUS RTUSBFreeDescriptorRequest(
|
||||
unsigned long IrqFlags;
|
||||
HT_TX_CONTEXT *pHTTXContext;
|
||||
|
||||
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
if ((pHTTXContext->CurWritePosition < pHTTXContext->NextBulkOutPosition) && ((pHTTXContext->CurWritePosition + NumberRequired + LOCAL_TXBUF_SIZE) > pHTTXContext->NextBulkOutPosition))
|
||||
{
|
||||
if ((pHTTXContext->CurWritePosition < pHTTXContext->NextBulkOutPosition)
|
||||
&&
|
||||
((pHTTXContext->CurWritePosition + NumberRequired +
|
||||
LOCAL_TXBUF_SIZE) > pHTTXContext->NextBulkOutPosition)) {
|
||||
|
||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
||||
}
|
||||
else if ((pHTTXContext->CurWritePosition == 8) && (pHTTXContext->NextBulkOutPosition < (NumberRequired + LOCAL_TXBUF_SIZE)))
|
||||
{
|
||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
||||
}
|
||||
else if (pHTTXContext->bCurWriting == TRUE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE,("RTUSBFreeD c3 --> QueIdx=%d, CWPos=%ld, NBOutPos=%ld!\n", BulkOutPipeId, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition));
|
||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
||||
}
|
||||
else
|
||||
{
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||
BulkOutPipeId));
|
||||
} else if ((pHTTXContext->CurWritePosition == 8)
|
||||
&& (pHTTXContext->NextBulkOutPosition <
|
||||
(NumberRequired + LOCAL_TXBUF_SIZE))) {
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||
BulkOutPipeId));
|
||||
} else if (pHTTXContext->bCurWriting == TRUE) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("RTUSBFreeD c3 --> QueIdx=%d, CWPos=%ld, NBOutPos=%ld!\n",
|
||||
BulkOutPipeId, pHTTXContext->CurWritePosition,
|
||||
pHTTXContext->NextBulkOutPosition));
|
||||
RTUSB_SET_BULK_FLAG(pAd,
|
||||
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||
BulkOutPipeId));
|
||||
} else {
|
||||
Status = NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
NDIS_STATUS RTUSBFreeDescriptorRelease(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
NDIS_STATUS RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd,
|
||||
IN UCHAR BulkOutPipeId)
|
||||
{
|
||||
unsigned long IrqFlags;
|
||||
@ -145,10 +141,7 @@ NDIS_STATUS RTUSBFreeDescriptorRelease(
|
||||
return (NDIS_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UCHAR BulkOutPipeId)
|
||||
BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId)
|
||||
{
|
||||
unsigned long IrqFlags;
|
||||
HT_TX_CONTEXT *pHTTXContext;
|
||||
@ -157,16 +150,23 @@ BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||
|
||||
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||
if ((pHTTXContext->IRPPending == TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */)
|
||||
{
|
||||
if ((pHTTXContext->CurWritePosition < pHTTXContext->ENextBulkOutPosition) &&
|
||||
(((pHTTXContext->ENextBulkOutPosition+MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT) || (pHTTXContext->CurWritePosition > MAX_AGGREGATION_SIZE)))
|
||||
{
|
||||
if ((pHTTXContext->IRPPending ==
|
||||
TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */ ) {
|
||||
if ((pHTTXContext->CurWritePosition <
|
||||
pHTTXContext->ENextBulkOutPosition)
|
||||
&&
|
||||
(((pHTTXContext->ENextBulkOutPosition +
|
||||
MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT)
|
||||
|| (pHTTXContext->CurWritePosition >
|
||||
MAX_AGGREGATION_SIZE))) {
|
||||
needQueBack = TRUE;
|
||||
}
|
||||
else if ((pHTTXContext->CurWritePosition > pHTTXContext->ENextBulkOutPosition) &&
|
||||
((pHTTXContext->ENextBulkOutPosition + MAX_AGGREGATION_SIZE) < pHTTXContext->CurWritePosition))
|
||||
{
|
||||
} else
|
||||
if ((pHTTXContext->CurWritePosition >
|
||||
pHTTXContext->ENextBulkOutPosition)
|
||||
&&
|
||||
((pHTTXContext->ENextBulkOutPosition +
|
||||
MAX_AGGREGATION_SIZE) <
|
||||
pHTTXContext->CurWritePosition)) {
|
||||
needQueBack = TRUE;
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,6 @@ BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@ -192,21 +191,17 @@ BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
VOID RTUSBRejectPendingPackets(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR Index;
|
||||
PQUEUE_ENTRY pEntry;
|
||||
PNDIS_PACKET pPacket;
|
||||
PQUEUE_HEADER pQueue;
|
||||
|
||||
|
||||
for (Index = 0; Index < 4; Index++)
|
||||
{
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
NdisAcquireSpinLock(&pAd->TxSwQueueLock[Index]);
|
||||
while (pAd->TxSwQueue[Index].Head != NULL)
|
||||
{
|
||||
pQueue = (PQUEUE_HEADER) &(pAd->TxSwQueue[Index]);
|
||||
while (pAd->TxSwQueue[Index].Head != NULL) {
|
||||
pQueue = (PQUEUE_HEADER) & (pAd->TxSwQueue[Index]);
|
||||
pEntry = RemoveHeadQueue(pQueue);
|
||||
pPacket = QUEUE_ENTRY_TO_PACKET(pEntry);
|
||||
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
||||
@ -217,7 +212,6 @@ VOID RTUSBRejectPendingPackets(
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@ -246,20 +240,17 @@ VOID RTUSBRejectPendingPackets(
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
|
||||
VOID RTMPWriteTxInfo(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd,
|
||||
IN PTXINFO_STRUC pTxInfo,
|
||||
IN USHORT USBDMApktLen,
|
||||
IN BOOLEAN bWiv,
|
||||
IN UCHAR QueueSel,
|
||||
IN UCHAR NextValid,
|
||||
IN UCHAR TxBurst)
|
||||
IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst)
|
||||
{
|
||||
pTxInfo->USBDMATxPktLen = USBDMApktLen;
|
||||
pTxInfo->QSEL = QueueSel;
|
||||
if (QueueSel != FIFO_EDCA)
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("====> QueueSel != FIFO_EDCA<============\n"));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("====> QueueSel != FIFO_EDCA<============\n"));
|
||||
pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this.
|
||||
pTxInfo->USBDMATxburst = TxBurst;
|
||||
pTxInfo->WIV = bWiv;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user