OpenNSL API Guide and Reference Manual
Data Structures | Macros | Typedefs | Functions
l2.h File Reference
#include <opennsl/types.h>
#include <opennsl/l2X.h>

Go to the source code of this file.

Data Structures

struct  opennsl_l2_addr_s
 Device-independent L2 address structure. More...
 
struct  opennsl_l2_cache_addr_s
 Device-independent L2 cache address structure. More...
 
struct  opennsl_l2_station_s
 L2 Station address info. More...
 

Macros

#define OPENNSL_L2_CACHE_BPDU   0x00000010
 Packet is BPDU.
 
#define OPENNSL_L2_CACHE_CPU   0x00000001
 Packet is copied to CPU.
 
#define OPENNSL_L2_CACHE_DISCARD   0x00000002
 Packet is not switched.
 
#define OPENNSL_L2_CALLBACK_ADD   1
 
#define OPENNSL_L2_CALLBACK_AGE_EVENT   4
 
#define OPENNSL_L2_CALLBACK_DELETE   0
 
#define OPENNSL_L2_CALLBACK_LEARN_EVENT   3
 
#define OPENNSL_L2_CALLBACK_MOVE_EVENT   5
 
#define OPENNSL_L2_CALLBACK_REPORT   2
 
#define OPENNSL_L2_COPY_TO_CPU   0x00000008
 
#define OPENNSL_L2_DELETE_NO_CALLBACKS   0x00000004
 
#define OPENNSL_L2_DELETE_PENDING   0x00000002
 
#define OPENNSL_L2_DELETE_STATIC   0x00000001
 
#define OPENNSL_L2_DES_HIT   0x00000800
 
#define OPENNSL_L2_DISCARD_DST   0x00000004
 
#define OPENNSL_L2_DISCARD_SRC   0x00000002
 
#define OPENNSL_L2_HIT   0x00000040
 
#define OPENNSL_L2_L3LOOKUP   0x00000010
 
#define OPENNSL_L2_LOCAL_CPU   0x00200000
 Entry is for the local CPU on the device.
 
#define OPENNSL_L2_MCAST   0x00000100
 
#define OPENNSL_L2_MOVE_PORT   0x00100000
 
#define OPENNSL_L2_REPLACE_DELETE   0x00000100
 L2 replace will perform delete operation instead of replace on matching entries.
 
#define OPENNSL_L2_REPLACE_MATCH_DEST   0x00000008
 Replace all L2 entries matching given modid port/tgid.
 
#define OPENNSL_L2_REPLACE_MATCH_MAC   0x00000002
 Replace all L2 entries matching given MAC address.
 
#define OPENNSL_L2_REPLACE_MATCH_STATIC   0x00000001
 Replace L2 static entries.
 
#define OPENNSL_L2_REPLACE_MATCH_VLAN   0x00000004
 Replace all L2 entries matching given VLAN id.
 
#define OPENNSL_L2_REPLACE_NO_CALLBACKS   0x00000800
 Replace L2 entries without callbacks.
 
#define OPENNSL_L2_SRC_HIT   0x00000400
 
#define OPENNSL_L2_STATIC   0x00000020
 
#define OPENNSL_L2_STATION_ARP_RARP   (1 << 4)
 Subject packets matching this entry to ARP/RARP processing.
 
#define OPENNSL_L2_STATION_IPV4   (1 << 2)
 Subject packets matching this entry to L3 processing.
 
#define OPENNSL_L2_STATION_IPV6   (1 << 3)
 Subject packets matching this entry to L3 processing.
 
#define OPENNSL_L2_STATION_WITH_ID   (1 << 0)
 Use the specified Station ID.
 
#define OPENNSL_L2_TRUNK_MEMBER   0x00000080
 

Typedefs

typedef void(* opennsl_l2_addr_callback_t )(int unit, opennsl_l2_addr_t *l2addr, int operation, void *userdata)
 Callback function used for receiving notification about insertions into and deletions from the L2 table dynamically as they occur.
 
typedef struct opennsl_l2_addr_s opennsl_l2_addr_t
 Device-independent L2 address structure.
 
typedef struct
opennsl_l2_cache_addr_s 
opennsl_l2_cache_addr_t
 Device-independent L2 cache address structure.
 
typedef struct opennsl_l2_station_s opennsl_l2_station_t
 L2 Station address info.
 
typedef int(* opennsl_l2_traverse_cb )(int unit, opennsl_l2_addr_t *info, void *user_data)
 

Functions

int opennsl_l2_addr_add (int unit, opennsl_l2_addr_t *l2addr) LIB_DLL_EXPORTED
 Add an L2 address entry to the specified device.
 
int opennsl_l2_addr_delete (int unit, opennsl_mac_t mac, opennsl_vlan_t vid) LIB_DLL_EXPORTED
 Delete an L2 address entry from the specified device.
 
int opennsl_l2_addr_delete_by_mac (int unit, opennsl_mac_t mac, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a MAC address.
 
int opennsl_l2_addr_delete_by_mac_port (int unit, opennsl_mac_t mac, opennsl_module_t mod, opennsl_port_t port, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a MAC address and a destination module/port.
 
int opennsl_l2_addr_delete_by_port (int unit, opennsl_module_t mod, opennsl_port_t port, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a destination module/port.
 
int opennsl_l2_addr_delete_by_trunk (int unit, opennsl_trunk_t tid, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a trunk.
 
int opennsl_l2_addr_delete_by_vlan (int unit, opennsl_vlan_t vid, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a VLAN.
 
int opennsl_l2_addr_delete_by_vlan_port (int unit, opennsl_vlan_t vid, opennsl_module_t mod, opennsl_port_t port, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a VLAN and a destination module/port.
 
int opennsl_l2_addr_delete_by_vlan_trunk (int unit, opennsl_vlan_t vid, opennsl_trunk_t tid, uint32 flags) LIB_DLL_EXPORTED
 Delete L2 entries associated with a VLAN and a destination module/port.
 
int opennsl_l2_addr_freeze (int unit) LIB_DLL_EXPORTED
 Temporarily stop/restore L2 table from changing.
 
int opennsl_l2_addr_get (int unit, opennsl_mac_t mac_addr, opennsl_vlan_t vid, opennsl_l2_addr_t *l2addr) LIB_DLL_EXPORTED
 Check if an L2 entry is present in the L2 table.
 
int opennsl_l2_addr_register (int unit, opennsl_l2_addr_callback_t callback, void *userdata) LIB_DLL_EXPORTED
 Register/Unregister a callback routine for OPENNSL L2 subsystem.
 
void opennsl_l2_addr_t_init (opennsl_l2_addr_t *l2addr, const opennsl_mac_t mac_addr, opennsl_vlan_t vid) LIB_DLL_EXPORTED
 Initialize an L2 address structure to a specified MAC address and VLAN ID.
 
int opennsl_l2_addr_thaw (int unit) LIB_DLL_EXPORTED
 Temporarily stop/restore L2 table from changing.
 
int opennsl_l2_addr_unregister (int unit, opennsl_l2_addr_callback_t callback, void *userdata) LIB_DLL_EXPORTED
 Register/Unregister a callback routine for OPENNSL L2 subsystem.
 
int opennsl_l2_age_timer_get (int unit, int *age_seconds) LIB_DLL_EXPORTED
 Set/Get the age timer.
 
int opennsl_l2_age_timer_set (int unit, int age_seconds) LIB_DLL_EXPORTED
 Set/Get the age timer.
 
void opennsl_l2_cache_addr_t_init (opennsl_l2_cache_addr_t *addr) LIB_DLL_EXPORTED
 Initialize an L2 cache address structure.
 
int opennsl_l2_cache_delete (int unit, int index) LIB_DLL_EXPORTED
 Clear an L2 cache entry.
 
int opennsl_l2_cache_delete_all (int unit) LIB_DLL_EXPORTED
 Clear all L2 cache entries.
 
int opennsl_l2_cache_get (int unit, int index, opennsl_l2_cache_addr_t *addr) LIB_DLL_EXPORTED
 Get an L2 cache entry.
 
int opennsl_l2_cache_init (int unit) LIB_DLL_EXPORTED
 Initialize the L2 cache.
 
int opennsl_l2_cache_set (int unit, int index, opennsl_l2_cache_addr_t *addr, int *index_used) LIB_DLL_EXPORTED
 Set an L2 cache entry.
 
int opennsl_l2_cache_size_get (int unit, int *size) LIB_DLL_EXPORTED
 Get number of L2 cache entries.
 
int opennsl_l2_replace (int unit, uint32 flags, opennsl_l2_addr_t *match_addr, opennsl_module_t new_module, opennsl_port_t new_port, opennsl_trunk_t new_trunk) LIB_DLL_EXPORTED
 Replace destination (or delete) multiple L2 entries.
 
int opennsl_l2_station_add (int unit, int *station_id, opennsl_l2_station_t *station) LIB_DLL_EXPORTED
 Add an entry to L2 Station table.
 
int opennsl_l2_station_delete (int unit, int station_id) LIB_DLL_EXPORTED
 Delete an entry from L2 Station Table.
 
int opennsl_l2_station_get (int unit, int station_id, opennsl_l2_station_t *station) LIB_DLL_EXPORTED
 Get L2 station entry details from Station Table.
 
void opennsl_l2_station_t_init (opennsl_l2_station_t *addr) LIB_DLL_EXPORTED
 Initialize L2 Station structure.
 
int opennsl_l2_traverse (int unit, opennsl_l2_traverse_cb trav_fn, void *user_data) LIB_DLL_EXPORTED
 Iterates over all entries in the L2 table and executes user callback function for each entry.
 
int opennsl_l2_tunnel_add (int unit, opennsl_mac_t mac, opennsl_vlan_t vlan) LIB_DLL_EXPORTED
 Add a destination L2 address to trigger tunnel processing.