drivers/net/ethernet/netronome/nfp/bpf/main.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/bpf/main.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/netronome/nfp/bpf/main.h
Extension
.h
Size
18027 bytes
Lines
616
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nfp_app_bpf {
	struct nfp_app *app;
	struct nfp_ccm ccm;

	struct bpf_offload_dev *bpf_dev;

	unsigned int cmsg_key_sz;
	unsigned int cmsg_val_sz;

	unsigned int cmsg_cache_cnt;

	struct list_head map_list;
	unsigned int maps_in_use;
	unsigned int map_elems_in_use;

	struct rhashtable maps_neutral;

	u32 abi_version;

	struct nfp_bpf_cap_adjust_head {
		u32 flags;
		int off_min;
		int off_max;
		int guaranteed_sub;
		int guaranteed_add;
	} adjust_head;

	struct {
		u32 types;
		u32 max_maps;
		u32 max_elems;
		u32 max_key_sz;
		u32 max_val_sz;
		u32 max_elem_sz;
	} maps;

	struct {
		u32 map_lookup;
		u32 map_update;
		u32 map_delete;
		u32 perf_event_output;
	} helpers;

	bool pseudo_random;
	bool queue_select;
	bool adjust_tail;
	bool cmsg_multi_ent;
};

enum nfp_bpf_map_use {
	NFP_MAP_UNUSED = 0,
	NFP_MAP_USE_READ,
	NFP_MAP_USE_WRITE,
	NFP_MAP_USE_ATOMIC_CNT,
};

struct nfp_bpf_map_word {
	unsigned char type		:4;
	unsigned char non_zero_update	:1;
};

#define NFP_BPF_MAP_CACHE_CNT		4U
#define NFP_BPF_MAP_CACHE_TIME_NS	(250 * 1000)

/**
 * struct nfp_bpf_map - private per-map data attached to BPF maps for offload
 * @offmap:	pointer to the offloaded BPF map
 * @bpf:	back pointer to bpf app private structure
 * @tid:	table id identifying map on datapath
 *
 * @cache_lock:	protects @cache_blockers, @cache_to, @cache
 * @cache_blockers:	number of ops in flight which block caching
 * @cache_gen:	counter incremented by every blocker on exit
 * @cache_to:	time when cache will no longer be valid (ns)
 * @cache:	skb with cached response
 *
 * @l:		link on the nfp_app_bpf->map_list list
 * @use_map:	map of how the value is used (in 4B chunks)
 */
struct nfp_bpf_map {
	struct bpf_offloaded_map *offmap;
	struct nfp_app_bpf *bpf;
	u32 tid;

	spinlock_t cache_lock;
	u32 cache_blockers;
	u32 cache_gen;
	u64 cache_to;
	struct sk_buff *cache;

Annotation

Implementation Notes