drivers/net/ethernet/engleder/tsnep_selftests.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/engleder/tsnep_selftests.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/engleder/tsnep_selftests.c- Extension
.c- Size
- 21754 bytes
- Lines
- 812
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
tsnep.hnet/pkt_sched.h
Detected Declarations
enum tsnep_testfunction enable_gc_timeoutfunction gc_timeout_signaledfunction ack_gc_timeoutfunction enable_gcfunction disable_gcfunction gc_delayed_enablefunction tsnep_test_gc_enablefunction delay_base_timefunction get_gate_statefunction get_operationfunction check_gatefunction check_gate_durationfunction enable_check_tapriofunction disable_tapriofunction run_tapriofunction tsnep_test_tapriofunction tsnep_test_taprio_changefunction tsnep_test_taprio_extensionfunction tsnep_ethtool_get_test_countfunction tsnep_ethtool_get_test_stringsfunction tsnep_ethtool_self_test
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2021 Gerhard Engleder <gerhard@engleder-embedded.com> */
#include "tsnep.h"
#include <net/pkt_sched.h>
enum tsnep_test {
TSNEP_TEST_ENABLE = 0,
TSNEP_TEST_TAPRIO,
TSNEP_TEST_TAPRIO_CHANGE,
TSNEP_TEST_TAPRIO_EXTENSION,
};
static const char tsnep_test_strings[][ETH_GSTRING_LEN] = {
"Enable timeout (offline)",
"TAPRIO (offline)",
"TAPRIO change (offline)",
"TAPRIO extension (offline)",
};
#define TSNEP_TEST_COUNT (sizeof(tsnep_test_strings) / ETH_GSTRING_LEN)
static bool enable_gc_timeout(struct tsnep_adapter *adapter)
{
iowrite8(TSNEP_GC_ENABLE_TIMEOUT, adapter->addr + TSNEP_GC);
if (!(ioread32(adapter->addr + TSNEP_GC) & TSNEP_GC_TIMEOUT_ACTIVE))
return false;
return true;
}
static bool gc_timeout_signaled(struct tsnep_adapter *adapter)
{
if (ioread32(adapter->addr + TSNEP_GC) & TSNEP_GC_TIMEOUT_SIGNAL)
return true;
return false;
}
static bool ack_gc_timeout(struct tsnep_adapter *adapter)
{
iowrite8(TSNEP_GC_ENABLE_TIMEOUT, adapter->addr + TSNEP_GC);
if (ioread32(adapter->addr + TSNEP_GC) &
(TSNEP_GC_TIMEOUT_ACTIVE | TSNEP_GC_TIMEOUT_SIGNAL))
return false;
return true;
}
static bool enable_gc(struct tsnep_adapter *adapter, bool a)
{
u8 enable;
u8 active;
if (a) {
enable = TSNEP_GC_ENABLE_A;
active = TSNEP_GC_ACTIVE_A;
} else {
enable = TSNEP_GC_ENABLE_B;
active = TSNEP_GC_ACTIVE_B;
}
iowrite8(enable, adapter->addr + TSNEP_GC);
if (!(ioread32(adapter->addr + TSNEP_GC) & active))
return false;
return true;
}
static bool disable_gc(struct tsnep_adapter *adapter)
{
iowrite8(TSNEP_GC_DISABLE, adapter->addr + TSNEP_GC);
if (ioread32(adapter->addr + TSNEP_GC) &
(TSNEP_GC_ACTIVE_A | TSNEP_GC_ACTIVE_B))
return false;
return true;
}
static bool gc_delayed_enable(struct tsnep_adapter *adapter, bool a, int delay)
{
u64 before, after;
u32 time;
bool enabled;
if (!disable_gc(adapter))
return false;
before = ktime_get_ns();
Annotation
- Immediate include surface: `tsnep.h`, `net/pkt_sched.h`.
- Detected declarations: `enum tsnep_test`, `function enable_gc_timeout`, `function gc_timeout_signaled`, `function ack_gc_timeout`, `function enable_gc`, `function disable_gc`, `function gc_delayed_enable`, `function tsnep_test_gc_enable`, `function delay_base_time`, `function get_gate_state`.
- 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.