drivers/net/ethernet/intel/ice/ice_switch.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_switch.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/ice/ice_switch.c
Extension
.c
Size
189295 bytes
Lines
6655
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 ice_dummy_pkt_offsets {
	enum ice_protocol_type type;
	u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */
};

struct ice_dummy_pkt_profile {
	const struct ice_dummy_pkt_offsets *offsets;
	const u8 *pkt;
	u32 match;
	u16 pkt_len;
	u16 offsets_len;
};

#define ICE_DECLARE_PKT_OFFSETS(type)					\
	static const struct ice_dummy_pkt_offsets			\
	ice_dummy_##type##_packet_offsets[]

#define ICE_DECLARE_PKT_TEMPLATE(type)					\
	static const u8 ice_dummy_##type##_packet[]

#define ICE_PKT_PROFILE(type, m) {					\
	.match		= (m),						\
	.pkt		= ice_dummy_##type##_packet,			\
	.pkt_len	= sizeof(ice_dummy_##type##_packet),		\
	.offsets	= ice_dummy_##type##_packet_offsets,		\
	.offsets_len	= sizeof(ice_dummy_##type##_packet_offsets),	\
}

ICE_DECLARE_PKT_OFFSETS(vlan) = {
	{ ICE_VLAN_OFOS,        12 },
};

ICE_DECLARE_PKT_TEMPLATE(vlan) = {
	0x81, 0x00, 0x00, 0x00, /* ICE_VLAN_OFOS 12 */
};

ICE_DECLARE_PKT_OFFSETS(qinq) = {
	{ ICE_VLAN_EX,          12 },
	{ ICE_VLAN_IN,          16 },
};

ICE_DECLARE_PKT_TEMPLATE(qinq) = {
	0x91, 0x00, 0x00, 0x00, /* ICE_VLAN_EX 12 */
	0x81, 0x00, 0x00, 0x00, /* ICE_VLAN_IN 16 */
};

ICE_DECLARE_PKT_OFFSETS(gre_tcp) = {
	{ ICE_MAC_OFOS,		0 },
	{ ICE_ETYPE_OL,		12 },
	{ ICE_IPV4_OFOS,	14 },
	{ ICE_NVGRE,		34 },
	{ ICE_MAC_IL,		42 },
	{ ICE_ETYPE_IL,		54 },
	{ ICE_IPV4_IL,		56 },
	{ ICE_TCP_IL,		76 },
	{ ICE_PROTOCOL_LAST,	0 },
};

ICE_DECLARE_PKT_TEMPLATE(gre_tcp) = {
	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_OFOS 0 */
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,

	0x08, 0x00,		/* ICE_ETYPE_OL 12 */

	0x45, 0x00, 0x00, 0x3E,	/* ICE_IPV4_OFOS 14 */
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x2F, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,

	0x80, 0x00, 0x65, 0x58,	/* ICE_NVGRE 34 */
	0x00, 0x00, 0x00, 0x00,

	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_IL 42 */
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,

	0x08, 0x00,		/* ICE_ETYPE_IL 54 */

	0x45, 0x00, 0x00, 0x14,	/* ICE_IPV4_IL 56 */
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x06, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,

	0x00, 0x00, 0x00, 0x00,	/* ICE_TCP_IL 76 */
	0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00,
	0x50, 0x02, 0x20, 0x00,

Annotation

Implementation Notes