Lines Matching refs:psock
102 int (*psock_update_sk_prot)(struct sock *sk, struct sk_psock *psock,
129 int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,
138 static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) in sk_msg_apply_bytes() argument
140 if (psock->apply_bytes) { in sk_msg_apply_bytes()
141 if (psock->apply_bytes < bytes) in sk_msg_apply_bytes()
142 psock->apply_bytes = 0; in sk_msg_apply_bytes()
144 psock->apply_bytes -= bytes; in sk_msg_apply_bytes()
285 static inline void sk_psock_set_state(struct sk_psock *psock, in sk_psock_set_state() argument
288 set_bit(bit, &psock->state); in sk_psock_set_state()
291 static inline void sk_psock_clear_state(struct sk_psock *psock, in sk_psock_clear_state() argument
294 clear_bit(bit, &psock->state); in sk_psock_clear_state()
297 static inline bool sk_psock_test_state(const struct sk_psock *psock, in sk_psock_test_state() argument
300 return test_bit(bit, &psock->state); in sk_psock_test_state()
309 static inline void sk_psock_queue_msg(struct sk_psock *psock, in sk_psock_queue_msg() argument
312 spin_lock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
313 if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) in sk_psock_queue_msg()
314 list_add_tail(&msg->list, &psock->ingress_msg); in sk_psock_queue_msg()
316 sk_msg_free(psock->sk, msg); in sk_psock_queue_msg()
319 spin_unlock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
322 static inline struct sk_msg *sk_psock_dequeue_msg(struct sk_psock *psock) in sk_psock_dequeue_msg() argument
326 spin_lock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
327 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_dequeue_msg()
330 spin_unlock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
334 static inline struct sk_msg *sk_psock_peek_msg(struct sk_psock *psock) in sk_psock_peek_msg() argument
338 spin_lock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
339 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_peek_msg()
340 spin_unlock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
344 static inline struct sk_msg *sk_psock_next_msg(struct sk_psock *psock, in sk_psock_next_msg() argument
349 spin_lock_bh(&psock->ingress_lock); in sk_psock_next_msg()
350 if (list_is_last(&msg->list, &psock->ingress_msg)) in sk_psock_next_msg()
354 spin_unlock_bh(&psock->ingress_lock); in sk_psock_next_msg()
358 static inline bool sk_psock_queue_empty(const struct sk_psock *psock) in sk_psock_queue_empty() argument
360 return psock ? list_empty(&psock->ingress_msg) : true; in sk_psock_queue_empty()
370 static inline void sk_psock_report_error(struct sk_psock *psock, int err) in sk_psock_report_error() argument
372 struct sock *sk = psock->sk; in sk_psock_report_error()
379 void sk_psock_stop(struct sk_psock *psock);
382 int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
383 void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);
384 void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);
386 static inline int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_init_strp() argument
391 static inline void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_start_strp() argument
395 static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_stop_strp() argument
400 void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);
401 void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);
403 int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock,
417 struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
419 static inline void sk_psock_cork_free(struct sk_psock *psock) in sk_psock_cork_free() argument
421 if (psock->cork) { in sk_psock_cork_free()
422 sk_msg_free(psock->sk, psock->cork); in sk_psock_cork_free()
423 kfree(psock->cork); in sk_psock_cork_free()
424 psock->cork = NULL; in sk_psock_cork_free()
429 struct sk_psock *psock) in sk_psock_restore_proto() argument
431 if (psock->psock_update_sk_prot) in sk_psock_restore_proto()
432 psock->psock_update_sk_prot(sk, psock, true); in sk_psock_restore_proto()
437 struct sk_psock *psock; in sk_psock_get() local
440 psock = sk_psock(sk); in sk_psock_get()
441 if (psock && !refcount_inc_not_zero(&psock->refcnt)) in sk_psock_get()
442 psock = NULL; in sk_psock_get()
444 return psock; in sk_psock_get()
447 void sk_psock_drop(struct sock *sk, struct sk_psock *psock);
449 static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock) in sk_psock_put() argument
451 if (refcount_dec_and_test(&psock->refcnt)) in sk_psock_put()
452 sk_psock_drop(sk, psock); in sk_psock_put()
455 static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock) in sk_psock_data_ready() argument
457 if (psock->saved_data_ready) in sk_psock_data_ready()
458 psock->saved_data_ready(sk); in sk_psock_data_ready()
492 int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb);
494 static inline bool sk_psock_strp_enabled(struct sk_psock *psock) in sk_psock_strp_enabled() argument
496 if (!psock) in sk_psock_strp_enabled()
498 return !!psock->saved_data_ready; in sk_psock_strp_enabled()