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

rx.h (6151B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        rx.h
      8  * Purpose:     Internal structures and definitions for RX module
      9  */
     10 
     11 #ifndef   _BCM_RX_H_
     12 #define   _BCM_RX_H_
     13 
     14 #include <sdk_config.h>
     15 #include <soc/dma.h>
     16 #include <bcm/error.h>
     17 #include <bcm/rx.h>
     18 #include <bcm_int/common/rx.h>
     19 
     20 /* Hardware values for different redirection configuration */
     21 #define _BCM_RX_COPYTOCPU_BUFFER_PRIORITY_LOW    0x0
     22 #define _BCM_RX_COPYTOCPU_BUFFER_PRIORITY_MEDIUM 0x1
     23 #define _BCM_RX_COPYTOCPU_BUFFER_PRIORITY_HIGH   0x2
     24 
     25 /* This is the tunnel header description */
     26 #define TUNNEL_RX_HEADER_LEN_OFS             0    /* uint16 */
     27 #define TUNNEL_RX_HEADER_REASON_OFS          2    /* uint32 */
     28 #define TUNNEL_RX_HEADER_RX_UNIT_OFS         6
     29 #define TUNNEL_RX_HEADER_RX_PORT_OFS         7
     30 #define TUNNEL_RX_HEADER_RX_CPU_COS_OFS      8
     31 #define TUNNEL_RX_HEADER_RX_UNTAGGED_OFS     9
     32 #define TUNNEL_RX_HEADER_COS_OFS             10
     33 #define TUNNEL_RX_HEADER_PRIO_INT_OFS        11
     34 #define TUNNEL_RX_HEADER_SRC_PORT_OFS        12
     35 #define TUNNEL_RX_HEADER_SRC_MOD_OFS         13
     36 #define TUNNEL_RX_HEADER_DEST_PORT_OFS       14
     37 #define TUNNEL_RX_HEADER_DEST_MOD_OFS        15
     38 #define TUNNEL_RX_HEADER_OPCODE_OFS          16
     39 #define TUNNEL_RX_HEADER_BYTES               17
     40 
     41 /* Sync for copy-to-cpu config */
     42 extern sal_mutex_t  _bcmi_rx_copy_to_cpu_config_mutex[BCM_MAX_NUM_UNITS];
     43 
     44 /* Place holder to store the copy-to-cpu configuration data */
     45 typedef struct _bcmi_rx_CopyToCpu_config_s {
     46     int flags;                          /* Flags to pass with configuration data */
     47     int index;                          /* Index of the entry */
     48     bcm_pkt_drop_reasons_t drop_reason_vector; /* Array of drop reasons */
     49     int strength;                       /* Strength of the entry */
     50     int buffer_priority;                /* Buffering priority of the redirected
     51                                            packet */
     52     int cpu_cosq;                       /* CPU CoS queue to use */
     53 } _bcmi_rx_CopyToCpu_config_t;
     54 
     55 /* Copy to CPU config data */
     56 extern _bcmi_rx_CopyToCpu_config_t
     57     *(_bcmi_rx_egr_drop_copy_to_cpu_config_data[BCM_MAX_NUM_UNITS]);
     58 
     59 /* Place holder to store the inuse bitmap for copy-to-cpu config */
     60 extern SHR_BITDCL
     61     *(_bcmi_rx_egr_drop_copy_to_cpu_loc_bitmap[BCM_MAX_NUM_UNITS]);
     62 
     63 /* Get accessors for the config data */
     64 #define BCMI_GET_COPY_TOCPU_FLAGS_GET(unit, index) \
     65         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].flags
     66 
     67 #define BCMI_GET_COPY_TOCPU_DROP_REASONS_GET(unit, index) \
     68         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index]. \
     69                                             drop_reason_vector
     70 
     71 #define BCMI_GET_COPY_TOCPU_STRENGTH_GET(unit, index) \
     72         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index]. \
     73                                             strength
     74 
     75 #define BCMI_GET_COPY_TOCPU_BUFFER_PRIORITY_GET(unit, index) \
     76         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index]. \
     77                                             buffer_priority
     78 
     79 #define BCMI_GET_COPY_TOCPU_COS_Q_GET(unit, index) \
     80         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index]. \
     81                                             cpu_cosq
     82 
     83 /* Set accessors for the config data */
     84 #define BCMI_GET_COPY_TOCPU_FLAGS_SET(unit, index, flags_val) \
     85         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].flags \
     86                                             = flags_val
     87 
     88 #define BCMI_GET_COPY_TOCPU_DROP_REASONS_SET(unit, index, drop_reasons_val) \
     89         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].drop_reason_vector \
     90                                             = drop_reasons_val
     91 
     92 #define BCMI_GET_COPY_TOCPU_STRENGTH_SET(unit, index, strength_val) \
     93         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].strength \
     94                                             = strength_val
     95 
     96 #define BCMI_GET_COPY_TOCPU_BUFFER_PRIORITY_SET(unit, index, buffer_priority_val) \
     97         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].buffer_priority \
     98                                             = buffer_priority_val
     99 
    100 #define BCMI_GET_COPY_TOCPU_COS_Q_SET(unit, index, cpu_cosq_val) \
    101         _bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][index].cpu_cosq \
    102                                             = cpu_cosq_val
    103 
    104 /* Accessors to get size for the config data fields */
    105 #define BCMI_GET_COPY_TOCPU_FLAGS_SIZE_GET(unit) \
    106         sizeof(_bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][0].flags)
    107 
    108 #define BCMI_GET_COPY_TOCPU_DROP_REASONS_SIZE_GET(unit) \
    109         sizeof(_bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][0]. \
    110                                                     drop_reason_vector)
    111 
    112 #define BCMI_GET_COPY_TOCPU_STRENGTH_SIZE_GET(unit) \
    113         sizeof(_bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][0].strength)
    114 
    115 #define BCMI_GET_COPY_TOCPU_BUFFER_PRIORITY_SIZE_GET(unit) \
    116         sizeof(_bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][0]. \
    117                                                     buffer_priority)
    118 
    119 #define BCMI_GET_COPY_TOCPU_COS_Q_SIZE_GET(unit) \
    120         sizeof(_bcmi_rx_egr_drop_copy_to_cpu_config_data[unit][0].cpu_cosq)
    121 
    122 /*
    123  * RX_COPYTO_CPU_LOCK/UNLOCK should be used to synchronize
    124  * Copy-to-Cpu configuration.
    125  */
    126 
    127 #define RX_COPY_TO_CPU_LOCK(unit)        \
    128     sal_mutex_take(_bcmi_rx_copy_to_cpu_config_mutex[unit], \
    129     sal_mutex_FOREVER)
    130 #define RX_COPY_TO_CPU_UNLOCK(unit)      \
    131     sal_mutex_give(_bcmi_rx_copy_to_cpu_config_mutex[unit])
    132 
    133 extern int _bcm_rx_shutdown(int unit);
    134 extern int bcm_esw_rx_deinit(int unit);
    135 
    136 extern int _bcm_esw_rx_olp_match_rule_set (int unit, int olp_match_rule);
    137 extern int _bcm_esw_rx_olp_match_rule_get (int unit, int *olp_match_rule);
    138 #ifdef BCM_WARM_BOOT_SUPPORT
    139 extern int _bcm_esw_rx_sync(int unit);
    140 #endif
    141 
    142 #ifdef BCM_TRX_SUPPORT
    143 extern int _bcm_trx_rx_cosq_mapping_init(int unit);
    144 #endif /* BCM_TRX_SUPPORT */
    145 
    146 #if defined(INCLUDE_PKTIO)
    147 extern int bcm_tomahawk3x_rx_deinit(int unit);
    148 #endif /* INCLUDE_PKTIO */
    149 
    150 #endif  /* !_BCM_RX_H_ */