dport.h (1421B)
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 8 #ifndef _SOC_DPORT_H 9 #define _SOC_DPORT_H 10 11 #include <soc/types.h> 12 13 #if defined(BCM_PETRA_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT) 14 #define SOC_DPORT_MAX SOC_MAX_NUM_PORTS 15 #else 16 #define SOC_DPORT_MAX 328 17 #endif 18 19 /* Flags used for caching config settings */ 20 #define SOC_DPORT_MAP_F_ENABLE 0x1 21 #define SOC_DPORT_MAP_F_INDEXED 0x2 22 23 /* 24 * Iterate over port bitmap in dport order. 25 * 26 * Note that the (_p) = -1 assignment is required to avoid 27 * (incorrect) warnings from certain compilers when (_p) 28 * is used after the loop. 29 */ 30 #define SOC_DPORT_PBMP_ITER(_u,_pbm,_dport,_p) \ 31 for ((_dport) = 0, (_p) = -1; (_dport) < SOC_DPORT_MAX; (_dport)++) \ 32 if (((_p) = soc_dport_to_port(_u,_dport)) >= 0 && \ 33 SOC_PBMP_MEMBER((_pbm),(_p))) 34 35 extern int soc_esw_dport_init(int unit); 36 37 extern int soc_dport_to_port(int unit, int dport); 38 39 extern int soc_dport_from_port(int unit, soc_port_t port); 40 41 extern int soc_dport_from_dport_idx(int unit, int dport, int idx); 42 43 extern int soc_dport_map_port(int unit, int dport, soc_port_t port); 44 45 extern int soc_dport_map_update(int unit); 46 47 #endif /* _SOC_DPORT_H */