The Ethernet Agent is an RDK-B middleware component responsible for managing Ethernet interface configurations, monitoring interface status, and handling WAN failover operations in broadband gateway devices. This component provides comprehensive Ethernet interface management services including interface discovery, configuration management, status monitoring, and integration with WAN management subsystems.

The component serves as the primary interface between the RDK-B middleware stack and the underlying Ethernet hardware abstraction layer (HAL), enabling dynamic configuration of Ethernet interfaces for LAN and WAN operations. It supports advanced features like Ethernet WAN operation mode selection, interface bridging control, and real-time status monitoring with event-driven notifications.

The Ethernet Agent integrates seamlessly with other RDK-B components including the WAN Manager, VLAN Agent, and Component Registry, providing a unified interface for Ethernet interface management across different deployment scenarios. It supports both traditional WAN agent integration and modern WAN manager architectures based on compile-time feature flags.

graph LR
    subgraph "External Systems"
        RemoteMgmt["Remote Management"]
        LocalUI["Local Web UI"]
        CloudMgmt["Cloud Management"]
    end

    subgraph "RDK-B Platform"
        subgraph "Remote Management Agents"
            ProtocolAgents["TR-069/WebPA/TR-369<br/>Protocol Agents"]
        end

        subgraph "Ethernet Middleware"
            EthAgent["CcspEthAgent<br/>(Ethernet Agent)"]
        end

        subgraph "RDK-B Core Components"
            PSM["PSM<br/>(Parameter Storage)"]
            CR["Component Registry"]
            WanMgr["WAN Manager"]
            VlanAgent["VLAN Agent"]
        end

        subgraph "System Layer"
            HAL["Ethernet HAL"]
            Linux["Linux Kernel<br/>(Network Stack)"]
        end
    end

    %% External connections
    RemoteMgmt -->|TR-069/WebPA/TR-369| ProtocolAgents
    LocalUI -->|HTTP/HTTPS| ProtocolAgents
    CloudMgmt -->|WebConfig| ProtocolAgents

    %% Upper layer to Ethernet Agent
    ProtocolAgents -->|R-BUS/DBUS| EthAgent

    %% Ethernet Agent to Other RDK-B Components
    EthAgent -->|Configuration| PSM
    EthAgent -->|Registration| CR
    EthAgent <-->|WAN Events| WanMgr
    EthAgent <-->|VLAN Config| VlanAgent

    %% System Layer interactions
    EthAgent <-->|HAL APIs| HAL
    HAL <-->|Driver Interfaces| Linux

    classDef external fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    classDef ethAgent fill:#e3f2fd,stroke:#1976d2,stroke-width:3px;
    classDef rdkbComponent fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px;
    classDef system fill:#fce4ec,stroke:#c2185b,stroke-width:2px;

    class RemoteMgmt,LocalUI,CloudMgmt external;
    class EthAgent ethAgent;
    class ProtocolAgents,PSM,CR,WanMgr,VlanAgent rdkbComponent;
    class HAL,Linux system;

Key Features & Responsibilities:

  • Ethernet Interface Management: Provides comprehensive management of Ethernet interfaces including discovery, configuration, and status monitoring for both LAN and WAN operations
  • TR-181 Data Model Support: Implements Device.Ethernet object hierarchy with support for interface configuration, statistics collection, and WAN mode selection parameters
  • WAN Failover Integration: Supports Ethernet WAN operation with automatic failover capabilities and integration with WAN Manager for multi-WAN scenarios
  • Dynamic Interface Configuration: Enables runtime configuration of Ethernet interface parameters including enable/disable, upstream designation, and bridge membership control
  • Real-time Status Monitoring: Provides continuous monitoring of interface status with event-driven notifications for link state changes and operational mode transitions
  • HAL Abstraction Layer: Abstracts underlying Ethernet hardware through standardized HAL interfaces enabling platform-independent operation across different hardware implementations

Design

The Ethernet Agent employs a layered architecture design that separates interface abstraction, data model management, and platform integration concerns. The core design follows the RDK-B component pattern with a Service Provider (SSP) layer for process management, a middle layer for TR-181 data model implementation, and a board-specific abstraction layer for HAL integration. This design ensures maintainability while providing flexible deployment options across different hardware platforms.

The component's architecture supports multiple operational modes through compile-time feature flags, enabling integration with either traditional WAN Agent architecture (FEATURE_RDKB_WAN_AGENT) or modern WAN Manager systems (FEATURE_RDKB_WAN_MANAGER). The design emphasizes event-driven communication patterns with other middleware components, utilizing R-BUS for inter-component messaging and HAL callbacks for hardware event processing.

The data persistence strategy leverages the Persistent Storage Manager (PSM) for configuration storage while maintaining runtime state in memory for performance. The component implements a robust error handling and recovery mechanism with comprehensive logging for troubleshooting and system diagnostics. The runtime architecture is event-driven but multi-threaded, with a main control path complemented by dedicated pthreads for responsibilities such as event handling, telemetry/logging, and state management. Interface state coordination is therefore designed to rely on clear thread ownership and synchronization rather than assuming single-threaded execution.

graph TD
    subgraph EthAgentContainer ["Ethernet Agent Process (CcspEthAgent)"]
        subgraph SSP ["Service Provider Layer"]
            SSPMain[SSP Main Process]
            MsgBusIntf[R-BUS Interface]
            ServiceReg[Service Registration]
        end

        subgraph MiddleLayer ["Middle Layer (TR-181 DML)"]
            EthDML[Ethernet DML Handler]
            InterfaceDML[Interface DML Handler]
            StatsModule[Statistics Module]
            R-BUSHandler[R-BUS Event Handler]
        end

        subgraph BoardAPI ["Board API Layer"]
            EthManager[Ethernet Manager]
            HALInterface[HAL Interface Module]
            ConfigMgr[Configuration Manager]
        end
    end

    subgraph ExternalDeps ["External Dependencies"]
        HAL[Ethernet HAL]
        PSMStore[PSM Storage]
        WanMgrSvc[WAN Manager Service]
    end

    SSPMain --> MsgBusIntf
    MsgBusIntf --> ServiceReg
    ServiceReg --> EthDML

    EthDML --> InterfaceDML
    EthDML --> StatsModule
    InterfaceDML --> R-BUSHandler

    R-BUSHandler --> EthManager
    EthManager --> HALInterface
    HALInterface --> ConfigMgr

    HALInterface -->|HAL API Calls| HAL
    ConfigMgr -->|PSM Get/Set| PSMStore
    R-BUSHandler -->|R-BUS Events| WanMgrSvc

    classDef ssp fill:#e3f2fd,stroke:#1976d2,stroke-width:2px;
    classDef middle fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px;
    classDef board fill:#fff8e1,stroke:#f57c00,stroke-width:2px;
    classDef external fill:#e8f5e8,stroke:#388e3c,stroke-width:2px;

    class SSPMain,MsgBusIntf,ServiceReg ssp;
    class EthDML,InterfaceDML,StatsModule,R-BUSHandler middle;
    class EthManager,HALInterface,ConfigMgr board;
    class HAL,PSMStore,WanMgrSvc external;

Prerequisites and Dependencies

Build-Time Flags and Configuration:

Configure OptionBuild FlagPurposeDefault
--enable-wanfailoverFEATURE_WAN_FAIL_OVEREnable WAN failover capabilities and R-BUS integrationDisabled
--enable-core_net_lib_feature_supportCORE_NET_LIB_FEATURE_SUPPORT (Makefile), CORE_NET_LIB (code guard)Enable linking against -lnet library. Sets CORE_NET_LIB_FEATURE_SUPPORT in Makefile for linking; code uses #ifdef CORE_NET_LIB which must be separately defined via CFLAGSDisabled
--enable-dropearlyDROP_ROOT_EARLYEnable non-root execution by dropping root privileges early in process lifecycleDisabled
--enable-notifyENABLE_SD_NOTIFYDefine systemd notification flag (note: currently defined but not used in codebase)Disabled
--enable-unitTestDockerSupportUNIT_TEST_DOCKER_SUPPORTEnable Docker-based unit testing support with static function visibilityDisabled


RDK-B Platform and Integration Requirements

  • RDK-B Components: Component Registry, Persistent Storage Manager (PSM), WAN Manager (if FEATURE_RDKB_WAN_MANAGER enabled), VLAN Agent (if FEATURE_RDKB_WAN_AGENT enabled)
  • HAL Dependencies: ccsp_hal_ethsw.h interface with minimum HAL specification compliance for Ethernet switching operations; platform-specific statistics support (ETH_STATS_ENABLED) may be available on some platforms
  • Systemd Services: ccsp-cr.service must be active, psm.service for configuration persistence, dbus.service for inter-process communication
  • Hardware Requirements: Ethernet switching hardware with HAL support, minimum 1 Ethernet interface, WAN-capable Ethernet port for WAN failover features
  • Message Bus: R-BUS component registration with Device.Ethernet namespace reservation for TR-181 support and inter-component communication
  • TR-181 Data Model: Device.Ethernet object hierarchy support, Device.DeviceInfo parameters for AutoWAN feature discovery
  • Configuration Files: TR181-EthAgent.xml for data model definitions (dynamically modified based on DISTRO features), PSM database initialization for default interface configurations
  • Startup Order: Component Registry → PSM → Ethernet Agent → WAN Manager (if enabled), HAL initialization must complete before Ethernet Agent startup

Threading Model

The Ethernet Agent uses a multi-threaded design with dedicated execution contexts for core control flow, asynchronous event handling, and background activities such as telemetry/logging. The agent spawns multiple pthreads including a state machine thread (CcspEthManager_StateMachineThread), event handler threads (SysEventHandlerThrd, CosaDmlEthEventHandlerThread), monitoring threads (ThreadMonitorPhyAndNotify, CcspHalExtSw_AssociatedDeviceMonitorThread), message update threads (ThreadUpdateInformMsg, ThreadBootInformMsg), and configuration threads (ThreadConfigEthWan, CosaDmlEthWanChangeHandling). Work is distributed across these threads, so the implementation treats interface state, configuration data, and published status as shared resources requiring proper synchronization.

  • Threading Architecture: Multi-threaded with event-driven processing across dedicated worker threads for state machine operations, event handling, monitoring, and background tasks
  • Primary Responsibilities: TR-181 DML operations execute in the main thread, while state-machine transitions, HAL event notifications, status polling, telemetry/logging, and WAN configuration changes execute in dedicated pthread contexts
  • Event Processing: Asynchronous events from HAL, R-BUS method calls, timers, and internal worker threads are coordinated so that updates are serialized where required before mutating shared component state
  • Synchronization / Ownership Rules: Shared mutable state must only be accessed under the component's synchronization primitives or via explicit thread ownership and hand-off mechanisms. Threads that do not own a piece of state should communicate changes through the agent's event/dispatch path rather than updating shared structures directly

Component State Flow

Initialization to Active State

The Ethernet Agent follows a structured initialization sequence from system startup to full operational state. The component initializes its service provider layer, registers with the Component Registry, loads interface configurations from persistent storage, establishes HAL connections, and transitions to active monitoring mode.

sequenceDiagram
    participant System as System Startup
    participant EthAgent as Ethernet Agent
    participant CR as Component Registry
    participant PSM as PSM
    participant HAL as Ethernet HAL
    participant WanMgr as WAN Manager

    System->>EthAgent: Start CcspEthAgent Process
    Note over EthAgent: State: Initializing<br/>Load configuration, setup logging

    EthAgent->>CR: Register Component & Namespace
    CR-->>EthAgent: Registration Complete
    Note over EthAgent: State: Initializing → LoadingConfig

    EthAgent->>PSM: Load Persistent Configuration
    PSM-->>EthAgent: Interface Configs Retrieved
    Note over EthAgent: State: LoadingConfig → InitializingHAL

    EthAgent->>HAL: Initialize Ethernet HAL
    HAL-->>EthAgent: HAL Ready & Interface Discovery
    Note over EthAgent: State: InitializingHAL → ConnectingServices

    EthAgent->>WanMgr: Establish R-BUS Connection (if WAN Manager enabled)
    WanMgr-->>EthAgent: Connection Established
    Note over EthAgent: State: ConnectingServices → Active

    EthAgent->>System: Initialization Complete (Active State)

    loop Runtime Operations
        Note over EthAgent: State: Active<br/>Monitor interfaces, process events
        EthAgent->>EthAgent: Process HAL Events & R-BUS Methods
        EthAgent->>HAL: Poll Interface Status
        HAL-->>EthAgent: Status Updates
        EthAgent->>WanMgr: Publish Interface Events
    end

    System->>EthAgent: Stop Request
    Note over EthAgent: State: Active → Shutdown
    EthAgent->>PSM: Persist Configuration
    EthAgent->>HAL: Cleanup HAL Resources
    EthAgent->>System: Shutdown Complete

Runtime State Changes and Context Switching

The Ethernet Agent manages several runtime state transitions based on interface events, configuration changes, and WAN operational mode switching. These state changes are triggered by HAL events, TR-181 parameter modifications, and external component requests.

State Change Triggers:

  • Interface link state changes (up/down) trigger immediate status updates and event notifications to subscribing components
  • WAN operational mode changes trigger interface reconfiguration and notification to WAN Manager for failover coordination
  • Configuration parameter updates trigger validation, persistence to PSM, and application of new settings to HAL interfaces
  • HAL error conditions trigger error state transitions with automatic recovery attempts and comprehensive error logging

Context Switching Scenarios:

  • WAN Failover Context: Component switches between monitoring primary and backup WAN interfaces based on WAN Manager requests
  • Bridge Mode Context: Interfaces dynamically added/removed from bridge configurations based on LAN/WAN role assignments
  • AutoWAN Mode Context: Automatic detection and configuration of optimal WAN interface based on connectivity validation

Call Flow

Initialization Call Flow:

sequenceDiagram
    participant Init as Initialization Process
    participant SSP as SSP Main
    participant DML as Ethernet DML
    participant HAL as Ethernet HAL
    participant PSM as PSM

    Init->>SSP: Start CcspEthAgent
    SSP->>SSP: Initialize Logging & Signal Handlers
    SSP->>DML: Load TR-181 Data Model
    DML->>DML: Register Parameter Handlers
    DML->>PSM: Load Persistent Interface Configs
    PSM-->>DML: Configuration Data
    DML->>HAL: Initialize Ethernet HAL
    HAL-->>DML: Interface Discovery & Status
    DML->>SSP: DML Initialization Complete
    SSP->>Init: Component Ready (Active State)

Interface Configuration Call Flow:

The most critical operational flow involves processing TR-181 parameter changes and applying them to the underlying Ethernet interfaces through the HAL layer.

sequenceDiagram
    participant Client as External Client
    participant DML as Ethernet DML
    participant Manager as Ethernet Manager  
    participant HAL as Ethernet HAL
    participant PSM as PSM
    participant WanMgr as WAN Manager

    Client->>DML: Set TR-181 Parameter (R-BUS)
    Note over DML: Validate parameter value & constraints
    DML->>Manager: Process Configuration Change
    Manager->>HAL: Apply Interface Configuration
    HAL-->>Manager: Configuration Applied/Error
    alt Configuration Success
        Manager->>PSM: Persist Configuration
        PSM-->>Manager: Storage Complete
        Manager->>WanMgr: Notify Interface Change (if WAN interface)
        WanMgr-->>Manager: Acknowledgment
        Manager-->>DML: Success Response
        DML-->>Client: Parameter Set Complete
    else Configuration Error  
        Manager-->>DML: Error Response
        DML-->>Client: Error - Invalid Configuration
    end

TR‑181 Data Models

Supported TR-181 Parameters

The Ethernet Agent implements comprehensive TR-181 parameter support following BBF TR-181 Issue 2 specifications with RDK-Central extensions for enhanced Ethernet interface management and WAN failover capabilities. The implementation covers the Device.Ethernet object hierarchy with custom extensions for AutoWAN feature support and interface bridging control.

Build Configuration Note: The Ethernet Agent's TR-181 data model varies based on compile-time feature flags defined in the build configuration:

Interface Table Implementation (mutually exclusive): - FEATURE_RDKB_WAN_MANAGER: Implements standard TR-181 Device.Ethernet.Interface.{i} table with full parameter support (Enable, Status, Alias, etc.) and Stats sub-object. This is the modern WAN Manager integration mode. - FEATURE_RDKB_WAN_AGENT: Implements RDK-Central custom Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i} table with vendor-specific parameters (X_RDKCENTRAL-COM_Upstream, X_RDKCENTRAL-COM_Status, etc.). This is the legacy WAN Agent integration mode.

Optional AutoWAN Feature (independent flag): - AUTOWAN_ENABLE: When enabled, adds the Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN object with automatic WAN interface selection capabilities. This object can be present in either WAN_MANAGER or WAN_AGENT builds.

Only one interface table implementation is active in a given build. The object hierarchies shown below indicate which build configuration each applies to.

Object Hierarchy

When FEATURE_RDKB_WAN_MANAGER is enabled:

Device.
├── DeviceInfo.
│   └── X_RDKCENTRAL-COM_AutowanFeatureSupport (boolean, R)
└── Ethernet.
    ├── X_RDKCENTRAL-COM_EthHost_Sync (boolean, R/W)
    ├── X_RDKCENTRAL-COM_WAN.
    │   ├── Enabled (boolean, R/W)
    │   └── Port (unsignedInt, R)
    ├── Interface.{i}.                                         [Standard TR-181]
    │   ├── Enable (boolean, R/W)
    │   ├── Status (string, R)
    │   ├── Alias (string, R/W)
    │   ├── Name (string, R)
    │   ├── LastChange (unsignedInt, R)
    │   ├── LowerLayers (string, R/W)
    │   ├── Upstream (boolean, R/W)                            [R/W if FEATURE_RDKB_WAN_UPSTREAM]
    │   ├── MACAddress (string, R)
    │   ├── MaxBitRate (int, R)
    │   ├── CurrentBitRate (unsignedInt, R)
    │   ├── DuplexMode (string, R/W)
    │   ├── X_RDKCENTRAL-COM_AssociatedDevice.{i}.
    │   │   └── MACAddress (string, R/W)
    │   └── Stats.
    │       ├── BytesSent (string, R)                          [64-bit counter as string]
    │       ├── BytesReceived (string, R)                      [64-bit counter as string]
    │       ├── PacketsSent (unsignedInt, R)
    │       ├── PacketsReceived (unsignedInt, R)
    │       ├── ErrorsSent (unsignedInt, R)
    │       ├── ErrorsReceived (unsignedInt, R)
    │       ├── UnicastPacketsSent (unsignedInt, R)
    │       ├── UnicastPacketsReceived (unsignedInt, R)
    │       ├── DiscardPacketsSent (unsignedInt, R)
    │       ├── DiscardPacketsReceived (unsignedInt, R)
    │       ├── MulticastPacketsSent (unsignedInt, R)
    │       ├── MulticastPacketsReceived (unsignedInt, R)
    │       ├── BroadcastPacketsSent (unsignedInt, R)
    │       ├── BroadcastPacketsReceived (unsignedInt, R)
    │       └── UnknownProtoPacketsReceived (unsignedInt, R)
    └── X_RDKCENTRAL-COM_EthernetWAN.                          [Only if AUTOWAN_ENABLE]
        ├── SelectedOperationalMode (string, R/W)
        ├── CurrentOperationalMode (string, R)
        ├── LastKnownOperationalMode (string, R)
        ├── ConfigureWan (boolean, R/W)
        ├── PostCfgWanFinalize (string, R/W)
        └── RequestPhyStatus (string, R/W)

When FEATURE_RDKB_WAN_AGENT is enabled:

Device.
├── DeviceInfo.
│   └── X_RDKCENTRAL-COM_AutowanFeatureSupport (boolean, R)
└── Ethernet.
    ├── X_RDKCENTRAL-COM_EthHost_Sync (boolean, R/W)
    ├── X_RDKCENTRAL-COM_WAN.
    │   ├── Enabled (boolean, R/W)
    │   └── Port (unsignedInt, R)
    ├── X_RDKCENTRAL-COM_Interface.{i}.                        [RDK-Central Custom]
    │   ├── X_RDKCENTRAL-COM_Upstream (boolean, R/W)
    │   ├── X_RDKCENTRAL-COM_WanValidated (boolean, R/W)
    │   ├── X_RDKCENTRAL-COM_Name (string, R)
    │   ├── X_RDKCENTRAL-COM_Status (string, R)                [Up(1), Down(2)]
    │   └── X_RDKCENTRAL-COM_WanStatus (string, R/W)          [Up(1), Down(2)]
    └── X_RDKCENTRAL-COM_EthernetWAN.                          [Only if AUTOWAN_ENABLE]
        ├── SelectedOperationalMode (string, R/W)
        ├── CurrentOperationalMode (string, R)
        ├── LastKnownOperationalMode (string, R)
        ├── ConfigureWan (boolean, R/W)
        ├── PostCfgWanFinalize (string, R/W)
        └── RequestPhyStatus (string, R/W)

Parameter Definitions

Common Parameters (all build configurations):

Parameter PathData TypeAccessDefault ValueDescriptionBBF Compliance
Device.DeviceInfo.X_RDKCENTRAL-COM_AutowanFeatureSupportbooleanRfalseIndicates whether the device supports AutoWAN feature for automatic WAN interface selection and failover capabilitiesRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthHost_SyncbooleanR/WfalseControls synchronization of Ethernet host device information with connected devices for network topology discoveryRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_WAN.EnabledbooleanR/WfalseEnables Ethernet WAN functionality allowing Ethernet interfaces to operate as WAN connectionsRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_WAN.PortunsignedIntR0Indicates the physical port number currently configured for Ethernet WAN operationRDK-Central Extension

FEATURE_RDKB_WAN_MANAGER Interface Parameters:

Parameter PathData TypeAccessDefault ValueDescriptionBBF Compliance
Device.Ethernet.Interface.{i}.EnablebooleanR/WtrueEnables or disables the Ethernet interface. When disabled, interface is administratively downTR-181 Issue 2
Device.Ethernet.Interface.{i}.StatusstringR"Down"Current operational status: Up(1), Down(2), Unknown(3), Dormant(4), NotPresent(5), LowerLayerDown(6), Error(7)TR-181 Issue 2
Device.Ethernet.Interface.{i}.AliasstringR/W""User-assigned name for the interface. Alternative identifier for interface referenceTR-181 Issue 2
Device.Ethernet.Interface.{i}.NamestringRSystem-assignedSystem-assigned interface name (e.g., eth0, eth1). Read-only identifierTR-181 Issue 2
Device.Ethernet.Interface.{i}.LastChangeunsignedIntR0Time in seconds since last interface state change. Used for monitoring interface stabilityTR-181 Issue 2
Device.Ethernet.Interface.{i}.LowerLayersstringR/W""Comma-separated list of lower-layer interface references for layered interface stackTR-181 Issue 2
Device.Ethernet.Interface.{i}.UpstreambooleanR/W¹falseIndicates whether interface is designated as upstream (WAN) connection. Controls routing and bridge membershipTR-181 Issue 2
Device.Ethernet.Interface.{i}.MACAddressstringRSystem-assignedPhysical MAC address of the Ethernet interface in colon-separated hexadecimal notationTR-181 Issue 2
Device.Ethernet.Interface.{i}.MaxBitRateintR-1Maximum supported bit rate in Mbps. -1 indicates unknown or auto-negotiationTR-181 Issue 2
Device.Ethernet.Interface.{i}.CurrentBitRateunsignedIntR0Current negotiated bit rate in Mbps. Reflects active link speedTR-181 Issue 2
Device.Ethernet.Interface.{i}.DuplexModestringR/W"Auto"Interface duplex mode: Half(1), Full(2), Auto(3). Auto enables automatic negotiationTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.BytesSentstringR"0"Total bytes transmitted. Represented as string to support 64-bit counter valuesTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.BytesReceivedstringR"0"Total bytes received. Represented as string to support 64-bit counter valuesTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.PacketsSentunsignedIntR0Total packets transmittedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.PacketsReceivedunsignedIntR0Total packets receivedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.ErrorsSentunsignedIntR0Total packets transmitted with errorsTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.ErrorsReceivedunsignedIntR0Total packets received with errorsTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.UnicastPacketsSentunsignedIntR0Total unicast packets transmittedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.UnicastPacketsReceivedunsignedIntR0Total unicast packets receivedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.DiscardPacketsSentunsignedIntR0Total outbound packets discarded (e.g., buffer full, policy)TR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.DiscardPacketsReceivedunsignedIntR0Total inbound packets discarded (e.g., buffer full, policy)TR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.MulticastPacketsSentunsignedIntR0Total multicast packets transmittedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.MulticastPacketsReceivedunsignedIntR0Total multicast packets receivedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.BroadcastPacketsSentunsignedIntR0Total broadcast packets transmittedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.BroadcastPacketsReceivedunsignedIntR0Total broadcast packets receivedTR-181 Issue 2
Device.Ethernet.Interface.{i}.Stats.UnknownProtoPacketsReceivedunsignedIntR0Total packets received with unknown or unsupported protocolTR-181 Issue 2

¹ Writable only when FEATURE_RDKB_WAN_UPSTREAM is enabled, otherwise read-only

FEATURE_RDKB_WAN_AGENT Interface Parameters:

Parameter PathData TypeAccessDefault ValueDescriptionBBF Compliance
Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i}.X_RDKCENTRAL-COM_UpstreambooleanR/WfalseIndicates whether interface is designated as upstream (WAN) connection for legacy WAN Agent integrationRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i}.X_RDKCENTRAL-COM_WanValidatedbooleanR/WfalseIndicates whether WAN connectivity validation has passed for this interfaceRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i}.X_RDKCENTRAL-COM_NamestringRSystem-assignedSystem-assigned interface name for legacy WAN Agent modeRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i}.X_RDKCENTRAL-COM_StatusstringR"Down"Current operational status for legacy mode: Up(1), Down(2)RDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_Interface.{i}.X_RDKCENTRAL-COM_WanStatusstringR/W"Down"WAN operational status for legacy mode: Up(1), Down(2)RDK-Central Extension

AUTOWAN_ENABLE Parameters (optional feature - only present when AUTOWAN_ENABLE is defined):

Note: The Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN object and its parameters are only available in builds where the AUTOWAN_ENABLE compile-time flag is enabled. This feature is independent of the WAN_MANAGER/WAN_AGENT choice and can be combined with either integration mode.

Parameter PathData TypeAccessDefault ValueDescriptionBBF Compliance
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.SelectedOperationalModestringR/W""User-selected WAN operational mode for automatic interface selection in multi-WAN scenariosRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.CurrentOperationalModestringR""Currently active WAN operational mode reflecting actual system configurationRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.LastKnownOperationalModestringR""Previously active WAN operational mode before current mode. Used for failback operationsRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.ConfigureWanbooleanR/WfalseTriggers WAN interface configuration process when set to true. Self-clearing after processingRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.PostCfgWanFinalizestringR/W""Post-configuration finalization command string for WAN setup completionRDK-Central Extension
Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.RequestPhyStatusstringR/W""Request physical interface status query. Write interface name to trigger status updateRDK-Central Extension

Internal Modules

The Ethernet Agent is structured into distinct functional modules that handle different aspects of Ethernet interface management. Each module has specific responsibilities and interacts through well-defined interfaces to maintain system modularity and testability.

Module/ClassDescriptionKey Files
SSP Main ProcessService provider layer handling process lifecycle, signal management, and R-BUS integration for component startup and shutdown coordinationssp_main.c, ssp_messagebus_interface.c, ssp_action.c
Ethernet DML HandlerTR-181 data model implementation providing parameter access, validation, and event handling for Device.Ethernet object hierarchycosa_ethernet_dml.c, cosa_ethernet_dml.h
Interface DML HandlerSpecialized handler for Device.Ethernet.Interface table operations including dynamic interface discovery, configuration management, and statistics collectioncosa_ethernet_interface_dml.c, cosa_ethernet_interface_dml.h
Ethernet ManagerCore business logic module managing interface state, configuration persistence, and coordination between HAL layer and upper middleware componentscosa_ethernet_manager.c, cosa_ethernet_apis.c
HAL Interface ModuleHardware abstraction layer integration providing platform-independent access to Ethernet hardware capabilities and event handlingeth_hal_interface.c, cosa_ethernet_apis.h
R-BUS HandlerEvent-driven communication module managing R-BUS method registration, event publishing, and inter-component messaging for real-time interface status updatescosa_rbus_handler_apis.c, cosa_rbus_handler_apis.h

Component Interactions

The Ethernet Agent integrates with multiple RDK-B middleware components and external systems to provide comprehensive Ethernet interface management. These interactions include TR-181 parameter access, event notifications, HAL hardware integration, and coordination with WAN management systems.

Interaction Matrix

Target Component/LayerInteraction PurposeKey APIs/Endpoints
RDK-B Middleware Components

WAN ManagerInterface status events and WAN failover coordinationDevice.Ethernet.X_RDKCENTRAL-COM_WAN.Enabled, Device.Ethernet.Interface.{i}.Upstream
VLAN AgentEthernet link configuration and VLAN interface creationDevice.X_RDKCENTRAL-COM_Ethernet.Link.{i}.* parameters via R-BUS
PSMConfiguration persistence for interface settingsdmsb.ethagent.if.{i}.Upstream, dmsb.ethagent.if.{i}.AddToLanBridge
Component RegistryService registration and namespace managementComponent registration with eRT.com.cisco.spvtg.ccsp.ethagent identifier
Telemetry AgentInterface statistics reportingR-BUS events for statistics data: BytesSent, PacketsReceived, ErrorsReceived
System & HAL Layers

Ethernet HALHardware interface control and status monitoringCcspHalEthSwSetPortAdminStatus(), CcspHalEthSwGetPortStatus(), CcspHalEthSwGetEthPortStats()
Linux Network StackDirect interface manipulation for advanced configurations/sys/class/net/{interface}/operstate, ioctl() system calls

Events Published by Ethernet Agent:

Event NameEvent Topic/PathTrigger ConditionSubscriber Components
Interface Status ChangeDevice.Ethernet.Interface.{i}.StatusLink up/down, operational state changesWAN Manager, Telemetry Agent, Web UI
WAN Interface ChangeDevice.Ethernet.X_RDKCENTRAL-COM_WAN.EnabledWAN interface enable/disable, port changesWAN Manager, VLAN Agent
Interface Statistics UpdateDevice.Ethernet.Interface.{i}.Stats.*Periodic statistics collection (configurable interval)Telemetry Agent, SNMP Agent
AutoWAN Mode Change¹Device.Ethernet.X_RDKCENTRAL-COM_EthernetWAN.CurrentOperationalModeWAN operational mode transitionsWAN Manager, Event logging systems

¹ Only published when AUTOWAN_ENABLE is defined

IPC Flow Patterns

Primary IPC Flow - Interface Configuration:

sequenceDiagram
    participant Client as Management Client
    participant EthAgent as Ethernet Agent
    participant HAL as Ethernet HAL
    participant PSM as PSM

    Client->>EthAgent: Set Device.Ethernet.Interface.1.Enable=true (R-BUS)
    Note over EthAgent: Validate parameter & check dependencies
    EthAgent->>HAL: CcspHalEthSwSetPortAdminStatus(1, true)
    HAL-->>EthAgent: SUCCESS/ERROR status
    alt Configuration Success
        EthAgent->>PSM: Set dmsb.ethagent.if.1.Enable=true
        PSM-->>EthAgent: Storage confirmation
        EthAgent-->>Client: R-BUS method response (SUCCESS)
    else Configuration Error
        Note over EthAgent: Log error & maintain previous state
        EthAgent-->>Client: R-BUS method response (ERROR)
    end

Event Notification Flow - Interface Status Change:

sequenceDiagram
    participant HAL as Ethernet HAL
    participant EthAgent as Ethernet Agent
    participant WanMgr as WAN Manager
    participant Telemetry as Telemetry Agent

    HAL->>EthAgent: Interface callback: Link Down Event
    Note over EthAgent: Update internal state & validate change
    EthAgent->>WanMgr: R-BUS Event: Device.Ethernet.Interface.1.Status=Down
    EthAgent->>Telemetry: R-BUS Event: Interface statistics update
    WanMgr-->>EthAgent: Event acknowledgment (if required)
    Telemetry-->>EthAgent: Event acknowledgment (if required)

Implementation Details

Major HAL APIs Integration

The Ethernet Agent integrates with the Ethernet HAL through the ccsp_hal_ethsw.h interface, providing platform-independent access to Ethernet switching hardware. The HAL integration supports comprehensive interface management including administrative control, status monitoring, and statistics collection.

Core HAL APIs:

HAL APIPurposeImplementation File
CcspHalEthSwSetPortAdminStatus()Set interface administrative status (enable/disable)source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c
CcspHalEthSwGetPortStatus()Retrieve current interface operational status including link state, link rate, and duplex modesource/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c
CcspHalEthSwGetEthPortStats()Collect comprehensive interface statistics (bytes, packets, errors)source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c
CcspHalEthSwGetPortCfg()Get interface configuration including link rate and duplex mode settingssource/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c
CcspHalEthSwGetPortAdminStatus()Get interface administrative status (up/down)source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c
CcspHalEthSw_RegisterLinkEventCallback()Register callback for asynchronous interface link status change notificationssource/TR-181/middle_layer_src/cosa_ethernet_internal.c
GWP_RegisterEthWan_Callback()Register callbacks for Ethernet WAN link up/down eventssource/TR-181/middle_layer_src/cosa_ethernet_internal.c
CcspHalExtSw_getAssociatedDevice()Retrieve list of devices associated with Ethernet interfacessource/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c, source/TR-181/board_sbapi/eth_hal_interface.c

Key Implementation Logic

  • Interface State Management: The core state machine is implemented in cosa_ethernet_manager.c with interface state tracking, configuration validation, and event-driven status updates

    • Main state machine thread execution in CcspEthManager_StateMachineThread() function started by CosaEthManager_Start_StateMachine()
    • Interface configuration and retrieval logic in CosaDmlEthPortGetEntry() and CosaDmlEthPortSetCfg() functions (source-arm/cosa_ethernet_apis_arm.c)
    • State transition handlers in EthInterface_SetParamBoolValue() and EthInterface_Validate() functions (cosa_ethernet_dml.c)
  • Event Processing: Hardware events from the HAL layer are processed asynchronously through multiple event handler threads and mapped to appropriate TR-181 parameter changes and R-BUS notifications

    • Link status callback handling in CosaDmlEthPortLinkStatusCallback() function registered via CcspHalEthSw_RegisterLinkEventCallback()
    • WAN link event callbacks EthWanLinkUp_callback() and EthWanLinkDown_callback() registered via GWP_RegisterEthWan_Callback()
    • Event handler threads SysEventHandlerThrd() and CosaDmlEthEventHandlerThread() for processing queued events
    • Asynchronous R-BUS event publishing in cosa_rbus_handler_apis.c
  • Error Handling Strategy: Comprehensive error detection and recovery with HAL error code mapping, automatic retry mechanisms, and detailed logging for troubleshooting

    • HAL error code mapping in CosaDmlEthPortGetDinfo() and HAL status query functions with ANSC_STATUS/RETURN_OK return codes
    • Recovery mechanisms for failed HAL operations with detailed error logging and fallback to previous known good state
    • Interface availability checking with getIfAvailability() to handle NotPresent status for missing physical interfaces
  • Logging & Debugging: Multi-level logging with interface-specific debug categories, HAL API tracing, and runtime configuration for troubleshooting

    • Interface state transition logging with COSA_LOG_LEVEL_INFO for normal operations
    • HAL API call tracing with entry/exit logging for all HAL function calls
    • Debug hooks for runtime troubleshooting including interface dump capabilities and state inspection

Key Configuration Files

Configuration FilePurposeOverride Mechanisms
config/TR181-EthAgent.xmlTR-181 data model definitions and function mappingsCompile-time feature flags: FEATURE_RDKB_WAN_MANAGER, AUTOWAN_ENABLE
CcspEthAgent.cfgComponent registration and R-BUS configuration; typically provided by the platform image or integration layer, not stored in this repositoryEnvironment variables: CCSP_MSG_BUS_CFG, CCSP_CFG_PATH
system_defaultsDefault interface configurations and PSM parameter values; typically provided by the platform image, build system, or companion repos, not stored in this repositoryBuild-time/integration configuration: --enable-wanfailover, --enable-dropearly

Note: In this repository, the documented configuration artifact present is config/TR181-EthAgent.xml. Files such as CcspEthAgent.cfg and system_defaults are deployment/platform integration artifacts and may be supplied by the target image, build environment, or other repositories.

  • No labels