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

vlan.c (5113B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #include <soc/drv.h>
      9 #include <soc/mem.h>
     10 #include <soc/debug.h>
     11 
     12 #include <sal/core/boot.h>
     13 
     14 #include <bcm/error.h>
     15 #include <bcm/vlan.h>
     16 #include <bcm/stg.h>
     17 #include <bcm/port.h>
     18 #include <bcm/trunk.h>
     19 #include <bcm/debug.h>
     20 #include <bcm/switch.h>
     21 #include <bcm/stat.h>
     22 #include <bcm/tsn.h>
     23 
     24 /*
     25  * Function:
     26  *      bcm_vlan_ip_t_init
     27  * Purpose:
     28  *      Initialize the vlan_ip_t structure
     29  * Parameters:
     30  *      vlan_ip - Pointer to structure which should be initialized
     31  * Returns:
     32  *      NONE
     33 */
     34 void 
     35 bcm_vlan_ip_t_init(bcm_vlan_ip_t *vlan_ip)
     36 {
     37     if (NULL != vlan_ip) {
     38         sal_memset(vlan_ip, 0, sizeof (bcm_vlan_ip_t));
     39     }
     40     return;
     41 }
     42 
     43 /*
     44  * Function:
     45  *      bcm_vlan_data_t_init
     46  * Purpose:
     47  *      Initialize the bcm_vlan_data_t structure
     48  * Parameters:
     49  *      vlan_data - Pointer to vlan data info structure
     50  * Returns:
     51  *      NONE
     52  */
     53 void
     54 bcm_vlan_data_t_init(bcm_vlan_data_t *vlan_data)
     55 {
     56     if (vlan_data != NULL) {
     57         sal_memset(vlan_data, 0, sizeof (bcm_vlan_data_t));
     58     }
     59     return;
     60 }
     61 
     62 /*
     63  * Function:
     64  *      bcm_vlan_control_vlan_t_init
     65  * Purpose:
     66  *      Initialize the bcm_vlan_control_vlan_t structure
     67  * Parameters:
     68  *      data - Pointer to vlan control structure to inititalize
     69  * Returns:
     70  *      NONE
     71  */
     72 void
     73 bcm_vlan_control_vlan_t_init(bcm_vlan_control_vlan_t *data)
     74 {
     75     if (data != NULL) {
     76         sal_memset(data, 0, sizeof(bcm_vlan_control_vlan_t));
     77         data->outer_tpid = 0x8100;
     78     }
     79     return;
     80 }
     81 
     82 /*
     83  * Function:
     84  *      bcm_vlan_block_t_init
     85  * Purpose:
     86  *      Initialize the bcm_vlan_block_t structure
     87  * Parameters:
     88  *      data - Pointer to vlan block structure to inititalize
     89  * Returns:
     90  *      NONE
     91  */
     92 void
     93 bcm_vlan_block_t_init(bcm_vlan_block_t *data)
     94 {
     95     if (data != NULL) {
     96         sal_memset(data, 0, sizeof(bcm_vlan_block_t));
     97     }
     98     return;
     99 }
    100 
    101 
    102 /*
    103  * Function:
    104  *      bcm_vlan_action_set_t_init
    105  * Purpose:
    106  *      Initialize the bcm_vlan_action_set_t structure
    107  * Parameters:
    108  *      data - Pointer to vlan action structure to inititalize
    109  * Returns:
    110  *      NONE
    111  */
    112 void
    113 bcm_vlan_action_set_t_init(bcm_vlan_action_set_t *data)
    114 {
    115     if (data != NULL) {
    116         sal_memset(data, 0, sizeof(bcm_vlan_action_set_t));
    117         data->taf_gate_primap = BCM_TSN_PRI_MAP_INVALID;
    118     }
    119     return;
    120 }
    121 
    122 /*
    123 * Function:
    124 *      bcm_vlan_translate_action_class_t_init
    125 * Purpose:
    126 *      Initialize the bcm_vlan_translate_action_class_t structure
    127 * Parameters:
    128 *      info - Pointer to the structure which should be initialized
    129 * Returns:
    130 *      NONE
    131 */
    132 void 
    133 bcm_vlan_translate_action_class_t_init(bcm_vlan_translate_action_class_t *action_class)
    134 {
    135     if (NULL != action_class) {
    136         sal_memset(action_class, 0, sizeof (*action_class));
    137     }
    138     return;
    139 }
    140 
    141 /*
    142  * Function:
    143  *      bcm_vlan_port_t_init
    144  * Purpose:
    145  *      Initialize the bcm_vlan_port_t structure
    146  * Parameters:
    147  *      data - Pointer to vlan port structure to inititalize
    148  * Returns:
    149  *      NONE
    150  */
    151 void
    152 bcm_vlan_port_t_init(bcm_vlan_port_t *data)
    153 {
    154     if (data != NULL) {
    155         sal_memset(data, 0, sizeof(bcm_vlan_port_t));
    156         data->outlif_counting_profile = BCM_STAT_LIF_COUNTING_PROFILE_NONE;
    157         data->inlif_counting_profile = BCM_STAT_LIF_COUNTING_PROFILE_NONE;
    158     }
    159     return;
    160 }
    161 
    162 /*
    163 * Function:
    164 *      bcm_vlan_port_translation_t_init
    165 * Purpose:
    166 *      Initialize the bcm_vlan_port_translation_t structure
    167 * Parameters:
    168 *      info - Pointer to the structure which should be initialized
    169 * Returns:
    170 *      NONE
    171 */
    172 void 
    173 bcm_vlan_port_translation_t_init(bcm_vlan_port_translation_t *vlan_port_translation)
    174 {
    175     if (NULL != vlan_port_translation) {
    176         sal_memset(vlan_port_translation, 0, sizeof (*vlan_port_translation));
    177     }
    178     return;
    179 }
    180 
    181 /*
    182  * Function:
    183  *      bcm_vlan_gport_info_t_init
    184  * Purpose:
    185  *      Initialize the bcm_vlan_gport_info_t structure
    186  * Parameters:
    187  *      data - Pointer to vlan gport info structure to inititalize
    188  * Returns:
    189  *      NONE
    190  */
    191 void
    192 bcm_vlan_gport_info_t_init(bcm_vlan_gport_info_t *data)
    193 {
    194     if (data != NULL) {
    195         sal_memset(data, 0, sizeof(bcm_vlan_gport_info_t));
    196     }
    197     return;
    198 }
    199 
    200 #if defined(INCLUDE_L3)
    201 /*
    202  * Function:
    203  *      bcm_vlan_vpn_config_t_init
    204  * Purpose:
    205  *      Initialize VLAN vpn config struct
    206  * Parameters:
    207  *      info - Pointer to the struct to be inited
    208  * Returns:
    209  *      NONE
    210  */
    211 void bcm_vlan_vpn_config_t_init(bcm_vlan_vpn_config_t *info)
    212 {
    213     if (info != NULL) {
    214         sal_memset(info, 0, sizeof(*info));
    215     }
    216 
    217     return;
    218 }
    219 #endif
    220 
    221 /*
    222  * Function:
    223  *      bcm_vlan_match_info_t_init
    224  * Purpose:
    225  *      Initialize the vlan match info structure
    226  * Parameters:
    227  *      info - Pointer to the struct to be inited
    228  * Returns:
    229  *      NONE
    230  */
    231 void bcm_vlan_match_info_t_init(bcm_vlan_match_info_t *vlan_match_info)
    232 {
    233     if (vlan_match_info != NULL) {
    234         sal_memset(vlan_match_info, 0, sizeof(*vlan_match_info));
    235     }
    236 
    237     return;
    238 }