net/packet: make packet_fanout.arr size configurable up to 64K
[ Upstream commit 9c661b0b85444e426d3f23250305eeb16f6ffe88 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
d10c5162b4
commit
3a1c395703
@@ -2,6 +2,7 @@
|
||||
#ifndef __LINUX_IF_PACKET_H
|
||||
#define __LINUX_IF_PACKET_H
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct sockaddr_pkt {
|
||||
@@ -296,6 +297,17 @@ struct packet_mreq {
|
||||
unsigned char mr_address[8];
|
||||
};
|
||||
|
||||
struct fanout_args {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
__u16 id;
|
||||
__u16 type_flags;
|
||||
#else
|
||||
__u16 type_flags;
|
||||
__u16 id;
|
||||
#endif
|
||||
__u32 max_num_members;
|
||||
};
|
||||
|
||||
#define PACKET_MR_MULTICAST 0
|
||||
#define PACKET_MR_PROMISC 1
|
||||
#define PACKET_MR_ALLMULTI 2
|
||||
|
Reference in New Issue
Block a user