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

mirror.c (3632B)


      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  * File:    mirror.c
      9  * Purpose: Common Mirror API
     10  */
     11 
     12 #include <soc/defs.h>
     13 
     14 #include <sal/core/libc.h>
     15 
     16 #include <soc/drv.h>
     17 #include <soc/mem.h>
     18 #include <soc/util.h>
     19 #include <soc/debug.h>
     20 
     21 #include <bcm/mirror.h>
     22 
     23 /*
     24  * Function:
     25  *      bcm_mirror_destination_t_init
     26  * Purpose:
     27  *      Initialize a mirror destination structure
     28  * Parameters:
     29  *      mirror_dest - pointer to the bcm_mirror_destination_t structure.
     30  * Returns:
     31  *      NONE
     32  */
     33 void
     34 bcm_mirror_destination_t_init(bcm_mirror_destination_t *mirror_dest)
     35 {
     36     if (NULL != mirror_dest) {
     37         sal_memset (mirror_dest, 0, sizeof(bcm_mirror_destination_t));
     38         mirror_dest->stat_id2 = -1;
     39     }
     40     return;
     41 }
     42 
     43 /*
     44  * Function:
     45  *      bcm_mirror_port_info_t_init
     46  * Purpose:
     47  *      Initialize a mirror port info structure
     48  * Parameters:
     49  *      mirror_info - pointer to the bcm_mirror_port_info_t structure.
     50  * Returns:
     51  *      NONE
     52  */
     53 void
     54 bcm_mirror_port_info_t_init(bcm_mirror_port_info_t *info)
     55 {
     56     if (NULL != info) {
     57         sal_memset (info, 0, sizeof(bcm_mirror_port_info_t));
     58     }
     59     return;
     60 }
     61 
     62 /*
     63  * Function:
     64  *      bcm_mirror_options_t_init
     65  * Purpose:
     66  *      Initialize a mirror options  structure
     67  * Parameters:
     68  *      options - pointer to the bcm_mirror_options_t structure.
     69  * Returns:
     70  *      NONE
     71  */
     72 void
     73 bcm_mirror_options_t_init(bcm_mirror_options_t *options)
     74 {
     75     if (NULL != options) {
     76         sal_memset (options, 0, sizeof(bcm_mirror_options_t));
     77         /* Enable mirroring by default*/
     78         options->forward_strength = 1;
     79         options->copy_strength = 1 ;
     80     }
     81 
     82     return;
     83 }
     84 
     85 /*
     86  * Function:
     87  *      bcm_mirror_pkt_header_updates_t_init
     88  * Purpose:
     89  *      Initialize a mirror pkt header updates  structure
     90  * Parameters:
     91  *      updates - pointer to the bcm_mirror_pkt_header_updates_t structure.
     92  * Returns:
     93  *      NONE
     94  */
     95 void
     96 bcm_mirror_pkt_header_updates_t_init(bcm_mirror_pkt_header_updates_t  *updates)
     97 {
     98     if (NULL != updates) {
     99         sal_memset (updates, 0, sizeof(bcm_mirror_pkt_header_updates_t));
    100     }
    101     return;
    102 }
    103 
    104 /*
    105  * Function:
    106  *      bcm_mirror_header_info_t_init
    107  * Purpose:
    108  *      Initialize a mirror header information structure
    109  * Parameters:
    110  *      updates - pointer to the bcm_mirror_header_info_t structure.
    111  * Returns:
    112  *      NONE
    113  */
    114 void
    115 bcm_mirror_header_info_t_init(bcm_mirror_header_info_t *mirror_header_info)
    116 {
    117     if (NULL != mirror_header_info) {
    118         sal_memset (mirror_header_info, 0, sizeof(bcm_mirror_header_info_t));
    119     }
    120     return;
    121 }
    122 
    123 /*
    124  * Function:
    125  *      bcm_mirror_payload_zero_info_t_init
    126  * Purpose:
    127  *      Initialize a payload zero info structure
    128  * Parameters:
    129  *      info - Pointer to the bcm_mirror_payload_zero_info_t structure
    130  * Returns:
    131  *      NONE
    132  */
    133 void
    134 bcm_mirror_payload_zero_info_t_init(bcm_mirror_payload_zero_info_t *info)
    135 {
    136     if (NULL != info) {
    137         sal_memset(info, 0, sizeof(bcm_mirror_payload_zero_info_t));
    138     }
    139 
    140     return;
    141 }
    142 
    143 /*
    144  * Function:
    145  *      bcm_mirror_payload_zero_offsets_t_init
    146  * Purpose:
    147  *      Initialize a payload zero offset structure
    148  * Parameters:
    149  *      info - Pointer to the bcm_mirror_payload_zero_offsets_t structure
    150  * Returns:
    151  *      NONE
    152  */
    153 void
    154 bcm_mirror_payload_zero_offsets_t_init(bcm_mirror_payload_zero_offsets_t *offset)
    155 {
    156     if (NULL != offset) {
    157         offset->l2_offset = -1;
    158         offset->l3_offset = -1;
    159         offset->udp_offset = -1;
    160     }
    161 
    162     return;
    163 }
    164