From: Eric Dumazet <eric.dumazet@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Tom Herbert <therbert@google.com>,
davem@davemloft.net, netdev@vger.kernel.org,
Netfilter Developer Mailing List
<netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH v5] rps: Receive Packet Steering
Date: Fri, 15 Jan 2010 07:19:33 +0100 [thread overview]
Message-ID: <4B5008F5.6090007@gmail.com> (raw)
In-Reply-To: <412e6f7f1001141822pffa070ap15c73e2931402294@mail.gmail.com>
Le 15/01/2010 03:22, Changli Gao a écrit :
> On Fri, Jan 15, 2010 at 5:56 AM, Tom Herbert <therbert@google.com> wrote:
>> +
>> + if (skb->rxhash)
>> + goto got_hash; /* Skip hash computation on packet header */
>> +
>> + switch (skb->protocol) {
>> + case __constant_htons(ETH_P_IP):
>> + if (!pskb_may_pull(skb, sizeof(*ip)))
>> + goto done;
>> +
>> + ip = (struct iphdr *) skb->data;
>> + ip_proto = ip->protocol;
>> + addr1 = ip->saddr;
>> + addr2 = ip->daddr;
>> + ihl = ip->ihl;
>> + break;
>> + case __constant_htons(ETH_P_IPV6):
>> + if (!pskb_may_pull(skb, sizeof(*ip6)))
>> + goto done;
>> +
>> + ip6 = (struct ipv6hdr *) skb->data;
>> + ip_proto = ip6->nexthdr;
> This code can't work, when there are extra headers. ipv6_skip_exthdr()
> can be used to get the l4 header.
Could you give exact code please ?
>
>> + addr1 = ip6->saddr.s6_addr32[3];
>> + addr2 = ip6->daddr.s6_addr32[3];
>> + ihl = (40 >> 2);
>> + break;
>> + default:
>> + goto done;
>> + }
>> + ports = 0;
>> + switch (ip_proto) {
>> + case IPPROTO_TCP:
>> + case IPPROTO_UDP:
>> + case IPPROTO_DCCP:
>> + case IPPROTO_ESP:
>> + case IPPROTO_AH:
>> + case IPPROTO_SCTP:
>> + case IPPROTO_UDPLITE:
>> + if (pskb_may_pull(skb, (ihl * 4) + 4))
>> + ports = *((u32 *) (skb->data + (ihl * 4)));
>> + break;
>> +
>> + default:
>> + break;
>> + }
>> +
>> + skb->rxhash = jhash_3words(addr1, addr2, ports, hashrnd);
> For connection based packet processing, such as netfilter,
> distributing the packets in two directions into one CPU will reduce
> cache miss, when NAT isn't used. I think the code bellow will help:
> if (addr1 > addr2)
> swap(addr1, addr2);
Yes, I already gave this hint in a previous review, but this adds a test
and I suspect Google is not using NAT :)
>
>> + if (!skb->rxhash)
>> + skb->rxhash = 1;
>
> Why not put the above code into a new function, and add more protocols
> support, such as 802.1Q. Though rxhash is based on 4-tuple, I think
> netfilter will benefit from it.
>
Sure, this can be done in a followup patch.
Thanks
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-01-15 6:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.DEB.1.00.1001141353140.19018@pokey.mtv.corp.google.com>
2010-01-15 2:22 ` [PATCH v5] rps: Receive Packet Steering Changli Gao
2010-01-15 6:19 ` Eric Dumazet [this message]
2010-01-15 6:39 ` Changli Gao
2010-01-15 6:57 ` Eric Dumazet
2010-01-15 8:49 ` David Miller
2010-01-15 9:20 ` Changli Gao
2010-01-15 9:26 ` David Miller
2010-01-21 7:04 ` Changli Gao
2010-01-15 9:45 ` David Miller
2010-01-15 8:50 ` David Miller
2010-01-15 9:05 ` Changli Gao
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=4B5008F5.6090007@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=therbert@google.com \
--cc=xiaosuo@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).