ETHFW API Guide
cpsw_proxy.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 __CPSWPROXY_H__
64 #define __CPSWPROXY_H__
65 
66 #include <stdint.h>
68 #include <ethremotecfg/protocol/cpsw_remote_notify_service.h>
70 #include <ti/drv/enet/enet.h>
71 
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
87 /* @} */
88 
103 /* Below error codes are aligned with CSL's and Enet LLD's to maintain
104  * consistency and avoid error code conversion */
105 
107 #define CPSWPROXY_SOK (0)
108 
110 #define CPSWPROXY_SINPROGRESS (1)
111 
113 #define CPSWPROXY_EFAIL (-1)
114 
116 #define CPSWPROXY_EBADARGS (-2)
117 
119 #define CPSWPROXY_EINVALIDPARAMS (-3)
120 
122 #define CPSWPROXY_ETIMEOUT (-4)
123 
125 #define CPSWPROXY_EALLOC (-8)
126 
128 #define CPSWPROXY_EUNEXPECTED (-9)
129 
131 #define CPSWPROXY_EBUSY (-10)
132 
134 #define CPSWPROXY_EALREADYOPEN (-11)
135 
137 #define CPSWPROXY_EPERM (-12)
138 
140 #define CPSWPROXY_ENOTSUPPORTED (-13)
141 
143 #define CPSWPROXY_ENOTFOUND (-14)
144 
146 #define CPSWPROXY_EUNKNOWNIOCTL (-15)
147 
149 #define CPSWPROXY_EMALFORMEDIOCTL (-16)
150 
164 
168 typedef struct CpswProxy_Config_s
169 {
172 
176 
182 typedef struct CpswProxy_ClientObj_s *CpswProxy_Handle;
183 
196 void CpswProxy_init(uint32_t masterCoreId,
197  uint32_t masterEndpt);
198 
205 void CpswProxy_deinit(void);
206 
218 int32_t CpswProxy_connect(void);
219 
233 
241 void CpswProxy_close(CpswProxy_Handle hProxy);
242 
269  Enet_Type enetType,
270  Enet_Handle *pCpswHandle,
271  uint32_t *coreKey,
272  uint32_t *rxMtu,
273  uint32_t *txMtu,
274  Enet_MacPort *macPort);
275 
315  Enet_Type enetType,
316  Enet_Handle *pCpswHandle,
317  uint32_t *coreKey,
318  uint32_t *rxMtu,
319  uint32_t *txMtu,
320  uint32_t *txPSILThreadId,
321  uint32_t *rxFlowStartIdx,
322  uint32_t *rxFlowIdx,
323  uint8_t *macAddress,
324  Enet_MacPort *macPort);
325 
341  Enet_Handle hEnet,
342  uint32_t coreKey);
343 
361  Enet_Handle hEnet,
362  uint32_t coreKey,
363  uint32_t *txPSILThreadId);
364 
381  Enet_Handle hEnet,
382  uint32_t coreKey,
383  uint32_t txChNum);
384 
405  Enet_Handle hEnet,
406  uint32_t coreKey,
407  uint32_t *rxFlowStartIdx,
408  uint32_t *rxFlowIdx);
409 
430  Enet_Handle hEnet,
431  uint32_t coreKey,
432  uint32_t rxFlowStartIdx,
433  uint32_t rxFlowIdx);
434 
452  Enet_Handle hEnet,
453  uint32_t coreKey,
454  uint8_t *macAddress);
455 
472  Enet_Handle hEnet,
473  uint32_t coreKey,
474  const uint8_t *macAddress);
475 
500  Enet_Handle hEnet,
501  uint32_t coreKey,
502  uint32_t rxFlowStartIdx,
503  uint32_t rxFlowOffsetIdx,
504  const uint8_t *macAddress);
505 
526  Enet_Handle hEnet,
527  uint32_t coreKey,
528  uint32_t rxFlowStartIdx,
529  uint32_t rxFlowOffsetIdx,
530  const uint8_t *macAddress);
531 
554  Enet_Handle hEnet,
555  uint32_t coreKey,
556  uint32_t rxFlowStartIdx,
557  uint32_t rxFlowOffsetIdx,
558  uint16_t etherType);
559 
583  Enet_Handle hEnet,
584  uint32_t coreKey,
585  uint32_t rxFlowStartIdx,
586  uint32_t rxFlowOffsetIdx,
587  uint16_t etherType);
588 
611  Enet_Handle hEnet,
612  uint32_t coreKey,
613  uint32_t rxFlowStartIdx,
614  uint32_t rxFlowOffsetIdx);
615 
640  Enet_Handle hEnet,
641  uint32_t coreKey,
642  uint32_t rxFlowStartIdx,
643  uint32_t rxFlowOffsetIdx);
644 
645 
646 
647 
666  Enet_Handle hEnet,
667  uint32_t coreKey,
668  uint8_t *macAddr,
669  uint8_t *ipv4Addr);
670 
688  Enet_Handle hEnet,
689  uint32_t coreKey,
690  uint8_t *ipv4Addr);
691 
711  Enet_Handle hEnet,
712  uint32_t coreKey,
713  const uint8_t *macAddr);
714 
715 
733  Enet_Handle hEnet,
734  uint32_t coreKey,
735  const uint8_t *macAddr);
736 
770  Enet_Handle hEnet,
771  uint32_t coreKey,
772  uint32_t rxFlowStartIdx,
773  uint32_t rxFlowOffsetIdx,
774  const uint8_t *macAddress,
775  uint16_t vlanId);
776 
803  Enet_Handle hEnet,
804  uint32_t coreKey,
805  uint32_t rxFlowStartIdx,
806  uint32_t rxFlowOffsetIdx,
807  const uint8_t *macAddress,
808  uint16_t vlanId);
809 
834  Enet_Handle hEnet,
835  uint32_t coreKey,
836  uint32_t cmd,
837  Enet_IoctlPrms *prms);
838 
855  Enet_Handle hEnet,
856  uint32_t coreKey,
857  Enet_MacPort portNum);
858 
876  Enet_Handle hEnet,
877  uint32_t coreKey,
878  uint8_t notifyId,
879  uint8_t *notifyInfo,
880  uint32_t notifyInfoLength);
881 
902  Enet_Handle hEnet,
903  uint32_t coreKey,
904  uint8_t timerId,
905  uint8_t hwPushNum);
906 
926  Enet_Handle hEnet,
927  uint32_t coreKey,
928  uint8_t hwPushNum);
929 
940 int32_t CpswProxy_registerHwPushNotifyCb(CpswRemoteNotifyService_hwPushNotifyCbFxn cbFxn,
941  void *cbArg);
942 
947 
959  Enet_Handle hEnet,
960  uint32_t coreKey,
961  bool enable);
962 
963 /* @} */
964 
965 #ifdef __cplusplus
966 }
967 #endif
968 
969 #endif /* #ifndef __CPSWPROXY_H__ */
u32 cmd
Definition: rpmsg-kdrv-transport-ethswitch.h:104
void CpswProxy_registerRemoteTimer(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t timerId, uint8_t hwPushNum)
Register remote core&#39;s timer for synchronization.
void CpswProxy_attachExtended(CpswProxy_Handle hProxy, Enet_Type enetType, Enet_Handle *pCpswHandle, uint32_t *coreKey, uint32_t *rxMtu, uint32_t *txMtu, uint32_t *txPSILThreadId, uint32_t *rxFlowStartIdx, uint32_t *rxFlowIdx, uint8_t *macAddress, Enet_MacPort *macPort)
Attach to Ethernet Switch Remote Device with extended response.
int32_t CpswProxy_connect(void)
Connect to the Cpsw Proxy server.
Cpsw Proxy Client Configuration structure.
Definition: cpsw_proxy.h:168
void CpswProxy_unregisterIPV4Addr(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t *ipv4Addr)
Unregister association of IPv4 address with MAC address by removing ARP entry in the master core...
CpswProxy_Handle CpswProxy_open(const CpswProxy_Config *cfg)
Open CPSW proxy client instance with the given configuration.
void CpswProxy_unregisterEthertypeRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, uint16_t etherType)
Unregister the given EtherType to the given rx flow id.
int32_t CpswProxy_registerHwPushNotifyCb(CpswRemoteNotifyService_hwPushNotifyCbFxn cbFxn, void *cbArg)
Register hardware push notification callback.
void CpswProxy_unregisterDefaultRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx)
Unregister Default Flow from the given flow index.
Ethernet Switch Remote Device Data.
Definition: rpmsg-kdrv-transport-ethswitch.h:1331
bool CpswProxy_isPhyLinked(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, Enet_MacPort portNum)
Query if the link for PHY associated with the given MAC Port is up.
void CpswProxy_ioctl(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t cmd, Enet_IoctlPrms *prms)
Invoke Cpsw IOCTL.
void CpswProxy_sendNotify(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t notifyId, uint8_t *notifyInfo, uint32_t notifyInfoLength)
Send custom notification info from client to server.
void CpswProxy_unregisterDstMacRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, const uint8_t *macAddress)
Unregister Destination MAC address from the given flow index.
void CpswProxy_attach(CpswProxy_Handle hProxy, Enet_Type enetType, Enet_Handle *pCpswHandle, uint32_t *coreKey, uint32_t *rxMtu, uint32_t *txMtu, Enet_MacPort *macPort)
Attach to Ethernet Switch Remote Device.
void CpswProxy_addHostPortEntry(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, const uint8_t *macAddr)
Add the given unicast macAddr as host port MAC address.
int32_t CpswProxy_filterDelMac(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, const uint8_t *macAddress, uint16_t vlanId)
Delete multicast address from receive filter.
void CpswProxy_registerDefaultRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx)
Register Default Flow to the given flow index.
void CpswProxy_registerEthertypeRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, uint16_t etherType)
Register the given EtherType to the given rx flow id.
void CpswProxy_allocRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t *rxFlowStartIdx, uint32_t *rxFlowIdx)
Alloc Rx flow Id.
int32_t CpswProxy_filterAddMac(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, const uint8_t *macAddress, uint16_t vlanId)
Add multicast address to receive filter.
u32 enable
Definition: rpmsg-kdrv-transport-ethswitch.h:104
EthRemoteCfg_VirtPort
Virtual port id.
Definition: ethremotecfg_virtport.h:97
void CpswProxy_allocMac(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t *macAddress)
Alloc Destination MAC address.
void CpswProxy_unregisterHwPushNotifyCb(void)
Unregister hardware push notification callback.
u8 hwPushNum
Definition: rpmsg-kdrv-transport-ethswitch.h:106
void CpswProxy_freeRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowIdx)
Free Rx flow Id.
void CpswProxy_setPromiscMode(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, bool enable)
Set promiscuous mode.
void(* CpswProxy_deviceDataNotifyCbFxn)(struct rpmsg_kdrv_ethswitch_device_data *eth_dev_data)
Application Callback function pointers to notify when remote ethernet device data is received on remo...
Definition: cpsw_proxy.h:163
struct CpswProxy_ClientObj_s * CpswProxy_Handle
CPSW Proxy handle.
Definition: cpsw_proxy.h:182
void CpswProxy_freeMac(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, const uint8_t *macAddress)
Free Tx Channel CPSW PSIL Destination thread id.
void CpswProxy_delAddrEntry(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, const uint8_t *macAddr)
Remove macAddress from the switch address resolution table.
void CpswProxy_deinit(void)
Deinitialize CPSW Proxy on a given core.
CpswProxy_deviceDataNotifyCbFxn deviceDataNotifyCb
Definition: cpsw_proxy.h:174
void CpswProxy_init(uint32_t masterCoreId, uint32_t masterEndpt)
Initialize CPSW Proxy on a given core.
void CpswProxy_allocTxCh(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t *txPSILThreadId)
Alloc Tx Channel CPSW PSIL Destination thread id.
void CpswProxy_registerIPV4Addr(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t *macAddr, uint8_t *ipv4Addr)
Register association of IPv4 address with MAC address by adding ARP entry in the master core...
void CpswProxy_close(CpswProxy_Handle hProxy)
Close CPSW proxy client.
EthRemoteCfg_VirtPort virtPort
Definition: cpsw_proxy.h:171
void CpswProxy_registerDstMacRxFlow(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t rxFlowStartIdx, uint32_t rxFlowOffsetIdx, const uint8_t *macAddress)
Register Destination MAC address with the given flow index.
void CpswProxy_unregisterRemoteTimer(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint8_t hwPushNum)
Unregister remote core&#39;s timer for synchronization.
void CpswProxy_detach(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey)
Detach from Ethernet Switch Remote Device.
void CpswProxy_freeTxCh(CpswProxy_Handle hProxy, Enet_Handle hEnet, uint32_t coreKey, uint32_t txChNum)
Free Tx Channel CPSW PSIL Destination thread id.
This file contains the type definitions and helper macros for Ethernet Firmware&#39;s Virtual Port...