drivers/net/ethernet/intel/igc/igc_tsn.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igc/igc_tsn.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igc/igc_tsn.c- Extension
.c- Size
- 19676 bytes
- Lines
- 730
- 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.
- 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
igc.higc_base.higc_hw.higc_tsn.h
Detected Declarations
enum tx_queuefunction igc_fpe_init_smd_framefunction igc_fpe_init_tx_descriptorfunction igc_fpe_xmit_smd_framefunction igc_fpe_configure_txfunction igc_fpe_send_mpacketfunction igc_fpe_initfunction igc_fpe_clear_preempt_queuefunction igc_fpe_map_preempt_tc_to_queuefunction igc_fpe_save_preempt_queuefunction is_any_launchtimefunction is_cbs_enabledfunction igc_tsn_new_flagsfunction igc_tsn_is_tx_mode_in_tsnfunction igc_tsn_adjust_txtime_offsetfunction igc_tsn_restore_retx_defaultfunction igc_tsn_is_taprio_activated_by_userfunction igc_tsn_tx_arbfunction igc_tsn_set_rxpbsizefunction igc_tsn_disable_offloadfunction igc_tsn_set_retx_qbvfullthresholdfunction igc_fpe_get_frag_size_multfunction igc_fpe_get_supported_frag_sizefunction igc_tsn_enable_offloadfunction igc_tsn_resetfunction igc_tsn_will_tx_mode_changefunction igc_tsn_offload_apply
Annotated Snippet
if (adapter->taprio_offload_enable) {
/* If taprio_offload_enable is set we are in "taprio"
* mode and we need to be strict about the
* cycles: only transmit a packet if it can be
* completed during that cycle.
*
* If taprio_offload_enable is NOT true when
* enabling TSN offload, the cycle should have
* no external effects, but is only used internally
* to adapt the base time register after a second
* has passed.
*
* Enabling strict mode in this case would
* unnecessarily prevent the transmission of
* certain packets (i.e. at the boundary of a
* second) and thus interfere with the launchtime
* feature that promises transmission at a
* certain point in time.
*/
txqctl |= IGC_TXQCTL_STRICT_CYCLE |
IGC_TXQCTL_STRICT_END;
}
if (ring->launchtime_enable)
txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
if (!adapter->fpe.tx_enabled) {
/* fpe inactive: clear both flags */
txqctl &= ~IGC_TXQCTL_PREEMPTIBLE;
txdctl &= ~IGC_TXDCTL_PRIORITY_HIGH;
} else if (ring->preemptible) {
/* fpe active + preemptible: enable preemptible queue + set low priority */
txqctl |= IGC_TXQCTL_PREEMPTIBLE;
txdctl &= ~IGC_TXDCTL_PRIORITY_HIGH;
} else {
/* fpe active + express: enable express queue + set high priority */
txqctl &= ~IGC_TXQCTL_PREEMPTIBLE;
txdctl |= IGC_TXDCTL_PRIORITY_HIGH;
}
wr32(IGC_TXDCTL(ring->reg_idx), txdctl);
/* Skip configuring CBS for Q2 and Q3 */
if (i > 1)
goto skip_cbs;
if (ring->cbs_enable) {
if (i == 0)
txqctl |= IGC_TXQCTL_QAV_SEL_CBS0;
else
txqctl |= IGC_TXQCTL_QAV_SEL_CBS1;
/* According to i225 datasheet section 7.5.2.7, we
* should set the 'idleSlope' field from TQAVCC
* register following the equation:
*
* value = link-speed 0x7736 * BW * 0.2
* ---------- * ----------------- (E1)
* 100Mbps 2.5
*
* Note that 'link-speed' is in Mbps.
*
* 'BW' is the percentage bandwidth out of full
* link speed which can be found with the
* following equation. Note that idleSlope here
* is the parameter from this function
* which is in kbps.
*
* BW = idleSlope
* ----------------- (E2)
* link-speed * 1000
*
* That said, we can come up with a generic
* equation to calculate the value we should set
* it TQAVCC register by replacing 'BW' in E1 by E2.
* The resulting equation is:
*
* value = link-speed * 0x7736 * idleSlope * 0.2
* ------------------------------------- (E3)
* 100 * 2.5 * link-speed * 1000
*
* 'link-speed' is present in both sides of the
* fraction so it is canceled out. The final
* equation is the following:
*
* value = idleSlope * 61036
* ----------------- (E4)
* 2500000
*
* NOTE: For i225, given the above, we can see
Annotation
- Immediate include surface: `igc.h`, `igc_base.h`, `igc_hw.h`, `igc_tsn.h`.
- Detected declarations: `enum tx_queue`, `function igc_fpe_init_smd_frame`, `function igc_fpe_init_tx_descriptor`, `function igc_fpe_xmit_smd_frame`, `function igc_fpe_configure_tx`, `function igc_fpe_send_mpacket`, `function igc_fpe_init`, `function igc_fpe_clear_preempt_queue`, `function igc_fpe_map_preempt_tc_to_queue`, `function igc_fpe_save_preempt_queue`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.