OpenNSL API Guide and Reference Manual
l3.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_L3_H__
25 #define __OPENNSL_L3_H__
26 
27 #if defined(INCLUDE_L3)
28 
29 #include <opennsl/types.h>
30 #include <opennsl/stat.h>
31 #include <opennsl/mpls.h>
32 
33 #define OPENNSL_L3_L2ONLY (1 << 0)
35 #define OPENNSL_L3_UNTAG (1 << 1)
36 #define OPENNSL_L3_S_HIT (1 << 2)
37 #define OPENNSL_L3_D_HIT (1 << 3)
39 #define OPENNSL_L3_HIT (OPENNSL_L3_S_HIT | OPENNSL_L3_D_HIT)
40 #define OPENNSL_L3_HIT_CLEAR (1 << 4)
41 #define OPENNSL_L3_ADD_TO_ARL (1 << 5)
43 #define OPENNSL_L3_WITH_ID (1 << 6)
44 #define OPENNSL_L3_REPLACE (1 << 8)
45 #define OPENNSL_L3_TGID (1 << 9)
46 #define OPENNSL_L3_RPE (1 << 10)
48 #define OPENNSL_L3_IPMC (1 << 11)
50 #define OPENNSL_L3_L2TOCPU (1 << 12)
53 #define OPENNSL_L3_DEFIP_CPU (1 << 13)
55 #define OPENNSL_L3_DEFIP_LOCAL OPENNSL_L3_DEFIP_CPU
56 #define OPENNSL_L3_MULTIPATH (1 << 14)
57 #define OPENNSL_L3_HOST_LOCAL (1 << 15)
58 #define OPENNSL_L3_HOST_AS_ROUTE (1 << 16)
60 #define OPENNSL_L3_IP6 (1 << 17)
61 #define OPENNSL_L3_RPF (1 << 18)
62 #define OPENNSL_L3_DST_DISCARD (1 << 20)
63 #define OPENNSL_L3_ROUTE_LABEL (1 << 22)
65 #define OPENNSL_L3_COPY_TO_CPU (1 << 23)
66 #define OPENNSL_L3_DEREFERENCED_NEXTHOP (1 << 30)
68 #define OPENNSL_L3_ECMP_RH_REPLACE OPENNSL_L3_DEREFERENCED_NEXTHOP
71 #define OPENNSL_L3_VXLAN_ONLY (1 << 31)
72 #define OPENNSL_L3_INGRESS_WITH_ID (1 << 0)
73 #define OPENNSL_L3_INGRESS_REPLACE (1 << 1)
75 #define OPENNSL_L3_INGRESS_GLOBAL_ROUTE (1 << 2)
77 #define OPENNSL_L3_INGRESS_DSCP_TRUST (1 << 3)
80 typedef struct opennsl_l3_intf_qos_s {
82  int qos_map_id;
85  int dscp;
87 /* __doxy_func_body_end__ */
88 
94 typedef struct opennsl_l3_intf_s {
100  int l3a_ttl;
101  int l3a_mtu;
108 /* __doxy_func_body_end__ */
109 
110 #define OPENNSL_L3_ECMP_DYNAMIC_SCALING_FACTOR_INVALID -1
112 #define OPENNSL_L3_ECMP_DYNAMIC_LOAD_WEIGHT_INVALID -1
115 typedef enum opennsl_l3_ingress_urpf_mode_e {
120 /* __doxy_func_body_end__ */
121 
127 typedef struct opennsl_l3_egress_s {
143  int reserved4;
144  int reserved5;
172 /* __doxy_func_body_end__ */
173 
179 typedef struct opennsl_l3_ingress_s {
193 /* __doxy_func_body_end__ */
194 
203 typedef struct opennsl_l3_host_s {
215  int reserved4;
216  int reserved5;
224 /* __doxy_func_body_end__ */
225 
234 typedef struct opennsl_l3_route_s {
263 /* __doxy_func_body_end__ */
264 
272 typedef struct opennsl_l3_info_s {
278 /* __doxy_func_body_end__ */
279 
281 typedef struct opennsl_l3_dgm_s {
286 /* __doxy_func_body_end__ */
287 
289 typedef struct opennsl_l3_egress_ecmp_s {
293  int max_paths;
307 /* __doxy_func_body_end__ */
308 
310 typedef struct opennsl_l3_ecmp_member_s {
316  int status;
318 /* __doxy_func_body_end__ */
319 
320 #define OPENNSL_L3_ECMP_DYNAMIC_MODE_RESILIENT 4
324 typedef int (*opennsl_l3_host_traverse_cb)(
325  int unit,
326  int index,
327  opennsl_l3_host_t *info,
328  void *user_data);
329 
331  int unit,
332  int index,
333  opennsl_l3_route_t *info,
334  void *user_data);
335 
337  int unit,
338  opennsl_if_t intf,
339  opennsl_l3_egress_t *info,
340  void *user_data);
341 
343  int unit,
344  opennsl_if_t mpintf,
345  int intf_count,
346  opennsl_if_t *intf_array,
347  void *user_data);
348 
350  int unit,
352  int intf_count,
353  opennsl_if_t *intf_array,
354  void *user_data);
355 
356 #ifndef OPENNSL_HIDE_DISPATCHABLE
357 
358 /***************************************************************************/
367 extern int opennsl_l3_init(
368  int unit) LIB_DLL_EXPORTED ;
369 
370 #endif /* OPENNSL_HIDE_DISPATCHABLE */
371 
372 #ifndef OPENNSL_HIDE_DISPATCHABLE
373 
374 /***************************************************************************/
385 extern int opennsl_l3_info(
386  int unit,
388 
389 #endif /* OPENNSL_HIDE_DISPATCHABLE */
390 
391 /***************************************************************************/
405 extern void opennsl_l3_intf_t_init(
407 
408 #ifndef OPENNSL_HIDE_DISPATCHABLE
409 
410 /***************************************************************************/
423 extern int opennsl_l3_intf_create(
424  int unit,
426 
427 /***************************************************************************/
439 extern int opennsl_l3_intf_delete(
440  int unit,
442 
443 /***************************************************************************/
455 extern int opennsl_l3_intf_find(
456  int unit,
458 
459 /***************************************************************************/
473 extern int opennsl_l3_intf_find_vlan(
474  int unit,
476 
477 /***************************************************************************/
488 extern int opennsl_l3_intf_get(
489  int unit,
491 
492 #endif /* OPENNSL_HIDE_DISPATCHABLE */
493 
494 /***************************************************************************/
508 extern void opennsl_l3_egress_t_init(
510 
511 #ifndef OPENNSL_HIDE_DISPATCHABLE
512 
513 /***************************************************************************/
528 extern int opennsl_l3_egress_create(
529  int unit,
530  uint32 flags,
531  opennsl_l3_egress_t *egr,
533 
534 /***************************************************************************/
547 extern int opennsl_l3_egress_destroy(
548  int unit,
550 
551 /***************************************************************************/
562 extern int opennsl_l3_egress_get(
563  int unit,
564  opennsl_if_t intf,
566 
567 /***************************************************************************/
579 extern int opennsl_l3_egress_find(
580  int unit,
581  opennsl_l3_egress_t *egr,
583 
584 /***************************************************************************/
598 extern int opennsl_l3_egress_traverse(
599  int unit,
601  void *user_data) LIB_DLL_EXPORTED ;
602 
603 /***************************************************************************/
623  int unit,
624  uint32 flags,
625  int intf_count,
626  opennsl_if_t *intf_array,
627  opennsl_if_t *mpintf) LIB_DLL_EXPORTED ;
628 
629 /***************************************************************************/
643  int unit,
645 
646 /***************************************************************************/
668  int unit,
669  opennsl_if_t mpintf,
670  int intf_size,
671  opennsl_if_t *intf_array,
672  int *intf_count) LIB_DLL_EXPORTED ;
673 
674 /***************************************************************************/
690  int unit,
691  opennsl_if_t mpintf,
693 
694 /***************************************************************************/
710  int unit,
711  opennsl_if_t mpintf,
713 
714 /***************************************************************************/
730  int unit,
731  int intf_count,
732  opennsl_if_t *intf_array,
733  opennsl_if_t *mpintf) LIB_DLL_EXPORTED ;
734 
735 /***************************************************************************/
751  int unit,
753  void *user_data) LIB_DLL_EXPORTED ;
754 
755 #endif /* OPENNSL_HIDE_DISPATCHABLE */
756 
757 /***************************************************************************/
772 
773 #ifndef OPENNSL_HIDE_DISPATCHABLE
774 
775 /***************************************************************************/
796 extern int opennsl_l3_ecmp_get(
797  int unit,
798  opennsl_l3_egress_ecmp_t *ecmp_info,
799  int ecmp_member_size,
800  opennsl_l3_ecmp_member_t *ecmp_member_array,
801  int *ecmp_member_count) LIB_DLL_EXPORTED ;
802 
803 /***************************************************************************/
818  int unit,
820  int intf_count,
821  opennsl_if_t *intf_array) LIB_DLL_EXPORTED ;
822 
823 /***************************************************************************/
837  int unit,
839 
840 /***************************************************************************/
859 extern int opennsl_l3_egress_ecmp_get(
860  int unit,
862  int intf_size,
863  opennsl_if_t *intf_array,
864  int *intf_count) LIB_DLL_EXPORTED ;
865 
866 /***************************************************************************/
878 extern int opennsl_l3_egress_ecmp_add(
879  int unit,
882 
883 /***************************************************************************/
897  int unit,
900 
901 /***************************************************************************/
914 extern int opennsl_l3_egress_ecmp_find(
915  int unit,
916  int intf_count,
917  opennsl_if_t *intf_array,
919 
920 /***************************************************************************/
936  int unit,
938  void *user_data) LIB_DLL_EXPORTED ;
939 
940 #endif /* OPENNSL_HIDE_DISPATCHABLE */
941 
942 /***************************************************************************/
955 extern void opennsl_l3_ingress_t_init(
957 
958 #ifndef OPENNSL_HIDE_DISPATCHABLE
959 
960 /***************************************************************************/
972 extern int opennsl_l3_ingress_create(
973  int unit,
974  opennsl_l3_ingress_t *ing_intf,
975  opennsl_if_t *intf_id) LIB_DLL_EXPORTED ;
976 
977 #endif /* OPENNSL_HIDE_DISPATCHABLE */
978 
979 /***************************************************************************/
993 extern void opennsl_l3_host_t_init(
995 
996 #ifndef OPENNSL_HIDE_DISPATCHABLE
997 
998 /***************************************************************************/
1013 extern int opennsl_l3_host_find(
1014  int unit,
1016 
1017 /***************************************************************************/
1030 extern int opennsl_l3_host_add(
1031  int unit,
1033 
1034 /***************************************************************************/
1048 extern int opennsl_l3_host_delete(
1049  int unit,
1051 
1052 /***************************************************************************/
1070  int unit,
1072 
1073 /***************************************************************************/
1084 extern int opennsl_l3_host_delete_all(
1085  int unit,
1087 
1088 /***************************************************************************/
1105 extern int opennsl_l3_host_traverse(
1106  int unit,
1107  uint32 flags,
1108  uint32 start,
1109  uint32 end,
1111  void *user_data) LIB_DLL_EXPORTED ;
1112 
1113 #endif /* OPENNSL_HIDE_DISPATCHABLE */
1114 
1115 /***************************************************************************/
1129 extern void opennsl_l3_route_t_init(
1131 
1132 #ifndef OPENNSL_HIDE_DISPATCHABLE
1133 
1134 /***************************************************************************/
1146 extern int opennsl_l3_route_add(
1147  int unit,
1149 
1150 /***************************************************************************/
1164 extern int opennsl_l3_route_delete(
1165  int unit,
1167 
1168 /***************************************************************************/
1181  int unit,
1183 
1184 /***************************************************************************/
1195 extern int opennsl_l3_route_delete_all(
1196  int unit,
1198 
1199 /***************************************************************************/
1211 extern int opennsl_l3_route_get(
1212  int unit,
1214 
1215 /***************************************************************************/
1234  int unit,
1235  opennsl_l3_route_t *the_route,
1236  opennsl_l3_route_t *path_array,
1237  int max_path,
1238  int *path_count) LIB_DLL_EXPORTED ;
1239 
1240 /***************************************************************************/
1256 extern int opennsl_l3_route_traverse(
1257  int unit,
1258  uint32 flags,
1259  uint32 start,
1260  uint32 end,
1262  void *user_data) LIB_DLL_EXPORTED ;
1263 
1264 /***************************************************************************/
1277  int unit,
1278  int max) LIB_DLL_EXPORTED ;
1279 
1280 /***************************************************************************/
1293  int unit,
1294  int *max) LIB_DLL_EXPORTED ;
1295 
1296 #endif /* OPENNSL_HIDE_DISPATCHABLE */
1297 
1298 /***************************************************************************/
1313 extern void opennsl_l3_info_t_init(
1315 
1317 typedef enum opennsl_l3_stat_e {
1325 /* __doxy_func_body_end__ */
1326 
1327 #ifndef OPENNSL_HIDE_DISPATCHABLE
1328 
1329 /***************************************************************************/
1343 extern int opennsl_l3_vrrp_add(
1344  int unit,
1345  opennsl_vlan_t vlan,
1346  uint32 vrid) LIB_DLL_EXPORTED ;
1347 
1348 /***************************************************************************/
1360 extern int opennsl_l3_vrrp_delete(
1361  int unit,
1362  opennsl_vlan_t vlan,
1363  uint32 vrid) LIB_DLL_EXPORTED ;
1364 
1365 /***************************************************************************/
1375 extern int opennsl_l3_vrrp_delete_all(
1376  int unit,
1378 
1379 /***************************************************************************/
1395 extern int opennsl_l3_vrrp_get(
1396  int unit,
1397  opennsl_vlan_t vlan,
1398  int alloc_size,
1399  int *vrid_array,
1400  int *count) LIB_DLL_EXPORTED ;
1401 
1402 /***************************************************************************/
1420  int unit,
1421  opennsl_if_t intf_id,
1422  opennsl_l3_stat_t stat,
1423  uint32 num_entries,
1424  uint32 *counter_indexes,
1425  opennsl_stat_value_t *counter_values) LIB_DLL_EXPORTED ;
1426 
1427 /***************************************************************************/
1445  int unit,
1446  opennsl_if_t intf_id,
1447  opennsl_l3_stat_t stat,
1448  uint32 num_entries,
1449  uint32 *counter_indexes,
1450  opennsl_stat_value_t *counter_values) LIB_DLL_EXPORTED ;
1451 
1452 #endif /* OPENNSL_HIDE_DISPATCHABLE */
1453 
1454 #ifndef OPENNSL_HIDE_DISPATCHABLE
1455 
1456 #endif /* OPENNSL_HIDE_DISPATCHABLE */
1457 
1458 #endif /* defined(INCLUDE_L3) */
1459 
1460 #include <opennsl/l3X.h>
1461 #endif /* __OPENNSL_L3_H__ */
1462