From: arno@natisbad.org (Arnaud Ebalard)
To: Willy Tarreau <w@1wt.eu>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Gregory CLEMENT <gregory.clement@free-electrons.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH 5/5] net: mvneta: replace Tx timer with a real interrupt
Date: Tue, 14 Jan 2014 00:22:03 +0100 [thread overview]
Message-ID: <87y52jeack.fsf@natisbad.org> (raw)
In-Reply-To: 1389519069-1619-6-git-send-email-w@1wt.eu
Hi Willy,
Willy Tarreau <w@1wt.eu> writes:
> @@ -1935,14 +1907,22 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
>
> /* Read cause register */
> cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE) &
> - MVNETA_RX_INTR_MASK(rxq_number);
> + (MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number));
> +
> + /* Release Tx descriptors */
> + if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) {
> + int tx_todo = 0;
> +
> + mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL), &tx_todo);
> + cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL;
> + }
Unless I missed something, tx_todo above is just here to make the
compiler happy w/ current prototype of mvneta_tx_done_gbe() but is
otherwise unused: you could simply remove the third parameter of the
function (it is only used here) and remove tx_todo.
Additionally, as you do not use the return value of the function, you
could probably make it void and spare some additional cycles by removing
the computation of the return value. While at it, mvneta_txq_done()
could also be made void.
The patch below gives the idea, it's compile-tested only and applies on
your whole set (fixes + perf).
Index: linux/drivers/net/ethernet/marvell/mvneta.c
===================================================================
--- linux.orig/drivers/net/ethernet/marvell/mvneta.c 2014-01-14 00:07:18.728729578 +0100
+++ linux/drivers/net/ethernet/marvell/mvneta.c 2014-01-14 00:11:57.740949448 +0100
@@ -1314,25 +1314,23 @@
}
/* Handle end of transmission */
-static int mvneta_txq_done(struct mvneta_port *pp,
+static void mvneta_txq_done(struct mvneta_port *pp,
struct mvneta_tx_queue *txq)
{
struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
int tx_done;
tx_done = mvneta_txq_sent_desc_proc(pp, txq);
- if (tx_done == 0)
- return tx_done;
- mvneta_txq_bufs_free(pp, txq, tx_done);
+ if (tx_done) {
+ mvneta_txq_bufs_free(pp, txq, tx_done);
- txq->count -= tx_done;
+ txq->count -= tx_done;
- if (netif_tx_queue_stopped(nq)) {
- if (txq->size - txq->count >= MAX_SKB_FRAGS + 1)
- netif_tx_wake_queue(nq);
+ if (netif_tx_queue_stopped(nq)) {
+ if (txq->size - txq->count >= MAX_SKB_FRAGS + 1)
+ netif_tx_wake_queue(nq);
+ }
}
-
- return tx_done;
}
static void *mvneta_frag_alloc(const struct mvneta_port *pp)
@@ -1704,30 +1702,23 @@
/* Handle tx done - called in softirq context. The <cause_tx_done> argument
* must be a valid cause according to MVNETA_TXQ_INTR_MASK_ALL.
*/
-static u32 mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done,
- int *tx_todo)
+static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done)
{
struct mvneta_tx_queue *txq;
- u32 tx_done = 0;
struct netdev_queue *nq;
- *tx_todo = 0;
while (cause_tx_done) {
txq = mvneta_tx_done_policy(pp, cause_tx_done);
nq = netdev_get_tx_queue(pp->dev, txq->id);
__netif_tx_lock(nq, smp_processor_id());
- if (txq->count) {
- tx_done += mvneta_txq_done(pp, txq);
- *tx_todo += txq->count;
- }
+ if (txq->count)
+ mvneta_txq_done(pp, txq);
__netif_tx_unlock(nq);
cause_tx_done &= ~((1 << txq->id));
}
-
- return tx_done;
}
/* Compute crc8 of the specified address, using a unique algorithm ,
@@ -1961,9 +1952,7 @@
/* Release Tx descriptors */
if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) {
- int tx_todo = 0;
-
- mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL), &tx_todo);
+ mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL));
cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL;
}
next prev parent reply other threads:[~2014-01-13 23:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-12 9:31 [PATCH 0/5] Assorted mvneta fixes Willy Tarreau
2014-01-12 9:31 ` [PATCH 1/5] net: mvneta: increase the 64-bit rx/tx stats out of the hot path Willy Tarreau
2014-01-13 0:49 ` Eric Dumazet
2014-01-13 3:06 ` Willy Tarreau
2014-01-12 9:31 ` [PATCH 2/5] net: mvneta: use per_cpu stats to fix an SMP lock up Willy Tarreau
2014-01-12 18:07 ` Eric Dumazet
2014-01-12 22:09 ` Willy Tarreau
2014-01-13 0:45 ` Eric Dumazet
2014-01-13 3:02 ` Willy Tarreau
2014-01-13 0:48 ` Eric Dumazet
2014-01-12 9:31 ` [PATCH 3/5] net: mvneta: do not schedule in mvneta_tx_timeout Willy Tarreau
2014-01-12 16:49 ` Ben Hutchings
2014-01-12 16:55 ` Willy Tarreau
2014-01-12 17:38 ` Ben Hutchings
2014-01-12 22:14 ` Willy Tarreau
2014-01-14 15:33 ` Willy Tarreau
2014-01-12 9:31 ` [PATCH 4/5] net: mvneta: add missing bit descriptions for interrupt masks and causes Willy Tarreau
2014-01-12 9:31 ` [PATCH 5/5] net: mvneta: replace Tx timer with a real interrupt Willy Tarreau
2014-01-13 23:22 ` Arnaud Ebalard [this message]
2014-01-14 7:30 ` Willy Tarreau
2014-01-12 19:21 ` [PATCH 0/5] Assorted mvneta fixes Arnaud Ebalard
2014-01-12 22:22 ` Willy Tarreau
2014-01-13 22:36 ` Arnaud Ebalard
2014-01-14 7:24 ` Willy Tarreau
2014-01-15 0:58 ` David Miller
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=87y52jeack.fsf@natisbad.org \
--to=arno@natisbad.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=gregory.clement@free-electrons.com \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
--cc=w@1wt.eu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.