drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c- Extension
.c- Size
- 51552 bytes
- Lines
- 1840
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../aq_hw.h../aq_hw_utils.h../aq_ring.h../aq_nic.h../aq_phy.hhw_atl_b0.hhw_atl_utils.hhw_atl_llh.hhw_atl_b0_internal.hhw_atl_llh_internal.h
Detected Declarations
function hw_atl_b0_hw_resetfunction hw_atl_b0_set_fcfunction hw_atl_b0_tc_ptp_setfunction hw_atl_b0_hw_qos_setfunction hw_atl_b0_hw_rss_hash_setfunction hw_atl_b0_hw_rss_setfunction hw_atl_b0_hw_offload_setfunction hw_atl_b0_hw_init_tx_tc_rate_limitfunction hw_atl_b0_hw_init_tx_pathfunction hw_atl_b0_hw_init_rx_rss_ctrl1function hw_atl_b0_hw_init_rx_pathfunction hw_atl_b0_hw_mac_addr_setfunction hw_atl_b0_hw_initfunction hw_atl_b0_hw_ring_tx_startfunction hw_atl_b0_hw_ring_rx_startfunction hw_atl_b0_hw_startfunction hw_atl_b0_hw_tx_ring_tail_updatefunction hw_atl_b0_hw_ring_tx_xmitfunction hw_atl_b0_hw_ring_rx_initfunction hw_atl_b0_hw_ring_tx_initfunction hw_atl_b0_hw_ring_rx_fillfunction hw_atl_b0_hw_ring_hwts_rx_fillfunction hw_atl_b0_hw_ring_hwts_rx_receivefunction hw_atl_b0_hw_ring_tx_head_updatefunction hw_atl_b0_hw_ring_rx_receivefunction hw_atl_b0_hw_irq_enablefunction hw_atl_b0_hw_irq_disablefunction hw_atl_b0_hw_irq_readfunction hw_atl_b0_hw_packet_filter_setfunction hw_atl_b0_hw_multicast_list_setfunction hw_atl_b0_hw_interrupt_moderation_setfunction hw_atl_b0_hw_stopfunction hw_atl_b0_hw_ring_tx_stopfunction hw_atl_b0_hw_ring_rx_stopfunction hw_atl_b0_get_ptp_tsfunction hw_atl_b0_adj_params_getfunction hw_atl_b0_mac_adj_param_calcfunction hw_atl_b0_adj_sys_clockfunction hw_atl_b0_set_sys_clockfunction hw_atl_b0_ts_to_sys_clockfunction hw_atl_b0_adj_clock_freqfunction hw_atl_b0_gpio_pulsefunction hw_atl_b0_extts_gpio_enablefunction hw_atl_b0_get_sync_tsfunction hw_atl_b0_rx_extract_tsfunction hw_atl_b0_extract_hwtsfunction hw_atl_b0_hw_fl3l4_clearfunction hw_atl_b0_hw_fl3l4_set
Annotated Snippet
if (!nic_cfg->tc_min_rate[tc]) {
tc_weight[tc] = 0;
continue;
}
tc_weight[tc] = (-1L + link_speed +
nic_cfg->tc_min_rate[tc] *
max_weight) /
link_speed;
tc_weight[tc] = min(tc_weight[tc], max_weight);
sum_weight += tc_weight[tc];
}
}
/* WSP, if min_rate is set for at least one TC.
* RR otherwise.
*
* NB! MAC FW sets arb mode itself if PTP is enabled. We shouldn't
* overwrite it here in that case.
*/
if (!nic_cfg->is_ptp)
hw_atl_tps_tx_pkt_shed_data_arb_mode_set(self, min_rate_msk ? 1U : 0U);
/* Data TC Arbiter takes precedence over Descriptor TC Arbiter,
* leave Descriptor TC Arbiter as RR.
*/
hw_atl_tps_tx_pkt_shed_desc_tc_arb_mode_set(self, 0U);
hw_atl_tps_tx_desc_rate_mode_set(self, nic_cfg->is_qos ? 1U : 0U);
for (tc = 0; tc != nic_cfg->tcs; tc++) {
const u32 en = (nic_cfg->tc_max_rate[tc] != 0) ? 1U : 0U;
const u32 desc = AQ_NIC_CFG_TCVEC2RING(nic_cfg, tc, 0);
u32 weight, max_credit;
hw_atl_tps_tx_pkt_shed_desc_tc_max_credit_set(self, tc,
fixed_max_credit);
hw_atl_tps_tx_pkt_shed_desc_tc_weight_set(self, tc, 0x1E);
if (num_min_rated_tcs) {
weight = tc_weight[tc];
if (!weight && sum_weight < max_weight)
weight = (max_weight - sum_weight) /
(nic_cfg->tcs - num_min_rated_tcs);
else if (!weight)
weight = 0x64;
max_credit = max(8 * weight, fixed_max_credit);
} else {
weight = 0x64;
max_credit = 0xFFF;
}
hw_atl_tps_tx_pkt_shed_tc_data_weight_set(self, tc, weight);
hw_atl_tps_tx_pkt_shed_tc_data_max_credit_set(self, tc,
max_credit);
hw_atl_tps_tx_desc_rate_en_set(self, desc, en);
if (en) {
/* Nominal rate is always 10G */
const u32 rate = 10000U * scale /
nic_cfg->tc_max_rate[tc];
const u32 rate_int = rate >>
HW_ATL_TPS_DESC_RATE_Y_WIDTH;
const u32 rate_frac = rate & frac_msk;
hw_atl_tps_tx_desc_rate_x_set(self, desc, rate_int);
hw_atl_tps_tx_desc_rate_y_set(self, desc, rate_frac);
} else {
/* A value of 1 indicates the queue is not
* rate controlled.
*/
hw_atl_tps_tx_desc_rate_x_set(self, desc, 1U);
hw_atl_tps_tx_desc_rate_y_set(self, desc, 0U);
}
}
for (tc = nic_cfg->tcs; tc != AQ_CFG_TCS_MAX; tc++) {
const u32 desc = AQ_NIC_CFG_TCVEC2RING(nic_cfg, tc, 0);
hw_atl_tps_tx_desc_rate_en_set(self, desc, 0U);
hw_atl_tps_tx_desc_rate_x_set(self, desc, 1U);
hw_atl_tps_tx_desc_rate_y_set(self, desc, 0U);
}
return aq_hw_err_from_flags(self);
}
static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self)
Annotation
- Immediate include surface: `../aq_hw.h`, `../aq_hw_utils.h`, `../aq_ring.h`, `../aq_nic.h`, `../aq_phy.h`, `hw_atl_b0.h`, `hw_atl_utils.h`, `hw_atl_llh.h`.
- Detected declarations: `function hw_atl_b0_hw_reset`, `function hw_atl_b0_set_fc`, `function hw_atl_b0_tc_ptp_set`, `function hw_atl_b0_hw_qos_set`, `function hw_atl_b0_hw_rss_hash_set`, `function hw_atl_b0_hw_rss_set`, `function hw_atl_b0_hw_offload_set`, `function hw_atl_b0_hw_init_tx_tc_rate_limit`, `function hw_atl_b0_hw_init_tx_path`, `function hw_atl_b0_hw_init_rx_rss_ctrl1`.
- 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.
- 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.