OpenNSL API Guide and Reference Manual
portmode.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * (C) Copyright Broadcom Corporation 2013-2016
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *********************************************************************
18  * File: portmode.h
19  * Details: This file defines common network port modes.
20  *
21  * Its contents are not used directly by applications;
22  * it is used only by header files of parent APIs which
23  * need to define port modes.
24  ********************************************************************/
25 
26 #ifndef _SHR_PORTMODE_H
27 #define _SHR_PORTMODE_H
28 
29 typedef unsigned int _shr_port_mode_t;
30 
31 /*
32  * Defines:
33  * _SHR_PM_*
34  * Purpose:
35  * Defines for port modes.
36  */
37 
38 #define _SHR_PM_10MB_HD (1 << 0)
39 #define _SHR_PM_10MB_FD (1 << 1)
40 #define _SHR_PM_100MB_HD (1 << 2)
41 #define _SHR_PM_100MB_FD (1 << 3)
42 #define _SHR_PM_1000MB_HD (1 << 4)
43 #define _SHR_PM_1000MB_FD (1 << 5)
44 #define _SHR_PM_2500MB_HD (1 << 6)
45 #define _SHR_PM_2500MB_FD (1 << 7)
46 #define _SHR_PM_10GB_HD (1 << 8)
47 #define _SHR_PM_10GB_FD (1 << 9)
48 #define _SHR_PM_PAUSE_TX (1 << 10) /* TX pause capable */
49 #define _SHR_PM_PAUSE_RX (1 << 11) /* RX pause capable */
50 #define _SHR_PM_PAUSE_ASYMM (1 << 12) /* Asymm pause capable (R/O) */
51 #define _SHR_PM_TBI (1 << 13) /* TBI mode supported */
52 #define _SHR_PM_MII (1 << 14) /* MII mode supported */
53 #define _SHR_PM_GMII (1 << 15) /* GMII mode supported */
54 #define _SHR_PM_SGMII (1 << 16) /* SGMII mode supported */
55 #define _SHR_PM_XGMII (1 << 17) /* XGMII mode supported */
56 #define _SHR_PM_LB_MAC (1 << 18) /* MAC loopback supported */
57 #define _SHR_PM_LB_NONE (1 << 19) /* Useful for automated test */
58 #define _SHR_PM_LB_PHY (1 << 20) /* PHY loopback supported */
59 #define _SHR_PM_AN (1 << 21) /* Auto-negotiation */
60 #define _SHR_PM_3000MB_HD (1 << 29)
61 #define _SHR_PM_3000MB_FD (1 << 30)
62 #define _SHR_PM_12GB_HD (1 << 22)
63 #define _SHR_PM_12GB_FD (1 << 23)
64 #define _SHR_PM_13GB_HD (1 << 24)
65 #define _SHR_PM_13GB_FD (1 << 25)
66 #define _SHR_PM_16GB_HD (1 << 26)
67 #define _SHR_PM_16GB_FD (1 << 27)
68 #define _SHR_PM_COMBO (1 << 31) /* COMBO ports support both
69  * copper and fiber interfaces */
70 
71 #define _SHR_PM_PAUSE (_SHR_PM_PAUSE_TX | _SHR_PM_PAUSE_RX)
72 #define _SHR_PM_10MB (_SHR_PM_10MB_HD | _SHR_PM_10MB_FD)
73 #define _SHR_PM_100MB (_SHR_PM_100MB_HD | _SHR_PM_100MB_FD)
74 #define _SHR_PM_1000MB (_SHR_PM_1000MB_HD | _SHR_PM_1000MB_FD)
75 #define _SHR_PM_2500MB (_SHR_PM_2500MB_HD | _SHR_PM_2500MB_FD)
76 #define _SHR_PM_3000MB (_SHR_PM_3000MB_HD | _SHR_PM_3000MB_FD)
77 #define _SHR_PM_10GB (_SHR_PM_10GB_HD | _SHR_PM_10GB_FD)
78 #define _SHR_PM_12GB (_SHR_PM_12GB_HD | _SHR_PM_12GB_FD)
79 #define _SHR_PM_13GB (_SHR_PM_13GB_HD | _SHR_PM_13GB_FD)
80 #define _SHR_PM_16GB (_SHR_PM_16GB_HD | _SHR_PM_16GB_FD)
81 
82 #define _SHR_PM_SPEED_ALL (_SHR_PM_16GB | \
83  _SHR_PM_13GB | \
84  _SHR_PM_12GB | \
85  _SHR_PM_10GB | \
86  _SHR_PM_3000MB | \
87  _SHR_PM_2500MB | \
88  _SHR_PM_1000MB | \
89  _SHR_PM_100MB | \
90  _SHR_PM_10MB)
91 
92 #define _SHR_PM_SPEED_MAX(m) (((m) & _SHR_PM_16GB) ? 16000 : \
93  ((m) & _SHR_PM_13GB) ? 13000 : \
94  ((m) & _SHR_PM_12GB) ? 12000 : \
95  ((m) & _SHR_PM_10GB) ? 10000 : \
96  ((m) & _SHR_PM_3000MB) ? 3000 : \
97  ((m) & _SHR_PM_2500MB) ? 2500 : \
98  ((m) & _SHR_PM_1000MB) ? 1000 : \
99  ((m) & _SHR_PM_100MB) ? 100 : \
100  ((m) & _SHR_PM_10MB) ? 10 : 0)
102 #define _SHR_PM_SPEED(s) ((16000 == (s)) ? _SHR_PM_16GB : \
103  (13000 == (s)) ? _SHR_PM_13GB : \
104  (12000 == (s)) ? _SHR_PM_12GB : \
105  (10000 == (s)) ? _SHR_PM_10GB : \
106  (3000 == (s)) ? _SHR_PM_3000MB : \
107  (2500 == (s)) ? _SHR_PM_2500MB : \
108  (1000 == (s)) ? _SHR_PM_1000MB : \
109  (100 == (s)) ? _SHR_PM_100MB : \
110  (10 == (s)) ? _SHR_PM_10MB : 0)
112 #define _SHR_PM_FD (_SHR_PM_16GB_FD | \
113  _SHR_PM_13GB_FD | \
114  _SHR_PM_12GB_FD | \
115  _SHR_PM_10GB_FD | \
116  _SHR_PM_3000MB_FD | \
117  _SHR_PM_2500MB_FD | \
118  _SHR_PM_1000MB_FD | \
119  _SHR_PM_100MB_FD | \
120  _SHR_PM_10MB_FD)
122 #define _SHR_PM_HD (_SHR_PM_16GB_HD | \
123  _SHR_PM_13GB_HD | \
124  _SHR_PM_12GB_HD | \
125  _SHR_PM_10GB_HD | \
126  _SHR_PM_3000MB_HD | \
127  _SHR_PM_2500MB_HD | \
128  _SHR_PM_1000MB_HD | \
129  _SHR_PM_100MB_HD | \
130  _SHR_PM_10MB_HD)
131 #endif /* !_SHR_PORTMODE_H */