xref: /freebsd/share/man/man4/mlx5io.4 (revision 1a720cbec513210fa2e85c3882741ef2f6dc5f35)
1e808190aSHans Petter Selasky.\"
2ff08edcbSHans Petter Selasky.\" Copyright (c) 2018, 2019 Mellanox Technologies
3e808190aSHans Petter Selasky.\" All rights reserved.
4e808190aSHans Petter Selasky.\"
5e808190aSHans Petter Selasky.\" Redistribution and use in source and binary forms, with or without
6e808190aSHans Petter Selasky.\" modification, are permitted provided that the following conditions
7e808190aSHans Petter Selasky.\" are met:
8e808190aSHans Petter Selasky.\" 1. Redistributions of source code must retain the above copyright
9e808190aSHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer.
10e808190aSHans Petter Selasky.\" 2. Redistributions in binary form must reproduce the above copyright
11e808190aSHans Petter Selasky.\"    notice, this list of conditions and the following disclaimer in the
12e808190aSHans Petter Selasky.\"    documentation and/or other materials provided with the distribution.
13e808190aSHans Petter Selasky.\"
14e808190aSHans Petter Selasky.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15e808190aSHans Petter Selasky.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16e808190aSHans Petter Selasky.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17e808190aSHans Petter Selasky.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18e808190aSHans Petter Selasky.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19e808190aSHans Petter Selasky.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20e808190aSHans Petter Selasky.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21e808190aSHans Petter Selasky.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22e808190aSHans Petter Selasky.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23e808190aSHans Petter Selasky.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24e808190aSHans Petter Selasky.\" SUCH DAMAGE.
25e808190aSHans Petter Selasky.\"
26048ddb58SHans Petter Selasky.Dd October 2, 2019
27e808190aSHans Petter Selasky.Dt mlx5io 4
28e808190aSHans Petter Selasky.Os
29e808190aSHans Petter Selasky.Sh NAME
30e808190aSHans Petter Selasky.Nm mlx5io
31048ddb58SHans Petter Selasky.Nd IOCTL interface to manage Connect-X 4/5/6 Mellanox network adapters
32e808190aSHans Petter Selasky.Sh SYNOPSIS
33e808190aSHans Petter Selasky.In dev/mlx5/mlx5io.h
34e808190aSHans Petter Selasky.Sh DESCRIPTION
35e808190aSHans Petter SelaskyThe
36e808190aSHans Petter Selasky.Nm
37048ddb58SHans Petter Selaskyinterface is provided for management of the Connect-X4, 5 and 6 network adapters
38e808190aSHans Petter Selaskyin the aspects not covered by the generic network configuration,
39e808190aSHans Petter Selaskymostly related to the PCIe attachment and internal card working.
40e808190aSHans Petter SelaskyInterface consists of the commands, which are passed by means of
41e808190aSHans Petter Selasky.Xr ioctl 2
42e808190aSHans Petter Selaskyon the file descriptor, opened from the
43e808190aSHans Petter Selasky.Pa /dev/mlx5ctl
44e808190aSHans Petter Selaskydevice node.
45e808190aSHans Petter Selasky.Pp
46e808190aSHans Petter SelaskyThe following commands are implemented:
47e808190aSHans Petter Selasky.Bl -tag -width indent
48e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_FORCE
49e808190aSHans Petter SelaskyTake the snapshot of the firmware registers state and store it in the
50e808190aSHans Petter Selaskykernel buffer.
51e808190aSHans Petter SelaskyThe buffer must be empty, in other words, no dumps should be written so
52e808190aSHans Petter Selaskyfar, or existing dump cleared with the
53e808190aSHans Petter Selasky.Dv MLX5_FWDUMP_RESET
54e808190aSHans Petter Selaskycommand for the specified device.
55e808190aSHans Petter SelaskyThe argument for the command should point to the
56b255ca09SHans Petter Selasky.Vt struct mlx5_tool_addr
57e808190aSHans Petter Selaskystructure, containing the PCIe bus address of the device.
58e808190aSHans Petter Selasky.Bd -literal
59b255ca09SHans Petter Selaskystruct mlx5_tool_addr {
60e808190aSHans Petter Selasky	uint32_t domain;
61e808190aSHans Petter Selasky	uint8_t bus;
62e808190aSHans Petter Selasky	uint8_t slot;
63e808190aSHans Petter Selasky	uint8_t func;
64e808190aSHans Petter Selasky};
65e808190aSHans Petter Selasky.Ed
66e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_RESET
67e808190aSHans Petter SelaskyClear the stored firmware dump, preparing the kernel buffer for
68e808190aSHans Petter Selaskythe next dump.
69e808190aSHans Petter SelaskyThe argument for the command should point to the
70b255ca09SHans Petter Selasky.Vt struct mlx5_tool_addr
71e808190aSHans Petter Selaskystructure, containing the PCIe bus address of the device.
72e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_GET
73e808190aSHans Petter SelaskyFetch the stored firmware dump into the user memory.
74e808190aSHans Petter SelaskyThe argument to the command should point to the input/output
75e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_get
76e808190aSHans Petter Selaskystructure.
77e808190aSHans Petter SelaskyIts
78e808190aSHans Petter Selasky.Dv devaddr
79e808190aSHans Petter Selaskyfield specifies the address of the device, the
80e808190aSHans Petter Selasky.Dv buf
81e808190aSHans Petter Selaskyfields points to the array of
82e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_reg
83e808190aSHans Petter Selaskyof records of the registers values, the size of the array is specified
84e808190aSHans Petter Selaskyin the
85e808190aSHans Petter Selasky.Dv reg_cnt
86e808190aSHans Petter Selaskyfield.
87e808190aSHans Petter Selasky.Bd -literal
88e808190aSHans Petter Selaskystruct mlx5_fwdump_get {
89b255ca09SHans Petter Selasky	struct mlx5_tool_addr devaddr;
90e808190aSHans Petter Selasky	struct mlx5_fwdump_reg *buf;
91e808190aSHans Petter Selasky	size_t reg_cnt;
92e808190aSHans Petter Selasky	size_t reg_filled; /* out */
93e808190aSHans Petter Selasky};
94e808190aSHans Petter Selasky.Ed
95e808190aSHans Petter Selasky.Pp
96ffc4f93eSBenedict ReuschlingOn successful return, the
97e808190aSHans Petter Selasky.Dv reg_filled
98e808190aSHans Petter Selaskyfield reports the number of the
99e808190aSHans Petter Selasky.Dv buf
100e808190aSHans Petter Selaskyarray elements actually filled with the registers values.
101e808190aSHans Petter SelaskyIf
102e808190aSHans Petter Selasky.Dv buf
103e808190aSHans Petter Selaskycontains the
104e808190aSHans Petter Selasky.Dv NULL
105e808190aSHans Petter Selaskypointer, no registers are filled, but
106e808190aSHans Petter Selasky.Dv reg_filled
107e808190aSHans Petter Selaskystill contains the number of registers that should be passed for
108e808190aSHans Petter Selaskythe complete dump.
109e808190aSHans Petter Selasky.Pp
110e808190aSHans Petter SelaskyThe
111e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_reg
112e808190aSHans Petter Selaskyelement contains the address of the register in the field
113e808190aSHans Petter Selasky.Dv addr ,
114e808190aSHans Petter Selaskyand its value in the field
115e808190aSHans Petter Selasky.Dv val .
116e808190aSHans Petter Selasky.Bd -literal
117e808190aSHans Petter Selaskystruct mlx5_fwdump_reg {
118e808190aSHans Petter Selasky	uint32_t addr;
119e808190aSHans Petter Selasky	uint32_t val;
120e808190aSHans Petter Selasky};
121e808190aSHans Petter Selasky.Ed
122ff08edcbSHans Petter Selasky.It Dv MLX5_FW_UPDATE
123ff08edcbSHans Petter SelaskyRequests firmware update (flash) on the adapter specified by the
124ff08edcbSHans Petter Selasky.Dv devaddr
125ff08edcbSHans Petter Selaskyusing the firmware image in
126ff08edcbSHans Petter Selasky.Dv MFA2
127ff08edcbSHans Petter Selaskyformat.
128ff08edcbSHans Petter SelaskyThe argument for the ioctl command is the
129ff08edcbSHans Petter Selasky.Vt struct mlx5_fw_update
130ff08edcbSHans Petter Selaskywith the following definition.
131ff08edcbSHans Petter Selasky.Bd -literal
132ff08edcbSHans Petter Selaskystruct mlx5_fw_update {
133ff08edcbSHans Petter Selasky	struct mlx5_tool_addr devaddr;
134ff08edcbSHans Petter Selasky	void *img_fw_data;
135ff08edcbSHans Petter Selasky	size_t img_fw_data_len;
136ff08edcbSHans Petter Selasky};
137ff08edcbSHans Petter Selasky.Ed
138ff08edcbSHans Petter SelaskyImage address in memory is passed in
139ff08edcbSHans Petter Selasky.Dv img_fw_data ,
140ff08edcbSHans Petter Selaskythe length of the image is specified in
141ff08edcbSHans Petter Selasky.Dv img_fw_data_len
142ff08edcbSHans Petter Selaskyfield.
143998c9a2bSHans Petter Selasky.It Dv MLX5_FW_RESET
144998c9a2bSHans Petter SelaskyRequests PCIe link-level reset on the device.
145998c9a2bSHans Petter SelaskyThe address of the device is specified by the
146998c9a2bSHans Petter Selasky.Vt struct mlx5_tool_addr
147998c9a2bSHans Petter Selaskystructure, which should be passed as an argument.
148048ddb58SHans Petter Selasky.It Dv MLX5_EEPROM_GET
149048ddb58SHans Petter SelaskyFetch EEPROM information.
150048ddb58SHans Petter SelaskyThe argument to the command should point to the input/output
151048ddb58SHans Petter Selasky.Vt struct mlx5_eeprom_get
152048ddb58SHans Petter Selaskystructure where, the
153048ddb58SHans Petter Selasky.Dv devaddr
154048ddb58SHans Petter Selaskyfield specifies the address of the device.
155048ddb58SHans Petter Selasky.Bd -literal
156048ddb58SHans Petter Selaskystruct mlx5_eeprom_get {
157048ddb58SHans Petter Selasky        struct mlx5_tool_addr devaddr;
158048ddb58SHans Petter Selasky        size_t eeprom_info_page_valid;
159048ddb58SHans Petter Selasky        uint32_t *eeprom_info_buf;
160048ddb58SHans Petter Selasky        size_t eeprom_info_out_len;
161048ddb58SHans Petter Selasky};
162048ddb58SHans Petter Selasky.Ed
163048ddb58SHans Petter Selasky.Pp
164ffc4f93eSBenedict ReuschlingOn successful return, the
165048ddb58SHans Petter Selasky.Dv eeprom_info_out_len
166048ddb58SHans Petter Selaskyfield reports the length of the EEPROM information.
167048ddb58SHans Petter Selasky.Dv eeprom_info_buf
168048ddb58SHans Petter Selaskyfield contains the actual EEPROM information.
169048ddb58SHans Petter Selasky.Dv eeprom_info_page_valid
170048ddb58SHans Petter Selaskyfield reports the third page validity.
171e808190aSHans Petter Selasky.El
172e808190aSHans Petter Selasky.Sh FILES
173e808190aSHans Petter SelaskyThe
174e808190aSHans Petter Selasky.Pa /dev/mlx5ctl
175*1a720cbeSAlexander Ziaee.Xr devfs 4
176e808190aSHans Petter Selaskynode is used to pass commands to the driver.
177e808190aSHans Petter Selasky.Sh RETURN VALUES
178e808190aSHans Petter SelaskyIf successful, the IOCTL returns zero.
179e808190aSHans Petter SelaskyOtherwise, -1 is returned and the global variable
180e808190aSHans Petter Selasky.Va errno
181e808190aSHans Petter Selaskyis set to indicate the error.
182e808190aSHans Petter Selasky.Sh SEE ALSO
183e808190aSHans Petter Selasky.Xr errno 2 ,
184e808190aSHans Petter Selasky.Xr ioctl 2 ,
185e808190aSHans Petter Selasky.Xr mlx5en 4 ,
186e808190aSHans Petter Selasky.Xr mlx5ib 4 ,
187e808190aSHans Petter Selasky.Xr mlx5tool 8
188e808190aSHans Petter Selaskyand
189e808190aSHans Petter Selasky.Xr pci 9 .
190