net/netfilter/nft_set_pipapo.h
Source file repositories/reference/linux-study-clean/net/netfilter/nft_set_pipapo.h
File Facts
- System
- Linux kernel
- Corpus path
net/netfilter/nft_set_pipapo.h- Extension
.h- Size
- 9702 bytes
- Lines
- 302
- 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.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/log2.hnet/ipv6.h
Detected Declarations
struct nft_pipapo_fieldstruct nft_pipapo_scratchstruct nft_pipapo_matchstruct nft_pipapostruct nft_pipapo_elemstruct nft_pipapo_elemfunction pipapo_and_field_buckets_4bitfunction pipapo_and_field_buckets_8bitfunction pipapo_estimate_sizefunction pipapo_resmap_init
Annotated Snippet
struct nft_pipapo_field {
unsigned int rules;
unsigned int bsize;
unsigned int rules_alloc;
u8 groups;
u8 bb;
unsigned long *lt;
union nft_pipapo_map_bucket *mt;
};
/**
* struct nft_pipapo_scratch - percpu data used for lookup and matching
* @bh_lock: PREEMPT_RT local spinlock
* @map_index: Current working bitmap index, toggled between field matches
* @__map: store partial matching results during lookup
*/
struct nft_pipapo_scratch {
local_lock_t bh_lock;
u8 map_index;
unsigned long __map[];
};
/**
* struct nft_pipapo_match - Data used for lookup and matching
* @field_count: Amount of fields in set
* @bsize_max: Maximum lookup table bucket size of all fields, in longs
* @scratch: Preallocated per-CPU maps for partial matching results
* @rcu: Matching data is swapped on commits
* @f: Fields, with lookup and mapping tables
*/
struct nft_pipapo_match {
u8 field_count;
unsigned int bsize_max;
struct nft_pipapo_scratch * __percpu *scratch;
struct rcu_head rcu;
struct nft_pipapo_field f[] __counted_by(field_count);
};
/**
* struct nft_pipapo - Representation of a set
* @match: Currently in-use matching data
* @clone: Copy where pending insertions and deletions are kept
* @width: Total bytes to be matched for one packet, including padding
* @last_gc: Timestamp of last garbage collection run, jiffies
* @gc_head: list of nft_trans_gc to queue up for mem reclaim
*/
struct nft_pipapo {
struct nft_pipapo_match __rcu *match;
struct nft_pipapo_match *clone;
int width;
unsigned long last_gc;
struct list_head gc_head;
};
struct nft_pipapo_elem;
/**
* struct nft_pipapo_elem - API-facing representation of single set element
* @priv: element placeholder
* @ext: nftables API extensions
*/
struct nft_pipapo_elem {
struct nft_elem_priv priv;
struct nft_set_ext ext;
};
int pipapo_refill(unsigned long *map, unsigned int len, unsigned int rules,
unsigned long *dst,
const union nft_pipapo_map_bucket *mt, bool match_only);
/**
* pipapo_and_field_buckets_4bit() - Intersect 4-bit buckets
* @f: Field including lookup table
* @dst: Area to store result
* @data: Input data selecting table buckets
*/
static inline void pipapo_and_field_buckets_4bit(const struct nft_pipapo_field *f,
unsigned long *dst,
const u8 *data)
{
unsigned long *lt = NFT_PIPAPO_LT_ALIGN(f->lt);
int group;
for (group = 0; group < f->groups; group += BITS_PER_BYTE / 4, data++) {
u8 v;
v = *data >> 4;
__bitmap_and(dst, dst, lt + v * f->bsize,
f->bsize * BITS_PER_LONG);
lt += f->bsize * NFT_PIPAPO_BUCKETS(4);
Annotation
- Immediate include surface: `linux/log2.h`, `net/ipv6.h`.
- Detected declarations: `struct nft_pipapo_field`, `struct nft_pipapo_scratch`, `struct nft_pipapo_match`, `struct nft_pipapo`, `struct nft_pipapo_elem`, `struct nft_pipapo_elem`, `function pipapo_and_field_buckets_4bit`, `function pipapo_and_field_buckets_8bit`, `function pipapo_estimate_size`, `function pipapo_resmap_init`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.