* [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash
@ 2015-09-23 21:13 Tom Herbert
2015-09-23 21:21 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Tom Herbert @ 2015-09-23 21:13 UTC (permalink / raw)
To: davem, netdev; +Cc: kernel-team, pch
In rt6_info_hash_nhsfn replace the custom hashing over flowi6 that is
using xor with a call to common function get_hash_from_flowi6.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
net/ipv6/route.c | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 53617d7..111dead 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -421,31 +421,7 @@ static bool rt6_check_expired(const struct rt6_info *rt)
static int rt6_info_hash_nhsfn(unsigned int candidate_count,
const struct flowi6 *fl6)
{
- unsigned int val = fl6->flowi6_proto;
-
- val ^= ipv6_addr_hash(&fl6->daddr);
- val ^= ipv6_addr_hash(&fl6->saddr);
-
- /* Work only if this not encapsulated */
- switch (fl6->flowi6_proto) {
- case IPPROTO_UDP:
- case IPPROTO_TCP:
- case IPPROTO_SCTP:
- val ^= (__force u16)fl6->fl6_sport;
- val ^= (__force u16)fl6->fl6_dport;
- break;
-
- case IPPROTO_ICMPV6:
- val ^= (__force u16)fl6->fl6_icmp_type;
- val ^= (__force u16)fl6->fl6_icmp_code;
- break;
- }
- /* RFC6438 recommands to use flowlabel */
- val ^= (__force u32)fl6->flowlabel;
-
- /* Perhaps, we need to tune, this function? */
- val = val ^ (val >> 7) ^ (val >> 12);
- return val % candidate_count;
+ return get_hash_from_flowi6(fl6) % candidate_count;
}
static struct rt6_info *rt6_multipath_select(struct rt6_info *match,
--
2.4.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash
2015-09-23 21:13 [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash Tom Herbert
@ 2015-09-23 21:21 ` David Miller
2015-09-23 21:57 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2015-09-23 21:21 UTC (permalink / raw)
To: tom; +Cc: netdev, kernel-team, pch
From: Tom Herbert <tom@herbertland.com>
Date: Wed, 23 Sep 2015 14:13:35 -0700
> In rt6_info_hash_nhsfn replace the custom hashing over flowi6 that is
> using xor with a call to common function get_hash_from_flowi6.
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash
2015-09-23 21:21 ` David Miller
@ 2015-09-23 21:57 ` David Miller
2015-09-23 22:45 ` Tom Herbert
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2015-09-23 21:57 UTC (permalink / raw)
To: tom; +Cc: netdev, kernel-team, pch
From: David Miller <davem@davemloft.net>
Date: Wed, 23 Sep 2015 14:21:38 -0700 (PDT)
> From: Tom Herbert <tom@herbertland.com>
> Date: Wed, 23 Sep 2015 14:13:35 -0700
>
>> In rt6_info_hash_nhsfn replace the custom hashing over flowi6 that is
>> using xor with a call to common function get_hash_from_flowi6.
>>
>> Signed-off-by: Tom Herbert <tom@herbertland.com>
>
> Applied, thanks.
Tom, I just so happened to look over the call paths that lead to this
function and the flowi6 ports aren't filled in much of the time.
I know your patch doesn't change things one way or the other in this
area, but I thought I'd bring it up nonetheless.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash
2015-09-23 21:57 ` David Miller
@ 2015-09-23 22:45 ` Tom Herbert
0 siblings, 0 replies; 4+ messages in thread
From: Tom Herbert @ 2015-09-23 22:45 UTC (permalink / raw)
To: David Miller
Cc: Linux Kernel Network Developers, Kernel Team, Peter Christensen
On Wed, Sep 23, 2015 at 2:57 PM, David Miller <davem@davemloft.net> wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 23 Sep 2015 14:21:38 -0700 (PDT)
>
>> From: Tom Herbert <tom@herbertland.com>
>> Date: Wed, 23 Sep 2015 14:13:35 -0700
>>
>>> In rt6_info_hash_nhsfn replace the custom hashing over flowi6 that is
>>> using xor with a call to common function get_hash_from_flowi6.
>>>
>>> Signed-off-by: Tom Herbert <tom@herbertland.com>
>>
>> Applied, thanks.
>
> Tom, I just so happened to look over the call paths that lead to this
> function and the flowi6 ports aren't filled in much of the time.
>
> I know your patch doesn't change things one way or the other in this
> area, but I thought I'd bring it up nonetheless.
Yeah, I noticed there's still a little work to do here. On input put
we should be passing in skb to use skb->hash instead of calculating
it. On ouput we should be getting hash from sk->txhash for connected
sockets.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-23 22:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 21:13 [PATCH net-next] ipv6 Use get_hash_from_flowi6 for rt6 hash Tom Herbert
2015-09-23 21:21 ` David Miller
2015-09-23 21:57 ` David Miller
2015-09-23 22:45 ` Tom Herbert
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).