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

ifa.h (3614B)


      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:    ifa.h
      8  */
      9 
     10 #ifndef _BCM_INT_IFA_H_
     11 #define _BCM_INT_IFA_H_
     12 
     13 #if defined(INCLUDE_IFA)
     14 #include <soc/shared/ifa.h>
     15 #include <soc/shared/ifa_msg.h>
     16 #include <soc/profile_mem.h>
     17 #include <shared/idxres_fl.h>
     18 #include <bcm/ifa.h>
     19 
     20 /*
     21  * Macro:
     22  *     _BCM_IFA_ALLOC
     23  * Purpose:
     24  *      Generic memory allocation routine.
     25  * Parameters:
     26  *    _ptr_     - Pointer to allocated memory.
     27  *    _ptype_   - Pointer type.
     28  *    _size_    - Size of heap memory to be allocated.
     29  *    _descr_   - Information about this memory allocation.
     30  */
     31 #define _BCM_IFA_ALLOC(_ptr_,_ptype_,_size_,_descr_)                        \
     32     do {                                                                    \
     33         if (NULL == (_ptr_)) {                                              \
     34             (_ptr_) = (_ptype_ *) sal_alloc((_size_), (_descr_));           \
     35         }                                                                   \
     36         if((_ptr_) != NULL) {                                               \
     37             sal_memset((_ptr_), 0, (_size_));                               \
     38         }  else {                                                           \
     39             LOG_ERROR(BSL_LS_BCM_IFA,                               \
     40                     (BSL_META("IFA Error: Allocation failure %s\n"),        \
     41                      (_descr_)));                                           \
     42         }                                                                   \
     43     } while (0)
     44 
     45 /* Internal data structure to store
     46  * global IFA information.
     47  */
     48 typedef struct _bcm_int_ifa_info_s {
     49     /* flags, See BCM_INT_IFA_INFO_FLAGS_XXX */
     50     uint32 flags;
     51 
     52     /* DMA Buffer used for messaging between SDK and UKERNEL. */
     53     uint8 *dma_buffer;
     54 
     55     /* Length of the DMA buffer */
     56     int dma_buffer_len;
     57 
     58     /* uController number running IFA appl */
     59     int uc_num;
     60 
     61     /* IFA status
     62      * 0 IFA Module Inactive
     63      * 1 IFA Module Active
     64      */
     65     uint32 status;
     66 
     67 } _bcm_int_ifa_info_t;
     68 
     69 /* Global data structures extern declarations */
     70 extern _bcm_int_ifa_info_t *ifa_global_info[BCM_MAX_NUM_UNITS];
     71 
     72 /* IFA warmboot sequence. */
     73 typedef enum _bcm_int_ifa_wb_sequence_e {
     74     _bcmIfaWbSequence             = 0,
     75     _bcmIfa2WbSequenceCfg         = 1,
     76     _bcmIfa2WbSequenceInitStatus  = 2,
     77     _bcmIfaWbSequenceCount
     78 } _bcm_int_ifa_wb_sequence_t;
     79 
     80 /* Get the IFA_INFO struct for the unit */
     81 #define IFA_INFO_GET(_u) ifa_global_info[(_u)]
     82 
     83 /* Minimum length of the collecotor encap
     84  * UDP_HDR  =  8 bytes
     85  * IPv4_HDR = 20 bytes
     86  * ETH_HDR  = 14 bytes
     87  * L2_CRC   =  4 bytes
     88  * 8 + 20 + 14 + 4 = 46
     89  */
     90 #define BCM_IFA_MIN_COLLECTOR_ENCAP_LENGTH 46
     91 
     92 /* Length of the L2 CRC field */
     93 #define BCM_IFA_L2_CRC_LENGTH 4
     94 
     95 /* Maximum Possible Rx packet Header length */
     96 #define BCM_IFA_MIN_RX_PACKET_LENGTH      128
     97 
     98 /* Max size of the IFA Rx Packet length */
     99 #define BCM_IFA_MAX_RX_PACKET_LENGTH      2176
    100 
    101 /* META DATA Header */
    102 #define BCM_IFA_METADATA_HEADER_LENGTH       32
    103 
    104 /* Tx and Rx channel index used by IFA EAPP */
    105 #define BCM_IFA_EAPP_TX_CHANNEL 0
    106 #define BCM_IFA_EAPP_RX_CHANNEL 1
    107 
    108 extern int _bcm_ifa2_appl_callback(int unit,
    109                                     int uC,
    110                                     soc_cmic_uc_shutdown_stage_t stage,
    111                                     void *user_data);
    112 #endif /* INCLUDE_IFA */
    113 
    114 extern int _bcm_esw_ifa_sync(int unit);
    115 
    116 #endif  /* !_BCM_INT_IFA_H_ */