From: Roman Yeryomin <roman@advem.lv>
To: netdev <netdev@vger.kernel.org>
Subject: [PATCH net-next 08/10] net: korina: optimize tx_full condition
Date: Sun, 15 Oct 2017 19:24:06 +0300 [thread overview]
Message-ID: <20171015162406.1118-1-roman@advem.lv> (raw)
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
reply other threads:[~2017-10-15 16:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171015162406.1118-1-roman@advem.lv \
--to=roman@advem.lv \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox