Lines Matching refs:psock

114 	int  (*psock_update_sk_prot)(struct sock *sk, struct sk_psock *psock,
142 int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,
151 static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) in sk_msg_apply_bytes() argument
153 if (psock->apply_bytes) { in sk_msg_apply_bytes()
154 if (psock->apply_bytes < bytes) in sk_msg_apply_bytes()
155 psock->apply_bytes = 0; in sk_msg_apply_bytes()
157 psock->apply_bytes -= bytes; in sk_msg_apply_bytes()
298 static inline void sk_psock_set_state(struct sk_psock *psock, in sk_psock_set_state() argument
301 set_bit(bit, &psock->state); in sk_psock_set_state()
304 static inline void sk_psock_clear_state(struct sk_psock *psock, in sk_psock_clear_state() argument
307 clear_bit(bit, &psock->state); in sk_psock_clear_state()
310 static inline bool sk_psock_test_state(const struct sk_psock *psock, in sk_psock_test_state() argument
313 return test_bit(bit, &psock->state); in sk_psock_test_state()
322 static inline bool sk_psock_queue_msg(struct sk_psock *psock, in sk_psock_queue_msg() argument
327 spin_lock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
328 if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) { in sk_psock_queue_msg()
329 list_add_tail(&msg->list, &psock->ingress_msg); in sk_psock_queue_msg()
332 sk_msg_free(psock->sk, msg); in sk_psock_queue_msg()
336 spin_unlock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
340 static inline struct sk_msg *sk_psock_dequeue_msg(struct sk_psock *psock) in sk_psock_dequeue_msg() argument
344 spin_lock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
345 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_dequeue_msg()
348 spin_unlock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
352 static inline struct sk_msg *sk_psock_peek_msg(struct sk_psock *psock) in sk_psock_peek_msg() argument
356 spin_lock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
357 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_peek_msg()
358 spin_unlock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
362 static inline struct sk_msg *sk_psock_next_msg(struct sk_psock *psock, in sk_psock_next_msg() argument
367 spin_lock_bh(&psock->ingress_lock); in sk_psock_next_msg()
368 if (list_is_last(&msg->list, &psock->ingress_msg)) in sk_psock_next_msg()
372 spin_unlock_bh(&psock->ingress_lock); in sk_psock_next_msg()
376 static inline bool sk_psock_queue_empty(const struct sk_psock *psock) in sk_psock_queue_empty() argument
378 return psock ? list_empty(&psock->ingress_msg) : true; in sk_psock_queue_empty()
388 static inline void sk_psock_report_error(struct sk_psock *psock, int err) in sk_psock_report_error() argument
390 struct sock *sk = psock->sk; in sk_psock_report_error()
397 void sk_psock_stop(struct sk_psock *psock);
400 int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
401 void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);
402 void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);
404 static inline int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_init_strp() argument
409 static inline void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_start_strp() argument
413 static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_stop_strp() argument
418 void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);
419 void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);
421 int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock,
438 struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
440 static inline void sk_psock_cork_free(struct sk_psock *psock) in sk_psock_cork_free() argument
442 if (psock->cork) { in sk_psock_cork_free()
443 sk_msg_free(psock->sk, psock->cork); in sk_psock_cork_free()
444 kfree(psock->cork); in sk_psock_cork_free()
445 psock->cork = NULL; in sk_psock_cork_free()
450 struct sk_psock *psock) in sk_psock_restore_proto() argument
452 if (psock->psock_update_sk_prot) in sk_psock_restore_proto()
453 psock->psock_update_sk_prot(sk, psock, true); in sk_psock_restore_proto()
458 struct sk_psock *psock; in sk_psock_get() local
461 psock = sk_psock(sk); in sk_psock_get()
462 if (psock && !refcount_inc_not_zero(&psock->refcnt)) in sk_psock_get()
463 psock = NULL; in sk_psock_get()
465 return psock; in sk_psock_get()
468 void sk_psock_drop(struct sock *sk, struct sk_psock *psock);
470 static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock) in sk_psock_put() argument
472 if (refcount_dec_and_test(&psock->refcnt)) in sk_psock_put()
473 sk_psock_drop(sk, psock); in sk_psock_put()
476 static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock) in sk_psock_data_ready() argument
479 if (psock->saved_data_ready) in sk_psock_data_ready()
480 psock->saved_data_ready(sk); in sk_psock_data_ready()
515 int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb);
517 static inline bool sk_psock_strp_enabled(struct sk_psock *psock) in sk_psock_strp_enabled() argument
519 if (!psock) in sk_psock_strp_enabled()
521 return !!psock->saved_data_ready; in sk_psock_strp_enabled()