Sat, Dec 15, 2018 at 11:45:25AM CET, yanmiaobest(a)gmail.com wrote:
Hi Jiri
This is Miao, I am currently working on a project to implement a new team policy
based on the kernel team support. Basically, I have lots of 'ports',
each of them
has a ID. I'd like to use the ID to calculate the hash and distribute
the traffic to
different team slave ports, similar to round-robin.
And when looking into team code, I see the team kernel driver has
the following comments:
/*
* Enable/disable port by adding to enabled port hashlist and setting
* port->index (Might be racy so reader could see incorrect ifindex when
* processing a flying packet, but that is not a problem). Write guarded
* by team->lock.
*/
The team datapath runs lockless, and libteam can enable/disble port
one the fly when traffic happens. For exmaple, I have 4 port and I
want, port0->slave0,
port1->slave1, port2->slave2 and port3->slave3, when slave1 device is link
down state, it becomes port0->slave0, port1->slave2, port2->slave3,
port3->slave0,
using the ID%num as the hash function.
But it seems if datapath runs lockless, it could see the wrong ifindex during
configuration as stated in the comment because the team drvier needs to
reconstruct the active ports list. So my question is why this is not a problem
when datapathsees a wrong ifindex, wouldn't that break the defined team
policy ? Thank you very much for your help.
Yes, it would. For a packet from time to time. Is it a problem?
>
>Regards,
>Miao