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

util.h (1185B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * Utilities for LTSW diag.
      8  */
      9 
     10 #if defined(BCM_LTSW_SUPPORT)
     11 
     12 #ifndef DIAG_LTSW_UTIL_H
     13 #define DIAG_LTSW_UTIL_H
     14 
     15 #include <bcm/types.h>
     16 
     17 
     18 /*
     19  * Iterate over port bitmap in dport order.
     20  *
     21  * Note that the (_p) = -1 assignment is required to avoid
     22  * (incorrect) warnings from certain compilers when (_p)
     23  * is used after the loop.
     24  */
     25 #define DPORT_PBMP_ITER(_u,_pbm,_dport,_p) \
     26         for ((_dport) = 0, (_p) = -1; (_dport) < SOC_DPORT_MAX; (_dport)++) \
     27                 if (((_p) = bcmi_ltsw_dport_to_port(_u,_dport)) >= 0 && \
     28                     BCM_PBMP_MEMBER((_pbm),(_p)))
     29 
     30 extern int
     31 bcmi_ltsw_dport_to_port(int unit, int dport);
     32 
     33 extern int
     34 ltsw_parse_pbmp(int unit, char *s, bcm_pbmp_t *pbmp);
     35 
     36 extern char *
     37 ltsw_format_pbmp(int unit, char *buf, int bufsize, bcm_pbmp_t pbmp);
     38 
     39 extern char *
     40 ltsw_port_name(int unit, bcm_port_t port);
     41 
     42 extern int
     43 ltsw_parse_port(int unit, char *s, bcm_port_t *port);
     44 
     45 #endif /* DIAG_LTSW_UTIL_H */
     46 
     47 #endif /* BCM_LTSW_SUPPORT */