drivers/net/ethernet/intel/ice/ice_dcb_nl.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_dcb_nl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_dcb_nl.c- Extension
.c- Size
- 30161 bytes
- Lines
- 1147
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ice.hice_dcb.hice_dcb_lib.hice_dcb_nl.hnet/dcbnl.h
Detected Declarations
function ice_dcbnl_devresetfunction ice_dcbnl_getetsfunction ice_dcbnl_setetsfunction ice_dcbnl_getnumtcsfunction ice_dcbnl_getdcbxfunction ice_dcbnl_setdcbxfunction ice_dcbnl_get_perm_hw_addrfunction ice_get_pfc_delayfunction ice_dcbnl_getpfcfunction ice_for_each_traffic_classfunction ice_dcbnl_setpfcfunction ice_dcbnl_get_pfc_cfgfunction ice_dcbnl_set_pfc_cfgfunction ice_dcbnl_getpfcstatefunction ice_dcbnl_getstatefunction ice_dcbnl_setstatefunction ice_dcbnl_get_pg_tc_cfg_txfunction ice_dcbnl_set_pg_tc_cfg_txfunction ice_for_each_traffic_classfunction ice_dcbnl_get_pg_bwg_cfg_txfunction ice_dcbnl_set_pg_bwg_cfg_txfunction ice_dcbnl_get_pg_tc_cfg_rxfunction ice_dcbnl_set_pg_tc_cfg_rxfunction ice_dcbnl_get_pg_bwg_cfg_rxfunction ice_dcbnl_set_pg_bwg_cfg_rxfunction ice_dcbnl_get_capfunction ice_dcbnl_getappfunction ice_dcbnl_find_appfunction ice_dcbnl_setappfunction ice_dcbnl_delappfunction ice_dcbnl_cee_set_allfunction ice_dcbnl_set_allfunction ice_dcbnl_vsi_del_appfunction ice_dcbnl_flush_appsfunction ice_dcbnl_setup
Annotated Snippet
if (new_cfg->pfc_mode == ICE_QOS_MODE_VLAN) {
/* in DSCP mode up->tc mapping cannot change */
new_cfg->etscfg.prio_table[i] = ets->prio_tc[i];
new_cfg->etsrec.prio_table[i] = ets->reco_prio_tc[i];
}
new_cfg->etsrec.tcbwtable[i] = ets->tc_reco_bw[i];
bwrec += ets->tc_reco_bw[i];
new_cfg->etsrec.tsatable[i] = ets->tc_reco_tsa[i];
}
if (ice_dcb_bwchk(pf, new_cfg)) {
err = -EINVAL;
goto ets_out;
}
new_cfg->etscfg.maxtcs = pf->hw.func_caps.common_cap.maxtc;
if (!bwcfg)
new_cfg->etscfg.tcbwtable[0] = 100;
if (!bwrec)
new_cfg->etsrec.tcbwtable[0] = 100;
err = ice_pf_dcb_cfg(pf, new_cfg, true);
/* return of zero indicates new cfg applied */
if (err == ICE_DCB_HW_CHG_RST)
ice_dcbnl_devreset(netdev);
if (err == ICE_DCB_NO_HW_CHG)
err = ICE_DCB_HW_CHG_RST;
ets_out:
mutex_unlock(&pf->tc_mutex);
return err;
}
/**
* ice_dcbnl_getnumtcs - Get max number of traffic classes supported
* @dev: pointer to netdev struct
* @tcid: TC ID
* @num: total number of TCs supported by the adapter
*
* Return the total number of TCs supported
*/
static int
ice_dcbnl_getnumtcs(struct net_device *dev, int __always_unused tcid, u8 *num)
{
struct ice_pf *pf = ice_netdev_to_pf(dev);
if (!test_bit(ICE_FLAG_DCB_CAPABLE, pf->flags))
return -EINVAL;
*num = pf->hw.func_caps.common_cap.maxtc;
return 0;
}
/**
* ice_dcbnl_getdcbx - retrieve current DCBX capability
* @netdev: pointer to the netdev struct
*/
static u8 ice_dcbnl_getdcbx(struct net_device *netdev)
{
struct ice_pf *pf = ice_netdev_to_pf(netdev);
return pf->dcbx_cap;
}
/**
* ice_dcbnl_setdcbx - set required DCBX capability
* @netdev: the corresponding netdev
* @mode: required mode
*/
static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode)
{
struct ice_pf *pf = ice_netdev_to_pf(netdev);
struct ice_qos_cfg *qos_cfg;
/* if FW LLDP agent is running, DCBNL not allowed to change mode */
if (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags))
return ICE_DCB_NO_HW_CHG;
/* No support for LLD_MANAGED modes or CEE+IEEE */
if ((mode & DCB_CAP_DCBX_LLD_MANAGED) ||
((mode & DCB_CAP_DCBX_VER_IEEE) && (mode & DCB_CAP_DCBX_VER_CEE)) ||
!(mode & DCB_CAP_DCBX_HOST))
return ICE_DCB_NO_HW_CHG;
/* Already set to the given mode no change */
if (mode == pf->dcbx_cap)
return ICE_DCB_NO_HW_CHG;
Annotation
- Immediate include surface: `ice.h`, `ice_dcb.h`, `ice_dcb_lib.h`, `ice_dcb_nl.h`, `net/dcbnl.h`.
- Detected declarations: `function ice_dcbnl_devreset`, `function ice_dcbnl_getets`, `function ice_dcbnl_setets`, `function ice_dcbnl_getnumtcs`, `function ice_dcbnl_getdcbx`, `function ice_dcbnl_setdcbx`, `function ice_dcbnl_get_perm_hw_addr`, `function ice_get_pfc_delay`, `function ice_dcbnl_getpfc`, `function ice_for_each_traffic_class`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.