Diagnostic APIs are crucial for bring-up and field failures (see this series' bring-up post). Fact-checking against the real SWS reveals a surprise here that corrects the original plan ("switched at the switch level instead of the PHY level").
Most of the |
The forwarding APIs at a glance
| EthSwt API | Forwards to |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Each of these functions uses the EthIf driver abstraction to pass the call
through to the EthTrcv instance referenced via EthSwtPortTrcvRef (see
Part 3 of this series).
Practical consequence: if an |
EthSwt_GetPortIdentifier: a clever detail
This function returns the port’s OUI (Organizationally Unique Identifier, 24 bits) — with a notable encoding rule:
If the OUI can be obtained from the referenced
EthTrcvviaEthTrcv_GetPhyIdentifier,EthSwt_GetPortIdentifiersets the 8 most significant bits to0x00xxxxxxIf it can’t be obtained, or comes directly from the switch port itself, the 8 most significant bits are set to
0xFFxxxxxx
This encoding lets you tell where the OUI came from just from the return value alone — a useful diagnostic feature for distinguishing whether you got information about a real external PHY chip or about the switch port itself. |
Switch-native diagnostics: GetSwitchIdentifier
Unlike the pure forwarding APIs, EthSwt_GetSwitchIdentifier actually
identifies the switch chip itself — relevant for multi-switch systems
where several identical chips need to be distinguished.
EthSwt_GetPortIdentifier, by contrast, is a hybrid: it prefers the OUI
from the referenced EthTrcv, but falls back to a switch-native
identifier if no transceiver is referenced or it can’t provide an OUI
(see the encoding rule above).
Case study: a port shows sporadic failures
Check signal quality —
EthSwt_GetPortSignalQuality; if the call returns0xFFFFFFFF, either the transceiver reference is missing or the PHY doesn’t support signal quality measurementTrigger cable diagnostics —
EthSwt_RunPortCableDiagnostic(asynchronous), then fetch the result viaEthSwt_GetPortCableDiagnosticsResultLoopback test —
EthSwt_SetPortLoopbackModeto narrow the fault down to the PHY/line level, independent of the switch fabricVerify port identity —
EthSwt_GetPortIdentifier, to make sure the expected port or PHY chip is actually being addressed
Summary
| Aspect | Key takeaway |
|---|---|
Forwarding APIs | Cable diagnostics, test/loopback/Tx mode, and signal quality are pure
wrappers around the corresponding |
Without a transceiver reference | These APIs return |
OUI encoding |
|
Switch-native diagnostics |
|