netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Alexander Duyck <alexander.h.duyck@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH 0/3] A few minor clean-ups to eth_type_trans
Date: Thu, 30 Apr 2015 16:11:43 -0700	[thread overview]
Message-ID: <5542B6AF.9010602@gmail.com> (raw)
In-Reply-To: <20150430223510.GA13111@Alexeis-MBP.westell.com>

On 04/30/2015 03:35 PM, Alexei Starovoitov wrote:
> On Thu, Apr 30, 2015 at 02:53:42PM -0700, Alexander Duyck wrote:
>> This series addresses a few minor issues I found in eth_type_trans that
>> that allow us to gain back something like 3 or more cycles per packet.
>>
>> The first change is to drop the byte swap since it isn't necessary.  On x86
>> we could just check the first byte and compare that against the upper 8
>> bits of the Ethertype to determine if we are dealing with a size value or
>> not.
>>
>> The second makes it so that the value we read in to test for multicast can
>> be used for the address comparison.  This allows us to avoid a second read
>> of the destination address.
>>
>> The final change is to avoid some unneeded instructions in computing the
>> Ethernet header pointer.  When we start the call the Ethernet header is at
>> skb->data, so we just use that rather than computing mac_header, and then
>> adding that back to skb->head.
> Great stuff! Excellent optimizations.
>
> Only the comment 'ETH_P_802_3_MIN is aligned to 512' through me off.
> It's divisible by 256 that matters.

Yeah, it is 0x0600 hex so we can ignore the lower 8 bits, or in the case 
of little-endian systems the upper 8 bits.  I think when I had 
originally written the patch I was using a mask of 0xFE00, but then I 
realized that all the compiler cared about is knowing which byte it is 
supposed to compare against.

- Alex

  reply	other threads:[~2015-04-30 23:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 21:53 [PATCH 0/3] A few minor clean-ups to eth_type_trans Alexander Duyck
2015-04-30 21:53 ` [PATCH 1/3] etherdev: Avoid unnecessary byte swap in check for Ethertype Alexander Duyck
2015-04-30 23:03   ` Eric Dumazet
2015-04-30 23:24     ` Alexander Duyck
2015-05-01  0:13       ` Eric Dumazet
2015-05-01  0:41         ` Alexander Duyck
2015-04-30 21:53 ` [PATCH 2/3] etherdev: Process is_multicast_ether_addr at same size as other operations Alexander Duyck
2015-04-30 21:53 ` [PATCH 3/3] etherdev: Use skb->data to retrieve Ethernet header instead of eth_hdr Alexander Duyck
2015-04-30 22:35 ` [PATCH 0/3] A few minor clean-ups to eth_type_trans Alexei Starovoitov
2015-04-30 23:11   ` Alexander Duyck [this message]
2015-05-01 11:30     ` David Laight
2015-05-01 15:34       ` Alexander Duyck
2015-05-04  2:47 ` 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=5542B6AF.9010602@gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=davem@davemloft.net \
    --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).