OSDN Git Service

skmsg: Move sk_redir from TCP_SKB_CB to skb
authorCong Wang <cong.wang@bytedance.com>
Tue, 23 Feb 2021 18:49:29 +0000 (10:49 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 20:28:03 +0000 (12:28 -0800)
commite3526bb92a2084cdaec6cb2855bcec98b280426c
tree8984946e916cdcdb2f4bd2ce606f84dd3ffc7cb9
parent16137b09a66f2b75090f1e56a9ba0e27ef845ebc
skmsg: Move sk_redir from TCP_SKB_CB to skb

Currently TCP_SKB_CB() is hard-coded in skmsg code, it certainly
does not work for any other non-TCP protocols. We can move them to
skb ext, but it introduces a memory allocation on fast path.

Fortunately, we only need to a word-size to store all the information,
because the flags actually only contains 1 bit so can be just packed
into the lowest bit of the "pointer", which is stored as unsigned
long.

Inside struct sk_buff, '_skb_refdst' can be reused because skb dst is
no longer needed after ->sk_data_ready() so we can just drop it.

Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20210223184934.6054-5-xiyou.wangcong@gmail.com
include/linux/skbuff.h
include/linux/skmsg.h
include/net/tcp.h
net/core/skmsg.c
net/core/sock_map.c