OpenNSL API Guide and Reference Manual
|
Data Structures | |
struct | opennsl_vlan_control_vlan_s |
This structure contains the configuration of a VLAN. More... | |
struct | opennsl_vlan_data_s |
Initialize a VLAN data information structure. More... | |
struct | opennsl_vlan_port_s |
Layer 2 Logical port type. More... | |
struct | opennsl_vlan_protocol_packet_ctrl_s |
Per VLAN Protocol Packet control. More... | |
Files | |
file | vlan.h |
file | vlanX.h |
Macros | |
#define | OPENNSL_VLAN_LEARN_DISABLE 0x00000001 |
#define | OPENNSL_VLAN_PORT_INNER_VLAN_PRESERVE 0x00000004 |
Preserve the inner VLAN tag (by default it is stripped). | |
#define | OPENNSL_VLAN_PORT_OUTER_VLAN_PRESERVE 0x00000100 |
Preserve the outer VLAN tag (by default it is stripped). | |
#define | OPENNSL_VLAN_PORT_REPLACE 0x00000001 |
Replace existing entry. | |
#define | OPENNSL_VLAN_PORT_WITH_ID 0x00000002 |
Add using the specified ID. | |
#define | OPENNSL_VLAN_PROTO_PKT_DROP_ENABLE 0x00000004 |
#define | OPENNSL_VLAN_PROTO_PKT_FLOOD_ENABLE 0x00000008 |
#define | OPENNSL_VLAN_PROTO_PKT_FORWARD_ENABLE 0x00000002 |
#define | OPENNSL_VLAN_PROTO_PKT_TOCPU_ENABLE 0x00000001 |
Typedefs | |
typedef enum opennsl_vlan_control_port_e | opennsl_vlan_control_port_t |
opennsl_vlan_control_port_t | |
typedef enum opennsl_vlan_control_e | opennsl_vlan_control_t |
opennsl_vlan_control_t | |
typedef struct opennsl_vlan_control_vlan_s | opennsl_vlan_control_vlan_t |
This structure contains the configuration of a VLAN. | |
typedef struct opennsl_vlan_data_s | opennsl_vlan_data_t |
Initialize a VLAN data information structure. | |
typedef enum opennsl_vlan_forward_e | opennsl_vlan_forward_t |
Per VLAN forwarding behavior. | |
typedef enum opennsl_vlan_mcast_flood_e | opennsl_vlan_mcast_flood_t |
VLAN multicast flood modes. | |
typedef enum opennsl_vlan_port_match_e | opennsl_vlan_port_match_t |
Logical layer 2 port match criteria. | |
typedef struct opennsl_vlan_port_s | opennsl_vlan_port_t |
Layer 2 Logical port type. | |
typedef struct opennsl_vlan_protocol_packet_ctrl_s | opennsl_vlan_protocol_packet_ctrl_t |
Per VLAN Protocol Packet control. | |
typedef enum opennsl_vlan_stat_e | opennsl_vlan_stat_t |
Types of statistics that are maintained per VLAN. | |
typedef enum opennsl_vlan_urpf_mode_e | opennsl_vlan_urpf_mode_t |
Per VLAN URPF Mode setting. | |
typedef enum opennsl_vlan_vp_mc_ctrl_e | opennsl_vlan_vp_mc_ctrl_t |
Per VLAN VP Mode control. | |
Functions | |
void | opennsl_vlan_action_set_t_init (opennsl_vlan_action_set_t *action) LIB_DLL_EXPORTED |
Initialize a VLAN tag action set structure. | |
int | opennsl_vlan_control_port_set (int unit, int port, opennsl_vlan_control_port_t type, int arg) LIB_DLL_EXPORTED |
Set/get miscellaneous port-specific VLAN options. | |
int | opennsl_vlan_control_set (int unit, opennsl_vlan_control_t type, int arg) LIB_DLL_EXPORTED |
Set/get miscellaneous VLAN-specific chip options. | |
int | opennsl_vlan_control_vlan_get (int unit, opennsl_vlan_t vlan, opennsl_vlan_control_vlan_t *control) LIB_DLL_EXPORTED |
Set or retrieve current VLAN properties. | |
int | opennsl_vlan_control_vlan_set (int unit, opennsl_vlan_t vlan, opennsl_vlan_control_vlan_t control) LIB_DLL_EXPORTED |
Set or retrieve current VLAN properties. | |
void | opennsl_vlan_control_vlan_t_init (opennsl_vlan_control_vlan_t *data) LIB_DLL_EXPORTED |
Initialize the opennsl_vlan_control_vlan_t structure. | |
int | opennsl_vlan_create (int unit, opennsl_vlan_t vid) LIB_DLL_EXPORTED |
Allocate and configure a VLAN on the OPENNSL device. | |
int | opennsl_vlan_default_get (int unit, opennsl_vlan_t *vid_ptr) LIB_DLL_EXPORTED |
Get the default VLAN ID. | |
int | opennsl_vlan_default_set (int unit, opennsl_vlan_t vid) LIB_DLL_EXPORTED |
Set the default VLAN ID. | |
int | opennsl_vlan_destroy (int unit, opennsl_vlan_t vid) LIB_DLL_EXPORTED |
Deallocate VLAN from the OPENNSL device. | |
int | opennsl_vlan_destroy_all (int unit) LIB_DLL_EXPORTED |
Destroy all VLANs except the default VLAN. | |
int | opennsl_vlan_gport_add (int unit, opennsl_vlan_t vlan, opennsl_gport_t port, int flags) LIB_DLL_EXPORTED |
Add a virtual or physical port to the specified VLAN. | |
int | opennsl_vlan_gport_delete (int unit, opennsl_vlan_t vlan, opennsl_gport_t port) LIB_DLL_EXPORTED |
Remove a virtual or physical port from the specified VLAN. | |
int | opennsl_vlan_gport_delete_all (int unit, opennsl_vlan_t vlan) LIB_DLL_EXPORTED |
Removes all virtual and physical port from the specified VLAN. | |
int | opennsl_vlan_gport_get (int unit, opennsl_vlan_t vlan, opennsl_gport_t port, int *flags) LIB_DLL_EXPORTED |
Get a virtual or physical port from the specified VLAN. | |
int | opennsl_vlan_list (int unit, opennsl_vlan_data_t **listp, int *countp) LIB_DLL_EXPORTED |
Returns an array of defined VLANs and their port bitmaps. | |
int | opennsl_vlan_list_destroy (int unit, opennsl_vlan_data_t *list, int count) LIB_DLL_EXPORTED |
Destroy a list returned by opennsl_vlan_list. | |
int | opennsl_vlan_port_add (int unit, opennsl_vlan_t vid, opennsl_pbmp_t pbmp, opennsl_pbmp_t ubmp) LIB_DLL_EXPORTED |
Add ports to the specified VLAN. | |
int | opennsl_vlan_port_create (int unit, opennsl_vlan_port_t *vlan_port) LIB_DLL_EXPORTED |
Create a layer 2 logical port. | |
int | opennsl_vlan_port_destroy (int unit, opennsl_gport_t gport) LIB_DLL_EXPORTED |
Destroy a layer 2 logical port. | |
int | opennsl_vlan_port_find (int unit, opennsl_vlan_port_t *vlan_port) LIB_DLL_EXPORTED |
Get/find a layer 2 logical port given the GPORT ID or match criteria. | |
int | opennsl_vlan_port_get (int unit, opennsl_vlan_t vid, opennsl_pbmp_t *pbmp, opennsl_pbmp_t *ubmp) LIB_DLL_EXPORTED |
Retrieves a list of the member ports of an existing VLAN. | |
int | opennsl_vlan_port_remove (int unit, opennsl_vlan_t vid, opennsl_pbmp_t pbmp) LIB_DLL_EXPORTED |
Remove ports from a specified VLAN. | |
void | opennsl_vlan_port_t_init (opennsl_vlan_port_t *vlan_port) LIB_DLL_EXPORTED |
Initialize the VLAN port structure. | |
int | opennsl_vlan_stat_get (int unit, opennsl_vlan_t vlan, opennsl_cos_t cos, opennsl_vlan_stat_t stat, uint64 *val) LIB_DLL_EXPORTED |
Extract per-VLAN statistics from the chip. | |
int | opennsl_vlan_stat_set (int unit, opennsl_vlan_t vlan, opennsl_cos_t cos, opennsl_vlan_stat_t stat, uint64 val) LIB_DLL_EXPORTED |
Set the specified statistic to the indicated value for the specified VLAN. | |
int | opennsl_vlan_translate_egress_action_add (int unit, int port_class, opennsl_vlan_t outer_vlan, opennsl_vlan_t inner_vlan, opennsl_vlan_action_set_t *action) LIB_DLL_EXPORTED |
Add an entry to the egress VLAN Translation table and assign VLAN actions. | |
int | opennsl_vlan_translate_egress_action_get (int unit, int port_class, opennsl_vlan_t outer_vlan, opennsl_vlan_t inner_vlan, opennsl_vlan_action_set_t *action) LIB_DLL_EXPORTED |
Get the assigned VLAN actions for egress VLAN translation on the given port class and VLAN tags. | |
#define OPENNSL_VLAN_PORT_INNER_VLAN_PRESERVE 0x00000004 |
Preserve the inner VLAN tag (by default it is stripped).
Definition at line 681 of file vlan.h.
Referenced by initial_qos_service_init().
#define OPENNSL_VLAN_PORT_OUTER_VLAN_PRESERVE 0x00000100 |
Preserve the outer VLAN tag (by default it is stripped).
Definition at line 684 of file vlan.h.
Referenced by initial_qos_service_init().
#define OPENNSL_VLAN_PORT_REPLACE 0x00000001 |
#define OPENNSL_VLAN_PORT_WITH_ID 0x00000002 |
typedef enum opennsl_vlan_control_port_e opennsl_vlan_control_port_t |
opennsl_vlan_control_port_t
typedef enum opennsl_vlan_control_e opennsl_vlan_control_t |
opennsl_vlan_control_t
typedef struct opennsl_vlan_control_vlan_s opennsl_vlan_control_vlan_t |
This structure contains the configuration of a VLAN.
typedef struct opennsl_vlan_data_s opennsl_vlan_data_t |
Initialize a VLAN data information structure.
typedef enum opennsl_vlan_forward_e opennsl_vlan_forward_t |
Per VLAN forwarding behavior.
typedef enum opennsl_vlan_mcast_flood_e opennsl_vlan_mcast_flood_t |
VLAN multicast flood modes.
typedef enum opennsl_vlan_port_match_e opennsl_vlan_port_match_t |
Logical layer 2 port match criteria.
typedef struct opennsl_vlan_port_s opennsl_vlan_port_t |
Layer 2 Logical port type.
Per VLAN Protocol Packet control.
A protocol packet type is copied to CPU if the packet control value is set to VLAN_PROTO_PKT_TOCPU_ENABLE. Additionally the control can be set to one of VLAN_PROTO_PKT_FORWARD_ENABLE, VLAN_PROTO_PKT_DROP_ENABLE, or VLAN_PROTO_PKT_FLOOD_ENABLE to forward, drop or flood in VLAN respectively.
typedef enum opennsl_vlan_stat_e opennsl_vlan_stat_t |
Types of statistics that are maintained per VLAN.
typedef enum opennsl_vlan_urpf_mode_e opennsl_vlan_urpf_mode_t |
Per VLAN URPF Mode setting.
typedef enum opennsl_vlan_vp_mc_ctrl_e opennsl_vlan_vp_mc_ctrl_t |
Per VLAN VP Mode control.
opennsl_vlan_control_t
enum opennsl_vlan_stat_e |
Types of statistics that are maintained per VLAN.
void opennsl_vlan_action_set_t_init | ( | opennsl_vlan_action_set_t * | action | ) |
Initialize a VLAN tag action set structure.
action | [IN,OUT] Pointer to VLAN tag action set structure to initialize. |
None. |
Referenced by initial_qos_service_vlan_action_set().
int opennsl_vlan_control_port_set | ( | int | unit, |
int | port, | ||
opennsl_vlan_control_port_t | type, | ||
int | arg | ||
) |
Set/get miscellaneous port-specific VLAN options.
unit | [IN] Unit number. |
port | [IN] Device or logical port number |
type | [IN] A value from the opennsl_vlan_control_port_t enumerated list |
arg | [IN] (for _set) A parameter whose meaning is dependent on 'type' |
OPENNSL_E_UNAVAIL | Feature not supported. |
OPENNSL_E_XXX |
int opennsl_vlan_control_set | ( | int | unit, |
opennsl_vlan_control_t | type, | ||
int | arg | ||
) |
Set/get miscellaneous VLAN-specific chip options.
unit | [IN] Unit number. |
type | [IN] A value from the opennsl_vlan_control_t enumerated list |
arg | [IN] (for _set) A parameter whose meaning is dependent on 'type' |
OPENNSL_E_UNAVAIL | Feature not supported. |
OPENNSL_E_XXX |
int opennsl_vlan_control_vlan_get | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_vlan_control_vlan_t * | control | ||
) |
Set or retrieve current VLAN properties.
unit | [IN] Unit number. |
vlan | [IN] VLAN |
control | [OUT] structure which contains VLAN property, see opennsl_vlan_control_vlan_t =opennsl_vlan_control_vlan_t |
OPENNSL_E_NONE | Operation completed successfully |
OPENNSL_E_UNAVAIL | Operation not supported |
OPENNSL_E_XXX | Operation failed. |
int opennsl_vlan_control_vlan_set | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_vlan_control_vlan_t | control | ||
) |
Set or retrieve current VLAN properties.
unit | [IN] Unit number. |
vlan | [IN] VLAN |
control | [IN] structure which contains VLAN property, see opennsl_vlan_control_vlan_t =opennsl_vlan_control_vlan_t |
OPENNSL_E_NONE | Operation completed successfully |
OPENNSL_E_UNAVAIL | Operation not supported |
OPENNSL_E_XXX | Operation failed. |
void opennsl_vlan_control_vlan_t_init | ( | opennsl_vlan_control_vlan_t * | data | ) |
Initialize the opennsl_vlan_control_vlan_t structure.
data | [IN,OUT] Pointer to the structure to be initialized |
int opennsl_vlan_create | ( | int | unit, |
opennsl_vlan_t | vid | ||
) |
Allocate and configure a VLAN on the OPENNSL device.
unit | [IN] Unit number. |
vid | [IN] VLAN ID |
OPENNSL_E_NONE | Success or when the default VLAN is created, even if it already exists. |
OPENNSL_E_XXX | |
OPENNSL_E_EXISTS | VLAN ID already in use. |
Referenced by example_create_l3_intf(), example_open_vlan_per_mc(), example_stg_create(), example_vlan_port_add(), and vlan_create_add_port().
int opennsl_vlan_default_get | ( | int | unit, |
opennsl_vlan_t * | vid_ptr | ||
) |
Get the default VLAN ID.
unit | [IN] Unit number. |
vid_ptr | [OUT] Current default VLAN ID |
OPENNSL_E_NONE | Success. |
int opennsl_vlan_default_set | ( | int | unit, |
opennsl_vlan_t | vid | ||
) |
Set the default VLAN ID.
unit | [IN] Unit number. |
vid | [IN] New default VLAN ID |
OPENNSL_E_XXX |
int opennsl_vlan_destroy | ( | int | unit, |
opennsl_vlan_t | vid | ||
) |
Deallocate VLAN from the OPENNSL device.
unit | [IN] Unit number. |
vid | [IN] VLAN ID |
OPENNSL_E_BADID | Cannot remove default VLAN |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX | |
Referenced by revert_stg().
int opennsl_vlan_destroy_all | ( | int | unit | ) |
Destroy all VLANs except the default VLAN.
unit | [IN] Unit number. |
OPENNSL_E_XXX |
int opennsl_vlan_gport_add | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_gport_t | port, | ||
int | flags | ||
) |
Add a virtual or physical port to the specified VLAN.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID |
port | [IN] Virtual or physical port to be added to the VLAN |
flags | [IN] Control flags. See =OPENNSL_VLAN_PORT_t |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
Referenced by example_add_vlan_on_port(), and example_create_l3_intf().
int opennsl_vlan_gport_delete | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_gport_t | port | ||
) |
Remove a virtual or physical port from the specified VLAN.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID |
port | [IN] Virtual or physical port to be removed from the VLAN |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
int opennsl_vlan_gport_delete_all | ( | int | unit, |
opennsl_vlan_t | vlan | ||
) |
Removes all virtual and physical port from the specified VLAN.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
int opennsl_vlan_gport_get | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_gport_t | port, | ||
int * | flags | ||
) |
Get a virtual or physical port from the specified VLAN.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID |
port | [IN] Virtual or physical port to get VLAN information |
flags | [OUT] Control flags. See =OPENNSL_VLAN_PORT_t |
OPENNSL_E_NOT_FOUND | VLAN ID not in use or port is not a member |
OPENNSL_E_XXX |
int opennsl_vlan_list | ( | int | unit, |
opennsl_vlan_data_t ** | listp, | ||
int * | countp | ||
) |
Returns an array of defined VLANs and their port bitmaps.
If by pbmp, then only VLANs which contain at least one of the specified ports are listed.
unit | [IN] Unit number. |
listp | [OUT] Place where pointer to return array will be stored, which will be NULL if there are zero VLANs defined. |
countp | [OUT] Place where number of entries in array will be stored, which will be 0 if there are zero VLANs defined. |
OPENNSL_E_MEMORY | Out of system memory. |
OPENNSL_E_XXX |
int opennsl_vlan_list_destroy | ( | int | unit, |
opennsl_vlan_data_t * | list, | ||
int | count | ||
) |
Destroy a list returned by opennsl_vlan_list.
unit | [IN] Unit number. |
list | [IN] List returned by opennsl_vlan_list |
count | [IN] Count returned by opennsl_vlan_list |
OPENNSL_E_NONE | Success. |
int opennsl_vlan_port_add | ( | int | unit, |
opennsl_vlan_t | vid, | ||
opennsl_pbmp_t | pbmp, | ||
opennsl_pbmp_t | ubmp | ||
) |
Add ports to the specified VLAN.
unit | [IN] Unit number. |
vid | [IN] VLAN ID |
pbmp | [IN] Port bitmap for members of VLAN |
ubmp | [IN] Port bitmap for untagged members of VLAN |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
Referenced by example_stg_create(), example_switch_default_vlan_config(), example_vlan_port_add(), main(), and vlan_create_add_port().
int opennsl_vlan_port_create | ( | int | unit, |
opennsl_vlan_port_t * | vlan_port | ||
) |
Create a layer 2 logical port.
unit | [IN] Unit number. |
vlan_port | [IN,OUT] Layer 2 Logical port. |
OPENNSL_E_XXX |
Referenced by example_vlan_inLif_create(), and initial_qos_service().
int opennsl_vlan_port_destroy | ( | int | unit, |
opennsl_gport_t | gport | ||
) |
Destroy a layer 2 logical port.
unit | [IN] Unit number. |
gport | [IN] Gport |
OPENNSL_E_XXX |
Referenced by initial_qos_service_cleanup().
int opennsl_vlan_port_find | ( | int | unit, |
opennsl_vlan_port_t * | vlan_port | ||
) |
Get/find a layer 2 logical port given the GPORT ID or match criteria.
unit | [IN] Unit number. |
vlan_port | [IN,OUT] Layer 2 logical port |
OPENNSL_E_XXX |
int opennsl_vlan_port_get | ( | int | unit, |
opennsl_vlan_t | vid, | ||
opennsl_pbmp_t * | pbmp, | ||
opennsl_pbmp_t * | ubmp | ||
) |
Retrieves a list of the member ports of an existing VLAN.
unit | [IN] Unit number. |
vid | [IN] VLAN ID |
pbmp | [OUT] Port bitmap for members of VLAN |
ubmp | [OUT] Port bitmap for untagged members of VLAN |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
int opennsl_vlan_port_remove | ( | int | unit, |
opennsl_vlan_t | vid, | ||
opennsl_pbmp_t | pbmp | ||
) |
Remove ports from a specified VLAN.
unit | [IN] Unit number. |
vid | [IN] VLAN ID |
pbmp | [IN] Port bitmap for members of VLAN |
OPENNSL_E_NOT_FOUND | VLAN ID not in use |
OPENNSL_E_XXX |
Referenced by example_policer_test().
void opennsl_vlan_port_t_init | ( | opennsl_vlan_port_t * | vlan_port | ) |
Initialize the VLAN port structure.
vlan_port | [IN,OUT] Layer 2 Logical port. |
OPENNSL_E_XXX |
Referenced by example_vlan_inLif_create(), and initial_qos_service_init().
int opennsl_vlan_stat_get | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_cos_t | cos, | ||
opennsl_vlan_stat_t | stat, | ||
uint64 * | val | ||
) |
Extract per-VLAN statistics from the chip.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID. |
cos | [IN] CoS or priority |
stat | [IN] Type of the counter to retrieve. |
val | [OUT] Pointer to a counter value. |
OPENNSL_E_XXX |
int opennsl_vlan_stat_set | ( | int | unit, |
opennsl_vlan_t | vlan, | ||
opennsl_cos_t | cos, | ||
opennsl_vlan_stat_t | stat, | ||
uint64 | val | ||
) |
Set the specified statistic to the indicated value for the specified VLAN.
unit | [IN] Unit number. |
vlan | [IN] VLAN ID. |
cos | [IN] CoS or priority |
stat | [IN] Type of the counter to set. |
val | [IN] New counter value. |
OPENNSL_E_XXX |
int opennsl_vlan_translate_egress_action_add | ( | int | unit, |
int | port_class, | ||
opennsl_vlan_t | outer_vlan, | ||
opennsl_vlan_t | inner_vlan, | ||
opennsl_vlan_action_set_t * | action | ||
) |
Add an entry to the egress VLAN Translation table and assign VLAN actions.
unit | [IN] Unit number. |
port_class | [IN] Port class |
outer_vlan | [IN] Outer VLAN ID |
inner_vlan | [IN] Inner VLAN ID |
action | [IN] VLAN tag action set, as specified in =OPENNSL_VLAN_ACTION_SET_t |
OPENNSL_E_UNAVAIL | Not supported. |
OPENNSL_E_XXX |
Referenced by initial_qos_service_vlan_action_set().
int opennsl_vlan_translate_egress_action_get | ( | int | unit, |
int | port_class, | ||
opennsl_vlan_t | outer_vlan, | ||
opennsl_vlan_t | inner_vlan, | ||
opennsl_vlan_action_set_t * | action | ||
) |
Get the assigned VLAN actions for egress VLAN translation on the given port class and VLAN tags.
unit | [IN] Unit number. |
port_class | [IN] Port class |
outer_vlan | [IN] Outer VLAN ID |
inner_vlan | [IN] Inner VLAN ID |
action | [IN,OUT] VLAN tag action set, as specified in =OPENNSL_VLAN_ACTION_SET_t |
OPENNSL_E_UNAVAIL | Not supported. |
OPENNSL_E_XXX |