Commit f1220c7d authored by Matthias Beyer's avatar Matthias Beyer Committed by Greg Kroah-Hartman

Staging: bcm: LeakyBucket.c: Replaced member accessing by variable

Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
Acked-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 792d9211
...@@ -20,6 +20,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter) ...@@ -20,6 +20,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
ULONG liCurrentTime; ULONG liCurrentTime;
INT i = 0; INT i = 0;
struct timeval tv; struct timeval tv;
struct bcm_packet_info *curr_pi;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=====>\n"); "=====>\n");
...@@ -31,23 +32,25 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter) ...@@ -31,23 +32,25 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
do_gettimeofday(&tv); do_gettimeofday(&tv);
for (i = 0; i < NO_OF_QUEUES; i++) { for (i = 0; i < NO_OF_QUEUES; i++) {
if (TRUE == Adapter->PackInfo[i].bValid && curr_pi = &Adapter->PackInfo[i];
(1 == Adapter->PackInfo[i].ucDirection)) {
if (TRUE == curr_pi->bValid &&
(1 == curr_pi->ucDirection)) {
liCurrentTime = ((tv.tv_sec- liCurrentTime = ((tv.tv_sec-
Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 + curr_pi->stLastUpdateTokenAt.tv_sec)*1000 +
(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/ (tv.tv_usec-curr_pi->stLastUpdateTokenAt.tv_usec)/
1000); 1000);
if (0 != liCurrentTime) { if (0 != liCurrentTime) {
Adapter->PackInfo[i].uiCurrentTokenCount += (ULONG) curr_pi->uiCurrentTokenCount += (ULONG)
((Adapter->PackInfo[i].uiMaxAllowedRate) * ((curr_pi->uiMaxAllowedRate) *
((ULONG)((liCurrentTime)))/1000); ((ULONG)((liCurrentTime)))/1000);
memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt, memcpy(&curr_pi->stLastUpdateTokenAt,
&tv, sizeof(struct timeval)); &tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = liCurrentTime; curr_pi->liLastUpdateTokenAt = liCurrentTime;
if (Adapter->PackInfo[i].uiCurrentTokenCount >= if (curr_pi->uiCurrentTokenCount >=
Adapter->PackInfo[i].uiMaxBucketSize) { curr_pi->uiMaxBucketSize) {
Adapter->PackInfo[i].uiCurrentTokenCount = curr_pi->uiCurrentTokenCount =
Adapter->PackInfo[i].uiMaxBucketSize; curr_pi->uiMaxBucketSize;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment