staging: vt6655: do calculation of uAckTime first

This patch is extracting calculation of uAckTime in one place, at the
start of case body.

Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
Link: https://lore.kernel.org/r/1588512552-12297-3-git-send-email-mdujava@kocurkovo.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Matej Dujava 2020-05-03 15:29:09 +02:00 committed by Greg Kroah-Hartman
parent e4a34ef772
commit 0ae73acc44
1 changed files with 15 additions and 18 deletions

View File

@ -255,9 +255,13 @@ s_uGetDataDuration(
switch (byDurType) {
case DATADUR_B: /* DATADUR_B */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopCCKBasicRate);
}
if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
return pDevice->uSIFS + uAckTime;
} else {
return 0;
@ -265,19 +269,18 @@ s_uGetDataDuration(
} else {/* First Frag or Mid Frag */
uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck);
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopCCKBasicRate);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
}
break;
case DATADUR_A: /* DATADUR_A */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopOFDMBasicRate);
}
if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
return pDevice->uSIFS + uAckTime;
} else {
return 0;
@ -286,20 +289,19 @@ s_uGetDataDuration(
uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len,
wRate, bNeedAck);
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopOFDMBasicRate);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
}
break;
case DATADUR_A_F0: /* DATADUR_A_F0 */
case DATADUR_A_F1: /* DATADUR_A_F1 */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopOFDMBasicRate);
}
if (((uMACfragNum == 1)) || bLastFrag) { /* Non Frag or Last Frag */
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
return pDevice->uSIFS + uAckTime;
} else {
return 0;
@ -322,11 +324,6 @@ s_uGetDataDuration(
bNeedAck);
}
if (bNeedAck) {
uAckTime = bb_get_frame_time(pDevice->byPreambleType,
byPktType, 14,
pDevice->byTopOFDMBasicRate);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
}
break;