File Index
Files and directories
Sign in
FILE

psp.h

File preview with syntax highlighting.

linux-6.19.14/net/psp/psp.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2
 3#ifndef __PSP_PSP_H
 4#define __PSP_PSP_H
 5
 6#include <linux/list.h>
 7#include <linux/lockdep.h>
 8#include <linux/mutex.h>
 9#include <net/netns/generic.h>
10#include <net/psp.h>
11#include <net/sock.h>
12
13extern struct xarray psp_devs;
14extern struct mutex psp_devs_lock;
15
16void psp_dev_free(struct psp_dev *psd);
17int psp_dev_check_access(struct psp_dev *psd, struct net *net);
18
19void psp_nl_notify_dev(struct psp_dev *psd, u32 cmd);
20
21struct psp_assoc *psp_assoc_create(struct psp_dev *psd);
22struct psp_dev *psp_dev_get_for_sock(struct sock *sk);
23void psp_dev_tx_key_del(struct psp_dev *psd, struct psp_assoc *pas);
24int psp_sock_assoc_set_rx(struct sock *sk, struct psp_assoc *pas,
25			  struct psp_key_parsed *key,
26			  struct netlink_ext_ack *extack);
27int psp_sock_assoc_set_tx(struct sock *sk, struct psp_dev *psd,
28			  u32 version, struct psp_key_parsed *key,
29			  struct netlink_ext_ack *extack);
30void psp_assocs_key_rotated(struct psp_dev *psd);
31
32static inline void psp_dev_get(struct psp_dev *psd)
33{
34	refcount_inc(&psd->refcnt);
35}
36
37static inline bool psp_dev_tryget(struct psp_dev *psd)
38{
39	return refcount_inc_not_zero(&psd->refcnt);
40}
41
42static inline void psp_dev_put(struct psp_dev *psd)
43{
44	if (refcount_dec_and_test(&psd->refcnt))
45		psp_dev_free(psd);
46}
47
48static inline bool psp_dev_is_registered(struct psp_dev *psd)
49{
50	lockdep_assert_held(&psd->lock);
51	return !!psd->ops;
52}
53
54#endif /* __PSP_PSP_H */
~/ Read-only file preview.