PDK API Guide for AM65xx
cpsw_stats_priv.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 
41 #ifndef CPSW_STATS_PRIV_H_
42 #define CPSW_STATS_PRIV_H_
43 
44 /* ========================================================================== */
45 /* Include Files */
46 /* ========================================================================== */
47 
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /* ========================================================================== */
56 /* Macros */
57 /* ========================================================================== */
58 
60 #define CPSW_STATS_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
61  ENET_IOCTL_STATS_BASE | \
62  ENET_IOCTL_PER_CPSW | \
63  ENET_IOCTL_MIN(x))
64 
66 #define CPSW_STATS_MACPORT_MAX (8U)
67 
68 /* ========================================================================== */
69 /* Structures and Enums */
70 /* ========================================================================== */
71 
75 typedef enum CpswStats_PrivIoctls_e
76 {
86 
90 typedef struct CpwStats_Obj_s
91 {
94 
98 
101 
105 
108 
112 
114  uint32_t macPortNum;
115 } CpswStats_Obj;
116 
121 
122 /* ========================================================================== */
123 /* Global Variables Declarations */
124 /* ========================================================================== */
125 
126 /* None */
127 
128 /* ========================================================================== */
129 /* Function Declarations */
130 /* ========================================================================== */
131 
143 int32_t CpswStats_open(EnetMod_Handle hMod,
144  Enet_Type enetType,
145  uint32_t instId,
146  const void *cfg,
147  uint32_t cfgSize);
148 
158 int32_t CpswStats_rejoin(EnetMod_Handle hMod,
159  Enet_Type enetType,
160  uint32_t instId);
161 
171 int32_t CpswStats_ioctl(EnetMod_Handle hMod,
172  uint32_t cmd,
173  Enet_IoctlPrms *prms);
174 
181 
182 /* ========================================================================== */
183 /* Deprecated Function Declarations */
184 /* ========================================================================== */
185 
186 /* None */
187 
188 /* ========================================================================== */
189 /* Static Function Definitions */
190 /* ========================================================================== */
191 
192 /* None */
193 
194 #ifdef __cplusplus
195 }
196 #endif
197 
198 #endif /* CPSW_STATS_PRIV_H_ */
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
int32_t CpswStats_ioctl(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on CPSW stats.
This file contains the type definitions and helper macros for the CPSW Statistics module interface.
int32_t CpswStats_rejoin(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
Rejoin a running CPSW stats module.
int32_t CpswStats_open(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize CPSW stats.
This file contains the type definitions and helper macros for the Enet Statistics module interface.
Ethernet Module object.
Definition: enet_mod.h:136
CpswStats_PortStats * hostPortStats
Definition: cpsw_stats_priv.h:100
#define CPSW_STATS_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for CPSW stats module.
Definition: cpsw_stats_priv.h:60
Enet IOCTL param.
Definition: enet_ioctl.h:229
CpswStats_PrivIoctls
Statistics private IOCTL commands.
Definition: cpsw_stats_priv.h:75
CpswStats_PortStats * macPortStats
Definition: cpsw_stats_priv.h:104
uint32_t macPortNum
Definition: cpsw_stats_priv.h:114
Enet_Type enetType
Definition: cpsw_stats_priv.h:97
CPSW nG port statistics.
Definition: cpsw_stats.h:826
CpswStats_PortStats hostPortStatsMem
Definition: cpsw_stats_priv.h:107
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
void CpswStats_close(EnetMod_Handle hMod)
Close CPSW stats.
CPSW statistics object.
Definition: cpsw_stats_priv.h:90
EnetMod_Obj enetMod
Definition: cpsw_stats_priv.h:93
CpswStats_Obj * CpswStats_Handle
Statistics module handle.
Definition: cpsw_stats_priv.h:120
Synchronize hardware and software statistics.
Definition: cpsw_stats_priv.h:84
#define CPSW_STATS_MACPORT_MAX
Maximum number of MAC port stats blocks.
Definition: cpsw_stats_priv.h:66