api_xlate_port.h (3128B)
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 * BCM internal port translation functions 8 */ 9 10 #ifndef _BCM_XLATE_PORT_H 11 #define _BCM_XLATE_PORT_H 12 13 #include <sal/core/libc.h> /* sal_memcpy */ 14 #include <bcm/types.h> 15 16 extern int _bcm_api_xlate_port_init(int unit); 17 18 extern int _bcm_api_xlate_port_cleanup(int unit); 19 20 extern int _bcm_api_xlate_port_map(int unit, bcm_port_t aport, bcm_port_t pport); 21 22 extern int _bcm_api_xlate_port_a2p(int unit, bcm_port_t *port); 23 24 extern int _bcm_api_xlate_port_p2a(int unit, bcm_port_t *port); 25 26 extern int _bcm_api_xlate_port_pbmp_a2p(int unit, bcm_pbmp_t *pbmp); 27 28 extern int _bcm_api_xlate_port_pbmp_p2a(int unit, bcm_pbmp_t *pbmp); 29 30 extern int _bcm_xlate_sysport_s2p(int unit, bcm_port_t *port); 31 32 extern int _bcm_xlate_sysport_p2s(int unit, bcm_port_t *port); 33 34 #ifdef INCLUDE_BCM_API_XLATE_PORT 35 36 #define BCM_API_XLATE_PORT_A2P(_u,_p) _bcm_api_xlate_port_a2p(_u,(bcm_port_t*)(_p)) 37 #define BCM_API_XLATE_PORT_P2A(_u,_p) _bcm_api_xlate_port_p2a(_u,(bcm_port_t*)(_p)) 38 #define BCM_API_XLATE_PORT_DECL(_var) bcm_port_t _var = 0 39 #define BCM_API_XLATE_PORT_ASSIGN(_dst,_src) _dst = _src 40 #define BCM_API_XLATE_PORT_SAVE(_dst,_src) BCM_API_XLATE_PORT_ASSIGN(_dst,_src) 41 #define BCM_API_XLATE_PORT_RESTORE(_dst,_src) BCM_API_XLATE_PORT_ASSIGN(_dst,_src) 42 43 #define BCM_API_XLATE_PORT_PBMP_A2P(_u,_p) _bcm_api_xlate_port_pbmp_a2p(_u,(_p)) 44 #define BCM_API_XLATE_PORT_PBMP_P2A(_u,_p) _bcm_api_xlate_port_pbmp_p2a(_u,(_p)) 45 #define BCM_API_XLATE_PORT_PBMP_DECL(_t) bcm_pbmp_t _t 46 /* We avoid BCM_PBMP_ASSIGN since this may cause (invalid) compiler warnings */ 47 #define BCM_API_XLATE_PORT_PBMP_ASSIGN(_t,_p) sal_memcpy(&(_t),&(_p),sizeof(_t)) 48 #define BCM_API_XLATE_PORT_PBMP_SAVE(_t,_p) BCM_API_XLATE_PORT_PBMP_ASSIGN(_t,_p) 49 #define BCM_API_XLATE_PORT_PBMP_RESTORE(_p,_t) BCM_API_XLATE_PORT_PBMP_ASSIGN(_p,_t) 50 51 #define BCM_API_XLATE_PORT_COND(_c) if(_c) 52 #define BCM_API_XLATE_PORT_ITER_DECL(_i) int _i 53 #define BCM_API_XLATE_PORT_ITER(_c,_i) for(_i=0;_i<(_c);_i++) 54 55 #else 56 57 #define BCM_API_XLATE_PORT_A2P(_u,_p) 58 #define BCM_API_XLATE_PORT_P2A(_u,_p) 59 #define BCM_API_XLATE_PORT_DECL(_var) 60 #define BCM_API_XLATE_PORT_ASSIGN(_dst,_src) 61 #define BCM_API_XLATE_PORT_SAVE(_dst,_src) 62 #define BCM_API_XLATE_PORT_RESTORE(_dst,_src) 63 64 #define BCM_API_XLATE_PORT_PBMP_A2P(_u,_p) 65 #define BCM_API_XLATE_PORT_PBMP_P2A(_u,_p) 66 #define BCM_API_XLATE_PORT_PBMP_DECL(_t) 67 #define BCM_API_XLATE_PORT_PBMP_ASSIGN(_t,_p) 68 #define BCM_API_XLATE_PORT_PBMP_SAVE(_t,_p) 69 #define BCM_API_XLATE_PORT_PBMP_RESTORE(_p,_t) 70 71 #define BCM_API_XLATE_PORT_COND(_c) 72 #define BCM_API_XLATE_PORT_ITER_DECL(_t) 73 #define BCM_API_XLATE_PORT_ITER(_c,_i) 74 75 #endif /* BCM_INCLUDE_API_XLATE_PORT */ 76 77 #define BCM_XLATE_SYSPORT_S2P(_u,_p) _bcm_xlate_sysport_s2p(_u,(bcm_port_t*)(_p)) 78 #define BCM_XLATE_SYSPORT_P2S(_u,_p) _bcm_xlate_sysport_p2s(_u,(bcm_port_t*)(_p)) 79 80 #endif /* _BCM_XLATE_PORT_H */ 81