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 (3162B)


      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  * File:    ifa_feature.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 /* Get the IFA_INFO struct for the unit */
     73 #define IFA_INFO_GET(_u) ifa_global_info[(_u)]
     74 
     75 /* Minimum length of the collecotor encap
     76  * UDP_HDR  =  8 bytes
     77  * IPv4_HDR = 20 bytes
     78  * ETH_HDR  = 14 bytes
     79  * L2_CRC   =  4 bytes
     80  * 8 + 20 + 14 + 4 = 46
     81  */
     82 #define BCM_IFA_MIN_COLLECTOR_ENCAP_LENGTH 46
     83 
     84 /* Length of the L2 CRC field */
     85 #define BCM_IFA_L2_CRC_LENGTH 4
     86 
     87 /* Maximum Possible Rx packet Header length */
     88 #define BCM_IFA_MIN_RX_PACKET_LENGTH      128
     89 
     90 /* Max size of the IFA Rx Packet length */
     91 #define BCM_IFA_MAX_RX_PACKET_LENGTH      1856
     92 
     93 /* META DATA Header */
     94 #define BCM_IFA_METADATA_HEADER_LENGTH       32
     95 
     96 /* Tx and Rx channel index used by IFA EAPP */
     97 #define BCM_IFA_EAPP_TX_CHANNEL 0
     98 #define BCM_IFA_EAPP_RX_CHANNEL 1
     99 
    100 #endif /* INCLUDE_IFA */
    101 
    102 extern int _bcm_esw_ifa_sync(int unit);
    103 
    104 #endif  /* !_BCM_INT_IFA_H_ */
    105