OpenNSL API Guide and Reference Manual
port_ability.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * (C) Copyright Broadcom Corporation 2013-2017
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: port_ability.h
19  * Details: This file defines common network port modes.
20  * Its contents are not used directly by applications;
21  * it is used only by header files of parent APIs which
22  * need to define port modes.
23  ******************************************************************/
24 
25 #ifndef _SHR_PORTABILITY_H
26 #define _SHR_PORTABILITY_H
27 
28 typedef unsigned int _shr_pa_encap_t;
29 
30 typedef struct _shr_port_ability_s {
44 /* __doxy_func_body_end__ */
45 
46 #define _SHR_PA_ABILITY_ALL (0xffffffff)
47 #define _SHR_PA_ABILITY_NONE (0)
48 
49 /*
50  * Defines:
51  * _SHR_PA_SPEED_*
52  * Purpose:
53  * Defines for half duplex port speeds.
54  */
55 #define _SHR_PA_SPEED_10MB (1 << 0)
56 #define _SHR_PA_SPEED_EXTENDED (1 << 1)
57 #define _SHR_PA_SPEED_27GB (1 << 2)
58 #define _SHR_PA_SPEED_50GB (1 << 3)
59 #define _SHR_PA_SPEED_53GB (1 << 4)
60 #define _SHR_PA_SPEED_100MB (1 << 5)
61 #define _SHR_PA_SPEED_1000MB (1 << 6)
62 #define _SHR_PA_SPEED_2500MB (1 << 7)
63 #define _SHR_PA_SPEED_3000MB (1 << 8)
64 #define _SHR_PA_SPEED_5000MB (1 << 9)
65 #define _SHR_PA_SPEED_6000MB (1 << 10)
66 #define _SHR_PA_SPEED_10GB (1 << 11)
67 #define _SHR_PA_SPEED_11GB (1 << 12)
68 #define _SHR_PA_SPEED_12GB (1 << 13)
69 #define _SHR_PA_SPEED_12P5GB (1 << 14)
70 #define _SHR_PA_SPEED_13GB (1 << 15)
71 #define _SHR_PA_SPEED_15GB (1 << 16)
72 #define _SHR_PA_SPEED_16GB (1 << 17)
73 #define _SHR_PA_SPEED_20GB (1 << 18)
74 #define _SHR_PA_SPEED_21GB (1 << 19)
75 #define _SHR_PA_SPEED_23GB (1 << 20)
76 #define _SHR_PA_SPEED_24GB (1 << 21)
77 #define _SHR_PA_SPEED_25GB (1 << 22)
78 #define _SHR_PA_SPEED_30GB (1 << 23)
79 #define _SHR_PA_SPEED_40GB (1 << 24)
80 #define _SHR_PA_SPEED_42GB (1 << 25)
81 #define _SHR_PA_SPEED_100GB (1 << 26)
82 #define _SHR_PA_SPEED_120GB (1 << 27)
83 #define _SHR_PA_SPEED_127GB (1 << 28)
84 #define _SHR_PA_SPEED_106GB (1 << 29)
85 #define _SHR_PA_SPEED_48GB (1 << 30)
86 #define _SHR_PA_SPEED_32GB (1 << 31)
87 
88 /*
89  * Defines:
90  * _SHR_PA_PAUSE_*
91  * Purpose:
92  * Defines for flow control abilities.
93  */
94 #define _SHR_PA_PAUSE_TX (1 << 0) /* TX pause capable */
95 #define _SHR_PA_PAUSE_RX (1 << 1) /* RX pause capable */
96 #define _SHR_PA_PAUSE_ASYMM (1 << 2) /* Asymm pause capable (R/O) */
97 
98 /*
99  * Defines:
100  * _SHR_PA_FEC_*
101  * Purpose:
102  * Defines for FEC abilities.
103  */
104 
105 #define _SHR_PA_FEC_NONE (1 << 0) /* FEC is not requested */
106 #define _SHR_PA_FEC_CL74 (1 << 1) /* FEC CL74 ability request */
107 #define _SHR_PA_FEC_CL91 (1 << 2) /* FEC Cl91 ability request */
108 
109 /*
110  * Defines:
111  * _SHR_PA_INTF_*
112  * Purpose:
113  * Defines for port interfaces supported.
114  */
115 #define _SHR_PA_INTF_TBI (1 << 0) /* TBI mode supported */
116 #define _SHR_PA_INTF_MII (1 << 1) /* MII mode supported */
117 #define _SHR_PA_INTF_GMII (1 << 2) /* GMII mode supported */
118 #define _SHR_PA_INTF_RGMII (1 << 3) /* RGMII mode supported */
119 #define _SHR_PA_INTF_SGMII (1 << 4) /* SGMII mode supported */
120 #define _SHR_PA_INTF_XGMII (1 << 5) /* XGMII mode supported */
121 #define _SHR_PA_INTF_QSGMII (1 << 6) /* QSGMII mode supported */
122 #define _SHR_PA_INTF_CGMII (1 << 7) /* CGMII mode supported */
123 
124 /*
125  * Defines:
126  * _SHR_PA_CHANNEL_*
127  * Purpose:
128  * Defines for CHANNEL abilities.
129  */
130 
131 #define _SHR_PA_CHANNEL_LONG (1 << 0) /* Channel is long */
132 #define _SHR_PA_CHANNEL_SHORT (1 << 1) /* Channel is short */
133 
134 /*
135  * Defines:
136  * _SHR_PA_MEDIUM_*
137  * Purpose:
138  * Defines for port medium modes.
139  */
140 #define _SHR_PA_MEDIUM_COPPER (1 << 0)
141 #define _SHR_PA_MEDIUM_FIBER (1 << 1)
142 #define _SHR_PA_MEDIUM_BACKPLANE (1 << 2)
143 
144 /*
145  * Defines:
146  * _SHR_PA_LOOPBACK_*
147  * Purpose:
148  * Defines for port loopback modes.
149  */
150 #define _SHR_PA_LB_NONE (1 << 0) /* Useful for automated test */
151 #define _SHR_PA_LB_MAC (1 << 1) /* MAC loopback supported */
152 #define _SHR_PA_LB_PHY (1 << 2) /* PHY loopback supported */
153 #define _SHR_PA_LB_LINE (1 << 3) /* PHY lineside loopback */
154 
155 /*
156  * Defines:
157  * _SHR_PA_FLAGS_*
158  * Purpose:
159  * Defines for the reest of port ability flags.
160  */
161 #define _SHR_PA_AUTONEG (1 << 0) /* Auto-negotiation */
162 #define _SHR_PA_COMBO (1 << 1) /* COMBO ports support both
163  * copper and fiber interfaces */
164 #define _SHR_PA_PAUSE (_SHR_PA_PAUSE_TX | _SHR_PA_PAUSE_RX)
166 #define _SHR_PA_SPEED_ALL (_SHR_PA_SPEED_127GB | \
167  _SHR_PA_SPEED_120GB | \
168  _SHR_PA_SPEED_106GB | \
169  _SHR_PA_SPEED_100GB | \
170  _SHR_PA_SPEED_53GB | \
171  _SHR_PA_SPEED_50GB | \
172  _SHR_PA_SPEED_42GB | \
173  _SHR_PA_SPEED_40GB | \
174  _SHR_PA_SPEED_32GB | \
175  _SHR_PA_SPEED_30GB | \
176  _SHR_PA_SPEED_27GB | \
177  _SHR_PA_SPEED_25GB | \
178  _SHR_PA_SPEED_24GB | \
179  _SHR_PA_SPEED_23GB | \
180  _SHR_PA_SPEED_21GB | \
181  _SHR_PA_SPEED_20GB | \
182  _SHR_PA_SPEED_16GB | \
183  _SHR_PA_SPEED_15GB | \
184  _SHR_PA_SPEED_13GB | \
185  _SHR_PA_SPEED_12P5GB | \
186  _SHR_PA_SPEED_12GB | \
187  _SHR_PA_SPEED_11GB | \
188  _SHR_PA_SPEED_10GB | \
189  _SHR_PA_SPEED_6000MB | \
190  _SHR_PA_SPEED_5000MB | \
191  _SHR_PA_SPEED_3000MB | \
192  _SHR_PA_SPEED_2500MB | \
193  _SHR_PA_SPEED_1000MB | \
194  _SHR_PA_SPEED_100MB | \
195  _SHR_PA_SPEED_10MB)
196 
198 #define _SHR_PA_SPEED_MAX(m) (((m) & _SHR_PA_SPEED_127GB) ? 127000 : \
199  ((m) & _SHR_PA_SPEED_120GB) ? 120000 : \
200  ((m) & _SHR_PA_SPEED_106GB) ? 106000 : \
201  ((m) & _SHR_PA_SPEED_100GB) ? 100000 : \
202  ((m) & _SHR_PA_SPEED_53GB) ? 53000 : \
203  ((m) & _SHR_PA_SPEED_50GB) ? 50000 : \
204  ((m) & _SHR_PA_SPEED_42GB) ? 42000 : \
205  ((m) & _SHR_PA_SPEED_40GB) ? 40000 : \
206  ((m) & _SHR_PA_SPEED_32GB) ? 32000 : \
207  ((m) & _SHR_PA_SPEED_30GB) ? 30000 : \
208  ((m) & _SHR_PA_SPEED_27GB) ? 27000 : \
209  ((m) & _SHR_PA_SPEED_25GB) ? 25000 : \
210  ((m) & _SHR_PA_SPEED_24GB) ? 24000 : \
211  ((m) & _SHR_PA_SPEED_23GB) ? 23000 : \
212  ((m) & _SHR_PA_SPEED_21GB) ? 21000 : \
213  ((m) & _SHR_PA_SPEED_20GB) ? 20000 : \
214  ((m) & _SHR_PA_SPEED_16GB) ? 16000 : \
215  ((m) & _SHR_PA_SPEED_15GB) ? 15000 : \
216  ((m) & _SHR_PA_SPEED_13GB) ? 13000 : \
217  ((m) & _SHR_PA_SPEED_12P5GB) ? 12500 : \
218  ((m) & _SHR_PA_SPEED_12GB) ? 12000 : \
219  ((m) & _SHR_PA_SPEED_11GB) ? 11000 : \
220  ((m) & _SHR_PA_SPEED_10GB) ? 10000 : \
221  ((m) & _SHR_PA_SPEED_6000MB) ? 6000 : \
222  ((m) & _SHR_PA_SPEED_5000MB) ? 5000 : \
223  ((m) & _SHR_PA_SPEED_3000MB) ? 3000 : \
224  ((m) & _SHR_PA_SPEED_2500MB) ? 2500 : \
225  ((m) & _SHR_PA_SPEED_1000MB) ? 1000 : \
226  ((m) & _SHR_PA_SPEED_100MB) ? 100 : \
227  ((m) & _SHR_PA_SPEED_10MB) ? 10 : 0)
228 
230 #define _SHR_PA_SPEED(s) ((127000 == (s)) ? _SHR_PA_SPEED_127GB : \
231  (120000 == (s)) ? _SHR_PA_SPEED_120GB : \
232  (106000 == (s)) ? _SHR_PA_SPEED_106GB : \
233  (100000 == (s)) ? _SHR_PA_SPEED_100GB : \
234  (53000 == (s)) ? _SHR_PA_SPEED_53GB : \
235  (50000 == (s)) ? _SHR_PA_SPEED_50GB : \
236  (42000 == (s)) ? _SHR_PA_SPEED_42GB : \
237  (40000 == (s)) ? _SHR_PA_SPEED_40GB : \
238  (32000 == (s)) ? _SHR_PA_SPEED_32GB : \
239  (30000 == (s)) ? _SHR_PA_SPEED_30GB : \
240  (27000 == (s)) ? _SHR_PA_SPEED_27GB : \
241  (25000 == (s)) ? _SHR_PA_SPEED_25GB : \
242  (24000 == (s)) ? _SHR_PA_SPEED_24GB : \
243  (23000 == (s)) ? _SHR_PA_SPEED_23GB : \
244  (21000 == (s)) ? _SHR_PA_SPEED_21GB : \
245  (20000 == (s)) ? _SHR_PA_SPEED_20GB : \
246  (16000 == (s)) ? _SHR_PA_SPEED_16GB : \
247  (15000 == (s)) ? _SHR_PA_SPEED_15GB : \
248  (13000 == (s)) ? _SHR_PA_SPEED_13GB : \
249  (12500 == (s)) ? _SHR_PA_SPEED_12P5GB : \
250  (12000 == (s)) ? _SHR_PA_SPEED_12GB : \
251  (11000 == (s)) ? _SHR_PA_SPEED_11GB : \
252  (10000 == (s)) ? _SHR_PA_SPEED_10GB : \
253  (6000 == (s)) ? _SHR_PA_SPEED_6000MB : \
254  (5000 == (s)) ? _SHR_PA_SPEED_5000MB : \
255  (3000 == (s)) ? _SHR_PA_SPEED_3000MB : \
256  (2500 == (s)) ? _SHR_PA_SPEED_2500MB : \
257  (1000 == (s)) ? _SHR_PA_SPEED_1000MB : \
258  (100 == (s)) ? _SHR_PA_SPEED_100MB : \
259  (10 == (s)) ? _SHR_PA_SPEED_10MB : 0)
260 
261 
262 /*
263  * Defines:
264  * _SHR_PA_EEE_*
265  * Purpose:
266  * Defines for EEE
267  */
268 #define _SHR_PA_EEE_100MB_BASETX (1 << 0) /* EEE for 100M-BaseTX */
269 #define _SHR_PA_EEE_1GB_BASET (1 << 1) /* EEE for 1G-BaseT */
270 #define _SHR_PA_EEE_10GB_BASET (1 << 2) /* EEE for 10G-BaseT */
271 #define _SHR_PA_EEE_10GB_KX (1 << 3) /* EEE for 10G-KX */
272 #define _SHR_PA_EEE_10GB_KX4 (1 << 4) /* EEE for 10G-KX4 */
273 #define _SHR_PA_EEE_10GB_KR (1 << 5) /* EEE for 10G-KR */
274 
275 #endif /* !_SHR_PORTABILITY_H */