Lines Matching refs:psock
103 int (*psock_update_sk_prot)(struct sock *sk, struct sk_psock *psock,
130 int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,
139 static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) in sk_msg_apply_bytes() argument
141 if (psock->apply_bytes) { in sk_msg_apply_bytes()
142 if (psock->apply_bytes < bytes) in sk_msg_apply_bytes()
143 psock->apply_bytes = 0; in sk_msg_apply_bytes()
145 psock->apply_bytes -= bytes; in sk_msg_apply_bytes()
286 static inline void sk_psock_set_state(struct sk_psock *psock, in sk_psock_set_state() argument
289 set_bit(bit, &psock->state); in sk_psock_set_state()
292 static inline void sk_psock_clear_state(struct sk_psock *psock, in sk_psock_clear_state() argument
295 clear_bit(bit, &psock->state); in sk_psock_clear_state()
298 static inline bool sk_psock_test_state(const struct sk_psock *psock, in sk_psock_test_state() argument
301 return test_bit(bit, &psock->state); in sk_psock_test_state()
310 static inline void sk_psock_queue_msg(struct sk_psock *psock, in sk_psock_queue_msg() argument
313 spin_lock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
314 if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) in sk_psock_queue_msg()
315 list_add_tail(&msg->list, &psock->ingress_msg); in sk_psock_queue_msg()
317 sk_msg_free(psock->sk, msg); in sk_psock_queue_msg()
320 spin_unlock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
323 static inline struct sk_msg *sk_psock_dequeue_msg(struct sk_psock *psock) in sk_psock_dequeue_msg() argument
327 spin_lock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
328 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_dequeue_msg()
331 spin_unlock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
335 static inline struct sk_msg *sk_psock_peek_msg(struct sk_psock *psock) in sk_psock_peek_msg() argument
339 spin_lock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
340 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_peek_msg()
341 spin_unlock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
345 static inline struct sk_msg *sk_psock_next_msg(struct sk_psock *psock, in sk_psock_next_msg() argument
350 spin_lock_bh(&psock->ingress_lock); in sk_psock_next_msg()
351 if (list_is_last(&msg->list, &psock->ingress_msg)) in sk_psock_next_msg()
355 spin_unlock_bh(&psock->ingress_lock); in sk_psock_next_msg()
359 static inline bool sk_psock_queue_empty(const struct sk_psock *psock) in sk_psock_queue_empty() argument
361 return psock ? list_empty(&psock->ingress_msg) : true; in sk_psock_queue_empty()
371 static inline void sk_psock_report_error(struct sk_psock *psock, int err) in sk_psock_report_error() argument
373 struct sock *sk = psock->sk; in sk_psock_report_error()
380 void sk_psock_stop(struct sk_psock *psock);
383 int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
384 void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);
385 void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);
387 static inline int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_init_strp() argument
392 static inline void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_start_strp() argument
396 static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_stop_strp() argument
401 void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);
402 void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);
404 int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock,
418 struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
420 static inline void sk_psock_cork_free(struct sk_psock *psock) in sk_psock_cork_free() argument
422 if (psock->cork) { in sk_psock_cork_free()
423 sk_msg_free(psock->sk, psock->cork); in sk_psock_cork_free()
424 kfree(psock->cork); in sk_psock_cork_free()
425 psock->cork = NULL; in sk_psock_cork_free()
430 struct sk_psock *psock) in sk_psock_restore_proto() argument
432 if (psock->psock_update_sk_prot) in sk_psock_restore_proto()
433 psock->psock_update_sk_prot(sk, psock, true); in sk_psock_restore_proto()
438 struct sk_psock *psock; in sk_psock_get() local
441 psock = sk_psock(sk); in sk_psock_get()
442 if (psock && !refcount_inc_not_zero(&psock->refcnt)) in sk_psock_get()
443 psock = NULL; in sk_psock_get()
445 return psock; in sk_psock_get()
448 void sk_psock_drop(struct sock *sk, struct sk_psock *psock);
450 static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock) in sk_psock_put() argument
452 if (refcount_dec_and_test(&psock->refcnt)) in sk_psock_put()
453 sk_psock_drop(sk, psock); in sk_psock_put()
456 static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock) in sk_psock_data_ready() argument
458 if (psock->saved_data_ready) in sk_psock_data_ready()
459 psock->saved_data_ready(sk); in sk_psock_data_ready()
493 int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb);
495 static inline bool sk_psock_strp_enabled(struct sk_psock *psock) in sk_psock_strp_enabled() argument
497 if (!psock) in sk_psock_strp_enabled()
499 return !!psock->saved_data_ready; in sk_psock_strp_enabled()