* [PATCH net-next 08/10] net: korina: optimize tx_full condition
@ 2017-10-15 16:24 Roman Yeryomin
0 siblings, 0 replies; only message in thread
From: Roman Yeryomin @ 2017-10-15 16:24 UTC (permalink / raw)
To: netdev
Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
drivers/net/ethernet/korina.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index f606f1e01af1..9520fa1e35a2 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -124,7 +124,6 @@ struct korina_private {
int tx_chain_tail;
enum chain_status tx_chain_status;
int tx_count;
- int tx_full;
int rx_irq;
int tx_irq;
@@ -261,19 +260,10 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
td = &lp->td_ring[lp->tx_chain_tail];
- /* stop queue when full, drop pkts if queue already full */
- if (lp->tx_count >= (KORINA_NUM_TDS - 2)) {
- lp->tx_full = 1;
+ /* stop queue when full */
+ if (unlikely(lp->tx_count > (KORINA_NUM_TDS - 3)))
netif_stop_queue(dev);
- if (lp->tx_count > (KORINA_NUM_TDS - 2)) {
- dev->stats.tx_dropped++;
- dev_kfree_skb_any(skb);
-
- return NETDEV_TX_BUSY;
- }
- }
-
lp->tx_count++;
lp->tx_skb[lp->tx_chain_tail] = skb;
@@ -323,10 +313,8 @@ static void korina_tx(struct net_device *dev)
/* Process all desc that are done */
while (IS_DMA_FINISHED(td->control)) {
- if (lp->tx_full == 1) {
+ if (unlikely(lp->tx_count > (KORINA_NUM_TDS - 2)))
netif_wake_queue(dev);
- lp->tx_full = 0;
- }
devcs = lp->td_ring[lp->tx_next_done].devcs;
@@ -696,7 +684,7 @@ static int korina_alloc_ring(struct net_device *dev)
lp->td_ring[i].link = 0;
}
lp->tx_next_done = lp->tx_chain_head = lp->tx_chain_tail =
- lp->tx_full = lp->tx_count = 0;
+ lp->tx_count = 0;
lp->tx_chain_status = desc_empty;
/* Initialize the receive descriptors */
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-15 16:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-15 16:24 [PATCH net-next 08/10] net: korina: optimize tx_full condition Roman Yeryomin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox