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

srv6.h (9511B)


      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_SRV6_H__
     14 #define __BCM_SRV6_H__
     15 
     16 #include <bcm/types.h>
     17 
     18 /* SRv6 SID initiator flags */
     19 #define BCM_SRV6_SID_INITIATOR_WITH_ID  (1 << 0)   /* if set, the tunnel_id will
     20                                                       be given by user as input,
     21                                                       otherwise output from
     22                                                       alloc_manager */
     23 #define BCM_SRV6_SID_INITIATOR_REPLACE  (1 << 1)   /* Replace existing entry,
     24                                                       update existing Tunnel */
     25 
     26 /* SRv6 SRH base initiator flags */
     27 #define BCM_SRV6_SRH_BASE_INITIATOR_WITH_ID (1 << 0)   /* if set, the tunnel_id
     28                                                           will be given by user
     29                                                           as input, otherwise
     30                                                           output from
     31                                                           alloc_manager */
     32 #define BCM_SRV6_SRH_BASE_INITIATOR_REPLACE (1 << 1)   /* Replace existing
     33                                                           entry, update existing
     34                                                           Tunnel */
     35 #define BCM_SRV6_SRH_BASE_INITIATOR_STAT_ENABLE (1 << 2)   /* if set, SRv6 SRH Base
     36                                                           supports statistics */
     37 
     38 /* SRv6 terminator next protocol mapping flags */
     39 #define BCM_SRV6_TERMINATOR_NEXT_PROTOCOL_REPLACE (1 << 0)   /* Replace existing entry */
     40 
     41 /* 
     42  * Structure that is used in SRv6 SID initiator APIs, for managing device
     43  * behavior at SRv6 Tunnel Encapsulation
     44  */
     45 typedef struct bcm_srv6_sid_initiator_info_s {
     46     uint32 flags;                       /* BCM_SRV6_SID_INITIATOR_XXX */
     47     bcm_gport_t tunnel_id;              /* Tunnel SRv6 SID initiator object ID */
     48     bcm_ip6_t sid;                      /* SID to encapsulate */
     49     bcm_encap_access_t encap_access;    /* Encapsulation Access stage */
     50     bcm_if_t next_encap_id;             /* Next pointer interface ID, can be
     51                                            next SID initiator or
     52                                            next-encapsulation interface */
     53 } bcm_srv6_sid_initiator_info_t;
     54 
     55 /* 
     56  * Structure that is used in SRv6 SRH Base initiator APIs, for managing
     57  * device behavior at SRv6 Tunnel Encapsulation
     58  */
     59 typedef struct bcm_srv6_srh_base_initiator_info_s {
     60     uint32 flags;                       /* BCM_SRV6_SRH_BASE_INITIATOR_XXX */
     61     bcm_gport_t tunnel_id;              /* Tunnel SRv6 SRH base object ID */
     62     int nof_sids;                       /* Number of SIDs in the SID list */
     63     int qos_map_id;                     /* QOS map identifier */
     64     int ttl;                            /* Tunnel header TTL */
     65     int dscp;                           /* Tunnel header DSCP value */
     66     bcm_qos_egress_model_t egress_qos_model; /* Egress qos and ttl model */
     67     bcm_if_t next_encap_id;             /* Next encapsulation ID */
     68 } bcm_srv6_srh_base_initiator_info_t;
     69 
     70 /* Structure for additional info for SRv6 SID initiator traverse */
     71 typedef struct bcm_srv6_sid_initiator_traverse_info_s {
     72     uint32 flags;           /* BCM_SRV6_SID_INITIATOR_XXX */
     73     uint32 traverse_flags;  /* BCM_SRV6_SID_INITIATOR_TRAVERSE_XXX */
     74 } bcm_srv6_sid_initiator_traverse_info_t;
     75 
     76 /* Structure for additional info for SRv6 SID initiator traverse */
     77 typedef struct bcm_srv6_srh_base_initiator_traverse_info_s {
     78     uint32 flags;           /* BCM_SRV6_SRH_BASE_INITIATOR_XXX */
     79     uint32 traverse_flags;  /* BCM_SRV6_SRH_BASE_INITIATOR_TRAVERSE_XXX */
     80 } bcm_srv6_srh_base_initiator_traverse_info_t;
     81 
     82 /* 
     83  * Structure that is used in SRv6 terminator next protocol APIs. Relevant
     84  * in 2-pass ESR USP case only.
     85  */
     86 typedef struct bcm_srv6_terminator_next_protocol_mapping_s {
     87     uint32 flags;           /* BCM_SRV6_TERMINATOR_NEXT_PROTOCOL_XXX */
     88     int next_protocol;      /* Protocol above SRv6 */
     89     bcm_gport_t encap_id;   /* Encapsulation id */
     90     bcm_gport_t port;       /* Gport destination */
     91 } bcm_srv6_terminator_next_protocol_mapping_t;
     92 
     93 /* 
     94  * Structure for additional info for terminator next protocol mapping
     95  * traverse
     96  */
     97 typedef struct bcm_srv6_terminator_next_protocol_traverse_info_s {
     98     uint32 flags;           /* BCM_SRV6_TERMINATOR_NEXT_PROTOCOL_XXX */
     99     uint32 traverse_flags;  /* BCM_SRV6_TERMINATOR_NEXT_PROTOCOL_TRAVERSE_XXX */
    100 } bcm_srv6_terminator_next_protocol_traverse_info_t;
    101 
    102 #ifndef BCM_HIDE_DISPATCHABLE
    103 
    104 /* 
    105  * Function links SIDs or other objects (such as IPv6) as linked list
    106  * entries
    107  *                 int unit [input] - device id
    108  *                 bcm_srv6_sid_initiator_info_t info [input/output] -
    109  * structure which describes the SID list object settings
    110  */
    111 extern int bcm_srv6_sid_initiator_create(
    112     int unit, 
    113     bcm_srv6_sid_initiator_info_t *info);
    114 
    115 /* 
    116  * Function gets the SID list object properties
    117  *                 int unit [input] - device id
    118  *                 bcm_srv6_sid_initiator_info_t info [output] -
    119  * structure which describes the SID list object settings
    120  */
    121 extern int bcm_srv6_sid_initiator_get(
    122     int unit, 
    123     bcm_srv6_sid_initiator_info_t *info);
    124 
    125 /* 
    126  * Function deletes the SID list association to the given Tunnel_Id
    127  *                 int unit [input] - device id
    128  *                 bcm_srv6_sid_initiator_info_t info [input] - structure
    129  * which describes the SID list object settings
    130  */
    131 extern int bcm_srv6_sid_initiator_delete(
    132     int unit, 
    133     bcm_srv6_sid_initiator_info_t *info);
    134 
    135 #endif /* BCM_HIDE_DISPATCHABLE */
    136 
    137 /* Srv6 callback function prototype */
    138 typedef int (*bcm_srv6_sid_initiator_traverse_cb)(
    139     int unit, 
    140     bcm_srv6_sid_initiator_info_t *info, 
    141     void *user_data);
    142 
    143 #ifndef BCM_HIDE_DISPATCHABLE
    144 
    145 /* 
    146  * Function traverses all tunnel_ids, that were allocated and runs a
    147  * callback function provided by the user on this data, along with
    148  * user_data.
    149  */
    150 extern int bcm_srv6_sid_initiator_traverse(
    151     int unit, 
    152     bcm_srv6_sid_initiator_traverse_info_t additional_info, 
    153     bcm_srv6_sid_initiator_traverse_cb cb, 
    154     void *user_data);
    155 
    156 /* Function creates an SRv6 SRH Base with an optional link to last SID */
    157 extern int bcm_srv6_srh_base_initiator_create(
    158     int unit, 
    159     bcm_srv6_srh_base_initiator_info_t *info);
    160 
    161 /* Function gets the SRv6 SRH Base properties */
    162 extern int bcm_srv6_srh_base_initiator_get(
    163     int unit, 
    164     bcm_srv6_srh_base_initiator_info_t *info);
    165 
    166 /* Function deletes the SRv6 SRH Base and optionally last SID association */
    167 extern int bcm_srv6_srh_base_initiator_delete(
    168     int unit, 
    169     bcm_srv6_srh_base_initiator_info_t *info);
    170 
    171 #endif /* BCM_HIDE_DISPATCHABLE */
    172 
    173 /* Srv6 callback function prototype */
    174 typedef int (*bcm_srv6_srh_base_initiator_traverse_cb)(
    175     int unit, 
    176     bcm_srv6_srh_base_initiator_info_t *info, 
    177     void *user_data);
    178 
    179 #ifndef BCM_HIDE_DISPATCHABLE
    180 
    181 /* 
    182  * Function traverses all tunnel_ids, that were allocated to SRv6 Tunnels
    183  * and runs a callback function provided by the user on this data, along
    184  * with user_data.
    185  */
    186 extern int bcm_srv6_srh_base_initiator_traverse(
    187     int unit, 
    188     bcm_srv6_srh_base_initiator_traverse_info_t additional_info, 
    189     bcm_srv6_srh_base_initiator_traverse_cb cb, 
    190     void *user_data);
    191 
    192 /* 
    193  * Creation and configuration of a Next Protocol (above SRv6) mapping to
    194  * port and Encapsulation for 2nd Pass ESR USP
    195  */
    196 extern int bcm_srv6_terminator_next_protocol_add(
    197     int unit, 
    198     bcm_srv6_terminator_next_protocol_mapping_t *info);
    199 
    200 /* 
    201  * Function returns the port and encap_id, that were mapped by the
    202  * next_protocol (above SRv6 layer)
    203  */
    204 extern int bcm_srv6_terminator_next_protocol_get(
    205     int unit, 
    206     bcm_srv6_terminator_next_protocol_mapping_t *info);
    207 
    208 /* 
    209  * Function deletes the port and encap_id that were mapped by the
    210  * next_protocol (above SRv6 layer)
    211  */
    212 extern int bcm_srv6_terminator_next_protocol_delete(
    213     int unit, 
    214     bcm_srv6_terminator_next_protocol_mapping_t *info);
    215 
    216 #endif /* BCM_HIDE_DISPATCHABLE */
    217 
    218 /* Srv6 user call back function */
    219 typedef int (*bcm_srv6_terminator_next_protocol_traverse_cb)(
    220     int unit, 
    221     bcm_srv6_terminator_next_protocol_mapping_t *info, 
    222     void *user_data);
    223 
    224 #ifndef BCM_HIDE_DISPATCHABLE
    225 
    226 /* 
    227  * Function traverses all next_protocols mappings and runs a callback
    228  * function provided by the user on this data, along with user_data.
    229  */
    230 extern int bcm_srv6_terminator_next_protocol_traverse(
    231     int unit, 
    232     bcm_srv6_terminator_next_protocol_traverse_info_t additional_info, 
    233     bcm_srv6_terminator_next_protocol_traverse_cb cb, 
    234     void *user_data);
    235 
    236 #endif /* BCM_HIDE_DISPATCHABLE */
    237 
    238 /* Initialize a bcm_srv6_srh_base_initiator_info_t structure. */
    239 extern void bcm_srv6_srh_base_initiator_info_t_init(
    240     bcm_srv6_srh_base_initiator_info_t *info);
    241 
    242 /* Initialize a bcm_srv6_sid_initiator_info_t structure. */
    243 extern void bcm_srv6_sid_initiator_info_t_init(
    244     bcm_srv6_sid_initiator_info_t *info);
    245 
    246 /* Initialize a bcm_srv6_terminator_next_protocol_mapping_t structure. */
    247 extern void bcm_srv6_terminator_next_protocol_mapping_t_init(
    248     bcm_srv6_terminator_next_protocol_mapping_t *info);
    249 
    250 #endif /* __BCM_SRV6_H__ */