drivers/net/ethernet/intel/ice/ice_repr.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_repr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_repr.c- Extension
.c- Size
- 13401 bytes
- Lines
- 551
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
ice.hice_lib.hice_eswitch.hdevlink/devlink.hdevlink/port.hice_sriov.hice_tc_lib.hice_dcb_lib.h
Detected Declarations
function ice_repr_inc_tx_statsfunction ice_repr_inc_rx_statsfunction ice_repr_get_stats64function systemfunction ice_repr_sf_openfunction ice_repr_vf_stopfunction ice_repr_sf_stopfunction ice_repr_sp_stats64function for_each_possible_cpufunction ice_repr_ndo_has_offload_statsfunction ice_repr_ndo_get_offload_statsfunction ice_repr_setup_tc_cls_flowerfunction ice_repr_setup_tc_block_cbfunction ice_repr_setup_tcfunction ice_is_port_repr_netdevfunction ice_repr_reg_netdevfunction ice_repr_ready_vffunction ice_repr_ready_sffunction ice_repr_destroyfunction ice_repr_rem_vffunction ice_repr_rem_sffunction ice_repr_set_tx_topologyfunction ice_repr_add_vffunction ice_repr_add_sffunction ice_repr_start_tx_queuesfunction ice_repr_stop_tx_queues
Annotated Snippet
static const struct net_device_ops ice_repr_vf_netdev_ops = {
.ndo_get_stats64 = ice_repr_get_stats64,
.ndo_open = ice_repr_vf_open,
.ndo_stop = ice_repr_vf_stop,
.ndo_start_xmit = ice_eswitch_port_start_xmit,
.ndo_setup_tc = ice_repr_setup_tc,
.ndo_has_offload_stats = ice_repr_ndo_has_offload_stats,
.ndo_get_offload_stats = ice_repr_ndo_get_offload_stats,
};
static const struct net_device_ops ice_repr_sf_netdev_ops = {
.ndo_get_stats64 = ice_repr_get_stats64,
.ndo_open = ice_repr_sf_open,
.ndo_stop = ice_repr_sf_stop,
.ndo_start_xmit = ice_eswitch_port_start_xmit,
.ndo_setup_tc = ice_repr_setup_tc,
.ndo_has_offload_stats = ice_repr_ndo_has_offload_stats,
.ndo_get_offload_stats = ice_repr_ndo_get_offload_stats,
};
/**
* ice_is_port_repr_netdev - Check if a given netdevice is a port representor netdev
* @netdev: pointer to netdev
*/
bool ice_is_port_repr_netdev(const struct net_device *netdev)
{
return netdev && (netdev->netdev_ops == &ice_repr_vf_netdev_ops ||
netdev->netdev_ops == &ice_repr_sf_netdev_ops);
}
/**
* ice_repr_reg_netdev - register port representor netdev
* @netdev: pointer to port representor netdev
* @ops: new ops for netdev
*/
static int
ice_repr_reg_netdev(struct net_device *netdev, const struct net_device_ops *ops)
{
eth_hw_addr_random(netdev);
netdev->netdev_ops = ops;
ice_set_ethtool_repr_ops(netdev);
netdev->hw_features |= NETIF_F_HW_TC;
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
return register_netdev(netdev);
}
static int ice_repr_ready_vf(struct ice_repr *repr)
{
return ice_check_vf_ready_for_cfg(repr->vf);
}
static int ice_repr_ready_sf(struct ice_repr *repr)
{
return !repr->sf->active;
}
/**
* ice_repr_destroy - remove representor from VF
* @repr: pointer to representor structure
*/
void ice_repr_destroy(struct ice_repr *repr)
{
free_percpu(repr->stats);
free_netdev(repr->netdev);
kfree(repr);
}
static void ice_repr_rem_vf(struct ice_repr *repr)
{
ice_eswitch_decfg_vsi(repr->src_vsi, repr->parent_mac);
ice_pass_vf_tx_lldp(repr->src_vsi, true);
unregister_netdev(repr->netdev);
ice_devlink_destroy_vf_port(repr->vf);
ice_virtchnl_set_dflt_ops(repr->vf);
}
static void ice_repr_rem_sf(struct ice_repr *repr)
{
unregister_netdev(repr->netdev);
ice_devlink_destroy_sf_port(repr->sf);
}
static void ice_repr_set_tx_topology(struct ice_pf *pf, struct devlink *devlink)
{
/* only export if ADQ and DCB disabled and eswitch enabled*/
if (ice_is_adq_active(pf) || ice_is_dcb_active(pf) ||
Annotation
- Immediate include surface: `ice.h`, `ice_lib.h`, `ice_eswitch.h`, `devlink/devlink.h`, `devlink/port.h`, `ice_sriov.h`, `ice_tc_lib.h`, `ice_dcb_lib.h`.
- Detected declarations: `function ice_repr_inc_tx_stats`, `function ice_repr_inc_rx_stats`, `function ice_repr_get_stats64`, `function system`, `function ice_repr_sf_open`, `function ice_repr_vf_stop`, `function ice_repr_sf_stop`, `function ice_repr_sp_stats64`, `function for_each_possible_cpu`, `function ice_repr_ndo_has_offload_stats`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.