rtl8188eu: Fix remaining checkfile errors in hal/*.c

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-08-08 22:23:49 -05:00
parent f527ca59c9
commit a311b57c32
12 changed files with 2406 additions and 3138 deletions

View file

@ -40,7 +40,8 @@ static u1Byte RETRY_PENALTY[PERENTRY][RETRYSIZE+1] = {
{49, 40, 24, 16, 0, 48}, /* 12 , idx = 0x13 */ {49, 40, 24, 16, 0, 48}, /* 12 , idx = 0x13 */
{49, 32, 18, 12, 0, 48}, /* 9 , idx = 0x14 */ {49, 32, 18, 12, 0, 48}, /* 9 , idx = 0x14 */
{49, 22, 18, 14, 0, 48}, /* 6 , idx = 0x15 */ {49, 22, 18, 14, 0, 48}, /* 6 , idx = 0x15 */
{49,16,16,0,0,48}};/* 3, idx=0x16 */ {49, 16, 16, 0, 0, 48}
}; /* 3, idx = 0x16 */
static u1Byte RETRY_PENALTY_UP[RETRYSIZE+1] = {49, 44, 16, 16, 0, 48}; /* 12% for rate up */ static u1Byte RETRY_PENALTY_UP[RETRYSIZE+1] = {49, 44, 16, 16, 0, 48}; /* 12% for rate up */
@ -54,7 +55,8 @@ static u1Byte RETRY_PENALTY_IDX[2][RATESIZE] = {
{0x0a, 0x0a, 0x0b, 0x0c, 0x0a, {0x0a, 0x0a, 0x0b, 0x0c, 0x0a,
0x0a, 0x0b, 0x0c, 0x0d, 0x10, 0x13, 0x14, /* SS<TH */ 0x0a, 0x0b, 0x0c, 0x0d, 0x10, 0x13, 0x14, /* SS<TH */
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x11, 0x13, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x11, 0x13, 0x15,
9,9,9,9,0x0c,0x0e,0x11,0x13}}; 9, 9, 9, 9, 0x0c, 0x0e, 0x11, 0x13}
};
static u1Byte RETRY_PENALTY_UP_IDX[RATESIZE] = { static u1Byte RETRY_PENALTY_UP_IDX[RATESIZE] = {
0x0c, 0x0d, 0x0d, 0x0f, 0x0d, 0x0e, 0x0c, 0x0d, 0x0d, 0x0f, 0x0d, 0x0e,
@ -116,7 +118,7 @@ static u2Byte DynamicTxRPTTiming[6] = {
/* End Rate adaptive parameters */ /* End Rate adaptive parameters */
static void odm_SetTxRPTTiming_8188E( static void odm_SetTxRPTTiming_8188E(
struct odm_dm_struct * pDM_Odm, struct odm_dm_struct *dm_odm,
struct odm_ra_info *pRaInfo, struct odm_ra_info *pRaInfo,
u1Byte extend u1Byte extend
) )
@ -127,41 +129,36 @@ static void odm_SetTxRPTTiming_8188E(
if (DynamicTxRPTTiming[idx] == pRaInfo->RptTime) if (DynamicTxRPTTiming[idx] == pRaInfo->RptTime)
break; break;
if (extend==0) /* back to default timing */ if (extend == 0) { /* back to default timing */
idx = 0; /* 200ms */ idx = 0; /* 200ms */
else if (extend==1) {/* increase the timing */ } else if (extend == 1) {/* increase the timing */
idx += 1; idx += 1;
if (idx > 5) if (idx > 5)
idx = 5; idx = 5;
} } else if (extend == 2) {/* decrease the timing */
else if (extend==2) {/* decrease the timing */
if (idx != 0) if (idx != 0)
idx -= 1; idx -= 1;
} }
pRaInfo->RptTime = DynamicTxRPTTiming[idx]; pRaInfo->RptTime = DynamicTxRPTTiming[idx];
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("pRaInfo->RptTime=0x%x\n", pRaInfo->RptTime)); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("pRaInfo->RptTime = 0x%x\n", pRaInfo->RptTime));
} }
static int odm_RateDown_8188E( static int odm_RateDown_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo)
struct odm_dm_struct *pDM_Odm,
struct odm_ra_info *pRaInfo
)
{ {
u1Byte RateID, LowestRate, HighestRate; u1Byte RateID, LowestRate, HighestRate;
u1Byte i; u1Byte i;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n"));
if (NULL == pRaInfo) if (NULL == pRaInfo) {
{ ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateDown_8188E(): pRaInfo is NULL\n"));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateDown_8188E(): pRaInfo is NULL\n"));
return -1; return -1;
} }
RateID = pRaInfo->PreRate; RateID = pRaInfo->PreRate;
LowestRate = pRaInfo->LowestRate; LowestRate = pRaInfo->LowestRate;
HighestRate = pRaInfo->HighestRate; HighestRate = pRaInfo->HighestRate;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" RateID =%d LowestRate =%d HighestRate =%d RateSGI =%d\n", (" RateID =%d LowestRate =%d HighestRate =%d RateSGI =%d\n",
RateID, LowestRate, HighestRate, pRaInfo->RateSGI)); RateID, LowestRate, HighestRate, pRaInfo->RateSGI));
if (RateID > HighestRate) { if (RateID > HighestRate) {
@ -185,6 +182,7 @@ RateDownFinish:
pRaInfo->RAWaitingCounter += 1; pRaInfo->RAWaitingCounter += 1;
pRaInfo->RAPendingCounter += 1; pRaInfo->RAPendingCounter += 1;
} else if (pRaInfo->RAWaitingCounter == 0) { } else if (pRaInfo->RAWaitingCounter == 0) {
;
} else { } else {
pRaInfo->RAWaitingCounter = 0; pRaInfo->RAWaitingCounter = 0;
pRaInfo->RAPendingCounter = 0; pRaInfo->RAPendingCounter = 0;
@ -194,30 +192,30 @@ RateDownFinish:
pRaInfo->RAPendingCounter = 4; pRaInfo->RAPendingCounter = 4;
pRaInfo->DecisionRate = RateID; pRaInfo->DecisionRate = RateID;
odm_SetTxRPTTiming_8188E(pDM_Odm,pRaInfo, 2); odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 2);
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down, RPT Timing default\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down, RPT Timing default\n"));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d",pRaInfo->RAWaitingCounter,pRaInfo->RAPendingCounter)); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI)); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<=====odm_RateDown_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateDown_8188E()\n"));
return 0; return 0;
} }
static int odm_RateUp_8188E( static int odm_RateUp_8188E(
struct odm_dm_struct * pDM_Odm, struct odm_dm_struct *dm_odm,
struct odm_ra_info *pRaInfo struct odm_ra_info *pRaInfo
) )
{ {
u1Byte RateID, HighestRate; u1Byte RateID, HighestRate;
u1Byte i; u1Byte i;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n"));
if (NULL == pRaInfo) { if (NULL == pRaInfo) {
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E(): pRaInfo is NULL\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E(): pRaInfo is NULL\n"));
return -1; return -1;
} }
RateID = pRaInfo->PreRate; RateID = pRaInfo->PreRate;
HighestRate = pRaInfo->HighestRate; HighestRate = pRaInfo->HighestRate;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" RateID =%d HighestRate =%d\n", (" RateID =%d HighestRate =%d\n",
RateID, HighestRate)); RateID, HighestRate));
if (pRaInfo->RAWaitingCounter == 1) { if (pRaInfo->RAWaitingCounter == 1) {
@ -227,8 +225,8 @@ static int odm_RateUp_8188E(
pRaInfo->PreRssiStaRA = pRaInfo->RssiStaRA; pRaInfo->PreRssiStaRA = pRaInfo->RssiStaRA;
goto RateUpfinish; goto RateUpfinish;
} }
odm_SetTxRPTTiming_8188E(pDM_Odm,pRaInfo, 0); odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 0);
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E():Decrease RPT Timing\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E():Decrease RPT Timing\n"));
if (RateID < HighestRate) { if (RateID < HighestRate) {
for (i = RateID+1; i <= HighestRate; i++) { for (i = RateID+1; i <= HighestRate; i++) {
@ -252,32 +250,34 @@ RateUpfinish:
pRaInfo->RAWaitingCounter++; pRaInfo->RAWaitingCounter++;
pRaInfo->DecisionRate = RateID; pRaInfo->DecisionRate = RateID;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate up to RateID %d\n", RateID)); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate up to RateID %d\n", RateID));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d",pRaInfo->RAWaitingCounter,pRaInfo->RAPendingCounter)); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<=====odm_RateUp_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateUp_8188E()\n"));
return 0; return 0;
} }
static void odm_ResetRaCounter_8188E(struct odm_ra_info *pRaInfo){ static void odm_ResetRaCounter_8188E(struct odm_ra_info *pRaInfo)
{
u1Byte RateID; u1Byte RateID;
RateID = pRaInfo->DecisionRate; RateID = pRaInfo->DecisionRate;
pRaInfo->NscUp = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1; pRaInfo->NscUp = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1;
pRaInfo->NscDown = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1; pRaInfo->NscDown = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1;
} }
static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm, static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm,
struct odm_ra_info *pRaInfo struct odm_ra_info *pRaInfo
) )
{ {
u1Byte RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0; u1Byte RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0;
/* u4Byte pool_retry; */ /* u4Byte pool_retry; */
static u1Byte DynamicTxRPTTimingCounter=0; static u1Byte DynamicTxRPTTimingCounter;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDecision_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDecision_8188E()\n"));
if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) /* STA used and data packet exits */ if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) { /* STA used and data packet exits */
{ if ((pRaInfo->RssiStaRA < (pRaInfo->PreRssiStaRA - 3)) ||
if ( (pRaInfo->RssiStaRA<(pRaInfo->PreRssiStaRA-3))|| (pRaInfo->RssiStaRA>(pRaInfo->PreRssiStaRA+3))){ (pRaInfo->RssiStaRA > (pRaInfo->PreRssiStaRA + 3))) {
pRaInfo->RAWaitingCounter = 0; pRaInfo->RAWaitingCounter = 0;
pRaInfo->RAPendingCounter = 0; pRaInfo->RAPendingCounter = 0;
} }
@ -292,14 +292,14 @@ static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm,
RtyPtID = 1; RtyPtID = 1;
PenaltyID1 = RETRY_PENALTY_IDX[RtyPtID][RateID]; /* TODO by page */ PenaltyID1 = RETRY_PENALTY_IDX[RtyPtID][RateID]; /* TODO by page */
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" NscDown init is %d\n", pRaInfo->NscDown)); (" NscDown init is %d\n", pRaInfo->NscDown));
pRaInfo->NscDown += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID1][0]; pRaInfo->NscDown += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID1][0];
pRaInfo->NscDown += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID1][1]; pRaInfo->NscDown += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID1][1];
pRaInfo->NscDown += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID1][2]; pRaInfo->NscDown += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID1][2];
pRaInfo->NscDown += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID1][3]; pRaInfo->NscDown += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID1][3];
pRaInfo->NscDown += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID1][4]; pRaInfo->NscDown += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID1][4];
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" NscDown is %d, total*penalty[5] is %d\n", (" NscDown is %d, total*penalty[5] is %d\n",
pRaInfo->NscDown, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))); pRaInfo->NscDown, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])));
if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])) if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))
@ -309,14 +309,14 @@ static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm,
/* rate up */ /* rate up */
PenaltyID2 = RETRY_PENALTY_UP_IDX[RateID]; PenaltyID2 = RETRY_PENALTY_UP_IDX[RateID];
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" NscUp init is %d\n", pRaInfo->NscUp)); (" NscUp init is %d\n", pRaInfo->NscUp));
pRaInfo->NscUp += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID2][0]; pRaInfo->NscUp += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID2][0];
pRaInfo->NscUp += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID2][1]; pRaInfo->NscUp += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID2][1];
pRaInfo->NscUp += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID2][2]; pRaInfo->NscUp += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID2][2];
pRaInfo->NscUp += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID2][3]; pRaInfo->NscUp += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID2][3];
pRaInfo->NscUp += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID2][4]; pRaInfo->NscUp += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID2][4];
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
("NscUp is %d, total*up[5] is %d\n", ("NscUp is %d, total*up[5] is %d\n",
pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))); pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])));
if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])) if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))
@ -324,13 +324,14 @@ static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm,
else else
pRaInfo->NscUp = 0; pRaInfo->NscUp = 0;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE|ODM_COMP_INIT, ODM_DBG_LOUD, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE|ODM_COMP_INIT, ODM_DBG_LOUD,
(" RssiStaRa = %d RtyPtID =%d PenaltyID1 = 0x%x PenaltyID2 = 0x%x RateID =%d NscDown =%d NscUp =%d SGI =%d\n", (" RssiStaRa = %d RtyPtID =%d PenaltyID1 = 0x%x PenaltyID2 = 0x%x RateID =%d NscDown =%d NscUp =%d SGI =%d\n",
pRaInfo->RssiStaRA, RtyPtID, PenaltyID1, PenaltyID2, RateID, pRaInfo->NscDown, pRaInfo->NscUp, pRaInfo->RateSGI)); pRaInfo->RssiStaRA, RtyPtID, PenaltyID1, PenaltyID2, RateID, pRaInfo->NscDown, pRaInfo->NscUp, pRaInfo->RateSGI));
if ((pRaInfo->NscDown < N_THRESHOLD_LOW[RateID]) ||(pRaInfo->DROP>DROPING_NECESSARY[RateID])) if ((pRaInfo->NscDown < N_THRESHOLD_LOW[RateID]) ||
odm_RateDown_8188E(pDM_Odm,pRaInfo); (pRaInfo->DROP > DROPING_NECESSARY[RateID]))
odm_RateDown_8188E(dm_odm, pRaInfo);
else if (pRaInfo->NscUp > N_THRESHOLD_HIGH[RateID]) else if (pRaInfo->NscUp > N_THRESHOLD_HIGH[RateID])
odm_RateUp_8188E(pDM_Odm,pRaInfo); odm_RateUp_8188E(dm_odm, pRaInfo);
if (pRaInfo->DecisionRate > pRaInfo->HighestRate) if (pRaInfo->DecisionRate > pRaInfo->HighestRate)
pRaInfo->DecisionRate = pRaInfo->HighestRate; pRaInfo->DecisionRate = pRaInfo->HighestRate;
@ -341,8 +342,9 @@ static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm,
DynamicTxRPTTimingCounter = 0; DynamicTxRPTTimingCounter = 0;
if (DynamicTxRPTTimingCounter >= 4) { if (DynamicTxRPTTimingCounter >= 4) {
odm_SetTxRPTTiming_8188E(pDM_Odm,pRaInfo, 1); odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 1);
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("<=====Rate don't change 4 times, Extend RPT Timing\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE,
ODM_DBG_LOUD, ("<===== Rate don't change 4 times, Extend RPT Timing\n"));
DynamicTxRPTTimingCounter = 0; DynamicTxRPTTimingCounter = 0;
} }
@ -350,14 +352,10 @@ static void odm_RateDecision_8188E(struct odm_dm_struct * pDM_Odm,
odm_ResetRaCounter_8188E(pRaInfo); odm_ResetRaCounter_8188E(pRaInfo);
} }
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<=====odm_RateDecision_8188E()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateDecision_8188E()\n"));
} }
static int static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo)
odm_ARFBRefresh_8188E(
struct odm_dm_struct * pDM_Odm,
struct odm_ra_info *pRaInfo
)
{ /* Wilson 2011/10/26 */ { /* Wilson 2011/10/26 */
u4Byte MaskFromReg; u4Byte MaskFromReg;
s1Byte i; s1Byte i;
@ -385,51 +383,45 @@ odm_ARFBRefresh_8188E(
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0000000d; pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0000000d;
break; break;
case 12: case 12:
MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR0); MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR0);
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
break; break;
case 13: case 13:
MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR1); MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR1);
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
break; break;
case 14: case 14:
MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR2); MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR2);
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
break; break;
case 15: case 15:
MaskFromReg=ODM_Read4Byte(pDM_Odm, REG_ARFR3); MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR3);
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
break; break;
default: default:
pRaInfo->RAUseRate = (pRaInfo->RateMask); pRaInfo->RAUseRate = (pRaInfo->RateMask);
break; break;
} }
/* Highest rate */ /* Highest rate */
if (pRaInfo->RAUseRate) { if (pRaInfo->RAUseRate) {
for (i=RATESIZE;i>=0;i--) for (i = RATESIZE; i >= 0; i--) {
{
if ((pRaInfo->RAUseRate)&BIT(i)) { if ((pRaInfo->RAUseRate)&BIT(i)) {
pRaInfo->HighestRate = i; pRaInfo->HighestRate = i;
break; break;
} }
} }
} } else {
else{
pRaInfo->HighestRate = 0; pRaInfo->HighestRate = 0;
} }
/* Lowest rate */ /* Lowest rate */
if (pRaInfo->RAUseRate) { if (pRaInfo->RAUseRate) {
for (i=0;i<RATESIZE;i++) for (i = 0; i < RATESIZE; i++) {
{ if ((pRaInfo->RAUseRate) & BIT(i)) {
if ((pRaInfo->RAUseRate)&BIT(i))
{
pRaInfo->LowestRate = i; pRaInfo->LowestRate = i;
break; break;
} }
} }
} } else {
else{
pRaInfo->LowestRate = 0; pRaInfo->LowestRate = 0;
} }
if (pRaInfo->HighestRate > 0x13) if (pRaInfo->HighestRate > 0x13)
@ -440,26 +432,22 @@ odm_ARFBRefresh_8188E(
pRaInfo->PTModeSS = 1; pRaInfo->PTModeSS = 1;
else else
pRaInfo->PTModeSS = 0; pRaInfo->PTModeSS = 0;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
("ODM_ARFBRefresh_8188E(): PTModeSS =%d\n", pRaInfo->PTModeSS)); ("ODM_ARFBRefresh_8188E(): PTModeSS =%d\n", pRaInfo->PTModeSS));
if (pRaInfo->DecisionRate > pRaInfo->HighestRate) if (pRaInfo->DecisionRate > pRaInfo->HighestRate)
pRaInfo->DecisionRate = pRaInfo->HighestRate; pRaInfo->DecisionRate = pRaInfo->HighestRate;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
("ODM_ARFBRefresh_8188E(): RateID =%d RateMask =%8.8x RAUseRate =%8.8x HighestRate =%d, DecisionRate =%d\n", ("ODM_ARFBRefresh_8188E(): RateID =%d RateMask =%8.8x RAUseRate =%8.8x HighestRate =%d, DecisionRate =%d\n",
pRaInfo->RateID, pRaInfo->RateMask, pRaInfo->RAUseRate, pRaInfo->HighestRate, pRaInfo->DecisionRate)); pRaInfo->RateID, pRaInfo->RateMask, pRaInfo->RAUseRate, pRaInfo->HighestRate, pRaInfo->DecisionRate));
return 0; return 0;
} }
static void static void odm_PTTryState_8188E(struct odm_ra_info *pRaInfo)
odm_PTTryState_8188E(
struct odm_ra_info *pRaInfo
)
{ {
pRaInfo->PTTryState = 0; pRaInfo->PTTryState = 0;
switch (pRaInfo->PTModeSS) switch (pRaInfo->PTModeSS) {
{
case 3: case 3:
if (pRaInfo->DecisionRate >= 0x19) if (pRaInfo->DecisionRate >= 0x19)
pRaInfo->PTTryState = 1; pRaInfo->PTTryState = 1;
@ -478,17 +466,16 @@ odm_PTTryState_8188E(
break; break;
default: default:
pRaInfo->PTTryState = 0; pRaInfo->PTTryState = 0;
break;
} }
if (pRaInfo->RssiStaRA<48) if (pRaInfo->RssiStaRA < 48) {
{
pRaInfo->PTStage = 0; pRaInfo->PTStage = 0;
} } else if (pRaInfo->PTTryState == 1) {
else if (pRaInfo->PTTryState==1) if ((pRaInfo->PTStopCount >= 10) ||
{ (pRaInfo->PTPreRssi > pRaInfo->RssiStaRA + 5) ||
if ((pRaInfo->PTStopCount>=10)||(pRaInfo->PTPreRssi>pRaInfo->RssiStaRA+5) (pRaInfo->PTPreRssi < pRaInfo->RssiStaRA - 5) ||
||(pRaInfo->PTPreRssi<pRaInfo->RssiStaRA-5)||(pRaInfo->DecisionRate!=pRaInfo->PTPreRate)) (pRaInfo->DecisionRate != pRaInfo->PTPreRate)) {
{
if (pRaInfo->PTStage == 0) if (pRaInfo->PTStage == 0)
pRaInfo->PTStage = 1; pRaInfo->PTStage = 1;
else if (pRaInfo->PTStage == 1) else if (pRaInfo->PTStage == 1)
@ -498,24 +485,18 @@ odm_PTTryState_8188E(
pRaInfo->PTPreRssi = pRaInfo->RssiStaRA; pRaInfo->PTPreRssi = pRaInfo->RssiStaRA;
pRaInfo->PTStopCount = 0; pRaInfo->PTStopCount = 0;
} else {
}
else{
pRaInfo->RAstage = 0; pRaInfo->RAstage = 0;
pRaInfo->PTStopCount++; pRaInfo->PTStopCount++;
} }
} } else {
else{
pRaInfo->PTStage = 0; pRaInfo->PTStage = 0;
pRaInfo->RAstage = 0; pRaInfo->RAstage = 0;
} }
pRaInfo->PTPreRate = pRaInfo->DecisionRate; pRaInfo->PTPreRate = pRaInfo->DecisionRate;
} }
static void static void odm_PTDecision_8188E(struct odm_ra_info *pRaInfo)
odm_PTDecision_8188E(
struct odm_ra_info *pRaInfo
)
{ {
u1Byte j; u1Byte j;
u1Byte temp_stage; u1Byte temp_stage;
@ -525,8 +506,7 @@ odm_PTDecision_8188E(
numsc = 0; numsc = 0;
num_total = pRaInfo->TOTAL * PT_PENALTY[5]; num_total = pRaInfo->TOTAL * PT_PENALTY[5];
for (j=0;j<=4;j++) for (j = 0; j <= 4; j++) {
{
numsc += pRaInfo->RTY[j] * PT_PENALTY[j]; numsc += pRaInfo->RTY[j] * PT_PENALTY[j];
if (numsc > num_total) if (numsc > num_total)
break; break;
@ -549,54 +529,44 @@ odm_PTDecision_8188E(
if (pRaInfo->DROP > 3) if (pRaInfo->DROP > 3)
temp_stage = 0; temp_stage = 0;
pRaInfo->PTStage = temp_stage; pRaInfo->PTStage = temp_stage;
} }
static void static void
odm_RATxRPTTimerSetting( odm_RATxRPTTimerSetting(
struct odm_dm_struct * pDM_Odm, struct odm_dm_struct *dm_odm,
u2Byte minRptTime u2Byte minRptTime
) )
{ {
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,(" =====>odm_RATxRPTTimerSetting()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" =====>odm_RATxRPTTimerSetting()\n"));
if (dm_odm->CurrminRptTime != minRptTime) {
if (pDM_Odm->CurrminRptTime != minRptTime){ ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" CurrminRptTime = 0x%04x minRptTime = 0x%04x\n", dm_odm->CurrminRptTime, minRptTime));
(" CurrminRptTime =0x%04x minRptTime=0x%04x\n", pDM_Odm->CurrminRptTime, minRptTime)); rtw_rpt_timer_cfg_cmd(dm_odm->Adapter, minRptTime);
rtw_rpt_timer_cfg_cmd(pDM_Odm->Adapter,minRptTime); dm_odm->CurrminRptTime = minRptTime;
pDM_Odm->CurrminRptTime = minRptTime;
} }
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,(" <=====odm_RATxRPTTimerSetting()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" <===== odm_RATxRPTTimerSetting()\n"));
} }
void void
ODM_RASupport_Init( ODM_RASupport_Init(
struct odm_dm_struct *pDM_Odm struct odm_dm_struct *dm_odm
) )
{ {
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RASupport_Init()\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RASupport_Init()\n"));
/* 2012/02/14 MH Be noticed, the init must be after IC type is recognized!!!!! */ /* 2012/02/14 MH Be noticed, the init must be after IC type is recognized!!!!! */
if (pDM_Odm->SupportICType == ODM_RTL8188E) if (dm_odm->SupportICType == ODM_RTL8188E)
pDM_Odm->RaSupport88E = true; dm_odm->RaSupport88E = true;
} }
int ODM_RAInfo_Init(struct odm_dm_struct *dm_odm, u1Byte macid)
int
ODM_RAInfo_Init(
struct odm_dm_struct *pDM_Odm,
u1Byte MacID
)
{ {
struct odm_ra_info *pRaInfo = &pDM_Odm->RAInfo[MacID]; struct odm_ra_info *pRaInfo = &dm_odm->RAInfo[macid];
u1Byte WirelessMode = 0xFF; /* invalid value */ u1Byte WirelessMode = 0xFF; /* invalid value */
u1Byte max_rate_idx = 0x13; /* MCS7 */ u1Byte max_rate_idx = 0x13; /* MCS7 */
if (pDM_Odm->pWirelessMode!=NULL){ if (dm_odm->pWirelessMode != NULL)
WirelessMode=*(pDM_Odm->pWirelessMode); WirelessMode = *(dm_odm->pWirelessMode);
}
if (WirelessMode != 0xFF) { if (WirelessMode != 0xFF) {
if (WirelessMode & ODM_WM_N24G) if (WirelessMode & ODM_WM_N24G)
@ -607,7 +577,7 @@ ODM_RAInfo_Init(
max_rate_idx = 0x03; max_rate_idx = 0x03;
} }
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
("ODM_RAInfo_Init(): WirelessMode:0x%08x , max_raid_idx:0x%02x\n", ("ODM_RAInfo_Init(): WirelessMode:0x%08x , max_raid_idx:0x%02x\n",
WirelessMode, max_rate_idx)); WirelessMode, max_rate_idx));
@ -647,127 +617,88 @@ ODM_RAInfo_Init(
return 0; return 0;
} }
int int ODM_RAInfo_Init_all(struct odm_dm_struct *dm_odm)
ODM_RAInfo_Init_all(
struct odm_dm_struct * pDM_Odm
)
{ {
u1Byte MacID = 0; u1Byte macid = 0;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>\n")); ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>\n"));
pDM_Odm->CurrminRptTime = 0; dm_odm->CurrminRptTime = 0;
for (MacID=0; MacID<ODM_ASSOCIATE_ENTRY_NUM; MacID++) for (macid = 0; macid < ODM_ASSOCIATE_ENTRY_NUM; macid++)
ODM_RAInfo_Init(pDM_Odm,MacID); ODM_RAInfo_Init(dm_odm, macid);
return 0; return 0;
} }
u1Byte ODM_RA_GetShortGI_8188E(struct odm_dm_struct *dm_odm, u1Byte macid)
u1Byte
ODM_RA_GetShortGI_8188E(
struct odm_dm_struct *pDM_Odm,
u1Byte MacID
)
{ {
if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
return 0; return 0;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
("MacID=%d SGI=%d\n", MacID, pDM_Odm->RAInfo[MacID].RateSGI)); ("macid =%d SGI =%d\n", macid, dm_odm->RAInfo[macid].RateSGI));
return pDM_Odm->RAInfo[MacID].RateSGI; return dm_odm->RAInfo[macid].RateSGI;
} }
u1Byte u1Byte ODM_RA_GetDecisionRate_8188E(struct odm_dm_struct *dm_odm, u1Byte macid)
ODM_RA_GetDecisionRate_8188E(
struct odm_dm_struct *pDM_Odm,
u1Byte MacID
)
{ {
u1Byte DecisionRate = 0; u1Byte DecisionRate = 0;
if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
return 0; return 0;
DecisionRate = (pDM_Odm->RAInfo[MacID].DecisionRate); DecisionRate = (dm_odm->RAInfo[macid].DecisionRate);
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" MacID=%d DecisionRate=0x%x\n", MacID, DecisionRate)); (" macid =%d DecisionRate = 0x%x\n", macid, DecisionRate));
return DecisionRate; return DecisionRate;
} }
u1Byte u1Byte ODM_RA_GetHwPwrStatus_8188E(struct odm_dm_struct *dm_odm, u1Byte macid)
ODM_RA_GetHwPwrStatus_8188E(
struct odm_dm_struct *pDM_Odm,
u1Byte MacID
)
{ {
u1Byte PTStage = 5; u1Byte PTStage = 5;
if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM))
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
return 0; return 0;
PTStage = (pDM_Odm->RAInfo[MacID].PTStage); PTStage = (dm_odm->RAInfo[macid].PTStage);
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
("MacID=%d PTStage=0x%x\n", MacID, PTStage)); ("macid =%d PTStage = 0x%x\n", macid, PTStage));
return PTStage; return PTStage;
} }
void void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u1Byte macid, u1Byte RateID, u4Byte RateMask, u1Byte SGIEnable)
ODM_RA_UpdateRateInfo_8188E(
struct odm_dm_struct *pDM_Odm,
u1Byte MacID,
u1Byte RateID,
u4Byte RateMask,
u1Byte SGIEnable
)
{ {
struct odm_ra_info *pRaInfo = NULL; struct odm_ra_info *pRaInfo = NULL;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
("MacID=%d RateID=0x%x RateMask=0x%x SGIEnable=%d\n", ("macid =%d RateID = 0x%x RateMask = 0x%x SGIEnable =%d\n",
MacID, RateID, RateMask, SGIEnable)); macid, RateID, RateMask, SGIEnable));
if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
return; return;
pRaInfo = &(pDM_Odm->RAInfo[MacID]); pRaInfo = &(dm_odm->RAInfo[macid]);
pRaInfo->RateID = RateID; pRaInfo->RateID = RateID;
pRaInfo->RateMask = RateMask; pRaInfo->RateMask = RateMask;
pRaInfo->SGIEnable = SGIEnable; pRaInfo->SGIEnable = SGIEnable;
odm_ARFBRefresh_8188E(pDM_Odm, pRaInfo); odm_ARFBRefresh_8188E(dm_odm, pRaInfo);
} }
void void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u1Byte macid, u1Byte Rssi)
ODM_RA_SetRSSI_8188E(
struct odm_dm_struct * pDM_Odm,
u1Byte MacID,
u1Byte Rssi
)
{ {
struct odm_ra_info *pRaInfo = NULL; struct odm_ra_info *pRaInfo = NULL;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
(" MacID=%d Rssi=%d\n", MacID, Rssi)); (" macid =%d Rssi =%d\n", macid, Rssi));
if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
return; return;
pRaInfo = &(pDM_Odm->RAInfo[MacID]); pRaInfo = &(dm_odm->RAInfo[macid]);
pRaInfo->RssiStaRA = Rssi; pRaInfo->RssiStaRA = Rssi;
} }
void void ODM_RA_Set_TxRPT_Time(struct odm_dm_struct *dm_odm, u2Byte minRptTime)
ODM_RA_Set_TxRPT_Time(
struct odm_dm_struct * pDM_Odm,
u2Byte minRptTime
)
{ {
ODM_Write2Byte(pDM_Odm, REG_TX_RPT_TIME, minRptTime); ODM_Write2Byte(dm_odm, REG_TX_RPT_TIME, minRptTime);
} }
void ODM_RA_TxRPT2Handle_8188E(struct odm_dm_struct *dm_odm, pu1Byte TxRPT_Buf, u2Byte TxRPT_Len, u4Byte macid_entry0, u4Byte macid_entry1)
void
ODM_RA_TxRPT2Handle_8188E(
struct odm_dm_struct * pDM_Odm,
pu1Byte TxRPT_Buf,
u2Byte TxRPT_Len,
u4Byte MacIDValidEntry0,
u4Byte MacIDValidEntry1
)
{ {
struct odm_ra_info *pRAInfo = NULL; struct odm_ra_info *pRAInfo = NULL;
u1Byte MacId = 0; u1Byte MacId = 0;
@ -775,72 +706,57 @@ ODM_RA_TxRPT2Handle_8188E(
u4Byte valid = 0, ItemNum = 0; u4Byte valid = 0, ItemNum = 0;
u2Byte minRptTime = 0x927c; u2Byte minRptTime = 0x927c;
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RA_TxRPT2Handle_8188E(): valid0=%d valid1=%d BufferLength=%d\n", ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
MacIDValidEntry0, MacIDValidEntry1, TxRPT_Len)); ("=====>ODM_RA_TxRPT2Handle_8188E(): valid0 =%d valid1 =%d BufferLength =%d\n",
macid_entry0, macid_entry1, TxRPT_Len));
ItemNum = TxRPT_Len >> 3; ItemNum = TxRPT_Len >> 3;
pBuffer = TxRPT_Buf; pBuffer = TxRPT_Buf;
do do {
{
if (MacId >= ASSOCIATE_ENTRY_NUM) if (MacId >= ASSOCIATE_ENTRY_NUM)
valid = 0; valid = 0;
else if (MacId >= 32) else if (MacId >= 32)
valid = (1<<(MacId-32)) & MacIDValidEntry1; valid = (1 << (MacId - 32)) & macid_entry1;
else else
valid = (1<<MacId) & MacIDValidEntry0; valid = (1 << MacId) & macid_entry0;
pRAInfo = &(pDM_Odm->RAInfo[MacId]);
if (valid)
{
pRAInfo = &(dm_odm->RAInfo[MacId]);
if (valid) {
pRAInfo->RTY[0] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_0(pBuffer); pRAInfo->RTY[0] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_0(pBuffer);
pRAInfo->RTY[1] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_1(pBuffer); pRAInfo->RTY[1] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_1(pBuffer);
pRAInfo->RTY[2] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_2(pBuffer); pRAInfo->RTY[2] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_2(pBuffer);
pRAInfo->RTY[3] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_3(pBuffer); pRAInfo->RTY[3] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_3(pBuffer);
pRAInfo->RTY[4] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_4(pBuffer); pRAInfo->RTY[4] = (u2Byte)GET_TX_REPORT_TYPE1_RERTY_4(pBuffer);
pRAInfo->DROP = (u2Byte)GET_TX_REPORT_TYPE1_DROP_0(pBuffer); pRAInfo->DROP = (u2Byte)GET_TX_REPORT_TYPE1_DROP_0(pBuffer);
pRAInfo->TOTAL = pRAInfo->RTY[0] + \ pRAInfo->TOTAL = pRAInfo->RTY[0] + pRAInfo->RTY[1] +
pRAInfo->RTY[1] + \ pRAInfo->RTY[2] + pRAInfo->RTY[3] +
pRAInfo->RTY[2] + \ pRAInfo->RTY[4] + pRAInfo->DROP;
pRAInfo->RTY[3] + \ if (pRAInfo->TOTAL != 0) {
pRAInfo->RTY[4] + \ ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
pRAInfo->DROP;
if (pRAInfo->TOTAL != 0)
{
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
("macid =%d Total =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d D0 =%d valid0 =%x valid1 =%x\n", ("macid =%d Total =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d D0 =%d valid0 =%x valid1 =%x\n",
MacId, MacId, pRAInfo->TOTAL,
pRAInfo->TOTAL, pRAInfo->RTY[0], pRAInfo->RTY[1],
pRAInfo->RTY[0], pRAInfo->RTY[2], pRAInfo->RTY[3],
pRAInfo->RTY[1], pRAInfo->RTY[4], pRAInfo->DROP,
pRAInfo->RTY[2], macid_entry0 , macid_entry1));
pRAInfo->RTY[3],
pRAInfo->RTY[4],
pRAInfo->DROP,
MacIDValidEntry0 ,
MacIDValidEntry1));
if (pRAInfo->PTActive) { if (pRAInfo->PTActive) {
if (pRAInfo->RAstage<5){ if (pRAInfo->RAstage < 5)
odm_RateDecision_8188E(pDM_Odm,pRAInfo); odm_RateDecision_8188E(dm_odm, pRAInfo);
} else if (pRAInfo->RAstage == 5) /* Power training try state */
else if (pRAInfo->RAstage==5){ /* Power training try state */
odm_PTTryState_8188E(pRAInfo); odm_PTTryState_8188E(pRAInfo);
} else /* RAstage == 6 */
else {/* RAstage==6 */
odm_PTDecision_8188E(pRAInfo); odm_PTDecision_8188E(pRAInfo);
}
/* Stage_RA counter */ /* Stage_RA counter */
if (pRAInfo->RAstage <= 5) if (pRAInfo->RAstage <= 5)
pRAInfo->RAstage++; pRAInfo->RAstage++;
else else
pRAInfo->RAstage = 0; pRAInfo->RAstage = 0;
} else {
odm_RateDecision_8188E(dm_odm, pRAInfo);
} }
else{ ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
odm_RateDecision_8188E(pDM_Odm,pRAInfo);
}
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
("macid =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d drop =%d valid0 =%x RateID =%d SGI =%d\n", ("macid =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d drop =%d valid0 =%x RateID =%d SGI =%d\n",
MacId, MacId,
pRAInfo->RTY[0], pRAInfo->RTY[0],
@ -849,12 +765,12 @@ ODM_RA_TxRPT2Handle_8188E(
pRAInfo->RTY[3], pRAInfo->RTY[3],
pRAInfo->RTY[4], pRAInfo->RTY[4],
pRAInfo->DROP, pRAInfo->DROP,
MacIDValidEntry0, macid_entry0,
pRAInfo->DecisionRate, pRAInfo->DecisionRate,
pRAInfo->RateSGI)); pRAInfo->RateSGI));
} else {
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" TOTAL = 0!!!!\n"));
} }
else
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" TOTAL=0!!!!\n"));
} }
if (minRptTime > pRAInfo->RptTime) if (minRptTime > pRAInfo->RptTime)
@ -864,8 +780,7 @@ ODM_RA_TxRPT2Handle_8188E(
MacId++; MacId++;
} while (MacId < ItemNum); } while (MacId < ItemNum);
odm_RATxRPTTimerSetting(pDM_Odm,minRptTime); odm_RATxRPTTimerSetting(dm_odm, minRptTime);
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("<===== ODM_RA_TxRPT2Handle_8188E()\n"));
ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("<===== ODM_RA_TxRPT2Handle_8188E()\n"));
} }

View file

@ -27,7 +27,6 @@ static s32 translate2dbm(u8 signal_strength_idx)
{ {
s32 signal_power; /* in dBm. */ s32 signal_power; /* in dBm. */
/* Translate to dBm (x=0.5y-95). */ /* Translate to dBm (x=0.5y-95). */
signal_power = (s32)((signal_strength_idx + 1) >> 1); signal_power = (s32)((signal_strength_idx + 1) >> 1);
signal_power -= 95; signal_power -= 95;
@ -35,15 +34,12 @@ static s32 translate2dbm(u8 signal_strength_idx)
return signal_power; return signal_power;
} }
static void process_rssi(struct adapter *padapter, union recv_frame *prframe) static void process_rssi(struct adapter *padapter, union recv_frame *prframe)
{ {
u32 last_rssi, tmp_val; u32 last_rssi, tmp_val;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data; struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data;
{
if (signal_stat->update_req) { if (signal_stat->update_req) {
signal_stat->total_num = 0; signal_stat->total_num = 0;
signal_stat->total_val = 0; signal_stat->total_val = 0;
@ -53,8 +49,6 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe)
signal_stat->total_num++; signal_stat->total_num++;
signal_stat->total_val += pattrib->phy_info.SignalStrength; signal_stat->total_val += pattrib->phy_info.SignalStrength;
signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
}
} /* Process_UI_RSSI_8192C */ } /* Process_UI_RSSI_8192C */
static void process_link_qual(struct adapter *padapter, union recv_frame *prframe) static void process_link_qual(struct adapter *padapter, union recv_frame *prframe)
@ -63,9 +57,8 @@ static void process_link_qual(struct adapter *padapter,union recv_frame *prframe
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
struct signal_stat *signal_stat; struct signal_stat *signal_stat;
if (prframe == NULL || padapter==NULL){ if (prframe == NULL || padapter == NULL)
return; return;
}
pattrib = &prframe->u.hdr.attrib; pattrib = &prframe->u.hdr.attrib;
signal_stat = &padapter->recvpriv.signal_qual_data; signal_stat = &padapter->recvpriv.signal_qual_data;
@ -85,23 +78,13 @@ void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe)
{ {
union recv_frame *precvframe = (union recv_frame *)prframe; union recv_frame *precvframe = (union recv_frame *)prframe;
/* */
/* Check RSSI */ /* Check RSSI */
/* */
process_rssi(padapter, precvframe); process_rssi(padapter, precvframe);
/* */
/* Check PWDB. */
/* */
/* Check EVM */ /* Check EVM */
process_link_qual(padapter, precvframe); process_link_qual(padapter, precvframe);
} }
void update_recvframe_attrib_88e(union recv_frame *precvframe, struct recv_stat *prxstat)
void update_recvframe_attrib_88e(
union recv_frame *precvframe,
struct recv_stat *prxstat)
{ {
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
struct recv_stat report; struct recv_stat report;
@ -145,7 +128,6 @@ void update_recvframe_attrib_88e(
pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */ pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */
pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3); pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3);
} else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */
pattrib->pkt_len = TX_RPT1_PKT_LEN; pattrib->pkt_len = TX_RPT1_PKT_LEN;
pattrib->drvinfo_sz = 0; pattrib->drvinfo_sz = 0;
@ -162,7 +144,6 @@ void update_recvframe_attrib_88e(
} else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */ } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */
pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */
} }
} }
/* /*
@ -170,9 +151,7 @@ void update_recvframe_attrib_88e(
* Before calling this function, * Before calling this function,
* precvframe->u.hdr.rx_data should be ready! * precvframe->u.hdr.rx_data should be ready!
*/ */
void update_recvframe_phyinfo_88e( void update_recvframe_phyinfo_88e(union recv_frame *precvframe, struct phy_stat *pphy_status)
union recv_frame *precvframe,
struct phy_stat *pphy_status)
{ {
struct adapter *padapter = precvframe->u.hdr.adapter; struct adapter *padapter = precvframe->u.hdr.adapter;
struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib;
@ -192,19 +171,21 @@ void update_recvframe_phyinfo_88e(
pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) &&
!pattrib->icv_err && !pattrib->crc_err && !pattrib->icv_err && !pattrib->crc_err &&
_rtw_memcmp(get_hdr_bssid(wlanhdr), get_bssid(&padapter->mlmepriv), ETH_ALEN)); _rtw_memcmp(get_hdr_bssid(wlanhdr),
get_bssid(&padapter->mlmepriv), ETH_ALEN));
pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && (_rtw_memcmp(get_da(wlanhdr), myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID &&
(_rtw_memcmp(get_da(wlanhdr),
myid(&padapter->eeprompriv), ETH_ALEN));
pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && (GetFrameSubType(wlanhdr) == WIFI_BEACON); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID &&
(GetFrameSubType(wlanhdr) == WIFI_BEACON);
if (pkt_info.bPacketBeacon) { if (pkt_info.bPacketBeacon) {
if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true){ if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
sa = padapter->mlmepriv.cur_network.network.MacAddress; sa = padapter->mlmepriv.cur_network.network.MacAddress;
}
/* to do Ad-hoc */ /* to do Ad-hoc */
} } else {
else{
sa = get_sa(wlanhdr); sa = get_sa(wlanhdr);
} }
@ -219,24 +200,16 @@ void update_recvframe_phyinfo_88e(
precvframe->u.hdr.psta = NULL; precvframe->u.hdr.psta = NULL;
if (pkt_info.bPacketMatchBSSID && if (pkt_info.bPacketMatchBSSID &&
(check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE))) {
{ if (psta) {
if (psta)
{
precvframe->u.hdr.psta = psta; precvframe->u.hdr.psta = psta;
rtl8188e_process_phy_info(padapter, precvframe); rtl8188e_process_phy_info(padapter, precvframe);
} }
} } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) {
else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) {
{
if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true)
{
if (psta) if (psta)
{
precvframe->u.hdr.psta = psta; precvframe->u.hdr.psta = psta;
} }
}
rtl8188e_process_phy_info(padapter, precvframe); rtl8188e_process_phy_info(padapter, precvframe);
} }
} }

View file

@ -22,7 +22,6 @@
#include <rtl8188e_sreset.h> #include <rtl8188e_sreset.h>
#include <rtl8188e_hal.h> #include <rtl8188e_hal.h>
extern void rtw_cancel_all_timer(struct adapter *padapter);
static void _restore_security_setting(struct adapter *padapter) static void _restore_security_setting(struct adapter *padapter)
{ {
u8 EntryId = 0; u8 EntryId = 0;
@ -32,26 +31,21 @@ static void _restore_security_setting(struct adapter *padapter)
struct security_priv *psecuritypriv = &(padapter->securitypriv); struct security_priv *psecuritypriv = &(padapter->securitypriv);
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info; struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
(pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) ?
? rtw_write8(padapter, REG_SECCFG, 0xcc) rtw_write8(padapter, REG_SECCFG, 0xcc) :
: rtw_write8(padapter, REG_SECCFG, 0xcf); rtw_write8(padapter, REG_SECCFG, 0xcf);
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_) || if ((padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_) ||
( padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_ )) (padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_)) {
{ for (EntryId = 0; EntryId < 4; EntryId++) {
for (EntryId=0; EntryId<4; EntryId++)
{
if (EntryId == psecuritypriv->dot11PrivacyKeyIndex) if (EntryId == psecuritypriv->dot11PrivacyKeyIndex)
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 1); rtw_set_key(padapter, &padapter->securitypriv, EntryId, 1);
else else
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 0); rtw_set_key(padapter, &padapter->securitypriv, EntryId, 0);
} }
} } else if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
else if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
{
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
if (psta) { if (psta) {
/* pairwise key */ /* pairwise key */
@ -60,7 +54,6 @@ static void _restore_security_setting(struct adapter *padapter)
rtw_set_key(padapter, &padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0); rtw_set_key(padapter, &padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0);
} }
} }
} }
static void _restore_network_status(struct adapter *padapter) static void _restore_network_status(struct adapter *padapter)
@ -131,22 +124,21 @@ void rtl8188e_sreset_xmit_status_check(struct adapter *padapter)
unsigned int diff_time; unsigned int diff_time;
u32 txdma_status; u32 txdma_status;
if ( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){ txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
if (txdma_status != 0x00) {
DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status); DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
rtl8188e_silentreset_for_specific_platform(padapter); rtl8188e_silentreset_for_specific_platform(padapter);
} }
/* total xmit irp = 4 */ /* total xmit irp = 4 */
current_time = rtw_get_current_time(); current_time = rtw_get_current_time();
if (0==pxmitpriv->free_xmitbuf_cnt) if (0 == pxmitpriv->free_xmitbuf_cnt) {
{
diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_time); diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_time);
if (diff_time > 2000) { if (diff_time > 2000) {
if (psrtpriv->last_tx_complete_time == 0) { if (psrtpriv->last_tx_complete_time == 0) {
psrtpriv->last_tx_complete_time = current_time; psrtpriv->last_tx_complete_time = current_time;
} } else {
else{
diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_complete_time); diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_complete_time);
if (diff_time > 4000) { if (diff_time > 4000) {
DBG_88E("%s tx hang\n", __func__); DBG_88E("%s tx hang\n", __func__);
@ -167,8 +159,7 @@ void rtl8188e_sreset_linked_status_check(struct adapter *padapter)
rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status);
} }
fw_status = rtw_read8(padapter, REG_FMETHR); fw_status = rtw_read8(padapter, REG_FMETHR);
if (fw_status != 0x00) if (fw_status != 0x00) {
{
if (fw_status == 1) if (fw_status == 1)
DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status); DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status);
else if (fw_status == 2) else if (fw_status == 2)

View file

@ -33,14 +33,15 @@ void dump_txrpt_ccx_88e(void *buf)
"retry_cnt:%u, lifetime_over:%u, retry_over:%u\n" "retry_cnt:%u, lifetime_over:%u, retry_over:%u\n"
"ccx_qtime:%u\n" "ccx_qtime:%u\n"
"final_data_rate:0x%02x\n" "final_data_rate:0x%02x\n"
"qsel:%u, sw:0x%03x\n" "qsel:%u, sw:0x%03x\n",
, __func__ __func__, txrpt_ccx->tag1, txrpt_ccx->pkt_num,
, txrpt_ccx->tag1, txrpt_ccx->pkt_num, txrpt_ccx->txdma_underflow, txrpt_ccx->int_bt, txrpt_ccx->int_tri, txrpt_ccx->int_ccx txrpt_ccx->txdma_underflow, txrpt_ccx->int_bt,
, txrpt_ccx->mac_id, txrpt_ccx->pkt_ok, txrpt_ccx->bmc txrpt_ccx->int_tri, txrpt_ccx->int_ccx,
, txrpt_ccx->retry_cnt, txrpt_ccx->lifetime_over, txrpt_ccx->retry_over txrpt_ccx->mac_id, txrpt_ccx->pkt_ok, txrpt_ccx->bmc,
, txrpt_ccx_qtime_88e(txrpt_ccx) txrpt_ccx->retry_cnt, txrpt_ccx->lifetime_over,
, txrpt_ccx->final_data_rate txrpt_ccx->retry_over, txrpt_ccx_qtime_88e(txrpt_ccx),
, txrpt_ccx->qsel, txrpt_ccx_sw_88e(txrpt_ccx) txrpt_ccx->final_data_rate, txrpt_ccx->qsel,
txrpt_ccx_sw_88e(txrpt_ccx)
); );
} }
@ -50,34 +51,32 @@ void handle_txrpt_ccx_88e(struct adapter *adapter, u8 *buf)
if (txrpt_ccx->int_ccx) { if (txrpt_ccx->int_ccx) {
if (txrpt_ccx->pkt_ok) if (txrpt_ccx->pkt_ok)
rtw_ack_tx_done(&adapter->xmitpriv, RTW_SCTX_DONE_SUCCESS); rtw_ack_tx_done(&adapter->xmitpriv,
RTW_SCTX_DONE_SUCCESS);
else else
rtw_ack_tx_done(&adapter->xmitpriv, RTW_SCTX_DONE_CCX_PKT_FAIL); rtw_ack_tx_done(&adapter->xmitpriv,
RTW_SCTX_DONE_CCX_PKT_FAIL);
} }
} }
void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *ptxdesc) void _dbg_dump_tx_info(struct adapter *padapter, int frame_tag,
struct tx_desc *ptxdesc)
{ {
u8 bDumpTxPkt; u8 dmp_txpkt;
u8 bDumpTxDesc = false; bool dump_txdesc = false;
rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(bDumpTxPkt)); rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(dmp_txpkt));
if (bDumpTxPkt ==1){/* dump txdesc for data frame */ if (dmp_txpkt == 1) {/* dump txdesc for data frame */
DBG_88E("dump tx_desc for data frame\n"); DBG_88E("dump tx_desc for data frame\n");
if ((frame_tag&0x0f) == DATA_FRAMETAG){ if ((frame_tag & 0x0f) == DATA_FRAMETAG)
bDumpTxDesc = true; dump_txdesc = true;
} } else if (dmp_txpkt == 2) {/* dump txdesc for mgnt frame */
}
else if (bDumpTxPkt ==2){/* dump txdesc for mgnt frame */
DBG_88E("dump tx_desc for mgnt frame\n"); DBG_88E("dump tx_desc for mgnt frame\n");
if ((frame_tag&0x0f) == MGNT_FRAMETAG){ if ((frame_tag & 0x0f) == MGNT_FRAMETAG)
bDumpTxDesc = true; dump_txdesc = true;
}
}
else if (bDumpTxPkt ==3){/* dump early info */
} }
if (bDumpTxDesc){ if (dump_txdesc) {
DBG_88E("=====================================\n"); DBG_88E("=====================================\n");
DBG_88E("txdw0(0x%08x)\n", ptxdesc->txdw0); DBG_88E("txdw0(0x%08x)\n", ptxdesc->txdw0);
DBG_88E("txdw1(0x%08x)\n", ptxdesc->txdw1); DBG_88E("txdw1(0x%08x)\n", ptxdesc->txdw1);
@ -89,5 +88,4 @@ void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *pt
DBG_88E("txdw7(0x%08x)\n", ptxdesc->txdw7); DBG_88E("txdw7(0x%08x)\n", ptxdesc->txdw7);
DBG_88E("=====================================\n"); DBG_88E("=====================================\n");
} }
} }

View file

@ -24,114 +24,72 @@
#include <rtl8188e_led.h> #include <rtl8188e_led.h>
/* LED object. */ /* LED object. */
/* */
/* */
/* Prototype of protected function. */
/* */
/* */
/* LED_819xUsb routines. */ /* LED_819xUsb routines. */
/* */
/* */
/* Description: */ /* Description: */
/* Turn on LED according to LedPin specified. */ /* Turn on LED according to LedPin specified. */
/* */
void SwLedOn(struct adapter *padapter, struct LED_871x *pLed) void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
{ {
u8 LedCfg; u8 LedCfg;
if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
{
return; return;
}
LedCfg = rtw_read8(padapter, REG_LEDCFG2); LedCfg = rtw_read8(padapter, REG_LEDCFG2);
switch (pLed->LedPin) switch (pLed->LedPin) {
{
case LED_PIN_LED0: case LED_PIN_LED0:
rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0)|BIT5|BIT6); /* SW control led0 on. */ rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0)|BIT5|BIT6); /* SW control led0 on. */
break; break;
case LED_PIN_LED1: case LED_PIN_LED1:
rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0x0f)|BIT5); /* SW control led1 on. */ rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0x0f)|BIT5); /* SW control led1 on. */
break; break;
default: default:
break; break;
} }
pLed->bLedOn = true; pLed->bLedOn = true;
} }
/* */
/* Description: */ /* Description: */
/* Turn off LED according to LedPin specified. */ /* Turn off LED according to LedPin specified. */
/* */
void SwLedOff(struct adapter *padapter, struct LED_871x *pLed) void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
{ {
u8 LedCfg; u8 LedCfg;
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
if ((padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
{
goto exit; goto exit;
}
LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */ LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */
switch (pLed->LedPin) switch (pLed->LedPin) {
{
case LED_PIN_LED0: case LED_PIN_LED0:
if (pHalData->bLedOpenDrain == true) /* Open-drain arrangement for controlling the LED) */ if (pHalData->bLedOpenDrain) {
{ /* Open-drain arrangement for controlling the LED) */
LedCfg &= 0x90; /* Set to software control. */ LedCfg &= 0x90; /* Set to software control. */
rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3)); rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3));
LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG); LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
LedCfg &= 0xFE; LedCfg &= 0xFE;
rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
} } else {
else
{
rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3|BIT5|BIT6)); rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3|BIT5|BIT6));
} }
break; break;
case LED_PIN_LED1: case LED_PIN_LED1:
LedCfg &= 0x0f; /* Set to software control. */ LedCfg &= 0x0f; /* Set to software control. */
rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3)); rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3));
break; break;
default: default:
break; break;
} }
exit: exit:
pLed->bLedOn = false; pLed->bLedOn = false;
} }
/* */
/* Interface to manipulate LED objects. */ /* Interface to manipulate LED objects. */
/* */
/* */
/* Default LED behavior. */ /* Default LED behavior. */
/* */
/* */
/* Description: */ /* Description: */
/* Initialize all LED_871x objects. */ /* Initialize all LED_871x objects. */
/* */ void rtl8188eu_InitSwLeds(struct adapter *padapter)
void
rtl8188eu_InitSwLeds(
struct adapter *padapter
)
{ {
struct led_priv *pledpriv = &(padapter->ledpriv); struct led_priv *pledpriv = &(padapter->ledpriv);
@ -142,15 +100,9 @@ rtl8188eu_InitSwLeds(
InitLed871x(padapter, &(pledpriv->SwLed1), LED_PIN_LED1); InitLed871x(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
} }
/* */
/* Description: */ /* Description: */
/* DeInitialize all LED_819xUsb objects. */ /* DeInitialize all LED_819xUsb objects. */
/* */ void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
void
rtl8188eu_DeInitSwLeds(
struct adapter *padapter
)
{ {
struct led_priv *ledpriv = &(padapter->ledpriv); struct led_priv *ledpriv = &(padapter->ledpriv);

View file

@ -32,22 +32,20 @@
#include <rtl8188e_hal.h> #include <rtl8188e_hal.h>
void rtl8188eu_init_recvbuf(struct adapter *padapter, struct recv_buf *precvbuf) void rtl8188eu_init_recvbuf(struct adapter *padapter, struct recv_buf *precvbuf)
{ {
precvbuf->transfer_len = 0; precvbuf->transfer_len = 0;
precvbuf->len = 0; precvbuf->len = 0;
precvbuf->ref_cnt = 0; precvbuf->ref_cnt = 0;
if (precvbuf->pbuf) if (precvbuf->pbuf) {
{ precvbuf->pdata = precvbuf->pbuf;
precvbuf->pdata = precvbuf->phead = precvbuf->ptail = precvbuf->pbuf; precvbuf->phead = precvbuf->pbuf;
precvbuf->ptail = precvbuf->pbuf;
precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ; precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ;
} }
} }
int rtl8188eu_init_recv_priv(struct adapter *padapter) int rtl8188eu_init_recv_priv(struct adapter *padapter)
@ -76,29 +74,19 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
precvbuf = (struct recv_buf *)precvpriv->precv_buf; precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i=0; i < NR_RECVBUFF ; i++) for (i = 0; i < NR_RECVBUFF; i++) {
{
_rtw_init_listhead(&precvbuf->list); _rtw_init_listhead(&precvbuf->list);
_rtw_spinlock_init(&precvbuf->recvbuf_lock); _rtw_spinlock_init(&precvbuf->recvbuf_lock);
precvbuf->alloc_sz = MAX_RECVBUF_SZ; precvbuf->alloc_sz = MAX_RECVBUF_SZ;
res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
if (res == _FAIL) if (res == _FAIL)
break; break;
precvbuf->ref_cnt = 0; precvbuf->ref_cnt = 0;
precvbuf->adapter = padapter; precvbuf->adapter = padapter;
precvbuf++; precvbuf++;
} }
precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF; precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF;
skb_queue_head_init(&precvpriv->rx_skb_queue); skb_queue_head_init(&precvpriv->rx_skb_queue);
{ {
int i; int i;
size_t tmpaddr = 0; size_t tmpaddr = 0;
@ -107,35 +95,25 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
skb_queue_head_init(&precvpriv->free_recv_skb_queue); skb_queue_head_init(&precvpriv->free_recv_skb_queue);
for (i=0; i<NR_PREALLOC_RECV_SKB; i++) for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
{ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) /* www.mail-archive.com/netdev@vger.kernel.org/msg17214.html */
pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL); pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL);
#else #else
pskb = __netdev_alloc_skb(padapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL); pskb = __netdev_alloc_skb(padapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL);
#endif #endif
if (pskb) {
if (pskb)
{
pskb->dev = padapter->pnetdev; pskb->dev = padapter->pnetdev;
tmpaddr = (size_t)pskb->data; tmpaddr = (size_t)pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment)); skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
} }
pskb = NULL; pskb = NULL;
} }
} }
exit: exit:
return res; return res;
} }
void rtl8188eu_free_recv_priv(struct adapter *padapter) void rtl8188eu_free_recv_priv(struct adapter *padapter)
@ -146,8 +124,7 @@ void rtl8188eu_free_recv_priv (struct adapter *padapter)
precvbuf = (struct recv_buf *)precvpriv->precv_buf; precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i=0; i < NR_RECVBUFF ; i++) for (i = 0; i < NR_RECVBUFF; i++) {
{
rtw_os_recvbuf_resource_free(padapter, precvbuf); rtw_os_recvbuf_resource_free(padapter, precvbuf);
precvbuf++; precvbuf++;
} }

View file

@ -26,33 +26,33 @@
#include <usb_ops.h> #include <usb_ops.h>
#include <rtl8188e_hal.h> #include <rtl8188e_hal.h>
s32 rtl8188eu_init_xmit_priv(struct adapter *padapter) s32 rtl8188eu_init_xmit_priv(struct adapter *adapt)
{ {
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
tasklet_init(&pxmitpriv->xmit_tasklet, tasklet_init(&pxmitpriv->xmit_tasklet,
(void(*)(unsigned long))rtl8188eu_xmit_tasklet, (void(*)(unsigned long))rtl8188eu_xmit_tasklet,
(unsigned long)padapter); (unsigned long)adapt);
return _SUCCESS; return _SUCCESS;
} }
void rtl8188eu_free_xmit_priv(struct adapter *padapter) void rtl8188eu_free_xmit_priv(struct adapter *adapt)
{ {
} }
static u8 urb_zero_packet_chk(struct adapter *padapter, int sz) static u8 urb_zero_packet_chk(struct adapter *adapt, int sz)
{ {
u8 blnSetTxDescOffset; u8 set_tx_desc_offset;
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
blnSetTxDescOffset = (((sz + TXDESC_SIZE) % pHalData->UsbBulkOutSize) ==0)?1:0; set_tx_desc_offset = (((sz + TXDESC_SIZE) % haldata->UsbBulkOutSize) == 0) ? 1 : 0;
return blnSetTxDescOffset; return set_tx_desc_offset;
} }
static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc) static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
{ {
u16 *usPtr = (u16*)ptxdesc; u16 *usptr = (u16 *)ptxdesc;
u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */
u32 index; u32 index;
u16 checksum = 0; u16 checksum = 0;
@ -61,27 +61,20 @@ static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
ptxdesc->txdw7 &= cpu_to_le32(0xffff0000); ptxdesc->txdw7 &= cpu_to_le32(0xffff0000);
for (index = 0; index < count; index++) for (index = 0; index < count; index++)
checksum = checksum ^ le16_to_cpu(*(__le16 *)(usPtr + index)); checksum = checksum ^ le16_to_cpu(*(__le16 *)(usptr + index));
ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff & checksum); ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff & checksum);
} }
/* */
/* Description: In normal chip, we should send some packet to Hw which will be used by Fw */ /* Description: In normal chip, we should send some packet to Hw which will be used by Fw */
/* in FW LPS mode. The function is to fill the Tx descriptor of this packets, then */ /* in FW LPS mode. The function is to fill the Tx descriptor of this packets, then */
/* Fw can tell Hw to send these packet derectly. */ /* Fw can tell Hw to send these packet derectly. */
/* */ void rtl8188e_fill_fake_txdesc(struct adapter *adapt, u8 *desc, u32 BufferLen, u8 ispspoll, u8 is_btqosnull)
void rtl8188e_fill_fake_txdesc(
struct adapter * padapter,
u8* pDesc,
u32 BufferLen,
u8 IsPsPoll,
u8 IsBTQosNull)
{ {
struct tx_desc *ptxdesc; struct tx_desc *ptxdesc;
/* Clear all status */ /* Clear all status */
ptxdesc = (struct tx_desc*)pDesc; ptxdesc = (struct tx_desc *)desc;
_rtw_memset(pDesc, 0, TXDESC_SIZE); _rtw_memset(desc, 0, TXDESC_SIZE);
/* offset 0 */ /* offset 0 */
ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); /* own, bFirstSeg, bLastSeg; */ ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); /* own, bFirstSeg, bLastSeg; */
@ -94,20 +87,15 @@ void rtl8188e_fill_fake_txdesc(
ptxdesc->txdw1 |= cpu_to_le32((QSLT_MGNT<<QSEL_SHT)&0x00001f00); /* Fixed queue of Mgnt queue */ ptxdesc->txdw1 |= cpu_to_le32((QSLT_MGNT<<QSEL_SHT)&0x00001f00); /* Fixed queue of Mgnt queue */
/* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error vlaue by Hw. */ /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error vlaue by Hw. */
if (IsPsPoll) if (ispspoll) {
{
ptxdesc->txdw1 |= cpu_to_le32(NAVUSEHDR); ptxdesc->txdw1 |= cpu_to_le32(NAVUSEHDR);
} } else {
else
{
ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); /* Hw set sequence number */ ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); /* Hw set sequence number */
ptxdesc->txdw3 |= cpu_to_le32((8 << 28)); /* set bit3 to 1. Suugested by TimChen. 2009.12.29. */ ptxdesc->txdw3 |= cpu_to_le32((8 << 28)); /* set bit3 to 1. Suugested by TimChen. 2009.12.29. */
} }
if (true == IsBTQosNull) if (is_btqosnull)
{
ptxdesc->txdw2 |= cpu_to_le32(BIT(23)); /* BT NULL */ ptxdesc->txdw2 |= cpu_to_le32(BIT(23)); /* BT NULL */
}
/* offset 16 */ /* offset 16 */
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));/* driver uses rate */ ptxdesc->txdw4 |= cpu_to_le32(BIT(8));/* driver uses rate */
@ -190,27 +178,26 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw)
} }
} }
static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bagg_pkt) static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bagg_pkt)
{ {
int pull = 0; int pull = 0;
uint qsel; uint qsel;
u8 data_rate, pwr_status, offset; u8 data_rate, pwr_status, offset;
struct adapter *padapter = pxmitframe->padapter; struct adapter *adapt = pxmitframe->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapt->mlmepriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib; struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
struct tx_desc *ptxdesc = (struct tx_desc *)pmem; struct tx_desc *ptxdesc = (struct tx_desc *)pmem;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &adapt->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
int bmcst = IS_MCAST(pattrib->ra); int bmcst = IS_MCAST(pattrib->ra);
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info* pwdinfo = &padapter->wdinfo; struct wifidirect_info *pwdinfo = &adapt->wdinfo;
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
if (padapter->registrypriv.mp_mode == 0) { if (adapt->registrypriv.mp_mode == 0) {
if ((!bagg_pkt) &&(urb_zero_packet_chk(padapter, sz)==0))/* sz %512) != 0 */ { if ((!bagg_pkt) && (urb_zero_packet_chk(adapt, sz) == 0)) {
ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ); ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ);
pull = 1; pull = 1;
} }
@ -226,9 +213,10 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
ptxdesc->txdw0 |= cpu_to_le32(((offset) << OFFSET_SHT) & 0x00ff0000);/* 32 bytes for TX Desc */ ptxdesc->txdw0 |= cpu_to_le32(((offset) << OFFSET_SHT) & 0x00ff0000);/* 32 bytes for TX Desc */
if (bmcst) ptxdesc->txdw0 |= cpu_to_le32(BMC); if (bmcst)
ptxdesc->txdw0 |= cpu_to_le32(BMC);
if (padapter->registrypriv.mp_mode == 0) { if (adapt->registrypriv.mp_mode == 0) {
if (!bagg_pkt) { if (!bagg_pkt) {
if ((pull) && (pxmitframe->pkt_offset > 0)) if ((pull) && (pxmitframe->pkt_offset > 0))
pxmitframe->pkt_offset = pxmitframe->pkt_offset - 1; pxmitframe->pkt_offset = pxmitframe->pkt_offset - 1;
@ -242,9 +230,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
/* driver uses rate */ /* driver uses rate */
ptxdesc->txdw4 |= cpu_to_le32(USERATE);/* rate control always by driver */ ptxdesc->txdw4 |= cpu_to_le32(USERATE);/* rate control always by driver */
if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) {
{
/* offset 4 */ /* offset 4 */
ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id & 0x3F); ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id & 0x3F);
@ -255,36 +241,30 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
fill_txdesc_sectype(pattrib, ptxdesc); fill_txdesc_sectype(pattrib, ptxdesc);
if (pattrib->ampdu_en==true){ if (pattrib->ampdu_en) {
ptxdesc->txdw2 |= cpu_to_le32(AGG_EN);/* AGG EN */ ptxdesc->txdw2 |= cpu_to_le32(AGG_EN);/* AGG EN */
ptxdesc->txdw6 = cpu_to_le32(0x6666f800); ptxdesc->txdw6 = cpu_to_le32(0x6666f800);
} } else {
else{
ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);/* AGG BK */ ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);/* AGG BK */
} }
/* offset 8 */ /* offset 8 */
/* offset 12 */ /* offset 12 */
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum << SEQ_SHT) & 0x0FFF0000); ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum << SEQ_SHT) & 0x0FFF0000);
/* offset 16 , offset 20 */ /* offset 16 , offset 20 */
if (pattrib->qos_en) if (pattrib->qos_en)
ptxdesc->txdw4 |= cpu_to_le32(QOS);/* QoS */ ptxdesc->txdw4 |= cpu_to_le32(QOS);/* QoS */
/* offset 20 */ /* offset 20 */
if (pxmitframe->agg_num > 1){ if (pxmitframe->agg_num > 1)
ptxdesc->txdw5 |= cpu_to_le32((pxmitframe->agg_num << USB_TXAGG_NUM_SHT) & 0xFF000000); ptxdesc->txdw5 |= cpu_to_le32((pxmitframe->agg_num << USB_TXAGG_NUM_SHT) & 0xFF000000);
}
if ((pattrib->ether_type != 0x888e) && if ((pattrib->ether_type != 0x888e) &&
(pattrib->ether_type != 0x0806) && (pattrib->ether_type != 0x0806) &&
(pattrib->ether_type != 0x88b4) && (pattrib->ether_type != 0x88b4) &&
(pattrib->dhcp_pkt != 1)) (pattrib->dhcp_pkt != 1)) {
{
/* Non EAP & ARP & DHCP type data packet */ /* Non EAP & ARP & DHCP type data packet */
fill_txdesc_vcs(pattrib, &ptxdesc->txdw4); fill_txdesc_vcs(pattrib, &ptxdesc->txdw4);
@ -294,29 +274,23 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);/* DATA/RTS Rate FB LMT */ ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);/* DATA/RTS Rate FB LMT */
if (pattrib->ht_en) { if (pattrib->ht_en) {
if ( ODM_RA_GetShortGI_8188E(&pHalData->odmpriv,pattrib->mac_id)) if (ODM_RA_GetShortGI_8188E(&haldata->odmpriv, pattrib->mac_id))
ptxdesc->txdw5 |= cpu_to_le32(SGI);/* SGI */ ptxdesc->txdw5 |= cpu_to_le32(SGI);/* SGI */
} }
data_rate = ODM_RA_GetDecisionRate_8188E(&haldata->odmpriv, pattrib->mac_id);
data_rate =ODM_RA_GetDecisionRate_8188E(&pHalData->odmpriv,pattrib->mac_id);
ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F);
pwr_status = ODM_RA_GetHwPwrStatus_8188E(&haldata->odmpriv, pattrib->mac_id);
pwr_status = ODM_RA_GetHwPwrStatus_8188E(&pHalData->odmpriv,pattrib->mac_id);
ptxdesc->txdw4 |= cpu_to_le32((pwr_status & 0x7) << PWR_STATUS_SHT); ptxdesc->txdw4 |= cpu_to_le32((pwr_status & 0x7) << PWR_STATUS_SHT);
} else { } else {
/* EAP data packet and ARP packet and DHCP. */ /* EAP data packet and ARP packet and DHCP. */
/* Use the 1M data rate to send the EAP/ARP packet. */ /* Use the 1M data rate to send the EAP/ARP packet. */
/* This will maybe make the handshake smooth. */ /* This will maybe make the handshake smooth. */
ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);/* AGG BK */ ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);/* AGG BK */
if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT) if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT)
ptxdesc->txdw4 |= cpu_to_le32(BIT(24));/* DATA_SHORT */ ptxdesc->txdw4 |= cpu_to_le32(BIT(24));/* DATA_SHORT */
ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate));
} }
} else if ((pxmitframe->frame_tag&0x0f) == MGNT_FRAMETAG) { } else if ((pxmitframe->frame_tag&0x0f) == MGNT_FRAMETAG) {
/* offset 4 */ /* offset 4 */
ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id & 0x3f); ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id & 0x3f);
@ -325,7 +299,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
ptxdesc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000f0000); ptxdesc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000f0000);
/* offset 8 */ /* offset 8 */
/* CCX-TXRPT ack for xmit mgmt frames. */ /* CCX-TXRPT ack for xmit mgmt frames. */
if (pxmitframe->ack_report) if (pxmitframe->ack_report)
@ -336,24 +309,18 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
/* offset 20 */ /* offset 20 */
ptxdesc->txdw5 |= cpu_to_le32(RTY_LMT_EN);/* retry limit enable */ ptxdesc->txdw5 |= cpu_to_le32(RTY_LMT_EN);/* retry limit enable */
if (pattrib->retry_ctrl == true) if (pattrib->retry_ctrl)
ptxdesc->txdw5 |= cpu_to_le32(0x00180000);/* retry limit = 6 */ ptxdesc->txdw5 |= cpu_to_le32(0x00180000);/* retry limit = 6 */
else else
ptxdesc->txdw5 |= cpu_to_le32(0x00300000);/* retry limit = 12 */ ptxdesc->txdw5 |= cpu_to_le32(0x00300000);/* retry limit = 12 */
ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate));
} } else if ((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG) {
else if ((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG)
{
DBG_88E("pxmitframe->frame_tag == TXAGG_FRAMETAG\n"); DBG_88E("pxmitframe->frame_tag == TXAGG_FRAMETAG\n");
} } else if (((pxmitframe->frame_tag&0x0f) == MP_FRAMETAG) &&
else if (((pxmitframe->frame_tag&0x0f) == MP_FRAMETAG) && (adapt->registrypriv.mp_mode == 1)) {
(padapter->registrypriv.mp_mode == 1)) fill_txdesc_for_mp(adapt, ptxdesc);
{ } else {
fill_txdesc_for_mp(padapter, ptxdesc);
}
else
{
DBG_88E("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag); DBG_88E("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag);
/* offset 4 */ /* offset 4 */
@ -378,22 +345,20 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
/* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */ /* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */
/* (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. */ /* (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. */
/* 2010.06.23. Added by tynli. */ /* 2010.06.23. Added by tynli. */
if (!pattrib->qos_en) if (!pattrib->qos_en) {
{
ptxdesc->txdw3 |= cpu_to_le32(EN_HWSEQ); /* Hw set sequence number */ ptxdesc->txdw3 |= cpu_to_le32(EN_HWSEQ); /* Hw set sequence number */
ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); /* Hw set sequence number */ ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); /* Hw set sequence number */
} }
ODM_SetTxAntByTxInfo_88E(&pHalData->odmpriv, pmem, pattrib->mac_id); ODM_SetTxAntByTxInfo_88E(&haldata->odmpriv, pmem, pattrib->mac_id);
rtl8188eu_cal_txdesc_chksum(ptxdesc); rtl8188eu_cal_txdesc_chksum(ptxdesc);
_dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc); _dbg_dump_tx_info(adapt, pxmitframe->frame_tag, ptxdesc);
return pull; return pull;
} }
/* for non-agg data frame or management frame */ /* for non-agg data frame or management frame */
static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitframe) static s32 rtw_dump_xframe(struct adapter *adapt, struct xmit_frame *pxmitframe)
{ {
s32 ret = _SUCCESS; s32 ret = _SUCCESS;
s32 inner_ret = _SUCCESS; s32 inner_ret = _SUCCESS;
@ -402,63 +367,52 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra
u32 ff_hwaddr; u32 ff_hwaddr;
struct xmit_buf *pxmitbuf = pxmitframe->pxmitbuf; struct xmit_buf *pxmitbuf = pxmitframe->pxmitbuf;
struct pkt_attrib *pattrib = &pxmitframe->attrib; struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &adapt->securitypriv;
if ((pxmitframe->frame_tag == DATA_FRAMETAG) && if ((pxmitframe->frame_tag == DATA_FRAMETAG) &&
(pxmitframe->attrib.ether_type != 0x0806) && (pxmitframe->attrib.ether_type != 0x0806) &&
(pxmitframe->attrib.ether_type != 0x888e) && (pxmitframe->attrib.ether_type != 0x888e) &&
(pxmitframe->attrib.ether_type != 0x88b4) && (pxmitframe->attrib.ether_type != 0x88b4) &&
(pxmitframe->attrib.dhcp_pkt != 1)) (pxmitframe->attrib.dhcp_pkt != 1))
{ rtw_issue_addbareq_cmd(adapt, pxmitframe);
rtw_issue_addbareq_cmd(padapter, pxmitframe);
}
mem_addr = pxmitframe->buf_addr; mem_addr = pxmitframe->buf_addr;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_dump_xframe()\n")); RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_dump_xframe()\n"));
for (t = 0; t < pattrib->nr_frags; t++) for (t = 0; t < pattrib->nr_frags; t++) {
{
if (inner_ret != _SUCCESS && ret == _SUCCESS) if (inner_ret != _SUCCESS && ret == _SUCCESS)
ret = _FAIL; ret = _FAIL;
if (t != (pattrib->nr_frags - 1)) if (t != (pattrib->nr_frags - 1)) {
{
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("pattrib->nr_frags=%d\n", pattrib->nr_frags)); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("pattrib->nr_frags=%d\n", pattrib->nr_frags));
sz = pxmitpriv->frag_len; sz = pxmitpriv->frag_len;
sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len); sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len);
} } else {
else /* no frag */ /* no frag */
{
sz = pattrib->last_txcmdsz; sz = pattrib->last_txcmdsz;
} }
pull = update_txdesc(pxmitframe, mem_addr, sz, false); pull = update_txdesc(pxmitframe, mem_addr, sz, false);
if (pull) if (pull) {
{
mem_addr += PACKET_OFFSET_SZ; /* pull txdesc head */ mem_addr += PACKET_OFFSET_SZ; /* pull txdesc head */
pxmitframe->buf_addr = mem_addr; pxmitframe->buf_addr = mem_addr;
w_sz = sz + TXDESC_SIZE; w_sz = sz + TXDESC_SIZE;
} } else {
else
{
w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ; w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ;
} }
ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe); ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe);
inner_ret = rtw_write_port(padapter, ff_hwaddr, w_sz, (unsigned char*)pxmitbuf); inner_ret = rtw_write_port(adapt, ff_hwaddr, w_sz, (unsigned char *)pxmitbuf);
rtw_count_tx_stats(padapter, pxmitframe, sz); rtw_count_tx_stats(adapt, pxmitframe, sz);
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_write_port, w_sz=%d\n", w_sz)); RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_write_port, w_sz=%d\n", w_sz));
mem_addr += w_sz; mem_addr += w_sz;
mem_addr = (u8 *)RND4(((size_t)(mem_addr))); mem_addr = (u8 *)RND4(((size_t)(mem_addr)));
} }
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
@ -487,9 +441,9 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe)
return len; return len;
} }
s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
{ {
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
struct xmit_frame *pxmitframe = NULL; struct xmit_frame *pxmitframe = NULL;
struct xmit_frame *pfirstframe = NULL; struct xmit_frame *pfirstframe = NULL;
@ -498,30 +452,28 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
struct tx_servq *ptxservq = NULL; struct tx_servq *ptxservq = NULL;
unsigned long irqL; unsigned long irql;
struct list_head *xmitframe_plist = NULL, *xmitframe_phead = NULL; struct list_head *xmitframe_plist = NULL, *xmitframe_phead = NULL;
u32 pbuf; /* next pkt address */ u32 pbuf; /* next pkt address */
u32 pbuf_tail; /* last pkt tail */ u32 pbuf_tail; /* last pkt tail */
u32 len; /* packet length, except TXDESC_SIZE and PKT_OFFSET */ u32 len; /* packet length, except TXDESC_SIZE and PKT_OFFSET */
u32 bulkSize = pHalData->UsbBulkOutSize; u32 bulksize = haldata->UsbBulkOutSize;
u8 descCount; u8 desc_cnt;
u32 bulkPtr; u32 bulkptr;
/* dump frame variable */ /* dump frame variable */
u32 ff_hwaddr; u32 ff_hwaddr;
RT_TRACE(_module_rtl8192c_xmit_c_, _drv_info_, ("+xmitframe_complete\n")); RT_TRACE(_module_rtl8192c_xmit_c_, _drv_info_, ("+xmitframe_complete\n"));
/* check xmitbuffer is ok */ /* check xmitbuffer is ok */
if (pxmitbuf == NULL) { if (pxmitbuf == NULL) {
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
if (pxmitbuf == NULL){ if (pxmitbuf == NULL)
return false; return false;
} }
}
/* 3 1. pick up first frame */ /* 3 1. pick up first frame */
do { do {
@ -541,10 +493,10 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
pxmitframe->agg_num = 1; /* alloc xmitframe should assign to 1. */ pxmitframe->agg_num = 1; /* alloc xmitframe should assign to 1. */
pxmitframe->pkt_offset = 1; /* first frame of aggregation, reserve offset */ pxmitframe->pkt_offset = 1; /* first frame of aggregation, reserve offset */
rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);
/* always return ndis_packet after rtw_xmitframe_coalesce */ /* always return ndis_packet after rtw_xmitframe_coalesce */
rtw_os_xmit_complete(padapter, pxmitframe); rtw_os_xmit_complete(adapt, pxmitframe);
break; break;
} while (1); } while (1);
@ -556,13 +508,13 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
pbuf = _RND8(pbuf_tail); pbuf = _RND8(pbuf_tail);
/* check pkt amount in one bulk */ /* check pkt amount in one bulk */
descCount = 0; desc_cnt = 0;
bulkPtr = bulkSize; bulkptr = bulksize;
if (pbuf < bulkPtr) if (pbuf < bulkptr) {
descCount++; desc_cnt++;
else { } else {
descCount = 0; desc_cnt = 0;
bulkPtr = ((pbuf / bulkSize) + 1) * bulkSize; /* round to next bulkSize */ bulkptr = ((pbuf / bulksize) + 1) * bulksize; /* round to next bulksize */
} }
/* dequeue same priority packet from station tx queue */ /* dequeue same priority packet from station tx queue */
@ -573,19 +525,16 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
ptxservq = &(psta->sta_xmitpriv.bk_q); ptxservq = &(psta->sta_xmitpriv.bk_q);
phwxmit = pxmitpriv->hwxmits + 3; phwxmit = pxmitpriv->hwxmits + 3;
break; break;
case 4: case 4:
case 5: case 5:
ptxservq = &(psta->sta_xmitpriv.vi_q); ptxservq = &(psta->sta_xmitpriv.vi_q);
phwxmit = pxmitpriv->hwxmits + 1; phwxmit = pxmitpriv->hwxmits + 1;
break; break;
case 6: case 6:
case 7: case 7:
ptxservq = &(psta->sta_xmitpriv.vo_q); ptxservq = &(psta->sta_xmitpriv.vo_q);
phwxmit = pxmitpriv->hwxmits; phwxmit = pxmitpriv->hwxmits;
break; break;
case 0: case 0:
case 3: case 3:
default: default:
@ -593,13 +542,12 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
phwxmit = pxmitpriv->hwxmits + 2; phwxmit = pxmitpriv->hwxmits + 2;
break; break;
} }
_enter_critical_bh(&pxmitpriv->lock, &irqL); _enter_critical_bh(&pxmitpriv->lock, &irql);
xmitframe_phead = get_list_head(&ptxservq->sta_pending); xmitframe_phead = get_list_head(&ptxservq->sta_pending);
xmitframe_plist = get_next(xmitframe_phead); xmitframe_plist = get_next(xmitframe_phead);
while (rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist) == false) while (!rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) {
{
pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
xmitframe_plist = get_next(xmitframe_plist); xmitframe_plist = get_next(xmitframe_plist);
@ -608,8 +556,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE + (pxmitframe->pkt_offset*PACKET_OFFSET_SZ); len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE + (pxmitframe->pkt_offset*PACKET_OFFSET_SZ);
if (_RND8(pbuf + len) > MAX_XMITBUF_SZ) if (_RND8(pbuf + len) > MAX_XMITBUF_SZ) {
{
pxmitframe->agg_num = 1; pxmitframe->agg_num = 1;
pxmitframe->pkt_offset = 1; pxmitframe->pkt_offset = 1;
break; break;
@ -620,9 +567,9 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf; pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf;
rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);
/* always return ndis_packet after rtw_xmitframe_coalesce */ /* always return ndis_packet after rtw_xmitframe_coalesce */
rtw_os_xmit_complete(padapter, pxmitframe); rtw_os_xmit_complete(adapt, pxmitframe);
/* (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz */ /* (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz */
update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz, true); update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz, true);
@ -634,35 +581,31 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
pbuf_tail = pbuf + len; pbuf_tail = pbuf + len;
pbuf = _RND8(pbuf_tail); pbuf = _RND8(pbuf_tail);
pfirstframe->agg_num++; pfirstframe->agg_num++;
if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num) if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num)
break; break;
if (pbuf < bulkPtr) { if (pbuf < bulkptr) {
descCount++; desc_cnt++;
if (descCount == pHalData->UsbTxAggDescNum) if (desc_cnt == haldata->UsbTxAggDescNum)
break; break;
} else { } else {
descCount = 0; desc_cnt = 0;
bulkPtr = ((pbuf / bulkSize) + 1) * bulkSize; bulkptr = ((pbuf / bulksize) + 1) * bulksize;
} }
} /* end while (aggregate same priority and same DA(AP or STA) frames) */ } /* end while (aggregate same priority and same DA(AP or STA) frames) */
if (_rtw_queue_empty(&ptxservq->sta_pending) == true) if (_rtw_queue_empty(&ptxservq->sta_pending) == true)
rtw_list_delete(&ptxservq->tx_pending); rtw_list_delete(&ptxservq->tx_pending);
_exit_critical_bh(&pxmitpriv->lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irql);
if ((pfirstframe->attrib.ether_type != 0x0806) && if ((pfirstframe->attrib.ether_type != 0x0806) &&
(pfirstframe->attrib.ether_type != 0x888e) && (pfirstframe->attrib.ether_type != 0x888e) &&
(pfirstframe->attrib.ether_type != 0x88b4) && (pfirstframe->attrib.ether_type != 0x88b4) &&
(pfirstframe->attrib.dhcp_pkt != 1)) (pfirstframe->attrib.dhcp_pkt != 1))
{ rtw_issue_addbareq_cmd(adapt, pfirstframe);
rtw_issue_addbareq_cmd(padapter, pfirstframe);
}
/* 3 3. update first frame txdesc */ /* 3 3. update first frame txdesc */
if ((pbuf_tail % bulkSize) == 0) { if ((pbuf_tail % bulksize) == 0) {
/* remove pkt_offset */ /* remove pkt_offset */
pbuf_tail -= PACKET_OFFSET_SZ; pbuf_tail -= PACKET_OFFSET_SZ;
pfirstframe->buf_addr += PACKET_OFFSET_SZ; pfirstframe->buf_addr += PACKET_OFFSET_SZ;
@ -673,33 +616,28 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm
/* 3 4. write xmit buffer to USB FIFO */ /* 3 4. write xmit buffer to USB FIFO */
ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe); ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe);
rtw_write_port(padapter, ff_hwaddr, pbuf_tail, (u8*)pxmitbuf); rtw_write_port(adapt, ff_hwaddr, pbuf_tail, (u8 *)pxmitbuf);
/* 3 5. update statisitc */ /* 3 5. update statisitc */
pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE); pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE);
pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ); pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ);
rtw_count_tx_stats(adapt, pfirstframe, pbuf_tail);
rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail);
rtw_free_xmitframe(pxmitpriv, pfirstframe); rtw_free_xmitframe(pxmitpriv, pfirstframe);
return true; return true;
} }
static s32 xmitframe_direct(struct adapter *padapter, struct xmit_frame *pxmitframe) static s32 xmitframe_direct(struct adapter *adapt, struct xmit_frame *pxmitframe)
{ {
s32 res = _SUCCESS; s32 res = _SUCCESS;
res = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); res = rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe);
if (res == _SUCCESS) { if (res == _SUCCESS)
rtw_dump_xframe(padapter, pxmitframe); rtw_dump_xframe(adapt, pxmitframe);
} else
else{
DBG_88E("==> %s xmitframe_coalsece failed\n", __func__); DBG_88E("==> %s xmitframe_coalsece failed\n", __func__);
}
return res; return res;
} }
@ -708,22 +646,19 @@ static s32 xmitframe_direct(struct adapter *padapter, struct xmit_frame *pxmitfr
* true dump packet directly * true dump packet directly
* false enqueue packet * false enqueue packet
*/ */
static s32 pre_xmitframe(struct adapter *padapter, struct xmit_frame *pxmitframe) static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe)
{ {
unsigned long irqL; unsigned long irql;
s32 res; s32 res;
struct xmit_buf *pxmitbuf = NULL; struct xmit_buf *pxmitbuf = NULL;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib; struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapt->mlmepriv;
_enter_critical_bh(&pxmitpriv->lock, &irqL); _enter_critical_bh(&pxmitpriv->lock, &irql);
if (rtw_txframes_sta_ac_pending(padapter, pattrib) > 0) if (rtw_txframes_sta_ac_pending(adapt, pattrib) > 0)
{
goto enqueue; goto enqueue;
}
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true)
goto enqueue; goto enqueue;
@ -732,13 +667,13 @@ static s32 pre_xmitframe(struct adapter *padapter, struct xmit_frame *pxmitframe
if (pxmitbuf == NULL) if (pxmitbuf == NULL)
goto enqueue; goto enqueue;
_exit_critical_bh(&pxmitpriv->lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irql);
pxmitframe->pxmitbuf = pxmitbuf; pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->buf_addr = pxmitbuf->pbuf; pxmitframe->buf_addr = pxmitbuf->pbuf;
pxmitbuf->priv_data = pxmitframe; pxmitbuf->priv_data = pxmitframe;
if (xmitframe_direct(padapter, pxmitframe) != _SUCCESS) { if (xmitframe_direct(adapt, pxmitframe) != _SUCCESS) {
rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
} }
@ -746,8 +681,8 @@ static s32 pre_xmitframe(struct adapter *padapter, struct xmit_frame *pxmitframe
return true; return true;
enqueue: enqueue:
res = rtw_xmitframe_enqueue(padapter, pxmitframe); res = rtw_xmitframe_enqueue(adapt, pxmitframe);
_exit_critical_bh(&pxmitpriv->lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irql);
if (res != _SUCCESS) { if (res != _SUCCESS) {
RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("pre_xmitframe: enqueue xmitframe fail\n")); RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("pre_xmitframe: enqueue xmitframe fail\n"));
@ -762,9 +697,9 @@ enqueue:
return false; return false;
} }
s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) s32 rtl8188eu_mgnt_xmit(struct adapter *adapt, struct xmit_frame *pmgntframe)
{ {
return rtw_dump_xframe(padapter, pmgntframe); return rtw_dump_xframe(adapt, pmgntframe);
} }
/* /*
@ -772,7 +707,7 @@ s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe)
* true dump packet directly ok * true dump packet directly ok
* false temporary can't transmit packets to hardware * false temporary can't transmit packets to hardware
*/ */
s32 rtl8188eu_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) s32 rtl8188eu_hal_xmit(struct adapter *adapt, struct xmit_frame *pxmitframe)
{ {
return pre_xmitframe(padapter, pxmitframe); return pre_xmitframe(adapt, pxmitframe);
} }

File diff suppressed because it is too large Load diff

View file

@ -29,9 +29,9 @@
static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype) static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
{ {
struct adapter *padapter = pintfhdl->padapter; struct adapter *adapt = pintfhdl->padapter;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); struct dvobj_priv *dvobjpriv = adapter_to_dvobj(adapt);
struct usb_device *udev = pdvobjpriv->pusbdev; struct usb_device *udev = dvobjpriv->pusbdev;
unsigned int pipe; unsigned int pipe;
int status = 0; int status = 0;
@ -41,8 +41,8 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
int vendorreq_times = 0; int vendorreq_times = 0;
u8 tmp_buf[MAX_USB_IO_CTL_SIZE]; u8 tmp_buf[MAX_USB_IO_CTL_SIZE];
if ((padapter->bSurpriseRemoved) ||(padapter->pwrctrlpriv.pnp_bstop_trx)){ if ((adapt->bSurpriseRemoved) || (adapt->pwrctrlpriv.pnp_bstop_trx)) {
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usbctrl_vendorreq:(padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usbctrl_vendorreq:(adapt->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n"));
status = -EPERM; status = -EPERM;
goto exit; goto exit;
} }
@ -53,10 +53,10 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
goto exit; goto exit;
} }
_enter_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL); _enter_critical_mutex(&dvobjpriv->usb_vendor_req_mutex, NULL);
/* Acquire IO memory for vendorreq */ /* Acquire IO memory for vendorreq */
pIo_buf = pdvobjpriv->usb_vendor_req_buf; pIo_buf = dvobjpriv->usb_vendor_req_buf;
if (pIo_buf == NULL) { if (pIo_buf == NULL) {
DBG_88E("[%s] pIo_buf == NULL\n", __func__); DBG_88E("[%s] pIo_buf == NULL\n", __func__);
@ -64,17 +64,13 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
goto release_mutex; goto release_mutex;
} }
while (++vendorreq_times<= MAX_USBCTRL_VENDORREQ_TIMES) while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
{
_rtw_memset(pIo_buf, 0, len); _rtw_memset(pIo_buf, 0, len);
if (requesttype == 0x01) if (requesttype == 0x01) {
{
pipe = usb_rcvctrlpipe(udev, 0);/* read_in */ pipe = usb_rcvctrlpipe(udev, 0);/* read_in */
reqtype = REALTEK_USB_VENQT_READ; reqtype = REALTEK_USB_VENQT_READ;
} } else {
else
{
pipe = usb_sndctrlpipe(udev, 0);/* write_out */ pipe = usb_sndctrlpipe(udev, 0);/* write_out */
reqtype = REALTEK_USB_VENQT_WRITE; reqtype = REALTEK_USB_VENQT_WRITE;
_rtw_memcpy(pIo_buf, pdata, len); _rtw_memcpy(pIo_buf, pdata, len);
@ -82,41 +78,33 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT); status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
if ( status == len) /* Success this control transfer. */ if (status == len) { /* Success this control transfer. */
{ rtw_reset_continual_urb_error(dvobjpriv);
rtw_reset_continual_urb_error(pdvobjpriv);
if (requesttype == 0x01) if (requesttype == 0x01)
{ /* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */
_rtw_memcpy(pdata, pIo_buf, len); _rtw_memcpy(pdata, pIo_buf, len);
} } else { /* error cases */
} DBG_88E("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n",
else { /* error cases */ value, (requesttype == 0x01) ? "read" : "write",
DBG_88E("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n" len, status, *(u32 *)pdata, vendorreq_times);
, value,(requesttype == 0x01)?"read":"write" , len, status, *(u32*)pdata, vendorreq_times);
if (status < 0) { if (status < 0) {
if (status == (-ESHUTDOWN) || status == -ENODEV ) if (status == (-ESHUTDOWN) || status == -ENODEV) {
{ adapt->bSurpriseRemoved = true;
padapter->bSurpriseRemoved = true;
} else { } else {
{ struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); haldata->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
pHalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
} }
} } else { /* status != len && status >= 0 */
}
else /* status != len && status >= 0 */
{
if (status > 0) { if (status > 0) {
if ( requesttype == 0x01 ) if (requesttype == 0x01) {
{ /* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */ /* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */
_rtw_memcpy(pdata, pIo_buf, len); _rtw_memcpy(pdata, pIo_buf, len);
} }
} }
} }
if (rtw_inc_and_chk_continual_urb_error(pdvobjpriv) == true ){ if (rtw_inc_and_chk_continual_urb_error(dvobjpriv)) {
padapter->bSurpriseRemoved = true; adapt->bSurpriseRemoved = true;
break; break;
} }
@ -125,10 +113,9 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
/* firmware download is checksumed, don't retry */ /* firmware download is checksumed, don't retry */
if ((value >= FW_8188E_START_ADDRESS && value <= FW_8188E_END_ADDRESS) || status == len) if ((value >= FW_8188E_START_ADDRESS && value <= FW_8188E_END_ADDRESS) || status == len)
break; break;
} }
release_mutex: release_mutex:
_exit_critical_mutex(&pdvobjpriv->usb_vendor_req_mutex, NULL); _exit_critical_mutex(&dvobjpriv->usb_vendor_req_mutex, NULL);
exit: exit:
return status; return status;
} }
@ -216,22 +203,15 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
int ret; int ret;
_func_enter_; _func_enter_;
request = 0x05; request = 0x05;
requesttype = 0x00;/* write_out */ requesttype = 0x00;/* write_out */
index = 0;/* n/a */ index = 0;/* n/a */
wvalue = (u16)(addr&0x0000ffff); wvalue = (u16)(addr&0x0000ffff);
len = 1; len = 1;
data = val; data = val;
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
_func_exit_; _func_exit_;
return ret; return ret;
} }
static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
@ -314,27 +294,25 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
_func_exit_; _func_exit_;
return ret; return ret;
} }
static void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf) static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
{ {
struct hal_data_8188e *pHalData=GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
struct reportpwrstate_parm pwr_rpt; struct reportpwrstate_parm pwr_rpt;
if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN ) if (pkt_len != INTERRUPT_MSG_FORMAT_LEN) {
{
DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len); DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len);
return; return;
} }
/* HISR */ /* HISR */
_rtw_memcpy(&(pHalData->IntArray[0]), &(pbuf[USB_INTR_CONTENT_HISR_OFFSET]), 4); _rtw_memcpy(&(haldata->IntArray[0]), &(pbuf[USB_INTR_CONTENT_HISR_OFFSET]), 4);
_rtw_memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4); _rtw_memcpy(&(haldata->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4);
/* C2H Event */ /* C2H Event */
if (pbuf[0] != 0) if (pbuf[0] != 0)
_rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16); _rtw_memcpy(&(haldata->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16);
} }
static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxstat, struct phy_stat *pphy_status) static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxstat, struct phy_stat *pphy_status)
@ -342,7 +320,7 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta
return _SUCCESS; return _SUCCESS;
} }
static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb) static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb)
{ {
u8 *pbuf; u8 *pbuf;
u8 shift_sz = 0; u8 shift_sz = 0;
@ -354,8 +332,8 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
struct sk_buff *pkt_copy = NULL; struct sk_buff *pkt_copy = NULL;
union recv_frame *precvframe = NULL; union recv_frame *precvframe = NULL;
struct rx_pkt_attrib *pattrib = NULL; struct rx_pkt_attrib *pattrib = NULL;
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &adapt->recvpriv;
struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue; struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
transfer_len = (s32)pskb->len; transfer_len = (s32)pskb->len;
@ -372,8 +350,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
prxstat = (struct recv_stat *)pbuf; prxstat = (struct recv_stat *)pbuf;
precvframe = rtw_alloc_recvframe(pfree_recv_queue); precvframe = rtw_alloc_recvframe(pfree_recv_queue);
if (precvframe==NULL) if (precvframe == NULL) {
{
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvbuf2recvframe: precvframe==NULL\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvbuf2recvframe: precvframe==NULL\n"));
DBG_88E("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __func__, __LINE__); DBG_88E("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __func__, __LINE__);
goto _exit_recvbuf2recvframe; goto _exit_recvbuf2recvframe;
@ -387,8 +364,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
pattrib = &precvframe->u.hdr.attrib; pattrib = &precvframe->u.hdr.attrib;
if ((pattrib->crc_err) || (pattrib->icv_err)) if ((pattrib->crc_err) || (pattrib->icv_err)) {
{
DBG_88E("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __func__, pattrib->crc_err, pattrib->icv_err); DBG_88E("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __func__, pattrib->crc_err, pattrib->icv_err);
rtw_free_recvframe(precvframe, pfree_recv_queue); rtw_free_recvframe(precvframe, pfree_recv_queue);
@ -396,14 +372,11 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
} }
if ((pattrib->physt) && (pattrib->pkt_rpt_type == NORMAL_RX)) if ((pattrib->physt) && (pattrib->pkt_rpt_type == NORMAL_RX))
{
pphy_status = (struct phy_stat *)(pbuf + RXDESC_OFFSET); pphy_status = (struct phy_stat *)(pbuf + RXDESC_OFFSET);
}
pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len; pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len;
if ((pattrib->pkt_len<=0) || (pkt_offset>transfer_len)) if ((pattrib->pkt_len <= 0) || (pkt_offset > transfer_len)) {
{
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recvbuf2recvframe: pkt_len<=0\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recvbuf2recvframe: pkt_len<=0\n"));
DBG_88E("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len\n", __func__, __LINE__); DBG_88E("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len\n", __func__, __LINE__);
rtw_free_recvframe(precvframe, pfree_recv_queue); rtw_free_recvframe(precvframe, pfree_recv_queue);
@ -413,13 +386,9 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
/* Modified by Albert 20101213 */ /* Modified by Albert 20101213 */
/* For 8 bytes IP header alignment. */ /* For 8 bytes IP header alignment. */
if (pattrib->qos) /* Qos data, wireless lan header length is 26 */ if (pattrib->qos) /* Qos data, wireless lan header length is 26 */
{
shift_sz = 6; shift_sz = 6;
}
else else
{
shift_sz = 0; shift_sz = 0;
}
skb_len = pattrib->pkt_len; skb_len = pattrib->pkt_len;
@ -430,58 +399,50 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
alloc_sz = 1664; alloc_sz = 1664;
else else
alloc_sz = skb_len + 14; alloc_sz = skb_len + 14;
} } else {
else {
alloc_sz = skb_len; alloc_sz = skb_len;
/* 6 is for IP header 8 bytes alignment in QoS packet case. */ /* 6 is for IP header 8 bytes alignment in QoS packet case. */
/* 8 is for skb->data 4 bytes alignment. */ /* 8 is for skb->data 4 bytes alignment. */
alloc_sz += 14; alloc_sz += 14;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) /* www.mail-archive.com/netdev@vger.kernel.org/msg17214.html */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
pkt_copy = dev_alloc_skb(alloc_sz); pkt_copy = dev_alloc_skb(alloc_sz);
#else #else
pkt_copy = netdev_alloc_skb(padapter->pnetdev, alloc_sz); pkt_copy = netdev_alloc_skb(adapt->pnetdev, alloc_sz);
#endif #endif
if (pkt_copy) if (pkt_copy) {
{ pkt_copy->dev = adapt->pnetdev;
pkt_copy->dev = padapter->pnetdev;
precvframe->u.hdr.pkt = pkt_copy; precvframe->u.hdr.pkt = pkt_copy;
precvframe->u.hdr.rx_head = pkt_copy->data; precvframe->u.hdr.rx_head = pkt_copy->data;
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz; precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
skb_reserve(pkt_copy, 8 - ((size_t)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte alignment address */ skb_reserve(pkt_copy, 8 - ((size_t)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte alignment address */
skb_reserve(pkt_copy, shift_sz);/* force ip_hdr at 8-byte alignment address according to shift_sz. */ skb_reserve(pkt_copy, shift_sz);/* force ip_hdr at 8-byte alignment address according to shift_sz. */
_rtw_memcpy(pkt_copy->data, (pbuf + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len); _rtw_memcpy(pkt_copy->data, (pbuf + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data; precvframe->u.hdr.rx_tail = pkt_copy->data;
} precvframe->u.hdr.rx_data = pkt_copy->data;
else } else {
{ if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) {
if ((pattrib->mfrag == 1)&&(pattrib->frag_num == 0))
{
DBG_88E("recvbuf2recvframe: alloc_skb fail , drop frag frame\n"); DBG_88E("recvbuf2recvframe: alloc_skb fail , drop frag frame\n");
rtw_free_recvframe(precvframe, pfree_recv_queue); rtw_free_recvframe(precvframe, pfree_recv_queue);
goto _exit_recvbuf2recvframe; goto _exit_recvbuf2recvframe;
} }
precvframe->u.hdr.pkt = skb_clone(pskb, GFP_ATOMIC); precvframe->u.hdr.pkt = skb_clone(pskb, GFP_ATOMIC);
if (precvframe->u.hdr.pkt) if (precvframe->u.hdr.pkt) {
{ precvframe->u.hdr.rx_tail = pbuf + pattrib->drvinfo_sz + RXDESC_SIZE;
precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_tail;
= pbuf+ pattrib->drvinfo_sz + RXDESC_SIZE; precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail;
precvframe->u.hdr.rx_end = pbuf + pattrib->drvinfo_sz + RXDESC_SIZE + alloc_sz; precvframe->u.hdr.rx_end = pbuf + pattrib->drvinfo_sz + RXDESC_SIZE + alloc_sz;
} } else {
else
{
DBG_88E("recvbuf2recvframe: skb_clone fail\n"); DBG_88E("recvbuf2recvframe: skb_clone fail\n");
rtw_free_recvframe(precvframe, pfree_recv_queue); rtw_free_recvframe(precvframe, pfree_recv_queue);
goto _exit_recvbuf2recvframe; goto _exit_recvbuf2recvframe;
} }
} }
recvframe_put(precvframe, skb_len); recvframe_put(precvframe, skb_len);
switch (pHalData->UsbRxAggMode) { switch (haldata->UsbRxAggMode) {
case USB_RX_AGG_DMA: case USB_RX_AGG_DMA:
case USB_RX_AGG_MIX: case USB_RX_AGG_MIX:
pkt_offset = (u16)_RND128(pkt_offset); pkt_offset = (u16)_RND128(pkt_offset);
@ -504,17 +465,17 @@ static int recvbuf2recvframe(struct adapter *padapter, struct sk_buff *pskb)
/* enqueue recvframe to txrtp queue */ /* enqueue recvframe to txrtp queue */
if (pattrib->pkt_rpt_type == TX_REPORT1) { if (pattrib->pkt_rpt_type == TX_REPORT1) {
/* CCX-TXRPT ack for xmit mgmt frames. */ /* CCX-TXRPT ack for xmit mgmt frames. */
handle_txrpt_ccx_88e(padapter, precvframe->u.hdr.rx_data); handle_txrpt_ccx_88e(adapt, precvframe->u.hdr.rx_data);
} else if (pattrib->pkt_rpt_type == TX_REPORT2) { } else if (pattrib->pkt_rpt_type == TX_REPORT2) {
ODM_RA_TxRPT2Handle_8188E( ODM_RA_TxRPT2Handle_8188E(
&pHalData->odmpriv, &haldata->odmpriv,
precvframe->u.hdr.rx_data, precvframe->u.hdr.rx_data,
pattrib->pkt_len, pattrib->pkt_len,
pattrib->MacIDValidEntry[0], pattrib->MacIDValidEntry[0],
pattrib->MacIDValidEntry[1] pattrib->MacIDValidEntry[1]
); );
} else if (pattrib->pkt_rpt_type == HIS_REPORT) { } else if (pattrib->pkt_rpt_type == HIS_REPORT) {
interrupt_handler_8188eu(padapter,pattrib->pkt_len,precvframe->u.hdr.rx_data); interrupt_handler_8188eu(adapt, pattrib->pkt_len, precvframe->u.hdr.rx_data);
} }
rtw_free_recvframe(precvframe, pfree_recv_queue); rtw_free_recvframe(precvframe, pfree_recv_queue);
} }
@ -537,16 +498,16 @@ _exit_recvbuf2recvframe:
void rtl8188eu_recv_tasklet(void *priv) void rtl8188eu_recv_tasklet(void *priv)
{ {
struct sk_buff *pskb; struct sk_buff *pskb;
struct adapter *padapter = (struct adapter*)priv; struct adapter *adapt = (struct adapter *)priv;
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &adapt->recvpriv;
while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) { while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
if ((padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true)) { if ((adapt->bDriverStopped) || (adapt->bSurpriseRemoved)) {
DBG_88E("recv_tasklet => bDriverStopped or bSurpriseRemoved\n"); DBG_88E("recv_tasklet => bDriverStopped or bSurpriseRemoved\n");
dev_kfree_skb_any(pskb); dev_kfree_skb_any(pskb);
break; break;
} }
recvbuf2recvframe(padapter, pskb); recvbuf2recvframe(adapt, pskb);
skb_reset_tail_pointer(pskb); skb_reset_tail_pointer(pskb);
pskb->len = 0; pskb->len = 0;
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
@ -555,25 +516,25 @@ void rtl8188eu_recv_tasklet(void *priv)
static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
{ {
unsigned long irqL; unsigned long irql;
uint isevt, *pbuf; uint isevt, *pbuf;
struct recv_buf *precvbuf = (struct recv_buf *)purb->context; struct recv_buf *precvbuf = (struct recv_buf *)purb->context;
struct adapter *padapter =(struct adapter *)precvbuf->adapter; struct adapter *adapt = (struct adapter *)precvbuf->adapter;
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &adapt->recvpriv;
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete!!!\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete!!!\n"));
precvpriv->rx_pending_cnt--; precvpriv->rx_pending_cnt--;
if (padapter->bSurpriseRemoved || padapter->bDriverStopped || padapter->bReadPortCancel) { if (adapt->bSurpriseRemoved || adapt->bDriverStopped || adapt->bReadPortCancel) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", ("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n",
padapter->bDriverStopped, padapter->bSurpriseRemoved)); adapt->bDriverStopped, adapt->bSurpriseRemoved));
precvbuf->reuse = true; precvbuf->reuse = true;
DBG_88E("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", DBG_88E("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n",
__func__, padapter->bDriverStopped, __func__, adapt->bDriverStopped,
padapter->bSurpriseRemoved, padapter->bReadPortCancel); adapt->bSurpriseRemoved, adapt->bReadPortCancel);
goto exit; goto exit;
} }
@ -582,10 +543,10 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n")); ("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
precvbuf->reuse = true; precvbuf->reuse = true;
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); rtw_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__); DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__);
} else { } else {
rtw_reset_continual_urb_error(adapter_to_dvobj(padapter)); rtw_reset_continual_urb_error(adapter_to_dvobj(adapt));
precvbuf->transfer_len = purb->actual_length; precvbuf->transfer_len = purb->actual_length;
skb_put(precvbuf->pskb, purb->actual_length); skb_put(precvbuf->pskb, purb->actual_length);
@ -596,15 +557,15 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
precvbuf->pskb = NULL; precvbuf->pskb = NULL;
precvbuf->reuse = false; precvbuf->reuse = false;
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); rtw_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
} }
} else { } else {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete : purb->status(%d) != 0\n", purb->status)); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete : purb->status(%d) != 0\n", purb->status));
DBG_88E("###=> usb_read_port_complete => urb status(%d)\n", purb->status); DBG_88E("###=> usb_read_port_complete => urb status(%d)\n", purb->status);
if (rtw_inc_and_chk_continual_urb_error(adapter_to_dvobj(padapter)) == true ) if (rtw_inc_and_chk_continual_urb_error(adapter_to_dvobj(adapt)))
padapter->bSurpriseRemoved = true; adapt->bSurpriseRemoved = true;
switch (purb->status) { switch (purb->status) {
case -EINVAL: case -EINVAL:
@ -613,17 +574,17 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
case -ESHUTDOWN: case -ESHUTDOWN:
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete:bSurpriseRemoved=true\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete:bSurpriseRemoved=true\n"));
case -ENOENT: case -ENOENT:
padapter->bDriverStopped=true; adapt->bDriverStopped = true;
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete:bDriverStopped=true\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_read_port_complete:bDriverStopped=true\n"));
break; break;
case -EPROTO: case -EPROTO:
case -EOVERFLOW: case -EOVERFLOW:
{ {
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct hal_data_8188e *haldata = GET_HAL_DATA(adapt);
pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; haldata->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL;
} }
precvbuf->reuse = true; precvbuf->reuse = true;
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); rtw_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
break; break;
case -EINPROGRESS: case -EINPROGRESS:
DBG_88E("ERROR: URB IS IN PROGRESS!/n"); DBG_88E("ERROR: URB IS IN PROGRESS!/n");
@ -639,7 +600,7 @@ _func_exit_;
static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
{ {
unsigned long irqL; unsigned long irql;
int err; int err;
unsigned int pipe; unsigned int pipe;
size_t tmpaddr = 0; size_t tmpaddr = 0;
@ -657,12 +618,13 @@ _func_enter_;
if (adapter->bDriverStopped || adapter->bSurpriseRemoved || if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
adapter->pwrctrlpriv.pnp_bstop_trx) { adapter->pwrctrlpriv.pnp_bstop_trx) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_read_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n")); ("usb_read_port:(adapt->bDriverStopped ||adapt->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n"));
return _FAIL; return _FAIL;
} }
if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) { if ((!precvbuf->reuse) || (precvbuf->pskb == NULL)) {
if (NULL != (precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue))) precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
if (NULL != precvbuf->pskb)
precvbuf->reuse = true; precvbuf->reuse = true;
} }
@ -670,8 +632,8 @@ _func_enter_;
rtl8188eu_init_recvbuf(adapter, precvbuf); rtl8188eu_init_recvbuf(adapter, precvbuf);
/* re-assign for linux based on skb */ /* re-assign for linux based on skb */
if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) { if ((!precvbuf->reuse) || (precvbuf->pskb == NULL)) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) /* www.mail-archive.com/netdev@vger.kernel.org/msg17214.html */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
precvbuf->pskb = dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); precvbuf->pskb = dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
#else #else
precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
@ -736,23 +698,23 @@ _func_exit_;
void rtl8188eu_xmit_tasklet(void *priv) void rtl8188eu_xmit_tasklet(void *priv)
{ {
int ret = false; int ret = false;
struct adapter *padapter = (struct adapter*)priv; struct adapter *adapt = (struct adapter *)priv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY) == true) if (check_fwstate(&adapt->mlmepriv, _FW_UNDER_SURVEY))
return; return;
while (1) { while (1) {
if ((padapter->bDriverStopped == true)|| if ((adapt->bDriverStopped) ||
(padapter->bSurpriseRemoved== true) || (adapt->bSurpriseRemoved) ||
(padapter->bWritePortCancel == true)) { (adapt->bWritePortCancel)) {
DBG_88E("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n"); DBG_88E("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n");
break; break;
} }
ret = rtl8188eu_xmitframe_complete(padapter, pxmitpriv, NULL); ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv, NULL);
if (ret==false) if (!ret)
break; break;
} }
} }
@ -777,9 +739,9 @@ void rtl8188eu_set_intf_ops(struct _io_ops *pops)
_func_exit_; _func_exit_;
} }
void rtl8188eu_set_hw_type(struct adapter *padapter) void rtl8188eu_set_hw_type(struct adapter *adapt)
{ {
padapter->chip_type = RTL8188E; adapt->chip_type = RTL8188E;
padapter->HardwareType = HARDWARE_TYPE_RTL8188EU; adapt->HardwareType = HARDWARE_TYPE_RTL8188EU;
DBG_88E("CHIP TYPE: RTL8188E\n"); DBG_88E("CHIP TYPE: RTL8188E\n");
} }

View file

@ -496,5 +496,7 @@ void rtl8188e_stop_thread(struct adapter *padapter);
void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len); void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len);
s32 rtl8188e_iol_efuse_patch(struct adapter * padapter); s32 rtl8188e_iol_efuse_patch(struct adapter * padapter);
void rtw_cancel_all_timer(struct adapter *padapter);
void _ps_open_RF(struct adapter *adapt);
#endif //__RTL8188E_HAL_H__ #endif //__RTL8188E_HAL_H__