Skip to content

Commit

Permalink
[BNX2]: Use constants for stats ticks.
Browse files Browse the repository at this point in the history
Change all stats related magic numbers to constants.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Chan authored and David S. Miller committed Jul 18, 2007
1 parent c2d3db8 commit 7ea6920
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4123,7 +4123,7 @@ bnx2_init_chip(struct bnx2 *bp)
if (CHIP_NUM(bp) == CHIP_NUM_5708)
REG_WR(bp, BNX2_HC_STATS_TICKS, 0);
else
REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00);
REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks);
REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */

if (CHIP_ID(bp) == CHIP_ID_5706_A1)
Expand Down Expand Up @@ -5798,8 +5798,9 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC)
bp->stats_ticks = USEC_PER_SEC;
}
if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00;
bp->stats_ticks &= 0xffff00;
if (bp->stats_ticks > BNX2_HC_STATS_TICKS_HC_STAT_TICKS)
bp->stats_ticks = BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS;

if (netif_running(bp->dev)) {
bnx2_netif_stop(bp);
Expand Down Expand Up @@ -6696,7 +6697,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->rx_ticks_int = 18;
bp->rx_ticks = 18;

bp->stats_ticks = 1000000 & 0xffff00;
bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS;

bp->timer_interval = HZ;
bp->current_interval = HZ;
Expand Down

0 comments on commit 7ea6920

Please sign in to comment.