drivers/net/ethernet/cisco/enic/enic_pp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cisco/enic/enic_pp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cisco/enic/enic_pp.c- Extension
.c- Size
- 8526 bytes
- Lines
- 354
- 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/string.hlinux/errno.hlinux/types.hlinux/netdevice.hlinux/etherdevice.hlinux/rtnetlink.hnet/ip.hvnic_vic.henic_res.henic.henic_dev.henic_pp.h
Detected Declarations
function enic_is_valid_pp_vffunction enic_set_port_profilefunction enic_unset_port_profilefunction enic_are_pp_differentfunction enic_pp_preassociatefunction enic_pp_disassociatefunction enic_pp_preassociate_rrfunction enic_pp_associatefunction enic_are_pp_differentfunction enic_process_set_pp_requestfunction enic_process_get_pp_request
Annotated Snippet
if (enic_sriov_enabled(enic)) {
if (vf < 0 || vf >= enic->num_vfs) {
*err = -EINVAL;
goto err_out;
}
} else {
*err = -EOPNOTSUPP;
goto err_out;
}
#else
*err = -EOPNOTSUPP;
goto err_out;
#endif
}
if (vf == PORT_SELF_VF && !enic_is_dynamic(enic)) {
*err = -EOPNOTSUPP;
goto err_out;
}
*err = 0;
return 1;
err_out:
return 0;
}
static int enic_set_port_profile(struct enic *enic, int vf)
{
struct net_device *netdev = enic->netdev;
struct enic_port_profile *pp;
struct vic_provinfo *vp;
const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
const u8 *client_mac;
char uuid_str[38];
char client_mac_str[18];
int err;
ENIC_PP_BY_INDEX(enic, vf, pp, &err);
if (err)
return err;
if (!(pp->set & ENIC_SET_NAME) || !strlen(pp->name))
return -EINVAL;
vp = vic_provinfo_alloc(GFP_KERNEL, oui,
VIC_PROVINFO_GENERIC_TYPE);
if (!vp)
return -ENOMEM;
VIC_PROVINFO_ADD_TLV(vp,
VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR,
strlen(pp->name) + 1, pp->name);
if (!is_zero_ether_addr(pp->mac_addr)) {
client_mac = pp->mac_addr;
} else if (vf == PORT_SELF_VF) {
client_mac = netdev->dev_addr;
} else {
netdev_err(netdev, "Cannot find pp mac address "
"for VF %d\n", vf);
err = -EINVAL;
goto add_tlv_failure;
}
VIC_PROVINFO_ADD_TLV(vp,
VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR,
ETH_ALEN, client_mac);
snprintf(client_mac_str, sizeof(client_mac_str), "%pM", client_mac);
VIC_PROVINFO_ADD_TLV(vp,
VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR,
sizeof(client_mac_str), client_mac_str);
if (pp->set & ENIC_SET_INSTANCE) {
sprintf(uuid_str, "%pUB", pp->instance_uuid);
VIC_PROVINFO_ADD_TLV(vp,
VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR,
sizeof(uuid_str), uuid_str);
}
if (pp->set & ENIC_SET_HOST) {
sprintf(uuid_str, "%pUB", pp->host_uuid);
VIC_PROVINFO_ADD_TLV(vp,
VIC_GENERIC_PROV_TLV_HOST_UUID_STR,
sizeof(uuid_str), uuid_str);
}
VIC_PROVINFO_ADD_TLV(vp,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `linux/errno.h`, `linux/types.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/rtnetlink.h`, `net/ip.h`.
- Detected declarations: `function enic_is_valid_pp_vf`, `function enic_set_port_profile`, `function enic_unset_port_profile`, `function enic_are_pp_different`, `function enic_pp_preassociate`, `function enic_pp_disassociate`, `function enic_pp_preassociate_rr`, `function enic_pp_associate`, `function enic_are_pp_different`, `function enic_process_set_pp_request`.
- 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.