[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8e3bc6a-60fe-0d70-12af-8edd947a321d@gmail.com>
Date: Fri, 1 Jun 2018 11:55:17 -0600
From: David Ahern <dsahern@...il.com>
To: Michal Kubecek <mkubecek@...e.cz>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Tom Herbert <tom@...bertland.com>
Subject: Re: [PATCH net] ipv6: omit traffic class when calculating flow hash
On 6/1/18 11:51 AM, Michal Kubecek wrote:
> On Fri, Jun 01, 2018 at 10:42:10AM -0600, David Ahern wrote:
>>
>> Can you make an inline for the flowlabel conversion. Something like this:
>>
>> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
>> index 798558fd1681..e36eca2f8531 100644
>> --- a/include/net/ipv6.h
>> +++ b/include/net/ipv6.h
>> @@ -284,6 +284,11 @@ struct ip6_flowlabel {
>> #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
>> #define IPV6_FLOWLABEL_STATELESS_FLAG cpu_to_be32(0x00080000)
>>
>> +static inline u32 flowi6_get_flowlabel(const struct flowi6 *fl6)
>> +{
>> + return (__force u32)(fl6->flowlabel & IPV6_FLOWLABEL_MASK);
>> +}
>> +
>> #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
>> #define IPV6_TCLASS_SHIFT 20
>>
>> From there we can fix the flow struct to have flowinfo instead of
>> flowlabel and use the macro to hide the conversion.
>
> I'll send v2 with inline helper. I'm just not sure about including the
> cast as this way the helper would be useful for hash key which is not
> clear from the name. So it seems more appropriate to either introduce a
> helper which just does the masking or helper which does also the copying
> into struct flow_keys.
>
I think the cast should stay in the helper. See the RFC patch flipping
the name from flowlabel to flowinfo. Makes the code the more readable IMHO.
Powered by blists - more mailing lists