ETHFW API Guide
Ethernet Switch Proxy Server APIs

Introduction

This section contains APIs for CPSW Proxy Server APIs.

The CPSW Proxy Server resides on the master core and enables clients on remote cores to configure the Ethernet Switch. The CPSW Proxy Server is the application interface to the ethernet remote device server.

The application configures and instantiates a CPSW Proxy Server instance. Once instantiated the CPSW will listen to, process and respond to CPSW_PROXY_CLIENT messages from remote cores.

Data Structures

struct  CpswProxyServer_VirtPortCfg
 Cpsw Proxy Server Virtual Port Configuration structure. More...
 
struct  CpswProxyServer_SharedMcastCfg
 Ethernet Firmware shared multicast fanout configuration. More...
 
struct  CpswProxyServer_RsvdMcastCfg
 Ethernet Firmware reserved multicast configuration. More...
 
struct  CpswProxyServer_Config_t
 Cpsw Proxy Server Remote Configuration structure. More...
 

Functions

int32_t CpswProxyServer_init (CpswProxyServer_Config_t *cfg)
 Cpsw proxy server initialization function. More...
 
int32_t CpswProxyServer_start (void)
 Start the Cpsw proxy server. More...
 

Typedefs

typedef void(* CpswProxyServer_InitEthfwDeviceDataCb) (uint32_t host_id, struct rpmsg_kdrv_ethswitch_device_data *eth_dev_data)
 Application callback function pointer to initialize Ethernet Firmware data. More...
 
typedef void(* CpswProxyServer_GetMcmCmdIfCb) (Enet_Type enetType, EnetMcm_CmdIf **pMcmCmdIfHandle)
 Application callback function pointer to get Multiclient Manager (MCM) command mailbox. More...
 
typedef void(* CpswProxyServer_NotifyCb) (uint32_t host_id, Enet_Handle hEnet, Enet_Type enetType, uint32_t core_key, enum rpmsg_kdrv_ethswitch_client_notify_type notifyid, uint8_t *notify_info, uint32_t notify_info_len)
 Application Callback function pointer to handle custom notification from remote client. More...
 
typedef void(* CpswProxyServer_FilterAddMacSharedCb) (const uint8_t *macAddr, const uint8_t coreId)
 Filter add shared multicast callback. More...
 
typedef void(* CpswProxyServer_FilterDelMacSharedCb) (const uint8_t *macAddr, const uint8_t coreId)
 Filter delete shared multicast callback. More...
 

Macros

#define CPSWPROXYSERVER_MAC_PORT_MAX   (8U)
 
#define CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN   (8U)
 
#define CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN   (4U)
 
#define CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX   (2U)
 

CpswProxyServer Error Codes

Error codes returned by the CPSW Proxy server APIs.

#define CPSWPROXYSERVER_SOK   (0)
 Success. More...
 
#define CPSWPROXYSERVER_SINPROGRESS   (1)
 Operation in progress. More...
 
#define CPSWPROXYSERVER_EFAIL   (-1)
 Generic failure error condition (typically caused by hardware). More...
 
#define CPSWPROXYSERVER_EBADARGS   (-2)
 Bad arguments (i.e. NULL pointer). More...
 
#define CPSWPROXYSERVER_EINVALIDPARAMS   (-3)
 Invalid parameters (i.e. value out-of-range). More...
 
#define CPSWPROXYSERVER_ETIMEOUT   (-4)
 Time out while waiting for a given condition to happen. More...
 
#define CPSWPROXYSERVER_EALLOC   (-8)
 Allocation failure. More...
 
#define CPSWPROXYSERVER_EUNEXPECTED   (-9)
 Unexpected condition occurred (sometimes unrecoverable). More...
 
#define CPSWPROXYSERVER_EBUSY   (-10)
 The resource is currently busy performing an operation. More...
 
#define CPSWPROXYSERVER_EALREADYOPEN   (-11)
 Already open error. More...
 
#define CPSWPROXYSERVER_EPERM   (-12)
 Operation not permitted. More...
 
#define CPSWPROXYSERVER_ENOTSUPPORTED   (-13)
 Operation not supported. More...
 
#define CPSWPROXYSERVER_ENOTFOUND   (-14)
 Resource not found. More...
 
#define CPSWPROXYSERVER_EUNKNOWNIOCTL   (-15)
 Unknown IOCTL. More...
 
#define CPSWPROXYSERVER_EMALFORMEDIOCTL   (-16)
 Malformed IOCTL (args pointer or size not as expected). More...
 

Macro Definition Documentation

◆ CPSWPROXYSERVER_SOK

#define CPSWPROXYSERVER_SOK   (0)

Success.

◆ CPSWPROXYSERVER_SINPROGRESS

#define CPSWPROXYSERVER_SINPROGRESS   (1)

Operation in progress.

◆ CPSWPROXYSERVER_EFAIL

#define CPSWPROXYSERVER_EFAIL   (-1)

Generic failure error condition (typically caused by hardware).

◆ CPSWPROXYSERVER_EBADARGS

#define CPSWPROXYSERVER_EBADARGS   (-2)

Bad arguments (i.e. NULL pointer).

◆ CPSWPROXYSERVER_EINVALIDPARAMS

#define CPSWPROXYSERVER_EINVALIDPARAMS   (-3)

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

◆ CPSWPROXYSERVER_ETIMEOUT

#define CPSWPROXYSERVER_ETIMEOUT   (-4)

Time out while waiting for a given condition to happen.

◆ CPSWPROXYSERVER_EALLOC

#define CPSWPROXYSERVER_EALLOC   (-8)

Allocation failure.

◆ CPSWPROXYSERVER_EUNEXPECTED

#define CPSWPROXYSERVER_EUNEXPECTED   (-9)

Unexpected condition occurred (sometimes unrecoverable).

◆ CPSWPROXYSERVER_EBUSY

#define CPSWPROXYSERVER_EBUSY   (-10)

The resource is currently busy performing an operation.

◆ CPSWPROXYSERVER_EALREADYOPEN

#define CPSWPROXYSERVER_EALREADYOPEN   (-11)

Already open error.

◆ CPSWPROXYSERVER_EPERM

#define CPSWPROXYSERVER_EPERM   (-12)

Operation not permitted.

◆ CPSWPROXYSERVER_ENOTSUPPORTED

#define CPSWPROXYSERVER_ENOTSUPPORTED   (-13)

Operation not supported.

◆ CPSWPROXYSERVER_ENOTFOUND

#define CPSWPROXYSERVER_ENOTFOUND   (-14)

Resource not found.

◆ CPSWPROXYSERVER_EUNKNOWNIOCTL

#define CPSWPROXYSERVER_EUNKNOWNIOCTL   (-15)

Unknown IOCTL.

◆ CPSWPROXYSERVER_EMALFORMEDIOCTL

#define CPSWPROXYSERVER_EMALFORMEDIOCTL   (-16)

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

◆ CPSWPROXYSERVER_MAC_PORT_MAX

#define CPSWPROXYSERVER_MAC_PORT_MAX   (8U)

Maximum number of MAC ports

◆ CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN

#define CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN   (8U)

Size of shared multicast address table

◆ CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN

#define CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN   (4U)

Size of reserved multicast address table

◆ CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX

#define CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX   (2U)

Max number of AUTOSAR client cores

Typedef Documentation

◆ CpswProxyServer_InitEthfwDeviceDataCb

typedef void(* CpswProxyServer_InitEthfwDeviceDataCb) (uint32_t host_id, struct rpmsg_kdrv_ethswitch_device_data *eth_dev_data)

Application callback function pointer to initialize Ethernet Firmware data.

When a client connection from remote core to cpsw proxy server is established, the server will invoke this application callback to populate firmware info which is exported as remote device data to the remote core client.

Parameters
host_idRemote Core Id
eth_dev_dataFirmware device data to be populated

◆ CpswProxyServer_GetMcmCmdIfCb

typedef void(* CpswProxyServer_GetMcmCmdIfCb) (Enet_Type enetType, EnetMcm_CmdIf **pMcmCmdIfHandle)

Application callback function pointer to get Multiclient Manager (MCM) command mailbox.

The MCM manages access to single CPSW LLD handle across multiple clients on both remote core and local core.

The CPSW Proxy server needs the MCM command interface to perform ATTACH. The MCM command interface is obtained by invoking this application callback.

Parameters
enetTypeEnet instance type
pMcmCmdIfHandlePointer to MCM command interface structure which will be populated by application

◆ CpswProxyServer_NotifyCb

typedef void(* CpswProxyServer_NotifyCb) (uint32_t host_id, Enet_Handle hEnet, Enet_Type enetType, uint32_t core_key, enum rpmsg_kdrv_ethswitch_client_notify_type notifyid, uint8_t *notify_info, uint32_t notify_info_len)

Application Callback function pointer to handle custom notification from remote client.

This is application handler for custom client to server notification from remote cores. The proxy layer just passes the notify info and notify_info_len. The client and server application interpretation of the custom notify info should match.

Parameters
host_idRemote Core IPC core id
hEnetHandle to CPSW
enetTypeEnet instance type
notifyidCustom notify id. Will be RPMSG_KDRV_TP_ETHSWITCH_CLIENTNOTIFY_CUSTOM
notify_infoNotify info
notify_info_lenNotify info length

◆ CpswProxyServer_FilterAddMacSharedCb

typedef void(* CpswProxyServer_FilterAddMacSharedCb) (const uint8_t *macAddr, const uint8_t coreId)

Filter add shared multicast callback.

Application callback function called when a remote client requests the addition of a shared multicast address to the filter.

Parameters
macAddrMulticast address being added
coreIdRemote core id which originated the multicast 'add' request

◆ CpswProxyServer_FilterDelMacSharedCb

typedef void(* CpswProxyServer_FilterDelMacSharedCb) (const uint8_t *macAddr, const uint8_t coreId)

Filter delete shared multicast callback.

Application callback function called when a remote client requests the deletion of a shared multicast address from the filter.

Parameters
macAddrMulticast address being added
coreIdRemote core id which originated the multicast 'remove' request

Function Documentation

◆ CpswProxyServer_init()

int32_t CpswProxyServer_init ( CpswProxyServer_Config_t *  cfg)

Cpsw proxy server initialization function.

Parameters
cfgCpsw Proxy Server configuration

◆ CpswProxyServer_start()

int32_t CpswProxyServer_start ( void  )

Start the Cpsw proxy server.

Starts the remote device framework.

Returns
Refer to CpswProxyServer_ErrorCodes.