drivers/net/ethernet/intel/i40e/i40e_ddp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_ddp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/i40e/i40e_ddp.c- Extension
.c- Size
- 14505 bytes
- Lines
- 500
- 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.
- 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/firmware.hi40e.h
Detected Declarations
struct i40e_ddp_profile_liststruct i40e_ddp_old_profile_listfunction i40e_ddp_profiles_eqfunction i40e_ddp_does_profile_existfunction i40e_ddp_profiles_overlapfunction i40e_ddp_does_profile_overlapfunction i40e_add_pinfofunction i40e_del_pinfofunction i40e_ddp_is_pkg_hdr_validfunction i40e_ddp_loadfunction i40e_ddp_restorefunction i40e_ddp_flash
Annotated Snippet
struct i40e_ddp_profile_list {
u32 p_count;
struct i40e_profile_info p_info[];
};
struct i40e_ddp_old_profile_list {
struct list_head list;
size_t old_ddp_size;
u8 old_ddp_buf[];
};
/**
* i40e_ddp_profiles_eq - checks if DDP profiles are the equivalent
* @a: new profile info
* @b: old profile info
*
* checks if DDP profiles are the equivalent.
* Returns true if profiles are the same.
**/
static bool i40e_ddp_profiles_eq(struct i40e_profile_info *a,
struct i40e_profile_info *b)
{
return a->track_id == b->track_id &&
!memcmp(&a->version, &b->version, sizeof(a->version)) &&
!memcmp(&a->name, &b->name, I40E_DDP_NAME_SIZE);
}
/**
* i40e_ddp_does_profile_exist - checks if DDP profile loaded already
* @hw: HW data structure
* @pinfo: DDP profile information structure
*
* checks if DDP profile loaded already.
* Returns >0 if the profile exists.
* Returns 0 if the profile is absent.
* Returns <0 if error.
**/
static int i40e_ddp_does_profile_exist(struct i40e_hw *hw,
struct i40e_profile_info *pinfo)
{
struct i40e_ddp_profile_list *profile_list;
u8 buff[I40E_PROFILE_LIST_SIZE];
int status;
int i;
status = i40e_aq_get_ddp_list(hw, buff, I40E_PROFILE_LIST_SIZE, 0,
NULL);
if (status)
return -1;
profile_list = (struct i40e_ddp_profile_list *)buff;
for (i = 0; i < profile_list->p_count; i++) {
if (i40e_ddp_profiles_eq(pinfo, &profile_list->p_info[i]))
return 1;
}
return 0;
}
/**
* i40e_ddp_profiles_overlap - checks if DDP profiles overlap.
* @new: new profile info
* @old: old profile info
*
* checks if DDP profiles overlap.
* Returns true if profiles are overlap.
**/
static bool i40e_ddp_profiles_overlap(struct i40e_profile_info *new,
struct i40e_profile_info *old)
{
unsigned int group_id_old = FIELD_GET(0x00FF0000, old->track_id);
unsigned int group_id_new = FIELD_GET(0x00FF0000, new->track_id);
/* 0x00 group must be only the first */
if (group_id_new == 0)
return true;
/* 0xFF group is compatible with anything else */
if (group_id_new == 0xFF || group_id_old == 0xFF)
return false;
/* otherwise only profiles from the same group are compatible*/
return group_id_old != group_id_new;
}
/**
* i40e_ddp_does_profile_overlap - checks if DDP overlaps with existing one.
* @hw: HW data structure
* @pinfo: DDP profile information structure
*
* checks if DDP profile overlaps with existing one.
* Returns >0 if the profile overlaps.
* Returns 0 if the profile is ok.
Annotation
- Immediate include surface: `linux/firmware.h`, `i40e.h`.
- Detected declarations: `struct i40e_ddp_profile_list`, `struct i40e_ddp_old_profile_list`, `function i40e_ddp_profiles_eq`, `function i40e_ddp_does_profile_exist`, `function i40e_ddp_profiles_overlap`, `function i40e_ddp_does_profile_overlap`, `function i40e_add_pinfo`, `function i40e_del_pinfo`, `function i40e_ddp_is_pkg_hdr_valid`, `function i40e_ddp_load`.
- 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.