drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c- Extension
.c- Size
- 33781 bytes
- Lines
- 1282
- 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
cxgb4.h
Detected Declarations
function cxgb4_dcb_state_syncedfunction cxgb4_dcb_state_initfunction cxgb4_dcb_version_initfunction cxgb4_dcb_cleanup_appsfunction cxgb4_dcb_resetfunction cxgb4_dcb_update_supportfunction cxgb4_dcb_state_fsmfunction cxgb4_dcb_handle_fw_updatefunction cxgb4_getstatefunction cxgb4_setstatefunction cxgb4_getpgtccfgfunction cxgb4_getpgtccfg_txfunction cxgb4_getpgtccfg_rxfunction cxgb4_setpgtccfg_txfunction cxgb4_getpgbwgcfgfunction cxgb4_getpgbwgcfg_txfunction cxgb4_getpgbwgcfg_rxfunction cxgb4_setpgbwgcfg_txfunction cxgb4_getpfccfgfunction cxgb4_setpfccfgfunction cxgb4_setallfunction cxgb4_getcapfunction cxgb4_getnumtcsfunction cxgb4_setnumtcsfunction cxgb4_getpfcstatefunction cxgb4_setpfcstatefunction cxgb4_getappfunction __cxgb4_setappfunction cxgb4_setappfunction cxgb4_ieee_negotiation_completefunction cxgb4_ieee_read_etsfunction cxgb4_ieee_get_etsfunction cxgb4_ieee_get_pfcfunction cxgb4_ieee_peer_etsfunction cxgb4_ieee_getappfunction cxgb4_ieee_setappfunction cxgb4_getdcbxfunction cxgb4_setdcbxfunction cxgb4_getpeer_appfunction cxgb4_getpeerapp_tblfunction cxgb4_cee_peer_getpgfunction cxgb4_cee_peer_getpfc
Annotated Snippet
if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) {
app.priority = dcb->app_priority[i].user_prio_map;
app.selector = dcb->app_priority[i].sel_field + 1;
err = dcb_ieee_delapp(dev, &app);
} else {
app.selector = !!(dcb->app_priority[i].sel_field);
err = dcb_setapp(dev, &app);
}
if (err) {
dev_err(adap->pdev_dev,
"Failed DCB Clear %s Application Priority: sel=%d, prot=%d, err=%d\n",
dcb_ver_array[dcb->dcb_version], app.selector,
app.protocol, -err);
break;
}
}
}
/* Reset a port's Data Center Bridging state. Typically used after a
* Link Down event.
*/
void cxgb4_dcb_reset(struct net_device *dev)
{
cxgb4_dcb_cleanup_apps(dev);
cxgb4_dcb_state_init(dev);
}
/* update the dcb port support, if version is IEEE then set it to
* FW_PORT_DCB_VER_IEEE and if DCB_CAP_DCBX_VER_CEE is already set then
* clear that. and if it is set to CEE then set dcb supported to
* DCB_CAP_DCBX_VER_CEE & if DCB_CAP_DCBX_VER_IEEE is set, clear it
*/
static inline void cxgb4_dcb_update_support(struct port_dcb_info *dcb)
{
if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) {
if (dcb->supported & DCB_CAP_DCBX_VER_CEE)
dcb->supported &= ~DCB_CAP_DCBX_VER_CEE;
dcb->supported |= DCB_CAP_DCBX_VER_IEEE;
} else if (dcb->dcb_version == FW_PORT_DCB_VER_CEE1D01) {
if (dcb->supported & DCB_CAP_DCBX_VER_IEEE)
dcb->supported &= ~DCB_CAP_DCBX_VER_IEEE;
dcb->supported |= DCB_CAP_DCBX_VER_CEE;
}
}
/* Finite State machine for Data Center Bridging.
*/
void cxgb4_dcb_state_fsm(struct net_device *dev,
enum cxgb4_dcb_state_input transition_to)
{
struct port_info *pi = netdev2pinfo(dev);
struct port_dcb_info *dcb = &pi->dcb;
struct adapter *adap = pi->adapter;
enum cxgb4_dcb_state current_state = dcb->state;
netdev_dbg(dev, "%s: State change from %d to %d for %s\n",
__func__, dcb->state, transition_to, dev->name);
switch (current_state) {
case CXGB4_DCB_STATE_START: {
switch (transition_to) {
case CXGB4_DCB_INPUT_FW_DISABLED: {
/* we're going to use Host DCB */
dcb->state = CXGB4_DCB_STATE_HOST;
dcb->supported = CXGB4_DCBX_HOST_SUPPORT;
break;
}
case CXGB4_DCB_INPUT_FW_ENABLED: {
/* we're going to use Firmware DCB */
dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
dcb->supported = DCB_CAP_DCBX_LLD_MANAGED;
if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE)
dcb->supported |= DCB_CAP_DCBX_VER_IEEE;
else
dcb->supported |= DCB_CAP_DCBX_VER_CEE;
break;
}
case CXGB4_DCB_INPUT_FW_INCOMPLETE: {
/* expected transition */
break;
}
case CXGB4_DCB_INPUT_FW_ALLSYNCED: {
dcb->state = CXGB4_DCB_STATE_FW_ALLSYNCED;
break;
}
Annotation
- Immediate include surface: `cxgb4.h`.
- Detected declarations: `function cxgb4_dcb_state_synced`, `function cxgb4_dcb_state_init`, `function cxgb4_dcb_version_init`, `function cxgb4_dcb_cleanup_apps`, `function cxgb4_dcb_reset`, `function cxgb4_dcb_update_support`, `function cxgb4_dcb_state_fsm`, `function cxgb4_dcb_handle_fw_update`, `function cxgb4_getstate`, `function cxgb4_setstate`.
- 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.