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

sum.h (2713B)


      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:    sum.h
      8  */
      9 
     10 #ifndef _BCM_INIT_SUM_H_
     11 #define _BCM_INIT_SUM_H_
     12 
     13 #if defined(INCLUDE_SUM)
     14 #include <soc/shared/sum.h>
     15 #include <soc/shared/sum_msg.h>
     16 #include <soc/profile_mem.h>
     17 #include <shared/idxres_fl.h>
     18 #include <bcm/sum.h>
     19 
     20 /*
     21  * Macro:
     22  *     _BCM_SUM_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_SUM_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_SUM,                                       \
     40                     (BSL_META("SUM Error: Allocation failure %s\n"),        \
     41                      (_descr_)));                                           \
     42         }                                                                   \
     43     } while (0)
     44 
     45 /* Internal data structure to store
     46  * global SUM information.
     47  */
     48 typedef struct _bcm_int_sum_info_s {
     49     /* flags, See BCM_INT_SUM_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     uint32 dma_buffer_len;
     57 
     58     /* uController number running SUM appl */
     59     int uc_num;
     60 
     61     /* SUM status
     62      * 0 SUM Module Inactive
     63      * 1 SUM Module Active
     64      */
     65     uint32 status;
     66 
     67     /* Host Buffer used for to sum stats information in SDK. */
     68     bcm_sum_stat_info_t *host_buffer;
     69 } _bcm_int_sum_info_t;
     70 
     71 /* Global data structures extern declarations */
     72 extern _bcm_int_sum_info_t *sum_global_info[BCM_MAX_NUM_UNITS];
     73 
     74 /* Get the SUM_INFO struct for the unit */
     75 #define SUM_INFO_GET(_u) sum_global_info[(_u)]
     76 
     77 /* Size of SUM stats info structure */
     78 #define SUM_STAT_SIZE   sizeof(bcm_sum_stat_info_t)
     79 
     80 #endif /* INCLUDE_SUM */
     81 
     82 extern int _bcm_th3_sum_sync(int unit);
     83 
     84 #endif  /* !_BCM_INIT_SUM_H_ */