netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: linuxppc-dev@ozlabs.org, leoli@freescale.com, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] ucc_geth: Rework the TX logic.
Date: Thu, 26 Mar 2009 16:39:18 +0300	[thread overview]
Message-ID: <20090326133918.GA27085@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1238072077-27044-2-git-send-email-Joakim.Tjernlund@transmode.se>

Hi Joakim,

On Thu, Mar 26, 2009 at 01:54:37PM +0100, Joakim Tjernlund wrote:
> The line:
>  if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
>        break;
> in ucc_geth_tx() didn not make sense to me. Rework & cleanup
> this logic to something understandable.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  drivers/net/ucc_geth.c |   40 ++++++++++++++++++++--------------------
>  1 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index 7fc91aa..b6ebefd 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -3048,6 +3048,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  	u8 __iomem *bd;			/* BD pointer */
>  	u32 bd_status;
>  	u8 txQ = 0;
> +	int txInd;

camelCase should not be used in Linux.

Surely, the driver is full of camelCases... though, it should be
fixed, not encouraged further.

And btw, there is even Hungarian notation in the driver. :-(

[...]
>  	/* If the next BD still needs to be cleaned up, then the bds
>  	   are full.  We need to tell the kernel to stop sending us stuff. */
> -	if (bd == ugeth->confBd[txQ]) {
> -		if (!netif_queue_stopped(dev))
> -			netif_stop_queue(dev);
> +	if (!in_be32((u32 __iomem *)(bd+4))) {

bd == ugeth->confBd[txQ]
and
!in_be32((u32 __iomem *)(bd+4))

Are not equivalent wrt. speed. MMIO accessors should be rather
slow comparing to normal memory.

We should really do some performance tests (using gbit links).
I'll try to help you with the tests, but it might take some time.

[...]
> +		if (!in_be32((u32 __iomem *)(bd+4)))
[...]
> +		out_be32((u32 __iomem *)(bd+4), (int)NULL); /* Mark it free */

How about some inline function that will self-document the bd + 4
stuff? Plus that way we'll get rid of the casts.

Note that "bd+4" should be "bd + 4". And (int)NULL makes
little sense, just 0 will work.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

  reply	other threads:[~2009-03-26 13:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 12:54 [PATCH 1/2] ucc_geth: Move freeing of TX packets to NAPI context Joakim Tjernlund
2009-03-26 12:54 ` [PATCH 2/2] ucc_geth: Rework the TX logic Joakim Tjernlund
2009-03-26 13:39   ` Anton Vorontsov [this message]
2009-03-26 16:43     ` Joakim Tjernlund
2009-03-26 18:05       ` Anton Vorontsov
2009-03-26 18:20         ` Joakim Tjernlund
2009-03-27  7:42           ` David Miller
2009-03-27  9:37             ` Joakim Tjernlund
2009-03-26 14:15 ` [PATCH 1/2] ucc_geth: Move freeing of TX packets to NAPI context Eric Dumazet
2009-03-26 16:55   ` Joakim Tjernlund
2009-03-26 18:26   ` [RFC] niu: RX queues should rotate if budget exhausted Eric Dumazet
2009-03-27  7:55     ` David Miller
2009-03-27  7:58       ` David Miller
2009-03-27  8:05         ` Eric Dumazet
2009-03-27 10:50 ` [PATCH 1/2] ucc_geth: Move freeing of TX packets to NAPI context Li Yang
2009-03-27 11:52   ` Joakim Tjernlund
2009-03-27 21:55     ` David Miller
2009-03-30  7:36     ` Li Yang
2009-03-30  7:48       ` Joakim Tjernlund
2009-03-30  7:57         ` Li Yang

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=20090326133918.GA27085@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=Joakim.Tjernlund@transmode.se \
    --cc=leoli@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --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;
as well as URLs for NNTP newsgroup(s).