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

xflow_macsec.h (34397B)


      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_XFLOW_MACSEC_H__
     14 #define __BCM_XFLOW_MACSEC_H__
     15 
     16 #if defined(INCLUDE_XFLOW_MACSEC)
     17 
     18 #include <bcm/types.h>
     19 #include <xflow_macsec_defs.h>
     20 
     21 #define BCM_XFLOW_MACSEC_SECURE_CHAN_ID_CREATE(flag, chan_id)                  \
     22                 XFLOW_MACSEC_SECURE_CHAN_ID_CREATE(flag, chan_id) 
     23 #define BCM_XFLOW_MACSEC_ENCRYPT_DECRYPT_NONE XFLOW_MACSEC_ENCRYPT_DECRYPT_NONE /* Indicates the
     24                                                           parameters are not
     25                                                           specific to encrypt or
     26                                                           decrypt flow or
     27                                                           applies to both. */
     28 #define BCM_XFLOW_MACSEC_ENCRYPT            XFLOW_MACSEC_ENCRYPT /* Indicates the
     29                                                           parameters are for
     30                                                           encryption. */
     31 #define BCM_XFLOW_MACSEC_DECRYPT            XFLOW_MACSEC_DECRYPT /* Indicates the
     32                                                           parameters are for
     33                                                           decryption. */
     34 #define BCM_XFLOW_MACSEC_SECURE_CHAN_WITH_ID XFLOW_MACSEC_SECURE_CHAN_WITH_ID /* To be used when secure
     35                                                           channel needs to be
     36                                                           created with a
     37                                                           particular id. */
     38 #define BCM_XFLOW_MACSEC_SECURE_CHAN_INFO_INCLUDE_SCI XFLOW_MACSEC_SECURE_CHAN_INFO_INCLUDE_SCI /* Indicates the 64-bit
     39                                                           SCI should be included
     40                                                           in the SecTAG during
     41                                                           encryption. */
     42 #define BCM_XFLOW_MACSEC_SECURE_CHAN_INFO_CONTROLLED_PORT XFLOW_MACSEC_SECURE_CHAN_INFO_CONTROLLED_PORT /* Allow all data packets
     43                                                           and management
     44                                                           packets. The default
     45                                                           is uncontrolled port
     46                                                           which is to discard
     47                                                           all data packets and
     48                                                           allow only management
     49                                                           packets. */
     50 #define BCM_XFLOW_MACSEC_SECURE_CHAN_INFO_ENCRYPT_DISABLE XFLOW_MACSEC_SECURE_CHAN_INFO_ENCRYPT_DISABLE /* Do not encrypt the
     51                                                           packet using the
     52                                                           Cipher suite. The
     53                                                           default behavior is to
     54                                                           encrypt. */
     55 #define BCM_XFLOW_MACSEC_SECURE_CHAN_INFO_REPLAY_PROTECT_ENABLE XFLOW_MACSEC_SECURE_CHAN_INFO_REPLAY_PROTECT_ENABLE /* Enable replay protect. */
     56 
     57 typedef enum bcm_xflow_macsec_crypto_e {
     58     bcmXflowMacsecCryptoAes128GcmIntegrityOnly = xflowMacsecCryptoAes128GcmIntegrityOnly, 
     59     bcmXflowMacsecCryptoAes128Gcm = xflowMacsecCryptoAes128Gcm, 
     60     bcmXflowMacsecCryptoAes128GcmXpnIntegrityOnly = xflowMacsecCryptoAes128GcmXpnIntegrityOnly, 
     61     bcmXflowMacsecCryptoAes128GcmXpn = xflowMacsecCryptoAes128GcmXpn, 
     62     bcmXflowMacsecCryptoAes256GcmIntegrityOnly = xflowMacsecCryptoAes256GcmIntegrityOnly, 
     63     bcmXflowMacsecCryptoAes256Gcm = xflowMacsecCryptoAes256Gcm, 
     64     bcmXflowMacsecCryptoAes256GcmXpnIntegrityOnly = xflowMacsecCryptoAes256GcmXpnIntegrityOnly, 
     65     bcmXflowMacsecCryptoAes256GcmXpn = xflowMacsecCryptoAes256GcmXpn, 
     66     bcmXflowMacsecCryptoCount = xflowMacsecCryptoCount 
     67 } bcm_xflow_macsec_crypto_t;
     68 
     69 typedef enum bcm_xflow_macsec_mtu_e {
     70     bcmXflowMacsecMtu0 = xflowMacsecMtu0, 
     71     bcmXflowMacsecMtu1 = xflowMacsecMtu1, 
     72     bcmXflowMacsecMtu2 = xflowMacsecMtu2, 
     73     bcmXflowMacsecMtu3 = xflowMacsecMtu3, 
     74     bcmXflowMacsecMtuCount = xflowMacsecMtuCount 
     75 } bcm_xflow_macsec_mtu_t;
     76 
     77 typedef enum bcm_xflow_macsec_sectag_ethertype_e {
     78     bcmXflowMacsecSecTagEtype0 = xflowMacsecSecTagEtype0, 
     79     bcmXflowMacsecSecTagEtype1 = xflowMacsecSecTagEtype1, 
     80     bcmXflowMacsecSecTagEtype2 = xflowMacsecSecTagEtype2, 
     81     bcmXflowMacsecSecTagEtype3 = xflowMacsecSecTagEtype3, 
     82     bcmXflowMacsecSecTagEtypeCount = xflowMacsecSecTagEtypeCount 
     83 } bcm_xflow_macsec_sectag_ethertype_t;
     84 
     85 typedef xflow_macsec_instance_id_t bcm_xflow_macsec_instance_id_t;
     86 
     87 typedef xflow_macsec_secure_chan_info_t bcm_xflow_macsec_secure_chan_info_t;
     88 
     89 typedef xflow_macsec_secure_chan_id_t bcm_xflow_macsec_secure_chan_id_t;
     90 
     91 #ifndef BCM_HIDE_DISPATCHABLE
     92 
     93 /* Installs a new security channel entry. Returns the channel Id. */
     94 extern int bcm_xflow_macsec_secure_chan_create(
     95     int unit, 
     96     uint32 flags, 
     97     bcm_xflow_macsec_instance_id_t instance_id, 
     98     bcm_xflow_macsec_secure_chan_info_t *chan_info, 
     99     int priority, 
    100     bcm_xflow_macsec_secure_chan_id_t *chan_id);
    101 
    102 /* 
    103  * Sets/Resets the value of one of the parameters of a given security
    104  * channel.
    105  */
    106 extern int bcm_xflow_macsec_secure_chan_set(
    107     int unit, 
    108     uint32 flags, 
    109     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    110     bcm_xflow_macsec_secure_chan_info_t *chan_info, 
    111     int priority);
    112 
    113 /* Get the security channel configuration for a given SC index. */
    114 extern int bcm_xflow_macsec_secure_chan_get(
    115     int unit, 
    116     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    117     bcm_xflow_macsec_secure_chan_info_t *chan_info, 
    118     int *priority);
    119 
    120 /* 
    121  * Delete the given security channel. The corresponding SA must be
    122  * destroyed first.
    123  */
    124 extern int bcm_xflow_macsec_secure_chan_destroy(
    125     int unit, 
    126     bcm_xflow_macsec_secure_chan_id_t chan_id);
    127 
    128 #endif /* BCM_HIDE_DISPATCHABLE */
    129 
    130 /* Initialize the data structure. */
    131 extern void bcm_xflow_macsec_secure_chan_info_t_init(
    132     bcm_xflow_macsec_secure_chan_info_t *chan_info);
    133 
    134 #ifndef BCM_HIDE_DISPATCHABLE
    135 
    136 /* Enable the Security Channel. */
    137 extern int bcm_xflow_macsec_secure_chan_enable_set(
    138     int unit, 
    139     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    140     int enable);
    141 
    142 /* Check if the Security Channel is enabled. */
    143 extern int bcm_xflow_macsec_secure_chan_enable_get(
    144     int unit, 
    145     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    146     int *enable);
    147 
    148 #endif /* BCM_HIDE_DISPATCHABLE */
    149 
    150 /* bcm_xflow_macsec_chan_traverse_cb */
    151 typedef int (*bcm_xflow_macsec_chan_traverse_cb)(
    152     int unit, 
    153     bcm_xflow_macsec_secure_chan_info_t *chan_info, 
    154     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    155     void *user_data);
    156 
    157 #ifndef BCM_HIDE_DISPATCHABLE
    158 
    159 /* Traverse secure channels */
    160 extern int bcm_xflow_macsec_secure_chan_info_traverse(
    161     int unit, 
    162     uint32 flags, 
    163     bcm_xflow_macsec_instance_id_t instance_id, 
    164     bcm_xflow_macsec_chan_traverse_cb callback, 
    165     void *user_data);
    166 
    167 #endif /* BCM_HIDE_DISPATCHABLE */
    168 
    169 #define BCM_XFLOW_MACSEC_SECURE_ASSOC_ID_CREATE(flag, assoc_id)                  \
    170                 XFLOW_MACSEC_SECURE_ASSOC_ID_CREATE(flag, assoc_id) 
    171 #define BCM_XFLOW_MACSEC_SECURE_ASSOC_INFO_SET_NEXT_PKT_NUM XFLOW_MACSEC_SECURE_ASSOC_INFO_SET_NEXT_PKT_NUM /* Set the next PN of the
    172                                                           security association
    173                                                           to the value given. */
    174 
    175 typedef xflow_macsec_secure_assoc_info_t bcm_xflow_macsec_secure_assoc_info_t;
    176 
    177 typedef xflow_macsec_crypto_aes128_gcm_t bcm_xflow_macsec_crypto_aes128_gcm_t;
    178 
    179 typedef xflow_macsec_crypto_aes256_gcm_t bcm_xflow_macsec_crypto_aes256_gcm_t;
    180 
    181 typedef uint32 bcm_xflow_macsec_secure_assoc_id_t;
    182 
    183 typedef enum bcm_xflow_macsec_secure_assoc_an_control_e {
    184     bcmXflowMacsecSecureAssocAnNormal = xflowMacsecSecureAssocAnNormal, 
    185     bcmXflowMacsecSecureAssocAnRollover = xflowMacsecSecureAssocAnRollover, 
    186     bcmXflowMacsecSecureAssocAnAuto = xflowMacsecSecureAssocAnAuto, 
    187     bcmXflowMacsecSecureAssocAnCount = xflowMacsecSecureAssocAnCount 
    188 } bcm_xflow_macsec_secure_assoc_an_control_t;
    189 
    190 #ifndef BCM_HIDE_DISPATCHABLE
    191 
    192 /* Create the Security Association for the given Security Channel. */
    193 extern int bcm_xflow_macsec_secure_assoc_create(
    194     int unit, 
    195     uint32 flags, 
    196     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    197     bcm_xflow_macsec_secure_assoc_info_t *assoc_info, 
    198     bcm_xflow_macsec_secure_assoc_id_t *assoc_id);
    199 
    200 /* 
    201  * Sets/Resets the value of any of the parameters of a given security
    202  * association.
    203  */
    204 extern int bcm_xflow_macsec_secure_assoc_set(
    205     int unit, 
    206     bcm_xflow_macsec_secure_assoc_id_t assoc_id, 
    207     bcm_xflow_macsec_secure_assoc_info_t *assoc_info);
    208 
    209 /* 
    210  * Retrieve the Security Association configuration and the SC index from
    211  * the SA index.
    212  */
    213 extern int bcm_xflow_macsec_secure_assoc_get(
    214     int unit, 
    215     bcm_xflow_macsec_secure_assoc_id_t assoc_id, 
    216     bcm_xflow_macsec_secure_assoc_info_t *assoc_info, 
    217     bcm_xflow_macsec_secure_chan_id_t *chan_id);
    218 
    219 /* Deletes the SA entry corresponding to the Security Association. */
    220 extern int bcm_xflow_macsec_secure_assoc_destroy(
    221     int unit, 
    222     bcm_xflow_macsec_secure_assoc_id_t assoc_id);
    223 
    224 #endif /* BCM_HIDE_DISPATCHABLE */
    225 
    226 /* Initialize the Security Association data structure. */
    227 extern void bcm_xflow_macsec_secure_assoc_info_t_init(
    228     bcm_xflow_macsec_secure_assoc_info_t *assoc_info);
    229 
    230 /* bcm_xflow_macsec_secure_assoc_traverse_cb */
    231 typedef int (*bcm_xflow_macsec_secure_assoc_traverse_cb)(
    232     int unit, 
    233     bcm_xflow_macsec_secure_assoc_info_t *assoc, 
    234     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    235     bcm_xflow_macsec_secure_assoc_id_t assoc_id, 
    236     void *user_data);
    237 
    238 #ifndef BCM_HIDE_DISPATCHABLE
    239 
    240 /* Traverse Secure Associations */
    241 extern int bcm_xflow_macsec_secure_assoc_traverse(
    242     int unit, 
    243     bcm_xflow_macsec_secure_chan_id_t chan_id, 
    244     bcm_xflow_macsec_secure_assoc_traverse_cb callback, 
    245     void *user_data);
    246 
    247 #endif /* BCM_HIDE_DISPATCHABLE */
    248 
    249 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_ID_CREATE(id)                  \
    250                 XFLOW_MACSEC_POLICY_ID_CREATE(BCM_XFLOW_MACSEC_DECRYPT, id) 
    251 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_WITH_ID XFLOW_MACSEC_POLICY_WITH_ID /* Provide the policy_id
    252                                                           as input to the API. */
    253 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_UNTAGGED_FRAME_DENY XFLOW_MACSEC_DECRYPT_POLICY_UNTAGGED_FRAME_DENY /* Deny and account all
    254                                                           data packet which
    255                                                           doesn't have a sectag. */
    256 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_CHECK_ICV XFLOW_MACSEC_DECRYPT_POLICY_CHECK_ICV /* Allow all data and
    257                                                           control packets to be
    258                                                           permitted and
    259                                                           accounted regardless
    260                                                           of policy violation,
    261                                                           but do check and
    262                                                           account (but not drop)
    263                                                           for ICV violations. */
    264 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_CHECK_NONE XFLOW_MACSEC_DECRYPT_POLICY_CHECK_NONE /* Allow all data and
    265                                                           control packets to be
    266                                                           permitted and
    267                                                           accounted regardless
    268                                                           of policy violation
    269                                                           and do not perform an
    270                                                           ICV check. */
    271 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_UNTAGGED_CONTROL_PORT_ENABLE XFLOW_MACSEC_DECRYPT_POLICY_UNTAGGED_CONTROL_PORT_ENABLE /* Allow data packets
    272                                                           which are untagged
    273                                                           (i.e., they don't have
    274                                                           a SecTAG) to be
    275                                                           processed by the
    276                                                           MACsec logic. */
    277 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_TAGGED_CONTROL_PORT_ENABLE XFLOW_MACSEC_DECRYPT_POLICY_TAGGED_CONTROL_PORT_ENABLE /* Allow data
    278                                                           (non-management)
    279                                                           packets which are
    280                                                           tagged (i.e., they
    281                                                           have a SecTAG) to be
    282                                                           processed by the
    283                                                           MACsec logic. */
    284 #define BCM_XFLOW_MACSEC_DECRYPT_POLICY_POINT_TO_POINT_ENABLE XFLOW_MACSEC_DECRYPT_POLICY_POINT_TO_POINT_ENABLE /* Enable the point to
    285                                                           point mode in the
    286                                                           Policy table. This
    287                                                           mode is disabled by
    288                                                           default. The SCI value
    289                                                           is only programmed
    290                                                           when point to point
    291                                                           mode is enabled. */
    292 
    293 typedef xflow_macsec_policy_id_t bcm_xflow_macsec_policy_id_t;
    294 
    295 typedef xflow_macsec_policy_info_t bcm_xflow_macsec_decrypt_policy_info_t;
    296 
    297 #ifndef BCM_HIDE_DISPATCHABLE
    298 
    299 /* Create a Macsec decrypt policy. Returns the policy_id. */
    300 extern int bcm_xflow_macsec_decrypt_policy_create(
    301     int unit, 
    302     uint32 flags, 
    303     bcm_xflow_macsec_instance_id_t instance_id, 
    304     bcm_xflow_macsec_decrypt_policy_info_t *policy_info, 
    305     bcm_xflow_macsec_policy_id_t *policy_id);
    306 
    307 /* 
    308  * Set/Replace one of the parameters of an existing decrypt policy
    309  * configuration.
    310  */
    311 extern int bcm_xflow_macsec_decrypt_policy_set(
    312     int unit, 
    313     bcm_xflow_macsec_policy_id_t policy_id, 
    314     bcm_xflow_macsec_decrypt_policy_info_t *policy_info);
    315 
    316 /* Get the decrypt policy configuration given the policy_id. */
    317 extern int bcm_xflow_macsec_decrypt_policy_get(
    318     int unit, 
    319     bcm_xflow_macsec_policy_id_t policy_id, 
    320     bcm_xflow_macsec_decrypt_policy_info_t *policy_info);
    321 
    322 /* Get the decrypt policy configuration given the policy_id. */
    323 extern int bcm_xflow_macsec_decrypt_policy_destroy(
    324     int unit, 
    325     bcm_xflow_macsec_policy_id_t policy_id);
    326 
    327 #endif /* BCM_HIDE_DISPATCHABLE */
    328 
    329 /* Initialize the data structure. */
    330 extern void bcm_xflow_macsec_decrypt_policy_info_t_init(
    331     bcm_xflow_macsec_decrypt_policy_info_t *policy_info);
    332 
    333 #define BCM_XFLOW_MACSEC_DECRYPT_FLOW_ID_CREATE(id)                  \
    334                 XFLOW_MACSEC_FLOW_ID_CREATE(XFLOW_MACSEC_DECRYPT, assoc_id) 
    335 #define BCM_XFLOW_MACSEC_FLOW_WITH_ID       XFLOW_MACSEC_FLOW_WITH_ID /* To be used when flows
    336                                                           need to be created
    337                                                           with a particular id */
    338 #define BCM_XFLOW_MACSEC_FLOW_TPID_SEL_0    XFLOW_MACSEC_FLOW_TPID_SEL_0 /* Select the first TPID
    339                                                           to be matched. */
    340 #define BCM_XFLOW_MACSEC_FLOW_TPID_SEL_1    XFLOW_MACSEC_FLOW_TPID_SEL_1 /* Select the second TPID
    341                                                           to be matched. */
    342 #define BCM_XFLOW_MACSEC_FLOW_TPID_SEL_2    XFLOW_MACSEC_FLOW_TPID_SEL_2 /* Select the third TPID
    343                                                           to be matched. */
    344 #define BCM_XFLOW_MACSEC_FLOW_TPID_SEL_3    XFLOW_MACSEC_FLOW_TPID_SEL_3 /* Select the fourth TPID
    345                                                           to be matched. */
    346 
    347 typedef xflow_macsec_flow_id_t bcm_xflow_macsec_flow_id_t;
    348 
    349 typedef xflow_macsec_flow_info_mpls_t bcm_xflow_macsec_flow_info_mpls_t;
    350 
    351 typedef xflow_macsec_flow_udf_param_t bcm_xflow_macsec_flow_udf_param_t;
    352 
    353 typedef xflow_macsec_flow_info_t bcm_xflow_macsec_decrypt_flow_info_t;
    354 
    355 typedef enum bcm_xflow_macsec_decrypt_flow_pkt_type_e {
    356     bcmXflowMacsecDecyptFlowAny = xflowMacsecDecyptFlowAny, 
    357     bcmXflowMacsecDecyptFlowNonMacsec = xflowMacsecDecyptFlowNonMacsec, 
    358     bcmXflowMacsecDecyptFlowMacSec = xflowMacsecDecyptFlowMacSec, 
    359     bcmXflowMacsecDecyptFlowManagement = xflowMacsecDecyptFlowManagement, 
    360     bcmXflowMacsecDecyptFlowKay = xflowMacsecDecyptFlowKay, 
    361     bcmXflowMacsecDecyptFlowCount = xflowMacsecDecyptFlowCount 
    362 } bcm_xflow_macsec_decrypt_flow_pkt_type_t;
    363 
    364 typedef enum bcm_xflow_macsec_decrypt_flow_etype_e {
    365     bcmXflowMacsecFlowEtypeAny = xflowMacsecFlowEtypeAny, 
    366     bcmXflowMacsecFlowEtypeEII = xflowMacsecFlowEtypeEII, 
    367     bcmXflowMacsecFlowEtypeSnap = xflowMacsecFlowEtypeSnap, 
    368     bcmXflowMacsecFlowEtypeLlc = xflowMacsecFlowEtypeLlc, 
    369     bcmXflowMacsecFlowEtypeMpls = xflowMacsecFlowEtypeMpls, 
    370     bcmXflowMacsecFlowEtypeCount = xflowMacsecFlowEtypeCount 
    371 } bcm_xflow_macsec_decrypt_flow_etype_t;
    372 
    373 typedef enum bcm_xflow_macsec_vlan_mpls_tag_status_e {
    374     bcmXflowMacsecTagAny = xflowMacsecTagAny, 
    375     bcmXflowMacsecTagUntaggedVlan = xflowMacsecTagUntaggedVlan, 
    376     bcmXflowMacsecTagSingleVlan = xflowMacsecTagSingleVlan, 
    377     bcmXflowMacsecTagDoubleVlan = xflowMacsecTagDoubleVlan, 
    378     bcmXflowMacsecTagOneMplsLabel = xflowMacsecTagOneMplsLabel, 
    379     bcmXflowMacsecTagTwoMplsLabel = xflowMacsecTagTwoMplsLabel, 
    380     bcmXflowMacsecTagThreeMplsLabel = xflowMacsecTagThreeMplsLabel, 
    381     bcmXflowMacsecTagCount = xflowMacsecTagCount 
    382 } bcm_xflow_macsec_vlan_mpls_tag_status_t;
    383 
    384 #ifndef BCM_HIDE_DISPATCHABLE
    385 
    386 /* 
    387  * Creates a flow entry in the decrypt TCAM which is used to match
    388  * packets that need decryption. Matched entry results in an index to the
    389  * policy table.
    390  */
    391 extern int bcm_xflow_macsec_decrypt_flow_create(
    392     int unit, 
    393     uint32 flags, 
    394     bcm_xflow_macsec_instance_id_t instance_id, 
    395     bcm_xflow_macsec_decrypt_flow_info_t *flow_info, 
    396     int priority, 
    397     bcm_xflow_macsec_flow_id_t *flow_id);
    398 
    399 /* Set/Replace one of the parameters in the flow criteria. */
    400 extern int bcm_xflow_macsec_decrypt_flow_set(
    401     int unit, 
    402     bcm_xflow_macsec_flow_id_t flow_id, 
    403     bcm_xflow_macsec_decrypt_flow_info_t *flow_info, 
    404     int priority);
    405 
    406 /* Get the flow configuration given a flow index. */
    407 extern int bcm_xflow_macsec_decrypt_flow_get(
    408     int unit, 
    409     bcm_xflow_macsec_flow_id_t flow_id, 
    410     bcm_xflow_macsec_decrypt_flow_info_t *flow_info, 
    411     int *priority);
    412 
    413 /* 
    414  * Delete a flow configuration given a flow index. This does not delete
    415  * the policy configuration.
    416  */
    417 extern int bcm_xflow_macsec_decrypt_flow_destroy(
    418     int unit, 
    419     bcm_xflow_macsec_flow_id_t flow_id);
    420 
    421 #endif /* BCM_HIDE_DISPATCHABLE */
    422 
    423 /* Initialize the data structure. */
    424 extern void bcm_xflow_macsec_decrypt_flow_info_t_init(
    425     bcm_xflow_macsec_decrypt_flow_info_t *flow_info);
    426 
    427 #ifndef BCM_HIDE_DISPATCHABLE
    428 
    429 /* Enable a flow given the flow index. */
    430 extern int bcm_xflow_macsec_decrypt_flow_enable_set(
    431     int unit, 
    432     bcm_xflow_macsec_flow_id_t flow_id, 
    433     int enable);
    434 
    435 /* Disable a flow given the flow index. */
    436 extern int bcm_xflow_macsec_decrypt_flow_enable_get(
    437     int unit, 
    438     bcm_xflow_macsec_flow_id_t flow_id, 
    439     int *enable);
    440 
    441 #endif /* BCM_HIDE_DISPATCHABLE */
    442 
    443 typedef xflow_macsec_id_t bcm_xflow_macsec_id_t;
    444 
    445 typedef xflow_macsec_subport_id_t bcm_xflow_macsec_subport_id_t;
    446 
    447 #ifndef BCM_HIDE_DISPATCHABLE
    448 
    449 /* Gives the subport ID corresponding to an encrypt or decrypt channel. */
    450 extern int bcm_xflow_macsec_subport_id_get(
    451     int unit, 
    452     bcm_xflow_macsec_id_t id, 
    453     bcm_xflow_macsec_subport_id_t *macsec_subport_id);
    454 
    455 #endif /* BCM_HIDE_DISPATCHABLE */
    456 
    457 typedef enum bcm_xflow_macsec_control_e {
    458     bcmXflowMacsecControlPNThreshold = xflowMacsecControlPNThreshold, 
    459     bcmXflowMacsecControlXPNThreshold = xflowMacsecControlXPNThreshold, 
    460     bcmXflowMacsecControlCount = xflowMacsecControlCount 
    461 } bcm_xflow_macsec_control_t;
    462 
    463 #ifndef BCM_HIDE_DISPATCHABLE
    464 
    465 /* Sets the value in HW for the macsec control type provided. */
    466 extern int bcm_xflow_macsec_control_set(
    467     int unit, 
    468     uint32 flags, 
    469     bcm_xflow_macsec_instance_id_t instance_id, 
    470     bcm_xflow_macsec_control_t type, 
    471     uint64 value);
    472 
    473 /* Gets the value from HW for the macsec control type provided. */
    474 extern int bcm_xflow_macsec_control_get(
    475     int unit, 
    476     uint32 flags, 
    477     bcm_xflow_macsec_instance_id_t instance_id, 
    478     bcm_xflow_macsec_control_t type, 
    479     uint64 *value);
    480 
    481 #endif /* BCM_HIDE_DISPATCHABLE */
    482 
    483 typedef enum bcm_xflow_macsec_stat_type_e {
    484     bcmXflowMacsecStatTypeInvalid = xflowMacsecStatTypeInvalid , 
    485     bcmXflowMacsecUnctrlPortInOctets = xflowMacsecUnctrlPortInOctets, 
    486     bcmXflowMacsecUnctrlPortInUcastPkts = xflowMacsecUnctrlPortInUcastPkts, 
    487     bcmXflowMacsecUnctrlPortInMulticastPkts = xflowMacsecUnctrlPortInMulticastPkts, 
    488     bcmXflowMacsecUnctrlPortInBroadcastPkts = xflowMacsecUnctrlPortInBroadcastPkts, 
    489     bcmXflowMacsecUnctrlPortInDiscards = xflowMacsecUnctrlPortInDiscards, 
    490     bcmXflowMacsecUnctrlPortOutOctets = xflowMacsecUnctrlPortOutOctets, 
    491     bcmXflowMacsecUnctrlPortOutUcastPkts = xflowMacsecUnctrlPortOutUcastPkts, 
    492     bcmXflowMacsecUnctrlPortOutMulticastPkts = xflowMacsecUnctrlPortOutMulticastPkts, 
    493     bcmXflowMacsecUnctrlPortOutBroadcastPkts = xflowMacsecUnctrlPortOutBroadcastPkts, 
    494     bcmXflowMacsecUnctrlPortOutErrors = xflowMacsecUnctrlPortOutErrors, 
    495     bcmXflowMacsecCtrlPortInOctets = xflowMacsecCtrlPortInOctets, 
    496     bcmXflowMacsecCtrlPortInUcastPkts = xflowMacsecCtrlPortInUcastPkts, 
    497     bcmXflowMacsecCtrlPortInMulticastPkts = xflowMacsecCtrlPortInMulticastPkts, 
    498     bcmXflowMacsecCtrlPortInBroadcastPkts = xflowMacsecCtrlPortInBroadcastPkts, 
    499     bcmXflowMacsecCtrlPortInDiscards = xflowMacsecCtrlPortInDiscards, 
    500     bcmXflowMacsecCtrlPortInErrors = xflowMacsecCtrlPortInErrors, 
    501     bcmXflowMacsecCtrlPortOutOctets = xflowMacsecCtrlPortOutOctets, 
    502     bcmXflowMacsecCtrlPortOutUcastPkts = xflowMacsecCtrlPortOutUcastPkts, 
    503     bcmXflowMacsecCtrlPortOutMulticastPkts = xflowMacsecCtrlPortOutMulticastPkts, 
    504     bcmXflowMacsecCtrlPortOutBroadcastPkts = xflowMacsecCtrlPortOutBroadcastPkts, 
    505     bcmXflowMacsecCtrlPortOutErrors = xflowMacsecCtrlPortOutErrors, 
    506     bcmXflowMacsecSecyStatsTxUntaggedPkts = xflowMacsecSecyStatsTxUntaggedPkts, 
    507     bcmXflowMacsecSecyStatsTxTooLongPkts = xflowMacsecSecyStatsTxTooLongPkts, 
    508     bcmXflowMacsecSecyStatsRxUntaggedPkts = xflowMacsecSecyStatsRxUntaggedPkts, 
    509     bcmXflowMacsecSecyStatsRxNoTagPkts = xflowMacsecSecyStatsRxNoTagPkts, 
    510     bcmXflowMacsecSecyStatsRxBadTagPkts = xflowMacsecSecyStatsRxBadTagPkts, 
    511     bcmXflowMacsecSecyStatsRxUnknownSCIPkts = xflowMacsecSecyStatsRxUnknownSCIPkts, 
    512     bcmXflowMacsecSecyStatsRxNoSCIPkts = xflowMacsecSecyStatsRxNoSCIPkts, 
    513     bcmXflowMacsecSecyStatsRxOverrunPkts = xflowMacsecSecyStatsRxOverrunPkts, 
    514     bcmXflowMacsecSecyTxSCStatsProtectedPkts = xflowMacsecSecyTxSCStatsProtectedPkts, 
    515     bcmXflowMacsecSecyTxSCStatsEncryptedPkts = xflowMacsecSecyTxSCStatsEncryptedPkts, 
    516     bcmXflowMacsecSecyTxSCStatsOctetsProtected = xflowMacsecSecyTxSCStatsOctetsProtected, 
    517     bcmXflowMacsecSecyTxSCStatsOctetsEncrypted = xflowMacsecSecyTxSCStatsOctetsEncrypted, 
    518     bcmXflowMacsecSecyRxSCStatsUnusedSAPkts = xflowMacsecSecyRxSCStatsUnusedSAPkts, 
    519     bcmXflowMacsecSecyRxSCStatsNotUsingSAPkts = xflowMacsecSecyRxSCStatsNotUsingSAPkts, 
    520     bcmXflowMacsecSecyRxSCStatsLatePkts = xflowMacsecSecyRxSCStatsLatePkts, 
    521     bcmXflowMacsecSecyRxSCStatsNotValidPkts = xflowMacsecSecyRxSCStatsNotValidPkts, 
    522     bcmXflowMacsecSecyRxSCStatsInvalidPkts = xflowMacsecSecyRxSCStatsInvalidPkts, 
    523     bcmXflowMacsecSecyRxSCStatsDelayedPkts = xflowMacsecSecyRxSCStatsDelayedPkts, 
    524     bcmXflowMacsecSecyRxSCStatsUncheckedPkts = xflowMacsecSecyRxSCStatsUncheckedPkts, 
    525     bcmXflowMacsecSecyRxSCStatsOKPkts = xflowMacsecSecyRxSCStatsOKPkts, 
    526     bcmXflowMacsecSecyRxSCStatsOctetsValidated = xflowMacsecSecyRxSCStatsOctetsValidated, 
    527     bcmXflowMacsecSecyRxSCStatsOctetsDecrypted = xflowMacsecSecyRxSCStatsOctetsDecrypted, 
    528     bcmXflowMacsecSecyTxSAStatsProtectedPkts = xflowMacsecSecyTxSAStatsProtectedPkts, 
    529     bcmXflowMacsecSecyTxSAStatsEncryptedPkts = xflowMacsecSecyTxSAStatsEncryptedPkts, 
    530     bcmXflowMacsecSecyRxSAStatsUnusedSAPkts = xflowMacsecSecyRxSAStatsUnusedSAPkts, 
    531     bcmXflowMacsecSecyRxSAStatsNotUsingSAPkts = xflowMacsecSecyRxSAStatsNotUsingSAPkts, 
    532     bcmXflowMacsecSecyRxSAStatsNotValidPkts = xflowMacsecSecyRxSAStatsNotValidPkts, 
    533     bcmXflowMacsecSecyRxSAStatsInvalidPkts = xflowMacsecSecyRxSAStatsInvalidPkts, 
    534     bcmXflowMacsecSecyRxSAStatsOKPkts = xflowMacsecSecyRxSAStatsOKPkts, 
    535     bcmXflowMacsecInMgmtPkts = xflowMacsecInMgmtPkts, 
    536     bcmXflowMacsecFlowTcamHitCntr = xflowMacsecFlowTcamHitCntr, 
    537     bcmXflowMacsecFlowTcamMissCntr = xflowMacsecFlowTcamMissCntr, 
    538     bcmXflowMacsecScTcamHitCntr = xflowMacsecScTcamHitCntr, 
    539     bcmXflowMacsecScTcamMissCntr = xflowMacsecScTcamMissCntr, 
    540     bcmXflowMacsecOutMgmtPkts = xflowMacsecOutMgmtPkts, 
    541     bcmXflowMacsecInPacketDropCntr = xflowMacsecInPacketDropCntr, 
    542     bcmXflowMacsecOutPacketDropCntr = xflowMacsecOutPacketDropCntr, 
    543     bcmXflowMacsecBadOlpHdrCntr = xflowMacsecBadOlpHdrCntr, 
    544     bcmXflowMacsecStatTypeCount = xflowMacsecStatTypeCount 
    545 } bcm_xflow_macsec_stat_type_t;
    546 
    547 #ifndef BCM_HIDE_DISPATCHABLE
    548 
    549 /* 
    550  * Gets the counter value corresponding to the macsec_id and stat_type
    551  * provided.
    552  */
    553 extern int bcm_xflow_macsec_stat_get(
    554     int unit, 
    555     uint32 flags, 
    556     bcm_xflow_macsec_id_t id, 
    557     bcm_xflow_macsec_stat_type_t  stat_type, 
    558     uint64 *value);
    559 
    560 /* 
    561  * Sets the counter value corresponding to the macsec_id and stat_type
    562  * provided.
    563  */
    564 extern int bcm_xflow_macsec_stat_set(
    565     int unit, 
    566     uint32 flags, 
    567     bcm_xflow_macsec_id_t id, 
    568     bcm_xflow_macsec_stat_type_t  stat_type, 
    569     uint64 value);
    570 
    571 /* 
    572  * Gets an array of counter values corresponding to macsec_id and the
    573  * array of stat_type provided. The output ?stats_array? should be
    574  * allocated to hold ?array_count? number of values.
    575  */
    576 extern int bcm_xflow_macsec_stat_multi_get(
    577     int unit, 
    578     uint32 flags, 
    579     bcm_xflow_macsec_id_t id, 
    580     uint32 num_stats, 
    581     bcm_xflow_macsec_stat_type_t  *stat_type_array, 
    582     uint64 *value_array);
    583 
    584 /* 
    585  * Sets an array of counter values corresponding to macsec_id and the
    586  * array of stat_type provided. The output ?stats_array? should be
    587  * allocated to hold ?array_count? number of values.
    588  */
    589 extern int bcm_xflow_macsec_stat_multi_set(
    590     int unit, 
    591     uint32 flags, 
    592     bcm_xflow_macsec_id_t id, 
    593     uint32 num_stats, 
    594     bcm_xflow_macsec_stat_type_t  *stat_type_array, 
    595     uint64 *value_array);
    596 
    597 #endif /* BCM_HIDE_DISPATCHABLE */
    598 
    599 #define BCM_XFLOW_MACSEC_MATCH_TPID_SEL_0   XFLOW_MACSEC_MATCH_TPID_SEL_0 /* Select the first TPID
    600                                                           to be matched. */
    601 #define BCM_XFLOW_MACSEC_MATCH_TPID_SEL_1   XFLOW_MACSEC_MATCH_TPID_SEL_1 /* Select the second TPID
    602                                                           to be matched. */
    603 #define BCM_XFLOW_MACSEC_MATCH_TPID_SEL_2   XFLOW_MACSEC_MATCH_TPID_SEL_2 /* Select the third TPID
    604                                                           to be matched. */
    605 #define BCM_XFLOW_MACSEC_MATCH_TPID_SEL_3   XFLOW_MACSEC_MATCH_TPID_SEL_3 /* Select the fourth TPID
    606                                                           to be matched. */
    607 #define BCM_XFLOW_MACSEC_VLAN_TPID_MAX      XFLOW_MACSEC_VLAN_TPID_MAX /* Total TPIDs
    608                                                           configurable */
    609 
    610 typedef xflow_macsec_vlan_tpid_t bcm_xflow_macsec_vlan_tpid_t;
    611 
    612 #ifndef BCM_HIDE_DISPATCHABLE
    613 
    614 /* Set the four VLAN TPID for decrypt flow. */
    615 extern int bcm_xflow_macsec_vlan_tpid_array_set(
    616     int unit, 
    617     bcm_xflow_macsec_instance_id_t instance_id, 
    618     bcm_xflow_macsec_vlan_tpid_t *vlan_tpid);
    619 
    620 /* Retrieve the four vlan tpid configured. */
    621 extern int bcm_xflow_macsec_vlan_tpid_array_get(
    622     int unit, 
    623     bcm_xflow_macsec_instance_id_t instance_id, 
    624     bcm_xflow_macsec_vlan_tpid_t *vlan_tpid);
    625 
    626 /* 
    627  * Get the index corresponding to a TPID value. This is to be used in the
    628  * decrypt policy.
    629  */
    630 extern int bcm_xflow_macsec_vlan_tpid_array_index_get(
    631     int unit, 
    632     bcm_xflow_macsec_instance_id_t instance_id, 
    633     uint32 vlan_tpid, 
    634     uint8 *tpid_index_sel);
    635 
    636 #endif /* BCM_HIDE_DISPATCHABLE */
    637 
    638 #define BCM_XFLOW_MACSEC_MTU_WITH_ID    XFLOW_MACSEC_MTU_WITH_ID /* The mtu_index is provided
    639                                                       as an input. */
    640 
    641 #ifndef BCM_HIDE_DISPATCHABLE
    642 
    643 /* 
    644  * Set the MTU for encrypt or decrypt flow and get the corresponding MTU
    645  * sel. The sel can be used with SC config. To clear the value, set mtu
    646  * as 0 for the corresponding mtu_sel (IN).
    647  */
    648 extern int bcm_xflow_macsec_mtu_set(
    649     int unit, 
    650     int flags, 
    651     bcm_xflow_macsec_instance_id_t instance_id, 
    652     uint32 mtu, 
    653     bcm_xflow_macsec_mtu_t *mtu_sel);
    654 
    655 /* Get the value corresponding to a MTU sel. */
    656 extern int bcm_xflow_macsec_mtu_get(
    657     int unit, 
    658     int flags, 
    659     bcm_xflow_macsec_instance_id_t instance_id, 
    660     bcm_xflow_macsec_mtu_t mtu_sel, 
    661     uint32 *mtu);
    662 
    663 #endif /* BCM_HIDE_DISPATCHABLE */
    664 
    665 #define BCM_XFLOW_MACSEC_ETHERTYPE_WITH_ID  XFLOW_MACSEC_ETHERTYPE_WITH_ID /* The sectag_etype_index
    666                                                           is provided as input. */
    667 
    668 #ifndef BCM_HIDE_DISPATCHABLE
    669 
    670 /* 
    671  * Set the sectag Ethertype and get the corresponding ethertype sel. To
    672  * clear this value, set the sectag_etype to 0 for the given
    673  * sectag_etype_sel(IN) along with the appropriate flag. This API is
    674  * applicable to both encrypt and decrypt.
    675  */
    676 extern int bcm_xflow_macsec_sectag_etype_set(
    677     int unit, 
    678     int flags, 
    679     bcm_xflow_macsec_instance_id_t instance_id, 
    680     uint32 sectag_etype, 
    681     bcm_xflow_macsec_sectag_ethertype_t *sectag_etype_sel);
    682 
    683 /* Get the value corresponding to a Sectag Ethertype select. */
    684 extern int bcm_xflow_macsec_sectag_etype_get(
    685     int unit, 
    686     bcm_xflow_macsec_instance_id_t instance_id, 
    687     bcm_xflow_macsec_sectag_ethertype_t sectag_etype_sel, 
    688     uint32 *sectag_etype);
    689 
    690 #endif /* BCM_HIDE_DISPATCHABLE */
    691 
    692 typedef enum bcm_xflow_macsec_event_e {
    693     bcmXflowMacsecEventSASoftExpire = xflowMacsecEventSASoftExpire, /* SA Soft Expire event. This indicates
    694                                            that the PN for a given SA has hit
    695                                            the threshold value configured. The
    696                                            index id has to be typecasted to
    697                                            bcm_xflow_macsec_secure_assoc_id_t. */
    698     bcmXflowMacsecEventSAExpire = xflowMacsecEventSAExpire, /* SA Expire event. This indicates that
    699                                            the PN for a given SA has hit the
    700                                            maximum value possible. For AES
    701                                            algorithm, this is 2^32. For AES XPN
    702                                            algorithm, this is 2^64. The index id
    703                                            has to be typecasted to
    704                                            bcm_xflow_macsec_secure_assoc_id_t. */
    705     bcmXflowMacsecEventCount = xflowMacsecEventCount 
    706 } bcm_xflow_macsec_event_t;
    707 
    708 /* 
    709  * Callback function to notify Xflow Macsec events. The flags specify
    710  * whether the callback is for encrypt or decrypt. The index id should be
    711  * typecasted based on the event.
    712  */
    713 typedef int (*bcm_xflow_macsec_event_cb)(
    714     int unit, 
    715     uint32 flags, 
    716     bcm_xflow_macsec_instance_id_t instance_id, 
    717     bcm_xflow_macsec_event_t event, 
    718     bcm_xflow_macsec_id_t id, 
    719     void *user_data);
    720 
    721 #ifndef BCM_HIDE_DISPATCHABLE
    722 
    723 /* 
    724  * Xflow Macsec callback registration API. The callback function will be
    725  * invoked when an event occurs.
    726  */
    727 extern int bcm_xflow_macsec_event_register(
    728     int unit, 
    729     bcm_xflow_macsec_event_cb cb, 
    730     void *user_data);
    731 
    732 /* Xflow Macsec callback deregistration API. */
    733 extern int bcm_xflow_macsec_event_deregister(
    734     int unit, 
    735     bcm_xflow_macsec_event_cb cb);
    736 
    737 #endif /* BCM_HIDE_DISPATCHABLE */
    738 
    739 typedef xflow_macsec_mac_addr_info_t bcm_xflow_macsec_mac_addr_info_t;
    740 
    741 typedef enum bcm_xflow_macsec_mac_addr_control_e {
    742     bcmXflowMacsecStationDstMac = xflowMacsecStationDstMac, /* Station mac addressed to be used when
    743                                            a dropped packet is to be copied to
    744                                            cpu.
    745                                            Argument mac_addr_info.mac_addr
    746                                            specifies the station MACDA.
    747                                            Not applicable to Inline Xflow
    748                                            Macsec. */
    749     bcmXflowMacsecMacAddrControlCount = xflowMacsecMacAddrControlCount /* Max value. */
    750 } bcm_xflow_macsec_mac_addr_control_t;
    751 
    752 #ifndef BCM_HIDE_DISPATCHABLE
    753 
    754 /* Sets the value in HW for the macsec control type provided. */
    755 extern int bcm_xflow_macsec_mac_addr_control_set(
    756     int unit, 
    757     uint32 flags, 
    758     bcm_xflow_macsec_instance_id_t instance_id, 
    759     bcm_xflow_macsec_mac_addr_control_t control_type, 
    760     bcm_xflow_macsec_mac_addr_info_t *control_info);
    761 
    762 /* Sets the value in HW for the macsec control type provided. */
    763 extern int bcm_xflow_macsec_mac_addr_control_get(
    764     int unit, 
    765     uint32 flags, 
    766     bcm_xflow_macsec_instance_id_t instance_id, 
    767     bcm_xflow_macsec_mac_addr_control_t control_type, 
    768     bcm_xflow_macsec_mac_addr_info_t *control_info);
    769 
    770 #endif /* defined(INCLUDE_XFLOW_MACSEC) */
    771 
    772 #endif /* BCM_HIDE_DISPATCHABLE */
    773 
    774 #endif /* __BCM_XFLOW_MACSEC_H__ */