Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215127
b: refs/heads/master
c: 7b738b5
h: refs/heads/master
i:
  215125: a111994
  215123: 829f673
  215119: f7a6df5
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 9, 2010
1 parent 765610d commit 397a71a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2259dca36a2f0226596ea37132a46338fcff6722
refs/heads/master: 7b738b55b2ec0e95a5030037c45b3c312e385789
10 changes: 6 additions & 4 deletions trunk/drivers/net/sundance.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ struct netdev_private {
struct timer_list timer; /* Media monitoring timer. */
/* Frequently used values: keep some adjacent for cache effect. */
spinlock_t lock;
spinlock_t rx_lock; /* Group with Tx control cache line. */
int msg_enable;
int chip_id;
unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */
Expand All @@ -390,6 +389,7 @@ struct netdev_private {
unsigned char phys[MII_CNT]; /* MII device addresses, only first one used. */
struct pci_dev *pci_dev;
void __iomem *base;
spinlock_t statlock;
};

/* The station address location in the EEPROM. */
Expand Down Expand Up @@ -514,6 +514,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
np->chip_id = chip_idx;
np->msg_enable = (1 << debug) - 1;
spin_lock_init(&np->lock);
spin_lock_init(&np->statlock);
tasklet_init(&np->rx_tasklet, rx_poll, (unsigned long)dev);
tasklet_init(&np->tx_tasklet, tx_poll, (unsigned long)dev);

Expand Down Expand Up @@ -1486,10 +1487,9 @@ static struct net_device_stats *get_stats(struct net_device *dev)
struct netdev_private *np = netdev_priv(dev);
void __iomem *ioaddr = np->base;
int i;
unsigned long flags;

/* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are
non-critical. */
spin_lock_irqsave(&np->statlock, flags);
/* The chip only need report frame silently dropped. */
dev->stats.rx_missed_errors += ioread8(ioaddr + RxMissed);
dev->stats.tx_packets += ioread16(ioaddr + TxFramesOK);
Expand All @@ -1506,6 +1506,8 @@ static struct net_device_stats *get_stats(struct net_device *dev)
dev->stats.rx_bytes += ioread16(ioaddr + RxOctetsLow);
dev->stats.rx_bytes += ioread16(ioaddr + RxOctetsHigh) << 16;

spin_unlock_irqrestore(&np->statlock, flags);

return &dev->stats;
}

Expand Down

0 comments on commit 397a71a

Please sign in to comment.