drivers/net/dsa/bcm_sf2_cfp.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/bcm_sf2_cfp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/bcm_sf2_cfp.c- Extension
.c- Size
- 33921 bytes
- Lines
- 1339
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/list.hlinux/ethtool.hlinux/if_ether.hlinux/in.hlinux/netdevice.hnet/dsa.hlinux/bitmap.hnet/flow_offload.hnet/switchdev.huapi/linux/if_bridge.hbcm_sf2.hbcm_sf2_regs.h
Detected Declarations
struct cfp_rulestruct cfp_udf_slice_layoutstruct cfp_udf_layoutfunction bcm_sf2_get_num_udf_slicesfunction udf_upper_bitsfunction udf_lower_bitsfunction bcm_sf2_get_slice_numberfunction bcm_sf2_cfp_udf_setfunction bcm_sf2_cfp_opfunction bcm_sf2_cfp_rule_addr_setfunction bcm_sf2_cfp_rule_sizefunction bcm_sf2_cfp_act_pol_setfunction bcm_sf2_cfp_slice_ipv4function bcm_sf2_cfp_ipv4_rule_setfunction bcm_sf2_cfp_slice_ipv6function list_for_each_entryfunction bcm_sf2_cfp_rule_cmpfunction list_for_each_entryfunction bcm_sf2_cfp_ipv6_rule_setfunction bcm_sf2_cfp_rule_insertfunction bcm_sf2_cfp_rule_setfunction bcm_sf2_cfp_rule_del_onefunction bcm_sf2_cfp_rule_removefunction bcm_sf2_cfp_rule_delfunction bcm_sf2_invert_masksfunction bcm_sf2_cfp_rule_getfunction bcm_sf2_cfp_rule_get_allfunction for_each_set_bit_fromfunction bcm_sf2_get_rxnfcfunction bcm_sf2_set_rxnfcfunction bcm_sf2_cfp_rstfunction bcm_sf2_cfp_exitfunction bcm_sf2_cfp_resumefunction list_for_each_entryfunction bcm_sf2_cfp_get_stringsfunction bcm_sf2_cfp_get_ethtool_statsfunction bcm_sf2_cfp_get_sset_count
Annotated Snippet
struct cfp_rule {
int port;
struct ethtool_rx_flow_spec fs;
struct list_head next;
};
struct cfp_udf_slice_layout {
u8 slices[UDFS_PER_SLICE];
u32 mask_value;
u32 base_offset;
};
struct cfp_udf_layout {
struct cfp_udf_slice_layout udfs[UDF_NUM_SLICES];
};
static const u8 zero_slice[UDFS_PER_SLICE] = { };
/* UDF slices layout for a TCPv4/UDPv4 specification */
static const struct cfp_udf_layout udf_tcpip4_layout = {
.udfs = {
[1] = {
.slices = {
/* End of L2, byte offset 12, src IP[0:15] */
CFG_UDF_EOL2 | 6,
/* End of L2, byte offset 14, src IP[16:31] */
CFG_UDF_EOL2 | 7,
/* End of L2, byte offset 16, dst IP[0:15] */
CFG_UDF_EOL2 | 8,
/* End of L2, byte offset 18, dst IP[16:31] */
CFG_UDF_EOL2 | 9,
/* End of L3, byte offset 0, src port */
CFG_UDF_EOL3 | 0,
/* End of L3, byte offset 2, dst port */
CFG_UDF_EOL3 | 1,
0, 0, 0
},
.mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
.base_offset = CORE_UDF_0_A_0_8_PORT_0 + UDF_SLICE_OFFSET,
},
},
};
/* UDF slices layout for a TCPv6/UDPv6 specification */
static const struct cfp_udf_layout udf_tcpip6_layout = {
.udfs = {
[0] = {
.slices = {
/* End of L2, byte offset 8, src IP[0:15] */
CFG_UDF_EOL2 | 4,
/* End of L2, byte offset 10, src IP[16:31] */
CFG_UDF_EOL2 | 5,
/* End of L2, byte offset 12, src IP[32:47] */
CFG_UDF_EOL2 | 6,
/* End of L2, byte offset 14, src IP[48:63] */
CFG_UDF_EOL2 | 7,
/* End of L2, byte offset 16, src IP[64:79] */
CFG_UDF_EOL2 | 8,
/* End of L2, byte offset 18, src IP[80:95] */
CFG_UDF_EOL2 | 9,
/* End of L2, byte offset 20, src IP[96:111] */
CFG_UDF_EOL2 | 10,
/* End of L2, byte offset 22, src IP[112:127] */
CFG_UDF_EOL2 | 11,
/* End of L3, byte offset 0, src port */
CFG_UDF_EOL3 | 0,
},
.mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
.base_offset = CORE_UDF_0_B_0_8_PORT_0,
},
[3] = {
.slices = {
/* End of L2, byte offset 24, dst IP[0:15] */
CFG_UDF_EOL2 | 12,
/* End of L2, byte offset 26, dst IP[16:31] */
CFG_UDF_EOL2 | 13,
/* End of L2, byte offset 28, dst IP[32:47] */
CFG_UDF_EOL2 | 14,
/* End of L2, byte offset 30, dst IP[48:63] */
CFG_UDF_EOL2 | 15,
/* End of L2, byte offset 32, dst IP[64:79] */
CFG_UDF_EOL2 | 16,
/* End of L2, byte offset 34, dst IP[80:95] */
CFG_UDF_EOL2 | 17,
/* End of L2, byte offset 36, dst IP[96:111] */
CFG_UDF_EOL2 | 18,
/* End of L2, byte offset 38, dst IP[112:127] */
CFG_UDF_EOL2 | 19,
/* End of L3, byte offset 2, dst port */
CFG_UDF_EOL3 | 1,
Annotation
- Immediate include surface: `linux/list.h`, `linux/ethtool.h`, `linux/if_ether.h`, `linux/in.h`, `linux/netdevice.h`, `net/dsa.h`, `linux/bitmap.h`, `net/flow_offload.h`.
- Detected declarations: `struct cfp_rule`, `struct cfp_udf_slice_layout`, `struct cfp_udf_layout`, `function bcm_sf2_get_num_udf_slices`, `function udf_upper_bits`, `function udf_lower_bits`, `function bcm_sf2_get_slice_number`, `function bcm_sf2_cfp_udf_set`, `function bcm_sf2_cfp_op`, `function bcm_sf2_cfp_rule_addr_set`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.