OpenNSL API Guide and Reference Manual
Welcome
OpenNSL Documentation
API Reference
Files
File List
Globals
include
opennsl
switch.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_SWITCH_H__
25
#define __OPENNSL_SWITCH_H__
26
27
#include <
opennsl/types.h
>
28
#include <
opennsl/port.h
>
29
#include <
opennsl/error.h
>
30
#include <
opennsl/stg.h
>
31
#include <
shared/switch.h
>
32
#include <
shared/bitop.h
>
33
35
typedef
enum
opennsl_switch_control_e
{
36
opennslSwitchCpuSamplePrio
= 16,
37
opennslSwitchUnknownL3DestToCpu
= 26,
38
opennslSwitchSampleIngressRandomSeed
= 31,
39
opennslSwitchSampleEgressRandomSeed
= 32,
40
opennslSwitchV6L3DstMissToCpu
= 40,
41
opennslSwitchV4L3DstMissToCpu
= 43,
42
opennslSwitchL3SlowpathToCpu
= 48,
43
opennslSwitchArpReplyToCpu
= 84,
44
opennslSwitchArpRequestToCpu
= 86,
45
opennslSwitchNdPktToCpu
= 89,
46
opennslSwitchIgmpPktToCpu
= 92,
47
opennslSwitchIgmpToCPU
=
opennslSwitchIgmpPktToCpu
,
49
opennslSwitchDhcpPktToCpu
= 94,
50
opennslSwitchDhcpPktDrop
= 95,
51
opennslSwitchV4ResvdMcPktToCpu
= 98,
52
opennslSwitchDirectedMirroring
= 125,
53
opennslSwitchHashControl
= 136,
54
opennslSwitchMirrorUnmarked
= 141,
56
opennslSwitchColorSelect
= 143,
57
opennslSwitchHashSeed0
= 147,
58
opennslSwitchHashSeed1
= 148,
59
opennslSwitchHashField0PreProcessEnable
= 149,
61
opennslSwitchHashField1PreProcessEnable
= 150,
63
opennslSwitchHashField0Config
= 151,
65
opennslSwitchHashField0Config1
= 152,
67
opennslSwitchHashField1Config
= 153,
69
opennslSwitchHashField1Config1
= 154,
71
opennslSwitchHashSelectControl
= 156,
73
opennslSwitchHashIP4Field0
= 157,
74
opennslSwitchHashIP4Field1
= 158,
75
opennslSwitchHashIP4TcpUdpField0
= 159,
76
opennslSwitchHashIP4TcpUdpField1
= 160,
77
opennslSwitchHashIP4TcpUdpPortsEqualField0
= 161,
78
opennslSwitchHashIP4TcpUdpPortsEqualField1
= 162,
81
opennslSwitchHashIP6Field0
= 163,
82
opennslSwitchHashIP6Field1
= 164,
83
opennslSwitchHashIP6TcpUdpField0
= 165,
84
opennslSwitchHashIP6TcpUdpField1
= 166,
85
opennslSwitchHashIP6TcpUdpPortsEqualField0
= 167,
86
opennslSwitchHashIP6TcpUdpPortsEqualField1
= 168,
89
opennslSwitchHashL2Field0
= 169,
90
opennslSwitchHashL2Field1
= 170,
91
opennslSwitchECMPHashSet0Offset
= 210,
92
opennslSwitchECMPHashSet1Offset
= 211,
93
opennslSwitchMirrorInvalidVlanDrop
= 221,
95
opennslSwitchMirrorPktChecksEnable
= 222,
97
opennslSwitchL3EgressMode
= 230,
98
opennslSwitchL3IngressMode
= 232,
100
opennslSwitchWarmBoot
= 238,
101
opennslSwitchStableSelect
= 239,
103
opennslSwitchStableSize
= 240,
105
opennslSwitchStableUsed
= 241,
107
opennslSwitchStableConsistent
= 242,
111
opennslSwitchControlSync
= 243,
113
opennslSwitchControlAutoSync
= 244,
115
opennslSwitchIpmcTtl1ToCpu
= 249,
116
opennslSwitchL3UcastTtl1ToCpu
= 250,
117
opennslSwitchL3UrpfMode
= 262,
118
opennslSwitchBstEnable
= 717,
119
opennslSwitchBstTrackingMode
= 718,
120
opennslSwitchVxlanUdpDestPortSet
= 729,
121
opennslSwitchVxlanEntropyEnable
= 730,
123
opennslSwitchVxlanVnIdMissToCpu
= 731,
125
opennslSwitchVxlanTunnelMissToCpu
= 732,
127
opennslSwitchFlexibleMirrorDestinations
= 781,
129
opennslSwitchEcmpMacroFlowHashEnable
= 782,
130
opennslSwitchMcQueueSchedMode
= 871,
132
opennslSwitchBstSnapshotEnable
= 878,
133
opennslSwitchMirrorExclusive
= 912,
135
}
opennsl_switch_control_t
;
136
/* __doxy_func_body_end__ */
137
138
#define OPENNSL_SWITCH_STABLE_APPLICATION (_SHR_SWITCH_STABLE_APPLICATION)
139
#ifndef OPENNSL_HIDE_DISPATCHABLE
140
141
/***************************************************************************/
160
extern
int
opennsl_switch_control_get
(
161
int
unit,
162
opennsl_switch_control_t
type,
163
int
*arg)
LIB_DLL_EXPORTED
;
164
165
/***************************************************************************/
184
extern
int
opennsl_switch_control_set
(
185
int
unit,
186
opennsl_switch_control_t
type,
187
int
arg)
LIB_DLL_EXPORTED
;
188
189
/***************************************************************************/
209
extern
int
opennsl_switch_control_port_get
(
210
int
unit,
211
opennsl_port_t
port
,
212
opennsl_switch_control_t
type,
213
int
*arg)
LIB_DLL_EXPORTED
;
214
215
/***************************************************************************/
235
extern
int
opennsl_switch_control_port_set
(
236
int
unit,
237
opennsl_port_t
port
,
238
opennsl_switch_control_t
type,
239
int
arg)
LIB_DLL_EXPORTED
;
240
241
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
242
244
typedef
_shr_switch_temperature_monitor_t
opennsl_switch_temperature_monitor_t
;
245
246
#ifndef OPENNSL_HIDE_DISPATCHABLE
247
248
/***************************************************************************/
265
extern
int
opennsl_switch_temperature_monitor_get
(
266
int
unit,
267
int
temperature_max,
268
opennsl_switch_temperature_monitor_t
*temperature_array,
269
int
*temperature_count)
LIB_DLL_EXPORTED
;
270
271
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
272
273
#define OPENNSL_SWITCH_PKT_INFO_SRC_GPORT (1 << 0)
275
#define OPENNSL_SWITCH_PKT_INFO_VLAN (1 << 1)
277
#define OPENNSL_SWITCH_PKT_INFO_ETHERTYPE (1 << 2)
278
#define OPENNSL_SWITCH_PKT_INFO_SRC_MAC (1 << 3)
280
#define OPENNSL_SWITCH_PKT_INFO_DST_MAC (1 << 4)
282
#define OPENNSL_SWITCH_PKT_INFO_SRC_IP (1 << 5)
284
#define OPENNSL_SWITCH_PKT_INFO_DST_IP (1 << 6)
286
#define OPENNSL_SWITCH_PKT_INFO_SRC_IPV6 (1 << 7)
288
#define OPENNSL_SWITCH_PKT_INFO_DST_IPV6 (1 << 8)
290
#define OPENNSL_SWITCH_PKT_INFO_PROTOCOL (1 << 9)
292
#define OPENNSL_SWITCH_PKT_INFO_SRC_L4_PORT (1 << 10)
294
#define OPENNSL_SWITCH_PKT_INFO_DST_L4_PORT (1 << 11)
296
#define OPENNSL_SWITCH_PKT_INFO_HASH_TRUNK (1 << 12)
298
#define OPENNSL_SWITCH_PKT_INFO_HASH_MULTIPATH (1 << 13)
300
#define OPENNSL_SWITCH_PKT_INFO_HASH_UDP_SOURCE_PORT (1 << 14)
302
#define OPENNSL_SWITCH_PKT_INFO_HASH_LBID (1 << 15)
303
#define OPENNSL_SWITCH_PKT_INFO_HASH_OVERLAY (1 << 16)
307
typedef enum opennsl_switch_pkt_hash_info_fwd_reason_e {
308
opennslSwitchPktHashInfoFwdReasonUnicast
= 0,
309
opennslSwitchPktHashInfoFwdReasonIpmc
= 1,
310
opennslSwitchPktHashInfoFwdReasonL2mc
= 2,
311
opennslSwitchPktHashInfoFwdReasonBcast
= 3,
312
opennslSwitchPktHashInfoFwdReasonDlf
= 4
313
}
opennsl_switch_pkt_hash_info_fwd_reason_t
;
314
/* __doxy_func_body_end__ */
315
321
typedef
struct
opennsl_switch_pkt_info_s
{
322
uint32
flags
;
324
opennsl_gport_t
src_gport
;
326
opennsl_vlan_t
vid
;
327
opennsl_ethertype_t
ethertype
;
328
opennsl_mac_t
src_mac
;
329
opennsl_mac_t
dst_mac
;
330
opennsl_ip_t
sip
;
331
opennsl_ip_t
dip
;
332
opennsl_ip6_t
sip6
;
333
opennsl_ip6_t
dip6
;
334
uint8
protocol
;
335
uint32
src_l4_port
;
336
uint32
dst_l4_port
;
337
opennsl_gport_t
trunk_gport
;
339
opennsl_if_t
mpintf
;
340
opennsl_switch_pkt_hash_info_fwd_reason_t
fwd_reason
;
341
}
opennsl_switch_pkt_info_t
;
342
/* __doxy_func_body_end__ */
343
344
/***************************************************************************/
359
extern
void
opennsl_switch_pkt_info_t_init
(
360
opennsl_switch_pkt_info_t
*pkt_info)
LIB_DLL_EXPORTED
;
361
362
#ifndef OPENNSL_HIDE_DISPATCHABLE
363
364
/***************************************************************************/
383
extern
int
opennsl_switch_pkt_info_hash_get
(
384
int
unit,
385
opennsl_switch_pkt_info_t
*pkt_info,
386
opennsl_gport_t
*dst_gport,
387
opennsl_if_t
*dst_intf)
LIB_DLL_EXPORTED
;
388
389
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
390
391
typedef
void (*
opennsl_switch_event_cb_t
)(
392
int
unit,
393
opennsl_switch_event_t
event,
394
uint32
arg1,
395
uint32
arg2,
396
uint32
arg3,
397
void
*userdata);
398
399
#ifndef OPENNSL_HIDE_DISPATCHABLE
400
401
/***************************************************************************/
425
extern
int
opennsl_switch_event_register
(
426
int
unit,
427
opennsl_switch_event_cb_t
cb,
428
void
*userdata)
LIB_DLL_EXPORTED
;
429
430
/***************************************************************************/
454
extern
int
opennsl_switch_event_unregister
(
455
int
unit,
456
opennsl_switch_event_cb_t
cb,
457
void
*userdata)
LIB_DLL_EXPORTED
;
458
459
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
460
461
#define OPENNSL_HASH_CONTROL_MULTIPATH_L4PORTS 0x0001
462
#define OPENNSL_HASH_CONTROL_MULTIPATH_DIP 0x0002
464
#define OPENNSL_HASH_CONTROL_TRUNK_UC_SRCPORT 0x0008
465
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_DST 0x0010
467
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_SRC 0x0020
469
#define OPENNSL_HASH_CONTROL_ECMP_ENHANCE 0x0080
471
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_ENHANCE 0x0100
474
#define OPENNSL_HASH_FIELD_CONFIG_CRC16XOR8 0x00000001
476
#define OPENNSL_HASH_FIELD_CONFIG_XOR16 0x00000006
477
#define OPENNSL_HASH_FIELD_CONFIG_CRC16CCITT 0x00000007
479
#define OPENNSL_HASH_FIELD_CONFIG_CRC32LO 0x00000008
480
#define OPENNSL_HASH_FIELD_CONFIG_CRC32HI 0x00000009
482
#define OPENNSL_HASH_FIELD_DSTL4 0x00000020
483
#define OPENNSL_HASH_FIELD_SRCL4 0x00000040
484
#define OPENNSL_HASH_FIELD_VLAN 0x00000080
485
#define OPENNSL_HASH_FIELD_IP4DST_LO 0x00000100
487
#define OPENNSL_HASH_FIELD_IP4DST_HI 0x00000200
489
#define OPENNSL_HASH_FIELD_IP4SRC_LO 0x00000400
491
#define OPENNSL_HASH_FIELD_IP4SRC_HI 0x00000800
493
#define OPENNSL_HASH_FIELD_IP6DST_LO 0x00001000
495
#define OPENNSL_HASH_FIELD_IP6DST_HI 0x00002000
497
#define OPENNSL_HASH_FIELD_IP6SRC_LO 0x00004000
499
#define OPENNSL_HASH_FIELD_IP6SRC_HI 0x00008000
501
#define OPENNSL_HASH_FIELD_MACDA_LO 0x00040000
503
#define OPENNSL_HASH_FIELD_MACDA_MI 0x00080000
505
#define OPENNSL_HASH_FIELD_MACDA_HI 0x00100000
507
#define OPENNSL_HASH_FIELD_MACSA_LO 0x00200000
509
#define OPENNSL_HASH_FIELD_MACSA_MI 0x00400000
511
#define OPENNSL_HASH_FIELD_MACSA_HI 0x00800000
513
#define OPENNSL_COLOR_PRIORITY 0
514
#define OPENNSL_COLOR_OUTER_CFI 1
515
typedef enum opennsl_switch_object_e {
516
opennslSwitchObjectL2EntryCurrent
= 0,
517
opennslSwitchObjectVlanCurrent
= 1,
518
opennslSwitchObjectL3HostCurrent
= 2,
519
opennslSwitchObjectL3RouteCurrent
= 3,
520
opennslSwitchObjectL3EgressCurrent
= 4,
522
opennslSwitchObjectIpmcCurrent
= 5,
524
opennslSwitchObjectEcmpCurrent
= 6,
525
opennslSwitchObjectL3RouteV4RoutesMax
= 7,
526
opennslSwitchObjectL3RouteV4RoutesFree
= 8,
528
opennslSwitchObjectL3RouteV4RoutesUsed
= 9,
529
opennslSwitchObjectL3RouteV6Routes64bMax
= 10,
531
opennslSwitchObjectL3RouteV6Routes64bFree
= 11,
533
opennslSwitchObjectL3RouteV6Routes64bUsed
= 12,
534
opennslSwitchObjectL3RouteV6Routes128bMax
= 13,
536
opennslSwitchObjectL3RouteV6Routes128bFree
= 14,
538
opennslSwitchObjectL3RouteV6Routes128bUsed
= 15,
539
opennslSwitchObjectL3RouteTotalUsedRoutes
= 16,
540
opennslSwitchObjectIpmcHeadTableFree
= 17,
542
opennslSwitchObjectL3HostV4Used
= 18,
543
opennslSwitchObjectL3HostV6Used
= 19,
544
opennslSwitchObjectEcmpMax
= 20,
546
opennslSwitchObjectPFCDeadlockCosMax
= 21,
548
opennslSwitchObjectL3HostV4Max
= 22,
550
opennslSwitchObjectL3HostV6Max
= 23,
552
opennslSwitchObjectL3RouteV4RoutesMinGuaranteed
= 24,
554
opennslSwitchObjectL3RouteV6Routes64bMinGuaranteed
= 25,
556
opennslSwitchObjectL3RouteV6Routes128bMinGuaranteed
= 26,
558
opennslSwitchObjectL3EgressMax
= 27,
560
opennslSwitchObjectIpmcV4Used
= 28,
562
opennslSwitchObjectIpmcV6Used
= 29,
564
opennslSwitchObjectIpmcV4Max
= 30,
566
opennslSwitchObjectIpmcV6Max
= 31,
568
opennslSwitchObjectL2EntryMax
= 32,
570
opennslSwitchObjectCount
573
}
opennsl_switch_object_t
;
574
/* __doxy_func_body_end__ */
575
576
#ifndef OPENNSL_HIDE_DISPATCHABLE
577
578
/***************************************************************************/
592
extern
int
opennsl_switch_object_count_multi_get
(
593
int
unit,
594
int
object_size,
595
opennsl_switch_object_t
*object_array,
596
int
*entries)
LIB_DLL_EXPORTED
;
597
598
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
599
601
typedef
enum
opennsl_switch_pkt_trace_lookup_e
{
602
opennslSwitchPktTraceLookupCount
= 20
603
}
opennsl_switch_pkt_trace_lookup_t
;
604
/* __doxy_func_body_end__ */
605
607
typedef
struct
opennsl_switch_pkt_trace_lookup_result_s
{
608
SHR_BITDCL
pkt_trace_status_bitmap
[
_SHR_BITDCLSIZE
(
opennslSwitchPktTraceLookupCount
)];
610
}
opennsl_switch_pkt_trace_lookup_result_t
;
611
/* __doxy_func_body_end__ */
612
613
#define OPENNSL_SWITCH_PKT_TRACE_ECMP_1 0x0001
615
#define OPENNSL_SWITCH_PKT_TRACE_ECMP_2 0x0002
617
#define OPENNSL_SWITCH_PKT_TRACE_TRUNK 0x0004
619
#define OPENNSL_SWITCH_PKT_TRACE_FABRIC_TRUNK 0x0008
622
typedef struct opennsl_switch_pkt_trace_hashing_info_s {
623
uint32
flags;
626
opennsl_if_t
ecmp_1_group
;
627
opennsl_if_t
ecmp_1_egress
;
628
opennsl_if_t
ecmp_2_group
;
629
opennsl_if_t
ecmp_2_egress
;
630
opennsl_gport_t
trunk
;
631
opennsl_gport_t
trunk_member;
633
opennsl_gport_t
fabric_trunk
;
634
opennsl_gport_t
fabric_trunk_member;
636
}
opennsl_switch_pkt_trace_hashing_info_t
;
637
/* __doxy_func_body_end__ */
638
639
#define OPENNSL_SWITCH_PKT_TRACE_RAW_DATA_MAX 112
642
typedef struct opennsl_switch_pkt_trace_info_s {
643
opennsl_switch_pkt_trace_lookup_result_t
pkt_trace_lookup_status
;
644
opennsl_switch_pkt_trace_hashing_info_t
pkt_trace_hash_info
;
645
opennsl_stg_stp_t
pkt_trace_stp_state
;
646
uint32
dest_pipe_num;
648
uint32
raw_data_length
;
649
uint8
raw_data[
OPENNSL_SWITCH_PKT_TRACE_RAW_DATA_MAX
];
651
}
opennsl_switch_pkt_trace_info_t
;
652
/* __doxy_func_body_end__ */
653
654
#ifndef OPENNSL_HIDE_DISPATCHABLE
655
656
/***************************************************************************/
681
extern
int
opennsl_switch_pkt_trace_info_get
(
682
int
unit,
683
uint32
options,
684
uint8
port
,
685
int
len,
686
uint8
*data,
687
opennsl_switch_pkt_trace_info_t
*pkt_trace_info)
LIB_DLL_EXPORTED
;
688
689
#endif
/* OPENNSL_HIDE_DISPATCHABLE */
690
691
#include <
opennsl/switchX.h
>
692
#endif
/* __OPENNSL_SWITCH_H__ */
693
© 2016-17 by Broadcom Limited. All rights reserved.