netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org
Subject: Re: [PATCH] sh_eth: Optimization for RX excess judgement
Date: Fri, 14 Nov 2014 01:09:06 +0300	[thread overview]
Message-ID: <54652C02.4070703@cogentembedded.com> (raw)
In-Reply-To: <1415862031-27925-1-git-send-email-ykaneko0929@gmail.com>

Hello.

On 11/13/2014 10:00 AM, Yoshihiro Kaneko wrote:

> From: Mitsuhiro Kimura <mitsuhiro.kimura.kc@renesas.com>

> Both of 'boguscnt' and 'quota' have nearly meaning as the condition of
> the reception loop.
> In order to cut down redundant processing, this patch changes excess judgement.

> Signed-off-by: Mitsuhiro Kimura <mitsuhiro.kimura.kc@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---

> This patch is based on net tree.

    This is clearly 'net-next' material.

>   drivers/net/ethernet/renesas/sh_eth.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 60e9c2c..7d46326 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1394,10 +1394,15 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
>
>   	int entry = mdp->cur_rx % mdp->num_rx_ring;
>   	int boguscnt = (mdp->dirty_rx + mdp->num_rx_ring) - mdp->cur_rx;
> +	int limit = boguscnt;
>   	struct sk_buff *skb;
>   	u16 pkt_len = 0;
>   	u32 desc_status;
>
> +	if (quota) {

    I don't see what's the point in checking -- quota is always non-NULL.

> +		boguscnt = min(boguscnt, *quota);
> +		limit = boguscnt;
> +	}
>   	rxdesc = &mdp->rx_ring[entry];
>   	while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) {
>   		desc_status = edmac_to_cpu(mdp, rxdesc->status);
[...]
> @@ -1501,7 +1501,10 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
>   		sh_eth_write(ndev, EDRRR_R, EDRRR);
>   	}
>
> -	return *quota <= 0;
> +	if (quota)

    Again, seeing no sense in this check.

> +		*quota -= limit - (++boguscnt);
> +
> +	return (boguscnt <= 0);

    Parens not needed.

[...]

WBR, Sergei


  parent reply	other threads:[~2014-11-13 22:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13  7:00 [PATCH] sh_eth: Optimization for RX excess judgement Yoshihiro Kaneko
2014-11-13 20:04 ` David Miller
2014-11-13 22:09 ` Sergei Shtylyov [this message]
2014-11-13 22:27 ` Sergei Shtylyov

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=54652C02.4070703@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=ykaneko0929@gmail.com \
    /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).