xref: /freebsd/share/man/man4/mlx5io.4 (revision ed549cb0c53f8438c52593ce811f6fcc812248e9)
1.\"
2.\" Copyright (c) 2018, 2019 Mellanox Technologies
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd October 2, 2019
29.Dt mlx5io 4
30.Os
31.Sh NAME
32.Nm mlx5io
33.Nd IOCTL interface to manage Connect-X 4/5/6 Mellanox network adapters
34.Sh SYNOPSIS
35.In dev/mlx5/mlx5io.h
36.Sh DESCRIPTION
37The
38.Nm
39interface is provided for management of the Connect-X4, 5 and 6 network adapters
40in the aspects not covered by the generic network configuration,
41mostly related to the PCIe attachment and internal card working.
42Interface consists of the commands, which are passed by means of
43.Xr ioctl 2
44on the file descriptor, opened from the
45.Pa /dev/mlx5ctl
46device node.
47.Pp
48The following commands are implemented:
49.Bl -tag -width indent
50.It Dv MLX5_FWDUMP_FORCE
51Take the snapshot of the firmware registers state and store it in the
52kernel buffer.
53The buffer must be empty, in other words, no dumps should be written so
54far, or existing dump cleared with the
55.Dv MLX5_FWDUMP_RESET
56command for the specified device.
57The argument for the command should point to the
58.Vt struct mlx5_tool_addr
59structure, containing the PCIe bus address of the device.
60.Bd -literal
61struct mlx5_tool_addr {
62	uint32_t domain;
63	uint8_t bus;
64	uint8_t slot;
65	uint8_t func;
66};
67.Ed
68.It Dv MLX5_FWDUMP_RESET
69Clear the stored firmware dump, preparing the kernel buffer for
70the next dump.
71The argument for the command should point to the
72.Vt struct mlx5_tool_addr
73structure, containing the PCIe bus address of the device.
74.It Dv MLX5_FWDUMP_GET
75Fetch the stored firmware dump into the user memory.
76The argument to the command should point to the input/output
77.Vt struct mlx5_fwdump_get
78structure.
79Its
80.Dv devaddr
81field specifies the address of the device, the
82.Dv buf
83fields points to the array of
84.Vt struct mlx5_fwdump_reg
85of records of the registers values, the size of the array is specified
86in the
87.Dv reg_cnt
88field.
89.Bd -literal
90struct mlx5_fwdump_get {
91	struct mlx5_tool_addr devaddr;
92	struct mlx5_fwdump_reg *buf;
93	size_t reg_cnt;
94	size_t reg_filled; /* out */
95};
96.Ed
97.Pp
98On successfull return, the
99.Dv reg_filled
100field reports the number of the
101.Dv buf
102array elements actually filled with the registers values.
103If
104.Dv buf
105contains the
106.Dv NULL
107pointer, no registers are filled, but
108.Dv reg_filled
109still contains the number of registers that should be passed for
110the complete dump.
111.Pp
112The
113.Vt struct mlx5_fwdump_reg
114element contains the address of the register in the field
115.Dv addr ,
116and its value in the field
117.Dv val .
118.Bd -literal
119struct mlx5_fwdump_reg {
120	uint32_t addr;
121	uint32_t val;
122};
123.Ed
124.It Dv MLX5_FW_UPDATE
125Requests firmware update (flash) on the adapter specified by the
126.Dv devaddr
127using the firmware image in
128.Dv MFA2
129format.
130The argument for the ioctl command is the
131.Vt struct mlx5_fw_update
132with the following definition.
133.Bd -literal
134struct mlx5_fw_update {
135	struct mlx5_tool_addr devaddr;
136	void *img_fw_data;
137	size_t img_fw_data_len;
138};
139.Ed
140Image address in memory is passed in
141.Dv img_fw_data ,
142the length of the image is specified in
143.Dv img_fw_data_len
144field.
145.It Dv MLX5_FW_RESET
146Requests PCIe link-level reset on the device.
147The address of the device is specified by the
148.Vt struct mlx5_tool_addr
149structure, which should be passed as an argument.
150.It Dv MLX5_EEPROM_GET
151Fetch EEPROM information.
152The argument to the command should point to the input/output
153.Vt struct mlx5_eeprom_get
154structure where, the
155.Dv devaddr
156field specifies the address of the device.
157.Bd -literal
158struct mlx5_eeprom_get {
159        struct mlx5_tool_addr devaddr;
160        size_t eeprom_info_page_valid;
161        uint32_t *eeprom_info_buf;
162        size_t eeprom_info_out_len;
163};
164.Ed
165.Pp
166On successfull return, the
167.Dv eeprom_info_out_len
168field reports the length of the EEPROM information.
169.Dv eeprom_info_buf
170field contains the actual EEPROM information.
171.Dv eeprom_info_page_valid
172field reports the third page validity.
173.El
174.Sh FILES
175The
176.Pa /dev/mlx5ctl
177.Xr devfs 5
178node is used to pass commands to the driver.
179.Sh RETURN VALUES
180If successful, the IOCTL returns zero.
181Otherwise, -1 is returned and the global variable
182.Va errno
183is set to indicate the error.
184.Sh SEE ALSO
185.Xr errno 2 ,
186.Xr ioctl 2 ,
187.Xr mlx5en 4 ,
188.Xr mlx5ib 4 ,
189.Xr mlx5tool 8
190and
191.Xr pci 9 .
192