diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-02-27 23:02:43 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-02-27 23:02:43 +0000 |
commit | 8665c57923fa16474713b845f96e703d22304091 (patch) | |
tree | eea009de79ef2a8ddc80b16ba78828a594ceba83 /target/linux/cns3xxx/files/drivers/net | |
parent | 96eb3d883dde86b8af2748d5932d5c53a35dbb8c (diff) | |
download | master-31e0f0ae-8665c57923fa16474713b845f96e703d22304091.tar.gz master-31e0f0ae-8665c57923fa16474713b845f96e703d22304091.tar.bz2 master-31e0f0ae-8665c57923fa16474713b845f96e703d22304091.zip |
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@gateworks.com>
SVN-Revision: 39762
Diffstat (limited to 'target/linux/cns3xxx/files/drivers/net')
-rw-r--r-- | target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c index bbbbf5c091..9692d47994 100644 --- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c +++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c @@ -583,7 +583,7 @@ static void eth_check_num_used(struct _tx_ring *tx_ring) } } -static void eth_complete_tx(struct sw *sw) +static int eth_complete_tx(struct sw *sw) { struct _tx_ring *tx_ring = &sw->tx_ring; struct tx_desc *desc; @@ -615,6 +615,8 @@ static void eth_complete_tx(struct sw *sw) tx_ring->free_index = index; tx_ring->num_used -= i; eth_check_num_used(tx_ring); + + return TX_DESCS - tx_ring->num_used; } static int eth_poll(struct napi_struct *napi, int budget) @@ -776,11 +778,13 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) skb_walk_frags(skb, skb1) nr_desc++; - eth_schedule_poll(sw); spin_lock_bh(&tx_lock); if ((tx_ring->num_used + nr_desc + 1) >= TX_DESCS) { - spin_unlock_bh(&tx_lock); - return NETDEV_TX_BUSY; + /* clean up tx descriptors when needed */ + if (eth_complete_tx(sw) < nr_desc) { + spin_unlock_bh(&tx_lock); + return NETDEV_TX_BUSY; + } } index = index0 = tx_ring->cur_index; |