drivers/net/ethernet/intel/ice/ice_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_main.c- Extension
.c- Size
- 266837 bytes
- Lines
- 9822
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
generated/utsrelease.hlinux/crash_dump.hice.hice_base.hice_lib.hice_fltr.hice_dcb_lib.hice_dcb_nl.hdevlink/devlink.hdevlink/port.hice_sf_eth.hice_hwmon.hice_trace.hice_eswitch.hice_tc_lib.hice_vsi_vlan_ops.hnet/xdp_sock_drv.h
Detected Declarations
struct ice_dimstruct ice_vsi_tx_statsstruct ice_vsi_rx_statsfunction netif_is_icefunction ice_get_tx_pendingfunction ice_check_for_hang_subtaskfunction ice_for_each_vsifunction ice_for_each_txqfunction ice_init_mac_fltrfunction functionsfunction functionsfunction ice_vsi_fltr_changedfunction ice_set_promiscfunction ice_clear_promiscfunction ice_vsi_sync_fltrfunction ice_sync_fltr_subtaskfunction ice_for_each_vsifunction ice_pf_dis_all_vsifunction ice_prepare_for_resetfunction ice_do_resetfunction ice_reset_subtaskfunction ice_print_topo_conflictfunction ice_print_link_msgfunction ice_vsi_link_eventfunction ice_set_dflt_mibfunction ice_check_phy_fw_loadfunction ice_check_module_powerfunction ice_check_link_cfg_errfunction ice_link_eventfunction ice_watchdog_subtaskfunction ice_init_link_eventsfunction ice_handle_link_eventfunction ice_aq_prep_for_eventfunction ice_aq_wait_for_eventfunction ice_aq_check_eventsfunction ice_aq_cancel_waiting_tasksfunction __ice_clean_ctrlqfunction ice_ctrlq_pendingfunction ice_clean_adminq_subtaskfunction ice_clean_mailboxq_subtaskfunction ice_clean_sbq_subtaskfunction ice_service_task_schedulefunction ice_service_task_completefunction ice_service_task_stopfunction worksfunction ice_service_timerfunction ice_mdd_maybe_reset_vffunction ice_handle_mdd_event
Annotated Snippet
static const struct net_device_ops ice_netdev_safe_mode_ops;
static const struct net_device_ops ice_netdev_ops;
static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
static void ice_vsi_release_all(struct ice_pf *pf);
static int ice_rebuild_channels(struct ice_pf *pf);
static void ice_remove_q_channels(struct ice_vsi *vsi, bool rem_adv_fltr);
static int
ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch,
void *cb_priv, enum tc_setup_type type, void *type_data,
void *data,
void (*cleanup)(struct flow_block_cb *block_cb));
bool netif_is_ice(const struct net_device *dev)
{
return dev && (dev->netdev_ops == &ice_netdev_ops ||
dev->netdev_ops == &ice_netdev_safe_mode_ops);
}
/**
* ice_get_tx_pending - returns number of Tx descriptors not processed
* @ring: the ring of descriptors
*/
static u16 ice_get_tx_pending(struct ice_tx_ring *ring)
{
u16 head, tail;
head = ring->next_to_clean;
tail = ring->next_to_use;
if (head != tail)
return (head < tail) ?
tail - head : (tail + ring->count - head);
return 0;
}
/**
* ice_check_for_hang_subtask - check for and recover hung queues
* @pf: pointer to PF struct
*/
static void ice_check_for_hang_subtask(struct ice_pf *pf)
{
struct ice_vsi *vsi = NULL;
struct ice_hw *hw;
unsigned int i;
int packets;
u32 v;
ice_for_each_vsi(pf, v)
if (pf->vsi[v] && pf->vsi[v]->type == ICE_VSI_PF) {
vsi = pf->vsi[v];
break;
}
if (!vsi || test_bit(ICE_VSI_DOWN, vsi->state))
return;
if (!(vsi->netdev && netif_carrier_ok(vsi->netdev)))
return;
hw = &vsi->back->hw;
ice_for_each_txq(vsi, i) {
struct ice_tx_ring *tx_ring = vsi->tx_rings[i];
struct ice_ring_stats *ring_stats;
if (!tx_ring)
continue;
if (ice_ring_ch_enabled(tx_ring))
continue;
ring_stats = tx_ring->ring_stats;
if (!ring_stats)
continue;
if (tx_ring->desc) {
/* If packet counter has not changed the queue is
* likely stalled, so force an interrupt for this
* queue.
*
* prev_pkt would be negative if there was no
* pending work.
*/
packets = ice_stats_read(ring_stats, pkts) & INT_MAX;
if (ring_stats->tx.prev_pkt == packets) {
/* Trigger sw interrupt to revive the queue */
ice_trigger_sw_intr(hw, tx_ring->q_vector);
Annotation
- Immediate include surface: `generated/utsrelease.h`, `linux/crash_dump.h`, `ice.h`, `ice_base.h`, `ice_lib.h`, `ice_fltr.h`, `ice_dcb_lib.h`, `ice_dcb_nl.h`.
- Detected declarations: `struct ice_dim`, `struct ice_vsi_tx_stats`, `struct ice_vsi_rx_stats`, `function netif_is_ice`, `function ice_get_tx_pending`, `function ice_check_for_hang_subtask`, `function ice_for_each_vsi`, `function ice_for_each_txq`, `function ice_init_mac_fltr`, `function functions`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.