OpenNSL API Guide and Reference Manual
Macros | Enumerations | Functions | Variables
example_qos.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <opennsl/error.h>
#include <opennsl/init.h>
#include <opennsl/port.h>
#include <opennsl/l2.h>
#include <opennsl/vlan.h>
#include <opennsl/switch.h>
#include <opennsl/vswitch.h>
#include <opennsl/qos.h>
#include <examples/util.h>

Go to the source code of this file.

Macros

#define DEFAULT_UNIT   0
 
#define DEFAULT_VLAN   1
 
#define MAC_DA   {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
 
#define MAC_MASK   {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
 

Enumerations

enum  service_type_e {
  match_untag,
  match_otag
}
 
enum  use_de_type_e {
  with_no_use_de,
  with_use_de
}
 

Functions

int initial_qos_service (int unit)
 
int initial_qos_service_cleanup (int unit)
 
int initial_qos_service_init (int unit, opennsl_port_t port_in, opennsl_port_t port_out)
 
int initial_qos_service_vlan_action_set (int unit, int service_type)
 
int main (int argc, char *argv[])
 Main function for QoS application.
 
int qos_map_l2_eg_dft_profile (int unit, int service_type)
 
int qos_pcp_map_create (int unit, int port, int is_use_de)
 

Variables

opennsl_vlan_t down_ovlan1 = 200
 
opennsl_vlan_t down_ovlan2 = 300
 
char example_usage []
 
opennsl_vswitch_cross_connect_t gports_tag
 
opennsl_vswitch_cross_connect_t gports_untag
 
opennsl_vlan_port_t in_vlan_port1
 
opennsl_vlan_port_t in_vlan_port2
 
int internal_color_ctag [8] = {0,0,0,0,1,1,1,1}
 
int internal_color_stag_with_no_use_de [8] = {1,0,1,0,1,0,1,0}
 
int internal_color_stag_with_use_de [8] = {0,1,0,1,0,1,0,1}
 
int internal_pri [8] = {1,2,3,4,5,6,7,7}
 
opennsl_vlan_port_t out_vlan_port1
 
opennsl_vlan_port_t out_vlan_port2
 
int pkt_cfi [8] = {0,1,0,1,0,1,0,1}
 
int pkt_pri [8] = {0,1,2,3,4,5,6,7}
 
int qos_eg_map_id_dft [2]
 
opennsl_vlan_t up_ovlan = 100
 

Macro Definition Documentation

#define DEFAULT_UNIT   0

Definition at line 77 of file example_qos.c.

Referenced by main().

#define DEFAULT_VLAN   1

Definition at line 78 of file example_qos.c.

#define MAC_DA   {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}

Definition at line 79 of file example_qos.c.

#define MAC_MASK   {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}

Definition at line 81 of file example_qos.c.

Enumeration Type Documentation

Enumerator:
match_untag 
match_otag 

Definition at line 104 of file example_qos.c.

Enumerator:
with_no_use_de 
with_use_de 

Definition at line 110 of file example_qos.c.

Function Documentation

int initial_qos_service ( int  unit)
int initial_qos_service_cleanup ( int  unit)
int initial_qos_service_init ( int  unit,
opennsl_port_t  port_in,
opennsl_port_t  port_out 
)
int initial_qos_service_vlan_action_set ( int  unit,
int  service_type 
)
int main ( int  argc,
char *  argv[] 
)

Main function for QoS application.

Parameters
argc,argvcommands line arguments
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 518 of file example_qos.c.

References DEFAULT_UNIT, example_port_default_config(), example_read_user_choice(), example_switch_default_vlan_config(), example_usage, initial_qos_service(), initial_qos_service_init(), NULL, opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_PARAM, opennsl_errmsg, and qos_pcp_map_create().

int qos_map_l2_eg_dft_profile ( int  unit,
int  service_type 
)
int qos_pcp_map_create ( int  unit,
int  port,
int  is_use_de 
)

Variable Documentation

opennsl_vlan_t down_ovlan1 = 200

Definition at line 85 of file example_qos.c.

Referenced by initial_qos_service_init(), and initial_qos_service_vlan_action_set().

opennsl_vlan_t down_ovlan2 = 300

Definition at line 86 of file example_qos.c.

Referenced by initial_qos_service_init(), and initial_qos_service_vlan_action_set().

char example_usage[]
Initial value:
=
"Syntax: example_qos \n\r"
" \n\r"
"Paramaters: None. \n\r"
" \n\r"
"Example: The following command is used to map the TC and DP from the \n\r"
" VLAN tagged packet, with tag ID 100. \n\r"
" \n\r"
" example_qos \n\r"
" \n\r"
"Usage Guidelines: None. \n\r"

Definition at line 65 of file example_qos.c.

Definition at line 88 of file example_qos.c.

Definition at line 88 of file example_qos.c.

opennsl_vlan_port_t in_vlan_port1

Definition at line 87 of file example_qos.c.

opennsl_vlan_port_t in_vlan_port2

Definition at line 87 of file example_qos.c.

int internal_color_ctag[8] = {0,0,0,0,1,1,1,1}

Definition at line 101 of file example_qos.c.

Referenced by qos_pcp_map_create().

int internal_color_stag_with_no_use_de[8] = {1,0,1,0,1,0,1,0}

Definition at line 99 of file example_qos.c.

Referenced by qos_pcp_map_create().

int internal_color_stag_with_use_de[8] = {0,1,0,1,0,1,0,1}

Definition at line 97 of file example_qos.c.

Referenced by qos_pcp_map_create().

int internal_pri[8] = {1,2,3,4,5,6,7,7}

Definition at line 95 of file example_qos.c.

Referenced by qos_pcp_map_create().

opennsl_vlan_port_t out_vlan_port1

Definition at line 87 of file example_qos.c.

Referenced by initial_qos_service_vlan_action_set().

opennsl_vlan_port_t out_vlan_port2

Definition at line 87 of file example_qos.c.

Referenced by initial_qos_service_vlan_action_set().

int pkt_cfi[8] = {0,1,0,1,0,1,0,1}

Definition at line 93 of file example_qos.c.

Referenced by qos_pcp_map_create().

int pkt_pri[8] = {0,1,2,3,4,5,6,7}

Definition at line 91 of file example_qos.c.

Referenced by qos_pcp_map_create().

int qos_eg_map_id_dft[2]
opennsl_vlan_t up_ovlan = 100

Definition at line 84 of file example_qos.c.

Referenced by initial_qos_service_init().