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()
289 static inline void sk_psock_set_state(struct sk_psock *psock, in sk_psock_set_state() argument
292 set_bit(bit, &psock->state); in sk_psock_set_state()
295 static inline void sk_psock_clear_state(struct sk_psock *psock, in sk_psock_clear_state() argument
298 clear_bit(bit, &psock->state); in sk_psock_clear_state()
301 static inline bool sk_psock_test_state(const struct sk_psock *psock, in sk_psock_test_state() argument
304 return test_bit(bit, &psock->state); in sk_psock_test_state()
313 static inline void drop_sk_msg(struct sk_psock *psock, struct sk_msg *msg) in drop_sk_msg() argument
316 sock_drop(psock->sk, msg->skb); in drop_sk_msg()
320 static inline void sk_psock_queue_msg(struct sk_psock *psock, in sk_psock_queue_msg() argument
323 spin_lock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
324 if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) in sk_psock_queue_msg()
325 list_add_tail(&msg->list, &psock->ingress_msg); in sk_psock_queue_msg()
327 drop_sk_msg(psock, msg); in sk_psock_queue_msg()
328 spin_unlock_bh(&psock->ingress_lock); in sk_psock_queue_msg()
331 static inline struct sk_msg *sk_psock_dequeue_msg(struct sk_psock *psock) in sk_psock_dequeue_msg() argument
335 spin_lock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
336 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_dequeue_msg()
339 spin_unlock_bh(&psock->ingress_lock); in sk_psock_dequeue_msg()
343 static inline struct sk_msg *sk_psock_peek_msg(struct sk_psock *psock) in sk_psock_peek_msg() argument
347 spin_lock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
348 msg = list_first_entry_or_null(&psock->ingress_msg, struct sk_msg, list); in sk_psock_peek_msg()
349 spin_unlock_bh(&psock->ingress_lock); in sk_psock_peek_msg()
353 static inline struct sk_msg *sk_psock_next_msg(struct sk_psock *psock, in sk_psock_next_msg() argument
358 spin_lock_bh(&psock->ingress_lock); in sk_psock_next_msg()
359 if (list_is_last(&msg->list, &psock->ingress_msg)) in sk_psock_next_msg()
363 spin_unlock_bh(&psock->ingress_lock); in sk_psock_next_msg()
367 static inline bool sk_psock_queue_empty(const struct sk_psock *psock) in sk_psock_queue_empty() argument
369 return psock ? list_empty(&psock->ingress_msg) : true; in sk_psock_queue_empty()
379 static inline void sk_psock_report_error(struct sk_psock *psock, int err) in sk_psock_report_error() argument
381 struct sock *sk = psock->sk; in sk_psock_report_error()
388 void sk_psock_stop(struct sk_psock *psock, bool wait);
391 int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
392 void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);
393 void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);
395 static inline int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_init_strp() argument
400 static inline void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_start_strp() argument
404 static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock) in sk_psock_stop_strp() argument
409 void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);
410 void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);
412 int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock,
426 struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
428 static inline void sk_psock_cork_free(struct sk_psock *psock) in sk_psock_cork_free() argument
430 if (psock->cork) { in sk_psock_cork_free()
431 sk_msg_free(psock->sk, psock->cork); in sk_psock_cork_free()
432 kfree(psock->cork); in sk_psock_cork_free()
433 psock->cork = NULL; in sk_psock_cork_free()
438 struct sk_psock *psock) in sk_psock_restore_proto() argument
440 if (psock->psock_update_sk_prot) in sk_psock_restore_proto()
441 psock->psock_update_sk_prot(sk, psock, true); in sk_psock_restore_proto()
446 struct sk_psock *psock; in sk_psock_get() local
449 psock = sk_psock(sk); in sk_psock_get()
450 if (psock && !refcount_inc_not_zero(&psock->refcnt)) in sk_psock_get()
451 psock = NULL; in sk_psock_get()
453 return psock; in sk_psock_get()
456 void sk_psock_drop(struct sock *sk, struct sk_psock *psock);
458 static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock) in sk_psock_put() argument
460 if (refcount_dec_and_test(&psock->refcnt)) in sk_psock_put()
461 sk_psock_drop(sk, psock); in sk_psock_put()
464 static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock) in sk_psock_data_ready() argument
466 if (psock->saved_data_ready) in sk_psock_data_ready()
467 psock->saved_data_ready(sk); in sk_psock_data_ready()
501 int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb);
503 static inline bool sk_psock_strp_enabled(struct sk_psock *psock) in sk_psock_strp_enabled() argument
505 if (!psock) in sk_psock_strp_enabled()
507 return !!psock->saved_data_ready; in sk_psock_strp_enabled()