Message ID | 20210726165304.1443836-4-john.fastabend@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | sockmap fixes picked up by stress tests | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | fail | 2 blamed authors not CCed: ast@kernel.org cong.wang@bytedance.com; 10 maintainers not CCed: yhs@fb.com kpsingh@kernel.org andrii@kernel.org cong.wang@bytedance.com kafai@fb.com ast@kernel.org lmb@cloudflare.com songliubraving@fb.com davem@davemloft.net kuba@kernel.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 69 this patch: 69 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: 'wont' may be misspelled - perhaps 'won't'? |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 69 this patch: 69 |
netdev/header_inline | fail | Link |
On Mon, Jul 26, 2021 at 09:53:04AM -0700, John Fastabend wrote: > --- a/include/linux/skmsg.h > +++ b/include/linux/skmsg.h > @@ -285,11 +285,45 @@ static inline struct sk_psock *sk_psock(const struct sock *sk) > return rcu_dereference_sk_user_data(sk); > } > > +static inline void sk_psock_set_state(struct sk_psock *psock, > + enum sk_psock_state_bits bit) > +{ > + set_bit(bit, &psock->state); > +} > + > +static inline void sk_psock_clear_state(struct sk_psock *psock, > + enum sk_psock_state_bits bit) > +{ > + clear_bit(bit, &psock->state); > +} > + > +static inline bool sk_psock_test_state(const struct sk_psock *psock, > + enum sk_psock_state_bits bit) > +{ > + return test_bit(bit, &psock->state); > +} > + > +static void sock_drop(struct sock *sk, struct sk_buff *skb) inline > +{ > + sk_drops_add(sk, skb); > + kfree_skb(skb); > +} > +
Martin KaFai Lau wrote: > On Mon, Jul 26, 2021 at 09:53:04AM -0700, John Fastabend wrote: > > --- a/include/linux/skmsg.h > > +++ b/include/linux/skmsg.h > > @@ -285,11 +285,45 @@ static inline struct sk_psock *sk_psock(const struct sock *sk) > > return rcu_dereference_sk_user_data(sk); > > } > > > > +static inline void sk_psock_set_state(struct sk_psock *psock, > > + enum sk_psock_state_bits bit) > > +{ > > + set_bit(bit, &psock->state); > > +} > > + > > +static inline void sk_psock_clear_state(struct sk_psock *psock, > > + enum sk_psock_state_bits bit) > > +{ > > + clear_bit(bit, &psock->state); > > +} > > + > > +static inline bool sk_psock_test_state(const struct sk_psock *psock, > > + enum sk_psock_state_bits bit) > > +{ > > + return test_bit(bit, &psock->state); > > +} > > + > > +static void sock_drop(struct sock *sk, struct sk_buff *skb) > inline Thanks will fix, bit surprised I didn't get a build warning for the typo.
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 96f319099744..94b4b61ba775 100644 --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -285,11 +285,45 @@ static inline struct sk_psock *sk_psock(const struct sock *sk) return rcu_dereference_sk_user_data(sk); } +static inline void sk_psock_set_state(struct sk_psock *psock, + enum sk_psock_state_bits bit) +{ + set_bit(bit, &psock->state); +} + +static inline void sk_psock_clear_state(struct sk_psock *psock, + enum sk_psock_state_bits bit) +{ + clear_bit(bit, &psock->state); +} + +static inline bool sk_psock_test_state(const struct sk_psock *psock, + enum sk_psock_state_bits bit) +{ + return test_bit(bit, &psock->state); +} + +static void sock_drop(struct sock *sk, struct sk_buff *skb) +{ + sk_drops_add(sk, skb); + kfree_skb(skb); +} + +static inline void drop_sk_msg(struct sk_psock *psock, struct sk_msg *msg) +{ + if (msg->skb) + sock_drop(psock->sk, msg->skb); + kfree(msg); +} + static inline void sk_psock_queue_msg(struct sk_psock *psock, struct sk_msg *msg) { spin_lock_bh(&psock->ingress_lock); - list_add_tail(&msg->list, &psock->ingress_msg); + if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) + list_add_tail(&msg->list, &psock->ingress_msg); + else + drop_sk_msg(psock, msg); spin_unlock_bh(&psock->ingress_lock); } @@ -406,24 +440,6 @@ static inline void sk_psock_restore_proto(struct sock *sk, psock->psock_update_sk_prot(sk, psock, true); } -static inline void sk_psock_set_state(struct sk_psock *psock, - enum sk_psock_state_bits bit) -{ - set_bit(bit, &psock->state); -} - -static inline void sk_psock_clear_state(struct sk_psock *psock, - enum sk_psock_state_bits bit) -{ - clear_bit(bit, &psock->state); -} - -static inline bool sk_psock_test_state(const struct sk_psock *psock, - enum sk_psock_state_bits bit) -{ - return test_bit(bit, &psock->state); -} - static inline struct sk_psock *sk_psock_get(struct sock *sk) { struct sk_psock *psock; diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 036cdb33a94a..2d6249b28928 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -584,12 +584,6 @@ static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb, return sk_psock_skb_ingress(psock, skb); } -static void sock_drop(struct sock *sk, struct sk_buff *skb) -{ - sk_drops_add(sk, skb); - kfree_skb(skb); -} - static void sk_psock_skb_state(struct sk_psock *psock, struct sk_psock_work_state *state, struct sk_buff *skb,