Changeset 29762


Ignore:
Timestamp:
2012-01-17T12:23:11+01:00 (6 years ago)
Author:
blogic
Message:

ramips: Rework ramips_eth to not require irqsave locking anymore

Previously the tx housekeeping was done in a spin_lock_irqsave critical
section which causes irqs to be disabled during that time. Since the
housekeeping is already prepared to be scheduled as a tasklet process
the housekeeping only in softirq context and revise the locking between
the tx path and the housekeeping tasklet by using a normal spin_lock
which in most situations will be a NOP anyway.

This makes sure that interrupts are only disabled for a short time
since in the worst case the housekeeping might have to free up to 256
skbs.

Signed-off-by: Helmut Schaa <helmut.schaa@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/files/drivers/net/ramips.c

    r24331 r29762  
    216216        unsigned int tx_next; 
    217217        unsigned int mapped_addr; 
    218         unsigned long flags; 
    219218 
    220219        if (priv->plat->min_pkt_len) { 
     
    234233                                                    DMA_TO_DEVICE); 
    235234        dma_sync_single_for_device(NULL, mapped_addr, skb->len, DMA_TO_DEVICE); 
    236         spin_lock_irqsave(&priv->page_lock, flags); 
     235        spin_lock(&priv->page_lock); 
    237236        tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0); 
    238237        tx_next = (tx + 1) % NUM_TX_DESC; 
     
    251250        wmb(); 
    252251        ramips_fe_wr(tx_next, RAMIPS_TX_CTX_IDX0); 
    253         spin_unlock_irqrestore(&priv->page_lock, flags); 
     252        spin_unlock(&priv->page_lock); 
    254253        return NETDEV_TX_OK; 
    255254 
    256255 out: 
    257         spin_unlock_irqrestore(&priv->page_lock, flags); 
     256        spin_unlock(&priv->page_lock); 
    258257        dev->stats.tx_dropped++; 
    259258        kfree_skb(skb); 
     
    314313        struct raeth_priv *priv = netdev_priv(dev); 
    315314 
     315        spin_lock(&priv->page_lock); 
    316316        while ((priv->tx[priv->skb_free_idx].txd2 & TX_DMA_DONE) && 
    317317               (priv->tx_skb[priv->skb_free_idx])) { 
     
    322322                        priv->skb_free_idx = 0; 
    323323        } 
     324        spin_unlock(&priv->page_lock); 
    324325 
    325326        ramips_fe_int_enable(RAMIPS_TX_DLY_INT); 
     
    347348        } 
    348349 
    349         if (fe_int & RAMIPS_TX_DLY_INT) 
    350                 ramips_eth_tx_housekeeping((unsigned long)dev); 
     350        if (fe_int & RAMIPS_TX_DLY_INT) { 
     351                ramips_fe_int_disable(RAMIPS_TX_DLY_INT); 
     352                tasklet_schedule(&priv->tx_housekeeping_tasklet); 
     353        } 
    351354 
    352355        return IRQ_HANDLED; 
Note: See TracChangeset for help on using the changeset viewer.