Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
openapi_instru_flow_tracker.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_flow_tracker.h
28 *
29 * @purpose FLOW TRACKER API: Provide an interface for configuring
30 * flow groups in hardware.
31 *
32 * @component FLOW TRACKER (FLOW TRACKER API)
33 *
34 * @create 07/20/2017
35 *
36 * @author Naveen Kumar Aketi
37 * @end
38 *
39 **********************************************************************/
40 #ifndef OPENAPI_FT_H_INCLUDED
41 #define OPENAPI_FT_H_INCLUDED
42 
43 #include <stdbool.h>
44 #include "openapi_common.h"
45 #include "openapi_instru_nos.h"
46 
48 typedef enum _open_ft_pkt_type_
49 {
50  OPEN_FT_PKT_TYPE_FLW_TEMPLATE = 1,
51  OPEN_FT_PKT_TYPE_FLW_GRP_TEMPLATE,
52  OPEN_FT_PKT_TYPE_FLW_GRP_REC
54 
56 typedef struct _open_ft_ipfix_config_
57 {
58  unsigned int periodicity; /* Template periodicity*/
59  unsigned int rec_periodicity; /* Record periodicity */
60  unsigned short src_port; /* Source port */
61  unsigned int obs_dmn; /* Observation domain */
63 
64 /* FT config feature params mask */
65 typedef enum _open_ft_config_feat_param_mask_
66 {
67  OPEN_FT_CONFIG_FEAT_ENABLE_MASK = (1 << 0), /* Mask of enable field in config feature */
68  OPEN_FT_CONFIG_FEAT_PARAM_FLW_AGE_TIME_MASK = (1 << 1), /* Mask of flow aging time param in config feat */
69 } OPEN_FT_CONFIG_FEAT_PARAM_MASK_t;
70 
71 
74 {
75  bool enable;
76  unsigned int flow_aging_time; /* Aging time of a Flow */
77  OPEN_FT_IPFIX_CONFIG_t flw_exp_ipfix; /* IPFIX configuration of flow exporting process */
78  OPEN_FT_IPFIX_CONFIG_t flw_grp_exp_ipfix; /* IPFIX configuration of flow group exporting process */
80 
81 /* Flow Tracker feature configuration params */
83 {
84  OPEN_FT_CONFIG_FEAT_PARAM_MASK_t param_mask;
85  OPEN_FT_CONFIG_t feature;
87 
90 {
91  OPEN_FT_CL_TRANS_TYPE_IPv4_UDP = (1<<0), /* IPv4, UDP */
92  OPEN_FT_CL_TRANS_TYPE_IPv6_UDP = (1<<1), /* IPv6, UDP */
93  OPEN_FT_CL_TRANS_TYPE_RAW = (1<<2) /* RAW */
95 
96 typedef enum _open_ft_cl_config_param_mask_
97 {
98  OPEN_FT_CL_CONFIG_PORT_MASK = (1 << 0), /* Mask of port param */
99 } OPEN_FT_CL_CONFIG_PARAM_MASK_t;
100 
102 typedef enum _open_ft_cl_proto_
103 {
104  OPEN_FT_CL_PROTO_IPFIXv10 = 10
106 
107 #define OPEN_FT_MAX_NAME_LENGTH 128
108 
110 typedef struct _open_ft_cl_config
111 {
112  char name[OPEN_FT_MAX_NAME_LENGTH];
113  OPEN_FT_CL_PROTO_t proto;
114  open_inet_addr_t addr;
115  unsigned short port;
116  OPEN_FT_CL_CONFIG_PARAM_MASK_t param_mask;
118 
120 typedef struct _open_ft_cl_info_
121 {
122  bool configured;
123  OPEN_FT_CL_TRANS_TYPE_t trans_type;
124  OPEN_FT_CL_CONFIG_t config;
125  unsigned int max_pkt_len;
126  uint32_t seq_num;
128 
130 typedef struct _open_ft_5_tuple_key_
131 {
132  OPEN_INSTRU_IP_PREFIX_t src_ip;
133  OPEN_INSTRU_IP_PREFIX_t dst_ip;
134  unsigned int protocol;
135  unsigned short src_port;
136  unsigned short dst_port;
137  unsigned int tuple_mask; /* Valid params mask */
139 
140 #define OPEN_FT_MASK_BASE_UNIT unsigned int
141 #define OPEN_FT_MASKWID (8*sizeof(unsigned int))
142 
143 /* (internal) Number of OPEN_FT_MASK_BASE_UNITs needed to contain _max bits */
144 #define OPEN_FT_MASK_SIZE(_max) (((_max) + OPEN_FT_MASKWID - 1) / OPEN_FT_MASKWID)
145 
146 #define OPEN_FT_PORT_MAX_RANGE_STR_LEN 256
147 
149 #define OPEN_ASIC_ICOS_FT_MAX_PORTS 300
150 #define OPEN_ASIC_FT_MAX_PORTS OPEN_ASIC_ICOS_FT_MAX_PORTS
151 
152 /* Interface storage */
153 typedef struct
154 {
155  OPEN_FT_MASK_BASE_UNIT value[OPEN_FT_MASK_SIZE(OPEN_ASIC_FT_MAX_PORTS)];
156  uint8_t port_list_str[OPEN_FT_PORT_MAX_RANGE_STR_LEN];
158 
161 {
162  OPEN_FT_5_TUPLE_KEY_t five_tuple;
163  /* List of egress ports*/
164  OPEN_FT_PORT_MASK_t egress_port_mask;
166 
167 /* Flow group actions mask */
168 typedef enum _open_ft_flw_grp_action_mask_
169 {
170  OPEN_FT_FLW_GRP_REP_FLWS = (1 << 0), /* Report flows */
171  OPEN_FT_FLW_GRP_REP_FLW_GRPS = (1 << 1), /* Report flow groups */
172 } OPEN_FT_FLW_GRP_ACTION_MASK_t;
173 
175 #define OPEN_FT_MAX_COLLECTOR_LIST_PER_FG 1
176 
179 {
180  OPEN_FT_FLW_GRP_MON_TYPE_FIVE_TUPLE = (1 << 0), /* Monitoring based on five tuple */
181  OPEN_FT_FLW_GRP_MON_TYPE_EGR_PORTS = (1 << 1), /* Monitoring based on egress ports */
182  OPEN_FT_FLW_GRP_MON_TYPE_ING_PORTS = (1 << 2), /* Monitoring based on ingress ports*/
183  OPEN_FT_FLW_GRP_MON_TYPE_CONGESTION = (1 << 3), /* Monitoring based on congestion */
185 
188 {
189  char name[OPEN_FT_MAX_NAME_LENGTH]; /* Name of flow group */
190  unsigned int cl_num; /* Number of Collectors */
191  char cl_name_list[OPEN_FT_MAX_COLLECTOR_LIST_PER_FG][OPEN_FT_MAX_NAME_LENGTH]; /* Name of Collectors */
192  unsigned int id; /* Group id */
193  OPEN_FT_FLW_GRP_MON_TYPE_t type; /* Monitoring type of a Flow group */
194  OPEN_FT_FLW_GRP_MON_PARAMS_t mon_params; /* Monitoring params */
195  bool rep_flws; /* Report flows */
196  bool rep_flw_grps; /* Report flow groups */
197  OPEN_FT_FLW_GRP_ACTION_MASK_t action_mask;
199 
201 #define OPEN_FT_TEMPLATE_MAX_SETS 1
202 
204 #define OPEN_IP_FIX_INF_MAX_ELEMENTS 16
205 
207 #define OPEN_FT_MAX_TEMPLATES_IN_FLW OPEN_FT_TEMPLATE_MAX_SETS
208 
210 #define OPEN_FT_MIN_PAYLOAD_LEN 64
211 
213 #define OPEN_FT_MAX_PAYLOAD_LEN 1500
214 
216 #define OPEN_FT_ASIC_MAX_COUNT 1
217 
218 /* Broadview uses byte aligned structure(packed) for the same. */
219 #pragma pack(push, 1)
221 {
222  unsigned short ent_ele_id;
223  unsigned short len;
224  bool ent_num_present;
225  unsigned long ent_num;
227 #pragma pack(pop)
228 
230 {
231  char name[OPEN_FT_MAX_NAME_LENGTH];
232  unsigned short template_hdr_id;
233  unsigned int num_ele; /* Number of elements in the template */
234  OPEN_IP_FIX_FLD_SPEC_WITH_EN_t ele_info[OPEN_IP_FIX_INF_MAX_ELEMENTS]; /* Elements information */
236 
238 {
239  unsigned int num_templates;
242 
245 {
246  uint64_t flow_cnt;
247  uint64_t octet_cnt;
248  uint64_t pkt_cnt;
249  uint64_t tcp_syn_cnt;
250  uint64_t tcp_fin_cnt;
251  uint64_t tcp_rst_cnt;
253 
256 {
257  bool multiple_collector_support;
258  unsigned int max_collectors;
259  unsigned int export_protocols;
260  unsigned int flw_grp_types;
261  unsigned int max_flw_grps;
262  unsigned int max_flws;
263  bool flw_sampling_support;
264  bool flw_template_support_in_fw;
266 
267 /* Structure to clear flow group stats params */
269 {
270  char name[OPEN_FT_MAX_NAME_LENGTH]; /* Flow group name */
271  bool grp_rec_clear; /* Clear group records flag */
272  bool flw_rec_clear; /* Clear flow records flag */
274 
276 {
277  char collectorName[OPEN_FT_MAX_NAME_LENGTH];
278  char templateName[OPEN_FT_MAX_NAME_LENGTH];
279  int periodicity;
280  int initialBurst;
282 
283 /*****************************************************************/
298  int asic,
299  OPEN_FT_CONFIG_t *ftCfg);
300 
301 /*****************************************************************/
316  int asic,
317  OPEN_FT_CL_INFO_t *clInfo);
318 
319 /*****************************************************************/
334  int asic, open_buffdesc *name);
335 
336 /*****************************************************************/
351  int asic,
352  OPEN_FT_FLW_GRP_CONFIG_t *ftFlwGrpCfg);
353 
354 /*****************************************************************/
369  int asic, open_buffdesc *name);
370 
371 /*****************************************************************/
386  int asic,
387  OPEN_FT_FLW_REC_TEMPLATE_t *ftFlwTemplateCfg);
388 
389 /*****************************************************************/
404  int asic, open_buffdesc *name);
405 
406 /*****************************************************************/
424  int asic, open_buffdesc *name,
425  OPEN_FT_PKT_TYPE_t pkt_type,
426  int payloadSize, open_buffdesc *payload);
427 
428 /*****************************************************************/
443  int asic, open_buffdesc *name);
444 
445 /*****************************************************************/
460  int asic, open_buffdesc *name,
461  OPEN_FT_FLW_GRP_STATS_t *pStat);
462 
463 /*****************************************************************/
478  int asic,
479  OPEN_FT_CAPABILITIES_t *pCapabilities);
480 
481 /*****************************************************************/
496  int asic,
497  OPEN_FT_CLEAR_FLW_GRP_STATS_t *clearStatParams);
498 
499 /*****************************************************************/
514  int asic,
515  OPEN_FT_TEMPLATE_XMIT_CONFIG_t *ftTemplateXmitConfig);
516 
517 #endif /* OPENAPI_FT_H_INCLUDED*/
518 
enum _open_ft_pkt_type_ OPEN_FT_PKT_TYPE_t
Enum to identify packet type.
enum _open_ft_flw_grp_mon_type_ OPEN_FT_FLW_GRP_MON_TYPE_t
Flow Tracker flow group monitor type.
Flow Tracker feature configuration.
open_error_t openapiFtTemplateTransmitConfig(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_TEMPLATE_XMIT_CONFIG_t *ftTemplateXmitConfig)
Flow tracker template transmit configuration.
struct _open_ft_configure_feature_ OPEN_FT_CONFIG_t
Flow Tracker feature configuration.
Union of flow group monitoring params.
open_error_t openapiFtCollectorConfigCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_CL_INFO_t *clInfo)
Flow collector configuration create function.
open_error_t openapiFtPktSend(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name, OPEN_FT_PKT_TYPE_t pkt_type, int payloadSize, open_buffdesc *payload)
Flow group template format packet send function.
Structure to hold capbilities.
#define OPEN_IP_FIX_INF_MAX_ELEMENTS
Max elements in a template record.
open_error_t
OPEN uses these enumerators to indicate the error codes.
struct _open_ft_5_tuple_key_ OPEN_FT_5_TUPLE_KEY_t
5-tuple parameters
open_error_t openapiFtConfigSet(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_CONFIG_t *ftCfg)
Flow tracker feature configuration set function.
struct _open_ft_flw_grp_stats_t_ OPEN_FT_FLW_GRP_STATS_t
Structure to hold Group stats.
_open_ft_cl_trans_type_
Transport type used to communicate with collector.
_open_ft_flw_grp_mon_type_
Flow Tracker flow group monitor type.
_open_ft_cl_proto_
Flow Tracker Collector Protocol.
enum _open_ft_cl_trans_type_ OPEN_FT_CL_TRANS_TYPE_t
Transport type used to communicate with collector.
open_error_t openapiFtCollectorConfigRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Flow collector configuration remove function.
open_error_t openapiFtFlowGroupConfigRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Flow group configuration remove function.
struct _open_ft_flw_grp_config_ OPEN_FT_FLW_GRP_CONFIG_t
Flow group configuration.
#define OPEN_FT_MAX_COLLECTOR_LIST_PER_FG
Max collector for each flow group.
open_error_t openapiFtFlowTemplateConfigCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_FLW_REC_TEMPLATE_t *ftFlwTemplateCfg)
Flow template configuration create function.
struct _open_ft_ipfix_config_ OPEN_FT_IPFIX_CONFIG_t
IPFIX configuration of flow and flow group record exporting processes.
union _open_ft_flw_grp_mon_params_ OPEN_FT_FLW_GRP_MON_PARAMS_t
Union of flow group monitoring params.
Flow group configuration.
open_error_t openapiFtFlowGroupStatsGet(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name, OPEN_FT_FLW_GRP_STATS_t *pStat)
Flow group statistics get function.
Flow tracker collector config.
open_error_t openapiFtFlowGroupStatsClear(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Flow group statistics clear function.
open_error_t openapiFtFlowTemplateConfigRemove(openapiClientHandle_t *clientHandle, int asic, open_buffdesc *name)
Flow template configuration remove function.
#define OPEN_FT_MAX_TEMPLATES_IN_FLW
Max templates to used by flow exporting process.
struct _open_ft_cl_info_ OPEN_FT_CL_INFO_t
Flow tracker collector configuration.
open_error_t openapiFtFlowGroupConfigCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_FLW_GRP_CONFIG_t *ftFlwGrpCfg)
Flow group configuration create function.
open_error_t openapiFtCapabilitiesGet(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_CAPABILITIES_t *pCapabilities)
Flow tracker feature capabilities get function.
struct _open_ft_capabilities_t_ OPEN_FT_CAPABILITIES_t
Structure to hold capbilities.
struct _open_ft_cl_config OPEN_FT_CL_CONFIG_t
Flow tracker collector config.
open_error_t openapiFtStatsClear(openapiClientHandle_t *clientHandle, int asic, OPEN_FT_CLEAR_FLW_GRP_STATS_t *clearStatParams)
Flow group statistics clear function.
_open_ft_pkt_type_
Enum to identify packet type.
Structure to hold Group stats.
enum _open_ft_cl_proto_ OPEN_FT_CL_PROTO_t
Flow Tracker Collector Protocol.
IPFIX configuration of flow and flow group record exporting processes.
Flow tracker collector configuration.