ECMP hash keys?
Alexander V. Chernikov
melifaro at FreeBSD.org
Thu Jan 16 21:23:34 UTC 2014
On 15.01.2014 19:22, Adrian Chadd wrote:
> On 15 January 2014 01:18, Alexander V. Chernikov <melifaro at freebsd.org> wrote:
>> On 14.01.2014 23:15, Nikolay Denev wrote:
>>>
>>> Hi,
>>>
>>> Currently it's implemented using Modulo-N Hash (RFC2991), see
>>> radix_mpath.c:rtalloc_mpath_fib()
>>
>> Yup. I'm going to change this to use flowid.
>>
>>>
>>> And as hash the xor of source and destination IP is supplied, look for
>>> rtalloc_mpath_fib() in ip_output.c :
>>>
>>> ...
>>> #ifdef RADIX_MPATH
>>> rtalloc_mpath_fib(ro,
>>> ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr),
>>> inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m));
>>> #else
>>> ...
>>>
>>> I've tried to hack this to use m_pkthdr.flowid if it exists, but in my
>>> case my network cards were not setting this (vr(4) on soekris) so I
>>
>> You can try http://static.ipfw.ru/patches/netisr_ip_flowid.diff to get
>> flowid values generated by netisr.
>
> Hm, this is interesting. I wonder if we should (finally) add in the
> toeplitz hash here and then make sure we are hashing the frame based
> on the right header contents and direction (so transmit and receive
> path frames hash to the same value.)
I'm not sure I understand. What workload we are talking about?
For pure routing we don't need both ends of TCP session to land on the
same CPU core.
For doing (transparent?) stateul firewalling - maybe, but that's not the
default.
Additionally, most (and all 10G) NICs already perform hashing (and
toeplitz which is implemented in most? of them does not provide the same
hash for forward/reverse packets of given session). We can do re-mark
here, but that require us to:
* do deferred netisr probably decrementing number of RX rings in every NIC
* improve netist (maybe, add batching and/or lockless queueing)
That's definitely not the default, too.
For server terminating connections - we can just save flowid of initial
connection and that's all. I'm not sure we require hash(src,dst) to be
equal to hash(dst,src)
So, if you really want hashing function with this additional restriction
- than we should add some more sysctls/tunables to netisr to be able to
select several different flowid functions for given family (nearly like
what is done for TCP CCs).
Anyway, we really should add _some_ hashing function for IPv4/IPv6.
>
> What do you think?
>
>
> -a
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20140117/d95909d1/attachment.sig>
More information about the freebsd-net
mailing list