ETHFW API Guide
cpsw_proxy_server.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2019 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 
63 #ifndef __CPSWPROXYSERVER_H__
64 #define __CPSWPROXYSERVER_H__
65 
66 #include <stdint.h>
68 #include <ti/drv/enet/enet.h>
69 #include <ti/drv/enet/examples/utils/include/enet_mcm.h>
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
90 /* @} */
91 
106 /* Below error codes are aligned with CSL's and Enet LLD's to maintain
107  * consistency and avoid error code conversion */
108 
110 #define CPSWPROXYSERVER_SOK (0)
111 
113 #define CPSWPROXYSERVER_SINPROGRESS (1)
114 
116 #define CPSWPROXYSERVER_EFAIL (-1)
117 
119 #define CPSWPROXYSERVER_EBADARGS (-2)
120 
122 #define CPSWPROXYSERVER_EINVALIDPARAMS (-3)
123 
125 #define CPSWPROXYSERVER_ETIMEOUT (-4)
126 
128 #define CPSWPROXYSERVER_EALLOC (-8)
129 
131 #define CPSWPROXYSERVER_EUNEXPECTED (-9)
132 
134 #define CPSWPROXYSERVER_EBUSY (-10)
135 
137 #define CPSWPROXYSERVER_EALREADYOPEN (-11)
138 
140 #define CPSWPROXYSERVER_EPERM (-12)
141 
143 #define CPSWPROXYSERVER_ENOTSUPPORTED (-13)
144 
146 #define CPSWPROXYSERVER_ENOTFOUND (-14)
147 
149 #define CPSWPROXYSERVER_EUNKNOWNIOCTL (-15)
150 
152 #define CPSWPROXYSERVER_EMALFORMEDIOCTL (-16)
153 
157 #define CPSWPROXYSERVER_MAC_PORT_MAX (8U)
158 
160 #define CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN (8U)
161 
163 #define CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN (4U)
164 
166 #define CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX (2U)
167 
179 typedef void (*CpswProxyServer_InitEthfwDeviceDataCb)(uint32_t host_id,
180  struct rpmsg_kdrv_ethswitch_device_data *eth_dev_data);
181 
196 typedef void (*CpswProxyServer_GetMcmCmdIfCb)(Enet_Type enetType, EnetMcm_CmdIf **pMcmCmdIfHandle);
197 
215 typedef void (*CpswProxyServer_NotifyCb)(uint32_t host_id,
216  Enet_Handle hEnet,
217  Enet_Type enetType,
218  uint32_t core_key,
220  uint8_t *notify_info,
221  uint32_t notify_info_len);
222 
226 typedef struct CpswProxyServer_VirtPortCfg_s
227 {
229  uint32_t remoteCoreId;
230 
234 
244 typedef void (*CpswProxyServer_FilterAddMacSharedCb)(const uint8_t *macAddr,
245  const uint8_t coreId);
246 
256 typedef void (*CpswProxyServer_FilterDelMacSharedCb)(const uint8_t *macAddr,
257  const uint8_t coreId);
258 
264 typedef struct CpswProxyServer_SharedMcastCfg_s
265 {
267  uint8_t macAddrList[CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN][ENET_MAC_ADDR_LEN];
268 
271  uint32_t numMacAddr;
272 
275 
279 
287 typedef struct CpswProxyServer_RsvdMcastCfg_s
288 {
290  uint8_t macAddrList[CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN][ENET_MAC_ADDR_LEN];
291 
294  uint32_t numMacAddr;
296 
302 typedef struct CpswProxyServer_Config_s
303 {
306 
309 
312 
315  uint32_t rpmsgEndPointId;
316 
318  uint32_t autosarEthDeviceEndPointId[CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX];
319 
321  uint32_t autosarEthDriverRemoteCoreId[CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX];
322 
325 
328 
331 
333  uint32_t notifyServiceRemoteCoreId[ETHREMOTECFG_SERVER_MAX_INSTANCES];
334 
337 
339  uint32_t numVirtPorts;
340 
342  Enet_MacPort macPort[CPSWPROXYSERVER_MAC_PORT_MAX];
343 
345  uint32_t numMacPorts;
346 
349 
352 
355 
359 
366 
374 int32_t CpswProxyServer_start(void);
375 
376 /* @} */
377 
378 #ifdef __cplusplus
379 }
380 #endif
381 
382 #endif /* #ifndef __CPSWPROXYSERVER_H__ */
CpswProxyServer_InitEthfwDeviceDataCb initEthfwDeviceDataCb
Definition: cpsw_proxy_server.h:305
CpswProxyServer_SharedMcastCfg sharedMcastCfg
Definition: cpsw_proxy_server.h:354
uint32_t numMacAddr
Definition: cpsw_proxy_server.h:294
EthRemoteCfg_VirtPort portId
Definition: cpsw_proxy_server.h:232
CpswProxyServer_FilterDelMacSharedCb filterDelMacSharedCb
Definition: cpsw_proxy_server.h:277
Ethernet Switch Remote Device Data.
Definition: rpmsg-kdrv-transport-ethswitch.h:1331
#define ETHREMOTECFG_SERVER_MAX_INSTANCES
Definition: ethremotecfg_server.h:96
#define CPSWPROXYSERVER_AUTOSAR_REMOTE_CLIENT_MAX
Definition: cpsw_proxy_server.h:166
Cpsw Proxy Server Remote Configuration structure.
Definition: cpsw_proxy_server.h:302
Ethernet Firmware shared multicast fanout configuration.
Definition: cpsw_proxy_server.h:264
#define CPSWPROXYSERVER_MAC_PORT_MAX
Definition: cpsw_proxy_server.h:157
void(* CpswProxyServer_FilterAddMacSharedCb)(const uint8_t *macAddr, const uint8_t coreId)
Filter add shared multicast callback.
Definition: cpsw_proxy_server.h:244
uint32_t rpmsgEndPointId
Definition: cpsw_proxy_server.h:315
Enet_Type notifyServiceCpswType
Definition: cpsw_proxy_server.h:330
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.
Definition: cpsw_proxy_server.h:215
u8 notify_info[RPMSG_KDRV_TP_ETHSWITCH_MESSAGE_DATA_LEN]
Definition: rpmsg-kdrv-transport-ethswitch.h:108
u32 notify_info_len
Definition: rpmsg-kdrv-transport-ethswitch.h:106
uint16_t dfltVlanIdSwitchPorts
Definition: cpsw_proxy_server.h:351
EthRemoteCfg_VirtPort
Virtual port id.
Definition: ethremotecfg_virtport.h:97
#define CPSWPROXYSERVER_SHARED_MCAST_LIST_LEN
Definition: cpsw_proxy_server.h:160
CpswProxyServer_GetMcmCmdIfCb getMcmCmdIfCb
Definition: cpsw_proxy_server.h:308
uint32_t numMacAddr
Definition: cpsw_proxy_server.h:271
void(* CpswProxyServer_GetMcmCmdIfCb)(Enet_Type enetType, EnetMcm_CmdIf **pMcmCmdIfHandle)
Application callback function pointer to get Multiclient Manager (MCM) command mailbox.
Definition: cpsw_proxy_server.h:196
#define CPSWPROXYSERVER_RSVD_MCAST_LIST_LEN
Definition: cpsw_proxy_server.h:163
uint16_t dfltVlanIdMacOnlyPorts
Definition: cpsw_proxy_server.h:348
void(* CpswProxyServer_FilterDelMacSharedCb)(const uint8_t *macAddr, const uint8_t coreId)
Filter delete shared multicast callback.
Definition: cpsw_proxy_server.h:256
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.
Definition: cpsw_proxy_server.h:179
uint32_t numMacPorts
Definition: cpsw_proxy_server.h:345
uint32_t numVirtPorts
Definition: cpsw_proxy_server.h:339
rpmsg_kdrv_ethswitch_client_notify_type
Etheret Remote Device Client to Server notify types.
Definition: rpmsg-kdrv-transport-ethswitch.h:503
CpswProxyServer_FilterAddMacSharedCb filterAddMacSharedCb
Definition: cpsw_proxy_server.h:274
Ethernet Firmware reserved multicast configuration.
Definition: cpsw_proxy_server.h:287
Cpsw Proxy Server Virtual Port Configuration structure.
Definition: cpsw_proxy_server.h:226
u32 core_key
Definition: rpmsg-kdrv-transport-ethswitch.h:102
u8 notifyid
Definition: rpmsg-kdrv-transport-ethswitch.h:104
int32_t CpswProxyServer_init(CpswProxyServer_Config_t *cfg)
Cpsw proxy server initialization function.
int32_t CpswProxyServer_start(void)
Start the Cpsw proxy server.
uint32_t remoteCoreId
Definition: cpsw_proxy_server.h:229
uint32_t autosarEthVirtPortNum
Definition: cpsw_proxy_server.h:327
CpswProxyServer_RsvdMcastCfg rsvdMcastCfg
Definition: cpsw_proxy_server.h:357
CpswProxyServer_NotifyCb notifyCb
Definition: cpsw_proxy_server.h:311