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