drivers/net/dsa/sja1105/sja1105_static_config.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/sja1105/sja1105_static_config.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/sja1105/sja1105_static_config.c- Extension
.c- Size
- 75994 bytes
- Lines
- 1951
- 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
sja1105_static_config.hlinux/crc32.hlinux/slab.hlinux/string.hlinux/errno.h
Detected Declarations
function Copyrightfunction sja1105_unpackfunction sja1105_packingfunction sja1105_crc32function sja1105et_avb_params_entry_packingfunction sja1105pqrs_avb_params_entry_packingfunction sja1105et_general_params_entry_packingfunction sja1105pqrs_general_params_entry_packingfunction sja1110_general_params_entry_packingfunction sja1105_l2_forwarding_params_entry_packingfunction sja1110_l2_forwarding_params_entry_packingfunction sja1105_l2_forwarding_entry_packingfunction sja1110_l2_forwarding_entry_packingfunction sja1105et_l2_lookup_params_entry_packingfunction sja1105pqrs_l2_lookup_params_entry_packingfunction sja1110_l2_lookup_params_entry_packingfunction sja1105et_l2_lookup_entry_packingfunction sja1105pqrs_l2_lookup_entry_packingfunction sja1110_l2_lookup_entry_packingfunction sja1105_l2_policing_entry_packingfunction sja1110_l2_policing_entry_packingfunction sja1105et_mac_config_entry_packingfunction sja1105pqrs_mac_config_entry_packingfunction sja1110_mac_config_entry_packingfunction sja1105_schedule_entry_points_params_entry_packingfunction sja1105_schedule_entry_points_entry_packingfunction sja1110_schedule_entry_points_entry_packingfunction sja1105_schedule_params_entry_packingfunction sja1110_schedule_params_entry_packingfunction sja1105_schedule_entry_packingfunction sja1110_schedule_entry_packingfunction sja1105_vl_forwarding_params_entry_packingfunction sja1110_vl_forwarding_params_entry_packingfunction sja1105_vl_forwarding_entry_packingfunction sja1110_vl_forwarding_entry_packingfunction sja1105_vl_lookup_entry_packingfunction sja1110_vl_lookup_entry_packingfunction sja1105_vl_policing_entry_packingfunction sja1110_vl_policing_entry_packingfunction sja1105_vlan_lookup_entry_packingfunction sja1110_vlan_lookup_entry_packingfunction sja1105_xmii_params_entry_packingfunction sja1110_xmii_params_entry_packingfunction sja1105_retagging_entry_packingfunction sja1110_retagging_entry_packingfunction sja1110_pcp_remapping_entry_packingfunction sja1105_table_header_packingfunction sja1105_table_header_pack_with_crc
Annotated Snippet
if (vl_lookup[i].iscritical) {
has_critical_links = true;
break;
}
}
if (tables[BLK_IDX_VL_POLICING].entry_count == 0 &&
has_critical_links)
return SJA1105_INCORRECT_VIRTUAL_LINK_CONFIGURATION;
if (tables[BLK_IDX_VL_FORWARDING].entry_count == 0 &&
has_critical_links)
return SJA1105_INCORRECT_VIRTUAL_LINK_CONFIGURATION;
if (tables[BLK_IDX_VL_FORWARDING_PARAMS].entry_count == 0 &&
has_critical_links)
return SJA1105_INCORRECT_VIRTUAL_LINK_CONFIGURATION;
}
if (tables[BLK_IDX_L2_POLICING].entry_count == 0)
return SJA1105_MISSING_L2_POLICING_TABLE;
if (tables[BLK_IDX_VLAN_LOOKUP].entry_count == 0)
return SJA1105_MISSING_VLAN_TABLE;
if (!IS_FULL(BLK_IDX_L2_FORWARDING))
return SJA1105_MISSING_L2_FORWARDING_TABLE;
if (!IS_FULL(BLK_IDX_MAC_CONFIG))
return SJA1105_MISSING_MAC_TABLE;
if (!IS_FULL(BLK_IDX_L2_FORWARDING_PARAMS))
return SJA1105_MISSING_L2_FORWARDING_PARAMS_TABLE;
if (!IS_FULL(BLK_IDX_GENERAL_PARAMS))
return SJA1105_MISSING_GENERAL_PARAMS_TABLE;
if (!IS_FULL(BLK_IDX_XMII_PARAMS))
return SJA1105_MISSING_XMII_TABLE;
return static_config_check_memory_size(tables, max_mem);
#undef IS_FULL
}
void
sja1105_static_config_pack(void *buf, struct sja1105_static_config *config)
{
struct sja1105_table_header header = {0};
enum sja1105_blk_idx i;
char *p = buf;
int j;
sja1105_pack(p, &config->device_id, 31, 0, 4);
p += SJA1105_SIZE_DEVICE_ID;
for (i = 0; i < BLK_IDX_MAX; i++) {
const struct sja1105_table *table;
char *table_start;
table = &config->tables[i];
if (!table->entry_count)
continue;
header.block_id = blk_id_map[i];
header.len = table->entry_count *
table->ops->packed_entry_size / 4;
sja1105_table_header_pack_with_crc(p, &header);
p += SJA1105_SIZE_TABLE_HEADER;
table_start = p;
for (j = 0; j < table->entry_count; j++) {
u8 *entry_ptr = table->entries;
entry_ptr += j * table->ops->unpacked_entry_size;
memset(p, 0, table->ops->packed_entry_size);
table->ops->packing(p, entry_ptr, PACK);
p += table->ops->packed_entry_size;
}
sja1105_table_write_crc(table_start, p);
p += 4;
}
/* Final header:
* Block ID does not matter
* Length of 0 marks that header is final
* CRC will be replaced on-the-fly on "config upload"
*/
header.block_id = 0;
header.len = 0;
header.crc = 0xDEADBEEF;
memset(p, 0, SJA1105_SIZE_TABLE_HEADER);
sja1105_table_header_packing(p, &header, PACK);
Annotation
- Immediate include surface: `sja1105_static_config.h`, `linux/crc32.h`, `linux/slab.h`, `linux/string.h`, `linux/errno.h`.
- Detected declarations: `function Copyright`, `function sja1105_unpack`, `function sja1105_packing`, `function sja1105_crc32`, `function sja1105et_avb_params_entry_packing`, `function sja1105pqrs_avb_params_entry_packing`, `function sja1105et_general_params_entry_packing`, `function sja1105pqrs_general_params_entry_packing`, `function sja1110_general_params_entry_packing`, `function sja1105_l2_forwarding_params_entry_packing`.
- 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.