File: tools_dev_types.h

package info (click to toggle)
mstflint 4.21.0%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 40,180 kB
  • sloc: ansic: 207,012; cpp: 94,474; ada: 10,938; python: 6,832; sh: 4,438; makefile: 953
file content (274 lines) | stat: -rw-r--r-- 8,545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/*
 * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
 * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 * End of legal section ......................................................
 *
 *  toos_dev_types.h - Defines an enum value for all mellanox chips in order to
 *                     have a uniform IDs for all toos.
 *
 *  Version: $Id$
 *
 *  Author: Wasim Abo Moch (wasim@mellanox.co.il)
 */

#ifndef TOOLS_DEV_TYPE_H
#define TOOLS_DEV_TYPE_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <common/bit_slice.h>
#include <common/compatibility.h>
#include <mtcr.h>

    enum dm_dev_id
    {
        DeviceUnknown = -1,    // Dummy Device - Marker for indicating error.
        DeviceStartMarker = 0, // Dummy Device - Marker for first device
                               // to let user iterate from DeviceStartMarker to DeviceEndMarker
                               // Note: Call dm_is_device_supported() to see if a device is supported by the lib.

        DeviceConnectX3,
        DeviceConnectIB,
        DeviceConnectX3Pro,
        DeviceSwitchIB,
        DeviceSpectrum,
        DeviceQuantum,
        DeviceConnectX4,
        DeviceConnectX4LX,
        DeviceConnectX5,
        DeviceConnectX6,
        DeviceBlueField,
        DeviceBlueField2,
        DeviceBlueField3,
        DeviceBlueField4,
        DeviceSwitchIB2,
        DeviceCable,
        DeviceCableQSFP,
        DeviceCableQSFPaging,
        DeviceCableSFP,
        DeviceCableSFP51,
        DeviceCableSFP51Paging,
        DeviceArdbeg,
        DeviceBaritone,
        DeviceMenhit,
        DeviceSpectrum2,
        DeviceDummy,
        DeviceSecureHost,
        DeviceConnectX6DX,
        DeviceConnectX6LX,
        DeviceConnectX7,
        DeviceConnectX8,
        DeviceSpectrum3, // Firebird
        DeviceSpectrum4, // Albatross
        DeviceQuantum2,  // Blackbird
        DeviceQuantum3,  // Sunbird
        DeviceGearBox,
        DeviceGearBoxManager,
        DeviceAbirGearBox,
        DeviceCableCMIS,
        DeviceCableCMISPaging,
        DeviceGB100,    // Blackwell
        DeviceArcusPTC, // ArcusP Test Chip
        DeviceArcusP,
        DeviceArcusE,
        DeviceEndMarker // Dummy Device - Marker for indicating end of devices when iterating
    };

    enum hw_dev_id
    {
        DeviceConnectX3_HwId = 0x1f5,
        DeviceConnectIB_HwId = 0x1ff,
        DeviceConnectX3Pro_HwId = 0x1f7,
        DeviceSwitchIB_HwId = 0x247,
        DeviceSpectrum_HwId = 0x249,
        DeviceConnectX4_HwId = 0x209,
        DeviceConnectX4LX_HwId = 0x20b,
        DeviceConnectX5_HwId = 0x20d,
        DeviceConnectX6_HwId = 0x20f,
        DeviceConnectX6DX_HwId = 0x212,
        DeviceConnectX6LX_HwId = 0x216,
        DeviceConnectX7_HwId = 0x218,
        DeviceConnectX8_HwId = 0x21e,
        DeviceBlueField_HwId = 0x211,
        DeviceBlueField2_HwId = 0x214,
        DeviceBlueField3_HwId = 0x21c,
        DeviceBlueField4_HwId = 0x220,
        DeviceSwitchIB2_HwId = 0x24b,
        DeviceCableQSFP_HwId = 0x0d,
        DeviceCableQSFPaging_HwId = 0x11,
        DeviceCableCMIS_HwId = 0x19,
        DeviceCableCMISPaging_HwId = 0x19,
        DeviceCableSFP_HwId = 0x03,
        DeviceCableSFP51_HwId = 0x03,
        DeviceCableSFP51Paging_HwId = 0x03,
        DeviceSpectrum2_HwId = 0x24e,
        DeviceQuantum_HwId = 0x24d,
        DeviceQuantum2_HwId = 0x257,
        DeviceQuantum3_HwId = 0x25b,
        DeviceGB100_HwId = 0x2900,
        DeviceArdbeg_HwId = 0x6e,
        DeviceBaritone_HwId = 0x6b,
        DeviceMenhit_HwId = 0x72,
        DeviceSecureHost_HwId = 0xcafe,
        DeviceSpectrum3_HwId = 0x250,
        DeviceSpectrum4_HwId = 0x254,
        DeviceGearBox_HwId = 0x252,
        DeviceGearBoxManager_HwId = 0x253,
        DeviceAbirGearBox_HwId = 0x256,
        DeviceArcusPTC_HwId = 0x7f, // ArcusP Test Chip
        DeviceArcusP_HwId = 0x80,
        DeviceArcusE_HwId = 0x81,
    };
    typedef enum dm_dev_id dm_dev_id_t;

    /**
     * Returns 0 on success and 1 on failure.
     */
    int dm_get_device_id(mfile* mf, dm_dev_id_t* ptr_dev_type, u_int32_t* ptr_dev_id, u_int32_t* ptr_chip_rev);

    int dm_get_device_id_without_prints(mfile* mf,
                                        dm_dev_id_t* ptr_dm_dev_id,
                                        u_int32_t* ptr_hw_dev_id,
                                        u_int32_t* ptr_hw_rev);

    /**
     * Returns 0 on success and 1 on failure.
     */
    int dm_get_device_id_offline(u_int32_t devid, u_int32_t chip_rev, dm_dev_id_t* ptr_dev_type);

    /**
     * Returns 1 if device is supported and 0 otherwise (library dependant)
     */
    int dm_is_device_supported(dm_dev_id_t type);

    /**
     * Returns the device name as a "const char*"
     */
    const char* dm_dev_type2str(dm_dev_id_t type);

    /**
     * Returns the device id
     */
    dm_dev_id_t dm_dev_str2type(const char* str);

    /**
     * A predicate returning if the device is an hca
     */
    int dm_dev_is_hca(dm_dev_id_t type);

    /**
     * A predicate returning if the device is gearbox
     */
    int dm_dev_is_gearbox(dm_dev_id_t type);

    /**
     * A predicate returning if the device is menhit
     */
    int dm_is_menhit(dm_dev_id_t type);

    /**
     * A predicate returning if the device is dummy
     */
    int dm_dev_is_dummy(dm_dev_id_t type);

    /**
     * A predicate returning if the hca supports 200G speed and above
     */
    int dm_dev_is_200g_speed_supported_hca(dm_dev_id_t type);

    /**
     * A predicate returning if the device is a switch
     */
    int dm_dev_is_switch(dm_dev_id_t type);

    /**
     * A predicate returning if the switch supports 200G speed and above
     */
    int dm_dev_is_200g_speed_supported_switch(dm_dev_id_t type);

    /**
     * A predicate returning if the device is a bridge
     */
    int dm_dev_is_bridge(dm_dev_id_t type);

    /**
     * A predicate returning if the device is a Cable
     */
    int dm_dev_is_cable(dm_dev_id_t type);

    /**
     * Returns the max num of ports or -1 on error
     */
    int dm_get_hw_ports_num(dm_dev_id_t type);

    /**
     * Returns the HW device id of the givn device type or zero on failure.
     */
    u_int32_t dm_get_hw_dev_id(dm_dev_id_t type);

    /**
     * Returns the HW chip revision of the given device type or zero on failures,
     * This is useful to distinguish between ConnectX2 and ConnectX.
     */
    u_int32_t dm_get_hw_rev_id(dm_dev_id_t type);

    /**
     * A predicate returning if the device supports Function Per Port
     */
    int dm_is_fpp_supported(dm_dev_id_t type);

    int dm_is_4th_gen(dm_dev_id_t type);

    int dm_is_5th_gen_hca(dm_dev_id_t type);

    int dm_is_connectib(dm_dev_id_t type);

    int dm_is_new_gen_switch(dm_dev_id_t type);

    int dm_dev_is_raven_family_switch(dm_dev_id_t type);

    int dm_dev_is_ib_switch(dm_dev_id_t type);

    int dm_dev_is_eth_switch(dm_dev_id_t type);
    /*
     * A predicate returning if the device is in LiveFish mode
     */
    int dm_is_livefish_mode(mfile* mf);

#ifdef __cplusplus
} /* end of 'extern "C"' */
#endif

#endif // TOOLS_DEV_TYPE_H