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

niv.h (7217B)


      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  */
      9 
     10 #ifndef __BCM_NIV_H__
     11 #define __BCM_NIV_H__
     12 
     13 #if defined(INCLUDE_L3)
     14 
     15 #include <bcm/types.h>
     16 
     17 /* BCM_NIV_* flags. */
     18 #define BCM_NIV_PORT_WITH_ID    (1 << 0)   /* create niv port with specified ID */
     19 
     20 /* BCM_NIV_* flags. */
     21 #define BCM_NIV_PORT_REPLACE    (1 << 1)   /* Replace existing entry */
     22 
     23 /* BCM_NIV_* flags. */
     24 #define BCM_NIV_PORT_MULTICAST  (1 << 2)   /* Create multicast type */
     25 
     26 /* BCM_NIV_* flags. */
     27 #define BCM_NIV_PORT_MATCH_NONE (1 << 3)   /* No matching criteria */
     28 
     29 /* BCM_NIV_* flags. */
     30 #define BCM_NIV_VNTAG_L_BIT_FORCE_1 (1 << 4)   /* Allow frames head back */
     31 
     32 /* BCM_NIV_* flags. */
     33 #define BCM_NIV_PORT_MATCH_DO_NOT_ADD   (1 << 5)   /* Do not add match criteria */
     34 
     35 /* NIV port type. */
     36 typedef struct bcm_niv_port_s {
     37     uint32 flags;                   /* BCM_NIV_PORT_xxx. */
     38     bcm_gport_t niv_port_id;        /* GPORT identifier. */
     39     bcm_gport_t port;               /* Physical port / trunk */
     40     uint16 virtual_interface_id;    /* Virtual Interface Identifier. */
     41     bcm_vlan_t match_vlan;          /* Outer VLAN ID to match. */
     42     uint16 match_service_tpid;      /* Ingress SD-tag TPID. */
     43     uint32 if_class;                /* Interface class ID. */
     44 } bcm_niv_port_t;
     45 
     46 /* BCM_NIV_FORWARD_* flags. */
     47 #define BCM_NIV_FORWARD_REPLACE (1 << 1)   /* Replace existing entry */
     48 
     49 /* BCM_NIV_FORWARD_* flags. */
     50 #define BCM_NIV_FORWARD_MULTICAST   (1 << 2)   /* Create multicast type */
     51 
     52 /* NIV forwarding table. */
     53 typedef struct bcm_niv_forward_s {
     54     uint32 flags;                   /* BCM_NIV_FORWARD_xxx. */
     55     uint16 name_space;              /* NIV Namespace. */
     56     uint16 virtual_interface_id;    /* Virtual Interface Identifier. */
     57     bcm_gport_t dest_port;          /* Destination Gport. */
     58     bcm_multicast_t dest_multicast; /* Destination Multicast Group. */
     59 } bcm_niv_forward_t;
     60 
     61 /* BCM_NIV_EGRESS_* flags. */
     62 #define BCM_NIV_EGRESS_MULTICAST            (1 << 0)   /* Create multicast type */
     63 #define BCM_NIV_EGRESS_SERVICE_VLAN_ADD     (1 << 1)   /* Add SD-tag */
     64 #define BCM_NIV_EGRESS_SERVICE_VLAN_DELETE  (1 << 2)   /* Delete SD-tag */
     65 #define BCM_NIV_EGRESS_SERVICE_VLAN_REPLACE (1 << 3)   /* Replace SD-tag VLAN ID */
     66 #define BCM_NIV_EGRESS_SERVICE_PRI_REPLACE  (1 << 4)   /* Replace SD-tag
     67                                                           Priority */
     68 #define BCM_NIV_EGRESS_SERVICE_TPID_REPLACE (1 << 5)   /* Replace SD-tag TPID */
     69 #define BCM_NIV_EGRESS_L3                   (1 << 6)   /* Create L3 egress
     70                                                           object */
     71 #define BCM_NIV_EGRESS_P_BIT_CLEAR          (1 << 7)   /* Clear the P bit for
     72                                                           multicast packets */
     73 
     74 /* NIV egress type. */
     75 typedef struct bcm_niv_egress_s {
     76     uint32 flags;                   /* BCM_NIV_EGRESS_xxx */
     77     bcm_gport_t port;               /* Physical port / trunk */
     78     uint16 virtual_interface_id;    /* Virtual Interface Identifier */
     79     bcm_vlan_t match_vlan;          /* Outer VLAN ID to match */
     80     bcm_if_t egress_if;             /* Egress object ID */
     81     uint16 service_tpid;            /* Egress SD-tag TPID */
     82     bcm_vlan_t service_vlan;        /* Egress SD-tag VLAN ID */
     83     uint8 service_pri;              /* Egress SD-tag default Priority */
     84     uint8 service_cfi;              /* Egress SD-tag default CFI */
     85     int service_qos_map_id;         /* Egress SD-tag Priority and CFI mapping
     86                                        profile ID */
     87     bcm_if_t intf;                  /* L3 interface */
     88     uint32 multicast_flags;         /* BCM_L3_MULTICAST flag definitions */
     89 } bcm_niv_egress_t;
     90 
     91 #ifndef BCM_HIDE_DISPATCHABLE
     92 
     93 /* Initialize the BCM NIV subsystem */
     94 extern int bcm_niv_init(
     95     int unit);
     96 
     97 /* Detach the NIV software module. */
     98 extern int bcm_niv_cleanup(
     99     int unit);
    100 
    101 #endif /* BCM_HIDE_DISPATCHABLE */
    102 
    103 /* Initialize the NIV port structure. */
    104 extern void bcm_niv_port_t_init(
    105     bcm_niv_port_t *niv_port);
    106 
    107 #ifndef BCM_HIDE_DISPATCHABLE
    108 
    109 /* Create a NIV port. */
    110 extern int bcm_niv_port_add(
    111     int unit, 
    112     bcm_niv_port_t *niv_port);
    113 
    114 /* Delete a NIV port. */
    115 extern int bcm_niv_port_delete(
    116     int unit, 
    117     bcm_gport_t niv_port_id);
    118 
    119 /* Delete all NIV ports. */
    120 extern int bcm_niv_port_delete_all(
    121     int unit);
    122 
    123 /* Get information about a NIV port. */
    124 extern int bcm_niv_port_get(
    125     int unit, 
    126     bcm_niv_port_t *niv_port);
    127 
    128 #endif /* BCM_HIDE_DISPATCHABLE */
    129 
    130 /* NIV port traverse function prototype. */
    131 typedef int (*bcm_niv_port_traverse_cb)(
    132     int unit, 
    133     bcm_niv_port_t *niv_port, 
    134     void *user_data);
    135 
    136 #ifndef BCM_HIDE_DISPATCHABLE
    137 
    138 /* Traverse all NIV ports. */
    139 extern int bcm_niv_port_traverse(
    140     int unit, 
    141     bcm_niv_port_traverse_cb cb, 
    142     void *user_data);
    143 
    144 #endif /* BCM_HIDE_DISPATCHABLE */
    145 
    146 /* Initialize the IV forwarding entry structure. */
    147 extern void bcm_niv_forward_t_init(
    148     bcm_niv_forward_t *iv_fwd_entry);
    149 
    150 #ifndef BCM_HIDE_DISPATCHABLE
    151 
    152 /* Add an IV forwarding entry. */
    153 extern int bcm_niv_forward_add(
    154     int unit, 
    155     bcm_niv_forward_t *iv_fwd_entry);
    156 
    157 /* Delete an IV forwarding entry. */
    158 extern int bcm_niv_forward_delete(
    159     int unit, 
    160     bcm_niv_forward_t *iv_fwd_entry);
    161 
    162 /* Delete all IV forwarding entries. */
    163 extern int bcm_niv_forward_delete_all(
    164     int unit);
    165 
    166 /* Get information about an IV forwarding entry. */
    167 extern int bcm_niv_forward_get(
    168     int unit, 
    169     bcm_niv_forward_t *iv_fwd_entry);
    170 
    171 #endif /* BCM_HIDE_DISPATCHABLE */
    172 
    173 /* NIV forward traverse function prototype. */
    174 typedef int (*bcm_niv_forward_traverse_cb)(
    175     int unit, 
    176     bcm_niv_forward_t *iv_fwd_entry, 
    177     void *user_data);
    178 
    179 #ifndef BCM_HIDE_DISPATCHABLE
    180 
    181 /* Traverse all IV forwarding entries. */
    182 extern int bcm_niv_forward_traverse(
    183     int unit, 
    184     bcm_niv_forward_traverse_cb cb, 
    185     void *user_data);
    186 
    187 #endif /* BCM_HIDE_DISPATCHABLE */
    188 
    189 /* Initialize the NIV egress object structure. */
    190 extern void bcm_niv_egress_t_init(
    191     bcm_niv_egress_t *niv_egress);
    192 
    193 #ifndef BCM_HIDE_DISPATCHABLE
    194 
    195 /* Create a NIV egress object and add it to a NIV port. */
    196 extern int bcm_niv_egress_add(
    197     int unit, 
    198     bcm_gport_t niv_port, 
    199     bcm_niv_egress_t *niv_egress);
    200 
    201 /* Delete a NIV egress object from a NIV port and destroy it. */
    202 extern int bcm_niv_egress_delete(
    203     int unit, 
    204     bcm_gport_t niv_port, 
    205     bcm_niv_egress_t *niv_egress);
    206 
    207 /* Delete all NIV egress objects associated with a NIV port. */
    208 extern int bcm_niv_egress_delete_all(
    209     int unit, 
    210     bcm_gport_t niv_port);
    211 
    212 /* Create a set of NIV egress objects and add them to a NIV port. */
    213 extern int bcm_niv_egress_set(
    214     int unit, 
    215     bcm_gport_t niv_port, 
    216     int array_size, 
    217     bcm_niv_egress_t *niv_egress_array);
    218 
    219 /* Get NIV egress objects associated with a NIV port. */
    220 extern int bcm_niv_egress_get(
    221     int unit, 
    222     bcm_gport_t niv_port, 
    223     int array_size, 
    224     bcm_niv_egress_t *niv_egress_array, 
    225     int *count);
    226 
    227 #endif /* defined(INCLUDE_L3) */
    228 
    229 #endif /* BCM_HIDE_DISPATCHABLE */
    230 
    231 #endif /* __BCM_NIV_H__ */