Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224355
b: refs/heads/master
c: 1a51502
h: refs/heads/master
i:
  224353: b42d989
  224351: 2d7464d
v: v3
  • Loading branch information
Eric Dumazet authored and Jeff Kirsher committed Nov 17, 2010
1 parent 03c1b2d commit 0fa2298
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 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: 9d1e5e40d6cac4bf7008e04c202d71918455ca11
refs/heads/master: 1a51502bddca7ac1e921d918b741ffd2bec149ed
19 changes: 11 additions & 8 deletions trunk/drivers/net/fec_mpc52xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,9 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)
{
struct net_device *dev = dev_id;
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
unsigned long flags;

spin_lock(&priv->lock);
spin_lock_irqsave(&priv->lock, flags);
while (bcom_buffer_done(priv->tx_dmatsk)) {
struct sk_buff *skb;
struct bcom_fec_bd *bd;
Expand All @@ -378,7 +379,7 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)

dev_kfree_skb_irq(skb);
}
spin_unlock(&priv->lock);
spin_unlock_irqrestore(&priv->lock, flags);

netif_wake_queue(dev);

Expand All @@ -394,8 +395,9 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
struct bcom_fec_bd *bd;
u32 status, physaddr;
int length;
unsigned long flags;

spin_lock(&priv->lock);
spin_lock_irqsave(&priv->lock, flags);

while (bcom_buffer_done(priv->rx_dmatsk)) {

Expand Down Expand Up @@ -427,7 +429,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)

/* Process the received skb - Drop the spin lock while
* calling into the network stack */
spin_unlock(&priv->lock);
spin_unlock_irqrestore(&priv->lock, flags);

dma_unmap_single(dev->dev.parent, physaddr, rskb->len,
DMA_FROM_DEVICE);
Expand All @@ -436,10 +438,10 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
rskb->protocol = eth_type_trans(rskb, dev);
netif_rx(rskb);

spin_lock(&priv->lock);
spin_lock_irqsave(&priv->lock, flags);
}

spin_unlock(&priv->lock);
spin_unlock_irqrestore(&priv->lock, flags);

return IRQ_HANDLED;
}
Expand All @@ -450,6 +452,7 @@ static irqreturn_t mpc52xx_fec_interrupt(int irq, void *dev_id)
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
struct mpc52xx_fec __iomem *fec = priv->fec;
u32 ievent;
unsigned long flags;

ievent = in_be32(&fec->ievent);

Expand All @@ -467,9 +470,9 @@ static irqreturn_t mpc52xx_fec_interrupt(int irq, void *dev_id)
if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");

spin_lock(&priv->lock);
spin_lock_irqsave(&priv->lock, flags);
mpc52xx_fec_reset(dev);
spin_unlock(&priv->lock);
spin_unlock_irqrestore(&priv->lock, flags);

return IRQ_HANDLED;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/ixgbe/ixgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ struct ixgbe_ring {

unsigned int size; /* length in bytes */
dma_addr_t dma; /* phys. address of descriptor ring */
struct rcu_head rcu;
} ____cacheline_internodealigned_in_smp;

enum ixgbe_ring_f_enum {
Expand Down
34 changes: 24 additions & 10 deletions trunk/drivers/net/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4751,6 +4751,11 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
return err;
}

static void ring_free_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct ixgbe_ring, rcu));
}

/**
* ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings
* @adapter: board private structure to clear interrupt scheme on
Expand All @@ -4767,7 +4772,12 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
adapter->tx_ring[i] = NULL;
}
for (i = 0; i < adapter->num_rx_queues; i++) {
kfree(adapter->rx_ring[i]);
struct ixgbe_ring *ring = adapter->rx_ring[i];

/* ixgbe_get_stats64() might access this ring, we must wait
* a grace period before freeing it.
*/
call_rcu(&ring->rcu, ring_free_rcu);
adapter->rx_ring[i] = NULL;
}

Expand Down Expand Up @@ -6563,20 +6573,23 @@ static struct rtnl_link_stats64 *ixgbe_get_stats64(struct net_device *netdev,

/* accurate rx/tx bytes/packets stats */
dev_txq_stats_fold(netdev, stats);
rcu_read_lock();
for (i = 0; i < adapter->num_rx_queues; i++) {
struct ixgbe_ring *ring = adapter->rx_ring[i];
struct ixgbe_ring *ring = ACCESS_ONCE(adapter->rx_ring[i]);
u64 bytes, packets;
unsigned int start;

do {
start = u64_stats_fetch_begin_bh(&ring->syncp);
packets = ring->stats.packets;
bytes = ring->stats.bytes;
} while (u64_stats_fetch_retry_bh(&ring->syncp, start));
stats->rx_packets += packets;
stats->rx_bytes += bytes;
if (ring) {
do {
start = u64_stats_fetch_begin_bh(&ring->syncp);
packets = ring->stats.packets;
bytes = ring->stats.bytes;
} while (u64_stats_fetch_retry_bh(&ring->syncp, start));
stats->rx_packets += packets;
stats->rx_bytes += bytes;
}
}

rcu_read_unlock();
/* following stats updated by ixgbe_watchdog_task() */
stats->multicast = netdev->stats.multicast;
stats->rx_errors = netdev->stats.rx_errors;
Expand Down Expand Up @@ -7282,6 +7295,7 @@ static void __exit ixgbe_exit_module(void)
dca_unregister_notify(&dca_notifier);
#endif
pci_unregister_driver(&ixgbe_driver);
rcu_barrier(); /* Wait for completion of call_rcu()'s */
}

#ifdef CONFIG_IXGBE_DCA
Expand Down

0 comments on commit 0fa2298

Please sign in to comment.