ETHFW API Guide
Ethernet Firmware Proxy Client APIs

Introduction

This section contains APIs for CPSW Proxy Client. The CPSW Proxy Client resides on the remote cores and enables clients on remote cores to configure the Ethernet device via RPC.

CPSW Proxy Client implements a subset of the commands and notifications supported by Ethernet Firmware Remote Configuration interface described in Ethernet Firmware Remote Config Interface.

CPSW Proxy Client is currently used by remote clients running RTOS. It could be repurposed for other OSes, but may or may not require porting.

Data Structures

struct  CpswProxy_Config
 Cpsw Proxy client configuration structure. More...
 
struct  CpswProxy_HeartbeatCb
 Cpsw Proxy Heartbeat Callback info. More...
 
struct  CpswProxy_TimeSyncCb
 Cpsw Proxy TimeSync Callback info. More...
 
struct  CpswProxy_initParams
 Cpsw Proxy init params structure. More...
 

Functions

void CpswProxy_initConfig (CpswProxy_initParams *params)
 CPSW Proxy init configuration parameters. More...
 
int32_t CpswProxy_init (const CpswProxy_initParams *params)
 Initialize CPSW Proxy on a given core. More...
 
void CpswProxy_deinit (void)
 De-initialize CPSW Proxy on a given core. More...
 
int32_t CpswProxy_connect (void)
 Connect to the Cpsw Proxy server. More...
 
CpswProxy_Handle CpswProxy_open (const CpswProxy_Config *cfg)
 Open CPSW proxy client instance with the given configuration. More...
 
void CpswProxy_close (CpswProxy_Handle hProxy)
 Close CPSW proxy client. More...
 
int32_t CpswProxy_attach (CpswProxy_Handle hProxy, EthRemoteCfg_VirtPort virtPort, uint32_t *rxMtu, uint32_t *txMtu, uint32_t *pNumTxCh, uint32_t *pNumRxFlow, uint32_t *features)
 Attach to Ethernet device. More...
 
int32_t CpswProxy_attachExtended (CpswProxy_Handle hProxy, EthRemoteCfg_VirtPort virtPort, uint32_t *rxMtu, uint32_t *txMtu, uint32_t *txPSILThreadId, uint32_t *rxFlowIdxBase, uint32_t *rxFlowIdxOffset, uint8_t *macAddr, uint32_t *features)
 Attach to Ethernet device with extended response. More...
 
int32_t CpswProxy_detach (CpswProxy_Handle hProxy)
 Detach from Ethernet device. More...
 
int32_t CpswProxy_allocTxCh (CpswProxy_Handle hProxy, uint32_t *txPSILThreadId, uint32_t chRelPriority)
 Allocate Tx channel. More...
 
int32_t CpswProxy_freeTxCh (CpswProxy_Handle hProxy, uint32_t txChNum)
 Free Tx channel. More...
 
int32_t CpswProxy_allocRxFlow (CpswProxy_Handle hProxy, uint32_t *rxFlowIdxBase, uint32_t *rxFlowIdxOffset, uint32_t flowIdx)
 Alloc Rx flow. More...
 
int32_t CpswProxy_freeRxFlow (CpswProxy_Handle hProxy, uint32_t rxFlowIdxBase, uint32_t rxFlowIdxOffset)
 Free Rx flow. More...
 
int32_t CpswProxy_allocMac (CpswProxy_Handle hProxy, uint8_t *macAddr)
 Allocate MAC address. More...
 
int32_t CpswProxy_freeMac (CpswProxy_Handle hProxy, const uint8_t *macAddr)
 Free MAC address. More...
 
int32_t CpswProxy_registerDstMacRxFlow (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, const uint8_t *macAddr)
 Register destination MAC address with the given flow index. More...
 
int32_t CpswProxy_unregisterDstMacRxFlow (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, const uint8_t *macAddr)
 Unregister destination MAC address from the given flow index. More...
 
int32_t CpswProxy_registerEthertypeRxFlow (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, uint16_t etherType)
 Register EtherType to the given Rx flow id. More...
 
int32_t CpswProxy_unregisterEthertypeRxFlow (CpswProxy_Handle hProxy, uint16_t etherType)
 Unregister the given EtherType to the given rx flow id. More...
 
int32_t CpswProxy_registerDefaultRxFlow (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset)
 Register default flow to the given flow index. More...
 
int32_t CpswProxy_unregisterDefaultRxFlow (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset)
 Unregister default flow from the given flow index. More...
 
int32_t CpswProxy_registerIPV4Addr (CpswProxy_Handle hProxy, uint8_t *macAddr, uint8_t *ipv4Addr)
 Register association of IPv4 address with MAC address by adding ARP entry in the master core. More...
 
int32_t CpswProxy_unregisterIPV4Addr (CpswProxy_Handle hProxy, uint8_t *ipv4Addr)
 Unregister association of IPv4 address with MAC address by removing ARP entry in the master core. More...
 
int32_t CpswProxy_joinVlan (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, const uint8_t *macAddr, uint16_t vlanId)
 Join a VLAN. More...
 
int32_t CpswProxy_leaveVlan (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, const uint8_t *macAddr, uint16_t vlanId)
 Leave a VLAN. More...
 
int32_t CpswProxy_filterAddMac (CpswProxy_Handle hProxy, uint32_t flowIdxBase, uint32_t flowIdxOffset, const uint8_t *macAddr, uint16_t vlanId)
 Add multicast address to receive filter. More...
 
int32_t CpswProxy_filterDelMac (CpswProxy_Handle hProxy, const uint8_t *macAddr, uint16_t vlanId)
 Delete multicast address from receive filter. More...
 
bool CpswProxy_isPhyLinked (CpswProxy_Handle hProxy)
 Query the link status. More...
 
int32_t CpswProxy_teardownCompletion (CpswProxy_Handle hProxy)
 Send DMA teardown completion notification. More...
 
int32_t CpswProxy_dumpStats (CpswProxy_Handle hProxy)
 Dump network statistics on remote side. More...
 
int32_t CpswProxy_getServerStatus (CpswProxy_Handle hProxy, EthRemoteCfg_ServerStatus *serverStatus)
 Get Server status. More...
 
int32_t CpswProxy_registerRemoteTimer (CpswProxy_Handle hProxy, uint8_t timerId, uint8_t hwPushNum)
 Register remote core's timer for synchronization. More...
 
int32_t CpswProxy_unregisterRemoteTimer (CpswProxy_Handle hProxy, uint8_t hwPushNum)
 Unregister remote core's timer for synchronization,. More...
 
int32_t CpswProxy_registerNotifyCb (CpswProxy_Handle hProxy, uint32_t notifyType, CpswProxy_NotifyCbFxn cbFxn, void *cbArg)
 Register notification callback. More...
 
int32_t CpswProxy_unregisterNotifyCb (CpswProxy_Handle hProxy, uint32_t notifyType)
 Unregister notification callback. More...
 
int32_t CpswProxy_allocHwPushInst (CpswProxy_Handle hProxy, uint32_t *hwPushNum)
 Allocate CPTS HW push instance. More...
 
int32_t CpswProxy_freeHwPushInst (CpswProxy_Handle hProxy, uint32_t hwPushNum)
 Free CPTS HW push instance. More...
 
int32_t CpswProxy_sendCmd (CpswProxy_Handle hProxy, uint32_t reqType, EthRemoteCfg_ReqHdr *req, uint16_t reqLen, EthRemoteCfg_ResHdr *res, uint16_t resLen)
 Send an remote command. More...
 
static bool CpswProxy_isSwitchPort (EthRemoteCfg_VirtPort portId)
 Check whether port is a virtual switch port or not. More...
 
static bool CpswProxy_isMacPort (EthRemoteCfg_VirtPort portId)
 Check whether port is a virtual MAC port or not. More...
 
static uint32_t CpswProxy_getPortNum (EthRemoteCfg_VirtPort portId)
 Get virtual port number. More...
 

Typedefs

typedef void(* CpswProxy_NotifyCbFxn) (uint32_t notifyType, void *notifyArg, void *cbArg)
 CPSW remote notification callback. More...
 
typedef void(* CpswProxy_HeartbeatCbFxn) (EthRemoteCfg_ServerStatus serverStatus, void *cbArg)
 CPSW Proxy Heartbeat notification callback. More...
 
typedef struct CpswProxy_ClientObj_s * CpswProxy_Handle
 CPSW Proxy handle. More...
 

Macros

#define CPSWPROXY_HB_DEFAULT_POLL_PERIOD_MS   (1000U)
 
#define CPSWPROXY_CMD_DEFAULT_TIMEOUT_MS   (1000U)
 

CpswProxy Error Codes

Error codes returned by the CPSW Proxy client APIs.

#define CPSWPROXY_SOK   (0)
 Success. More...
 
#define CPSWPROXY_SINPROGRESS   (1)
 Operation in progress. More...
 
#define CPSWPROXY_EFAIL   (-1)
 Generic failure error condition (typically caused by hardware). More...
 
#define CPSWPROXY_EBADARGS   (-2)
 Bad arguments (i.e. NULL pointer). More...
 
#define CPSWPROXY_EINVALIDPARAMS   (-3)
 Invalid parameters (i.e. value out-of-range). More...
 
#define CPSWPROXY_ETIMEOUT   (-4)
 Time out while waiting for a given condition to happen. More...
 
#define CPSWPROXY_EALLOC   (-8)
 Allocation failure. More...
 
#define CPSWPROXY_EUNEXPECTED   (-9)
 Unexpected condition occurred (sometimes unrecoverable). More...
 
#define CPSWPROXY_EBUSY   (-10)
 The resource is currently busy performing an operation. More...
 
#define CPSWPROXY_EALREADYOPEN   (-11)
 Already open error. More...
 
#define CPSWPROXY_EPERM   (-12)
 Operation not permitted. More...
 
#define CPSWPROXY_ENOTSUPPORTED   (-13)
 Operation not supported. More...
 
#define CPSWPROXY_ENOTFOUND   (-14)
 Resource not found. More...
 
#define CPSWPROXY_EUNKNOWNIOCTL   (-15)
 Unknown IOCTL. More...
 
#define CPSWPROXY_EMALFORMEDIOCTL   (-16)
 Malformed IOCTL (args pointer or size not as expected). More...
 

Macro Definition Documentation

◆ CPSWPROXY_SOK

#define CPSWPROXY_SOK   (0)

Success.

◆ CPSWPROXY_SINPROGRESS

#define CPSWPROXY_SINPROGRESS   (1)

Operation in progress.

◆ CPSWPROXY_EFAIL

#define CPSWPROXY_EFAIL   (-1)

Generic failure error condition (typically caused by hardware).

◆ CPSWPROXY_EBADARGS

#define CPSWPROXY_EBADARGS   (-2)

Bad arguments (i.e. NULL pointer).

◆ CPSWPROXY_EINVALIDPARAMS

#define CPSWPROXY_EINVALIDPARAMS   (-3)

Invalid parameters (i.e. value out-of-range).

◆ CPSWPROXY_ETIMEOUT

#define CPSWPROXY_ETIMEOUT   (-4)

Time out while waiting for a given condition to happen.

◆ CPSWPROXY_EALLOC

#define CPSWPROXY_EALLOC   (-8)

Allocation failure.

◆ CPSWPROXY_EUNEXPECTED

#define CPSWPROXY_EUNEXPECTED   (-9)

Unexpected condition occurred (sometimes unrecoverable).

◆ CPSWPROXY_EBUSY

#define CPSWPROXY_EBUSY   (-10)

The resource is currently busy performing an operation.

◆ CPSWPROXY_EALREADYOPEN

#define CPSWPROXY_EALREADYOPEN   (-11)

Already open error.

◆ CPSWPROXY_EPERM

#define CPSWPROXY_EPERM   (-12)

Operation not permitted.

◆ CPSWPROXY_ENOTSUPPORTED

#define CPSWPROXY_ENOTSUPPORTED   (-13)

Operation not supported.

◆ CPSWPROXY_ENOTFOUND

#define CPSWPROXY_ENOTFOUND   (-14)

Resource not found.

◆ CPSWPROXY_EUNKNOWNIOCTL

#define CPSWPROXY_EUNKNOWNIOCTL   (-15)

Unknown IOCTL.

◆ CPSWPROXY_EMALFORMEDIOCTL

#define CPSWPROXY_EMALFORMEDIOCTL   (-16)

Malformed IOCTL (args pointer or size not as expected).

◆ CPSWPROXY_HB_DEFAULT_POLL_PERIOD_MS

#define CPSWPROXY_HB_DEFAULT_POLL_PERIOD_MS   (1000U)

Heartbeat default period.

◆ CPSWPROXY_CMD_DEFAULT_TIMEOUT_MS

#define CPSWPROXY_CMD_DEFAULT_TIMEOUT_MS   (1000U)

Command response default timeout.

Typedef Documentation

◆ CpswProxy_NotifyCbFxn

typedef void(* CpswProxy_NotifyCbFxn) (uint32_t notifyType, void *notifyArg, void *cbArg)

CPSW remote notification callback.

Clients can register a callback function of this type to get notified of events on the Ethernet Firmware remote side.

Parameters
notifyTypeNotification type, see EthRemoteCfg_NotifyType.
notifyArgNotification argument, specific to the notification type.
cbArgCallback argument passed at the time of registration.

◆ CpswProxy_HeartbeatCbFxn

typedef void(* CpswProxy_HeartbeatCbFxn) (EthRemoteCfg_ServerStatus serverStatus, void *cbArg)

CPSW Proxy Heartbeat notification callback.

Clients can register a callback function of this type to get notified of status of the Ethernet Firmware remote side.

Parameters
serverStatusStatus of ETHFW server.
cbArgCallback argument passed at the time of registration.

◆ CpswProxy_Handle

typedef struct CpswProxy_ClientObj_s* CpswProxy_Handle

CPSW Proxy handle.

CPSW Proxy opaque handle.

Function Documentation

◆ CpswProxy_initConfig()

void CpswProxy_initConfig ( CpswProxy_initParams params)

CPSW Proxy init configuration parameters.

Sets the CPSW Proxy configuration parameters. It needs to be called only once per core and it is optional function that app should call, but not mandatory.

Parameters
paramsInit configuration params.

◆ CpswProxy_init()

int32_t CpswProxy_init ( const CpswProxy_initParams params)

Initialize CPSW Proxy on a given core.

Performs one-time initialization of the CPSW Proxy layer. It needs to be called only once per core and it is mandatory function that app should call.

Parameters
paramsInit configuration params.
Returns
CPSWPROXY_SOK if initialization was successful, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_deinit()

void CpswProxy_deinit ( void  )

De-initialize CPSW Proxy on a given core.

Performs one-time de-initialization of the CPSW Proxy layer. It needs to be called only once per core and it must be the very last CpswProxy API to be called.

◆ CpswProxy_connect()

int32_t CpswProxy_connect ( void  )

Connect to the Cpsw Proxy server.

Connect with the server side if it has been initialized. Client side then continues its initialization steps which are dependent on server.

Application should call this function until connection is established before calling CpswProxy_open() or any other CpswProxy API.

Returns
CPSWPROXY_SOK if able to connect to CPSW Proxy server, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_open()

CpswProxy_Handle CpswProxy_open ( const CpswProxy_Config cfg)

Open CPSW proxy client instance with the given configuration.

Application will get a handle to Cpsw Proxy which will be used in all CPSW Proxy APIs. Each virtPort will get a proxy handle, which will be used in CPSW Proxy APIs.

Parameters
cfgConfiguration of the CPSW Proxy client.
Returns
Cpsw Proxy Handle which will be used in all Cpsw Proxy APIs. NULL value indicates CpswProxy_open() failed.

◆ CpswProxy_close()

void CpswProxy_close ( CpswProxy_Handle  hProxy)

Close CPSW proxy client.

Close and free the CPSW proxy client instance.

Parameters
hProxyCpsw Proxy Handle

◆ CpswProxy_attach()

int32_t CpswProxy_attach ( CpswProxy_Handle  hProxy,
EthRemoteCfg_VirtPort  virtPort,
uint32_t *  rxMtu,
uint32_t *  txMtu,
uint32_t *  pNumTxCh,
uint32_t *  pNumRxFlow,
uint32_t *  features 
)

Attach to Ethernet device.

This is the first function to be called by a client after the connection with the remote Ethernet device has been established via CpswProxy_open().

Alternatively, clients that require a single Rx and single Tx channel could use CpswProxy_attachExtended() which provides the same functionality as this function, but it also performs allocation of one Tx channel, one Rx flow and one MAC address.

Parameters
hProxyHandle to Cpsw Proxy.
virtPortVirtual port id to attach to.
rxMtuPointer to maximum receive packet length. Populated by this function.
txMtuArray of maximum transmit packet length per priority supported by the Ethernet device.
pNumTxChPointer to number of tx channels allocated to the virtual port
pNumRxFlowPointer to number of rx flows allocated to the virtual port
featuresSupported features flag (see EthRemoteCfg_FeatureMask)
Returns
CPSWPROXY_SOK if client has been successfully attached, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_attachExtended()

int32_t CpswProxy_attachExtended ( CpswProxy_Handle  hProxy,
EthRemoteCfg_VirtPort  virtPort,
uint32_t *  rxMtu,
uint32_t *  txMtu,
uint32_t *  txPSILThreadId,
uint32_t *  rxFlowIdxBase,
uint32_t *  rxFlowIdxOffset,
uint8_t *  macAddr,
uint32_t *  features 
)

Attach to Ethernet device with extended response.

This is the first function to be called by a client after the connection with the remote Ethernet device has been established via CpswProxy_open().

It's an alternative option to CpswProxy_attach() that can be used in clients that require a single Rx and single Tx channel. In addition to attaching to the remote Ethernet device, this function also allocates one Tx channel, one Rx flow and one MAC address.

Parameters
hProxyHandle to Cpsw Proxy.
virtPortVirtual port id to attach to.
rxMtuPointer to maximum receive packet length. Populated by this function.
txMtuArray of maximum transmit packet length per priority supported by Ethernet device.
txPSILThreadIdPointer to allocated Tx Channel CPSW PSIL destination thread id populated by this function.
rxFlowIdxBasePointer to RX flow index base value.
rxFlowIdxOffsetPointer to RX flow offset to be allocated.
macAddrPointer to allocated destination MAC address allocated to remote core populated by this function.
featuresSupported features flag (see EthRemoteCfg_FeatureMask)
Returns
CPSWPROXY_SOK if client has been successfully attached, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_detach()

int32_t CpswProxy_detach ( CpswProxy_Handle  hProxy)

Detach from Ethernet device.

Detaches the local client from remote Ethernet device.

Parameters
hProxyHandle to Cpsw Proxy.
Returns
CPSWPROXY_SOK if client has been detached, CPSWPROXY_EINVALIDPARAMS error in case a client makes a detach call before attaching itself, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_allocTxCh()

int32_t CpswProxy_allocTxCh ( CpswProxy_Handle  hProxy,
uint32_t *  txPSILThreadId,
uint32_t  chRelPriority 
)

Allocate Tx channel.

Allocates a TX channel to be used exclusively by this client. The channel is returned as a Tx PSIL destination thread id which client can use to configure the DMA channel.

Parameters
hProxyHandle to Cpsw Proxy.
txPSILThreadIdAllocated Tx channel CPSW PSIL destination thread id, populated by this function.
chRelPriorityTx channel priority (relative) which client want to allocate
Returns
CPSWPROXY_SOK if TX channel has been successfully allocated, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_freeTxCh()

int32_t CpswProxy_freeTxCh ( CpswProxy_Handle  hProxy,
uint32_t  txChNum 
)

Free Tx channel.

Deallocates a TX channel previously allocated through CpswProxy_allocTxCh() or CpswProxy_attachExtended().

Parameters
hProxyHandle to Cpsw Proxy.
txChNumTx channel CPSW PSIL destination thread id to be freed.
Returns
CPSWPROXY_SOK if TX channel has been freed, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_allocRxFlow()

int32_t CpswProxy_allocRxFlow ( CpswProxy_Handle  hProxy,
uint32_t *  rxFlowIdxBase,
uint32_t *  rxFlowIdxOffset,
uint32_t  flowIdx 
)

Alloc Rx flow.

Allocates a Rx flow to be used exclusively by this client. The Rx flow idx is returned as a pair of base and offset values. The absolute flow idx is: rxFlowIdxBase + rxFlowIdxOffset.

Parameters
hProxyHandle to Cpsw Proxy.
rxFlowIdxBasePointer to RX flow index base value.
rxFlowIdxOffsetPointer to RX flow offset to be allocated.
flowIdxRelative index of rx flow among available numRxFlow
Returns
CPSWPROXY_SOK if RX flow has been successfully allocated, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_freeRxFlow()

int32_t CpswProxy_freeRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  rxFlowIdxBase,
uint32_t  rxFlowIdxOffset 
)

Free Rx flow.

Frees a Rx flow previously allocated through CpswProxy_allocRxFlow() or CpswProxy_attachExtended().

Parameters
hProxyHandle to Cpsw Proxy.
rxFlowIdxBaseRX flow index base value.
rxFlowIdxOffsetRX flow offset to be freed.
Returns
CPSWPROXY_SOK if RX flow has been freed, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_allocMac()

int32_t CpswProxy_allocMac ( CpswProxy_Handle  hProxy,
uint8_t *  macAddr 
)

Allocate MAC address.

Allocates a MAC address from server's MAC address pool. Client may choose to use a locally allocated MAC address instead, in which case this function is not required.

Parameters
hProxyHandle to Cpsw Proxy
macAddrPointer to MAC address to be allocated.
Returns
CPSWPROXY_SOK if MAC address has been successfully allocated, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_freeMac()

int32_t CpswProxy_freeMac ( CpswProxy_Handle  hProxy,
const uint8_t *  macAddr 
)

Free MAC address.

Frees a MAC address previously allocated through CpswProxy_allocMac() or CpswProxy_attachExtended().

Parameters
hProxyHandle to Cpsw Proxy.
macAddrMAC address to be freed.
Returns
CPSWPROXY_SOK if MAC address has been freed, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerDstMacRxFlow()

int32_t CpswProxy_registerDstMacRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
const uint8_t *  macAddr 
)

Register destination MAC address with the given flow index.

Registers the destination MAC to the given Rx flow index. This causes all packets with the given destination MAC address to be routed to the given Rx flow index (flowIdxBase + flowIdxOffset).

RX flow idx must be set up prior to calling this function.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
macAddrDestination MAC address to be registered.
Returns
CPSWPROXY_SOK if RX flow has been registered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterDstMacRxFlow()

int32_t CpswProxy_unregisterDstMacRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
const uint8_t *  macAddr 
)

Unregister destination MAC address from the given flow index.

Unregister a destination MAC address previously registered via CpswProxy_registerDstMacRxFlow(). Upon successful unregistration, packets with the provided MAC address will no longer be routed to RX flow index (flowIdxBase + flowIdxBase).

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
macAddrDestination MAC address to be unregistered.
Returns
CPSWPROXY_SOK if RX flow has been unregistered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerEthertypeRxFlow()

int32_t CpswProxy_registerEthertypeRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
uint16_t  etherType 
)

Register EtherType to the given Rx flow id.

Registers an EtherType-based route to the provided flow idx.

RX flow idx must be set up prior to calling this function.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
etherTypeEtherType to be associated with the Rx flow idx.
Returns
CPSWPROXY_SOK if RX flow has been registered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterEthertypeRxFlow()

int32_t CpswProxy_unregisterEthertypeRxFlow ( CpswProxy_Handle  hProxy,
uint16_t  etherType 
)

Unregister the given EtherType to the given rx flow id.

Unregisters the EtherType-based route. Upon successful unregistration, packets with the given EtherType will be routed to the default flow.

Parameters
hProxyHandle to Cpsw Proxy.
etherTypeEthertype to be disassociated from the given Rx flow idx.
Returns
CPSWPROXY_SOK if RX flow has been unregistered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerDefaultRxFlow()

int32_t CpswProxy_registerDefaultRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset 
)

Register default flow to the given flow index.

Enables routing of default traffic (traffic not matching any classifier with thread id configured) to the given Rx flowIdx.

RX flow idx must be set up prior to calling this function.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
Returns
CPSWPROXY_SOK if default RX flow has been registered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterDefaultRxFlow()

int32_t CpswProxy_unregisterDefaultRxFlow ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset 
)

Unregister default flow from the given flow index.

Disables routing of default traffic (traffic not matching any classifier with thread id configured) to the given Rx flowIdx. Once disabled, all default traffic will be routed to the reserved flow resulting in all packets of default flow being dropped.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
Returns
CPSWPROXY_SOK if default RX flow has been unregistered, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerIPV4Addr()

int32_t CpswProxy_registerIPV4Addr ( CpswProxy_Handle  hProxy,
uint8_t *  macAddr,
uint8_t *  ipv4Addr 
)

Register association of IPv4 address with MAC address by adding ARP entry in the master core.

Register an IPv4 address in master core ARP table which will respond to ARP request messages on behalf of the client.

Parameters
hProxyHandle to Cpsw Proxy.
macAddrMAC address with which the IPv4 address will be associated.
ipv4AddrIPv4 address to be added to ARP database.
Returns
CPSWPROXY_SOK if successfully registered IPv4 address, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterIPV4Addr()

int32_t CpswProxy_unregisterIPV4Addr ( CpswProxy_Handle  hProxy,
uint8_t *  ipv4Addr 
)

Unregister association of IPv4 address with MAC address by removing ARP entry in the master core.

Unregisters an IPv4 address from master core ARP table. Upon successful unregistration, the remote core will no longer respond to ARP request messages for the IPv4 address.

Parameters
hProxyHandle to Cpsw Proxy.
ipv4AddrIPv4 address to be unregistered.
Returns
CPSWPROXY_SOK if successfully unregistered IPv4 address, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_joinVlan()

int32_t CpswProxy_joinVlan ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
const uint8_t *  macAddr,
uint16_t  vlanId 
)

Join a VLAN.

Joins a client to a VLAN registered on the server side.

VLAN creation is done by Ethernet Firmware server at init time, it sets up all VLANs, including the VLAN member list, flood masks, etc. The server also defines which remote clients can join the VLAN.

If the client is allowed to join the VLAN, the server will setup a route for VLAN tagged unicast packets matching the destination MAC address provided in this function.

RX flow idx must be set up prior to calling this function.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
macAddrMAC address (unicast).
vlanIdVLAN id to join.
Returns
CPSWPROXY_SOK if successfully joined VLAN, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_leaveVlan()

int32_t CpswProxy_leaveVlan ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
const uint8_t *  macAddr,
uint16_t  vlanId 
)

Leave a VLAN.

Leaves a previously joined VLAN, registered on the server side.

Client's route setup at the time of joining will be deleted after client leaves the VLAN.

Parameters
hProxyHandle to Cpsw Proxy.
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
macAddrMAC address (unicast).
vlanIdVLAN id to leave.
Returns
CPSWPROXY_SOK if successfully left VLAN, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_filterAddMac()

int32_t CpswProxy_filterAddMac ( CpswProxy_Handle  hProxy,
uint32_t  flowIdxBase,
uint32_t  flowIdxOffset,
const uint8_t *  macAddr,
uint16_t  vlanId 
)

Add multicast address to receive filter.

Adds a multicast address to the receive filter. Ethernet Firmware differentiates multicast addresses as shared or _exclusive).

  • Exclusive multicast address - Use is allowed only on a single remote client, the first one to request it. Traffic received with exclusive address is routed to the remote client in hardware to the given RX flow index.
  • Shared multicast address - Traffic received with shared address is fanned out to all remote clients that request it via virtual intercore interface. RX flow index is not relevant in this case.

RX flow idx must be set up prior to calling this function.

Parameters
hProxyHandle to Cpsw Proxy
flowIdxBaseRX flow index base value.
flowIdxOffsetRX flow offset.
macAddrMulticast MAC address to be added to receive filter.
vlanIdVLAN id.
Returns
CPSWPROXY_SOK if multicast address has been successfully added to the filter, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_filterDelMac()

int32_t CpswProxy_filterDelMac ( CpswProxy_Handle  hProxy,
const uint8_t *  macAddr,
uint16_t  vlanId 
)

Delete multicast address from receive filter.

Deletes a multicast address to the receive filter previous added through CpswProxy_filterAddMac().

Parameters
hProxyHandle to Cpsw Proxy.
macAddrMulticast MAC address to be deleted from receive filter.
vlanIdVLAN id.
Returns
CPSWPROXY_SOK if multicast address has been deleted from filter, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_isPhyLinked()

bool CpswProxy_isPhyLinked ( CpswProxy_Handle  hProxy)

Query the link status.

Queries the link status of the virtual port which depends on the virtual port type:

  • Virtual switch ports - They are not associated with a specific hardware Ethernet port, so their link status is always reported as linked.
  • Virtual MAC ports - They are associated with one actual Ethernet port on the Ethernet device, so the status reported by this function is the actual link state between the MAC port and the link partner.
Parameters
hProxyHandle to Cpsw Proxy.
Returns
Whether link is up or not.

◆ CpswProxy_teardownCompletion()

int32_t CpswProxy_teardownCompletion ( CpswProxy_Handle  hProxy)

Send DMA teardown completion notification.

Sends a DMA tear-down completion notification to ETHFW so it can proceed with Ethernet device recovery.

Parameters
hProxyHandle to Cpsw Proxy.
Returns
CPSWPROXY_SOK if teardown completion notification was sent, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_dumpStats()

int32_t CpswProxy_dumpStats ( CpswProxy_Handle  hProxy)

Dump network statistics on remote side.

Request network statistics, ALE table, policer table to be dumped into ETHFW logs.

Parameters
hProxyHandle to Cpsw Proxy.
Returns
CPSWPROXY_SOK if successful, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_getServerStatus()

int32_t CpswProxy_getServerStatus ( CpswProxy_Handle  hProxy,
EthRemoteCfg_ServerStatus serverStatus 
)

Get Server status.

Get the status of the Ethernet Firmware.

Parameters
hProxyHandle to Cpsw Proxy.
serverStatusPointer to status of ETHFW server.
Returns
CPSWPROXY_SOK if successful, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerRemoteTimer()

int32_t CpswProxy_registerRemoteTimer ( CpswProxy_Handle  hProxy,
uint8_t  timerId,
uint8_t  hwPushNum 
)

Register remote core's timer for synchronization.

Register the remote core's timer with Ethernet Firmware, which will configure the Time Sync Router (TSR) to route timer timerId events to the given CPTS hardware push number.

Parameters
hProxyHandle to Cpsw Proxy.
timerIdInput Id number of timer in TSR.
hwPushNumCPTS hardware push number.
Returns
CPSWPROXY_SOK if remote timer is registered successfully, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterRemoteTimer()

int32_t CpswProxy_unregisterRemoteTimer ( CpswProxy_Handle  hProxy,
uint8_t  hwPushNum 
)

Unregister remote core's timer for synchronization,.

Unregisters the remote core's timer previously registered through CpswProxy_registerRemoteTimer(). Ethernet Firmware will clear the Time Sync Router (TSR) configuration previously done for the given CPTS hardware push number.

Parameters
hProxyHandle to Cpsw Proxy.
hwPushNumHardware push number of CPTS.
Returns
CPSWPROXY_SOK if remote timer is unregistered successfully, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_registerNotifyCb()

int32_t CpswProxy_registerNotifyCb ( CpswProxy_Handle  hProxy,
uint32_t  notifyType,
CpswProxy_NotifyCbFxn  cbFxn,
void *  cbArg 
)

Register notification callback.

Registers a callback function for the provided notification type in oder to get notified of events on the Ethernet Firmware remote side.

Parameters
hProxyHandle to Cpsw Proxy.
notifyTypeNotification type, see EthRemoteCfg_NotifyType.
cbFxnCallback function to be called when event occurs.
cbArgApp's specific callback arguments.
Returns
CPSWPROXY_SOK if callback is registered successfully, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_unregisterNotifyCb()

int32_t CpswProxy_unregisterNotifyCb ( CpswProxy_Handle  hProxy,
uint32_t  notifyType 
)

Unregister notification callback.

Unregisters a callback function for the provided notification type.

Parameters
hProxyHandle to Cpsw Proxy.
notifyTypeNotification type, see EthRemoteCfg_NotifyType.
Returns
CPSWPROXY_SOK if callback is unregistered successfully, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_allocHwPushInst()

int32_t CpswProxy_allocHwPushInst ( CpswProxy_Handle  hProxy,
uint32_t *  hwPushNum 
)

Allocate CPTS HW push instance.

Allocates a CPTS HW push instance from RM.

Parameters
hProxyHandle to Cpsw Proxy
hwPushNumPointer to HW push instance to be allocated.
Returns
CPSWPROXY_SOK if HW push instance has been successfully allocated, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_freeHwPushInst()

int32_t CpswProxy_freeHwPushInst ( CpswProxy_Handle  hProxy,
uint32_t  hwPushNum 
)

Free CPTS HW push instance.

Frees an allocated CPTS HW push instance from RM.

Parameters
hProxyHandle to Cpsw Proxy
hwPushNumHW push instance to be freed.
Returns
CPSWPROXY_SOK if HW push instance has been successfully freed, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_sendCmd()

int32_t CpswProxy_sendCmd ( CpswProxy_Handle  hProxy,
uint32_t  reqType,
EthRemoteCfg_ReqHdr req,
uint16_t  reqLen,
EthRemoteCfg_ResHdr res,
uint16_t  resLen 
)

Send an remote command.

Send an command to ETHFW.This function can be used to send any supported remote commands to ETHFW.Note that it's recommended to use the dedicated CPSW Proxy Client API if one exists for the desired functionality.

Parameters
hProxyHandle to Cpsw Proxy.
reqTypeRequest type.
reqCommand request message, see EthRemoteCfg_ReqHdr.
reqLenCommand request length.
resCommand response message, see EthRemoteCfg_ResHdr.
resLenCommand response length.
Returns
CPSWPROXY_SOK if callback is unregistered successfully, or negative error in case of a failure, see CpswProxy_ErrorCodes.

◆ CpswProxy_isSwitchPort()

static bool CpswProxy_isSwitchPort ( EthRemoteCfg_VirtPort  portId)
inlinestatic

Check whether port is a virtual switch port or not.

Parameters
portId[in] Virtual port id.
Returns
true if virtual switch port, false otherwise.

◆ CpswProxy_isMacPort()

static bool CpswProxy_isMacPort ( EthRemoteCfg_VirtPort  portId)
inlinestatic

Check whether port is a virtual MAC port or not.

Parameters
portId[in] Virtual port id.
Returns
true if virtual MAC port, false otherwise.

◆ CpswProxy_getPortNum()

static uint32_t CpswProxy_getPortNum ( EthRemoteCfg_VirtPort  portId)
inlinestatic

Get virtual port number.

Gets the port number of a virtual port. Virtual switch ports numbers are 0-relative and virtual MAC ports are 1-relative.

Parameters
portId[in] Virtual port id.
Returns
Port number.