drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h- Extension
.h- Size
- 8998 bytes
- Lines
- 337
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct cxgb4_match_fieldstruct cxgb4_next_headerstruct cxgb4_linkstruct cxgb4_tc_u32_tablefunction cxgb4_fill_ipv4_tosfunction cxgb4_fill_ipv4_fragfunction cxgb4_fill_ipv4_protofunction cxgb4_fill_ipv4_src_ipfunction cxgb4_fill_ipv4_dst_ipfunction cxgb4_fill_ipv6_tosfunction cxgb4_fill_ipv6_protofunction cxgb4_fill_ipv6_src_ip0function cxgb4_fill_ipv6_src_ip1function cxgb4_fill_ipv6_src_ip2function cxgb4_fill_ipv6_src_ip3function cxgb4_fill_ipv6_dst_ip0function cxgb4_fill_ipv6_dst_ip1function cxgb4_fill_ipv6_dst_ip2function cxgb4_fill_ipv6_dst_ip3function cxgb4_fill_l4_ports
Annotated Snippet
struct cxgb4_match_field {
int off; /* Offset from the beginning of the header to match */
/* Fill the value/mask pair in the spec if matched */
int (*val)(struct ch_filter_specification *f, __be32 val, __be32 mask);
};
/* IPv4 match fields */
static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
f->val.tos = (ntohl(val) >> 16) & 0x000000FF;
f->mask.tos = (ntohl(mask) >> 16) & 0x000000FF;
return 0;
}
static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
u32 mask_val;
u8 frag_val;
frag_val = (ntohl(val) >> 13) & 0x00000007;
mask_val = ntohl(mask) & 0x0000FFFF;
if (frag_val == 0x1 && mask_val != 0x3FFF) { /* MF set */
f->val.frag = 1;
f->mask.frag = 1;
} else if (frag_val == 0x2 && mask_val != 0x3FFF) { /* DF set */
f->val.frag = 0;
f->mask.frag = 1;
} else {
return -EINVAL;
}
return 0;
}
static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
f->val.proto = (ntohl(val) >> 16) & 0x000000FF;
f->mask.proto = (ntohl(mask) >> 16) & 0x000000FF;
return 0;
}
static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
memcpy(&f->val.fip[0], &val, sizeof(u32));
memcpy(&f->mask.fip[0], &mask, sizeof(u32));
return 0;
}
static inline int cxgb4_fill_ipv4_dst_ip(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
memcpy(&f->val.lip[0], &val, sizeof(u32));
memcpy(&f->mask.lip[0], &mask, sizeof(u32));
return 0;
}
static const struct cxgb4_match_field cxgb4_ipv4_fields[] = {
{ .off = 0, .val = cxgb4_fill_ipv4_tos },
{ .off = 4, .val = cxgb4_fill_ipv4_frag },
{ .off = 8, .val = cxgb4_fill_ipv4_proto },
{ .off = 12, .val = cxgb4_fill_ipv4_src_ip },
{ .off = 16, .val = cxgb4_fill_ipv4_dst_ip },
{ .val = NULL }
};
/* IPv6 match fields */
static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
f->val.tos = (ntohl(val) >> 20) & 0x000000FF;
f->mask.tos = (ntohl(mask) >> 20) & 0x000000FF;
return 0;
}
static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f,
__be32 val, __be32 mask)
{
f->val.proto = (ntohl(val) >> 8) & 0x000000FF;
f->mask.proto = (ntohl(mask) >> 8) & 0x000000FF;
Annotation
- Detected declarations: `struct cxgb4_match_field`, `struct cxgb4_next_header`, `struct cxgb4_link`, `struct cxgb4_tc_u32_table`, `function cxgb4_fill_ipv4_tos`, `function cxgb4_fill_ipv4_frag`, `function cxgb4_fill_ipv4_proto`, `function cxgb4_fill_ipv4_src_ip`, `function cxgb4_fill_ipv4_dst_ip`, `function cxgb4_fill_ipv6_tos`.
- Atlas domain: Driver Families / drivers/net.
- 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.