PDK API Guide for J721E
cpsw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2020
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
62 #ifndef CPSW_H_
63 #define CPSW_H_
64 
65 /* ========================================================================== */
66 /* Include Files */
67 /* ========================================================================== */
68 
69 #include <stdint.h>
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 /* ========================================================================== */
86 /* Macros */
87 /* ========================================================================== */
89 #define CPSW_PER_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
90  ENET_IOCTL_PER_BASE | \
91  ENET_IOCTL_PER_CPSW | \
92  ENET_IOCTL_MIN(x))
93 
95 #define CPSW_MAC_PORT_NUM (8U)
96 
107 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT (CPSW_ALE_POLICER_MATCH_PORT)
108 
110 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC (CPSW_ALE_POLICER_MATCH_MACSRC)
111 
113 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST (CPSW_ALE_POLICER_MATCH_MACDST)
114 
116 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE (CPSW_ALE_POLICER_MATCH_ETHERTYPE)
117 
119 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC (CPSW_ALE_POLICER_MATCH_IPSRC)
120 
122 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST (CPSW_ALE_POLICER_MATCH_IPDST)
123 
127 #define CPSW_INTR_STATS_PEND0 (1U)
128 
130 #define CPSW_INTR_MDIO_PEND (2U)
131 
133 #define CPSW_INTR_EVNT_PEND (3U)
134 
135 /* ========================================================================== */
136 /* Structures and Enums */
137 /* ========================================================================== */
138 
142 typedef enum Cpsw_Ioctl_e
143 {
152 
161 
170 
179 
188 
198 
211 
223 } Cpsw_Ioctl;
224 
228 typedef struct Cpsw_InterVlanRouteIngressPktMatchCfg_s
229 {
233 
238 
243 
248 
253 
255  uint32_t vlanId;
256 
261 
266 
270  uint16_t etherType;
272 
276 typedef struct Cpsw_InterVlanEgressPortCfg_s
277 {
280 
286 
290 typedef struct Cpsw_SetInterVlanRouteUniEgressInArgs_s
291 {
296 
300 
304 typedef struct Cpsw_SetInterVlanRouteUniEgressOutArgs_s
305 {
308 
312 
316 typedef struct Cpsw_ClearInterVlanRouteUniEgressInArgs_s
317 {
322 
325 
329  uint32_t delAleEntryMask;
331 
335 typedef struct Cpsw_SetInterVlanRouteMultiEgressInArgs_s
336 {
338  uint32_t numEgressPorts;
339 
344 
350 
354 typedef struct Cpsw_SetInterVlanRouteMultiEgressOutArgs_s
355 {
358 
362 
366 typedef struct Cpsw_ClearInterVlanRouteMultiEgressInArgs_s
367 {
369  uint32_t numEgressPorts;
370 
375 
380 
384  uint32_t delAleEntryMask;
386 
390 typedef struct Cpsw_SetTxShortIpgCfgInArgs_s
391 {
396 
400 
402  uint32_t numMacPorts;
403 
408 
414 typedef struct Cpsw_TxShortIpgCfg_s
415 {
419 
421  uint32_t numMacPorts;
422 
427 
432 typedef struct Cpsw_PortRxFlowInfo_s
433 {
435  uint32_t coreKey;
436 
438  uint32_t startIdx;
439 
441  uint32_t flowIdx;
442 
446 
450 typedef struct Cpsw_VlanCfg_s
451 {
453  bool vlanAware;
454 
457 
459  uint16_t outerVlan;
460 
462  uint16_t innerVlan;
463 } Cpsw_VlanCfg;
464 
468 typedef struct Cpsw_MdioLinkStateChangeInfo_s
469 {
471  uint32_t phyAddr;
472 
476 
479  bool isAlive;
480 
483 
485  bool isLinked;
487 
495  void *appArg);
496 
505  bool isLinkUp,
506  void *appArg);
507 
513 typedef struct Cpsw_Cfg_s
514 {
517 
519  const void *dmaCfg;
520 
523 
527  uint32_t txMtu[ENET_PRI_NUM];
528 
529  // /*! Configuration of the CPSW DMA */
530  // EnetDma_Cfg dmaCfg;
531 
534 
537 
540 
543 
546 
548  uint32_t intrPriority;
549 
552 
555 
559 
562 
568 
571 } Cpsw_Cfg;
572 
573 /* ========================================================================== */
574 /* Global Variables Declarations */
575 /* ========================================================================== */
576 
577 /* None */
578 
579 /* ========================================================================== */
580 /* Function Declarations */
581 /* ========================================================================== */
582 
583 /* None */
584 
585 /* ========================================================================== */
586 /* Deprecated Function Declarations */
587 /* ========================================================================== */
588 
589 /* None */
590 
591 /* ========================================================================== */
592 /* Static Function Definitions */
593 /* ========================================================================== */
594 
595 /* None */
596 
597 #ifdef __cplusplus
598 }
599 #endif
600 
601 #endif /* CPSW_H_ */
602 
bool enableQsgmii1RDC
Definition: cpsw.h:570
Setup interVLAN route for a single egress port.
Definition: cpsw.h:151
#define CPSW_PER_PUBLIC_IOCTL(x)
Helper macro to create CPSW IOCTL commands.
Definition: cpsw.h:89
uint32_t coreKey
Definition: cpsw.h:435
Enet_MacPort macPort
Definition: cpsw.h:444
bool isAlive
Definition: cpsw.h:479
CpswAle_Cfg aleCfg
Definition: cpsw.h:536
void(* Cpsw_PortLinkStatusChangeCb)(Enet_MacPort macPort, bool isLinkUp, void *appArg)
CPSW port link status change callback function.
Definition: cpsw.h:504
ALE configuration.
Definition: cpsw_ale.h:2047
Clear interVLAN route for a multiple egress port route.
Definition: cpsw.h:178
This file contains the type definitions and helper macros for the CPSW Statistics module interface.
Enet_MacPort egressPort
Definition: cpsw.h:279
#define CPSW_ALE_NUM_MAC_PORTS
Number of external ports in the subsystem.
Definition: cpsw_ale.h:92
uint32_t vlanId
Definition: cpsw.h:255
bool isLinked
Definition: cpsw.h:485
Unregister MAC port from a specific RX flow.
Definition: cpsw.h:222
uint32_t numEgressPorts
Definition: cpsw.h:338
Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:304
CpswAle_IpAddrClassifierInfo srcIpInfo
Definition: cpsw.h:260
Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:316
const void * dmaCfg
Definition: cpsw.h:519
uint32_t packetMatchEnMask
Definition: cpsw.h:232
Cpsw_VlanCfg vlanCfg
Definition: cpsw.h:522
Setup interVLAN route for a single egress port.
Definition: cpsw.h:160
bool linkChanged
Definition: cpsw.h:482
This file contains the type definitions and helper macros for the Enet Data Path (DMA) interface.
This file contains the type definitions and helper macros for the CPSW Address Lookup Engine (ALE) mo...
void * mdioLinkStateChangeCbArg
Definition: cpsw.h:554
uint32_t flowIdx
Definition: cpsw.h:441
This file contains the type definitions and helper macros for the Ethernet PHY interface.
Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:354
Mdio_Cfg mdioCfg
Definition: cpsw.h:542
uint32_t intrPriority
Definition: cpsw.h:548
void * portLinkStatusChangeCbArg
Definition: cpsw.h:561
Short IPG configuration for CPSW IP.
Definition: cpsw.h:414
bool configureGapThresh
Definition: cpsw.h:395
uint16_t etherType
Definition: cpsw.h:270
uint32_t delAleEntryMask
Definition: cpsw.h:384
CpswMacPort_InterVlanRouteId egressPortRouteId
Definition: cpsw.h:307
Enet_MacPort ingressPort
Definition: cpsw.h:242
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:213
CpswAle_PolicerEntryOutArgs ingressPacketClassifierInfo
Definition: cpsw.h:310
#define CPSW_MAC_PORT_NUM
Definition: cpsw.h:95
uint32_t ipgTriggerThreshBlkCnt
Definition: cpsw.h:399
uint32_t numEgressPorts
Definition: cpsw.h:369
void(* Cpsw_MdioLinkStateChangeCb)(Cpsw_MdioLinkStateChangeInfo *info, void *appArg)
CPSW PHY link state change callback function.
Definition: cpsw.h:494
Setup interVLAN route for a multiple egress port.
Definition: cpsw.h:169
ALE IP address classifier info.
Definition: cpsw_ale.h:1402
CpswAle_MacAddrClassifierInfo srcMacAddrInfo
Definition: cpsw.h:247
This file contains the type definitions and helper macros for the Enet Resource Manager module.
Enet_VlanTagType vlanSwitch
Definition: cpsw.h:456
uint32_t numMacPorts
Definition: cpsw.h:421
Resource manager configuration parameters.
Definition: enet_rm.h:336
Cpsw_Ioctl
CPSW peripheral IOCTL commands.
Definition: cpsw.h:142
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:321
CpswAle_MacAddrClassifierInfo dstMacAddrInfo
Definition: cpsw.h:252
Cpsw_PortLinkStatusChangeCb portLinkStatusChangeCb
Definition: cpsw.h:558
Input args for CPSW_IOCTL_REGISTER_PORT_RX_FLOW and CPSW_IOCTL_UNREGISTER_PORT_RX_FLOW commands.
Definition: cpsw.h:432
bool enableQsgmii0RDC
Definition: cpsw.h:567
This file contains the type definitions and helper macros for the CPSW host port module.
Cpsw_MdioLinkStateChangeCb mdioLinkStateChangeCb
Definition: cpsw.h:551
CPSW-level VLAN configuration.
Definition: cpsw.h:450
ALE classifier/policer match parameters for source or destination MAC address.
Definition: cpsw_ale.h:1202
CPTS configuration.
Definition: cpsw_cpts.h:577
Input args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:335
MAC port's short gap configuration.
Definition: cpsw_macport.h:177
uint32_t ipgTriggerThreshBlkCnt
Definition: cpsw.h:418
Input args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:290
uint32_t phyAddr
Definition: cpsw.h:471
MDIO module configuration.
Definition: mdio.h:107
This file contains the type definitions and helper macros for the CPSW MAC port module interface.
PHY link status change event information.
Definition: cpsw.h:468
uint32_t escalatePriorityLoadVal
Definition: cpsw.h:516
InterVLAN route ingress packet match criteria configuration.
Definition: cpsw.h:228
Output args for CPSW_ALE_IOCTL_GET_POLICER, CPSW_ALE_IOCTL_SET_POLICER_THREADCFG, CPSW_ALE_IOCTL_BLOC...
Definition: cpsw_ale.h:1553
#define ENET_PRI_NUM
Packet priority.
Definition: enet_types.h:165
InterVLAN egress port configuration.
Definition: cpsw.h:276
uint32_t numMacPorts
Definition: cpsw.h:402
uint32_t startIdx
Definition: cpsw.h:438
CpswMacPort_InterVlanRoutingCfg outPktModCfg
Definition: cpsw.h:284
Enet_MacPort
MAC port.
Definition: enet_types.h:405
Register MAC port to a specific RX flow.
Definition: cpsw.h:210
CpswAle_IpAddrClassifierInfo dstIpInfo
Definition: cpsw.h:265
Get the current short inter-packet gap (IPG) configuration for all open MAC ports.
Definition: cpsw.h:197
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:295
Host port module configuration parameters.
Definition: cpsw_hostport.h:137
This file contains the CPSW clock id definitions.
CpswHostPort_Cfg hostPortCfg
Definition: cpsw.h:533
CpswMacPort_InterVlanRouteId
MAC port interVLAN route identifier.
Definition: cpsw_macport.h:189
CpswCpts_Cfg cptsCfg
Definition: cpsw.h:539
Input args for CPSW_PER_IOCTL_SET_SHORT_IPG_CFG.
Definition: cpsw.h:390
CPSW configuration.
Definition: cpsw.h:513
bool vlanAware
Definition: cpsw.h:453
EnetRm_ResCfg resCfg
Definition: cpsw.h:545
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:348
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:379
Cpsw_InterVlanEgressPortCfg egressCfg
Definition: cpsw.h:298
CpswMacPort_InterVlanRouteId egressPortRouteId
Definition: cpsw.h:357
uint16_t outerVlan
Definition: cpsw.h:459
Enet_VlanTagType
Double tagging VLAN type.
Definition: enet_types.h:372
This file contains private type definitions and helper macros for the CPSW CPTS module.
bool ttlCheckEn
Definition: cpsw.h:237
uint32_t delAleEntryMask
Definition: cpsw.h:329
This file contains the type definitions and helper macros for the MDIO module interface.
bool aliveChanged
Definition: cpsw.h:475
Configure short inter-packet gap (IPG) for specific MAC ports.
Definition: cpsw.h:187
Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:366
CpswAle_PolicerEntryOutArgs ingressPacketClassifierInfo
Definition: cpsw.h:360
Cpsw_InterVlanEgressPortCfg egressCfg
Definition: cpsw.h:324
uint16_t innerVlan
Definition: cpsw.h:462