xref: /freebsd/sys/dev/mlx4/cmd.h (revision 55b1c6e7e4a6909004e13c6d2f328f911a8e7b83)
197549c34SHans Petter Selasky /*
297549c34SHans Petter Selasky  * Copyright (c) 2006 Cisco Systems, Inc.  All rights reserved.
397549c34SHans Petter Selasky  *
497549c34SHans Petter Selasky  * This software is available to you under a choice of one of two
597549c34SHans Petter Selasky  * licenses.  You may choose to be licensed under the terms of the GNU
697549c34SHans Petter Selasky  * General Public License (GPL) Version 2, available from the file
797549c34SHans Petter Selasky  * COPYING in the main directory of this source tree, or the
897549c34SHans Petter Selasky  * OpenIB.org BSD license below:
997549c34SHans Petter Selasky  *
1097549c34SHans Petter Selasky  *     Redistribution and use in source and binary forms, with or
1197549c34SHans Petter Selasky  *     without modification, are permitted provided that the following
1297549c34SHans Petter Selasky  *     conditions are met:
1397549c34SHans Petter Selasky  *
1497549c34SHans Petter Selasky  *      - Redistributions of source code must retain the above
1597549c34SHans Petter Selasky  *        copyright notice, this list of conditions and the following
1697549c34SHans Petter Selasky  *        disclaimer.
1797549c34SHans Petter Selasky  *
1897549c34SHans Petter Selasky  *      - Redistributions in binary form must reproduce the above
1997549c34SHans Petter Selasky  *        copyright notice, this list of conditions and the following
2097549c34SHans Petter Selasky  *        disclaimer in the documentation and/or other materials
2197549c34SHans Petter Selasky  *        provided with the distribution.
2297549c34SHans Petter Selasky  *
2397549c34SHans Petter Selasky  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2497549c34SHans Petter Selasky  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2597549c34SHans Petter Selasky  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2697549c34SHans Petter Selasky  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2797549c34SHans Petter Selasky  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2897549c34SHans Petter Selasky  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2997549c34SHans Petter Selasky  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3097549c34SHans Petter Selasky  * SOFTWARE.
3197549c34SHans Petter Selasky  */
3297549c34SHans Petter Selasky 
3397549c34SHans Petter Selasky #ifndef MLX4_CMD_H
3497549c34SHans Petter Selasky #define MLX4_CMD_H
3597549c34SHans Petter Selasky 
3697549c34SHans Petter Selasky #include <linux/dma-mapping.h>
3797549c34SHans Petter Selasky #include <linux/types.h>
3897549c34SHans Petter Selasky 
39*c3191c2eSHans Petter Selasky struct mlx4_counter;
40*c3191c2eSHans Petter Selasky 
4197549c34SHans Petter Selasky enum {
4297549c34SHans Petter Selasky 	/* initialization and general commands */
4397549c34SHans Petter Selasky 	MLX4_CMD_SYS_EN		 = 0x1,
4497549c34SHans Petter Selasky 	MLX4_CMD_SYS_DIS	 = 0x2,
4597549c34SHans Petter Selasky 	MLX4_CMD_MAP_FA		 = 0xfff,
4697549c34SHans Petter Selasky 	MLX4_CMD_UNMAP_FA	 = 0xffe,
4797549c34SHans Petter Selasky 	MLX4_CMD_RUN_FW		 = 0xff6,
4897549c34SHans Petter Selasky 	MLX4_CMD_MOD_STAT_CFG	 = 0x34,
4997549c34SHans Petter Selasky 	MLX4_CMD_QUERY_DEV_CAP	 = 0x3,
5097549c34SHans Petter Selasky 	MLX4_CMD_QUERY_FW	 = 0x4,
5197549c34SHans Petter Selasky 	MLX4_CMD_ENABLE_LAM	 = 0xff8,
5297549c34SHans Petter Selasky 	MLX4_CMD_DISABLE_LAM	 = 0xff7,
5397549c34SHans Petter Selasky 	MLX4_CMD_QUERY_DDR	 = 0x5,
5497549c34SHans Petter Selasky 	MLX4_CMD_QUERY_ADAPTER	 = 0x6,
5597549c34SHans Petter Selasky 	MLX4_CMD_INIT_HCA	 = 0x7,
5697549c34SHans Petter Selasky 	MLX4_CMD_CLOSE_HCA	 = 0x8,
5797549c34SHans Petter Selasky 	MLX4_CMD_INIT_PORT	 = 0x9,
5897549c34SHans Petter Selasky 	MLX4_CMD_CLOSE_PORT	 = 0xa,
5997549c34SHans Petter Selasky 	MLX4_CMD_QUERY_HCA	 = 0xb,
6097549c34SHans Petter Selasky 	MLX4_CMD_QUERY_PORT	 = 0x43,
6197549c34SHans Petter Selasky 	MLX4_CMD_SENSE_PORT	 = 0x4d,
6297549c34SHans Petter Selasky 	MLX4_CMD_HW_HEALTH_CHECK = 0x50,
6397549c34SHans Petter Selasky 	MLX4_CMD_SET_PORT	 = 0xc,
6497549c34SHans Petter Selasky 	MLX4_CMD_SET_NODE	 = 0x5a,
6597549c34SHans Petter Selasky 	MLX4_CMD_QUERY_FUNC	 = 0x56,
6697549c34SHans Petter Selasky 	MLX4_CMD_ACCESS_DDR	 = 0x2e,
6797549c34SHans Petter Selasky 	MLX4_CMD_MAP_ICM	 = 0xffa,
6897549c34SHans Petter Selasky 	MLX4_CMD_UNMAP_ICM	 = 0xff9,
6997549c34SHans Petter Selasky 	MLX4_CMD_MAP_ICM_AUX	 = 0xffc,
7097549c34SHans Petter Selasky 	MLX4_CMD_UNMAP_ICM_AUX	 = 0xffb,
7197549c34SHans Petter Selasky 	MLX4_CMD_SET_ICM_SIZE	 = 0xffd,
72*c3191c2eSHans Petter Selasky 	MLX4_CMD_ACCESS_REG	 = 0x3b,
73*c3191c2eSHans Petter Selasky 	MLX4_CMD_ALLOCATE_VPP	 = 0x80,
74*c3191c2eSHans Petter Selasky 	MLX4_CMD_SET_VPORT_QOS	 = 0x81,
75*c3191c2eSHans Petter Selasky 
7697549c34SHans Petter Selasky 	/*master notify fw on finish for slave's flr*/
7797549c34SHans Petter Selasky 	MLX4_CMD_INFORM_FLR_DONE = 0x5b,
78*c3191c2eSHans Petter Selasky 	MLX4_CMD_VIRT_PORT_MAP   = 0x5c,
7997549c34SHans Petter Selasky 	MLX4_CMD_GET_OP_REQ      = 0x59,
8097549c34SHans Petter Selasky 
8197549c34SHans Petter Selasky 	/* TPT commands */
8297549c34SHans Petter Selasky 	MLX4_CMD_SW2HW_MPT	 = 0xd,
8397549c34SHans Petter Selasky 	MLX4_CMD_QUERY_MPT	 = 0xe,
8497549c34SHans Petter Selasky 	MLX4_CMD_HW2SW_MPT	 = 0xf,
8597549c34SHans Petter Selasky 	MLX4_CMD_READ_MTT	 = 0x10,
8697549c34SHans Petter Selasky 	MLX4_CMD_WRITE_MTT	 = 0x11,
8797549c34SHans Petter Selasky 	MLX4_CMD_SYNC_TPT	 = 0x2f,
8897549c34SHans Petter Selasky 
8997549c34SHans Petter Selasky 	/* EQ commands */
9097549c34SHans Petter Selasky 	MLX4_CMD_MAP_EQ		 = 0x12,
9197549c34SHans Petter Selasky 	MLX4_CMD_SW2HW_EQ	 = 0x13,
9297549c34SHans Petter Selasky 	MLX4_CMD_HW2SW_EQ	 = 0x14,
9397549c34SHans Petter Selasky 	MLX4_CMD_QUERY_EQ	 = 0x15,
9497549c34SHans Petter Selasky 
9597549c34SHans Petter Selasky 	/* CQ commands */
9697549c34SHans Petter Selasky 	MLX4_CMD_SW2HW_CQ	 = 0x16,
9797549c34SHans Petter Selasky 	MLX4_CMD_HW2SW_CQ	 = 0x17,
9897549c34SHans Petter Selasky 	MLX4_CMD_QUERY_CQ	 = 0x18,
9997549c34SHans Petter Selasky 	MLX4_CMD_MODIFY_CQ	 = 0x2c,
10097549c34SHans Petter Selasky 
10197549c34SHans Petter Selasky 	/* SRQ commands */
10297549c34SHans Petter Selasky 	MLX4_CMD_SW2HW_SRQ	 = 0x35,
10397549c34SHans Petter Selasky 	MLX4_CMD_HW2SW_SRQ	 = 0x36,
10497549c34SHans Petter Selasky 	MLX4_CMD_QUERY_SRQ	 = 0x37,
10597549c34SHans Petter Selasky 	MLX4_CMD_ARM_SRQ	 = 0x40,
10697549c34SHans Petter Selasky 
10797549c34SHans Petter Selasky 	/* QP/EE commands */
10897549c34SHans Petter Selasky 	MLX4_CMD_RST2INIT_QP	 = 0x19,
10997549c34SHans Petter Selasky 	MLX4_CMD_INIT2RTR_QP	 = 0x1a,
11097549c34SHans Petter Selasky 	MLX4_CMD_RTR2RTS_QP	 = 0x1b,
11197549c34SHans Petter Selasky 	MLX4_CMD_RTS2RTS_QP	 = 0x1c,
11297549c34SHans Petter Selasky 	MLX4_CMD_SQERR2RTS_QP	 = 0x1d,
11397549c34SHans Petter Selasky 	MLX4_CMD_2ERR_QP	 = 0x1e,
11497549c34SHans Petter Selasky 	MLX4_CMD_RTS2SQD_QP	 = 0x1f,
11597549c34SHans Petter Selasky 	MLX4_CMD_SQD2SQD_QP	 = 0x38,
11697549c34SHans Petter Selasky 	MLX4_CMD_SQD2RTS_QP	 = 0x20,
11797549c34SHans Petter Selasky 	MLX4_CMD_2RST_QP	 = 0x21,
11897549c34SHans Petter Selasky 	MLX4_CMD_QUERY_QP	 = 0x22,
11997549c34SHans Petter Selasky 	MLX4_CMD_INIT2INIT_QP	 = 0x2d,
12097549c34SHans Petter Selasky 	MLX4_CMD_SUSPEND_QP	 = 0x32,
12197549c34SHans Petter Selasky 	MLX4_CMD_UNSUSPEND_QP	 = 0x33,
12297549c34SHans Petter Selasky 	MLX4_CMD_UPDATE_QP	 = 0x61,
12397549c34SHans Petter Selasky 	/* special QP and management commands */
12497549c34SHans Petter Selasky 	MLX4_CMD_CONF_SPECIAL_QP = 0x23,
12597549c34SHans Petter Selasky 	MLX4_CMD_MAD_IFC	 = 0x24,
126*c3191c2eSHans Petter Selasky 	MLX4_CMD_MAD_DEMUX	 = 0x203,
12797549c34SHans Petter Selasky 
12897549c34SHans Petter Selasky 	/* multicast commands */
12997549c34SHans Petter Selasky 	MLX4_CMD_READ_MCG	 = 0x25,
13097549c34SHans Petter Selasky 	MLX4_CMD_WRITE_MCG	 = 0x26,
13197549c34SHans Petter Selasky 	MLX4_CMD_MGID_HASH	 = 0x27,
13297549c34SHans Petter Selasky 
13397549c34SHans Petter Selasky 	/* miscellaneous commands */
13497549c34SHans Petter Selasky 	MLX4_CMD_DIAG_RPRT	 = 0x30,
13597549c34SHans Petter Selasky 	MLX4_CMD_NOP		 = 0x31,
136*c3191c2eSHans Petter Selasky 	MLX4_CMD_CONFIG_DEV	 = 0x3a,
13797549c34SHans Petter Selasky 	MLX4_CMD_ACCESS_MEM	 = 0x2e,
13897549c34SHans Petter Selasky 	MLX4_CMD_SET_VEP	 = 0x52,
13997549c34SHans Petter Selasky 
14097549c34SHans Petter Selasky 	/* Ethernet specific commands */
14197549c34SHans Petter Selasky 	MLX4_CMD_SET_VLAN_FLTR	 = 0x47,
14297549c34SHans Petter Selasky 	MLX4_CMD_SET_MCAST_FLTR	 = 0x48,
14397549c34SHans Petter Selasky 	MLX4_CMD_DUMP_ETH_STATS	 = 0x49,
14497549c34SHans Petter Selasky 
14597549c34SHans Petter Selasky 	/* Communication channel commands */
14697549c34SHans Petter Selasky 	MLX4_CMD_ARM_COMM_CHANNEL = 0x57,
14797549c34SHans Petter Selasky 	MLX4_CMD_GEN_EQE	 = 0x58,
14897549c34SHans Petter Selasky 
14997549c34SHans Petter Selasky 	/* virtual commands */
15097549c34SHans Petter Selasky 	MLX4_CMD_ALLOC_RES	 = 0xf00,
15197549c34SHans Petter Selasky 	MLX4_CMD_FREE_RES	 = 0xf01,
15297549c34SHans Petter Selasky 	MLX4_CMD_MCAST_ATTACH	 = 0xf05,
15397549c34SHans Petter Selasky 	MLX4_CMD_UCAST_ATTACH	 = 0xf06,
15497549c34SHans Petter Selasky 	MLX4_CMD_PROMISC         = 0xf08,
15597549c34SHans Petter Selasky 	MLX4_CMD_QUERY_FUNC_CAP  = 0xf0a,
15697549c34SHans Petter Selasky 	MLX4_CMD_QP_ATTACH	 = 0xf0b,
15797549c34SHans Petter Selasky 
15897549c34SHans Petter Selasky 	/* debug commands */
15997549c34SHans Petter Selasky 	MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
16097549c34SHans Petter Selasky 	MLX4_CMD_SET_DEBUG_MSG	 = 0x2b,
16197549c34SHans Petter Selasky 
16297549c34SHans Petter Selasky 	/* statistics commands */
16397549c34SHans Petter Selasky 	MLX4_CMD_QUERY_IF_STAT	 = 0X54,
16497549c34SHans Petter Selasky 	MLX4_CMD_SET_IF_STAT	 = 0X55,
16597549c34SHans Petter Selasky 
16697549c34SHans Petter Selasky 	/* register/delete flow steering network rules */
16797549c34SHans Petter Selasky 	MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
16897549c34SHans Petter Selasky 	MLX4_QP_FLOW_STEERING_DETACH = 0x66,
16997549c34SHans Petter Selasky 	MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64,
170*c3191c2eSHans Petter Selasky 
171*c3191c2eSHans Petter Selasky 	/* Update and read QCN parameters */
172*c3191c2eSHans Petter Selasky 	MLX4_CMD_CONGESTION_CTRL_OPCODE = 0x68,
17397549c34SHans Petter Selasky };
17497549c34SHans Petter Selasky 
17597549c34SHans Petter Selasky enum {
17697549c34SHans Petter Selasky 	MLX4_CMD_TIME_CLASS_A	= 60000,
17797549c34SHans Petter Selasky 	MLX4_CMD_TIME_CLASS_B	= 60000,
17897549c34SHans Petter Selasky 	MLX4_CMD_TIME_CLASS_C	= 60000,
17997549c34SHans Petter Selasky };
18097549c34SHans Petter Selasky 
18197549c34SHans Petter Selasky enum {
182*c3191c2eSHans Petter Selasky 	/* virtual to physical port mapping opcode modifiers */
183*c3191c2eSHans Petter Selasky 	MLX4_GET_PORT_VIRT2PHY = 0x0,
184*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_VIRT2PHY = 0x1,
185*c3191c2eSHans Petter Selasky };
186*c3191c2eSHans Petter Selasky 
187*c3191c2eSHans Petter Selasky enum {
18897549c34SHans Petter Selasky 	MLX4_MAILBOX_SIZE	= 4096,
18997549c34SHans Petter Selasky 	MLX4_ACCESS_MEM_ALIGN	= 256,
19097549c34SHans Petter Selasky };
19197549c34SHans Petter Selasky 
19297549c34SHans Petter Selasky enum {
193*c3191c2eSHans Petter Selasky 	/* Set port opcode modifiers */
194*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_IB_OPCODE		= 0x0,
195*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_ETH_OPCODE	= 0x1,
196*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_BEACON_OPCODE	= 0x4,
197*c3191c2eSHans Petter Selasky };
198*c3191c2eSHans Petter Selasky 
199*c3191c2eSHans Petter Selasky enum {
200*c3191c2eSHans Petter Selasky 	/* Set port Ethernet input modifiers */
20197549c34SHans Petter Selasky 	MLX4_SET_PORT_GENERAL   = 0x0,
20297549c34SHans Petter Selasky 	MLX4_SET_PORT_RQP_CALC  = 0x1,
20397549c34SHans Petter Selasky 	MLX4_SET_PORT_MAC_TABLE = 0x2,
20497549c34SHans Petter Selasky 	MLX4_SET_PORT_VLAN_TABLE = 0x3,
20597549c34SHans Petter Selasky 	MLX4_SET_PORT_PRIO_MAP  = 0x4,
20697549c34SHans Petter Selasky 	MLX4_SET_PORT_GID_TABLE = 0x5,
20797549c34SHans Petter Selasky 	MLX4_SET_PORT_PRIO2TC	= 0x8,
208*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_SCHEDULER = 0x9,
209*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_VXLAN	= 0xB,
210*c3191c2eSHans Petter Selasky 	MLX4_SET_PORT_ROCE_ADDR	= 0xD
211*c3191c2eSHans Petter Selasky };
212*c3191c2eSHans Petter Selasky 
213*c3191c2eSHans Petter Selasky enum {
214*c3191c2eSHans Petter Selasky 	MLX4_CMD_MAD_DEMUX_CONFIG	= 0,
215*c3191c2eSHans Petter Selasky 	MLX4_CMD_MAD_DEMUX_QUERY_STATE	= 1,
216*c3191c2eSHans Petter Selasky 	MLX4_CMD_MAD_DEMUX_QUERY_RESTR	= 2, /* Query mad demux restrictions */
21797549c34SHans Petter Selasky };
21897549c34SHans Petter Selasky 
21997549c34SHans Petter Selasky enum {
22097549c34SHans Petter Selasky 	MLX4_CMD_WRAPPED,
22197549c34SHans Petter Selasky 	MLX4_CMD_NATIVE
22297549c34SHans Petter Selasky };
22397549c34SHans Petter Selasky 
224*c3191c2eSHans Petter Selasky /*
225*c3191c2eSHans Petter Selasky  * MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP -
226*c3191c2eSHans Petter Selasky  * Receive checksum value is reported in CQE also for non TCP/UDP packets.
227*c3191c2eSHans Petter Selasky  *
228*c3191c2eSHans Petter Selasky  * MLX4_RX_CSUM_MODE_L4 -
229*c3191c2eSHans Petter Selasky  * L4_CSUM bit in CQE, which indicates whether or not L4 checksum
230*c3191c2eSHans Petter Selasky  * was validated correctly, is supported.
231*c3191c2eSHans Petter Selasky  *
232*c3191c2eSHans Petter Selasky  * MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP -
233*c3191c2eSHans Petter Selasky  * IP_OK CQE's field is supported also for non TCP/UDP IP packets.
234*c3191c2eSHans Petter Selasky  *
235*c3191c2eSHans Petter Selasky  * MLX4_RX_CSUM_MODE_MULTI_VLAN -
236*c3191c2eSHans Petter Selasky  * Receive Checksum offload is supported for packets with more than 2 vlan headers.
237*c3191c2eSHans Petter Selasky  */
238*c3191c2eSHans Petter Selasky enum mlx4_rx_csum_mode {
239*c3191c2eSHans Petter Selasky 	MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP		= 1UL << 0,
240*c3191c2eSHans Petter Selasky 	MLX4_RX_CSUM_MODE_L4				= 1UL << 1,
241*c3191c2eSHans Petter Selasky 	MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP		= 1UL << 2,
242*c3191c2eSHans Petter Selasky 	MLX4_RX_CSUM_MODE_MULTI_VLAN			= 1UL << 3
243*c3191c2eSHans Petter Selasky };
244*c3191c2eSHans Petter Selasky 
245*c3191c2eSHans Petter Selasky struct mlx4_config_dev_params {
246*c3191c2eSHans Petter Selasky 	u16	vxlan_udp_dport;
247*c3191c2eSHans Petter Selasky 	u8	rx_csum_flags_port_1;
248*c3191c2eSHans Petter Selasky 	u8	rx_csum_flags_port_2;
249*c3191c2eSHans Petter Selasky };
250*c3191c2eSHans Petter Selasky 
251*c3191c2eSHans Petter Selasky enum mlx4_en_congestion_control_algorithm {
252*c3191c2eSHans Petter Selasky 	MLX4_CTRL_ALGO_802_1_QAU_REACTION_POINT = 0,
253*c3191c2eSHans Petter Selasky };
254*c3191c2eSHans Petter Selasky 
255*c3191c2eSHans Petter Selasky enum mlx4_en_congestion_control_opmod {
256*c3191c2eSHans Petter Selasky 	MLX4_CONGESTION_CONTROL_GET_PARAMS,
257*c3191c2eSHans Petter Selasky 	MLX4_CONGESTION_CONTROL_GET_STATISTICS,
258*c3191c2eSHans Petter Selasky 	MLX4_CONGESTION_CONTROL_SET_PARAMS = 4,
259*c3191c2eSHans Petter Selasky };
260*c3191c2eSHans Petter Selasky 
26197549c34SHans Petter Selasky struct mlx4_dev;
26297549c34SHans Petter Selasky 
26397549c34SHans Petter Selasky struct mlx4_cmd_mailbox {
26497549c34SHans Petter Selasky 	void		       *buf;
26597549c34SHans Petter Selasky 	dma_addr_t		dma;
26697549c34SHans Petter Selasky };
26797549c34SHans Petter Selasky 
26897549c34SHans Petter Selasky int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
26997549c34SHans Petter Selasky 	       int out_is_imm, u32 in_modifier, u8 op_modifier,
27097549c34SHans Petter Selasky 	       u16 op, unsigned long timeout, int native);
27197549c34SHans Petter Selasky 
27297549c34SHans Petter Selasky /* Invoke a command with no output parameter */
mlx4_cmd(struct mlx4_dev * dev,u64 in_param,u32 in_modifier,u8 op_modifier,u16 op,unsigned long timeout,int native)27397549c34SHans Petter Selasky static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier,
27497549c34SHans Petter Selasky 			   u8 op_modifier, u16 op, unsigned long timeout,
27597549c34SHans Petter Selasky 			   int native)
27697549c34SHans Petter Selasky {
27797549c34SHans Petter Selasky 	return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier,
27897549c34SHans Petter Selasky 			  op_modifier, op, timeout, native);
27997549c34SHans Petter Selasky }
28097549c34SHans Petter Selasky 
28197549c34SHans Petter Selasky /* Invoke a command with an output mailbox */
mlx4_cmd_box(struct mlx4_dev * dev,u64 in_param,u64 out_param,u32 in_modifier,u8 op_modifier,u16 op,unsigned long timeout,int native)28297549c34SHans Petter Selasky static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param,
28397549c34SHans Petter Selasky 			       u32 in_modifier, u8 op_modifier, u16 op,
28497549c34SHans Petter Selasky 			       unsigned long timeout, int native)
28597549c34SHans Petter Selasky {
28697549c34SHans Petter Selasky 	return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier,
28797549c34SHans Petter Selasky 			  op_modifier, op, timeout, native);
28897549c34SHans Petter Selasky }
28997549c34SHans Petter Selasky 
29097549c34SHans Petter Selasky /*
29197549c34SHans Petter Selasky  * Invoke a command with an immediate output parameter (and copy the
29297549c34SHans Petter Selasky  * output into the caller's out_param pointer after the command
29397549c34SHans Petter Selasky  * executes).
29497549c34SHans Petter Selasky  */
mlx4_cmd_imm(struct mlx4_dev * dev,u64 in_param,u64 * out_param,u32 in_modifier,u8 op_modifier,u16 op,unsigned long timeout,int native)29597549c34SHans Petter Selasky static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
29697549c34SHans Petter Selasky 			       u32 in_modifier, u8 op_modifier, u16 op,
29797549c34SHans Petter Selasky 			       unsigned long timeout, int native)
29897549c34SHans Petter Selasky {
29997549c34SHans Petter Selasky 	return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier,
30097549c34SHans Petter Selasky 			  op_modifier, op, timeout, native);
30197549c34SHans Petter Selasky }
30297549c34SHans Petter Selasky 
30397549c34SHans Petter Selasky struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
30497549c34SHans Petter Selasky void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
30597549c34SHans Petter Selasky 
306*c3191c2eSHans Petter Selasky int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index,
307*c3191c2eSHans Petter Selasky 			   struct mlx4_counter *counter_stats, int reset);
30897549c34SHans Petter Selasky u32 mlx4_comm_get_version(void);
309*c3191c2eSHans Petter Selasky int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
310*c3191c2eSHans Petter Selasky int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan,
311*c3191c2eSHans Petter Selasky 		     u8 qos, __be16 proto);
312*c3191c2eSHans Petter Selasky int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
313*c3191c2eSHans Petter Selasky 		     int max_tx_rate);
31497549c34SHans Petter Selasky int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
315*c3191c2eSHans Petter Selasky int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
316*c3191c2eSHans Petter Selasky 			      struct mlx4_config_dev_params *params);
317*c3191c2eSHans Petter Selasky void mlx4_cmd_wake_completions(struct mlx4_dev *dev);
318*c3191c2eSHans Petter Selasky void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev);
31997549c34SHans Petter Selasky /*
32097549c34SHans Petter Selasky  * mlx4_get_slave_default_vlan -
321*c3191c2eSHans Petter Selasky  * return true if VST ( default vlan)
322*c3191c2eSHans Petter Selasky  * if VST, will return vlan & qos (if not NULL)
32397549c34SHans Petter Selasky  */
324*c3191c2eSHans Petter Selasky bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
325*c3191c2eSHans Petter Selasky 				 u16 *vlan, u8 *qos);
32697549c34SHans Petter Selasky 
32797549c34SHans Petter Selasky #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
328*c3191c2eSHans Petter Selasky #define COMM_CHAN_EVENT_INTERNAL_ERR (1 << 17)
32997549c34SHans Petter Selasky 
33097549c34SHans Petter Selasky #endif /* MLX4_CMD_H */
331