forked from Mellanox/ibdump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbus_ioctl.h
executable file
·118 lines (98 loc) · 3.81 KB
/
bus_ioctl.h
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
/*
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. 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 ......................................................
*/
#ifndef BUS_IOCTL_IN
#define DEVICE_NAME L"\\Device\\MLX4BUSControl"
#define DOS_DEVICE_NAME L"\\DosDevices\\MLX4BUSControl"
#define APP_DEVICE_NAME L"\\\\.\\MLX4BUSControl"
#define APP_DOS_DEVICE_NAME L"MLX4BUSControl"
#define IOCTL_GETINFO_METHOD_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS )
#define IOCTL_GETESWITCH_METHOD_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS )
#define IOCTL_GET_RES_TRACK_METHOD_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS )
#define IOCTL_GET_HCA_INFO_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x900, METHOD_BUFFERED, FILE_ANY_ACCESS )
#define IOCTL_OPEN_SNIFFER_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x901, METHOD_BUFFERED, FILE_ANY_ACCESS )
#define IOCTL_CLOSE_SNIFFER_BUFFERED \
CTL_CODE( FILE_DEVICE_INFINIBAND, 0x902, METHOD_BUFFERED, FILE_ANY_ACCESS )
//
// Used in SetPCIDevice for WMI
//
typedef struct
{
UCHAR bus;
UCHAR device;
UCHAR function;
} HCA_IDENTIFICATION;
#define PART_NUMBER_SIZE 100
//
// Used in SetPCIDevice for WMI
//
typedef struct
{
UINT64 firmwareVersion;
UINT8 busType;
UINT8 busSpeed;
UINT8 busWidth;
UCHAR revisionId;
USHORT deviceId;
char partNumber[PART_NUMBER_SIZE];
} HCA_INFO;
//
// Used for configuring sniffing (IOCTL_OPEN_SNIFFER_BUFFERED, IOCTL_OPEN_SNIFFER_BUFFERED)
//
typedef enum
{
SNIFFER_DIR_SX = 1,
SNIFFER_DIR_RX
} SNIFFER_DIRECTION;
typedef struct
{
UINT64 ca_guid; // HCA guid
UINT32 port_num; // 1 or 2
UINT32 qpn; // sniffering QP
SNIFFER_DIRECTION direction; // SNIFFER_DIR_SX/SNIFFER_DIR_RX
} OPEN_SNIFFER_IN;
typedef struct
{
UINT32 reg_id; // registration id
} OPEN_SNIFFER_OUT;
typedef struct
{
UINT64 ca_guid; // HCA guid
UINT32 reg_id; // registration id
} CLOSE_SNIFFER_IN;
#endif