Ignore:
Timestamp:
2014-02-28T00:02:43+01:00 (4 years ago)
Author:
nbd
Message:

cns3xxx: ethernet - clean up tx descs only when needed

We already clean up tx descriptors in the napi eth_poll() function so it
would likely be rare to run out of available descriptors in eth_xmit. Thus
we can clean them up only when needed and return busy only when we
still don't have enough.

Signed-off-by: Tim Harvey <tharvey@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c

    r39761 r39762  
    584584} 
    585585 
    586 static void eth_complete_tx(struct sw *sw) 
     586static int eth_complete_tx(struct sw *sw) 
    587587{ 
    588588        struct _tx_ring *tx_ring = &sw->tx_ring; 
     
    616616        tx_ring->num_used -= i; 
    617617        eth_check_num_used(tx_ring); 
     618 
     619        return TX_DESCS - tx_ring->num_used; 
    618620} 
    619621 
     
    777779                nr_desc++; 
    778780 
    779         eth_schedule_poll(sw); 
    780781        spin_lock_bh(&tx_lock); 
    781782        if ((tx_ring->num_used + nr_desc + 1) >= TX_DESCS) { 
    782                 spin_unlock_bh(&tx_lock); 
    783                 return NETDEV_TX_BUSY; 
     783                /* clean up tx descriptors when needed */ 
     784                if (eth_complete_tx(sw) < nr_desc) { 
     785                        spin_unlock_bh(&tx_lock); 
     786                        return NETDEV_TX_BUSY; 
     787                } 
    784788        } 
    785789 
Note: See TracChangeset for help on using the changeset viewer.