net/packet: make packet_fanout.arr size configurable up to 64K
authorTanner Love <tannerlove@google.com>
Fri, 6 Nov 2020 18:07:40 +0000 (13:07 -0500)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Nov 2020 00:41:40 +0000 (16:41 -0800)
commit9c661b0b85444e426d3f23250305eeb16f6ffe88
treeccd38de01ae8ce6c1ca2ff0c2d5b14eb10ae73ad
parenta3ce2b109a59ee9670706ae8126dcc04cfe261cd
net/packet: make packet_fanout.arr size configurable up to 64K

One use case of PACKET_FANOUT is lockless reception with one socket
per CPU. 256 is a practical limit on increasingly many machines.

Increase PACKET_FANOUT_MAX to 64K. Expand setsockopt PACKET_FANOUT to
take an extra argument max_num_members. Also explicitly define a
fanout_args struct, instead of implicitly casting to an integer. This
documents the API and simplifies the control flow.

If max_num_members is not specified or is set to 0, then 256 is used,
same as before.

Signed-off-by: Tanner Love <tannerlove@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/if_packet.h
net/packet/af_packet.c
net/packet/internal.h