From: Matej Dujava <mdujava@kocurkovo.cz>
To: Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Stefano Brivio <sbrivio@redhat.com>,
Briana Oursler <briana.oursler@gmail.com>,
"Frank A. Cancio Bello" <frank@generalsoftwareinc.com>,
Matej Dujava <mdujava@kocurkovo.cz>
Subject: [PATCH 2/5] staging: vt6655: do calculation of uAckTime first
Date: Sun, 3 May 2020 15:29:09 +0200 [thread overview]
Message-ID: <1588512552-12297-3-git-send-email-mdujava@kocurkovo.cz> (raw)
In-Reply-To: <1588512552-12297-1-git-send-email-mdujava@kocurkovo.cz>
This patch is extracting calculation of uAckTime in one place, at the
start of case body.
Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
---
drivers/staging/vt6655/rxtx.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 28f0cda36dec..01ceace253a4 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -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;
--
2.26.2
next prev parent reply other threads:[~2020-05-03 13:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 13:29 [PATCH 0/5] Cleaning s_uGetDataDuration function Matej Dujava
2020-05-03 13:29 ` [PATCH 1/5] staging: vt6655: merge two switch cases in s_uGetDataDuration Matej Dujava
2020-05-03 13:29 ` Matej Dujava [this message]
2020-05-03 13:29 ` [PATCH 3/5] staging: vt6655: remove else after return and invert condition Matej Dujava
2020-05-03 13:29 ` [PATCH 4/5] staging: vt6655: return at the ond of case body Matej Dujava
2020-05-03 13:29 ` [PATCH 5/5] staging: vt6655: extract index manupulation out of function call Matej Dujava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1588512552-12297-3-git-send-email-mdujava@kocurkovo.cz \
--to=mdujava@kocurkovo.cz \
--cc=briana.oursler@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=frank@generalsoftwareinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®