include/net/psp/types.h

Source file repositories/reference/linux-study-clean/include/net/psp/types.h

File Facts

System
Linux kernel
Corpus path
include/net/psp/types.h
Extension
.h
Size
5645 bytes
Lines
240
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

struct psphdr {
	u8	nexthdr;
	u8	hdrlen;
	u8	crypt_offset;
	u8	verfl;
	__be32	spi;
	__be64	iv;
	__be64	vc[]; /* optional */
};

#define PSP_ENCAP_HLEN (sizeof(struct udphdr) + sizeof(struct psphdr))

#define PSP_SPI_KEY_ID		GENMASK(30, 0)
#define PSP_SPI_KEY_PHASE	BIT(31)

#define PSPHDR_CRYPT_OFFSET	GENMASK(5, 0)

#define PSPHDR_VERFL_SAMPLE	BIT(7)
#define PSPHDR_VERFL_DROP	BIT(6)
#define PSPHDR_VERFL_VERSION	GENMASK(5, 2)
#define PSPHDR_VERFL_VIRT	BIT(1)
#define PSPHDR_VERFL_ONE	BIT(0)

#define PSP_HDRLEN_NOOPT	((sizeof(struct psphdr) - 8) / 8)

/**
 * struct psp_dev_config - PSP device configuration
 * @versions: PSP versions enabled on the device
 */
struct psp_dev_config {
	u32 versions;
};

/* Max number of devices that can be associated with a single PSP device.
 * Each entry consumes ~24 bytes in the netlink dev-get response, and the
 * response must fit in GENLMSG_DEFAULT_SIZE (~3.7KB).
 */
#define PSP_ASSOC_DEV_MAX	128

/**
 * struct psp_assoc_dev - wrapper for associated net_device
 * @dev_list: list node for psp_dev::assoc_dev_list
 * @assoc_dev: the associated net_device
 * @dev_tracker: tracker for the net_device reference
 */
struct psp_assoc_dev {
	struct list_head dev_list;
	struct net_device *assoc_dev;
	netdevice_tracker dev_tracker;
};

/**
 * struct psp_dev - PSP device struct
 * @main_netdev: original netdevice of this PSP device
 * @assoc_dev_list: list of psp_assoc_dev entries associated with this PSP device
 * @assoc_dev_cnt: number of entries in @assoc_dev_list
 * @ops:	driver callbacks
 * @caps:	device capabilities
 * @drv_priv:	driver priv pointer
 * @lock:	instance lock, protects all fields
 * @refcnt:	reference count for the instance
 * @id:		instance id
 * @generation:	current generation of the device key
 * @config:	current device configuration
 * @active_assocs:	list of registered associations
 * @prev_assocs:	associations which use old (but still usable)
 *			device key
 * @stale_assocs:	associations which use a rotated out key
 *
 * @stats:	statistics maintained by the core
 * @stats.rotations:	See stats attr key-rotations
 * @stats.stales:	See stats attr stale-events
 *
 * @rcu:	RCU head for freeing the structure
 */
struct psp_dev {
	struct net_device *main_netdev;
	struct list_head assoc_dev_list;
	int assoc_dev_cnt;

	struct psp_dev_ops *ops;
	struct psp_dev_caps *caps;
	void *drv_priv;

	struct mutex lock;
	refcount_t refcnt;

	u32 id;

	u8 generation;

Annotation

Implementation Notes