projects
/
linux-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sock_map: Rename skb_parser and skb_verdict
[linux-block.git]
/
net
/
core
/
sock_map.c
diff --git
a/net/core/sock_map.c
b/net/core/sock_map.c
index d758fb83c8841d35737c25c6a42f338468b95a6f..69785070f02d7ee54554b0481e168258a752e94b 100644
(file)
--- a/
net/core/sock_map.c
+++ b/
net/core/sock_map.c
@@
-148,9
+148,9
@@
static void sock_map_del_link(struct sock *sk,
struct bpf_map *map = link->map;
struct bpf_stab *stab = container_of(map, struct bpf_stab,
map);
struct bpf_map *map = link->map;
struct bpf_stab *stab = container_of(map, struct bpf_stab,
map);
- if (psock->
parser.enabled && stab->progs.skb
_parser)
+ if (psock->
saved_data_ready && stab->progs.stream
_parser)
strp_stop = true;
strp_stop = true;
- if (psock->
parser.enabled && stab->progs.skb
_verdict)
+ if (psock->
saved_data_ready && stab->progs.stream
_verdict)
verdict_stop = true;
list_del(&link->list);
sk_psock_free_link(link);
verdict_stop = true;
list_del(&link->list);
sk_psock_free_link(link);
@@
-224,23
+224,23
@@
out:
static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
struct sock *sk)
{
static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
struct sock *sk)
{
- struct bpf_prog *msg_parser, *s
kb_parser, *skb
_verdict;
+ struct bpf_prog *msg_parser, *s
tream_parser, *stream
_verdict;
struct sk_psock *psock;
int ret;
struct sk_psock *psock;
int ret;
- s
kb_verdict = READ_ONCE(progs->skb
_verdict);
- if (s
kb
_verdict) {
- s
kb_verdict = bpf_prog_inc_not_zero(skb
_verdict);
- if (IS_ERR(s
kb
_verdict))
- return PTR_ERR(s
kb
_verdict);
+ s
tream_verdict = READ_ONCE(progs->stream
_verdict);
+ if (s
tream
_verdict) {
+ s
tream_verdict = bpf_prog_inc_not_zero(stream
_verdict);
+ if (IS_ERR(s
tream
_verdict))
+ return PTR_ERR(s
tream
_verdict);
}
}
- s
kb_parser = READ_ONCE(progs->skb
_parser);
- if (s
kb
_parser) {
- s
kb_parser = bpf_prog_inc_not_zero(skb
_parser);
- if (IS_ERR(s
kb
_parser)) {
- ret = PTR_ERR(s
kb
_parser);
- goto out_put_s
kb
_verdict;
+ s
tream_parser = READ_ONCE(progs->stream
_parser);
+ if (s
tream
_parser) {
+ s
tream_parser = bpf_prog_inc_not_zero(stream
_parser);
+ if (IS_ERR(s
tream
_parser)) {
+ ret = PTR_ERR(s
tream
_parser);
+ goto out_put_s
tream
_verdict;
}
}
}
}
@@
-249,7
+249,7
@@
static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
msg_parser = bpf_prog_inc_not_zero(msg_parser);
if (IS_ERR(msg_parser)) {
ret = PTR_ERR(msg_parser);
msg_parser = bpf_prog_inc_not_zero(msg_parser);
if (IS_ERR(msg_parser)) {
ret = PTR_ERR(msg_parser);
- goto out_put_s
kb
_parser;
+ goto out_put_s
tream
_parser;
}
}
}
}
@@
-261,8
+261,8
@@
static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
if (psock) {
if ((msg_parser && READ_ONCE(psock->progs.msg_parser)) ||
if (psock) {
if ((msg_parser && READ_ONCE(psock->progs.msg_parser)) ||
- (s
kb_parser && READ_ONCE(psock->progs.skb
_parser)) ||
- (s
kb_verdict && READ_ONCE(psock->progs.skb
_verdict))) {
+ (s
tream_parser && READ_ONCE(psock->progs.stream
_parser)) ||
+ (s
tream_verdict && READ_ONCE(psock->progs.stream
_verdict))) {
sk_psock_put(sk, psock);
ret = -EBUSY;
goto out_progs;
sk_psock_put(sk, psock);
ret = -EBUSY;
goto out_progs;
@@
-283,15
+283,15
@@
static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
goto out_drop;
write_lock_bh(&sk->sk_callback_lock);
goto out_drop;
write_lock_bh(&sk->sk_callback_lock);
- if (s
kb_parser && skb_verdict && !psock->parser.enabled
) {
+ if (s
tream_parser && stream_verdict && !psock->saved_data_ready
) {
ret = sk_psock_init_strp(sk, psock);
if (ret)
goto out_unlock_drop;
ret = sk_psock_init_strp(sk, psock);
if (ret)
goto out_unlock_drop;
- psock_set_prog(&psock->progs.s
kb_verdict, skb
_verdict);
- psock_set_prog(&psock->progs.s
kb_parser, skb
_parser);
+ psock_set_prog(&psock->progs.s
tream_verdict, stream
_verdict);
+ psock_set_prog(&psock->progs.s
tream_parser, stream
_parser);
sk_psock_start_strp(sk, psock);
sk_psock_start_strp(sk, psock);
- } else if (!s
kb_parser && skb_verdict && !psock->parser.enabled
) {
- psock_set_prog(&psock->progs.s
kb_verdict, skb
_verdict);
+ } else if (!s
tream_parser && stream_verdict && !psock->saved_data_ready
) {
+ psock_set_prog(&psock->progs.s
tream_verdict, stream
_verdict);
sk_psock_start_verdict(sk,psock);
}
write_unlock_bh(&sk->sk_callback_lock);
sk_psock_start_verdict(sk,psock);
}
write_unlock_bh(&sk->sk_callback_lock);
@@
-303,12
+303,12
@@
out_drop:
out_progs:
if (msg_parser)
bpf_prog_put(msg_parser);
out_progs:
if (msg_parser)
bpf_prog_put(msg_parser);
-out_put_s
kb
_parser:
- if (s
kb
_parser)
- bpf_prog_put(s
kb
_parser);
-out_put_s
kb
_verdict:
- if (s
kb
_verdict)
- bpf_prog_put(s
kb
_verdict);
+out_put_s
tream
_parser:
+ if (s
tream
_parser)
+ bpf_prog_put(s
tream
_parser);
+out_put_s
tream
_verdict:
+ if (s
tream
_verdict)
+ bpf_prog_put(s
tream
_verdict);
return ret;
}
return ret;
}
@@
-657,7
+657,6
@@
const struct bpf_func_proto bpf_sock_map_update_proto = {
BPF_CALL_4(bpf_sk_redirect_map, struct sk_buff *, skb,
struct bpf_map *, map, u32, key, u64, flags)
{
BPF_CALL_4(bpf_sk_redirect_map, struct sk_buff *, skb,
struct bpf_map *, map, u32, key, u64, flags)
{
- struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);
struct sock *sk;
if (unlikely(flags & ~(BPF_F_INGRESS)))
struct sock *sk;
if (unlikely(flags & ~(BPF_F_INGRESS)))
@@
-667,8
+666,7
@@
BPF_CALL_4(bpf_sk_redirect_map, struct sk_buff *, skb,
if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
return SK_DROP;
if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
return SK_DROP;
- tcb->bpf.flags = flags;
- tcb->bpf.sk_redir = sk;
+ skb_bpf_set_redir(skb, sk, flags & BPF_F_INGRESS);
return SK_PASS;
}
return SK_PASS;
}
@@
-1250,7
+1248,6
@@
const struct bpf_func_proto bpf_sock_hash_update_proto = {
BPF_CALL_4(bpf_sk_redirect_hash, struct sk_buff *, skb,
struct bpf_map *, map, void *, key, u64, flags)
{
BPF_CALL_4(bpf_sk_redirect_hash, struct sk_buff *, skb,
struct bpf_map *, map, void *, key, u64, flags)
{
- struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);
struct sock *sk;
if (unlikely(flags & ~(BPF_F_INGRESS)))
struct sock *sk;
if (unlikely(flags & ~(BPF_F_INGRESS)))
@@
-1260,8
+1257,7
@@
BPF_CALL_4(bpf_sk_redirect_hash, struct sk_buff *, skb,
if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
return SK_DROP;
if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
return SK_DROP;
- tcb->bpf.flags = flags;
- tcb->bpf.sk_redir = sk;
+ skb_bpf_set_redir(skb, sk, flags & BPF_F_INGRESS);
return SK_PASS;
}
return SK_PASS;
}
@@
-1461,11
+1457,13
@@
int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog,
case BPF_SK_MSG_VERDICT:
pprog = &progs->msg_parser;
break;
case BPF_SK_MSG_VERDICT:
pprog = &progs->msg_parser;
break;
+#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)
case BPF_SK_SKB_STREAM_PARSER:
case BPF_SK_SKB_STREAM_PARSER:
- pprog = &progs->s
kb
_parser;
+ pprog = &progs->s
tream
_parser;
break;
break;
+#endif
case BPF_SK_SKB_STREAM_VERDICT:
case BPF_SK_SKB_STREAM_VERDICT:
- pprog = &progs->s
kb
_verdict;
+ pprog = &progs->s
tream
_verdict;
break;
default:
return -EOPNOTSUPP;
break;
default:
return -EOPNOTSUPP;