[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-K1imzDHm2K8bvrtYu5j-MNrN_4xH2h2je6ornuqmi_QA@mail.gmail.com>
Date: Sat, 16 Mar 2019 14:09:33 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
"David S . Miller" <davem@...emloft.net>,
Willem de Bruijn <willemb@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
Antoine Tenart <antoine.tenart@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH net] packets: Always register packet sk in the same order
On Sat, Mar 16, 2019 at 9:43 AM Maxime Chevallier
<maxime.chevallier@...tlin.com> wrote:
>
> When using fanouts with AF_PACKET, the demux functions such as
> fanout_demux_cpu will return an index in the fanout socket array, which
> corresponds to the selected socket.
>
> The ordering of this array depends on the order the sockets were added
> to a given fanout group, so for FANOUT_CPU this means sockets are bound
> to cpus in the order they are configured, which is OK.
>
> However, when stopping then restarting the interface these sockets are
> bound to, the sockets are reassigned to the fanout group in the reverse
> order, due to the fact that they were inserted at the head of the
> interface's AF_PACKET socket list.
>
> This means that traffic that was directed to the first socket in the
> fanout group is now directed to the last one after an interface restart.
>
> In the case of FANOUT_CPU, traffic from CPU0 will be directed to the
> socket that used to receive traffic from the last CPU after an interface
> restart.
>
> This commit introduces a helper to add a socket at the tail of a list,
> then uses it to register AF_PACKET sockets.
>
> Note that this changes the order in which sockets are listed in /proc and
> with sock_diag.
>
> Fixes: dc99f600698d ("packet: Add fanout support")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Acked-by: Willem de Bruijn <willemb@...gle.com>
Note that another consequence of this patch is that insertion on
packet create is now O(N) with the number of active packet sockets,
due to sklist being an hlist.
Powered by blists - more mailing lists