drivers/net/ethernet/intel/ice/ice_eswitch.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_eswitch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_eswitch.c- Extension
.c- Size
- 15715 bytes
- Lines
- 636
- 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
ice.hice_lib.hice_eswitch.hice_eswitch_br.hice_fltr.hice_repr.hdevlink/devlink.hice_tc_lib.h
Detected Declarations
function ice_eswitch_setup_envfunction ice_eswitch_release_reprfunction ice_eswitch_setup_reprfunction ice_eswitch_cfg_vsifunction ice_eswitch_decfg_vsifunction ice_eswitch_update_reprfunction ice_eswitch_port_start_xmitfunction ice_eswitch_set_target_vsifunction ice_eswitch_release_envfunction ice_eswitch_enable_switchdevfunction ice_eswitch_disable_switchdevfunction ice_eswitch_mode_setfunction ice_eswitch_mode_getfunction ice_is_eswitch_mode_switchdevfunction ice_eswitch_start_all_tx_queuesfunction ice_eswitch_stop_all_tx_queuesfunction ice_eswitch_stop_reprsfunction ice_eswitch_start_reprsfunction ice_eswitch_attachfunction ice_eswitch_attach_vffunction ice_eswitch_attach_sffunction ice_eswitch_detachfunction ice_eswitch_detach_vffunction ice_eswitch_detach_sf
Annotated Snippet
if (ice_is_adq_active(pf)) {
dev_err(ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
NL_SET_ERR_MSG_MOD(extack, "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
return -EOPNOTSUPP;
}
dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
pf->hw.pf_id);
xa_init(&pf->eswitch.reprs);
NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");
break;
}
default:
NL_SET_ERR_MSG_MOD(extack, "Unknown eswitch mode");
return -EINVAL;
}
pf->eswitch_mode = mode;
return 0;
}
/**
* ice_eswitch_mode_get - get current eswitch mode
* @devlink: pointer to devlink structure
* @mode: output parameter for current eswitch mode
*/
int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
{
struct ice_pf *pf = devlink_priv(devlink);
*mode = pf->eswitch_mode;
return 0;
}
/**
* ice_is_eswitch_mode_switchdev - check if eswitch mode is set to switchdev
* @pf: pointer to PF structure
*
* Returns true if eswitch mode is set to DEVLINK_ESWITCH_MODE_SWITCHDEV,
* false otherwise.
*/
bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
{
return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV;
}
/**
* ice_eswitch_start_all_tx_queues - start Tx queues of all port representors
* @pf: pointer to PF structure
*/
static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf)
{
struct ice_repr *repr;
unsigned long id;
if (test_bit(ICE_DOWN, pf->state))
return;
xa_for_each(&pf->eswitch.reprs, id, repr)
ice_repr_start_tx_queues(repr);
}
/**
* ice_eswitch_stop_all_tx_queues - stop Tx queues of all port representors
* @pf: pointer to PF structure
*/
void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)
{
struct ice_repr *repr;
unsigned long id;
if (test_bit(ICE_DOWN, pf->state))
return;
xa_for_each(&pf->eswitch.reprs, id, repr)
ice_repr_stop_tx_queues(repr);
}
static void ice_eswitch_stop_reprs(struct ice_pf *pf)
{
ice_eswitch_stop_all_tx_queues(pf);
}
static void ice_eswitch_start_reprs(struct ice_pf *pf)
{
ice_eswitch_start_all_tx_queues(pf);
}
static int
ice_eswitch_attach(struct ice_pf *pf, struct ice_repr *repr, unsigned long *id)
Annotation
- Immediate include surface: `ice.h`, `ice_lib.h`, `ice_eswitch.h`, `ice_eswitch_br.h`, `ice_fltr.h`, `ice_repr.h`, `devlink/devlink.h`, `ice_tc_lib.h`.
- Detected declarations: `function ice_eswitch_setup_env`, `function ice_eswitch_release_repr`, `function ice_eswitch_setup_repr`, `function ice_eswitch_cfg_vsi`, `function ice_eswitch_decfg_vsi`, `function ice_eswitch_update_repr`, `function ice_eswitch_port_start_xmit`, `function ice_eswitch_set_target_vsi`, `function ice_eswitch_release_env`, `function ice_eswitch_enable_switchdev`.
- 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.