Skip to content

Commit 222e4d0

Browse files
françois romieudavem330
authored andcommitted
pch_gbe: replace private tx ring lock with common netif_tx_lock
pch_gbe_tx_ring.tx_lock is only used in the hard_xmit handler and in the transmit completion reaper called from NAPI context. Compile-tested only. Potential victims Cced. Someone more knowledgeable may check if pch_gbe_tx_queue could have some use for a mmiowb. Signed-off-by: Francois Romieu <[email protected]> Cc: Darren Hart <[email protected]> Cc: Andy Cress <[email protected]> Cc: [email protected] Signed-off-by: David S. Miller <[email protected]>
1 parent badf3ad commit 222e4d0

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ struct pch_gbe_buffer {
481481

482482
/**
483483
* struct pch_gbe_tx_ring - tx ring information
484-
* @tx_lock: spinlock structs
485484
* @desc: pointer to the descriptor ring memory
486485
* @dma: physical address of the descriptor ring
487486
* @size: length of descriptor ring in bytes
@@ -491,7 +490,6 @@ struct pch_gbe_buffer {
491490
* @buffer_info: array of buffer information structs
492491
*/
493492
struct pch_gbe_tx_ring {
494-
spinlock_t tx_lock;
495493
struct pch_gbe_tx_desc *desc;
496494
dma_addr_t dma;
497495
unsigned int size;

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
16401640
cleaned_count);
16411641
if (cleaned_count > 0) { /*skip this if nothing cleaned*/
16421642
/* Recover from running out of Tx resources in xmit_frame */
1643-
spin_lock(&tx_ring->tx_lock);
1643+
netif_tx_lock(adapter->netdev);
16441644
if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev))))
16451645
{
16461646
netif_wake_queue(adapter->netdev);
@@ -1652,7 +1652,7 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
16521652

16531653
netdev_dbg(adapter->netdev, "next_to_clean : %d\n",
16541654
tx_ring->next_to_clean);
1655-
spin_unlock(&tx_ring->tx_lock);
1655+
netif_tx_unlock(adapter->netdev);
16561656
}
16571657
return cleaned;
16581658
}
@@ -1805,7 +1805,6 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,
18051805

18061806
tx_ring->next_to_use = 0;
18071807
tx_ring->next_to_clean = 0;
1808-
spin_lock_init(&tx_ring->tx_lock);
18091808

18101809
for (desNo = 0; desNo < tx_ring->count; desNo++) {
18111810
tx_desc = PCH_GBE_TX_DESC(*tx_ring, desNo);
@@ -2135,13 +2134,9 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
21352134
{
21362135
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
21372136
struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
2138-
unsigned long flags;
2139-
2140-
spin_lock_irqsave(&tx_ring->tx_lock, flags);
21412137

21422138
if (unlikely(!PCH_GBE_DESC_UNUSED(tx_ring))) {
21432139
netif_stop_queue(netdev);
2144-
spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
21452140
netdev_dbg(netdev,
21462141
"Return : BUSY next_to use : 0x%08x next_to clean : 0x%08x\n",
21472142
tx_ring->next_to_use, tx_ring->next_to_clean);
@@ -2150,7 +2145,6 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
21502145

21512146
/* CRC,ITAG no support */
21522147
pch_gbe_tx_queue(adapter, tx_ring, skb);
2153-
spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
21542148
return NETDEV_TX_OK;
21552149
}
21562150

0 commit comments

Comments
 (0)