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

oam.c (10733B)


      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-2019 Broadcom Inc. All rights reserved.
      7  *
      8  * This program is the proprietary software of Broadcom Corporation
      9  * and/or its licensors, and may only be used, duplicated, modified
     10  * or distributed pursuant to the terms and conditions of a separate,
     11  * written license agreement executed between you and Broadcom
     12  * (an "Authorized License").  Except as set forth in an Authorized
     13  * License, Broadcom grants no license (express or implied), right
     14  * to use, or waiver of any kind with respect to the Software, and
     15  * Broadcom expressly reserves all rights in and to the Software and
     16  * all intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED
     17  * LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY,
     18  * AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE
     19  * OF THE SOFTWARE. 
     20  *
     21  * Except as expressly set forth in the Authorized License,
     22  *
     23  * 1. This program, including its structure, sequence and organization,
     24  * constitutes the valuable trade secrets of Broadcom, and you shall use
     25  * all reasonable efforts to protect the confidentiality thereof, and
     26  * to use this information only in connection with your use of Broadcom
     27  * integrated circuit products.
     28  *
     29  * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED
     30  * "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
     31  * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
     32  * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
     33  * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
     34  * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
     35  * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
     36  * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
     37  * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
     38  * 
     39  * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM
     40  * OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL,
     41  * INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY
     42  * RELATING TO YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF
     43  * BROADCOM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR (ii)
     44  * ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE
     45  * ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE LIMITATIONS SHALL
     46  * APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED
     47  * REMEDY.
     48  */
     49 
     50 #include <sal/core/libc.h>
     51 #include <bcm/oam.h>
     52 
     53 #if defined(INCLUDE_BHH)
     54 #include <bcm_int/esw/bhh_feature.h>
     55 
     56 /*Global to hold the bhh firmware version for feature compatibility check */
     57 uint32 bhh_firmware_version = BHH_UC_MIN_VERSION;
     58 #endif
     59 
     60 #if defined(INCLUDE_ETH_LM_DM)
     61 #include <bcm_int/esw/eth_lm_dm_feature.h>
     62 
     63 /*Global to hold the eth lm/dm firmware version for feature compatibility check */
     64 uint32 eth_lm_dm_firmware_version = ETH_LM_DM_UC_MIN_VERSION;
     65 #endif
     66 
     67 #if defined(INCLUDE_MPLS_LM_DM)
     68 #include <bcm_int/esw/mpls_lm_dm_feature.h>
     69 
     70 /*Global to hold the mpls lm/dm firmware version for feature compatibility check */
     71 uint32 mpls_lm_dm_firmware_version = MPLS_LM_DM_UC_MIN_VERSION;
     72 #endif
     73 /*
     74  * Function:
     75  *      bcm_oam_group_info_t_init
     76  * Purpose:
     77  *      Initialize an OAM group info structure
     78  * Parameters:
     79  *      group_info - (OUT) Pointer to OAM group info structure to be initialized
     80  * Returns:
     81  *      BCM_E_XXX
     82  * Notes:
     83  */
     84 void 
     85 bcm_oam_group_info_t_init(
     86     bcm_oam_group_info_t *group_info)
     87 {
     88     sal_memset(group_info, 0, sizeof(bcm_oam_group_info_t));
     89 }
     90 
     91 /*
     92  * Function:
     93  *      bcm_oam_endpoint_info_t_init
     94  * Purpose:
     95  *      Initialize an OAM endpoint info structure
     96  * Parameters:
     97  *      endpoint_info - (OUT) Pointer to OAM endpoint info structure to be initialized
     98  * Returns:
     99  *      BCM_E_XXX
    100  * Notes:
    101  */
    102 void 
    103 bcm_oam_endpoint_info_t_init(
    104     bcm_oam_endpoint_info_t *endpoint_info)
    105 {
    106     sal_memset(endpoint_info, 0, sizeof(bcm_oam_endpoint_info_t));
    107     endpoint_info->gport            	= BCM_GPORT_INVALID;
    108     endpoint_info->tx_gport         	= BCM_GPORT_INVALID;
    109     endpoint_info->remote_gport     	= BCM_GPORT_INVALID;
    110     endpoint_info->mpls_out_gport   	= BCM_GPORT_INVALID;
    111     endpoint_info->action_reference_id 	= BCM_OAM_ENDPOINT_INVALID;
    112 #ifdef INCLUDE_L3
    113     bcm_mpls_egress_label_t_init(&endpoint_info->egress_label);
    114 #endif
    115 }
    116 
    117 /*
    118  * Function:
    119  *      bcm_oam_loss_t_init
    120  * Purpose:
    121  *      Initialize an OAM loss structure
    122  * Parameters:
    123  *      loss_ptr - (OUT) Pointer to OAM loss structure to be initialized
    124  * Returns:
    125  *      BCM_E_XXX
    126  * Notes:
    127  */
    128 void
    129 bcm_oam_loss_t_init(
    130     bcm_oam_loss_t *loss_ptr)
    131 {
    132     sal_memset(loss_ptr, 0, sizeof(bcm_oam_loss_t));
    133     loss_ptr->pkt_pri_bitmap = ~0;
    134 }
    135 
    136 /*
    137  * Function:
    138  *      bcm_oam_delay_t_init
    139  * Purpose:
    140  *      Initialize an OAM delay structure
    141  * Parameters:
    142  *      delay_ptr - (OUT) Pointer to OAM delay structure to be initialized
    143  * Returns:
    144  *      BCM_E_XXX
    145  * Notes:
    146  */
    147 void
    148 bcm_oam_delay_t_init(
    149     bcm_oam_delay_t *delay_ptr)
    150 {
    151     sal_memset(delay_ptr, 0, sizeof(bcm_oam_delay_t));
    152     delay_ptr->pkt_pri_bitmap = ~0;
    153 }
    154 
    155 
    156 /*
    157  * Function:
    158  *      bcm_oam_ais_t_init
    159  * Purpose:
    160  *      Initialize an AIS delay structure
    161  * Parameters:
    162  *      ais_ptr - (OUT) Pointer to OAM delay structure to be initialized
    163  * Returns:
    164  *      BCM_E_XXX
    165  * Notes:
    166  */
    167 void
    168 bcm_oam_ais_t_init(
    169     bcm_oam_ais_t *ais_ptr)
    170 {
    171     sal_memset(ais_ptr, 0, sizeof(bcm_oam_ais_t));
    172 }
    173 
    174 /*
    175  * Function:
    176  *      bcm_oam_performance_event_data_t_init
    177  * Purpose:
    178  *      Initialize an bcm_oam_performance_event_data_t structure
    179  * Parameters:
    180  *      performance_event_data_ptr - (OUT) Pointer to bcm_oam_performance_event_data_t structure to be initialized
    181  */
    182 /* Initialize an performance event data structure */
    183 void bcm_oam_performance_event_data_t_init(
    184     bcm_oam_performance_event_data_t *performance_event_data_ptr)
    185 {
    186     sal_memset(performance_event_data_ptr, 0, sizeof(bcm_oam_performance_event_data_t));
    187 }
    188 
    189 /*
    190  * Function:
    191  *      bcm_oam_psc_t_init
    192  * Purpose:
    193  *      Initialize an OAM PSC structure
    194  * Parameters:
    195  *      psc_ptr - (OUT) Pointer to OAM PSC structure to be initialized
    196  * Returns:
    197  *      BCM_E_XXX
    198  * Notes:
    199  */
    200 void
    201 bcm_oam_psc_t_init(
    202     bcm_oam_psc_t *psc_ptr)
    203 {
    204     sal_memset(psc_ptr, 0, sizeof(bcm_oam_psc_t));
    205 }
    206 
    207 /*
    208  * Function:
    209  *      bcm_oam_loopback_t_init
    210  * Purpose:
    211  *      Initialize an OAM loopback structure
    212  * Parameters:
    213  *      loopback_ptr - (OUT) Pointer to OAM loopback structure to be initialized
    214  * Returns:
    215  *      BCM_E_XXX
    216  * Notes:
    217  */
    218 void
    219 bcm_oam_loopback_t_init(
    220     bcm_oam_loopback_t *loopback_ptr)
    221 {
    222     sal_memset(loopback_ptr, 0, sizeof(bcm_oam_loopback_t));
    223 	loopback_ptr->int_pri = -1;
    224 	loopback_ptr->pkt_pri = 0xff;
    225 	loopback_ptr->inner_pkt_pri = 0xff;
    226 }
    227 
    228 /*
    229  * Function:
    230  *      bcm_oam_pw_status_t_init
    231  * Purpose:
    232  *      Initialize an OAM PW Status structure
    233  * Parameters:
    234  *      pw_status_ptr - (OUT) Pointer to OAM PW Status structure to be initialized
    235  * Returns:
    236  *      BCM_E_XXX
    237  * Notes:
    238  */
    239 void
    240 bcm_oam_pw_status_t_init(
    241     bcm_oam_pw_status_t *pw_status_ptr)
    242 {
    243     sal_memset(pw_status_ptr, 0, sizeof(bcm_oam_pw_status_t));
    244 }
    245 
    246 /*
    247  * Function:
    248  *      bcm_oam_tst_tx_t_init
    249  * Purpose:
    250  *      Initialize an tst_tx structure
    251  * Parameters:
    252  *      tst_tx_info - (OUT) Pointer to OAM tst_tx structure to be initialized
    253  * Returns:
    254  *      BCM_E_XXX
    255  * Notes:
    256  */
    257 void bcm_oam_tst_tx_t_init(
    258     bcm_oam_tst_tx_t *tst_tx_info)
    259 {
    260     sal_memset(tst_tx_info, 0, sizeof(bcm_oam_tst_tx_t));
    261 }
    262 
    263 /*
    264  * Function:
    265  *      bcm_oam_tst_rx_t_init
    266  * Purpose:
    267  *      Initialize an tst_rx structure
    268  * Parameters:
    269  *      tst_rx_info - (OUT) Pointer to OAM tst_rx structure to be initialized
    270  * Returns:
    271  *      BCM_E_XXX
    272  * Notes:
    273  */
    274 void bcm_oam_tst_rx_t_init(
    275     bcm_oam_tst_rx_t *tst_rx_info)
    276 {
    277     sal_memset(tst_rx_info, 0, sizeof(bcm_oam_tst_rx_t));
    278 }
    279 
    280 /*
    281  * Function:
    282  *      bcm_oam_csf_t_init
    283  * Purpose:
    284  *      Initialize an CSF delay structure
    285  * Parameters:
    286  *      csf_ptr - (OUT) Pointer to OAM delay structure to be initialized
    287  * Returns:
    288  *      BCM_E_XXX
    289  * Notes:
    290  */
    291 void
    292 bcm_oam_csf_t_init(
    293     bcm_oam_csf_t *csf_ptr)
    294 {
    295     sal_memset(csf_ptr, 0, sizeof(bcm_oam_csf_t));
    296 }
    297 
    298 /*
    299  * Function:
    300  *      bcm_oam_sd_sf_detection_t_init
    301  * Purpose:
    302  *      Initialize an sd_sf_detection structure
    303  * Parameters:
    304  *      sd_sf_ptr - (OUT) Pointer to OAM sd_sf_detection structure to be initialized
    305  * Returns:
    306  *      BCM_E_XXX
    307  * Notes:
    308  */
    309 void bcm_oam_sd_sf_detection_t_init(
    310     bcm_oam_sd_sf_detection_t *sd_sf_ptr)
    311 {
    312     sal_memset(sd_sf_ptr, 0, sizeof(bcm_oam_sd_sf_detection_t));
    313 }
    314 
    315 /*
    316  * Function:
    317  *      bcm_oam_y_1711_alarm_t_init
    318  * Purpose:
    319  *      Initialize an Y.1711 alarm structure
    320  * Parameters:
    321  *      sd_sf_ptr - (OUT) Pointer to OAM Y.1711 alarm structure to be initialized
    322  * Returns:
    323  *      BCM_E_XXX
    324  * Notes:
    325  */
    326 void bcm_oam_y_1711_alarm_t_init(
    327     bcm_oam_y_1711_alarm_t *alarm_ptr)
    328 {
    329     sal_memset(alarm_ptr, 0, sizeof(bcm_oam_y_1711_alarm_t));
    330 }
    331 
    332 /*
    333  * Function:
    334  *      bcm_oam_endpoint_action_t_init 
    335  * Purpose:
    336  *      Initialize an bcm_oam_endpoint_action_t structure
    337  * Parameters:
    338  *      action_ptr - (OUT) Pointer to OAM OPCODE ACTION structure 
    339  *                   to be initialized
    340  * Returns:
    341  *      BCM_E_XXX
    342  * Notes:
    343  */
    344 void bcm_oam_endpoint_action_t_init(
    345     bcm_oam_endpoint_action_t *action_ptr)
    346 {
    347     sal_memset(action_ptr, 0, sizeof(bcm_oam_endpoint_action_t));
    348     action_ptr->destination = BCM_GPORT_INVALID;
    349     action_ptr->destination2 = BCM_GPORT_INVALID;
    350 }
    351 
    352  /*
    353   * Function:
    354   *      bcm_oam_action_key_t_init 
    355   * Purpose:
    356   *      Initialize a bcm_oam_action_key_t structure
    357   * Parameters:
    358   *      action_key_ptr - (OUT) Pointer to an OAM ACTION key 
    359   *                   to be initialized
    360   * Returns:
    361   *      void
    362   * Notes:
    363   */
    364  void bcm_oam_action_key_t_init(
    365      bcm_oam_action_key_t *action_key_ptr)
    366  {
    367      sal_memset(action_key_ptr, 0, sizeof(bcm_oam_action_key_t));
    368      action_key_ptr->dest_mac_type = bcmOAMDestMacTypeCount;
    369      action_key_ptr->endpoint_type = bcmOAMMatchTypeCount;
    370      action_key_ptr->opcode = bcmOamOpcodeMax;
    371  }
    372  
    373  /*
    374   * Function:
    375   *      bcm_oam_action_result_t_init 
    376   * Purpose:
    377   *      Initialize a bcm_oam_action_result_t structure
    378   * Parameters:
    379   *      action_result_ptr - (OUT) Pointer to an OAM ACTION result 
    380   *                   to be initialized
    381   * Returns:
    382   *      void
    383   * Notes:
    384   */
    385  void bcm_oam_action_result_t_init(
    386      bcm_oam_action_result_t *action_result_ptr)
    387  {
    388      sal_memset(action_result_ptr, 0, sizeof(bcm_oam_action_result_t));
    389  }