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

fcoe.h (21759B)


      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_FCOE_H__
     11 #define __BCM_FCOE_H__
     12 
     13 #include <bcm/types.h>
     14 #include <bcm/stat.h>
     15 
     16 #ifndef BCM_HIDE_DISPATCHABLE
     17 
     18 /* Initialize the BCM Fiber Channel Over Ethernet module. */
     19 extern int bcm_fcoe_init(
     20     int unit);
     21 
     22 /* Detach the Fiber Channel Over Ethernet module. */
     23 extern int bcm_fcoe_cleanup(
     24     int unit);
     25 
     26 /* enable/disable FCOE without clearing any FCOE table */
     27 extern int bcm_fcoe_enable_set(
     28     int unit);
     29 
     30 #endif /* BCM_HIDE_DISPATCHABLE */
     31 
     32 typedef uint32 bcm_fcoe_nport_id_t;
     33 
     34 typedef uint32 bcm_fcoe_fcmap_t;
     35 
     36 #define BCM_FCOE_HOST_ROUTE             0x00000001 /* Host FCOE route */
     37 #define BCM_FCOE_SOURCE_ROUTE           0x00000002 /* Source FCOE route */
     38 #define BCM_FCOE_DOMAIN_ROUTE           0x00000004 /* Domain FCOE route */
     39 #define BCM_FCOE_DST_DISCARD            0x00000008 /* Destination match discard */
     40 #define BCM_FCOE_SRC_DISCARD            0x00000010 /* Destination match discard */
     41 #define BCM_FCOE_MULTIPATH              0x00000020 /* Specify ECMP treatment */
     42 #define BCM_FCOE_RPE                    0x00000040 /* Pick up new priority from
     43                                                       Entry */
     44 #define BCM_FCOE_LOCAL_ADDRESS          0x00000080 /* Address belong to switch -
     45                                                       for FCOE_HOST_ROUTE */
     46 #define BCM_FCOE_NO_HOP_COUNT_CHANGE    0x00000100 /* Don't decrement VFP Hop
     47                                                       Count */
     48 #define BCM_FCOE_COPY_TO_CPU            0x00000200 /* Send a Copy to CPU */
     49 #define BCM_FCOE_DEFIP_ENTRY_TYPE_FCOE  0x00000400 /* FCOE Entry in DEFIP table */
     50 
     51 /* FCOE route info */
     52 typedef struct bcm_fcoe_route_s {
     53     uint32 flags;                       /* BCM_FCOE_* flags */
     54     bcm_vrf_t vrf;                      /* Virtual router instance */
     55     bcm_fcoe_nport_id_t nport_id;       /* Destination/Source FC Nport ID */
     56     bcm_fcoe_nport_id_t nport_id_mask;  /* Mask used for Domain/prefix routes */
     57     bcm_cos_t pri;                      /* New priority in packet */
     58     bcm_if_t intf;                      /* L3 intf associated with this address */
     59     bcm_mac_t nexthop_mac;              /* Next-hop mac address */
     60     bcm_gport_t port;                   /* Port */
     61     int lookup_class;                   /* Classification lookup class ID */
     62     bcm_if_t encap_id;                  /* encapsulation index */
     63 } bcm_fcoe_route_t;
     64 
     65 /* Initialize bcm_fcoe_route_t structure. */
     66 extern void bcm_fcoe_route_t_init(
     67     bcm_fcoe_route_t *route);
     68 
     69 #ifndef BCM_HIDE_DISPATCHABLE
     70 
     71 /* Add an entry into the FCOE routing table. */
     72 extern int bcm_fcoe_route_add(
     73     int unit, 
     74     bcm_fcoe_route_t *route);
     75 
     76 /* Delete an nport_id entry from the FCOE routing table. */
     77 extern int bcm_fcoe_route_delete(
     78     int unit, 
     79     bcm_fcoe_route_t *route);
     80 
     81 /* Delete FCOE entries based on Masked Domain prefix (network). */
     82 extern int bcm_fcoe_route_delete_by_prefix(
     83     int unit, 
     84     bcm_fcoe_route_t *route);
     85 
     86 /* Delete FCOE entries that do/don't match a specified L3 interface. */
     87 extern int bcm_fcoe_route_delete_by_interface(
     88     int unit, 
     89     bcm_fcoe_route_t *route);
     90 
     91 /* Deletes all FCOE routing table entries. */
     92 extern int bcm_fcoe_route_delete_all(
     93     int unit);
     94 
     95 /* Look up an FCOE routing table entry based on nport id. */
     96 extern int bcm_fcoe_route_find(
     97     int unit, 
     98     bcm_fcoe_route_t *route);
     99 
    100 #endif /* BCM_HIDE_DISPATCHABLE */
    101 
    102 #define BCM_FCOE_VSAN_OPTION_REPLACE        0x00000001 /* Replace the VSAN ID */
    103 #define BCM_FCOE_VSAN_CONFIG_NORMALIZED_ZONE_CHECK 0x00000001 /* VSAN normalized zone
    104                                                           check */
    105 #define BCM_FCOE_VSAN_CONFIG_FCOE_ROUTE_ENABLE 0x00000002 /* Enable routing on VSAN */
    106 
    107 /* FCOE VSAN object */
    108 typedef struct bcm_fcoe_vsan_s {
    109     uint32 config_flags;    /* BCM_FCOE_VSAN_CONFIG_* flags */
    110     bcm_if_t l3_intf_id;    /* L3 interface ID */
    111     bcm_fcoe_fcmap_t fcmap; /* Associated FC Map */
    112 } bcm_fcoe_vsan_t;
    113 
    114 /* VSAN controls */
    115 typedef enum bcm_fcoe_vsan_control_e {
    116     bcmFcoeVsanNormalizedZoneCheck = 0, /* FCoE Zone checking is normalized */
    117     bcmFcoeVsanRouteEnable = 1          /* FCoE Routing enable */
    118 } bcm_fcoe_vsan_control_t;
    119 
    120 /* Initialize bcm_fcoe_vsan_t. */
    121 extern void bcm_fcoe_vsan_t_init(
    122     bcm_fcoe_vsan_t *vsan);
    123 
    124 #ifndef BCM_HIDE_DISPATCHABLE
    125 
    126 /* Allocate and configure a VSAN. */
    127 extern int bcm_fcoe_vsan_create(
    128     int unit, 
    129     uint32 options, 
    130     bcm_fcoe_vsan_t *vsan, 
    131     bcm_fcoe_vsan_id_t *vsan_id);
    132 
    133 /* Destroy a VSAN. */
    134 extern int bcm_fcoe_vsan_destroy(
    135     int unit, 
    136     bcm_fcoe_vsan_id_t vsan_id);
    137 
    138 /* Destroy all VSANs. */
    139 extern int bcm_fcoe_vsan_destroy_all(
    140     int unit);
    141 
    142 /* 
    143  * Get VSAN controls
    144  * Set VSAN controls
    145  */
    146 extern int bcm_fcoe_control_vsan_get(
    147     int unit, 
    148     bcm_fcoe_vsan_id_t vsan_id, 
    149     bcm_fcoe_vsan_control_t type, 
    150     int *arg);
    151 
    152 /* 
    153  * Get VSAN controls
    154  * Set VSAN controls
    155  */
    156 extern int bcm_fcoe_control_vsan_set(
    157     int unit, 
    158     bcm_fcoe_vsan_id_t vsan_id, 
    159     bcm_fcoe_vsan_control_t type, 
    160     int arg);
    161 
    162 /* 
    163  * Get VSAN properties associated with a VSAN ID
    164  * Update VSAN properties associated with a VSAN ID
    165  */
    166 extern int bcm_fcoe_vsan_get(
    167     int unit, 
    168     bcm_fcoe_vsan_id_t vsan_id, 
    169     bcm_fcoe_vsan_t *vsan);
    170 
    171 /* 
    172  * Get VSAN properties associated with a VSAN ID
    173  * Update VSAN properties associated with a VSAN ID
    174  */
    175 extern int bcm_fcoe_vsan_set(
    176     int unit, 
    177     bcm_fcoe_vsan_id_t vsan_id, 
    178     bcm_fcoe_vsan_t *vsan);
    179 
    180 #endif /* BCM_HIDE_DISPATCHABLE */
    181 
    182 /* Actions on packets matching zone check */
    183 typedef enum bcm_fcoe_zone_action_e {
    184     bcmFcoeZoneActionAllow = 0,     /* Allow packets matching the zone check */
    185     bcmFcoeZoneActionDeny = 1,      /* Deny packets matching the zone check */
    186     bcmFcoeZoneActionCopyToCpu = 2, /* Copy-to-CPU packets matching the zone
    187                                        check */
    188     bcmFcoeZoneActionRedirect = 3   /* redirect port to given port */
    189 } bcm_fcoe_zone_action_t;
    190 
    191 /* Device-independent Zone address structure */
    192 typedef struct bcm_fcoe_zone_entry_s {
    193     uint32 flags;                   /* BCM_FCOE_ZONE_* flags - for Future */
    194     bcm_fcoe_vsan_id_t vsan_id;     /* VSAN identifier */
    195     bcm_fcoe_nport_id_t d_id;       /* Destination FC Nport ID */
    196     bcm_fcoe_nport_id_t s_id;       /* Source FC Nport ID */
    197     int class_id;                   /* Class id to Field Processor */
    198     bcm_fcoe_zone_action_t action;  /* Action to take for Zone match packets */
    199     bcm_gport_t dest_port;          /* destination port relevant for redirect
    200                                        action */
    201 } bcm_fcoe_zone_entry_t;
    202 
    203 /* Initialize FCOE zone entry. */
    204 extern void bcm_fcoe_zone_entry_t_init(
    205     bcm_fcoe_zone_entry_t *zone);
    206 
    207 #ifndef BCM_HIDE_DISPATCHABLE
    208 
    209 /* Add FCOE zoning entry. */
    210 extern int bcm_fcoe_zone_add(
    211     int unit, 
    212     bcm_fcoe_zone_entry_t *zone);
    213 
    214 /* Delete FCOE zoning entry by VSAN ID. */
    215 extern int bcm_fcoe_zone_delete_by_vsan(
    216     int unit, 
    217     bcm_fcoe_zone_entry_t *zone);
    218 
    219 /* Delete FCOE zoning entry. */
    220 extern int bcm_fcoe_zone_delete(
    221     int unit, 
    222     bcm_fcoe_zone_entry_t *zone);
    223 
    224 /* Delete FCOE zoning entry by Source ID. */
    225 extern int bcm_fcoe_zone_delete_by_sid(
    226     int unit, 
    227     bcm_fcoe_zone_entry_t *zone);
    228 
    229 /* Delete FCOE zoning entry by Destination ID. */
    230 extern int bcm_fcoe_zone_delete_by_did(
    231     int unit, 
    232     bcm_fcoe_zone_entry_t *zone);
    233 
    234 /* Delete all FCOE zoning entry. */
    235 extern int bcm_fcoe_zone_delete_all(
    236     int unit);
    237 
    238 /* Get FCOE zoning entry. */
    239 extern int bcm_fcoe_zone_get(
    240     int unit, 
    241     bcm_fcoe_zone_entry_t *zone);
    242 
    243 #endif /* BCM_HIDE_DISPATCHABLE */
    244 
    245 #define BCM_FCOE_FC_HEADER_TYPE_INGRESS 0x00000001 /* Ingress header type */
    246 #define BCM_FCOE_FC_HEADER_TYPE_EGRESS  0x00000002 /* Egress header type */
    247 
    248 /* Header types for bcm_fcoe_fc_header_type_set/get */
    249 typedef enum bcm_fcoe_fc_header_type_e {
    250     bcmFcoeFcHeaderTypeNone = 0,    /* No header */
    251     bcmFcoeFcHeaderTypeStd = 1,     /* Standard header */
    252     bcmFcoeFcHeaderTypeEncap = 2,   /* Encapsulated header */
    253     bcmFcoeFcHeaderTypeVft = 3,     /* VFT header */
    254     bcmFcoeFcHeaderTypeIfr = 4,     /* IFR Header */
    255     bcmFcoeFcHeaderTypeUnknown = 5, /* Unknown Header */
    256     bcmFcoeFcHeaderTypeCount = 6 
    257 } bcm_fcoe_fc_header_type_t;
    258 
    259 #ifndef BCM_HIDE_DISPATCHABLE
    260 
    261 /* Set the header type that a given r_ctl should be parsed as. */
    262 extern int bcm_fcoe_fc_header_type_set(
    263     int unit, 
    264     uint32 flags, 
    265     uint8 r_ctl, 
    266     bcm_fcoe_fc_header_type_t hdr_type);
    267 
    268 /* Get the header type that a given r_ctl is set to be parsed as. */
    269 extern int bcm_fcoe_fc_header_type_get(
    270     int unit, 
    271     uint32 flags, 
    272     uint8 r_ctl, 
    273     bcm_fcoe_fc_header_type_t *hdr_type);
    274 
    275 #endif /* BCM_HIDE_DISPATCHABLE */
    276 
    277 /* FCOE statistics maintained per VSAN. */
    278 typedef enum bcm_fcoe_vsan_stat_e {
    279     bcmFcoeVsanInPackets = 0,   /* Packets that ingress on fcoe vsan */
    280     bcmFcoeVsanInBytes = 1      /* Bytes that ingress on fcoe vsan */
    281 } bcm_fcoe_vsan_stat_t;
    282 
    283 #ifndef BCM_HIDE_DISPATCHABLE
    284 
    285 /* Attach a flex counter ID to FCOE VSAN ID. */
    286 extern int bcm_fcoe_vsan_stat_attach(
    287     int unit, 
    288     bcm_fcoe_vsan_id_t vsan, 
    289     uint32 stat_counter_id);
    290 
    291 /* Detach a flex counter ID from FCOE VSAN ID. */
    292 extern int bcm_fcoe_vsan_stat_detach(
    293     int unit, 
    294     bcm_fcoe_vsan_id_t vsan);
    295 
    296 /* Get flex counter value for FCOE VSAN ID. */
    297 extern int bcm_fcoe_vsan_stat_counter_get(
    298     int unit, 
    299     bcm_fcoe_vsan_id_t vsan, 
    300     bcm_fcoe_vsan_stat_t stat, 
    301     uint32 num_entries, 
    302     uint32 *counter_indexes, 
    303     bcm_stat_value_t *counter_values);
    304 
    305 /* 
    306  * Force an immediate counter update and retrieve flex counter
    307  * value for FCOE VSAN ID.
    308  */
    309 extern int bcm_fcoe_vsan_stat_counter_sync_get(
    310     int unit, 
    311     bcm_fcoe_vsan_id_t vsan, 
    312     bcm_fcoe_vsan_stat_t stat, 
    313     uint32 num_entries, 
    314     uint32 *counter_indexes, 
    315     bcm_stat_value_t *counter_values);
    316 
    317 /* Set flex counter value for FCOE VSAN ID. */
    318 extern int bcm_fcoe_vsan_stat_counter_set(
    319     int unit, 
    320     bcm_fcoe_vsan_id_t vsan, 
    321     bcm_fcoe_vsan_stat_t stat, 
    322     uint32 num_entries, 
    323     uint32 *counter_indexes, 
    324     bcm_stat_value_t *counter_values);
    325 
    326 /* Get stat counter ID for FCOE VSAN ID. */
    327 extern int bcm_fcoe_vsan_stat_id_get(
    328     int unit, 
    329     bcm_fcoe_vsan_id_t vsan, 
    330     bcm_fcoe_vsan_stat_t stat, 
    331     uint32 *stat_counter_id);
    332 
    333 #endif /* BCM_HIDE_DISPATCHABLE */
    334 
    335 /* FCOE statistics maintained per route. */
    336 typedef enum bcm_fcoe_route_stat_e {
    337     bcmFcoeRouteInPackets = 0,  /* Packets that ingress on fcoe route */
    338     bcmFcoeRouteInBytes = 1     /* Bytes that ingress on fcoe route */
    339 } bcm_fcoe_route_stat_t;
    340 
    341 #ifndef BCM_HIDE_DISPATCHABLE
    342 
    343 /* Attach a flex counter ID to FCOE route. */
    344 extern int bcm_fcoe_route_stat_attach(
    345     int unit, 
    346     bcm_fcoe_route_t *route, 
    347     uint32 stat_counter_id);
    348 
    349 /* Detach flex counter ID from FCOE route. */
    350 extern int bcm_fcoe_route_stat_detach(
    351     int unit, 
    352     bcm_fcoe_route_t *route);
    353 
    354 /* Get flex counter value for FCOE route. */
    355 extern int bcm_fcoe_route_stat_counter_get(
    356     int unit, 
    357     bcm_fcoe_route_t *route, 
    358     bcm_fcoe_route_stat_t stat, 
    359     uint32 num_entries, 
    360     uint32 *counter_indexes, 
    361     bcm_stat_value_t *counter_values);
    362 
    363 /* 
    364  * Force an immediate counter update and retrieve flex counter
    365  * value for FCOE route.
    366  */
    367 extern int bcm_fcoe_route_stat_counter_sync_get(
    368     int unit, 
    369     bcm_fcoe_route_t *route, 
    370     bcm_fcoe_route_stat_t stat, 
    371     uint32 num_entries, 
    372     uint32 *counter_indexes, 
    373     bcm_stat_value_t *counter_values);
    374 
    375 /* Set flex counter value for FCOE route. */
    376 extern int bcm_fcoe_route_stat_counter_set(
    377     int unit, 
    378     bcm_fcoe_route_t *route, 
    379     bcm_fcoe_route_stat_t stat, 
    380     uint32 num_entries, 
    381     uint32 *counter_indexes, 
    382     bcm_stat_value_t *counter_values);
    383 
    384 /* Get stat counter ID for FCOE route. */
    385 extern int bcm_fcoe_route_stat_id_get(
    386     int unit, 
    387     bcm_fcoe_route_t *route, 
    388     bcm_fcoe_route_stat_t stat, 
    389     uint32 *stat_counter_id);
    390 
    391 #endif /* BCM_HIDE_DISPATCHABLE */
    392 
    393 /* FCOE VSAN VFT object */
    394 typedef struct bcm_fcoe_vsan_vft_s {
    395     uint8 r_ctl; 
    396     uint8 version; 
    397     uint8 type; 
    398     uint8 hop_count; 
    399 } bcm_fcoe_vsan_vft_t;
    400 
    401 /* FCOE Interface VSAN ID source */
    402 typedef enum bcm_fcoe_intf_vsan_id_source_e {
    403     bcmFcoeIntfVsanSet = 0,         /* Get VSAN ID from table entry */
    404     bcmFcoeIntfVsanInternal = 1,    /* Get VSAN ID from internal VSAN ID */
    405     bcmFcoeIntfVsanInnerVlan = 2,   /* Get VSAN ID from internal ITAG */
    406     bcmFcoeIntfVsanOuterVlan = 3    /* Get VSAN ID from internal OVID */
    407 } bcm_fcoe_intf_vsan_id_source_t;
    408 
    409 /* FCOE Interface VSAN Priority source */
    410 typedef enum bcm_fcoe_intf_vsan_pri_source_e {
    411     bcmFcoeIntfVsanPriSet = 0,      /* Use VSAN PRI from table entry */
    412     bcmFcoeIntfVsanPriInternal = 1, /* Get VSAN PRI from internal VSAN PRI */
    413     bcmFcoeIntfVsanPriRemark = 2    /* Get VSAN PRI from internal PRI */
    414 } bcm_fcoe_intf_vsan_pri_source_t;
    415 
    416 /* FCOE interface configuration parameters */
    417 typedef struct bcm_fcoe_intf_config_s {
    418     uint32 flags; 
    419     int qos_map_id; 
    420     bcm_fcoe_vsan_id_t vsan; 
    421     uint8 vsan_pri; 
    422     bcm_fcoe_vsan_vft_t vft; 
    423     bcm_fcoe_intf_vsan_id_source_t vsan_source; 
    424     bcm_fcoe_intf_vsan_pri_source_t vsan_pri_source; 
    425 } bcm_fcoe_intf_config_t;
    426 
    427 #define BCM_FCOE_INTF_VFT_DO_NOT_MODIFY 0x00000001 /* Do not modify any existing
    428                                                       VFT header */
    429 #define BCM_FCOE_INTF_VFT_ADD_REPLACE   0x00000002 /* Add or replace VFT header */
    430 #define BCM_FCOE_INTF_VFT_DELETE        0x00000004 /* Delete VFT header if
    431                                                       present */
    432 
    433 #ifndef BCM_HIDE_DISPATCHABLE
    434 
    435 /* Change settings for FCOE specific properties of a L3 interface. */
    436 extern int bcm_fcoe_intf_config_set(
    437     int unit, 
    438     uint32 flags, 
    439     bcm_if_t intf, 
    440     bcm_fcoe_intf_config_t *cfg);
    441 
    442 /* Retrieve settings for FCOE specific properties of a L3 interface. */
    443 extern int bcm_fcoe_intf_config_get(
    444     int unit, 
    445     uint32 flags, 
    446     bcm_if_t intf, 
    447     bcm_fcoe_intf_config_t *cfg);
    448 
    449 #endif /* BCM_HIDE_DISPATCHABLE */
    450 
    451 /* FCOE VSAN Translation actions */
    452 typedef enum bcm_fcoe_vsan_action_e {
    453     bcmFcoeVsanActionNone = 0,      /* Do not modify */
    454     bcmFcoeVsanActionInnerVlan = 1, /* Use Inner Vlan's value */
    455     bcmFcoeVsanActionOuterVlan = 2, /* Use Outer Vlan's value */
    456     bcmFcoeVsanActionReplace = 3,   /* Replace with specified value */
    457     bcmFcoeVsanActionDelete = 4,    /* Delete */
    458     bcmFcoeVsanActionInternal = 5,  /* Replace with Internal value */
    459     bcmFcoeVsanActionCount = 6 
    460 } bcm_fcoe_vsan_action_t;
    461 
    462 /* FCOE VSAN Translate Key types */
    463 typedef enum bcm_fcoe_vsan_translate_key_e {
    464     bcmFcoeVsanTranslateKeyInvalid = -1, /* Invalid Key Type */
    465     bcmFcoeVsanTranslateKeyDoubleVsan = 0, /* Use I-VID[11:0],O-VID[11:0] and
    466                                            VSAN-ID[11:0] */
    467     bcmFcoeVsanTranslateKeyInnerVsan = 1, /* Use I-VID[11:0] and VSAN-ID[11:0] */
    468     bcmFcoeVsanTranslateKeyOuterVsan = 2, /* Use O-VID[11:0] and VSAN-ID[11:0] */
    469     bcmFcoeVsanTranslateKeyDouble = 3,  /* Use O-VID[11:0] and I-VID[11:0] */
    470     bcmFcoeVsanTranslateKeyOuter = 4,   /* Use O-VID[11:0] */
    471     bcmFcoeVsanTranslateKeyInner = 5,   /* Use I-VID[11:0] */
    472     bcmFcoeVsanTranslateKeyOuterTag = 6, /* Use O-TAG[15:0] */
    473     bcmFcoeVsanTranslateKeyInnerTag = 7, /* Use I-TAG[15:0] */
    474     bcmFcoeVsanTranslateKeyOuterPri = 8, /* Use (VLAN-PRI, VLAN-CFI of O-TAG) */
    475     bcmFcoeVsanTranslateKeyPortDouble = 9, /* Use Port, O-VID[11:0] and I-VID[11:0] */
    476     bcmFcoeVsanTranslateKeyPortOuter = 10, /* Use Port, O-VID[11:0] */
    477     bcmFcoeVsanTranslateKeyPortInner = 11, /* Use Port, I-VID[11:0] */
    478     bcmFcoeVsanTranslateKeyPortOuterTag = 12, /* Use Port, O-TAG[15:0] */
    479     bcmFcoeVsanTranslateKeyPortInnerTag = 13, /* Use Port, I-TAG[15:0] */
    480     bcmFcoeVsanTranslateKeyPortOuterPri = 14, /* Use Port, (VLAN-PRI, VLAN-CFI of
    481                                            O-TAG) */
    482     bcmFcoeVsanTranslateKeyPortDoubleVsan = 15, /* Use Port, I-VID[11:0],O-VID[11:0] and
    483                                            VSAN-ID[11:0] */
    484     bcmFcoeVsanTranslateKeyPortInnerVsan = 16, /* Use Port, I-VID[11:0] and
    485                                            VSAN-ID[11:0] */
    486     bcmFcoeVsanTranslateKeyPortOuterVsan = 17 /* Use Port, O-VID[11:0] and
    487                                            VSAN-ID[11:0] */
    488 } bcm_fcoe_vsan_translate_key_t;
    489 
    490 /* FCOE VSAN Translate Key types */
    491 typedef enum bcm_fcoe_vsan_translate_key_egress_e {
    492     bcmFcoeVsanTranslateKeyEgressInvalid = -1, /* Invalid Key Type */
    493     bcmFcoeVsanTranslateKeyEgressDoubleVsan = 0, /* Use I-VID[11:0],O-VID[11:0] and
    494                                            VSAN-ID[11:0] */
    495     bcmFcoeVsanTranslateKeyEgressVsan = 1, /* Use VSAN-ID[11:0] */
    496     bcmFcoeVsanTranslateKeyEgressInnerVsan = 2, /* Use I-VID[11:0] and VSAN-ID[11:0] */
    497     bcmFcoeVsanTranslateKeyEgressOuterVsan = 3, /* Use O-VID[11:0] and VSAN-ID[11:0] */
    498     bcmFcoeVsanTranslateKeyEgressDouble = 4, /* Use O-VID[11:0] and I-VID[11:0] */
    499     bcmFcoeVsanTranslateKeyEgressInner = 5, /* Use I-VID[11:0] */
    500     bcmFcoeVsanTranslateKeyEgressOuter = 6 /* Use O-VID[11:0] */
    501 } bcm_fcoe_vsan_translate_key_egress_t;
    502 
    503 /* Translate Key Configuration. */
    504 typedef struct bcm_fcoe_vsan_translate_key_config_s {
    505     uint32 flags; 
    506     bcm_fcoe_vsan_translate_key_t key_type; 
    507     bcm_vlan_t inner_vlan;              /* Inner Vlan ID to match on */
    508     bcm_vlan_t outer_vlan;              /* Outer Vlan ID to match on */
    509     bcm_fcoe_vsan_id_t vsan;            /* VFT VSAN ID to match on */
    510     bcm_gport_t port;                   /* Port to match on */
    511 } bcm_fcoe_vsan_translate_key_config_t;
    512 
    513 #define BCM_FCOE_VSAN_ACTION_INGRESS    0x00000001 /* Translate at ingress */
    514 #define BCM_FCOE_VSAN_ACTION_EGRESS     0x00000002 /* Translate at egress */
    515 #define BCM_FCOE_VSAN_ACTION_VFT_NONE   0x00000004 /* Indicates no VFT tag is
    516                                                       present */
    517 
    518 /* VLAN/VSAN Translation Action Set. */
    519 typedef struct bcm_fcoe_vsan_action_set_s {
    520     uint32 flags;                       /* BCM_FCOE_VSAN_ACTION_* */
    521     bcm_fcoe_vsan_id_t new_vsan;        /* new VSAN ID to replace with */
    522     uint8 new_vsan_pri;                 /* new VSAN priority to replace with */
    523     bcm_fcoe_vsan_vft_t vft;            /* remaining fields of VFT header */
    524     bcm_if_t ingress_if;                /* TBD */
    525     bcm_fcoe_vsan_action_t dt_vsan;     /* Vsan action when double tagged */
    526     bcm_fcoe_vsan_action_t dt_vsan_pri; /* VSAN Priority action when double
    527                                            tagged */
    528     bcm_fcoe_vsan_action_t it_vsan;     /* Vsan action when single inner tagged */
    529     bcm_fcoe_vsan_action_t it_vsan_pri; /* Vsan Priority action when single
    530                                            inner tagged */
    531     bcm_fcoe_vsan_action_t ot_vsan;     /* Vsan action when single outer tagged */
    532     bcm_fcoe_vsan_action_t ot_vsan_pri; /* Vsan Priority action when single
    533                                            outer tagged */
    534     bcm_fcoe_vsan_action_t ut_vsan;     /* Vsan action when un-tagged */
    535     bcm_fcoe_vsan_action_t ut_vsan_pri; /* Vsan Priority action when un-tagged */
    536     bcm_vlan_action_set_t vlan_action;  /* VLAN actions */
    537 } bcm_fcoe_vsan_action_set_t;
    538 
    539 #ifndef BCM_HIDE_DISPATCHABLE
    540 
    541 /* Add FCOE VSAN and VLAN translation action. */
    542 extern int bcm_fcoe_vsan_translate_action_add(
    543     int unit, 
    544     bcm_fcoe_vsan_translate_key_config_t *key, 
    545     bcm_fcoe_vsan_action_set_t *action);
    546 
    547 /* Delete FCOE VSAN and VLAN translation action. */
    548 extern int bcm_fcoe_vsan_translate_action_delete(
    549     int unit, 
    550     bcm_fcoe_vsan_translate_key_config_t *key);
    551 
    552 #endif /* BCM_HIDE_DISPATCHABLE */
    553 
    554 /* Initialize bcm_fcoe_intf_config_t structure. */
    555 extern void bcm_fcoe_intf_config_t_init(
    556     bcm_fcoe_intf_config_t *intf);
    557 
    558 /* Initialize bcm_fcoe_vsan_vft_t structure. */
    559 extern void bcm_fcoe_vsan_vft_t_init(
    560     bcm_fcoe_vsan_vft_t *vft);
    561 
    562 /* Initialize bcm_fcoe_vsan_translate_key_config_t structure. */
    563 extern void bcm_fcoe_vsan_translate_key_config_t_init(
    564     bcm_fcoe_vsan_translate_key_config_t *key_config);
    565 
    566 /* Initialize bcm_fcoe_vsan_action_set_t structure. */
    567 extern void bcm_fcoe_vsan_action_set_t_init(
    568     bcm_fcoe_vsan_action_set_t *action_set);
    569 
    570 /* bcm_fcoe_zone_traverse_cb */
    571 typedef int (*bcm_fcoe_zone_traverse_cb)(
    572     int unit, 
    573     bcm_fcoe_zone_entry_t *zone, 
    574     void *user_data);
    575 
    576 /* bcm_fcoe_vsan_traverse_cb */
    577 typedef int (*bcm_fcoe_vsan_traverse_cb)(
    578     int unit, 
    579     bcm_fcoe_vsan_id_t vsan_id, 
    580     bcm_fcoe_vsan_t *vsan, 
    581     void *user_data);
    582 
    583 /* bcm_fcoe_route_traverse_cb */
    584 typedef int (*bcm_fcoe_route_traverse_cb)(
    585     int unit, 
    586     bcm_fcoe_route_t *route, 
    587     void *user_data);
    588 
    589 #ifndef BCM_HIDE_DISPATCHABLE
    590 
    591 /* Traverse through the FCOE zone table and run callback at each zone. */
    592 extern int bcm_fcoe_zone_traverse(
    593     int unit, 
    594     uint32 flags, 
    595     bcm_fcoe_zone_traverse_cb trav_fn, 
    596     void *user_data);
    597 
    598 /* Traverse through the FCOE vsan table and run callback at each vsan. */
    599 extern int bcm_fcoe_vsan_traverse(
    600     int unit, 
    601     uint32 flags, 
    602     bcm_fcoe_vsan_traverse_cb trav_fn, 
    603     void *user_data);
    604 
    605 /* 
    606  * Traverse through the FCOE routing table and run callback at each
    607  * route.
    608  */
    609 extern int bcm_fcoe_route_traverse(
    610     int unit, 
    611     uint32 flags, 
    612     bcm_fcoe_route_traverse_cb trav_fn, 
    613     void *user_data);
    614 
    615 #endif /* BCM_HIDE_DISPATCHABLE */
    616 
    617 #endif /* __BCM_FCOE_H__ */