drivers/net/ethernet/freescale/dpaa2/dpni.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa2/dpni.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/dpaa2/dpni.c- Extension
.c- Size
- 64980 bytes
- Lines
- 2186
- 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
linux/kernel.hlinux/errno.hlinux/fsl/mc.hdpni.hdpni-cmd.h
Detected Declarations
function dpni_prepare_key_cfgfunction dpni_openfunction dpni_closefunction dpni_set_poolsfunction dpni_enablefunction dpni_disablefunction dpni_is_enabledfunction dpni_resetfunction dpni_set_irq_enablefunction dpni_get_irq_enablefunction dpni_set_irq_maskfunction dpni_get_irq_maskfunction dpni_get_irq_statusfunction dpni_clear_irq_statusfunction dpni_get_attributesfunction dpni_set_errors_behaviorfunction dpni_get_buffer_layoutfunction dpni_set_buffer_layoutfunction dpni_set_offloadfunction dpni_get_offloadfunction dpni_get_qdidfunction dpni_get_tx_data_offsetfunction dpni_set_link_cfgfunction dpni_get_link_cfgfunction dpni_get_link_statefunction dpni_set_max_frame_lengthfunction dpni_get_max_frame_lengthfunction dpni_set_multicast_promiscfunction dpni_get_multicast_promiscfunction dpni_set_unicast_promiscfunction dpni_get_unicast_promiscfunction dpni_set_primary_mac_addrfunction dpni_get_primary_mac_addrfunction dpni_get_port_mac_addrfunction dpni_enable_vlan_filterfunction dpni_add_vlan_idfunction dpni_remove_vlan_idfunction dpni_add_mac_addrfunction dpni_remove_mac_addrfunction dpni_clear_mac_filtersfunction dpni_set_rx_tc_distfunction dpni_set_congestion_notificationfunction dpni_set_queuefunction dpni_get_queuefunction dpni_get_statisticsfunction dpni_set_taildropfunction dpni_get_taildropfunction dpni_get_api_version
Annotated Snippet
switch (cfg->extracts[i].type) {
case DPKG_EXTRACT_FROM_HDR:
extr->prot = cfg->extracts[i].extract.from_hdr.prot;
dpni_set_field(extr->efh_type, EFH_TYPE,
cfg->extracts[i].extract.from_hdr.type);
extr->size = cfg->extracts[i].extract.from_hdr.size;
extr->offset = cfg->extracts[i].extract.from_hdr.offset;
extr->field = cpu_to_le32(
cfg->extracts[i].extract.from_hdr.field);
extr->hdr_index =
cfg->extracts[i].extract.from_hdr.hdr_index;
break;
case DPKG_EXTRACT_FROM_DATA:
extr->size = cfg->extracts[i].extract.from_data.size;
extr->offset =
cfg->extracts[i].extract.from_data.offset;
break;
case DPKG_EXTRACT_FROM_PARSE:
extr->size = cfg->extracts[i].extract.from_parse.size;
extr->offset =
cfg->extracts[i].extract.from_parse.offset;
break;
default:
return -EINVAL;
}
extr->num_of_byte_masks = cfg->extracts[i].num_of_byte_masks;
dpni_set_field(extr->extract_type, EXTRACT_TYPE,
cfg->extracts[i].type);
for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
extr->masks[j].offset =
cfg->extracts[i].masks[j].offset;
}
}
return 0;
}
/**
* dpni_open() - Open a control session for the specified object
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @dpni_id: DPNI unique ID
* @token: Returned token; use in subsequent API calls
*
* This function can be used to open a control session for an
* already created object; an object may have been declared in
* the DPL or by calling the dpni_create() function.
* This function returns a unique authentication token,
* associated with the specific object ID and the specific MC
* portal; this token must be used in all subsequent commands for
* this specific object.
*
* Return: '0' on Success; Error code otherwise.
*/
int dpni_open(struct fsl_mc_io *mc_io,
u32 cmd_flags,
int dpni_id,
u16 *token)
{
struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_open *cmd_params;
int err;
/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_OPEN,
cmd_flags,
0);
cmd_params = (struct dpni_cmd_open *)cmd.params;
cmd_params->dpni_id = cpu_to_le32(dpni_id);
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
if (err)
return err;
/* retrieve response parameters */
*token = mc_cmd_hdr_read_token(&cmd);
return 0;
}
/**
* dpni_close() - Close the control session of the object
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @token: Token of DPNI object
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/fsl/mc.h`, `dpni.h`, `dpni-cmd.h`.
- Detected declarations: `function dpni_prepare_key_cfg`, `function dpni_open`, `function dpni_close`, `function dpni_set_pools`, `function dpni_enable`, `function dpni_disable`, `function dpni_is_enabled`, `function dpni_reset`, `function dpni_set_irq_enable`, `function dpni_get_irq_enable`.
- 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.