summaryrefslogtreecommitdiffstats
path: root/net/packet/internal.h
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2015-08-14 22:31:34 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-17 14:22:47 -0700
commit47dceb8ecdc1c3ad1818dfea3d659a05b74c3fc2 (patch)
tree6329539935535b2b5ed438612464e168b02f03ce /net/packet/internal.h
parenta1c234f95cae2d293047bb6c36e7a4840dbac815 (diff)
downloadlinux-47dceb8ecdc1c3ad1818dfea3d659a05b74c3fc2.tar.bz2
packet: add classic BPF fanout mode
Add fanout mode PACKET_FANOUT_CBPF that accepts a classic BPF program to select a socket. This avoids having to keep adding special case fanout modes. One example use case is application layer load balancing. The QUIC protocol, for instance, encodes a connection ID in UDP payload. Also add socket option SOL_PACKET/PACKET_FANOUT_DATA that updates data associated with the socket group. Fanout mode PACKET_FANOUT_CBPF is the only user so far. Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/internal.h')
-rw-r--r--net/packet/internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/packet/internal.h b/net/packet/internal.h
index e20b3e8829b8..9ee46314b7d7 100644
--- a/net/packet/internal.h
+++ b/net/packet/internal.h
@@ -79,7 +79,10 @@ struct packet_fanout {
u16 id;
u8 type;
u8 flags;
- atomic_t rr_cur;
+ union {
+ atomic_t rr_cur;
+ struct bpf_prog __rcu *bpf_prog;
+ };
struct list_head list;
struct sock *arr[PACKET_FANOUT_MAX];
spinlock_t lock;