Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
openapi_instru_ifa.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2018 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License")
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_instru_ifa.h
28 *
29 * @purpose INBAND FLOW ANALYZER API: Provide an interface for configuring
30 * IFA sessions in hardware.
31 *
32 * @component INBAND FLOW ANALYZER (INBAND FLOW ANALYZER API)
33 *
34 * @create 09/06/2018
35 *
36 * @author Naveen Kumar Aketi
37 * @end
38 *
39 **********************************************************************/
40 #ifndef OPENAPI_IFA_H_INCLUDED
41 #define OPENAPI_IFA_H_INCLUDED
42 
43 #include <stdbool.h>
44 #include "openapi_common.h"
45 #include "openapi_instru_nos.h"
46 
48 #define OPEN_IFA_MAX_NAME_LENGTH 128
49 
50 /* IFA max flow per session */
51 #define OPEN_IFA_MAX_FLOWS_PER_SESSION 8
52 
54 #define OPEN_IFA_ASIC_MAX_COUNT 1
55 
56 /* IFA flow key*/
57 typedef struct _open_ifa_flow_key_
58 {
59  char name[OPEN_IFA_MAX_NAME_LENGTH]; /* Name of the singature*/
61 
62 /* IFA flow type*/
63 typedef enum _open_ifa_flow_type_
64 {
65  OPEN_IFA_FLOW_FIVE_TUPLE = (1<<0), /* Five tuple based flow */
66  OPEN_IFA_FLOW_EGR_PORTS = (1<<1), /* Egress ports based flow */
67  OPEN_IFA_FLOW_ING_PORTS = (1<<2), /* Ingress ports based flow */
68 } OPEN_IFA_FLOW_TYPE_t;
69 
70 /* Five tuple params mask */
71 typedef enum _open_ifa_tuple_mask_
72 {
73  OPEN_IFA_CONFIG_TUPLE_SRC_IP = (1 << 0),
74  OPEN_IFA_CONFIG_TUPLE_DST_IP = (1 << 1),
75  OPEN_IFA_CONFIG_TUPLE_PROTOCOL = (1 << 2),
76  OPEN_IFA_CONFIG_TUPLE_SRC_PORT = (1 << 3),
77  OPEN_IFA_CONFIG_TUPLE_DST_PORT = (1 << 4)
78 } OPEN_IFA_TUPLE_MASK_t;
79 
80 /* 5-tuple parameters */
81 typedef struct _open_ifa_5_tuple_key_
82 {
83  OPEN_INSTRU_IP_PREFIX_t src_ip;
84  OPEN_INSTRU_IP_PREFIX_t dst_ip;
85  unsigned int protocol;
86  unsigned short src_port;
87  unsigned short dst_port;
88  unsigned int tuple_mask; /* Valid 5 tuple params mask */
90 
91 /* enum that represents params */
92 typedef enum _open_ifa_flow_param_mask_
93 {
94  OPEN_IFA_FLOW_PARAM_ING_PORT = (1 << 0),
95  OPEN_IFA_FLOW_PARAM_SAMPLING_RATE = (1 << 1),
96 } OPEN_IFA_FLOW_PARAM_t;
97 
98 /* structure of different flow params */
99 typedef struct _open_ifa_flow_params_
100 {
101  unsigned int ing_port; /* Ingress port */
102  OPEN_IFA_5_TUPLE_KEY_t five_tuple; /* five tuple info */
103  OPEN_PORT_MASK_t ing_port_mask; /* Ingress port mask */
104  OPEN_PORT_MASK_t egr_port_mask; /* Egress port mask */
105  unsigned int sampling_rate; /* sampling rate */
106  unsigned int mask; /* Mask of valid params */
108 
109 /* IFA singature information */
110 typedef struct _open_ifa_flow_
111 {
112  OPEN_IFA_FLOW_KEY_t key; /* IFA flow key*/
113  OPEN_IFA_FLOW_TYPE_t type; /* IFA flow type*/
114  OPEN_IFA_FLOW_PARAMS_t params; /* Flow information*/
116 
117 typedef enum _open_ifa_cl_config_param_mask_
118 {
119  OPEN_IFA_CL_CONFIG_VLAN_MASK = (1 << 0), /* Mask of vlan param */
120  OPEN_IFA_CL_CONFIG_PRIORITY_MASK = (1 << 1), /* Mask of priority param */
121 } OPEN_IFA_CL_CONFIG_PARAM_MASK_t;
122 
123 /* IFA Collector key*/
124 typedef struct _open_ifa_cl_key_
125 {
126  char name[OPEN_IFA_MAX_NAME_LENGTH]; /* Name of the singature*/
128 
129 /* IFA collector config */
130 typedef struct _open_ifa_cl_config_
131 {
132  OPEN_IFA_CL_KEY_t key; /* Collector Key */
133  OPEN_INSTRU_IP_ADDR_t addr; /* IP address of the collector */
134  unsigned short port; /* Port number of the collector */
135  unsigned short vlan_id; /* Vlan ID */
136  unsigned char priority; /* Priority */
137  OPEN_IFA_CL_CONFIG_PARAM_MASK_t mask; /* Param mask */
139 
140 /* IFA session key*/
142 {
143  char name[OPEN_IFA_MAX_NAME_LENGTH];
145 
146 /* IFA session information */
147 typedef struct _open_ifa_session_
148 {
149  OPEN_IFA_SESSION_KEY_t key; /* IFA session key*/
150  unsigned int num_of_flows; /* Number of flows */
151  OPEN_IFA_FLOW_KEY_t flow[OPEN_IFA_MAX_FLOWS_PER_SESSION]; /* IFA session flows infromation */
152  OPEN_IFA_CL_KEY_t collector_key; /* Collector key */
153  unsigned int congestion_limit; /* Queue congestion limit */
154  unsigned int drop_limit; /* Drop limit */
156 
157 /* IFA device type */
158 typedef enum _open_ifa_dev_type_
159 {
160  IFA_DEV_TYPE_INGRESS = (1 << 0), /* Ingress device */
161  IFA_DEV_TYPE_INTERMEDIATE = (1 << 1), /* Intermediate device */
162  IFA_DEV_TYPE_EGRESS = (1 << 2) /* Egress device */
163 } OPEN_IFA_DEV_TYPE_t;
164 
165 /* IFA feature config mask */
166 typedef enum _open_ifa_feat_config_mask_
167 {
168  OPEN_IFA_FEAT_CONFIG_DEV_ID = (1 << 1), /* dev_id param mask */
169  OPEN_IFA_FEAT_CONFIG_DEV_TYPE = (1 << 2) /* dev_type params mask */
170 } OPEN_IFA_FEAT_CONFIG_MASK_t;
171 
172 /* ifa feature information */
173 typedef struct _open_ifa_feature_
174 {
175  bool enable; /* IFA feature status */
176  unsigned int dev_id; /* Switch ID */
177  OPEN_IFA_DEV_TYPE_t dev_type; /* Device Type */
178  OPEN_IFA_FEAT_CONFIG_MASK_t mask; /* Config params mask */
180 
181 /* IFA Capabilities */
183 {
184  unsigned int max_flows; /* Max supported flows */
185  unsigned int max_sessions; /* Max supported sessions */
186  unsigned int max_collectors; /* Max supported collectors */
187  unsigned int max_payload; /* Maximum number of bytes that an IFA payload can take. */
188  unsigned int flow_types; /* Indicates the types of flows that can be monitored for IFA
189  Supported values */
190 
191  unsigned int supported_dev_type_mask; /* Supported device types mask */
193 
194 /* IFA Session Statistics */
196 {
197  uint64_t count;
199 
200 /*****************************************************************/
215  int asic,
216  OPEN_IFA_FEATURE_t *config);
217 
218 /*****************************************************************/
233  int asic,
234  OPEN_IFA_FEATURE_t *config);
235 
236 /*****************************************************************/
251  int asic,
252  OPEN_IFA_SESSION_t *session);
253 
254 /*****************************************************************/
269  int asic,
270  OPEN_IFA_FLOW_t *appFlow);
271 
272 /*****************************************************************/
287  int asic,
288  open_buffdesc *name);
289 
290 /*****************************************************************/
305  int asic,
306  open_buffdesc *name);
307 
308 /*****************************************************************/
323  int asic,
324  open_buffdesc *name);
325 
326 /*****************************************************************/
341  int asic,
342  open_buffdesc *name);
343 
344 /*****************************************************************/
359  int asic,
361 
362 /*****************************************************************/
377  int asic,
378  open_buffdesc *name);
379 
380 /*****************************************************************/
396  int asic,
397  open_buffdesc *name,
399 
400 /*****************************************************************/
415  int asic,
416  OPEN_IFA_CL_CONFIG_t *clConfig);
417 
418 /*****************************************************************/
433  int asic,
434  open_buffdesc *name);
435 #endif /* OPENAPI_IFA_H_INCLUDED*/
436 
open_error_t openapiIfaSessionStatsGet(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name, OPEN_IFA_SESSION_STATS_t *data)
Get IFA stats.
open_error_t openapiIfaClearStats(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Clear IFA stats.
open_error_t
OPEN uses these enumerators to indicate the error codes.
open_error_t openapiIfaSessionCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_SESSION_t *session)
Create IFA session.
open_error_t openapiIfaFlowCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_FLOW_t *appFlow)
Create IFA flow.
open_error_t openapiIfaSessionStop(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Stop IFA session.
open_error_t openapiIfaCapabilitiesGet(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_CAPABILITIES_t *cap)
Get IFA capabilities.
open_error_t openapiIfaCollectorRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Remove IFA collector.
open_error_t openapiIfaSessionRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Remove IFA session.
open_error_t openapiIfaCollectorCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_CL_CONFIG_t *clConfig)
Create IFA collector.
open_error_t openapiIfaSessionStart(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Start IFA session.
open_error_t openapiIfaFlowRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Remove IFA flow.
#define OPEN_IFA_MAX_NAME_LENGTH
Maximum length of name param.
open_error_t openapiIfaConfigGet(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_FEATURE_t *config)
Inband flow analyzer feature configuration get function.
open_error_t openapiIfaConfigSet(openapiClientHandle_t *clientHandle, int asic, OPEN_IFA_FEATURE_t *config)
Inband flow analyzer feature configuration set function.