OpenNSL API Guide and Reference Manual
Data Structures | Macros | Typedefs | Enumerations | Functions
switch.h File Reference
#include <opennsl/types.h>
#include <opennsl/port.h>
#include <opennsl/error.h>
#include <opennsl/stg.h>
#include <shared/switch.h>
#include <shared/bitop.h>
#include <opennsl/switchX.h>

Go to the source code of this file.

Data Structures

struct  opennsl_switch_pkt_info_s
 Switch packet info structure. More...
 
struct  opennsl_switch_pkt_trace_hashing_info_s
 packet hashing resolution information More...
 
struct  opennsl_switch_pkt_trace_info_s
 packet trace ingress process data More...
 
struct  opennsl_switch_pkt_trace_lookup_result_s
 lookup result set bit map More...
 

Macros

#define OPENNSL_COLOR_OUTER_CFI   1
 SPVLAN CFI->COLOR mapping.
 
#define OPENNSL_COLOR_PRIORITY   0
 Priority->COLOR mapping.
 
#define OPENNSL_HASH_CONTROL_ECMP_ENHANCE   0x0080
 Use enhanced ECMP hashing.
 
#define OPENNSL_HASH_CONTROL_MULTIPATH_DIP   0x0002
 Use destination IP address.
 
#define OPENNSL_HASH_CONTROL_MULTIPATH_L4PORTS   0x0001
 Use TCP/UDP ports.
 
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_DST   0x0010
 Use destination MAC or IP address.
 
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_ENHANCE   0x0100
 Use enhanced non-unicast trunk hashing.
 
#define OPENNSL_HASH_CONTROL_TRUNK_NUC_SRC   0x0020
 Use source MAC or IP address.
 
#define OPENNSL_HASH_CONTROL_TRUNK_UC_SRCPORT   0x0008
 Use source port.
 
#define OPENNSL_HASH_FIELD_CONFIG_CRC16CCITT   0x00000007
 16-bit CRC using CCITT polynomial.
 
#define OPENNSL_HASH_FIELD_CONFIG_CRC16XOR8   0x00000001
 8-bit CRC16 + 8-bit XOR8.
 
#define OPENNSL_HASH_FIELD_CONFIG_CRC32HI   0x00000009
 Higher 16-bit of CRC32.
 
#define OPENNSL_HASH_FIELD_CONFIG_CRC32LO   0x00000008
 Lower 16-bit of CRC32.
 
#define OPENNSL_HASH_FIELD_CONFIG_XOR16   0x00000006
 16-bit XOR.
 
#define OPENNSL_HASH_FIELD_DSTL4   0x00000020
 Destination L4 port.
 
#define OPENNSL_HASH_FIELD_IP4DST_HI   0x00000200
 IPv4 destination address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_IP4DST_LO   0x00000100
 IPv4 destination address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_IP4SRC_HI   0x00000800
 IPv4 source address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_IP4SRC_LO   0x00000400
 IPv4 source address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_IP6DST_HI   0x00002000
 IPv6 collapsed destination address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_IP6DST_LO   0x00001000
 IPv6 collapsed destination address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_IP6SRC_HI   0x00008000
 IPv6 collapsed source address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_IP6SRC_LO   0x00004000
 IPv6 collapsed source address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_MACDA_HI   0x00100000
 MAC destination address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_MACDA_LO   0x00040000
 MAC destination address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_MACDA_MI   0x00080000
 MAC destination address middle 16 bits.
 
#define OPENNSL_HASH_FIELD_MACSA_HI   0x00800000
 MAC source address upper 16 bits.
 
#define OPENNSL_HASH_FIELD_MACSA_LO   0x00200000
 MAC source address lower 16 bits.
 
#define OPENNSL_HASH_FIELD_MACSA_MI   0x00400000
 MAC source address middle 16 bits.
 
#define OPENNSL_HASH_FIELD_SRCL4   0x00000040
 Source L4 port.
 
#define OPENNSL_HASH_FIELD_VLAN   0x00000080
 VLAN ID.
 
#define OPENNSL_SWITCH_PKT_INFO_DST_IP   (1 << 6)
 Destination IPv4 address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_DST_IPV6   (1 << 8)
 Destination IPv6 address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_DST_L4_PORT   (1 << 11)
 Destination L4 port field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_DST_MAC   (1 << 4)
 Destination MAC address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_ETHERTYPE   (1 << 2)
 Ethertype field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_HASH_LBID   (1 << 15)
 Retrieve LBID.
 
#define OPENNSL_SWITCH_PKT_INFO_HASH_MULTIPATH   (1 << 13)
 Retrieve ECMP hash result.
 
#define OPENNSL_SWITCH_PKT_INFO_HASH_OVERLAY   (1 << 16)
 Retrieve ECMP hash result for overlay layer.
 
#define OPENNSL_SWITCH_PKT_INFO_HASH_TRUNK   (1 << 12)
 Retrieve trunk hash result.
 
#define OPENNSL_SWITCH_PKT_INFO_HASH_UDP_SOURCE_PORT   (1 << 14)
 Retrieve Entropy Value of VXLan packet.
 
#define OPENNSL_SWITCH_PKT_INFO_PROTOCOL   (1 << 9)
 IP protocol field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_SRC_GPORT   (1 << 0)
 Source gport (module, port) field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_SRC_IP   (1 << 5)
 Source IPv4 address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_SRC_IPV6   (1 << 7)
 Source IPv6 address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_SRC_L4_PORT   (1 << 10)
 Source L4 port field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_SRC_MAC   (1 << 3)
 Source MAC address field valid.
 
#define OPENNSL_SWITCH_PKT_INFO_VLAN   (1 << 1)
 VLAN identifier field valid.
 
#define OPENNSL_SWITCH_PKT_TRACE_ECMP_1   0x0001
 level 1 ecmp hashing resolution done
 
#define OPENNSL_SWITCH_PKT_TRACE_ECMP_2   0x0002
 level 2 ecmp hashing resolution done
 
#define OPENNSL_SWITCH_PKT_TRACE_FABRIC_TRUNK   0x0008
 hg trunk hashing resolution done
 
#define OPENNSL_SWITCH_PKT_TRACE_RAW_DATA_MAX   112
 max bytes of pkt_trace_info.raw_data
 
#define OPENNSL_SWITCH_PKT_TRACE_TRUNK   0x0004
 trunk hashing resolution done
 
#define OPENNSL_SWITCH_STABLE_APPLICATION   (_SHR_SWITCH_STABLE_APPLICATION)
 

Typedefs

typedef enum
opennsl_switch_control_e 
opennsl_switch_control_t
 Switch controls.
 
typedef void(* opennsl_switch_event_cb_t )(int unit, opennsl_switch_event_t event, uint32 arg1, uint32 arg2, uint32 arg3, void *userdata)
 
typedef enum
opennsl_switch_object_e 
opennsl_switch_object_t
 
typedef enum
opennsl_switch_pkt_hash_info_fwd_reason_e 
opennsl_switch_pkt_hash_info_fwd_reason_t
 Packet forward reason for hash calculation.
 
typedef struct
opennsl_switch_pkt_info_s 
opennsl_switch_pkt_info_t
 Switch packet info structure.
 
typedef struct
opennsl_switch_pkt_trace_hashing_info_s 
opennsl_switch_pkt_trace_hashing_info_t
 packet hashing resolution information
 
typedef struct
opennsl_switch_pkt_trace_info_s 
opennsl_switch_pkt_trace_info_t
 packet trace ingress process data
 
typedef struct
opennsl_switch_pkt_trace_lookup_result_s 
opennsl_switch_pkt_trace_lookup_result_t
 lookup result set bit map
 
typedef enum
opennsl_switch_pkt_trace_lookup_e 
opennsl_switch_pkt_trace_lookup_t
 packet trace lookup result enums
 
typedef
_shr_switch_temperature_monitor_t 
opennsl_switch_temperature_monitor_t
 Entry type for retrieving temperature values.
 

Enumerations

enum  opennsl_switch_control_e {
  opennslSwitchCpuSamplePrio = 16,
  opennslSwitchUnknownL3DestToCpu = 26,
  opennslSwitchSampleIngressRandomSeed = 31,
  opennslSwitchSampleEgressRandomSeed = 32,
  opennslSwitchV6L3DstMissToCpu = 40,
  opennslSwitchV4L3DstMissToCpu = 43,
  opennslSwitchL3SlowpathToCpu = 48,
  opennslSwitchArpReplyToCpu = 84,
  opennslSwitchArpRequestToCpu = 86,
  opennslSwitchNdPktToCpu = 89,
  opennslSwitchIgmpPktToCpu = 92,
  opennslSwitchIgmpToCPU = opennslSwitchIgmpPktToCpu,
  opennslSwitchDhcpPktToCpu = 94,
  opennslSwitchDhcpPktDrop = 95,
  opennslSwitchV4ResvdMcPktToCpu = 98,
  opennslSwitchDirectedMirroring = 125,
  opennslSwitchHashControl = 136,
  opennslSwitchMirrorUnmarked = 141,
  opennslSwitchColorSelect = 143,
  opennslSwitchHashSeed0 = 147,
  opennslSwitchHashSeed1 = 148,
  opennslSwitchHashField0PreProcessEnable = 149,
  opennslSwitchHashField1PreProcessEnable = 150,
  opennslSwitchHashField0Config = 151,
  opennslSwitchHashField0Config1 = 152,
  opennslSwitchHashField1Config = 153,
  opennslSwitchHashField1Config1 = 154,
  opennslSwitchHashSelectControl = 156,
  opennslSwitchHashIP4Field0 = 157,
  opennslSwitchHashIP4Field1 = 158,
  opennslSwitchHashIP4TcpUdpField0 = 159,
  opennslSwitchHashIP4TcpUdpField1 = 160,
  opennslSwitchHashIP4TcpUdpPortsEqualField0 = 161,
  opennslSwitchHashIP4TcpUdpPortsEqualField1 = 162,
  opennslSwitchHashIP6Field0 = 163,
  opennslSwitchHashIP6Field1 = 164,
  opennslSwitchHashIP6TcpUdpField0 = 165,
  opennslSwitchHashIP6TcpUdpField1 = 166,
  opennslSwitchHashIP6TcpUdpPortsEqualField0 = 167,
  opennslSwitchHashIP6TcpUdpPortsEqualField1 = 168,
  opennslSwitchHashL2Field0 = 169,
  opennslSwitchHashL2Field1 = 170,
  opennslSwitchECMPHashSet0Offset = 210,
  opennslSwitchECMPHashSet1Offset = 211,
  opennslSwitchMirrorInvalidVlanDrop = 221,
  opennslSwitchMirrorPktChecksEnable = 222,
  opennslSwitchL3EgressMode = 230,
  opennslSwitchL3IngressMode = 232,
  opennslSwitchWarmBoot = 238,
  opennslSwitchStableSelect = 239,
  opennslSwitchStableSize = 240,
  opennslSwitchStableUsed = 241,
  opennslSwitchStableConsistent = 242,
  opennslSwitchControlSync = 243,
  opennslSwitchControlAutoSync = 244,
  opennslSwitchIpmcTtl1ToCpu = 249,
  opennslSwitchL3UcastTtl1ToCpu = 250,
  opennslSwitchL3UrpfMode = 262,
  opennslSwitchBstEnable = 717,
  opennslSwitchBstTrackingMode = 718,
  opennslSwitchVxlanUdpDestPortSet = 729,
  opennslSwitchVxlanEntropyEnable = 730,
  opennslSwitchVxlanVnIdMissToCpu = 731,
  opennslSwitchVxlanTunnelMissToCpu = 732,
  opennslSwitchFlexibleMirrorDestinations = 781,
  opennslSwitchEcmpMacroFlowHashEnable = 782,
  opennslSwitchMcQueueSchedMode = 871,
  opennslSwitchBstSnapshotEnable = 878,
  opennslSwitchMirrorExclusive = 912
}
 Switch controls. More...
 
enum  opennsl_switch_object_e {
  opennslSwitchObjectL2EntryCurrent = 0,
  opennslSwitchObjectVlanCurrent = 1,
  opennslSwitchObjectL3HostCurrent = 2,
  opennslSwitchObjectL3RouteCurrent = 3,
  opennslSwitchObjectL3EgressCurrent = 4,
  opennslSwitchObjectIpmcCurrent = 5,
  opennslSwitchObjectEcmpCurrent = 6,
  opennslSwitchObjectL3RouteV4RoutesMax = 7,
  opennslSwitchObjectL3RouteV4RoutesFree = 8,
  opennslSwitchObjectL3RouteV4RoutesUsed = 9,
  opennslSwitchObjectL3RouteV6Routes64bMax = 10,
  opennslSwitchObjectL3RouteV6Routes64bFree = 11,
  opennslSwitchObjectL3RouteV6Routes64bUsed = 12,
  opennslSwitchObjectL3RouteV6Routes128bMax = 13,
  opennslSwitchObjectL3RouteV6Routes128bFree = 14,
  opennslSwitchObjectL3RouteV6Routes128bUsed = 15,
  opennslSwitchObjectL3RouteTotalUsedRoutes = 16,
  opennslSwitchObjectIpmcHeadTableFree = 17,
  opennslSwitchObjectL3HostV4Used = 18,
  opennslSwitchObjectL3HostV6Used = 19,
  opennslSwitchObjectEcmpMax = 20,
  opennslSwitchObjectPFCDeadlockCosMax = 21,
  opennslSwitchObjectL3HostV4Max = 22,
  opennslSwitchObjectL3HostV6Max = 23,
  opennslSwitchObjectL3RouteV4RoutesMinGuaranteed = 24,
  opennslSwitchObjectL3RouteV6Routes64bMinGuaranteed = 25,
  opennslSwitchObjectL3RouteV6Routes128bMinGuaranteed = 26,
  opennslSwitchObjectL3EgressMax = 27,
  opennslSwitchObjectIpmcV4Used = 28,
  opennslSwitchObjectIpmcV6Used = 29,
  opennslSwitchObjectIpmcV4Max = 30,
  opennslSwitchObjectIpmcV6Max = 31,
  opennslSwitchObjectL2EntryMax = 32,
  opennslSwitchObjectCount
}
 
enum  opennsl_switch_pkt_hash_info_fwd_reason_e {
  opennslSwitchPktHashInfoFwdReasonUnicast = 0,
  opennslSwitchPktHashInfoFwdReasonIpmc = 1,
  opennslSwitchPktHashInfoFwdReasonL2mc = 2,
  opennslSwitchPktHashInfoFwdReasonBcast = 3,
  opennslSwitchPktHashInfoFwdReasonDlf = 4
}
 Packet forward reason for hash calculation. More...
 
enum  opennsl_switch_pkt_trace_lookup_e { opennslSwitchPktTraceLookupCount = 20 }
 packet trace lookup result enums More...
 

Functions

int opennsl_switch_control_get (int unit, opennsl_switch_control_t type, int *arg) LIB_DLL_EXPORTED
 Configure port-specific and device-wide operating modes.
 
int opennsl_switch_control_port_get (int unit, opennsl_port_t port, opennsl_switch_control_t type, int *arg) LIB_DLL_EXPORTED
 Configure port-specific and device-wide operating modes.
 
int opennsl_switch_control_port_set (int unit, opennsl_port_t port, opennsl_switch_control_t type, int arg) LIB_DLL_EXPORTED
 Configure port-specific and device-wide operating modes.
 
int opennsl_switch_control_set (int unit, opennsl_switch_control_t type, int arg) LIB_DLL_EXPORTED
 Configure port-specific and device-wide operating modes.
 
int opennsl_switch_event_register (int unit, opennsl_switch_event_cb_t cb, void *userdata) LIB_DLL_EXPORTED
 Registers/Unregisters a callback function for switch critical events.
 
int opennsl_switch_event_unregister (int unit, opennsl_switch_event_cb_t cb, void *userdata) LIB_DLL_EXPORTED
 Registers/Unregisters a callback function for switch critical events.
 
int opennsl_switch_object_count_multi_get (int unit, int object_size, opennsl_switch_object_t *object_array, int *entries) LIB_DLL_EXPORTED
 Retrieving the statistics on the number of API objects.
 
int opennsl_switch_pkt_info_hash_get (int unit, opennsl_switch_pkt_info_t *pkt_info, opennsl_gport_t *dst_gport, opennsl_if_t *dst_intf) LIB_DLL_EXPORTED
 Gets the hash result for the specified link aggregation method using provided packet parameters and device configuration.
 
void opennsl_switch_pkt_info_t_init (opennsl_switch_pkt_info_t *pkt_info) LIB_DLL_EXPORTED
 Initialize a opennsl_switch_pkt_info_t structure.
 
int opennsl_switch_pkt_trace_info_get (int unit, uint32 options, uint8 port, int len, uint8 *data, opennsl_switch_pkt_trace_info_t *pkt_trace_info) LIB_DLL_EXPORTED
 Generate a visibility trace packet and then read the result of the packets ingress processing information.
 
int opennsl_switch_temperature_monitor_get (int unit, int temperature_max, opennsl_switch_temperature_monitor_t *temperature_array, int *temperature_count) LIB_DLL_EXPORTED
 There are temperature monitors embedded in the various points of some switch chips for the purpose of monitoring the health of the chip.