OpenNSL API Guide and Reference Manual
types.h
Go to the documentation of this file.
1 
4 /*****************************************************************************
5  *
6  * (C) Copyright Broadcom Corporation 2013-2016
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  *
11  * You may obtain a copy of the License at
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  ***************************************************************************/
24 #ifndef __OPENNSL_TYPES_H__
25 #define __OPENNSL_TYPES_H__
26 
27 #include <sal/types.h>
28 #include <sal/commdefs.h>
29 #include <shared/bitop.h>
30 #include <shared/pbmp.h>
31 #include <shared/gport.h>
32 #include <shared/types.h>
33 #include <shared/util.h>
34 
36 typedef int opennsl_multicast_t;
37 
38 #if !defined(OPENNSL_LOCAL_UNITS_MAX)
39 #endif
40 #if !defined(OPENNSL_UNITS_MAX)
41 #endif
42 #define OPENNSL_PBMP_PORT_MAX _SHR_PBMP_PORT_MAX
43 #define OPENNSL_PBMP_CLEAR(pbm) _SHR_PBMP_CLEAR(pbm)
44 #define OPENNSL_PBMP_MEMBER(bmp, port) _SHR_PBMP_MEMBER((bmp), (port))
45 #define OPENNSL_PBMP_ITER(bmp, port) _SHR_PBMP_ITER((bmp), (port))
46 #define OPENNSL_PBMP_COUNT(pbm, count) _SHR_PBMP_COUNT(pbm, count)
47 #define OPENNSL_PBMP_IS_NULL(pbm) _SHR_PBMP_IS_NULL(pbm)
48 #define OPENNSL_PBMP_NOT_NULL(pbm) _SHR_PBMP_NOT_NULL(pbm)
49 #define OPENNSL_PBMP_EQ(pbm_a, pbm_b) _SHR_PBMP_EQ(pbm_a, pbm_b)
50 #define OPENNSL_PBMP_NEQ(pbm_a, pbm_b) _SHR_PBMP_NEQ(pbm_a, pbm_b)
51 #define OPENNSL_PBMP_ASSIGN(dst, src) _SHR_PBMP_ASSIGN(dst, src)
52 #define OPENNSL_PBMP_AND(pbm_a, pbm_b) _SHR_PBMP_AND(pbm_a, pbm_b)
53 #define OPENNSL_PBMP_OR(pbm_a, pbm_b) _SHR_PBMP_OR(pbm_a, pbm_b)
54 #define OPENNSL_PBMP_XOR(pbm_a, pbm_b) _SHR_PBMP_XOR(pbm_a, pbm_b)
55 #define OPENNSL_PBMP_REMOVE(pbm_a, pbm_b) _SHR_PBMP_REMOVE(pbm_a, pbm_b)
56 #define OPENNSL_PBMP_NEGATE(pbm_a, pbm_b) _SHR_PBMP_NEGATE(pbm_a, pbm_b)
57 #define OPENNSL_PBMP_PORT_SET(pbm, port) _SHR_PBMP_PORT_SET(pbm, port)
58 #define OPENNSL_PBMP_PORT_ADD(pbm, port) _SHR_PBMP_PORT_ADD(pbm, port)
59 #define OPENNSL_PBMP_PORT_REMOVE(pbm, port) _SHR_PBMP_PORT_REMOVE(pbm, port)
60 #define OPENNSL_PBMP_PORT_FLIP(pbm, port) _SHR_PBMP_PORT_FLIP(pbm, port)
61 
62 typedef int opennsl_port_t;
63 
66 
68 typedef uint8 opennsl_mac_t[6];
69 
72 
74 typedef uint8 opennsl_ip6_t[16];
75 
77 typedef int opennsl_if_t;
78 
81 
83 typedef int opennsl_l4_port_t;
84 
86 typedef int opennsl_if_group_t;
87 
89 typedef int opennsl_vrf_t;
90 
93 
94 #define OPENNSL_VLAN_NONE ((opennsl_vlan_t)0x0000)
95 #define OPENNSL_VLAN_DEFAULT ((opennsl_vlan_t)0x0001)
96 
98 
101 
104 
106 typedef int opennsl_policer_t;
107 
110 
111 #define OPENNSL_VLAN_MIN 0
112 #define OPENNSL_VLAN_MAX 4095
113 #define OPENNSL_VLAN_COUNT (OPENNSL_VLAN_MAX - OPENNSL_VLAN_MIN + 1)
114 
116 
117 #define OPENNSL_VLAN_VEC_GET(vec, n) SHR_BITGET(vec, n)
118 #define OPENNSL_VLAN_VEC_SET(vec, n) SHR_BITSET(vec, n)
119 #define OPENNSL_VLAN_VEC_CLR(vec, n) SHR_BITCLR(vec, n)
120 #define OPENNSL_VLAN_VEC_ZERO(vec) \
121  memset(vec, 0, \
122  SHR_BITALLOCSIZE(OPENNSL_VLAN_COUNT))
123 
124 typedef int opennsl_cos_t;
125 
128 
129 #define OPENNSL_COS_MIN 0
130 #define OPENNSL_COS_MAX 7
131 #define OPENNSL_COS_COUNT 8
132 #define OPENNSL_COS_DEFAULT 4
133 #define OPENNSL_COS_INVALID -1
134 #define OPENNSL_PRIO_MIN 0
135 #define OPENNSL_PRIO_MAX 7
136 #define OPENNSL_PRIO_RED 0x100
137 #define OPENNSL_PRIO_YELLOW 0x200
138 #define OPENNSL_PRIO_DROP_FIRST OPENNSL_PRIO_RED
139 #define OPENNSL_PRIO_MASK 0xff
140 #define OPENNSL_PRIO_GREEN 0x400
141 #define OPENNSL_PRIO_DROP_LAST 0x800
142 #define OPENNSL_PRIO_PRESERVE OPENNSL_PRIO_DROP_LAST
143 #define OPENNSL_PRIO_STAG 0x100
144 #define OPENNSL_PRIO_CTAG 0x200
145 #define OPENNSL_DSCP_ECN 0x100
146 #define OPENNSL_PRIO_BLACK 0x1000
147 #define OPENNSL_PRIO_SECONDARY 0x2000
148 
149 typedef int opennsl_module_t;
150 
151 #define OPENNSL_TRUNK_INVALID ((opennsl_trunk_t) -1)
152 
153 typedef int opennsl_trunk_t;
154 
157 
162 typedef int opennsl_gport_t;
163 
164 #define OPENNSL_GPORT_TYPE_NONE _SHR_GPORT_NONE
165 #define OPENNSL_GPORT_INVALID _SHR_GPORT_INVALID
166 #define OPENNSL_GPORT_TYPE_LOCAL _SHR_GPORT_TYPE_LOCAL
167 #define OPENNSL_GPORT_TYPE_MODPORT _SHR_GPORT_TYPE_MODPORT
168 #define OPENNSL_GPORT_TYPE_UCAST_QUEUE_GROUP _SHR_GPORT_TYPE_UCAST_QUEUE_GROUP
169 #define OPENNSL_GPORT_TYPE_DESTMOD_QUEUE_GROUP _SHR_GPORT_TYPE_DESTMOD_QUEUE_GROUP
170 #define OPENNSL_GPORT_TYPE_MCAST _SHR_GPORT_TYPE_MCAST
171 #define OPENNSL_GPORT_TYPE_MCAST_QUEUE_GROUP _SHR_GPORT_TYPE_MCAST_QUEUE_GROUP
172 #define OPENNSL_GPORT_TYPE_SCHEDULER _SHR_GPORT_TYPE_SCHEDULER
173 #define OPENNSL_GPORT_TYPE_CHILD _SHR_GPORT_TYPE_CHILD
174 #define OPENNSL_GPORT_TYPE_EGRESS_GROUP _SHR_GPORT_TYPE_EGRESS_GROUP
175 #define OPENNSL_GPORT_TYPE_EGRESS_CHILD _SHR_GPORT_TYPE_EGRESS_CHILD
176 #define OPENNSL_GPORT_TYPE_EGRESS_MODPORT _SHR_GPORT_TYPE_EGRESS_MODPORT
177 #define OPENNSL_GPORT_TYPE_UCAST_SUBSCRIBER_QUEUE_GROUP _SHR_GPORT_TYPE_UCAST_SUBSCRIBER_QUEUE_GROUP
178 #define OPENNSL_GPORT_TYPE_MCAST_SUBSCRIBER_QUEUE_GROUP _SHR_GPORT_TYPE_MCAST_SUBSCRIBER_QUEUE_GROUP
179 #define OPENNSL_GPORT_TYPE_COSQ _SHR_GPORT_TYPE_COSQ
180 #define OPENNSL_GPORT_TYPE_PROFILE _SHR_GPORT_TYPE_PROFILE
181 #define OPENNSL_GPORT_IS_TRUNK(_gport) _SHR_GPORT_IS_TRUNK(_gport)
182 #define OPENNSL_GPORT_IS_UCAST_QUEUE_GROUP(_gport) _SHR_GPORT_IS_UCAST_QUEUE_GROUP(_gport)
183 #define OPENNSL_GPORT_IS_MCAST_QUEUE_GROUP(_gport) _SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport)
184 #define OPENNSL_GPORT_IS_SCHEDULER(_gport) _SHR_GPORT_IS_SCHEDULER(_gport)
185 #define OPENNSL_GPORT_IS_COSQ(_gport) _SHR_GPORT_IS_COSQ(_gport)
186 #define OPENNSL_GPORT_LOCAL_SET(_gport, _port) \
187  _SHR_GPORT_LOCAL_SET(_gport, _port)
188 #define OPENNSL_GPORT_LOCAL_GET(_gport) \
189  (!_SHR_GPORT_IS_LOCAL(_gport) ? -1 : \
190  _SHR_GPORT_LOCAL_GET(_gport))
191 #define OPENNSL_GPORT_MODPORT_SET(_gport, _module, _port) \
192  _SHR_GPORT_MODPORT_SET(_gport, _module, _port)
193 #define OPENNSL_GPORT_MODPORT_MODID_GET(_gport) \
194  (!_SHR_GPORT_IS_MODPORT(_gport) ? -1 : \
195  _SHR_GPORT_MODPORT_MODID_GET(_gport))
196 #define OPENNSL_GPORT_MODPORT_PORT_GET(_gport) \
197  (!_SHR_GPORT_IS_MODPORT(_gport) ? -1 : \
198  _SHR_GPORT_MODPORT_PORT_GET(_gport))
199 #define OPENNSL_GPORT_TRUNK_SET(_gport, _trunk_id) \
200  _SHR_GPORT_TRUNK_SET(_gport, _trunk_id)
201 #define OPENNSL_GPORT_TRAP_SET(_gport, _trap_id, _trap_strength, _snoop_strength) \
202  _SHR_GPORT_TRAP_SET(_gport, _trap_id, _trap_strength, _snoop_strength)
203 #define OPENNSL_GPORT_TRAP_GET_ID(_gport) \
204  (!_SHR_GPORT_IS_TRAP(_gport) ? -1 : \
205  _SHR_GPORT_TRAP_GET_ID(_gport))
206 #define OPENNSL_GPORT_TRAP_GET_STRENGTH(_gport) \
207  _SHR_GPORT_TRAP_GET_STRENGTH(_gport)
208 #define OPENNSL_GPORT_TRAP_GET_SNOOP_STRENGTH(_gport) \
209  _SHR_GPORT_TRAP_GET_SNOOP_STRENGTH(_gport)
210 #define OPENNSL_GPORT_IS_TRAP(_gport) \
211  _SHR_GPORT_IS_TRAP(_gport)
212 #define OPENNSL_GPORT_TRUNK_GET(_gport) \
213  (!_SHR_GPORT_IS_TRUNK(_gport) ? OPENNSL_TRUNK_INVALID : \
214  _SHR_GPORT_TRUNK_GET(_gport))
215 #define OPENNSL_GPORT_UCAST_QUEUE_GROUP_SET(_gport, _qid) \
216  _SHR_GPORT_UCAST_QUEUE_GROUP_SET(_gport, _qid)
217 #define OPENNSL_GPORT_UCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid) \
218  _SHR_GPORT_UCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid)
219 #define OPENNSL_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_GET(_gport) \
220  (!_SHR_GPORT_IS_UCAST_QUEUE_GROUP(_gport) ? -1 : \
221  _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_GET(_gport))
222 
223 #define OPENNSL_GPORT_UCAST_QUEUE_GROUP_QID_GET(_gport) \
224  (!_SHR_GPORT_IS_UCAST_QUEUE_GROUP(_gport) ? -1 : \
225  _SHR_GPORT_UCAST_QUEUE_GROUP_QID_GET(_gport))
226 
227 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_SET(_gport, _qid) \
228  _SHR_GPORT_MCAST_QUEUE_GROUP_SET(_gport, _qid)
229 
230 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_GET(_gport) \
231  (!_SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) ? -1 : \
232  _SHR_GPORT_MCAST_QUEUE_GROUP_GET(_gport))
233 
234 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid) \
235  _SHR_GPORT_MCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid)
236 
237 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_GET(_gport) \
238  (!_SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) ? -1 : \
239  _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_GET(_gport))
240 
241 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_QID_GET(_gport) \
242  (!_SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) ? -1 : \
243  _SHR_GPORT_MCAST_QUEUE_GROUP_QID_GET(_gport))
244 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_QUEUE_SET(_gport, _qid) \
245  _SHR_GPORT_MCAST_QUEUE_GROUP_QUEUE_SET(_gport, _qid)
246 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_CORE_QUEUE_SET(_gport, _core, _qid) \
247  _SHR_GPORT_MCAST_QUEUE_GROUP_CORE_QUEUE_SET(_gport, _core, _qid)
248 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_QUEUE_GET(_gport) \
249  (!_SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) ? -1 : \
250  _SHR_GPORT_MCAST_QUEUE_GROUP_QUEUE_GET(_gport))
251 #define OPENNSL_GPORT_MCAST_QUEUE_GROUP_CORE_GET(_gport) \
252  (!_SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) ? -1 : \
253  _SHR_GPORT_MCAST_QUEUE_GROUP_CORE_GET(_gport))
254 
255 #define OPENNSL_GPORT_SCHEDULER_SET(_gport, _scheduler_id) \
256  _SHR_GPORT_SCHEDULER_SET(_gport, _scheduler_id)
257 #define OPENNSL_GPORT_SCHEDULER_NODE_SET(_gport, _scheduler_level, _scheduler_id) \
258  _SHR_GPORT_SCHEDULER_NODE_SET(_gport, _scheduler_level,_scheduler_id)
259 #define OPENNSL_GPORT_SCHEDULER_GET(_gport) \
260  _SHR_GPORT_SCHEDULER_GET(_gport)
261 #define OPENNSL_GPORT_SCHEDULER_CORE_GET(_gport) \
262  _SHR_GPORT_SCHEDULER_CORE_GET(_gport)
263 #define OPENNSL_GPORT_SCHEDULER_CORE_SET(_gport, _scheduler_id, _core_id) \
264  _SHR_GPORT_SCHEDULER_CORE_SET(_gport, _scheduler_id, _core_id)
265 
267 
269 typedef int opennsl_failover_t;
270 
271 #define OPENNSL_GPORT_LOCAL_CPU _SHR_GPORT_LOCAL_CPU
272 #define OPENNSL_GPORT_MIRROR_SET(_gport, _value) \
273  _SHR_GPORT_MIRROR_SET(_gport, _value)
274 #define OPENNSL_GPORT_MIRROR_GET(_gport) \
275  (!_SHR_GPORT_IS_MIRROR(_gport) ? -1 : \
276  _SHR_GPORT_MIRROR_GET(_gport))
277 #define OPENNSL_GPORT_TUNNEL_ID_SET(_gport, _tunnel_id) \
278  (_SHR_GPORT_TUNNEL_ID_SET(_gport, _tunnel_id))
279 
280 #define OPENNSL_GPORT_TUNNEL_ID_GET(_gport) \
281  (!_SHR_GPORT_IS_TUNNEL(_gport) ? -1 : \
282  _SHR_GPORT_TUNNEL_ID_GET(_gport))
283 
285 typedef int opennsl_stg_t;
286 
288 typedef enum opennsl_color_e {
297 /* __doxy_func_body_end__ */
298 
308 /* __doxy_func_body_end__ */
309 
315 /* __doxy_func_body_end__ */
316 
317 #define OPENNSL_FLOW_MAX_NOF_LOGICAL_FIELDS 20
318 #if defined(LE_HOST)
319 #else
320 #define opennsl_htonl(_l) (_l)
321 #define opennsl_htons(_s) (_s)
322 #define opennsl_ntohl(_l) (_l)
323 #define opennsl_ntohs(_s) (_s)
324 #endif
325 /***************************************************************************/
333 extern int opennsl_ip6_mask_create(
334  opennsl_ip6_t ip6,
335  int len) LIB_DLL_EXPORTED ;
336 
337 /***************************************************************************/
345  int len) LIB_DLL_EXPORTED ;
346 
354 /* __doxy_func_body_end__ */
355 
364 /* __doxy_func_body_end__ */
365 
367 typedef enum opennsl_vlan_action_e {
383 /* __doxy_func_body_end__ */
384 
387 
391 /* __doxy_func_body_end__ */
392 
406  int priority;
474  int action_id;
480 /* __doxy_func_body_end__ */
481 
484 
487 
488 #define OPENNSL_FIELD_STAT_ID_SET(_stat_id, _proc, _ctr) _SHR_FIELD_STAT_ID_SET(_stat_id, _proc, _ctr)
489 #define OPENNSL_FIELD_STAT_ID_COUNTER_GET(_stat_id) _SHR_FIELD_STAT_ID_COUNTER_GET(_stat_id)
490 #define OPENNSL_FIELD_STAT_ID_PROCESSOR_GET(_stat_id) _SHR_FIELD_STAT_ID_PROCESSOR_GET(_stat_id)
491 
492 typedef struct opennsl_vntag_s {
499 /* __doxy_func_body_end__ */
500 
502 typedef struct opennsl_etag_s {
508 /* __doxy_func_body_end__ */
509 
510 #include <opennsl/typesX.h>
511 #endif /* __OPENNSL_TYPES_H__ */
512