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

topo_int.h (1409B)


      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:        topo_int.h
      8  * Purpose:     
      9  */
     10 
     11 #ifndef   _TOPO_INT_H_
     12 #define   _TOPO_INT_H_
     13 
     14 /* Accessors for topo information stored in DB structure as cookie */
     15 
     16 #define TP_INFO(db_ref) ((topo_info_t *)((db_ref)->topo_cookie))
     17 
     18 /*
     19  * The TX CXN matrix is ordered (src, dest) -> src-tx-stk-idx
     20  * The RX CXN matrix is ordered (dest, src) -> dest-rx-stk-idx
     21  *
     22  * src and dest are topology CPU indices
     23  */
     24 
     25 #define TP_TX_CXN_MATRIX(db_ref)  (TP_INFO(db_ref)->tp_tx_cxns)
     26 #define TP_TX_CXN_INIT(db_ref, bytes) \
     27     sal_memset(TP_TX_CXN_MATRIX(db_ref), TOPO_CXN_UNKNOWN, bytes)
     28 #define TP_TX_CXN(db_ref, src_idx, dest_idx) \
     29     (TP_TX_CXN_MATRIX(db_ref)[db_ref->num_cpus * src_idx + dest_idx])
     30 
     31 #define TP_RX_CXN_MATRIX(db_ref)  (TP_INFO(db_ref)->tp_rx_cxns)
     32 #define TP_RX_CXN_INIT(db_ref, bytes) \
     33     sal_memset(TP_RX_CXN_MATRIX(db_ref), TOPO_CXN_UNKNOWN, bytes)
     34 #define TP_RX_CXN(db_ref, src_idx, dest_idx) \
     35     (TP_RX_CXN_MATRIX(db_ref)[db_ref->num_cpus * src_idx + dest_idx])
     36 
     37 #define TP_REACHABLE(db_ref, src_idx, dest_idx) \
     38          (TP_TX_CXN(db_ref, src_idx, dest_idx) != TOPO_CXN_UNKNOWN)
     39 
     40 #define PACK_LONG _SHR_PACK_LONG
     41 #define UNPACK_LONG _SHR_UNPACK_LONG
     42 
     43 #endif /* _TOPO_INT_H_ */