public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ding Tianhong <dthxman@gmail.com>,
	Ding Tianhong <dingtianhong@huawei.com>,
	"David S. Miller" <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2 11/20] net: packetengines: slight optimization of addr
Date: Sun, 29 Dec 2013 02:25:29 +0300	[thread overview]
Message-ID: <52BF5DE9.3060501@cogentembedded.com> (raw)
In-Reply-To: <52BEEBD5.1040301@gmail.com>

Hello.

On 12/28/2013 06:18 PM, Ding Tianhong wrote:

>>> Use possibly more efficient ether_addr_equal
>>> to instead of memcmp.

>>> Cc: "David S. Miller" <davem@davemloft.net>
>>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>>> ---
>>>    drivers/net/ethernet/packetengines/yellowfin.c |   12 ++++++------
>>>    1 files changed, 6 insertions(+), 6 deletions(-)

>>> diff --git a/drivers/net/ethernet/packetengines/yellowfin.c b/drivers/net/ethernet/packetengines/yellowfin.c
>>> index d28593b..b83ac0e 100644
>>> --- a/drivers/net/ethernet/packetengines/yellowfin.c
>>> +++ b/drivers/net/ethernet/packetengines/yellowfin.c
>>> @@ -1097,12 +1097,12 @@ static int yellowfin_rx(struct net_device *dev)
>>>                if (status2 & 0x80) dev->stats.rx_dropped++;
>>>    #ifdef YF_PROTOTYPE        /* Support for prototype hardware errata. */
>>>            } else if ((yp->flags & HasMACAddrBug)  &&
>>> -            memcmp(le32_to_cpu(yp->rx_ring_dma +
>>> -                entry*sizeof(struct yellowfin_desc)),
>>> -                dev->dev_addr, 6) != 0 &&
>>> -            memcmp(le32_to_cpu(yp->rx_ring_dma +
>>> -                entry*sizeof(struct yellowfin_desc)),
>>> -                "\377\377\377\377\377\377", 6) != 0) {
>>> +            !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
>>> +                              entry * sizeof(struct yellowfin_desc)),
>>> +                              dev->dev_addr) &&

>>     Previous line was aligned correctly, the above line should start under le32_to_cpu.

>>> +            !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
>>> +                              entry * sizeof(struct yellowfin_desc)),

>>     Start the continuation lines under 'yp', please.

>>> +                              "\377\377\377\377\377\377")) {

>>     This line should start under le32_to_cpu.

>> WBR, Sergei


> Hi sergei:
> you mean this way?
> 	!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
> 				      entry * sizeof(struct yellowfin_desc)),
> 			  dev->dev_addr) &&
>
> 	!ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
> 				      entry * sizeof(struct yellowfin_desc)),
> 			  "\377\377\377\377\377\377")) {

    Yes, exactly.

> Regards
> Ding

WBR, Sergei


      parent reply	other threads:[~2013-12-28 22:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-28  6:17 [PATCH net-next v2 11/20] net: packetengines: slight optimization of addr Ding Tianhong
2013-12-28 13:58 ` Sergei Shtylyov
2013-12-28 15:18   ` Ding Tianhong
2013-12-28 17:23     ` Joe Perches
2013-12-30  2:39       ` Ding Tianhong
2013-12-30  6:05         ` Joe Perches
2013-12-30  6:19           ` Ding Tianhong
2013-12-28 23:25     ` Sergei Shtylyov [this message]

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=52BF5DE9.3060501@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=dingtianhong@huawei.com \
    --cc=dthxman@gmail.com \
    --cc=linux-kernel@vger.kernel.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