OpenNSL API Guide and Reference Manual
Welcome
OpenNSL Documentation
API Reference
Files
File List
Globals
include
opennsl
l2.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_L2_H__
25
#define __OPENNSL_L2_H__
26
27
#include <
opennsl/types.h
>
28
29
#define OPENNSL_L2_DISCARD_SRC 0x00000002
30
#define OPENNSL_L2_DISCARD_DST 0x00000004
31
#define OPENNSL_L2_COPY_TO_CPU 0x00000008
32
#define OPENNSL_L2_L3LOOKUP 0x00000010
33
#define OPENNSL_L2_STATIC 0x00000020
34
#define OPENNSL_L2_HIT 0x00000040
35
#define OPENNSL_L2_TRUNK_MEMBER 0x00000080
36
#define OPENNSL_L2_MCAST 0x00000100
37
#define OPENNSL_L2_SRC_HIT 0x00000400
38
#define OPENNSL_L2_DES_HIT 0x00000800
39
#define OPENNSL_L2_MOVE_PORT 0x00100000
40
#define OPENNSL_L2_LOCAL_CPU 0x00200000
42
#define OPENNSL_L2_CALLBACK_DELETE 0
43
#define OPENNSL_L2_CALLBACK_ADD 1
44
#define OPENNSL_L2_CALLBACK_REPORT 2
45
#define OPENNSL_L2_CALLBACK_LEARN_EVENT 3
46
#define OPENNSL_L2_CALLBACK_AGE_EVENT 4
47
#define OPENNSL_L2_CALLBACK_MOVE_EVENT 5
48
49
typedef
struct
opennsl_l2_addr_s
{
50
uint32
flags
;
51
uint32
reserved1
;
52
uint32
reserved2
;
53
opennsl_mac_t
mac
;
54
opennsl_vlan_t
vid
;
55
int
port
;
56
int
modid
;
57
opennsl_trunk_t
tgid
;
58
opennsl_cos_t
reserved3
;
59
opennsl_cos_t
reserved4
;
60
opennsl_multicast_t
l2mc_group
;
62
opennsl_if_t
reserved5
;
63
opennsl_pbmp_t
reserved6
;
64
int
reserved7
;
65
int
reserved8
;
66
opennsl_fabric_distribution_t
reserved9
;
67
int
reserved10
;
68
int
reserved11
;
69
uint32
reserved12
;
70
uint32
reserved13
;
71
opennsl_flow_logical_field_t
reserved14
[
OPENNSL_FLOW_MAX_NOF_LOGICAL_FIELDS
];
72
uint32
reserved15
;
73
opennsl_pbmp_t
reserved16
;
74
opennsl_tsn_flowset_t
reserved17
;
75
opennsl_tsn_sr_flowset_t
reserved18
;
76
opennsl_policer_t
reserved19
;
77
opennsl_tsn_pri_map_t
reserved20
;
78
}
opennsl_l2_addr_t
;
79
/* __doxy_func_body_end__ */
80
81
#define OPENNSL_L2_CACHE_CPU 0x00000001
82
#define OPENNSL_L2_CACHE_DISCARD 0x00000002
83
#define OPENNSL_L2_CACHE_BPDU 0x00000010
85
typedef struct opennsl_l2_cache_addr_s {
86
uint32
flags
;
87
uint32
station_flags
;
88
opennsl_mac_t
mac
;
89
opennsl_mac_t
mac_mask
;
90
opennsl_vlan_t
vlan
;
91
opennsl_vlan_t
vlan_mask
;
92
opennsl_port_t
src_port;
94
opennsl_port_t
src_port_mask;
96
opennsl_module_t
dest_modid
;
97
opennsl_port_t
dest_port
;
98
opennsl_trunk_t
dest_trunk
;
99
int
prio
;
100
opennsl_pbmp_t
dest_ports;
102
int
lookup_class
;
103
uint8
subtype
;
104
opennsl_if_t
encap_id
;
105
opennsl_multicast_t
group
;
106
opennsl_ethertype_t
ethertype
;
107
opennsl_ethertype_t
ethertype_mask
;
108
}
opennsl_l2_cache_addr_t
;
109
/* __doxy_func_body_end__ */
110
111
/***************************************************************************/
126
extern
void
opennsl_l2_addr_t_init
(
127
opennsl_l2_addr_t
*l2addr,
128
const
opennsl_mac_t
mac_addr,
129
opennsl_vlan_t
vid)
LIB_DLL_EXPORTED
;
130
131
#ifndef OPENNSL_HIDE_DISPATCHABLE
132
133
/***************************************************************************/
148
extern
int
opennsl_l2_addr_add
(
149
int
unit,
150
opennsl_l2_addr_t
*l2addr)
LIB_DLL_EXPORTED
;
151
152
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
153
154
#define OPENNSL_L2_DELETE_STATIC 0x00000001
155
#define OPENNSL_L2_DELETE_PENDING 0x00000002
156
#define OPENNSL_L2_DELETE_NO_CALLBACKS 0x00000004
157
#ifndef OPENNSL_HIDE_DISPATCHABLE
158
159
/***************************************************************************/
176
extern
int
opennsl_l2_addr_delete
(
177
int
unit,
178
opennsl_mac_t
mac,
179
opennsl_vlan_t
vid)
LIB_DLL_EXPORTED
;
180
181
/***************************************************************************/
216
extern
int
opennsl_l2_addr_delete_by_port
(
217
int
unit,
218
opennsl_module_t
mod,
219
opennsl_port_t
port
,
220
uint32
flags)
LIB_DLL_EXPORTED
;
221
222
/***************************************************************************/
250
extern
int
opennsl_l2_addr_delete_by_mac
(
251
int
unit,
252
opennsl_mac_t
mac,
253
uint32
flags)
LIB_DLL_EXPORTED
;
254
255
/***************************************************************************/
288
extern
int
opennsl_l2_addr_delete_by_vlan
(
289
int
unit,
290
opennsl_vlan_t
vid,
291
uint32
flags)
LIB_DLL_EXPORTED
;
292
293
/***************************************************************************/
326
extern
int
opennsl_l2_addr_delete_by_trunk
(
327
int
unit,
328
opennsl_trunk_t
tid,
329
uint32
flags)
LIB_DLL_EXPORTED
;
330
331
/***************************************************************************/
363
extern
int
opennsl_l2_addr_delete_by_mac_port
(
364
int
unit,
365
opennsl_mac_t
mac,
366
opennsl_module_t
mod,
367
opennsl_port_t
port
,
368
uint32
flags)
LIB_DLL_EXPORTED
;
369
370
/***************************************************************************/
407
extern
int
opennsl_l2_addr_delete_by_vlan_port
(
408
int
unit,
409
opennsl_vlan_t
vid,
410
opennsl_module_t
mod,
411
opennsl_port_t
port
,
412
uint32
flags)
LIB_DLL_EXPORTED
;
413
414
/***************************************************************************/
449
extern
int
opennsl_l2_addr_delete_by_vlan_trunk
(
450
int
unit,
451
opennsl_vlan_t
vid,
452
opennsl_trunk_t
tid,
453
uint32
flags)
LIB_DLL_EXPORTED
;
454
455
/***************************************************************************/
468
extern
int
opennsl_l2_addr_get
(
469
int
unit,
470
opennsl_mac_t
mac_addr,
471
opennsl_vlan_t
vid,
472
opennsl_l2_addr_t
*l2addr)
LIB_DLL_EXPORTED
;
473
474
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
475
482
typedef
void (*
opennsl_l2_addr_callback_t
)(
483
int
unit,
484
opennsl_l2_addr_t
*l2addr,
485
int
operation,
486
void
*userdata);
487
488
#ifndef OPENNSL_HIDE_DISPATCHABLE
489
490
/***************************************************************************/
506
extern
int
opennsl_l2_addr_register
(
507
int
unit,
508
opennsl_l2_addr_callback_t
callback,
509
void
*userdata)
LIB_DLL_EXPORTED
;
510
511
/***************************************************************************/
527
extern
int
opennsl_l2_addr_unregister
(
528
int
unit,
529
opennsl_l2_addr_callback_t
callback,
530
void
*userdata)
LIB_DLL_EXPORTED
;
531
532
/***************************************************************************/
555
extern
int
opennsl_l2_age_timer_set
(
556
int
unit,
557
int
age_seconds)
LIB_DLL_EXPORTED
;
558
559
/***************************************************************************/
582
extern
int
opennsl_l2_age_timer_get
(
583
int
unit,
584
int
*age_seconds)
LIB_DLL_EXPORTED
;
585
586
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
587
588
#ifndef OPENNSL_HIDE_DISPATCHABLE
589
590
/***************************************************************************/
612
extern
int
opennsl_l2_addr_freeze
(
613
int
unit)
LIB_DLL_EXPORTED
;
614
615
/***************************************************************************/
637
extern
int
opennsl_l2_addr_thaw
(
638
int
unit)
LIB_DLL_EXPORTED
;
639
640
/***************************************************************************/
651
extern
int
opennsl_l2_cache_init
(
652
int
unit)
LIB_DLL_EXPORTED
;
653
654
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
655
656
/***************************************************************************/
666
extern
void
opennsl_l2_cache_addr_t_init
(
667
opennsl_l2_cache_addr_t
*addr)
LIB_DLL_EXPORTED
;
668
669
#ifndef OPENNSL_HIDE_DISPATCHABLE
670
671
/***************************************************************************/
681
extern
int
opennsl_l2_cache_size_get
(
682
int
unit,
683
int
*size)
LIB_DLL_EXPORTED
;
684
685
/***************************************************************************/
709
extern
int
opennsl_l2_cache_set
(
710
int
unit,
711
int
index,
712
opennsl_l2_cache_addr_t
*addr,
713
int
*index_used)
LIB_DLL_EXPORTED
;
714
715
/***************************************************************************/
728
extern
int
opennsl_l2_cache_get
(
729
int
unit,
730
int
index,
731
opennsl_l2_cache_addr_t
*addr)
LIB_DLL_EXPORTED
;
732
733
/***************************************************************************/
743
extern
int
opennsl_l2_cache_delete
(
744
int
unit,
745
int
index)
LIB_DLL_EXPORTED
;
746
747
/***************************************************************************/
756
extern
int
opennsl_l2_cache_delete_all
(
757
int
unit)
LIB_DLL_EXPORTED
;
758
759
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
760
761
#ifndef OPENNSL_HIDE_DISPATCHABLE
762
763
/***************************************************************************/
776
extern
int
opennsl_l2_tunnel_add
(
777
int
unit,
778
opennsl_mac_t
mac,
779
opennsl_vlan_t
vlan)
LIB_DLL_EXPORTED
;
780
781
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
782
783
#ifndef OPENNSL_HIDE_DISPATCHABLE
784
785
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
786
787
typedef
int (*
opennsl_l2_traverse_cb
)(
788
int
unit,
789
opennsl_l2_addr_t
*info,
790
void
*user_data);
791
792
#ifndef OPENNSL_HIDE_DISPATCHABLE
793
794
/***************************************************************************/
809
extern
int
opennsl_l2_traverse
(
810
int
unit,
811
opennsl_l2_traverse_cb
trav_fn,
812
void
*user_data)
LIB_DLL_EXPORTED
;
813
814
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
815
816
#define OPENNSL_L2_REPLACE_MATCH_STATIC 0x00000001
817
#define OPENNSL_L2_REPLACE_MATCH_MAC 0x00000002
819
#define OPENNSL_L2_REPLACE_MATCH_VLAN 0x00000004
821
#define OPENNSL_L2_REPLACE_MATCH_DEST 0x00000008
824
#define OPENNSL_L2_REPLACE_DELETE 0x00000100
828
#define OPENNSL_L2_REPLACE_NO_CALLBACKS 0x00000800
830
#ifndef OPENNSL_HIDE_DISPATCHABLE
831
832
/***************************************************************************/
871
extern
int
opennsl_l2_replace
(
872
int
unit,
873
uint32
flags,
874
opennsl_l2_addr_t
*match_addr,
875
opennsl_module_t
new_module,
876
opennsl_port_t
new_port,
877
opennsl_trunk_t
new_trunk)
LIB_DLL_EXPORTED
;
878
879
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
880
882
typedef
struct
opennsl_l2_station_s
{
883
uint32
flags
;
884
opennsl_mac_t
dst_mac
;
885
opennsl_mac_t
dst_mac_mask
;
886
opennsl_vlan_t
vlan
;
887
opennsl_vlan_t
vlan_mask
;
888
opennsl_port_t
src_port
;
889
opennsl_port_t
src_port_mask
;
890
}
opennsl_l2_station_t
;
891
/* __doxy_func_body_end__ */
892
893
#define OPENNSL_L2_STATION_WITH_ID (1 << 0)
894
#define OPENNSL_L2_STATION_IPV4 (1 << 2)
896
#define OPENNSL_L2_STATION_IPV6 (1 << 3)
898
#define OPENNSL_L2_STATION_ARP_RARP (1 << 4)
900
/***************************************************************************/
910
extern void opennsl_l2_station_t_init(
911
opennsl_l2_station_t
*addr)
LIB_DLL_EXPORTED
;
912
913
#ifndef OPENNSL_HIDE_DISPATCHABLE
914
915
/***************************************************************************/
949
extern
int
opennsl_l2_station_add
(
950
int
unit,
951
int
*station_id,
952
opennsl_l2_station_t
*station)
LIB_DLL_EXPORTED
;
953
954
/***************************************************************************/
964
extern
int
opennsl_l2_station_delete
(
965
int
unit,
966
int
station_id)
LIB_DLL_EXPORTED
;
967
968
/***************************************************************************/
979
extern
int
opennsl_l2_station_get
(
980
int
unit,
981
int
station_id,
982
opennsl_l2_station_t
*station)
LIB_DLL_EXPORTED
;
983
984
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
985
986
#include <
opennsl/l2X.h
>
987
#endif
/* __OPENNSL_L2_H__ */
988
© 2016-17 by Broadcom Limited. All rights reserved.