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
13 changed files with 5830 additions and 5550 deletions
|
@ -39,12 +39,10 @@
|
||||||
|
|
||||||
#include "../rt_config.h"
|
#include "../rt_config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef RTMP_RF_RW_SUPPORT
|
#ifndef RTMP_RF_RW_SUPPORT
|
||||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||||
#endif // RTMP_RF_RW_SUPPORT //
|
#endif // RTMP_RF_RW_SUPPORT //
|
||||||
|
|
||||||
|
|
||||||
VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
|
@ -52,61 +50,55 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
|
|
||||||
// Driver must read EEPROM to get RfIcType before initial RF registers
|
// Driver must read EEPROM to get RfIcType before initial RF registers
|
||||||
// Initialize RF register to default value
|
// Initialize RF register to default value
|
||||||
if (IS_RT3070(pAd) || IS_RT3071(pAd))
|
if (IS_RT3070(pAd) || IS_RT3071(pAd)) {
|
||||||
{
|
|
||||||
// Init RF calibration
|
// Init RF calibration
|
||||||
// Driver should toggle RF R30 bit7 before init RF registers
|
// Driver should toggle RF R30 bit7 before init RF registers
|
||||||
UINT32 RfReg = 0;
|
UINT32 RfReg = 0;
|
||||||
UINT32 data;
|
UINT32 data;
|
||||||
|
|
||||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
|
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg);
|
||||||
RfReg |= 0x80;
|
RfReg |= 0x80;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||||
RTMPusecDelay(1000);
|
RTMPusecDelay(1000);
|
||||||
RfReg &= 0x7F;
|
RfReg &= 0x7F;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||||
|
|
||||||
// Initialize RF register to default value
|
// Initialize RF register to default value
|
||||||
for (i = 0; i < NUM_RF_REG_PARMS; i++)
|
for (i = 0; i < NUM_RF_REG_PARMS; i++) {
|
||||||
{
|
RT30xxWriteRFRegister(pAd,
|
||||||
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
|
RT30xx_RFRegTable[i].Register,
|
||||||
|
RT30xx_RFRegTable[i].Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add by johnli
|
// add by johnli
|
||||||
if (IS_RT3070(pAd))
|
if (IS_RT3070(pAd)) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// The DAC issue(LDO_CFG0) has been fixed in RT3070(F).
|
// The DAC issue(LDO_CFG0) has been fixed in RT3070(F).
|
||||||
// The voltage raising patch is no longer needed for 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
|
// Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate
|
||||||
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
||||||
data = ((data & 0xF0FFFFFF) | 0x0D000000);
|
data = ((data & 0xF0FFFFFF) | 0x0D000000);
|
||||||
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
|
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
|
// 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;
|
RfReg |= 0x40;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg);
|
||||||
|
|
||||||
// init R31
|
// init R31
|
||||||
RT30xxWriteRFRegister(pAd, RF_R31, 0x14);
|
RT30xxWriteRFRegister(pAd, RF_R31, 0x14);
|
||||||
|
|
||||||
// RT3071 version E has fixed this issue
|
// 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
|
// patch tx EVM issue temporarily
|
||||||
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
|
||||||
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
||||||
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
|
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||||
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
||||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||||
|
@ -117,8 +109,7 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
data &= ~(0x20);
|
data &= ~(0x20);
|
||||||
RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data);
|
RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data);
|
||||||
}
|
}
|
||||||
|
//For RF filter Calibration
|
||||||
//For RF filter Calibration
|
|
||||||
RTMPFilterCalibration(pAd);
|
RTMPFilterCalibration(pAd);
|
||||||
|
|
||||||
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
|
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
|
||||||
|
@ -126,15 +117,12 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||||
// Raising RF voltage is no longer needed for 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);
|
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
|
||||||
}
|
}
|
||||||
else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211))
|
|
||||||
{
|
|
||||||
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set led open drain enable
|
// set led open drain enable
|
||||||
RTUSBReadMACRegister(pAd, OPT_14, &data);
|
RTUSBReadMACRegister(pAd, OPT_14, &data);
|
||||||
data |= 0x01;
|
data |= 0x01;
|
||||||
|
@ -145,29 +133,25 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
|
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
|
||||||
RFValue &= (~0x08);
|
RFValue &= (~0x08);
|
||||||
// to fix rx long range issue
|
// to fix rx long range issue
|
||||||
if (pAd->NicConfig2.field.ExternalLNAForG == 0)
|
if (pAd->NicConfig2.field.ExternalLNAForG == 0) {
|
||||||
{
|
if ((IS_RT3071(pAd)
|
||||||
if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd))
|
&& ((pAd->MACVersion & 0xffff) >= 0x0211))
|
||||||
{
|
|| IS_RT3070(pAd)) {
|
||||||
RFValue |= 0x20;
|
RFValue |= 0x20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
|
// 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 &= (~0x7); // clean bit [2:0]
|
|
||||||
RFValue |= pAd->TxMixerGain24G;
|
RFValue |= pAd->TxMixerGain24G;
|
||||||
}
|
}
|
||||||
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
|
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
|
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
|
||||||
RT30xxLoadRFNormalModeSetup(pAd);
|
RT30xxLoadRFNormalModeSetup(pAd);
|
||||||
}
|
} else if (IS_RT3070(pAd)) {
|
||||||
else if (IS_RT3070(pAd))
|
/* 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
|
// LDORF_VC, RF R27 register Bit 2 to 0
|
||||||
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
||||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||||
|
|
|
@ -39,44 +39,39 @@
|
||||||
|
|
||||||
#include "../rt_config.h"
|
#include "../rt_config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef RTMP_RF_RW_SUPPORT
|
#ifndef RTMP_RF_RW_SUPPORT
|
||||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||||
#endif // RTMP_RF_RW_SUPPORT //
|
#endif // RTMP_RF_RW_SUPPORT //
|
||||||
|
|
||||||
|
|
||||||
VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
|
VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
// Driver must read EEPROM to get RfIcType before initial RF registers
|
// Driver must read EEPROM to get RfIcType before initial RF registers
|
||||||
// Initialize RF register to default value
|
// Initialize RF register to default value
|
||||||
if (IS_RT3090(pAd))
|
if (IS_RT3090(pAd)) {
|
||||||
{
|
|
||||||
// Init RF calibration
|
// Init RF calibration
|
||||||
// Driver should toggle RF R30 bit7 before init RF registers
|
// Driver should toggle RF R30 bit7 before init RF registers
|
||||||
UINT32 RfReg = 0, data;
|
UINT32 RfReg = 0, data;
|
||||||
|
|
||||||
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
|
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg);
|
||||||
RfReg |= 0x80;
|
RfReg |= 0x80;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||||
RTMPusecDelay(1000);
|
RTMPusecDelay(1000);
|
||||||
RfReg &= 0x7F;
|
RfReg &= 0x7F;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg);
|
||||||
|
|
||||||
// init R24, R31
|
// init R24, R31
|
||||||
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
|
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
|
||||||
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
|
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
|
||||||
|
|
||||||
// RT309x version E has fixed this issue
|
// 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
|
// patch tx EVM issue temporarily
|
||||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||||
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
data = ((data & 0xE0FFFFFF) | 0x0D000000);
|
||||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
|
||||||
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
data = ((data & 0xE0FFFFFF) | 0x01000000);
|
||||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
|
||||||
|
@ -88,15 +83,16 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
|
||||||
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
|
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
|
||||||
|
|
||||||
// Initialize RF register to default value
|
// Initialize RF register to default value
|
||||||
for (i = 0; i < NUM_RF_REG_PARMS; i++)
|
for (i = 0; i < NUM_RF_REG_PARMS; i++) {
|
||||||
{
|
RT30xxWriteRFRegister(pAd,
|
||||||
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
|
RT30xx_RFRegTable[i].Register,
|
||||||
|
RT30xx_RFRegTable[i].Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Driver should set RF R6 bit6 on before calibration
|
// Driver should set RF R6 bit6 on before calibration
|
||||||
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
|
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg);
|
||||||
RfReg |= 0x40;
|
RfReg |= 0x40;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
|
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg);
|
||||||
|
|
||||||
//For RF filter Calibration
|
//For RF filter Calibration
|
||||||
RTMPFilterCalibration(pAd);
|
RTMPFilterCalibration(pAd);
|
||||||
|
|
|
@ -35,73 +35,82 @@
|
||||||
-------- ---------- ----------------------------------------------
|
-------- ---------- ----------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef RT30xx
|
#ifdef RT30xx
|
||||||
|
|
||||||
|
|
||||||
#ifndef RTMP_RF_RW_SUPPORT
|
#ifndef RTMP_RF_RW_SUPPORT
|
||||||
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
|
||||||
#endif // RTMP_RF_RW_SUPPORT //
|
#endif // RTMP_RF_RW_SUPPORT //
|
||||||
|
|
||||||
#include "../rt_config.h"
|
#include "../rt_config.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RF register initialization set
|
// RF register initialization set
|
||||||
//
|
//
|
||||||
REG_PAIR RT30xx_RFRegTable[] = {
|
REG_PAIR RT30xx_RFRegTable[] = {
|
||||||
{RF_R04, 0x40},
|
{RF_R04, 0x40}
|
||||||
{RF_R05, 0x03},
|
,
|
||||||
{RF_R06, 0x02},
|
{RF_R05, 0x03}
|
||||||
{RF_R07, 0x70},
|
,
|
||||||
{RF_R09, 0x0F},
|
{RF_R06, 0x02}
|
||||||
{RF_R10, 0x41},
|
,
|
||||||
{RF_R11, 0x21},
|
{RF_R07, 0x70}
|
||||||
{RF_R12, 0x7B},
|
,
|
||||||
{RF_R14, 0x90},
|
{RF_R09, 0x0F}
|
||||||
{RF_R15, 0x58},
|
,
|
||||||
{RF_R16, 0xB3},
|
{RF_R10, 0x41}
|
||||||
{RF_R17, 0x92},
|
,
|
||||||
{RF_R18, 0x2C},
|
{RF_R11, 0x21}
|
||||||
{RF_R19, 0x02},
|
,
|
||||||
{RF_R20, 0xBA},
|
{RF_R12, 0x7B}
|
||||||
{RF_R21, 0xDB},
|
,
|
||||||
{RF_R24, 0x16},
|
{RF_R14, 0x90}
|
||||||
{RF_R25, 0x01},
|
,
|
||||||
{RF_R29, 0x1F},
|
{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));
|
UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Antenna divesity use GPIO3 and EESK pin for control
|
// Antenna divesity use GPIO3 and EESK pin for control
|
||||||
// Antenna and EEPROM access are both using EESK pin,
|
// Antenna and EEPROM access are both using EESK pin,
|
||||||
// Therefor we should avoid accessing EESK at the same time
|
// Therefor we should avoid accessing EESK at the same time
|
||||||
// Then restore antenna after EEPROM access
|
// Then restore antenna after EEPROM access
|
||||||
// The original name of this function is AsicSetRxAnt(), now change to
|
// The original name of this function is AsicSetRxAnt(), now change to
|
||||||
//VOID AsicSetRxAnt(
|
//VOID AsicSetRxAnt(
|
||||||
VOID RT30xxSetRxAnt(
|
VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant)
|
||||||
IN PRTMP_ADAPTER pAd,
|
|
||||||
IN UCHAR Ant)
|
|
||||||
{
|
{
|
||||||
UINT32 Value;
|
UINT32 Value;
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
UINT32 x;
|
UINT32 x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((pAd->EepromAccess) ||
|
if ((pAd->EepromAccess) ||
|
||||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) ||
|
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) ||
|
||||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_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_RADIO_OFF)) ||
|
||||||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
|
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the antenna selection is through firmware and MAC register(GPIO3)
|
// the antenna selection is through firmware and MAC register(GPIO3)
|
||||||
if (Ant == 0)
|
if (Ant == 0) {
|
||||||
{
|
|
||||||
// Main antenna
|
// Main antenna
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
||||||
|
@ -114,10 +123,9 @@ VOID RT30xxSetRxAnt(
|
||||||
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
|
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
|
||||||
Value &= ~(0x0808);
|
Value &= ~(0x0808);
|
||||||
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
|
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
|
||||||
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n"));
|
DBGPRINT_RAW(RT_DEBUG_TRACE,
|
||||||
}
|
("AsicSetRxAnt, switch to main antenna\n"));
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
// Aux antenna
|
// Aux antenna
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
|
||||||
|
@ -130,11 +138,11 @@ VOID RT30xxSetRxAnt(
|
||||||
Value &= ~(0x0808);
|
Value &= ~(0x0808);
|
||||||
Value |= 0x08;
|
Value |= 0x08;
|
||||||
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
|
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,46 +159,43 @@ VOID RT30xxSetRxAnt(
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RTMPFilterCalibration(
|
VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd)
|
||||||
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;
|
UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0;
|
||||||
UCHAR RF_R24_Value = 0;
|
UCHAR RF_R24_Value = 0;
|
||||||
|
|
||||||
// Give bbp filter initial value
|
// Give bbp filter initial value
|
||||||
pAd->Mlme.CaliBW20RfR24 = 0x1F;
|
pAd->Mlme.CaliBW20RfR24 = 0x1F;
|
||||||
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
|
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
if (loop == 1) //BandWidth = 40 MHz
|
if (loop == 1) //BandWidth = 40 MHz
|
||||||
{
|
{
|
||||||
// Write 0x27 to RF_R24 to program filter
|
// Write 0x27 to RF_R24 to program filter
|
||||||
RF_R24_Value = 0x27;
|
RF_R24_Value = 0x27;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
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;
|
FilterTarget = 0x15;
|
||||||
else
|
else
|
||||||
FilterTarget = 0x19;
|
FilterTarget = 0x19;
|
||||||
|
|
||||||
// when calibrate BW40, BBP mask must set to BW40.
|
// when calibrate BW40, BBP mask must set to BW40.
|
||||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
|
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
|
||||||
BBPValue&= (~0x18);
|
BBPValue &= (~0x18);
|
||||||
BBPValue|= (0x10);
|
BBPValue |= (0x10);
|
||||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
|
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
|
||||||
|
|
||||||
// set to BW40
|
// set to BW40
|
||||||
RT30xxReadRFRegister(pAd, RF_R31, &value);
|
RT30xxReadRFRegister(pAd, RF_R31, &value);
|
||||||
value |= 0x20;
|
value |= 0x20;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R31, value);
|
RT30xxWriteRFRegister(pAd, RF_R31, value);
|
||||||
}
|
} else //BandWidth = 20 MHz
|
||||||
else //BandWidth = 20 MHz
|
|
||||||
{
|
{
|
||||||
// Write 0x07 to RF_R24 to program filter
|
// Write 0x07 to RF_R24 to program filter
|
||||||
RF_R24_Value = 0x07;
|
RF_R24_Value = 0x07;
|
||||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
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;
|
FilterTarget = 0x13;
|
||||||
else
|
else
|
||||||
FilterTarget = 0x16;
|
FilterTarget = 0x16;
|
||||||
|
@ -209,8 +214,7 @@ VOID RTMPFilterCalibration(
|
||||||
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
|
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
|
||||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
|
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
// Write 0x90 to BBP_R25 to transmit test tone
|
// Write 0x90 to BBP_R25 to transmit test tone
|
||||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
|
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
|
// Write 0x06 to BBP_R24 to set power & frequency of stopband test tone
|
||||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
|
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
|
||||||
|
|
||||||
while(TRUE)
|
while (TRUE) {
|
||||||
{
|
|
||||||
// Write 0x90 to BBP_R25 to transmit test tone
|
// Write 0x90 to BBP_R25 to transmit test tone
|
||||||
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
|
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
|
||||||
|
|
||||||
|
@ -233,59 +236,47 @@ VOID RTMPFilterCalibration(
|
||||||
RTMPusecDelay(1000);
|
RTMPusecDelay(1000);
|
||||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
|
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
|
||||||
value &= 0xFF;
|
value &= 0xFF;
|
||||||
if ((R55x - value) < FilterTarget)
|
if ((R55x - value) < FilterTarget) {
|
||||||
{
|
RF_R24_Value++;
|
||||||
RF_R24_Value ++;
|
} else if ((R55x - value) == FilterTarget) {
|
||||||
}
|
RF_R24_Value++;
|
||||||
else if ((R55x - value) == FilterTarget)
|
count++;
|
||||||
{
|
} else {
|
||||||
RF_R24_Value ++;
|
|
||||||
count ++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent infinite loop cause driver hang.
|
// prevent infinite loop cause driver hang.
|
||||||
if (loopcnt++ > 100)
|
if (loopcnt++ > 100) {
|
||||||
{
|
DBGPRINT(RT_DEBUG_ERROR,
|
||||||
DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt));
|
("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating",
|
||||||
|
loopcnt));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write RF_R24 to program filter
|
// Write RF_R24 to program filter
|
||||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0) {
|
||||||
{
|
|
||||||
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
|
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store for future usage
|
// Store for future usage
|
||||||
if (loopcnt < 100)
|
if (loopcnt < 100) {
|
||||||
{
|
if (loop++ == 0) {
|
||||||
if (loop++ == 0)
|
|
||||||
{
|
|
||||||
//BandWidth = 20 MHz
|
//BandWidth = 20 MHz
|
||||||
pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value;
|
pAd->Mlme.CaliBW20RfR24 = (UCHAR) RF_R24_Value;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//BandWidth = 40 MHz
|
//BandWidth = 40 MHz
|
||||||
pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value;
|
pAd->Mlme.CaliBW40RfR24 = (UCHAR) RF_R24_Value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
|
||||||
|
|
||||||
// reset count
|
// reset count
|
||||||
count = 0;
|
count = 0;
|
||||||
} while(TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set back to initial state
|
// Set back to initial state
|
||||||
|
@ -298,13 +289,14 @@ VOID RTMPFilterCalibration(
|
||||||
|
|
||||||
// set BBP back to BW20
|
// set BBP back to BW20
|
||||||
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
|
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);
|
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
|
// add by johnli, RF power sequence setup
|
||||||
/*
|
/*
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
@ -314,8 +306,7 @@ VOID RTMPFilterCalibration(
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RT30xxLoadRFNormalModeSetup(
|
VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd)
|
||||||
IN PRTMP_ADAPTER pAd)
|
|
||||||
{
|
{
|
||||||
UCHAR RFValue;
|
UCHAR RFValue;
|
||||||
|
|
||||||
|
@ -330,22 +321,22 @@ VOID RT30xxLoadRFNormalModeSetup(
|
||||||
RT30xxWriteRFRegister(pAd, RF_R15, RFValue);
|
RT30xxWriteRFRegister(pAd, RF_R15, RFValue);
|
||||||
|
|
||||||
/* move to NICInitRT30xxRFRegisters
|
/* move to NICInitRT30xxRFRegisters
|
||||||
// TX_LO1_en, RF R17 register Bit 3 to 0
|
// TX_LO1_en, RF R17 register Bit 3 to 0
|
||||||
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
|
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
|
||||||
RFValue &= (~0x08);
|
RFValue &= (~0x08);
|
||||||
// to fix rx long range issue
|
// to fix rx long range issue
|
||||||
if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0))
|
if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0))
|
||||||
{
|
{
|
||||||
RFValue |= 0x20;
|
RFValue |= 0x20;
|
||||||
}
|
}
|
||||||
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
|
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
|
||||||
if (pAd->TxMixerGain24G >= 2)
|
if (pAd->TxMixerGain24G >= 2)
|
||||||
{
|
{
|
||||||
RFValue &= (~0x7); // clean bit [2:0]
|
RFValue &= (~0x7); // clean bit [2:0]
|
||||||
RFValue |= pAd->TxMixerGain24G;
|
RFValue |= pAd->TxMixerGain24G;
|
||||||
}
|
}
|
||||||
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
|
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// RX_LO1_en, RF R20 register Bit 3 to 0
|
// RX_LO1_en, RF R20 register Bit 3 to 0
|
||||||
RT30xxReadRFRegister(pAd, RF_R20, &RFValue);
|
RT30xxReadRFRegister(pAd, RF_R20, &RFValue);
|
||||||
|
@ -357,7 +348,7 @@ VOID RT30xxLoadRFNormalModeSetup(
|
||||||
RFValue &= (~0x08);
|
RFValue &= (~0x08);
|
||||||
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
|
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
|
// LDORF_VC, RF R27 register Bit 2 to 0
|
||||||
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
|
||||||
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
|
||||||
|
@ -381,15 +372,13 @@ VOID RT30xxLoadRFNormalModeSetup(
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RT30xxLoadRFSleepModeSetup(
|
VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd)
|
||||||
IN PRTMP_ADAPTER pAd)
|
|
||||||
{
|
{
|
||||||
UCHAR RFValue;
|
UCHAR RFValue;
|
||||||
UINT32 MACValue;
|
UINT32 MACValue;
|
||||||
|
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
if(!IS_RT3572(pAd))
|
if (!IS_RT3572(pAd))
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
{
|
{
|
||||||
// RF_BLOCK_en. RF R1 register Bit 0 to 0
|
// RF_BLOCK_en. RF R1 register Bit 0 to 0
|
||||||
|
@ -414,9 +403,8 @@ VOID RT30xxLoadRFSleepModeSetup(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
||||||
IS_RT3572(pAd) ||
|
IS_RT3572(pAd) ||
|
||||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
|
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) {
|
||||||
{
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
if (!IS_RT3572(pAd))
|
if (!IS_RT3572(pAd))
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
|
@ -440,14 +428,13 @@ VOID RT30xxLoadRFSleepModeSetup(
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RT30xxReverseRFSleepModeSetup(
|
VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd)
|
||||||
IN PRTMP_ADAPTER pAd)
|
|
||||||
{
|
{
|
||||||
UCHAR RFValue;
|
UCHAR RFValue;
|
||||||
UINT32 MACValue;
|
UINT32 MACValue;
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
if(!IS_RT3572(pAd))
|
if (!IS_RT3572(pAd))
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
{
|
{
|
||||||
// RF_BLOCK_en, RF R1 register Bit 0 to 1
|
// RF_BLOCK_en, RF R1 register Bit 0 to 1
|
||||||
|
@ -472,10 +459,9 @@ VOID RT30xxReverseRFSleepModeSetup(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
|
||||||
IS_RT3572(pAd) ||
|
IS_RT3572(pAd) ||
|
||||||
IS_RT3390(pAd) ||
|
IS_RT3390(pAd) ||
|
||||||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
|
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) {
|
||||||
{
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
if (!IS_RT3572(pAd))
|
if (!IS_RT3572(pAd))
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
|
@ -487,48 +473,41 @@ VOID RT30xxReverseRFSleepModeSetup(
|
||||||
RFValue = (RFValue & (~0x77));
|
RFValue = (RFValue & (~0x77));
|
||||||
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
|
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RT3071 version E has fixed this issue
|
// 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
|
// patch tx EVM issue temporarily
|
||||||
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
||||||
MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000);
|
MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000);
|
||||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
|
||||||
MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000);
|
MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000);
|
||||||
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IS_RT3572(pAd))
|
if (IS_RT3572(pAd))
|
||||||
RT30xxWriteRFRegister(pAd, RF_R08, 0x80);
|
RT30xxWriteRFRegister(pAd, RF_R08, 0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
// end johnli
|
// end johnli
|
||||||
|
|
||||||
VOID RT30xxHaltAction(
|
VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd)
|
||||||
IN PRTMP_ADAPTER pAd)
|
|
||||||
{
|
{
|
||||||
UINT32 TxPinCfg = 0x00050F0F;
|
UINT32 TxPinCfg = 0x00050F0F;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Turn off LNA_PE or TRSW_POL
|
// 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))
|
if ((IS_RT3071(pAd) || IS_RT3572(pAd))
|
||||||
#ifdef RTMP_EFUSE_SUPPORT
|
#ifdef RTMP_EFUSE_SUPPORT
|
||||||
&& (pAd->bUseEfuse)
|
&& (pAd->bUseEfuse)
|
||||||
#endif // RTMP_EFUSE_SUPPORT //
|
#endif // RTMP_EFUSE_SUPPORT //
|
||||||
)
|
) {
|
||||||
{
|
TxPinCfg &= 0xFFFBF0F0; // bit18 off
|
||||||
TxPinCfg &= 0xFFFBF0F0; // bit18 off
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TxPinCfg &= 0xFFFFF0F0;
|
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"
|
#include "rt_config.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* Private Variables Used */
|
/* Private Variables Used */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
PSTRING mac = ""; // default 00:00:00:00:00:00
|
PSTRING mac = ""; // default 00:00:00:00:00:00
|
||||||
PSTRING hostname = ""; // default CMPC
|
PSTRING hostname = ""; // default CMPC
|
||||||
module_param (mac, charp, 0);
|
module_param(mac, charp, 0);
|
||||||
MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr");
|
MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr");
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* Prototypes of Functions Used */
|
/* Prototypes of Functions Used */
|
||||||
|
@ -58,11 +55,11 @@ int rt28xx_close(IN struct net_device *net_dev);
|
||||||
int rt28xx_open(struct net_device *net_dev);
|
int rt28xx_open(struct net_device *net_dev);
|
||||||
|
|
||||||
// private function prototype
|
// private function prototype
|
||||||
static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
|
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
|
||||||
static struct net_device_stats *RT28xx_get_ether_stats(
|
*net_dev);
|
||||||
IN struct net_device *net_dev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
@ -86,57 +83,66 @@ Note:
|
||||||
*/
|
*/
|
||||||
int MainVirtualIF_close(IN struct net_device *net_dev)
|
int MainVirtualIF_close(IN struct net_device *net_dev)
|
||||||
{
|
{
|
||||||
RTMP_ADAPTER *pAd = NULL;
|
RTMP_ADAPTER *pAd = NULL;
|
||||||
|
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
// Sanity check for pAd
|
// Sanity check for pAd
|
||||||
if (pAd == NULL)
|
if (pAd == NULL)
|
||||||
return 0; // close ok
|
return 0; // close ok
|
||||||
|
|
||||||
netif_carrier_off(pAd->net_dev);
|
netif_carrier_off(pAd->net_dev);
|
||||||
netif_stop_queue(pAd->net_dev);
|
netif_stop_queue(pAd->net_dev);
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOLEAN Cancelled;
|
BOOLEAN Cancelled;
|
||||||
|
|
||||||
if (INFRA_ON(pAd) &&
|
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_DISASSOC_REQ_STRUCT DisReq;
|
MLME_QUEUE_ELEM *MsgElem =
|
||||||
MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
|
(MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM),
|
||||||
|
MEM_ALLOC_FLAG);
|
||||||
|
|
||||||
if (MsgElem)
|
if (MsgElem) {
|
||||||
{
|
COPY_MAC_ADDR(DisReq.Addr,
|
||||||
COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid);
|
pAd->CommonCfg.Bssid);
|
||||||
DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
|
DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
|
||||||
|
|
||||||
MsgElem->Machine = ASSOC_STATE_MACHINE;
|
MsgElem->Machine = ASSOC_STATE_MACHINE;
|
||||||
MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
|
MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
|
||||||
MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT);
|
MsgElem->MsgLen =
|
||||||
NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT));
|
sizeof(MLME_DISASSOC_REQ_STRUCT);
|
||||||
|
NdisMoveMemory(MsgElem->Msg, &DisReq,
|
||||||
|
sizeof
|
||||||
|
(MLME_DISASSOC_REQ_STRUCT));
|
||||||
|
|
||||||
// Prevent to connect AP again in STAMlmePeriodicExec
|
// Prevent to connect AP again in STAMlmePeriodicExec
|
||||||
pAd->MlmeAux.AutoReconnectSsidLen= 32;
|
pAd->MlmeAux.AutoReconnectSsidLen = 32;
|
||||||
NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen);
|
NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid,
|
||||||
|
pAd->MlmeAux.
|
||||||
|
AutoReconnectSsidLen);
|
||||||
|
|
||||||
pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC;
|
pAd->Mlme.CntlMachine.CurrState =
|
||||||
MlmeDisassocReqAction(pAd, MsgElem);
|
CNTL_WAIT_OID_DISASSOC;
|
||||||
kfree(MsgElem);
|
MlmeDisassocReqAction(pAd, MsgElem);
|
||||||
|
kfree(MsgElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTMPusecDelay(1000);
|
RTMPusecDelay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled);
|
RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer,
|
||||||
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
|
&Cancelled);
|
||||||
|
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer,
|
||||||
|
&Cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
VIRTUAL_IF_DOWN(pAd);
|
VIRTUAL_IF_DOWN(pAd);
|
||||||
|
|
||||||
RT_MOD_DEC_USE_COUNT();
|
RT_MOD_DEC_USE_COUNT();
|
||||||
|
|
||||||
return 0; // close ok
|
return 0; // close ok
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -161,13 +167,13 @@ Note:
|
||||||
*/
|
*/
|
||||||
int MainVirtualIF_open(IN struct net_device *net_dev)
|
int MainVirtualIF_open(IN struct net_device *net_dev)
|
||||||
{
|
{
|
||||||
RTMP_ADAPTER *pAd = NULL;
|
RTMP_ADAPTER *pAd = NULL;
|
||||||
|
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
// Sanity check for pAd
|
// Sanity check for pAd
|
||||||
if (pAd == NULL)
|
if (pAd == NULL)
|
||||||
return 0; // close ok
|
return 0; // close ok
|
||||||
|
|
||||||
if (VIRTUAL_IF_UP(pAd) != 0)
|
if (VIRTUAL_IF_UP(pAd) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -204,10 +210,10 @@ Note:
|
||||||
*/
|
*/
|
||||||
int rt28xx_close(IN PNET_DEV dev)
|
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;
|
RTMP_ADAPTER *pAd = NULL;
|
||||||
BOOLEAN Cancelled;
|
BOOLEAN Cancelled;
|
||||||
UINT32 i = 0;
|
UINT32 i = 0;
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup);
|
DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup);
|
||||||
|
@ -216,12 +222,12 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
|
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
|
DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
|
||||||
|
|
||||||
Cancelled = FALSE;
|
Cancelled = FALSE;
|
||||||
// Sanity check for pAd
|
// Sanity check for pAd
|
||||||
if (pAd == NULL)
|
if (pAd == NULL)
|
||||||
return 0; // close ok
|
return 0; // close ok
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
|
@ -230,13 +236,11 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
|
|
||||||
// If dirver doesn't wake up firmware here,
|
// If dirver doesn't wake up firmware here,
|
||||||
// NICLoadFirmware will hang forever when interface is up again.
|
// 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);
|
||||||
AsicForceWakeup(pAd, TRUE);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
|
|
||||||
MlmeRadioOff(pAd);
|
MlmeRadioOff(pAd);
|
||||||
|
@ -247,30 +251,28 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
|
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
||||||
|
|
||||||
for (i = 0 ; i < NUM_OF_TX_RING; i++)
|
for (i = 0; i < NUM_OF_TX_RING; i++) {
|
||||||
{
|
while (pAd->DeQueueRunning[i] == TRUE) {
|
||||||
while (pAd->DeQueueRunning[i] == TRUE)
|
DBGPRINT(RT_DEBUG_TRACE,
|
||||||
{
|
("Waiting for TxQueue[%d] done..........\n",
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i));
|
i));
|
||||||
RTMPusecDelay(1000);
|
RTMPusecDelay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
// ensure there are no more active urbs.
|
// ensure there are no more active urbs.
|
||||||
add_wait_queue (&unlink_wakeup, &wait);
|
add_wait_queue(&unlink_wakeup, &wait);
|
||||||
pAd->wait = &unlink_wakeup;
|
pAd->wait = &unlink_wakeup;
|
||||||
|
|
||||||
// maybe wait for deletions to finish.
|
// maybe wait for deletions to finish.
|
||||||
i = 0;
|
i = 0;
|
||||||
//while((i < 25) && atomic_read(&pAd->PendingRx) > 0)
|
//while((i < 25) && atomic_read(&pAd->PendingRx) > 0)
|
||||||
while(i < 25)
|
while (i < 25) {
|
||||||
{
|
|
||||||
unsigned long IrqFlags;
|
unsigned long IrqFlags;
|
||||||
|
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
||||||
if (pAd->PendingRx == 0)
|
if (pAd->PendingRx == 0) {
|
||||||
{
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +282,7 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
pAd->wait = NULL;
|
pAd->wait = NULL;
|
||||||
remove_wait_queue (&unlink_wakeup, &wait);
|
remove_wait_queue(&unlink_wakeup, &wait);
|
||||||
#endif // RTMP_MAC_USB //
|
#endif // RTMP_MAC_USB //
|
||||||
|
|
||||||
// Stop Mlme state machine
|
// Stop Mlme state machine
|
||||||
|
@ -293,41 +295,36 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
MacTableReset(pAd);
|
MacTableReset(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MeasureReqTabExit(pAd);
|
MeasureReqTabExit(pAd);
|
||||||
TpcReqTabExit(pAd);
|
TpcReqTabExit(pAd);
|
||||||
|
|
||||||
|
|
||||||
// Close kernel threads
|
// Close kernel threads
|
||||||
RtmpMgmtTaskExit(pAd);
|
RtmpMgmtTaskExit(pAd);
|
||||||
|
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
{
|
{
|
||||||
BOOLEAN brc;
|
BOOLEAN brc;
|
||||||
// ULONG Value;
|
// 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);
|
||||||
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.
|
||||||
|
|
||||||
// Receive packets to clear DMA index after disable interrupt.
|
brc = RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0);
|
||||||
//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);
|
|
||||||
|
|
||||||
//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff
|
//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff
|
||||||
pAd->bPCIclkOff = FALSE;
|
pAd->bPCIclkOff = FALSE;
|
||||||
|
|
||||||
if (brc==FALSE)
|
if (brc == FALSE) {
|
||||||
{
|
DBGPRINT(RT_DEBUG_ERROR,
|
||||||
DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__));
|
("%s call RT28xxPciAsicRadioOff fail !!\n",
|
||||||
|
__func__));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
|
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
|
||||||
|
@ -341,15 +338,13 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
#endif // RTMP_MAC_PCI //
|
#endif // RTMP_MAC_PCI //
|
||||||
|
|
||||||
// Free IRQ
|
// 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
|
#ifdef RTMP_MAC_PCI
|
||||||
// Deregister interrupt function
|
// Deregister interrupt function
|
||||||
RtmpOSIRQRelease(net_dev);
|
RtmpOSIRQRelease(net_dev);
|
||||||
#endif // RTMP_MAC_PCI //
|
#endif // RTMP_MAC_PCI //
|
||||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
|
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free Ring or USB buffers
|
// Free Ring or USB buffers
|
||||||
RTMPFreeTxRxRingMemory(pAd);
|
RTMPFreeTxRxRingMemory(pAd);
|
||||||
|
|
||||||
|
@ -358,7 +353,6 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
// Free BA reorder resource
|
// Free BA reorder resource
|
||||||
ba_reordering_resource_release(pAd);
|
ba_reordering_resource_release(pAd);
|
||||||
|
|
||||||
|
|
||||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
|
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
|
||||||
|
|
||||||
/*+++Modify by woody to solve the bulk fail+++*/
|
/*+++Modify by woody to solve the bulk fail+++*/
|
||||||
|
@ -366,9 +360,8 @@ int rt28xx_close(IN PNET_DEV dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n"));
|
DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n"));
|
||||||
return 0; // close ok
|
return 0; // close ok
|
||||||
} /* End of rt28xx_close */
|
} /* End of rt28xx_close */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
@ -387,7 +380,7 @@ Note:
|
||||||
*/
|
*/
|
||||||
int rt28xx_open(IN PNET_DEV dev)
|
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;
|
PRTMP_ADAPTER pAd = NULL;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
//POS_COOKIE pObj;
|
//POS_COOKIE pObj;
|
||||||
|
@ -395,24 +388,21 @@ int rt28xx_open(IN PNET_DEV dev)
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
// Sanity check for pAd
|
// Sanity check for pAd
|
||||||
if (pAd == NULL)
|
if (pAd == NULL) {
|
||||||
{
|
|
||||||
/* if 1st open fail, pAd will be free;
|
/* if 1st open fail, pAd will be free;
|
||||||
So the net_dev->ml_priv will be NULL in 2rd open */
|
So the net_dev->ml_priv will be NULL in 2rd open */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net_dev->priv_flags == INT_MAIN)
|
if (net_dev->priv_flags == INT_MAIN) {
|
||||||
{
|
|
||||||
if (pAd->OpMode == OPMODE_STA)
|
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
|
// Request interrupt service routine for PCI device
|
||||||
// register the interrupt routine with the os
|
// register the interrupt routine with the os
|
||||||
RtmpOSIRQRequest(net_dev);
|
RtmpOSIRQRequest(net_dev);
|
||||||
|
|
||||||
|
|
||||||
// Init IRQ parameters stored in pAd
|
// Init IRQ parameters stored in pAd
|
||||||
RTMP_IRQ_INIT(pAd);
|
RTMP_IRQ_INIT(pAd);
|
||||||
|
|
||||||
|
@ -420,7 +410,6 @@ int rt28xx_open(IN PNET_DEV dev)
|
||||||
if (rt28xx_init(pAd, mac, hostname) == FALSE)
|
if (rt28xx_init(pAd, mac, hostname) == FALSE)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
||||||
// Enable Interrupt
|
// Enable Interrupt
|
||||||
RTMP_IRQ_ENABLE(pAd);
|
RTMP_IRQ_ENABLE(pAd);
|
||||||
|
|
||||||
|
@ -429,25 +418,25 @@ int rt28xx_open(IN PNET_DEV dev)
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP);
|
||||||
|
|
||||||
{
|
{
|
||||||
UINT32 reg = 0;
|
UINT32 reg = 0;
|
||||||
RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts
|
RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts
|
||||||
printk("0x1300 = %08x\n", reg);
|
printk("0x1300 = %08x\n", reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// u32 reg;
|
// u32 reg;
|
||||||
// UINT8 byte;
|
// UINT8 byte;
|
||||||
// u16 tmp;
|
// u16 tmp;
|
||||||
|
|
||||||
// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®);
|
// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®);
|
||||||
|
|
||||||
// tmp = 0x0805;
|
// tmp = 0x0805;
|
||||||
// reg = (reg & 0xffff0000) | tmp;
|
// reg = (reg & 0xffff0000) | tmp;
|
||||||
// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg);
|
// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg);
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef RTMP_MAC_PCI
|
#ifdef RTMP_MAC_PCI
|
||||||
RTMPInitPCIeLinkCtrlValue(pAd);
|
RTMPInitPCIeLinkCtrlValue(pAd);
|
||||||
#endif // RTMP_MAC_PCI //
|
#endif // RTMP_MAC_PCI //
|
||||||
|
|
||||||
return (retval);
|
return (retval);
|
||||||
|
@ -457,39 +446,41 @@ err:
|
||||||
RtmpOSIRQRelease(net_dev);
|
RtmpOSIRQRelease(net_dev);
|
||||||
//---Add by shiang, move from rt28xx_init() to here.
|
//---Add by shiang, move from rt28xx_init() to here.
|
||||||
return (-1);
|
return (-1);
|
||||||
} /* End of rt28xx_open */
|
} /* End of rt28xx_open */
|
||||||
|
|
||||||
static const struct net_device_ops rt2860_netdev_ops = {
|
static const struct net_device_ops rt2860_netdev_ops = {
|
||||||
.ndo_open = MainVirtualIF_open,
|
.ndo_open = MainVirtualIF_open,
|
||||||
.ndo_stop = MainVirtualIF_close,
|
.ndo_stop = MainVirtualIF_close,
|
||||||
.ndo_do_ioctl = rt28xx_sta_ioctl,
|
.ndo_do_ioctl = rt28xx_sta_ioctl,
|
||||||
.ndo_get_stats = RT28xx_get_ether_stats,
|
.ndo_get_stats = RT28xx_get_ether_stats,
|
||||||
.ndo_validate_addr = NULL,
|
.ndo_validate_addr = NULL,
|
||||||
.ndo_set_mac_address = eth_mac_addr,
|
.ndo_set_mac_address = eth_mac_addr,
|
||||||
.ndo_change_mtu = eth_change_mtu,
|
.ndo_change_mtu = eth_change_mtu,
|
||||||
.ndo_start_xmit = rt28xx_send_packets,
|
.ndo_start_xmit = rt28xx_send_packets,
|
||||||
};
|
};
|
||||||
|
|
||||||
PNET_DEV RtmpPhyNetDevInit(
|
PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd,
|
||||||
IN RTMP_ADAPTER *pAd,
|
IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook)
|
||||||
IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook)
|
|
||||||
{
|
{
|
||||||
struct net_device *net_dev = NULL;
|
struct net_device *net_dev = NULL;
|
||||||
// NDIS_STATUS Status;
|
// NDIS_STATUS Status;
|
||||||
|
|
||||||
net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME);
|
net_dev =
|
||||||
if (net_dev == NULL)
|
RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER),
|
||||||
{
|
INF_MAIN_DEV_NAME);
|
||||||
printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n");
|
if (net_dev == NULL) {
|
||||||
|
printk
|
||||||
|
("RtmpPhyNetDevInit(): creation failed for main physical net device!\n");
|
||||||
return NULL;
|
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->netdev_ops = &rt2860_netdev_ops;
|
||||||
pNetDevHook->priv_flags = INT_MAIN;
|
pNetDevHook->priv_flags = INT_MAIN;
|
||||||
pNetDevHook->needProtcted = FALSE;
|
pNetDevHook->needProtcted = FALSE;
|
||||||
|
|
||||||
net_dev->ml_priv = (PVOID)pAd;
|
net_dev->ml_priv = (PVOID) pAd;
|
||||||
pAd->net_dev = net_dev;
|
pAd->net_dev = net_dev;
|
||||||
|
|
||||||
netif_stop_queue(net_dev);
|
netif_stop_queue(net_dev);
|
||||||
|
@ -498,7 +489,6 @@ PNET_DEV RtmpPhyNetDevInit(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -529,16 +519,14 @@ int rt28xx_packet_xmit(struct sk_buff *skb)
|
||||||
|
|
||||||
{
|
{
|
||||||
// Drop send request since we are in monitor mode
|
// 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);
|
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EapolStart size is 18
|
// EapolStart size is 18
|
||||||
if (skb->len < 14)
|
if (skb->len < 14) {
|
||||||
{
|
|
||||||
//printk("bad packet size: %d\n", pkt->len);
|
//printk("bad packet size: %d\n", pkt->len);
|
||||||
hex_dump("bad packet", skb->data, skb->len);
|
hex_dump("bad packet", skb->data, skb->len);
|
||||||
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
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);
|
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;
|
status = NETDEV_TX_OK;
|
||||||
done:
|
done:
|
||||||
|
@ -554,7 +542,6 @@ done:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -571,30 +558,27 @@ Return Value:
|
||||||
Note:
|
Note:
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
static int rt28xx_send_packets(
|
static int rt28xx_send_packets(IN struct sk_buff *skb_p,
|
||||||
IN struct sk_buff *skb_p,
|
IN struct net_device *net_dev)
|
||||||
IN struct net_device *net_dev)
|
|
||||||
{
|
{
|
||||||
RTMP_ADAPTER *pAd = NULL;
|
RTMP_ADAPTER *pAd = NULL;
|
||||||
|
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
if (!(net_dev->flags & IFF_UP))
|
if (!(net_dev->flags & IFF_UP)) {
|
||||||
{
|
RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET) skb_p,
|
||||||
RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE);
|
NDIS_STATUS_FAILURE);
|
||||||
return NETDEV_TX_OK;
|
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);
|
RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID);
|
||||||
|
|
||||||
return rt28xx_packet_xmit(skb_p);
|
return rt28xx_packet_xmit(skb_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function will be called when query /proc
|
// This function will be called when query /proc
|
||||||
struct iw_statistics *rt28xx_get_wireless_stats(
|
struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev)
|
||||||
IN struct net_device *net_dev)
|
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd = NULL;
|
PRTMP_ADAPTER pAd = NULL;
|
||||||
|
|
||||||
|
@ -602,42 +586,41 @@ struct iw_statistics *rt28xx_get_wireless_stats(
|
||||||
|
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n"));
|
DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n"));
|
||||||
|
|
||||||
pAd->iw_stats.status = 0; // Status - device dependent for now
|
pAd->iw_stats.status = 0; // Status - device dependent for now
|
||||||
|
|
||||||
// link quality
|
// link quality
|
||||||
if (pAd->OpMode == OPMODE_STA)
|
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;
|
pAd->iw_stats.qual.qual = 100;
|
||||||
|
|
||||||
if (pAd->OpMode == OPMODE_STA)
|
if (pAd->OpMode == OPMODE_STA) {
|
||||||
{
|
|
||||||
pAd->iw_stats.qual.level =
|
pAd->iw_stats.qual.level =
|
||||||
RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0,
|
RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0,
|
||||||
pAd->StaCfg.RssiSample.LastRssi1,
|
pAd->StaCfg.RssiSample.LastRssi1,
|
||||||
pAd->StaCfg.RssiSample.LastRssi2);
|
pAd->StaCfg.RssiSample.LastRssi2);
|
||||||
}
|
}
|
||||||
|
|
||||||
pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm)
|
pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm)
|
||||||
|
|
||||||
pAd->iw_stats.qual.noise += 256 - 143;
|
pAd->iw_stats.qual.noise += 256 - 143;
|
||||||
pAd->iw_stats.qual.updated = 1; // Flags to know if updated
|
pAd->iw_stats.qual.updated = 1; // Flags to know if updated
|
||||||
#ifdef IW_QUAL_DBM
|
#ifdef IW_QUAL_DBM
|
||||||
pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm
|
pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm
|
||||||
#endif // IW_QUAL_DBM //
|
#endif // IW_QUAL_DBM //
|
||||||
|
|
||||||
pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid
|
pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid
|
||||||
pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe
|
pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe
|
||||||
|
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n"));
|
DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n"));
|
||||||
return &pAd->iw_stats;
|
return &pAd->iw_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void tbtt_tasklet(unsigned long data)
|
void tbtt_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
//#define MAX_TX_IN_TBTT (16)
|
//#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(
|
static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device
|
||||||
IN struct net_device *net_dev)
|
*net_dev)
|
||||||
{
|
{
|
||||||
RTMP_ADAPTER *pAd = NULL;
|
RTMP_ADAPTER *pAd = NULL;
|
||||||
|
|
||||||
if (net_dev)
|
if (net_dev)
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
if (pAd)
|
if (pAd) {
|
||||||
{
|
|
||||||
|
|
||||||
pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
|
pAd->stats.rx_packets =
|
||||||
pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
|
pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
|
||||||
|
pAd->stats.tx_packets =
|
||||||
|
pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
|
||||||
|
|
||||||
pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
|
pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
|
||||||
pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
|
pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
|
||||||
|
@ -680,45 +664,40 @@ static struct net_device_stats *RT28xx_get_ether_stats(
|
||||||
pAd->stats.rx_dropped = 0;
|
pAd->stats.rx_dropped = 0;
|
||||||
pAd->stats.tx_dropped = 0;
|
pAd->stats.tx_dropped = 0;
|
||||||
|
|
||||||
pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received
|
pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received
|
||||||
pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets
|
pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets
|
||||||
|
|
||||||
pAd->stats.rx_length_errors = 0;
|
pAd->stats.rx_length_errors = 0;
|
||||||
pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow
|
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_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_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun
|
||||||
pAd->stats.rx_missed_errors = 0; // receiver missed packet
|
pAd->stats.rx_missed_errors = 0; // receiver missed packet
|
||||||
|
|
||||||
// detailed tx_errors
|
// detailed tx_errors
|
||||||
pAd->stats.tx_aborted_errors = 0;
|
pAd->stats.tx_aborted_errors = 0;
|
||||||
pAd->stats.tx_carrier_errors = 0;
|
pAd->stats.tx_carrier_errors = 0;
|
||||||
pAd->stats.tx_fifo_errors = 0;
|
pAd->stats.tx_fifo_errors = 0;
|
||||||
pAd->stats.tx_heartbeat_errors = 0;
|
pAd->stats.tx_heartbeat_errors = 0;
|
||||||
pAd->stats.tx_window_errors = 0;
|
pAd->stats.tx_window_errors = 0;
|
||||||
|
|
||||||
// for cslip etc
|
// for cslip etc
|
||||||
pAd->stats.rx_compressed = 0;
|
pAd->stats.rx_compressed = 0;
|
||||||
pAd->stats.tx_compressed = 0;
|
pAd->stats.tx_compressed = 0;
|
||||||
|
|
||||||
return &pAd->stats;
|
return &pAd->stats;
|
||||||
}
|
} else
|
||||||
else
|
return NULL;
|
||||||
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
|
// Unregister network device
|
||||||
if (net_dev != NULL)
|
if (net_dev != NULL) {
|
||||||
{
|
printk
|
||||||
printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name);
|
("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n",
|
||||||
|
net_dev->name);
|
||||||
RtmpOSNetDevDetach(net_dev);
|
RtmpOSNetDevDetach(net_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +705,6 @@ BOOLEAN RtmpPhyNetDevExit(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -743,17 +721,14 @@ Return Value:
|
||||||
Note:
|
Note:
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
NDIS_STATUS AdapterBlockAllocateMemory(
|
NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd)
|
||||||
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));
|
NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER));
|
||||||
((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle;
|
((PRTMP_ADAPTER) * ppAd)->OS_Cookie = handle;
|
||||||
return (NDIS_STATUS_SUCCESS);
|
return (NDIS_STATUS_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return (NDIS_STATUS_FAILURE);
|
return (NDIS_STATUS_FAILURE);
|
||||||
|
|
|
@ -48,31 +48,28 @@ static void ac2_dma_done_tasklet(unsigned long data);
|
||||||
static void ac3_dma_done_tasklet(unsigned long data);
|
static void ac3_dma_done_tasklet(unsigned long data);
|
||||||
static void fifo_statistic_full_tasklet(unsigned long data);
|
static void fifo_statistic_full_tasklet(unsigned long data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* Symbol & Macro Definitions */
|
/* Symbol & Macro Definitions */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define RT2860_INT_RX_DLY (1<<0) // bit 0
|
#define RT2860_INT_RX_DLY (1<<0) // bit 0
|
||||||
#define RT2860_INT_TX_DLY (1<<1) // bit 1
|
#define RT2860_INT_TX_DLY (1<<1) // bit 1
|
||||||
#define RT2860_INT_RX_DONE (1<<2) // bit 2
|
#define RT2860_INT_RX_DONE (1<<2) // bit 2
|
||||||
#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3
|
#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3
|
||||||
#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4
|
#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4
|
||||||
#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5
|
#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5
|
||||||
#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6
|
#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6
|
||||||
#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7
|
#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7
|
||||||
#define RT2860_INT_MGMT_DONE (1<<8) // bit 8
|
#define RT2860_INT_MGMT_DONE (1<<8) // bit 8
|
||||||
|
|
||||||
#define INT_RX RT2860_INT_RX_DONE
|
#define INT_RX RT2860_INT_RX_DONE
|
||||||
|
|
||||||
#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY)
|
#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||||
#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY)
|
#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||||
#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY)
|
#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||||
#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY)
|
#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||||
#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY)
|
#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY)
|
||||||
#define INT_MGMT_DLY RT2860_INT_MGMT_DONE
|
#define INT_MGMT_DLY RT2860_INT_MGMT_DONE
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
*
|
||||||
* Interface-depended memory allocation/Free related procedures.
|
* 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.
|
// Function for TxDesc Memory allocation.
|
||||||
void RTMP_AllocateTxDescMemory(
|
void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN UINT Index,
|
||||||
IN UINT Index,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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.
|
// Function for MgmtDesc Memory allocation.
|
||||||
void RTMP_AllocateMgmtDescMemory(
|
void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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.
|
// Function for RxDesc Memory allocation.
|
||||||
void RTMP_AllocateRxDescMemory(
|
void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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.
|
// Function for free allocated Desc Memory.
|
||||||
void RTMP_FreeDescMemory(
|
void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN PVOID VirtualAddress,
|
||||||
IN PVOID VirtualAddress,
|
IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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.
|
// Function for TxData DMA Memory allocation.
|
||||||
void RTMP_AllocateFirstTxBuffer(
|
void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN UINT Index,
|
||||||
IN UINT Index,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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 ULONG Length,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN BOOLEAN Cached,
|
||||||
IN ULONG Length,
|
IN PVOID VirtualAddress,
|
||||||
IN BOOLEAN Cached,
|
IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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
|
* FUNCTION: Allocate a common buffer for DMA
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -175,19 +170,19 @@ void RTMP_FreeFirstTxBuffer(
|
||||||
* VirtualAddress: Pointer to memory is returned here
|
* VirtualAddress: Pointer to memory is returned here
|
||||||
* PhysicalAddress: Physical address corresponding to virtual address
|
* PhysicalAddress: Physical address corresponding to virtual address
|
||||||
*/
|
*/
|
||||||
void RTMP_AllocateSharedMemory(
|
void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
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
|
* FUNCTION: Allocate a packet buffer for DMA
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -199,25 +194,28 @@ void RTMP_AllocateSharedMemory(
|
||||||
* Notes:
|
* Notes:
|
||||||
* Cached is ignored: always cached memory
|
* Cached is ignored: always cached memory
|
||||||
*/
|
*/
|
||||||
PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
|
PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN ULONG Length,
|
||||||
IN ULONG Length,
|
IN BOOLEAN Cached,
|
||||||
IN BOOLEAN Cached,
|
OUT PVOID * VirtualAddress,
|
||||||
OUT PVOID *VirtualAddress,
|
OUT PNDIS_PHYSICAL_ADDRESS
|
||||||
OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
|
PhysicalAddress)
|
||||||
{
|
{
|
||||||
struct sk_buff *pkt;
|
struct sk_buff *pkt;
|
||||||
|
|
||||||
pkt = dev_alloc_skb(Length);
|
pkt = dev_alloc_skb(Length);
|
||||||
|
|
||||||
if (pkt == NULL) {
|
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) {
|
if (pkt) {
|
||||||
RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS);
|
RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS);
|
||||||
*VirtualAddress = (PVOID) pkt->data;
|
*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 {
|
} else {
|
||||||
*VirtualAddress = (PVOID) NULL;
|
*VirtualAddress = (PVOID) NULL;
|
||||||
*PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL;
|
*PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL;
|
||||||
|
@ -226,36 +224,40 @@ PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
|
||||||
return (PNDIS_PACKET) pkt;
|
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;
|
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;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd);
|
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->mgmt_dma_done_task, mgmt_dma_done_tasklet,
|
||||||
tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd);
|
(unsigned long)pAd);
|
||||||
tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd);
|
tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet,
|
||||||
tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd);
|
(unsigned long)pAd);
|
||||||
tasklet_init(&pObj->ac3_dma_done_task, ac3_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->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;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd)
|
||||||
void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
|
@ -271,15 +273,12 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
||||||
tasklet_kill(&pObj->fifo_statistic_full_task);
|
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;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -294,15 +293,12 @@ Return Value:
|
||||||
Note:
|
Note:
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RtmpMgmtTaskExit(
|
VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd)
|
||||||
IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode)
|
static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||||
{
|
{
|
||||||
u32 regValue;
|
u32 regValue;
|
||||||
|
@ -311,31 +307,28 @@ static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||||
regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask);
|
regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask);
|
||||||
//if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
|
//if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
|
||||||
{
|
{
|
||||||
RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable
|
RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
// DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n"));
|
// DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n"));
|
||||||
|
|
||||||
if (regValue != 0)
|
if (regValue != 0)
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode)
|
static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode)
|
||||||
{
|
{
|
||||||
u32 regValue;
|
u32 regValue;
|
||||||
|
|
||||||
pAd->int_disable_mask |= mode;
|
pAd->int_disable_mask |= mode;
|
||||||
regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask);
|
regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask);
|
||||||
RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable
|
RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable
|
||||||
|
|
||||||
if (regValue == 0)
|
if (regValue == 0) {
|
||||||
{
|
|
||||||
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
*
|
||||||
* tasklet related procedures.
|
* tasklet related procedures.
|
||||||
|
@ -345,17 +338,18 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
// printk("mgmt_dma_done_process\n");
|
// printk("mgmt_dma_done_process\n");
|
||||||
IntSource.word = 0;
|
IntSource.word = 0;
|
||||||
IntSource.field.MgmtDmaDone = 1;
|
IntSource.field.MgmtDmaDone = 1;
|
||||||
pAd->int_pending &= ~INT_MGMT_DLY;
|
pAd->int_pending &= ~INT_MGMT_DLY;
|
||||||
|
@ -368,8 +362,7 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||||
/*
|
/*
|
||||||
* double check to avoid lose of interrupts
|
* 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);
|
tasklet_hi_schedule(&pObj->mgmt_dma_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -380,30 +373,29 @@ static void mgmt_dma_done_tasklet(unsigned long data)
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rx_done_tasklet(unsigned long data)
|
static void rx_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
BOOLEAN bReschedule = 0;
|
BOOLEAN bReschedule = 0;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
pAd->int_pending &= ~(INT_RX);
|
pAd->int_pending &= ~(INT_RX);
|
||||||
bReschedule = STARxDoneInterruptHandle(pAd, 0);
|
bReschedule = STARxDoneInterruptHandle(pAd, 0);
|
||||||
|
|
||||||
RTMP_INT_LOCK(&pAd->irq_lock, flags);
|
RTMP_INT_LOCK(&pAd->irq_lock, flags);
|
||||||
/*
|
/*
|
||||||
* double check to avoid rotting packet
|
* 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);
|
tasklet_hi_schedule(&pObj->rx_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -415,7 +407,6 @@ static void rx_done_tasklet(unsigned long data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fifo_statistic_full_tasklet(unsigned long data)
|
void fifo_statistic_full_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -424,10 +415,11 @@ void fifo_statistic_full_tasklet(unsigned long data)
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
pAd->int_pending &= ~(FifoStaFullInt);
|
pAd->int_pending &= ~(FifoStaFullInt);
|
||||||
NICUpdateFifoStaCounters(pAd);
|
NICUpdateFifoStaCounters(pAd);
|
||||||
|
@ -436,8 +428,7 @@ void fifo_statistic_full_tasklet(unsigned long data)
|
||||||
/*
|
/*
|
||||||
* double check to avoid rotting packet
|
* double check to avoid rotting packet
|
||||||
*/
|
*/
|
||||||
if (pAd->int_pending & FifoStaFullInt)
|
if (pAd->int_pending & FifoStaFullInt) {
|
||||||
{
|
|
||||||
tasklet_hi_schedule(&pObj->fifo_statistic_full_task);
|
tasklet_hi_schedule(&pObj->fifo_statistic_full_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -454,18 +445,19 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
BOOLEAN bReschedule = 0;
|
BOOLEAN bReschedule = 0;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
// printk("ac0_dma_done_process\n");
|
// printk("ac0_dma_done_process\n");
|
||||||
IntSource.word = 0;
|
IntSource.word = 0;
|
||||||
IntSource.field.Ac3DmaDone = 1;
|
IntSource.field.Ac3DmaDone = 1;
|
||||||
pAd->int_pending &= ~INT_AC3_DLY;
|
pAd->int_pending &= ~INT_AC3_DLY;
|
||||||
|
@ -476,8 +468,7 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||||
/*
|
/*
|
||||||
* double check to avoid lose of interrupts
|
* 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);
|
tasklet_hi_schedule(&pObj->ac3_dma_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -488,21 +479,21 @@ static void ac3_dma_done_tasklet(unsigned long data)
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ac2_dma_done_tasklet(unsigned long data)
|
static void ac2_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
BOOLEAN bReschedule = 0;
|
BOOLEAN bReschedule = 0;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
IntSource.word = 0;
|
IntSource.word = 0;
|
||||||
IntSource.field.Ac2DmaDone = 1;
|
IntSource.field.Ac2DmaDone = 1;
|
||||||
|
@ -515,8 +506,7 @@ static void ac2_dma_done_tasklet(unsigned long data)
|
||||||
/*
|
/*
|
||||||
* double check to avoid lose of interrupts
|
* 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);
|
tasklet_hi_schedule(&pObj->ac2_dma_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -527,23 +517,23 @@ static void ac2_dma_done_tasklet(unsigned long data)
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ac1_dma_done_tasklet(unsigned long data)
|
static void ac1_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
BOOLEAN bReschedule = 0;
|
BOOLEAN bReschedule = 0;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
// printk("ac0_dma_done_process\n");
|
// printk("ac0_dma_done_process\n");
|
||||||
IntSource.word = 0;
|
IntSource.word = 0;
|
||||||
IntSource.field.Ac1DmaDone = 1;
|
IntSource.field.Ac1DmaDone = 1;
|
||||||
pAd->int_pending &= ~INT_AC1_DLY;
|
pAd->int_pending &= ~INT_AC1_DLY;
|
||||||
|
@ -554,8 +544,7 @@ static void ac1_dma_done_tasklet(unsigned long data)
|
||||||
/*
|
/*
|
||||||
* double check to avoid lose of interrupts
|
* 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);
|
tasklet_hi_schedule(&pObj->ac1_dma_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -566,36 +555,35 @@ static void ac1_dma_done_tasklet(unsigned long data)
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ac0_dma_done_tasklet(unsigned long data)
|
static void ac0_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
BOOLEAN bReschedule = 0;
|
BOOLEAN bReschedule = 0;
|
||||||
|
|
||||||
// Do nothing if the driver is starting halt state.
|
// Do nothing if the driver is starting halt state.
|
||||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
// 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;
|
return;
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
// printk("ac0_dma_done_process\n");
|
// printk("ac0_dma_done_process\n");
|
||||||
IntSource.word = 0;
|
IntSource.word = 0;
|
||||||
IntSource.field.Ac0DmaDone = 1;
|
IntSource.field.Ac0DmaDone = 1;
|
||||||
pAd->int_pending &= ~INT_AC0_DLY;
|
pAd->int_pending &= ~INT_AC0_DLY;
|
||||||
|
|
||||||
// RTMPHandleMgmtRingDmaDoneInterrupt(pAd);
|
// RTMPHandleMgmtRingDmaDoneInterrupt(pAd);
|
||||||
bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource);
|
bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource);
|
||||||
|
|
||||||
RTMP_INT_LOCK(&pAd->irq_lock, flags);
|
RTMP_INT_LOCK(&pAd->irq_lock, flags);
|
||||||
/*
|
/*
|
||||||
* double check to avoid lose of interrupts
|
* 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);
|
tasklet_hi_schedule(&pObj->ac0_dma_done_task);
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
return;
|
return;
|
||||||
|
@ -606,9 +594,6 @@ static void ac0_dma_done_tasklet(unsigned long data)
|
||||||
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
RTMP_INT_UNLOCK(&pAd->irq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
*
|
||||||
* interrupt handler related procedures.
|
* interrupt handler related procedures.
|
||||||
|
@ -618,27 +603,25 @@ int print_int_count;
|
||||||
|
|
||||||
IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
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;
|
PRTMP_ADAPTER pAd = NULL;
|
||||||
INT_SOURCE_CSR_STRUC IntSource;
|
INT_SOURCE_CSR_STRUC IntSource;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
GET_PAD_FROM_NET_DEV(pAd, net_dev);
|
||||||
|
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
|
|
||||||
/* Note 03312008: we can not return here before
|
/* Note 03312008: we can not return here before
|
||||||
RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word);
|
RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word);
|
||||||
RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word);
|
RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word);
|
||||||
Or kernel will panic after ifconfig ra0 down sometimes */
|
Or kernel will panic after ifconfig ra0 down sometimes */
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Inital the Interrupt source.
|
// Inital the Interrupt source.
|
||||||
//
|
//
|
||||||
IntSource.word = 0x00000000L;
|
IntSource.word = 0x00000000L;
|
||||||
// McuIntSource.word = 0x00000000L;
|
// McuIntSource.word = 0x00000000L;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the interrupt sources & saved to local variable
|
// Get the interrupt sources & saved to local variable
|
||||||
|
@ -655,25 +638,26 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||||
//
|
//
|
||||||
// RT2661 => when ASIC is sleeping, MAC register cannot be read and written.
|
// RT2661 => when ASIC is sleeping, MAC register cannot be read and written.
|
||||||
// RT2860 => when ASIC is sleeping, MAC register can be read and written.
|
// RT2860 => when ASIC is sleeping, MAC register can be read and written.
|
||||||
// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
|
// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
|
||||||
{
|
{
|
||||||
RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word);
|
RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word);
|
||||||
RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear
|
RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n"));
|
// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n"));
|
||||||
|
|
||||||
// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear);
|
// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear);
|
||||||
// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear);
|
// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear);
|
||||||
// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n",
|
// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n",
|
||||||
// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear));
|
// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear));
|
||||||
|
|
||||||
// Do nothing if Reset in progress
|
// 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,
|
||||||
return IRQ_HANDLED;
|
(fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
|
fRTMP_ADAPTER_HALT_IN_PROGRESS))) {
|
||||||
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle interrupt, walk through all bits
|
// Handle interrupt, walk through all bits
|
||||||
// Should start from highest priority interrupt
|
// Should start from highest priority interrupt
|
||||||
|
@ -684,7 +668,6 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
pAd->bPCIclkOff = FALSE;
|
pAd->bPCIclkOff = FALSE;
|
||||||
|
|
||||||
// If required spinlock, each interrupt service routine has to acquire
|
// 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
|
// Do nothing if NIC doesn't exist
|
||||||
if (IntSource.word == 0xffffffff)
|
if (IntSource.word == 0xffffffff) {
|
||||||
{
|
RTMP_SET_FLAG(pAd,
|
||||||
RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS));
|
(fRTMP_ADAPTER_NIC_NOT_EXIST |
|
||||||
return IRQ_HANDLED;
|
fRTMP_ADAPTER_HALT_IN_PROGRESS));
|
||||||
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & TxCoherent)
|
if (IntSource.word & TxCoherent) {
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n"));
|
DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n"));
|
||||||
RTMPHandleRxCoherentInterrupt(pAd);
|
RTMPHandleRxCoherentInterrupt(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & RxCoherent)
|
if (IntSource.word & RxCoherent) {
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n"));
|
DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n"));
|
||||||
RTMPHandleRxCoherentInterrupt(pAd);
|
RTMPHandleRxCoherentInterrupt(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & FifoStaFullInt)
|
if (IntSource.word & FifoStaFullInt) {
|
||||||
{
|
if ((pAd->int_disable_mask & FifoStaFullInt) == 0) {
|
||||||
if ((pAd->int_disable_mask & FifoStaFullInt) == 0)
|
|
||||||
{
|
|
||||||
/* mask FifoStaFullInt */
|
/* mask FifoStaFullInt */
|
||||||
rt2860_int_disable(pAd, FifoStaFullInt);
|
rt2860_int_disable(pAd, FifoStaFullInt);
|
||||||
tasklet_hi_schedule(&pObj->fifo_statistic_full_task);
|
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;
|
pAd->int_pending |= FifoStaFullInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & INT_MGMT_DLY)
|
if (IntSource.word & INT_MGMT_DLY) {
|
||||||
{
|
if ((pAd->int_disable_mask & INT_MGMT_DLY) == 0) {
|
||||||
if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 )
|
|
||||||
{
|
|
||||||
rt2860_int_disable(pAd, INT_MGMT_DLY);
|
rt2860_int_disable(pAd, INT_MGMT_DLY);
|
||||||
tasklet_hi_schedule(&pObj->mgmt_dma_done_task);
|
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 (IntSource.word & INT_RX) {
|
||||||
{
|
if ((pAd->int_disable_mask & INT_RX) == 0) {
|
||||||
if ((pAd->int_disable_mask & INT_RX) == 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* mask RxINT */
|
/* mask RxINT */
|
||||||
rt2860_int_disable(pAd, INT_RX);
|
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;
|
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 */
|
/* mask TxDataInt */
|
||||||
rt2860_int_disable(pAd, INT_AC3_DLY);
|
rt2860_int_disable(pAd, INT_AC3_DLY);
|
||||||
tasklet_hi_schedule(&pObj->ac3_dma_done_task);
|
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;
|
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 */
|
/* mask TxDataInt */
|
||||||
rt2860_int_disable(pAd, INT_AC2_DLY);
|
rt2860_int_disable(pAd, INT_AC2_DLY);
|
||||||
tasklet_hi_schedule(&pObj->ac2_dma_done_task);
|
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;
|
pAd->int_pending |= INT_AC2_DLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & INT_AC1_DLY)
|
if (IntSource.word & INT_AC1_DLY) {
|
||||||
{
|
|
||||||
|
|
||||||
pAd->int_pending |= 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 */
|
/* mask TxDataInt */
|
||||||
rt2860_int_disable(pAd, INT_AC1_DLY);
|
rt2860_int_disable(pAd, INT_AC1_DLY);
|
||||||
tasklet_hi_schedule(&pObj->ac1_dma_done_task);
|
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) {
|
if (IntSource.word & 0x2) {
|
||||||
|
@ -793,8 +762,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||||
*/
|
*/
|
||||||
pAd->int_pending |= INT_AC0_DLY;
|
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 */
|
/* mask TxDataInt */
|
||||||
rt2860_int_disable(pAd, INT_AC0_DLY);
|
rt2860_int_disable(pAd, INT_AC0_DLY);
|
||||||
tasklet_hi_schedule(&pObj->ac0_dma_done_task);
|
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);
|
RTMPHandlePreTBTTInterrupt(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntSource.word & TBTTInt)
|
if (IntSource.word & TBTTInt) {
|
||||||
{
|
|
||||||
RTMPHandleTBTTInterrupt(pAd);
|
RTMPHandleTBTTInterrupt(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,57 +783,57 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
|
||||||
RTMPHandleTwakeupInterrupt(pAd);
|
RTMPHandleTwakeupInterrupt(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* invaild or writeback cache
|
* invaild or writeback cache
|
||||||
* and convert virtual address to physical address
|
* 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;
|
PRTMP_ADAPTER pAd;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------ Porting Information ------
|
------ Porting Information ------
|
||||||
> For Tx Alloc:
|
> For Tx Alloc:
|
||||||
mgmt packets => sd_idx = 0
|
mgmt packets => sd_idx = 0
|
||||||
SwIdx: pAd->MgmtRing.TxCpuIdx
|
SwIdx: pAd->MgmtRing.TxCpuIdx
|
||||||
pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa;
|
pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa;
|
||||||
|
|
||||||
data packets => sd_idx = 1
|
data packets => sd_idx = 1
|
||||||
TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx
|
TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx
|
||||||
QueIdx: pTxBlk->QueIdx
|
QueIdx: pTxBlk->QueIdx
|
||||||
pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa;
|
pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa;
|
||||||
|
|
||||||
> For Rx Alloc:
|
> For Rx Alloc:
|
||||||
sd_idx = -1
|
sd_idx = -1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pAd = (PRTMP_ADAPTER)handle;
|
pAd = (PRTMP_ADAPTER) handle;
|
||||||
pObj = (POS_COOKIE)pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
if (sd_idx == 1)
|
if (sd_idx == 1) {
|
||||||
{
|
PTX_BLK pTxBlk;
|
||||||
PTX_BLK pTxBlk;
|
pTxBlk = (PTX_BLK) ptr;
|
||||||
pTxBlk = (PTX_BLK)ptr;
|
return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData,
|
||||||
return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction);
|
pTxBlk->SrcBufLen, direction);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return pci_map_single(pObj->pci_dev, ptr, size, direction);
|
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;
|
PRTMP_ADAPTER pAd;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
pAd=(PRTMP_ADAPTER)handle;
|
pAd = (PRTMP_ADAPTER) handle;
|
||||||
pObj = (POS_COOKIE)pAd->OS_Cookie;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
pci_unmap_single(pObj->pci_dev, dma_addr, size, direction);
|
pci_unmap_single(pObj->pci_dev, dma_addr, size, direction);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include "rt_config.h"
|
#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("urb :0x%08lx\n", (unsigned long)purb);
|
||||||
printk("\tdev :0x%08lx\n", (unsigned long)purb->dev);
|
printk("\tdev :0x%08lx\n", (unsigned long)purb->dev);
|
||||||
|
@ -46,16 +46,20 @@
|
||||||
printk("\tpipe :0x%08x\n", purb->pipe);
|
printk("\tpipe :0x%08x\n", purb->pipe);
|
||||||
printk("\tstatus :%d\n", purb->status);
|
printk("\tstatus :%d\n", purb->status);
|
||||||
printk("\ttransfer_flags :0x%08x\n", purb->transfer_flags);
|
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("\ttransfer_buffer_length:%d\n", purb->transfer_buffer_length);
|
||||||
printk("\tactual_length :%d\n", purb->actual_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("\tstart_frame :%d\n", purb->start_frame);
|
||||||
printk("\tnumber_of_packets :%d\n", purb->number_of_packets);
|
printk("\tnumber_of_packets :%d\n", purb->number_of_packets);
|
||||||
printk("\tinterval :%d\n", purb->interval);
|
printk("\tinterval :%d\n", purb->interval);
|
||||||
printk("\terror_count :%d\n", purb->error_count);
|
printk("\terror_count :%d\n", purb->error_count);
|
||||||
printk("\tcontext :0x%08lx\n", (unsigned long)purb->context);
|
printk("\tcontext :0x%08lx\n",
|
||||||
printk("\tcomplete :0x%08lx\n\n", (unsigned long)purb->complete);
|
(unsigned long)purb->context);
|
||||||
|
printk("\tcomplete :0x%08lx\n\n",
|
||||||
|
(unsigned long)purb->complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -73,23 +77,22 @@ Return Value:
|
||||||
Note:
|
Note:
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
NDIS_STATUS RtmpMgmtTaskInit(
|
NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd)
|
||||||
IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
RTMP_OS_TASK *pTask;
|
RTMP_OS_TASK *pTask;
|
||||||
NDIS_STATUS status;
|
NDIS_STATUS status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Creat TimerQ Thread, We need init timerQ related structure before create the timer thread.
|
Creat TimerQ Thread, We need init timerQ related structure before create the timer thread.
|
||||||
*/
|
*/
|
||||||
RtmpTimerQInit(pAd);
|
RtmpTimerQInit(pAd);
|
||||||
|
|
||||||
pTask = &pAd->timerTask;
|
pTask = &pAd->timerTask;
|
||||||
RtmpOSTaskInit(pTask, "RtmpTimerTask", pAd);
|
RtmpOSTaskInit(pTask, "RtmpTimerTask", pAd);
|
||||||
status = RtmpOSTaskAttach(pTask, RtmpTimerQThread, pTask);
|
status = RtmpOSTaskAttach(pTask, RtmpTimerQThread, pTask);
|
||||||
if (status == NDIS_STATUS_FAILURE)
|
if (status == NDIS_STATUS_FAILURE) {
|
||||||
{
|
printk(KERN_WARNING "%s: unable to start RtmpTimerQThread\n",
|
||||||
printk (KERN_WARNING "%s: unable to start RtmpTimerQThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||||
return NDIS_STATUS_FAILURE;
|
return NDIS_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,9 +100,9 @@ NDIS_STATUS RtmpMgmtTaskInit(
|
||||||
pTask = &pAd->mlmeTask;
|
pTask = &pAd->mlmeTask;
|
||||||
RtmpOSTaskInit(pTask, "RtmpMlmeTask", pAd);
|
RtmpOSTaskInit(pTask, "RtmpMlmeTask", pAd);
|
||||||
status = RtmpOSTaskAttach(pTask, MlmeThread, pTask);
|
status = RtmpOSTaskAttach(pTask, MlmeThread, pTask);
|
||||||
if (status == NDIS_STATUS_FAILURE)
|
if (status == NDIS_STATUS_FAILURE) {
|
||||||
{
|
printk(KERN_WARNING "%s: unable to start MlmeThread\n",
|
||||||
printk (KERN_WARNING "%s: unable to start MlmeThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||||
return NDIS_STATUS_FAILURE;
|
return NDIS_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,18 +110,15 @@ NDIS_STATUS RtmpMgmtTaskInit(
|
||||||
pTask = &pAd->cmdQTask;
|
pTask = &pAd->cmdQTask;
|
||||||
RtmpOSTaskInit(pTask, "RtmpCmdQTask", pAd);
|
RtmpOSTaskInit(pTask, "RtmpCmdQTask", pAd);
|
||||||
status = RtmpOSTaskAttach(pTask, RTUSBCmdThread, pTask);
|
status = RtmpOSTaskAttach(pTask, RTUSBCmdThread, pTask);
|
||||||
if (status == NDIS_STATUS_FAILURE)
|
if (status == NDIS_STATUS_FAILURE) {
|
||||||
{
|
printk(KERN_WARNING "%s: unable to start RTUSBCmdThread\n",
|
||||||
printk (KERN_WARNING "%s: unable to start RTUSBCmdThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev));
|
||||||
return NDIS_STATUS_FAILURE;
|
return NDIS_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return NDIS_STATUS_SUCCESS;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -133,11 +133,10 @@ Return Value:
|
||||||
Note:
|
Note:
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RtmpMgmtTaskExit(
|
VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd)
|
||||||
IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
INT ret;
|
INT ret;
|
||||||
RTMP_OS_TASK *pTask;
|
RTMP_OS_TASK *pTask;
|
||||||
|
|
||||||
// Sleep 50 milliseconds so pending io might finish normally
|
// Sleep 50 milliseconds so pending io might finish normally
|
||||||
RTMPusecDelay(50000);
|
RTMPusecDelay(50000);
|
||||||
|
@ -153,10 +152,11 @@ VOID RtmpMgmtTaskExit(
|
||||||
/* Terminate Mlme Thread */
|
/* Terminate Mlme Thread */
|
||||||
pTask = &pAd->mlmeTask;
|
pTask = &pAd->mlmeTask;
|
||||||
ret = RtmpOSTaskKill(pTask);
|
ret = RtmpOSTaskKill(pTask);
|
||||||
if (ret == NDIS_STATUS_FAILURE)
|
if (ret == NDIS_STATUS_FAILURE) {
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
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 */
|
/* Terminate cmdQ thread */
|
||||||
|
@ -174,10 +174,11 @@ VOID RtmpMgmtTaskExit(
|
||||||
mb();
|
mb();
|
||||||
//RTUSBCMDUp(pAd);
|
//RTUSBCMDUp(pAd);
|
||||||
ret = RtmpOSTaskKill(pTask);
|
ret = RtmpOSTaskKill(pTask);
|
||||||
if (ret == NDIS_STATUS_FAILURE)
|
if (ret == NDIS_STATUS_FAILURE) {
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
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;
|
pAd->CmdQ.CmdQState = RTMP_TASK_STAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -185,47 +186,44 @@ VOID RtmpMgmtTaskExit(
|
||||||
/* Terminate timer thread */
|
/* Terminate timer thread */
|
||||||
pTask = &pAd->timerTask;
|
pTask = &pAd->timerTask;
|
||||||
ret = RtmpOSTaskKill(pTask);
|
ret = RtmpOSTaskKill(pTask);
|
||||||
if (ret == NDIS_STATUS_FAILURE)
|
if (ret == NDIS_STATUS_FAILURE) {
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n",
|
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)
|
static void rtusb_dataout_complete(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
PHT_TX_CONTEXT pHTTXContext;
|
PHT_TX_CONTEXT pHTTXContext;
|
||||||
UCHAR BulkOutPipeId;
|
UCHAR BulkOutPipeId;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
unsigned long IrqFlags;
|
unsigned long IrqFlags;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
pAd = pHTTXContext->pAd;
|
||||||
pAd = pHTTXContext->pAd;
|
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
pObj = (POS_COOKIE) pAd->OS_Cookie;
|
Status = pUrb->status;
|
||||||
Status = pUrb->status;
|
|
||||||
|
|
||||||
// Store BulkOut PipeId
|
// Store BulkOut PipeId
|
||||||
BulkOutPipeId = pHTTXContext->BulkOutPipeId;
|
BulkOutPipeId = pHTTXContext->BulkOutPipeId;
|
||||||
pAd->BulkOutDataOneSecCount++;
|
pAd->BulkOutDataOneSecCount++;
|
||||||
|
|
||||||
//DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition,
|
//DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition,
|
||||||
// pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad));
|
// pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad));
|
||||||
|
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
||||||
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
|
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
|
||||||
pHTTXContext->IRPPending = FALSE;
|
pHTTXContext->IRPPending = FALSE;
|
||||||
pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0;
|
pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0;
|
||||||
|
|
||||||
if (Status == USB_ST_NOERROR)
|
if (Status == USB_ST_NOERROR) {
|
||||||
{
|
|
||||||
pAd->BulkOutComplete++;
|
pAd->BulkOutComplete++;
|
||||||
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
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);
|
FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext);
|
||||||
//RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
//RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
|
|
||||||
|
} else // STATUS_OTHER
|
||||||
}
|
|
||||||
else // STATUS_OTHER
|
|
||||||
{
|
{
|
||||||
PUCHAR pBuf;
|
PUCHAR pBuf;
|
||||||
|
|
||||||
pAd->BulkOutCompleteOther++;
|
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 |
|
if (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST |
|
fRTMP_ADAPTER_NIC_NOT_EXIST |
|
||||||
fRTMP_ADAPTER_BULKOUT_RESET)))
|
fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||||
{
|
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||||
pAd->bulkResetPipeid = BulkOutPipeId;
|
pAd->bulkResetPipeid = BulkOutPipeId;
|
||||||
pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq;
|
pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq;
|
||||||
}
|
}
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
|
||||||
|
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkOutDataPacket failed: ReasonCode=%d!\n", Status));
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther));
|
("BulkOutDataPacket failed: ReasonCode=%d!\n",
|
||||||
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]));
|
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));
|
//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.
|
// bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out.
|
||||||
//
|
//
|
||||||
//RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
//RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) &&
|
if ((pHTTXContext->ENextBulkOutPosition !=
|
||||||
(pHTTXContext->ENextBulkOutPosition != (pHTTXContext->CurWritePosition+8)) &&
|
pHTTXContext->CurWritePosition)
|
||||||
!RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)))
|
&& (pHTTXContext->ENextBulkOutPosition !=
|
||||||
{
|
(pHTTXContext->CurWritePosition + 8))
|
||||||
|
&& !RTUSB_TEST_BULK_FLAG(pAd,
|
||||||
|
(fRTUSB_BULK_OUT_DATA_FRAG <<
|
||||||
|
BulkOutPipeId))) {
|
||||||
// Indicate There is data avaliable
|
// 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);
|
//RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
|
|
||||||
|
@ -282,49 +292,46 @@ static void rtusb_dataout_complete(unsigned long data)
|
||||||
RTUSBKickBulkOut(pAd);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_null_frame_done_tasklet(unsigned long data)
|
static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PTX_CONTEXT pNullContext;
|
PTX_CONTEXT pNullContext;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
unsigned long irqFlag;
|
unsigned long irqFlag;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pNullContext = (PTX_CONTEXT) pUrb->context;
|
||||||
pNullContext = (PTX_CONTEXT)pUrb->context;
|
pAd = pNullContext->pAd;
|
||||||
pAd = pNullContext->pAd;
|
Status = pUrb->status;
|
||||||
Status = pUrb->status;
|
|
||||||
|
|
||||||
// Reset Null frame context flags
|
// Reset Null frame context flags
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
pNullContext->IRPPending = FALSE;
|
pNullContext->IRPPending = FALSE;
|
||||||
pNullContext->InUse = FALSE;
|
pNullContext->InUse = FALSE;
|
||||||
pAd->BulkOutPending[0] = FALSE;
|
pAd->BulkOutPending[0] = FALSE;
|
||||||
pAd->watchDogTxPendingCnt[0] = 0;
|
pAd->watchDogTxPendingCnt[0] = 0;
|
||||||
|
|
||||||
if (Status == USB_ST_NOERROR)
|
if (Status == USB_ST_NOERROR) {
|
||||||
{
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
|
|
||||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
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)) &&
|
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_HALT_IN_PROGRESS)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||||
{
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", Status));
|
("Bulk Out Null Frame Failed, ReasonCode=%d!\n",
|
||||||
|
Status));
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
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);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
}
|
NULL, 0);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,46 +341,42 @@ static void rtusb_null_frame_done_tasklet(unsigned long data)
|
||||||
RTUSBKickBulkOut(pAd);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PTX_CONTEXT pRTSContext;
|
PTX_CONTEXT pRTSContext;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
unsigned long irqFlag;
|
unsigned long irqFlag;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pRTSContext = (PTX_CONTEXT) pUrb->context;
|
||||||
pRTSContext = (PTX_CONTEXT)pUrb->context;
|
pAd = pRTSContext->pAd;
|
||||||
pAd = pRTSContext->pAd;
|
Status = pUrb->status;
|
||||||
Status = pUrb->status;
|
|
||||||
|
|
||||||
// Reset RTS frame context flags
|
// Reset RTS frame context flags
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
pRTSContext->IRPPending = FALSE;
|
pRTSContext->IRPPending = FALSE;
|
||||||
pRTSContext->InUse = FALSE;
|
pRTSContext->InUse = FALSE;
|
||||||
|
|
||||||
if (Status == USB_ST_NOERROR)
|
if (Status == USB_ST_NOERROR) {
|
||||||
{
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
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)) &&
|
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_HALT_IN_PROGRESS)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||||
{
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out RTS Frame Failed\n"));
|
("Bulk Out RTS Frame Failed\n"));
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
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);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
}
|
NULL, 0);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,44 +389,40 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data)
|
||||||
// The protectioon of rest bulk should be in BulkOut routine
|
// The protectioon of rest bulk should be in BulkOut routine
|
||||||
RTUSBKickBulkOut(pAd);
|
RTUSBKickBulkOut(pAd);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
static void rtusb_pspoll_frame_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PTX_CONTEXT pPsPollContext;
|
PTX_CONTEXT pPsPollContext;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
|
pPsPollContext = (PTX_CONTEXT) pUrb->context;
|
||||||
pUrb = (purbb_t)data;
|
pAd = pPsPollContext->pAd;
|
||||||
pPsPollContext = (PTX_CONTEXT)pUrb->context;
|
Status = pUrb->status;
|
||||||
pAd = pPsPollContext->pAd;
|
|
||||||
Status = pUrb->status;
|
|
||||||
|
|
||||||
// Reset PsPoll context flags
|
// Reset PsPoll context flags
|
||||||
pPsPollContext->IRPPending = FALSE;
|
pPsPollContext->IRPPending = FALSE;
|
||||||
pPsPollContext->InUse = FALSE;
|
pPsPollContext->InUse = FALSE;
|
||||||
pAd->watchDogTxPendingCnt[0] = 0;
|
pAd->watchDogTxPendingCnt[0] = 0;
|
||||||
|
|
||||||
if (Status == USB_ST_NOERROR)
|
if (Status == USB_ST_NOERROR) {
|
||||||
{
|
|
||||||
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
|
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)) &&
|
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_HALT_IN_PROGRESS)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||||
{
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out PSPoll Failed\n"));
|
("Bulk Out PSPoll Failed\n"));
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
pAd->bulkResetPipeid =
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
(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:
|
Routine Description:
|
||||||
|
@ -454,18 +452,17 @@ Note:
|
||||||
*/
|
*/
|
||||||
static void rx_done_tasklet(unsigned long data)
|
static void rx_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
PRX_CONTEXT pRxContext;
|
PRX_CONTEXT pRxContext;
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
unsigned int IrqFlags;
|
unsigned int IrqFlags;
|
||||||
|
|
||||||
pUrb = (purbb_t)data;
|
pUrb = (purbb_t) data;
|
||||||
pRxContext = (PRX_CONTEXT)pUrb->context;
|
pRxContext = (PRX_CONTEXT) pUrb->context;
|
||||||
pAd = pRxContext->pAd;
|
pAd = pRxContext->pAd;
|
||||||
Status = pUrb->status;
|
Status = pUrb->status;
|
||||||
|
|
||||||
|
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
|
||||||
pRxContext->InUse = FALSE;
|
pRxContext->InUse = FALSE;
|
||||||
pRxContext->IRPPending = FALSE;
|
pRxContext->IRPPending = FALSE;
|
||||||
|
@ -473,8 +470,7 @@ static void rx_done_tasklet(unsigned long data)
|
||||||
//NdisInterlockedDecrement(&pAd->PendingRx);
|
//NdisInterlockedDecrement(&pAd->PendingRx);
|
||||||
pAd->PendingRx--;
|
pAd->PendingRx--;
|
||||||
|
|
||||||
if (Status == USB_ST_NOERROR)
|
if (Status == USB_ST_NOERROR) {
|
||||||
{
|
|
||||||
pAd->BulkInComplete++;
|
pAd->BulkInComplete++;
|
||||||
pAd->NextRxBulkInPosition = 0;
|
pAd->NextRxBulkInPosition = 0;
|
||||||
if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero.
|
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);
|
INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE);
|
||||||
}
|
}
|
||||||
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
|
||||||
}
|
} else // STATUS_OTHER
|
||||||
else // STATUS_OTHER
|
|
||||||
{
|
{
|
||||||
pAd->BulkInCompleteFail++;
|
pAd->BulkInCompleteFail++;
|
||||||
// Still read this packet although it may comtain wrong bytes.
|
// Still read this packet although it may comtain wrong bytes.
|
||||||
|
@ -493,16 +488,19 @@ static void rx_done_tasklet(unsigned long data)
|
||||||
|
|
||||||
// Parsing all packets. because after reset, the index will reset to all zero.
|
// Parsing all packets. because after reset, the index will reset to all zero.
|
||||||
if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_BULKIN_RESET |
|
fRTMP_ADAPTER_BULKIN_RESET |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
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",
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
Status, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pRxContext->pUrb->actual_length));
|
("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);
|
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,46 +508,43 @@ static void rx_done_tasklet(unsigned long data)
|
||||||
|
|
||||||
RTUSBBulkReceive(pAd);
|
RTUSBBulkReceive(pAd);
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PTX_CONTEXT pMLMEContext;
|
PTX_CONTEXT pMLMEContext;
|
||||||
int index;
|
int index;
|
||||||
PNDIS_PACKET pPacket;
|
PNDIS_PACKET pPacket;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
unsigned long IrqFlags;
|
unsigned long IrqFlags;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pMLMEContext = (PTX_CONTEXT) pUrb->context;
|
||||||
pMLMEContext = (PTX_CONTEXT)pUrb->context;
|
pAd = pMLMEContext->pAd;
|
||||||
pAd = pMLMEContext->pAd;
|
Status = pUrb->status;
|
||||||
Status = pUrb->status;
|
index = pMLMEContext->SelfIdx;
|
||||||
index = pMLMEContext->SelfIdx;
|
|
||||||
|
|
||||||
ASSERT((pAd->MgmtRing.TxDmaIdx == index));
|
ASSERT((pAd->MgmtRing.TxDmaIdx == index));
|
||||||
|
|
||||||
RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
|
||||||
|
|
||||||
|
if (Status != USB_ST_NOERROR) {
|
||||||
if (Status != USB_ST_NOERROR)
|
|
||||||
{
|
|
||||||
//Bulk-Out fail status handle
|
//Bulk-Out fail status handle
|
||||||
if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) &&
|
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_HALT_IN_PROGRESS)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&
|
||||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)))
|
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) {
|
||||||
{
|
DBGPRINT_RAW(RT_DEBUG_ERROR,
|
||||||
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status));
|
("Bulk Out MLME Failed, Status=%d!\n",
|
||||||
|
Status));
|
||||||
// TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt?
|
// TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt?
|
||||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
|
||||||
pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
pAd->bulkResetPipeid =
|
||||||
|
(MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,163 +571,141 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data)
|
||||||
RTMPFreeNdisPacket(pAd, pPacket);
|
RTMPFreeNdisPacket(pAd, pPacket);
|
||||||
|
|
||||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||||
{
|
|
||||||
// do nothing and return directly.
|
// do nothing and return directly.
|
||||||
}
|
} 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,
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) &&
|
NULL, 0);
|
||||||
((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG))
|
} else {
|
||||||
{ // For Mgmt Bulk-Out failed, ignore it now.
|
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// Always call Bulk routine, even reset bulk.
|
// Always call Bulk routine, even reset bulk.
|
||||||
// The protectioon of rest bulk should be in BulkOut routine
|
// 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);
|
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME);
|
||||||
}
|
}
|
||||||
RTUSBKickBulkOut(pAd);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtusb_ac3_dma_done_tasklet(unsigned long data)
|
static void rtusb_ac3_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PHT_TX_CONTEXT pHTTXContext;
|
PHT_TX_CONTEXT pHTTXContext;
|
||||||
UCHAR BulkOutPipeId = 3;
|
UCHAR BulkOutPipeId = 3;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
pAd = pHTTXContext->pAd;
|
||||||
pAd = pHTTXContext->pAd;
|
|
||||||
|
|
||||||
rtusb_dataout_complete((unsigned long)pUrb);
|
rtusb_dataout_complete((unsigned long)pUrb);
|
||||||
|
|
||||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||||
{
|
|
||||||
// do nothing and return directly.
|
// do nothing and return directly.
|
||||||
}
|
} else {
|
||||||
else
|
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||||
{
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
NULL, 0);
|
||||||
{
|
} else {
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
}
|
|
||||||
else
|
|
||||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
|
||||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||||
(pHTTXContext->bCurWriting == FALSE))
|
(pHTTXContext->bCurWriting == FALSE)) {
|
||||||
{
|
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
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);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_ac2_dma_done_tasklet(unsigned long data)
|
static void rtusb_ac2_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PHT_TX_CONTEXT pHTTXContext;
|
PHT_TX_CONTEXT pHTTXContext;
|
||||||
UCHAR BulkOutPipeId = 2;
|
UCHAR BulkOutPipeId = 2;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
pAd = pHTTXContext->pAd;
|
||||||
pAd = pHTTXContext->pAd;
|
|
||||||
|
|
||||||
rtusb_dataout_complete((unsigned long)pUrb);
|
rtusb_dataout_complete((unsigned long)pUrb);
|
||||||
|
|
||||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||||
{
|
|
||||||
// do nothing and return directly.
|
// do nothing and return directly.
|
||||||
}
|
} else {
|
||||||
else
|
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||||
{
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
NULL, 0);
|
||||||
{
|
} else {
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
}
|
|
||||||
else
|
|
||||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
|
||||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||||
(pHTTXContext->bCurWriting == FALSE))
|
(pHTTXContext->bCurWriting == FALSE)) {
|
||||||
{
|
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
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);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PHT_TX_CONTEXT pHTTXContext;
|
PHT_TX_CONTEXT pHTTXContext;
|
||||||
UCHAR BulkOutPipeId = 1;
|
UCHAR BulkOutPipeId = 1;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
pAd = pHTTXContext->pAd;
|
||||||
pAd = pHTTXContext->pAd;
|
|
||||||
|
|
||||||
rtusb_dataout_complete((unsigned long)pUrb);
|
rtusb_dataout_complete((unsigned long)pUrb);
|
||||||
|
|
||||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||||
{
|
|
||||||
// do nothing and return directly.
|
// do nothing and return directly.
|
||||||
}
|
} else {
|
||||||
else
|
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||||
{
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
NULL, 0);
|
||||||
{
|
} else {
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
}
|
|
||||||
else
|
|
||||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
|
||||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||||
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||||
(pHTTXContext->bCurWriting == FALSE))
|
(pHTTXContext->bCurWriting == FALSE)) {
|
||||||
{
|
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
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);
|
RTUSBKickBulkOut(pAd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,41 +713,35 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rtusb_ac0_dma_done_tasklet(unsigned long data)
|
static void rtusb_ac0_dma_done_tasklet(unsigned long data)
|
||||||
{
|
{
|
||||||
PRTMP_ADAPTER pAd;
|
PRTMP_ADAPTER pAd;
|
||||||
PHT_TX_CONTEXT pHTTXContext;
|
PHT_TX_CONTEXT pHTTXContext;
|
||||||
UCHAR BulkOutPipeId = 0;
|
UCHAR BulkOutPipeId = 0;
|
||||||
purbb_t pUrb;
|
purbb_t pUrb;
|
||||||
|
|
||||||
|
pUrb = (purbb_t) data;
|
||||||
pUrb = (purbb_t)data;
|
pHTTXContext = (PHT_TX_CONTEXT) pUrb->context;
|
||||||
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
|
pAd = pHTTXContext->pAd;
|
||||||
pAd = pHTTXContext->pAd;
|
|
||||||
|
|
||||||
rtusb_dataout_complete((unsigned long)pUrb);
|
rtusb_dataout_complete((unsigned long)pUrb);
|
||||||
|
|
||||||
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
fRTMP_ADAPTER_HALT_IN_PROGRESS |
|
||||||
fRTMP_ADAPTER_NIC_NOT_EXIST))))
|
fRTMP_ADAPTER_NIC_NOT_EXIST)))) {
|
||||||
{
|
|
||||||
// do nothing and return directly.
|
// do nothing and return directly.
|
||||||
}
|
} else {
|
||||||
else
|
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) {
|
||||||
{
|
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT,
|
||||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
|
NULL, 0);
|
||||||
{
|
} else {
|
||||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0);
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
}
|
|
||||||
else
|
|
||||||
{ pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
|
||||||
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) &&
|
||||||
/* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
/* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
|
||||||
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
(pAd->DeQueueRunning[BulkOutPipeId] == FALSE) &&
|
||||||
(pHTTXContext->bCurWriting == FALSE))
|
(pHTTXContext->bCurWriting == FALSE)) {
|
||||||
{
|
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId,
|
||||||
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
|
MAX_TX_PROCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL);
|
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;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd)
|
||||||
NDIS_STATUS RtmpNetTaskInit(
|
|
||||||
IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||||
|
|
||||||
// Create receive tasklet
|
// Create receive tasklet
|
||||||
tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG)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->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet,
|
||||||
tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, (unsigned long)pAd);
|
(unsigned long)pAd);
|
||||||
tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet, (unsigned long)pAd);
|
tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet,
|
||||||
tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet, (unsigned long)pAd);
|
(unsigned long)pAd);
|
||||||
tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_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->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->null_frame_complete_task,
|
||||||
tasklet_init(&pObj->rts_frame_complete_task, rtusb_rts_frame_done_tasklet, (unsigned long)pAd);
|
rtusb_null_frame_done_tasklet, (unsigned long)pAd);
|
||||||
tasklet_init(&pObj->pspoll_frame_complete_task, rtusb_pspoll_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;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd)
|
||||||
void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd)
|
|
||||||
{
|
{
|
||||||
POS_COOKIE pObj;
|
POS_COOKIE pObj;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -39,40 +39,33 @@
|
||||||
|
|
||||||
#ifdef RTMP_MAC_USB
|
#ifdef RTMP_MAC_USB
|
||||||
|
|
||||||
|
|
||||||
#include "../rt_config.h"
|
#include "../rt_config.h"
|
||||||
|
|
||||||
extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c
|
extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c
|
||||||
extern UCHAR EpToQueue[];
|
extern UCHAR EpToQueue[];
|
||||||
|
|
||||||
VOID REPORT_AMSDU_FRAMES_TO_LLC(
|
VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN PUCHAR pData, IN ULONG DataSize)
|
||||||
IN PUCHAR pData,
|
|
||||||
IN ULONG DataSize)
|
|
||||||
{
|
{
|
||||||
PNDIS_PACKET pPacket;
|
PNDIS_PACKET pPacket;
|
||||||
UINT nMSDU;
|
UINT nMSDU;
|
||||||
struct sk_buff *pSkb;
|
struct sk_buff *pSkb;
|
||||||
|
|
||||||
nMSDU = 0;
|
nMSDU = 0;
|
||||||
/* allocate a rx packet */
|
/* allocate a rx packet */
|
||||||
pSkb = dev_alloc_skb(RX_BUFFER_AGGRESIZE);
|
pSkb = dev_alloc_skb(RX_BUFFER_AGGRESIZE);
|
||||||
pPacket = (PNDIS_PACKET)OSPKT_TO_RTPKT(pSkb);
|
pPacket = (PNDIS_PACKET) OSPKT_TO_RTPKT(pSkb);
|
||||||
if (pSkb)
|
if (pSkb) {
|
||||||
{
|
|
||||||
|
|
||||||
/* convert 802.11 to 802.3 packet */
|
/* convert 802.11 to 802.3 packet */
|
||||||
pSkb->dev = get_netdev_from_bssid(pAd, BSS0);
|
pSkb->dev = get_netdev_from_bssid(pAd, BSS0);
|
||||||
RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS);
|
RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS);
|
||||||
deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize);
|
deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize);
|
||||||
}
|
} else {
|
||||||
else
|
DBGPRINT(RT_DEBUG_ERROR, ("Can't allocate skb\n"));
|
||||||
{
|
|
||||||
DBGPRINT(RT_DEBUG_ERROR,("Can't allocate skb\n"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
|
@ -92,50 +85,53 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC(
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
NDIS_STATUS RTUSBFreeDescriptorRequest(
|
NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN UCHAR BulkOutPipeId,
|
||||||
IN UCHAR BulkOutPipeId,
|
IN UINT32 NumberRequired)
|
||||||
IN UINT32 NumberRequired)
|
|
||||||
{
|
{
|
||||||
// UCHAR FreeNumber = 0;
|
// UCHAR FreeNumber = 0;
|
||||||
// UINT Index;
|
// UINT Index;
|
||||||
NDIS_STATUS Status = NDIS_STATUS_FAILURE;
|
NDIS_STATUS Status = NDIS_STATUS_FAILURE;
|
||||||
unsigned long IrqFlags;
|
unsigned long IrqFlags;
|
||||||
HT_TX_CONTEXT *pHTTXContext;
|
HT_TX_CONTEXT *pHTTXContext;
|
||||||
|
|
||||||
|
|
||||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
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));
|
RTUSB_SET_BULK_FLAG(pAd,
|
||||||
}
|
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||||
else if ((pHTTXContext->CurWritePosition == 8) && (pHTTXContext->NextBulkOutPosition < (NumberRequired + LOCAL_TXBUF_SIZE)))
|
BulkOutPipeId));
|
||||||
{
|
} else if ((pHTTXContext->CurWritePosition == 8)
|
||||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
&& (pHTTXContext->NextBulkOutPosition <
|
||||||
}
|
(NumberRequired + LOCAL_TXBUF_SIZE))) {
|
||||||
else if (pHTTXContext->bCurWriting == TRUE)
|
RTUSB_SET_BULK_FLAG(pAd,
|
||||||
{
|
(fRTUSB_BULK_OUT_DATA_NORMAL <<
|
||||||
DBGPRINT(RT_DEBUG_TRACE,("RTUSBFreeD c3 --> QueIdx=%d, CWPos=%ld, NBOutPos=%ld!\n", BulkOutPipeId, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition));
|
BulkOutPipeId));
|
||||||
RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
|
} else if (pHTTXContext->bCurWriting == TRUE) {
|
||||||
}
|
DBGPRINT(RT_DEBUG_TRACE,
|
||||||
else
|
("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;
|
Status = NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
|
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NDIS_STATUS RTUSBFreeDescriptorRelease(
|
NDIS_STATUS RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd,
|
||||||
IN RTMP_ADAPTER *pAd,
|
IN UCHAR BulkOutPipeId)
|
||||||
IN UCHAR BulkOutPipeId)
|
|
||||||
{
|
{
|
||||||
unsigned long IrqFlags;
|
unsigned long IrqFlags;
|
||||||
HT_TX_CONTEXT *pHTTXContext;
|
HT_TX_CONTEXT *pHTTXContext;
|
||||||
|
|
||||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
|
@ -145,28 +141,32 @@ NDIS_STATUS RTUSBFreeDescriptorRelease(
|
||||||
return (NDIS_STATUS_SUCCESS);
|
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;
|
unsigned long IrqFlags;
|
||||||
HT_TX_CONTEXT *pHTTXContext;
|
HT_TX_CONTEXT *pHTTXContext;
|
||||||
BOOLEAN needQueBack = FALSE;
|
BOOLEAN needQueBack = FALSE;
|
||||||
|
|
||||||
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
pHTTXContext = &pAd->TxContext[BulkOutPipeId];
|
||||||
|
|
||||||
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags);
|
||||||
if ((pHTTXContext->IRPPending == TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */)
|
if ((pHTTXContext->IRPPending ==
|
||||||
{
|
TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */ ) {
|
||||||
if ((pHTTXContext->CurWritePosition < pHTTXContext->ENextBulkOutPosition) &&
|
if ((pHTTXContext->CurWritePosition <
|
||||||
(((pHTTXContext->ENextBulkOutPosition+MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT) || (pHTTXContext->CurWritePosition > MAX_AGGREGATION_SIZE)))
|
pHTTXContext->ENextBulkOutPosition)
|
||||||
{
|
&&
|
||||||
|
(((pHTTXContext->ENextBulkOutPosition +
|
||||||
|
MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT)
|
||||||
|
|| (pHTTXContext->CurWritePosition >
|
||||||
|
MAX_AGGREGATION_SIZE))) {
|
||||||
needQueBack = TRUE;
|
needQueBack = TRUE;
|
||||||
}
|
} else
|
||||||
else if ((pHTTXContext->CurWritePosition > pHTTXContext->ENextBulkOutPosition) &&
|
if ((pHTTXContext->CurWritePosition >
|
||||||
((pHTTXContext->ENextBulkOutPosition + MAX_AGGREGATION_SIZE) < pHTTXContext->CurWritePosition))
|
pHTTXContext->ENextBulkOutPosition)
|
||||||
{
|
&&
|
||||||
|
((pHTTXContext->ENextBulkOutPosition +
|
||||||
|
MAX_AGGREGATION_SIZE) <
|
||||||
|
pHTTXContext->CurWritePosition)) {
|
||||||
needQueBack = TRUE;
|
needQueBack = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,6 @@ BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
|
@ -192,21 +191,17 @@ BOOLEAN RTUSBNeedQueueBackForAgg(
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
VOID RTUSBRejectPendingPackets(
|
VOID RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd)
|
||||||
IN PRTMP_ADAPTER pAd)
|
|
||||||
{
|
{
|
||||||
UCHAR Index;
|
UCHAR Index;
|
||||||
PQUEUE_ENTRY pEntry;
|
PQUEUE_ENTRY pEntry;
|
||||||
PNDIS_PACKET pPacket;
|
PNDIS_PACKET pPacket;
|
||||||
PQUEUE_HEADER pQueue;
|
PQUEUE_HEADER pQueue;
|
||||||
|
|
||||||
|
for (Index = 0; Index < 4; Index++) {
|
||||||
for (Index = 0; Index < 4; Index++)
|
|
||||||
{
|
|
||||||
NdisAcquireSpinLock(&pAd->TxSwQueueLock[Index]);
|
NdisAcquireSpinLock(&pAd->TxSwQueueLock[Index]);
|
||||||
while (pAd->TxSwQueue[Index].Head != NULL)
|
while (pAd->TxSwQueue[Index].Head != NULL) {
|
||||||
{
|
pQueue = (PQUEUE_HEADER) & (pAd->TxSwQueue[Index]);
|
||||||
pQueue = (PQUEUE_HEADER) &(pAd->TxSwQueue[Index]);
|
|
||||||
pEntry = RemoveHeadQueue(pQueue);
|
pEntry = RemoveHeadQueue(pQueue);
|
||||||
pPacket = QUEUE_ENTRY_TO_PACKET(pEntry);
|
pPacket = QUEUE_ENTRY_TO_PACKET(pEntry);
|
||||||
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
|
||||||
|
@ -217,7 +212,6 @@ VOID RTUSBRejectPendingPackets(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
|
@ -246,21 +240,18 @@ VOID RTUSBRejectPendingPackets(
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd,
|
||||||
VOID RTMPWriteTxInfo(
|
IN PTXINFO_STRUC pTxInfo,
|
||||||
IN PRTMP_ADAPTER pAd,
|
IN USHORT USBDMApktLen,
|
||||||
IN PTXINFO_STRUC pTxInfo,
|
IN BOOLEAN bWiv,
|
||||||
IN USHORT USBDMApktLen,
|
IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst)
|
||||||
IN BOOLEAN bWiv,
|
|
||||||
IN UCHAR QueueSel,
|
|
||||||
IN UCHAR NextValid,
|
|
||||||
IN UCHAR TxBurst)
|
|
||||||
{
|
{
|
||||||
pTxInfo->USBDMATxPktLen = USBDMApktLen;
|
pTxInfo->USBDMATxPktLen = USBDMApktLen;
|
||||||
pTxInfo->QSEL = QueueSel;
|
pTxInfo->QSEL = QueueSel;
|
||||||
if (QueueSel != FIFO_EDCA)
|
if (QueueSel != FIFO_EDCA)
|
||||||
DBGPRINT(RT_DEBUG_TRACE, ("====> QueueSel != FIFO_EDCA<============\n"));
|
DBGPRINT(RT_DEBUG_TRACE,
|
||||||
pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this.
|
("====> QueueSel != FIFO_EDCA<============\n"));
|
||||||
|
pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this.
|
||||||
pTxInfo->USBDMATxburst = TxBurst;
|
pTxInfo->USBDMATxburst = TxBurst;
|
||||||
pTxInfo->WIV = bWiv;
|
pTxInfo->WIV = bWiv;
|
||||||
pTxInfo->SwUseLastRound = 0;
|
pTxInfo->SwUseLastRound = 0;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue