openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

qos.h (9686B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  * 
      8  * DO NOT EDIT THIS FILE!
      9  * This file is auto-generated.
     10  * Edits to this file will be lost when it is regenerated.
     11  */
     12 
     13 #ifndef __BCM_QOS_H__
     14 #define __BCM_QOS_H__
     15 
     16 #include <bcm/types.h>
     17 #include <bcm/multicast.h>
     18 
     19 /* QoS Configuration Flags. */
     20 #define BCM_QOS_MAP_WITH_ID             0x0001     
     21 #define BCM_QOS_MAP_REPLACE             0x0002     
     22 #define BCM_QOS_MAP_L2                  0x0004     
     23 #define BCM_QOS_MAP_L2_OUTER_TAG        BCM_QOS_MAP_L2 
     24 #define BCM_QOS_MAP_L2_INNER_TAG        0x0008     
     25 #define BCM_QOS_MAP_L2_UNTAGGED         0x0010     
     26 #define BCM_QOS_MAP_L2_VLAN_PCP         0x0020     
     27 #define BCM_QOS_MAP_L3                  0x0040     
     28 #define BCM_QOS_MAP_IPV4                BCM_QOS_MAP_L3 
     29 #define BCM_QOS_MAP_IPV6                0x0080     
     30 #define BCM_QOS_MAP_MPLS                0x0100     
     31 #define BCM_QOS_MAP_ENCAP               0x0200     
     32 #define BCM_QOS_MAP_INGRESS             0x0400     
     33 #define BCM_QOS_MAP_EGRESS              0x0800     
     34 #define BCM_QOS_MAP_MPLS_ELSP           0x1000     
     35 #define BCM_QOS_MAP_MIM_ITAG            0x2000     
     36 #define BCM_QOS_MAP_QUEUE               0x4000     
     37 #define BCM_QOS_MAP_POLICER             0x8000     
     38 #define BCM_QOS_MAP_PACKET_INVALID      0x10000    
     39 #define BCM_QOS_MAP_IGNORE_OFFSET       0x20000    
     40 #define BCM_QOS_MAP_OPCODE              0x40000    
     41 #define BCM_QOS_MAP_L2_ETAG             0x80000    
     42 #define BCM_QOS_MAP_MPLS_SECOND         BCM_QOS_MAP_L2_ETAG 
     43 #define BCM_QOS_MAP_L2_VLAN_ETAG        0x100000   
     44 #define BCM_QOS_MAP_MPLS_PHP            0x200000   
     45 #define BCM_QOS_MAP_SUBPORT             0x400000   
     46 #define BCM_QOS_MAP_PORT                BCM_QOS_MAP_SUBPORT 
     47 #define BCM_QOS_MAP_L3_L2               0x800000   
     48 #define BCM_QOS_MAP_VFT                 0x1000000  
     49 #define BCM_QOS_MAP_VSAN                0x2000000  
     50 #define BCM_QOS_MAP_RCH                 0x2000000  
     51 #define BCM_QOS_MAP_OAM_PCP             0x4000000  
     52 #define BCM_QOS_MAP_OAM_INTPRI          0x8000000  
     53 #define BCM_QOS_MAP_OAM_OUTER_VLAN_PCP  0x10000000 
     54 #define BCM_QOS_MAP_OAM_INNER_VLAN_PCP  0x20000000 
     55 #define BCM_QOS_MAP_OAM_MPLS_EXP        0x40000000 
     56 #define BCM_QOS_MAP_REMARK              0x10000000 
     57 #define BCM_QOS_MAP_ECN                 0x20000000 
     58 #define BCM_QOS_MAP_PHB                 0x40000000 
     59 #define BCM_QOS_MAP_REPLICATION         0x80000000 
     60 #define BCM_QOS_MAP_MIML                BCM_QOS_MAP_MIM_ITAG 
     61 #define BCM_QOS_MAP_ENCAP_INTPRI_COLOR  BCM_QOS_MAP_VFT 
     62 
     63 /* Special qos map values */
     64 #define BCM_QOS_OPCODE_PRESERVE -4         /* Dedicated opcode for QoS preserve. */
     65 
     66 /* QoS Map structure */
     67 typedef struct bcm_qos_map_s {
     68     uint8 pkt_pri;              /* Packet priority */
     69     uint8 pkt_cfi;              /* Packet CFI */
     70     int dscp;                   /* Packet DSCP */
     71     int exp;                    /* Packet EXP */
     72     int int_pri;                /* Internal priority */
     73     bcm_color_t color;          /* Color */
     74     int remark_int_pri;         /* (internal) remarking priority */
     75     bcm_color_t remark_color;   /* (internal) remark color */
     76     int policer_offset;         /* Offset based on pri/cos to fetch a policer */
     77     int queue_offset;           /* Offset based on int_pri to fetch cosq for
     78                                    subscriber ports */
     79     int port_offset;            /* Offset based on port connection for indexing
     80                                    into the action table */
     81     uint8 etag_pcp;             /* ETAG PCP field */
     82     uint8 etag_de;              /* ETAG DE field */
     83     int counter_offset;         /* Offset based on priority for indexing into
     84                                    the loss measurement counter table */
     85     int inherited_dscp_exp;     /* Inherited DSCP EXP value */
     86     uint32 opcode;              /* Set QOS Map Opcode ID */
     87 } bcm_qos_map_t;
     88 
     89 /* qos ingress model type */
     90 typedef enum bcm_qos_ingress_model_type_e {
     91     bcmQosIngressModelInvalid = 0,      /* qos model invalid */
     92     bcmQosIngressModelShortpipe = 1,    /* qos model is short pipe */
     93     bcmQosIngressModelPipe = 2,         /* qos model is pipe */
     94     bcmQosIngressModelUniform = 3,      /* qos model is uniform */
     95     bcmQosIngressModelStuck = 4         /* qos model is stuck */
     96 } bcm_qos_ingress_model_type_t;
     97 
     98 /* qos ingress ecn model type */
     99 typedef enum bcm_qos_ingress_ecn_model_type_e {
    100     bcmQosIngressEcnModelInvalid = 0,   /* qos ecn model is invalid */
    101     bcmQosIngressEcnModelEligible = 1   /* qos ecn model is eligible */
    102 } bcm_qos_ingress_ecn_model_type_t;
    103 
    104 /* Ingress QoS model structure */
    105 typedef struct bcm_qos_ingress_model_s {
    106     bcm_qos_ingress_model_type_t ingress_phb; /* ingress PHB model */
    107     bcm_qos_ingress_model_type_t ingress_remark; /* ingress remark model */
    108     bcm_qos_ingress_model_type_t ingress_ttl; /* ingress ttl model */
    109     bcm_qos_ingress_ecn_model_type_t ingress_ecn; /* ingress ecn model */
    110 } bcm_qos_ingress_model_t;
    111 
    112 /* qos egress model type */
    113 typedef enum bcm_qos_egress_model_type_e {
    114     bcmQosEgressModelUniform = 0,       /* use previous layer qos */
    115     bcmQosEgressModelPipeNextNameSpace = 1, /* qos egress pipe next name space */
    116     bcmQosEgressModelPipeMyNameSpace = 2, /* qos egress pipe my name space */
    117     bcmQosEgressModelInitial = 3        /* use egress initial qos */
    118 } bcm_qos_egress_model_type_t;
    119 
    120 /* egress QoS model structure */
    121 typedef struct bcm_qos_egress_model_s {
    122     bcm_qos_egress_model_type_t egress_qos; /* egress qos variable */
    123     bcm_qos_egress_model_type_t egress_ttl; /* egress ttl */
    124     uint8 ecn_eligible;                 /* layer ecn is eligible */
    125 } bcm_qos_egress_model_t;
    126 
    127 /* Initialize the QoS Map structure. */
    128 extern void bcm_qos_map_t_init(
    129     bcm_qos_map_t *qos_map);
    130 
    131 /* Initialize the QoS ingress model structure. */
    132 extern void bcm_qos_ingress_model_t_init(
    133     bcm_qos_ingress_model_t *qos_ingress_model);
    134 
    135 /* Initialize the QoS egress model structure. */
    136 extern void bcm_qos_egress_model_t_init(
    137     bcm_qos_egress_model_t *qos_egress_model);
    138 
    139 #ifndef BCM_HIDE_DISPATCHABLE
    140 
    141 /* Initialize the BCM QoS subsystem. */
    142 extern int bcm_qos_init(
    143     int unit);
    144 
    145 /* Detach the QoS software module. */
    146 extern int bcm_qos_detach(
    147     int unit);
    148 
    149 /* bcm_qos_map_create */
    150 extern int bcm_qos_map_create(
    151     int unit, 
    152     uint32 flags, 
    153     int *map_id);
    154 
    155 /* bcm_qos_map_destroy */
    156 extern int bcm_qos_map_destroy(
    157     int unit, 
    158     int map_id);
    159 
    160 /* bcm_qos_map_add */
    161 extern int bcm_qos_map_add(
    162     int unit, 
    163     uint32 flags, 
    164     bcm_qos_map_t *map, 
    165     int map_id);
    166 
    167 /* bcm_qos_map_multi_get */
    168 extern int bcm_qos_map_multi_get(
    169     int unit, 
    170     uint32 flags, 
    171     int map_id, 
    172     int array_size, 
    173     bcm_qos_map_t *array, 
    174     int *array_count);
    175 
    176 /* bcm_qos_map_delete */
    177 extern int bcm_qos_map_delete(
    178     int unit, 
    179     uint32 flags, 
    180     bcm_qos_map_t *map, 
    181     int map_id);
    182 
    183 /* bcm_qos_port_map_set */
    184 extern int bcm_qos_port_map_set(
    185     int unit, 
    186     bcm_gport_t port, 
    187     int ing_map, 
    188     int egr_map);
    189 
    190 /* bcm_qos_port_map_type_get */
    191 extern int bcm_qos_port_map_type_get(
    192     int unit, 
    193     bcm_gport_t port, 
    194     uint32 flags, 
    195     int *map_id);
    196 
    197 /* bcm_qos_port_map_get */
    198 extern int bcm_qos_port_map_get(
    199     int unit, 
    200     bcm_gport_t port, 
    201     int *ing_map, 
    202     int *egr_map);
    203 
    204 /* bcm_qos_port_vlan_map_set */
    205 extern int bcm_qos_port_vlan_map_set(
    206     int unit, 
    207     bcm_port_t port, 
    208     bcm_vlan_t vid, 
    209     int ing_map, 
    210     int egr_map);
    211 
    212 /* bcm_qos_port_vlan_map_get */
    213 extern int bcm_qos_port_vlan_map_get(
    214     int unit, 
    215     bcm_port_t port, 
    216     bcm_vlan_t vid, 
    217     int *ing_map, 
    218     int *egr_map);
    219 
    220 /* bcm_qos_multi_get */
    221 extern int bcm_qos_multi_get(
    222     int unit, 
    223     int array_size, 
    224     int *map_ids_array, 
    225     int *flags_array, 
    226     int *array_count);
    227 
    228 #endif /* BCM_HIDE_DISPATCHABLE */
    229 
    230 typedef enum bcm_qos_map_control_type_e {
    231     bcmQosMapControlRemarkUseNextLayer = 0, /* Remark according to the next layer,
    232                                            otherwise current layer */
    233     bcmQosMapControlPhbUseNextLayer = 1, /* PHB according to the next layer,
    234                                            otherwise current layer. */
    235     bcmQosMapControlCount = 2           /* Always last. Not a usable value. */
    236 } bcm_qos_map_control_type_t;
    237 
    238 #ifndef BCM_HIDE_DISPATCHABLE
    239 
    240 /* Set QOS Map control properties */
    241 extern int bcm_qos_map_control_set(
    242     int unit, 
    243     uint32 map_id, 
    244     uint32 flags, 
    245     bcm_qos_map_control_type_t type, 
    246     uint64 arg);
    247 
    248 /* Get QOS Map control properties */
    249 extern int bcm_qos_map_control_get(
    250     int unit, 
    251     uint32 map_id, 
    252     uint32 flags, 
    253     bcm_qos_map_control_type_t type, 
    254     uint64 *arg);
    255 
    256 /* bcm_qos_map_id_get_by_profile */
    257 extern int bcm_qos_map_id_get_by_profile(
    258     int unit, 
    259     uint32 flags, 
    260     int profile, 
    261     int *map_id);
    262 
    263 #endif /* BCM_HIDE_DISPATCHABLE */
    264 
    265 /* QoS control types */
    266 typedef enum bcm_qos_control_type_e {
    267     bcmQosControlMplsIngressSwapRemarkProfile = 0, /* Egress QoS map Id for MPLS ingress
    268                                            swap cases. */
    269     bcmQosControl__Count = 1            /* Always last. Not a usable value. */
    270 } bcm_qos_control_type_t;
    271 
    272 #ifndef BCM_HIDE_DISPATCHABLE
    273 
    274 /* bcm_qos_control_set */
    275 extern int bcm_qos_control_set(
    276     int unit, 
    277     bcm_qos_control_type_t type, 
    278     int arg);
    279 
    280 /* bcm_qos_control_get */
    281 extern int bcm_qos_control_get(
    282     int unit, 
    283     bcm_qos_control_type_t type, 
    284     int *arg);
    285 
    286 #endif /* BCM_HIDE_DISPATCHABLE */
    287 
    288 #endif /* __BCM_QOS_H__ */