xref: /freebsd/contrib/ofed/libmlx4/wqe.h (revision 87181516ef48be852d5e5fee53c6e0dbfc62f21e)
1*d6b92ffaSHans Petter Selasky /*
2*d6b92ffaSHans Petter Selasky  * Copyright (c) 2007 Cisco, Inc.  All rights reserved.
3*d6b92ffaSHans Petter Selasky  *
4*d6b92ffaSHans Petter Selasky  * This software is available to you under a choice of one of two
5*d6b92ffaSHans Petter Selasky  * licenses.  You may choose to be licensed under the terms of the GNU
6*d6b92ffaSHans Petter Selasky  * General Public License (GPL) Version 2, available from the file
7*d6b92ffaSHans Petter Selasky  * COPYING in the main directory of this source tree, or the
8*d6b92ffaSHans Petter Selasky  * OpenIB.org BSD license below:
9*d6b92ffaSHans Petter Selasky  *
10*d6b92ffaSHans Petter Selasky  *     Redistribution and use in source and binary forms, with or
11*d6b92ffaSHans Petter Selasky  *     without modification, are permitted provided that the following
12*d6b92ffaSHans Petter Selasky  *     conditions are met:
13*d6b92ffaSHans Petter Selasky  *
14*d6b92ffaSHans Petter Selasky  *      - Redistributions of source code must retain the above
15*d6b92ffaSHans Petter Selasky  *        copyright notice, this list of conditions and the following
16*d6b92ffaSHans Petter Selasky  *        disclaimer.
17*d6b92ffaSHans Petter Selasky  *
18*d6b92ffaSHans Petter Selasky  *      - Redistributions in binary form must reproduce the above
19*d6b92ffaSHans Petter Selasky  *        copyright notice, this list of conditions and the following
20*d6b92ffaSHans Petter Selasky  *        disclaimer in the documentation and/or other materials
21*d6b92ffaSHans Petter Selasky  *        provided with the distribution.
22*d6b92ffaSHans Petter Selasky  *
23*d6b92ffaSHans Petter Selasky  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24*d6b92ffaSHans Petter Selasky  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25*d6b92ffaSHans Petter Selasky  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26*d6b92ffaSHans Petter Selasky  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27*d6b92ffaSHans Petter Selasky  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28*d6b92ffaSHans Petter Selasky  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29*d6b92ffaSHans Petter Selasky  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30*d6b92ffaSHans Petter Selasky  * SOFTWARE.
31*d6b92ffaSHans Petter Selasky  */
32*d6b92ffaSHans Petter Selasky 
33*d6b92ffaSHans Petter Selasky #ifndef WQE_H
34*d6b92ffaSHans Petter Selasky #define WQE_H
35*d6b92ffaSHans Petter Selasky 
36*d6b92ffaSHans Petter Selasky #include <stdint.h>
37*d6b92ffaSHans Petter Selasky 
38*d6b92ffaSHans Petter Selasky enum {
39*d6b92ffaSHans Petter Selasky 	MLX4_SEND_DOORBELL	= 0x14,
40*d6b92ffaSHans Petter Selasky };
41*d6b92ffaSHans Petter Selasky 
42*d6b92ffaSHans Petter Selasky enum {
43*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_SOLICIT		= 1 << 1,
44*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_CQ_UPDATE		= 3 << 2,
45*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_IP_HDR_CSUM	= 1 << 4,
46*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_TCP_UDP_CSUM	= 1 << 5,
47*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_FENCE		= 1 << 6,
48*d6b92ffaSHans Petter Selasky 	MLX4_WQE_CTRL_STRONG_ORDER	= 1 << 7
49*d6b92ffaSHans Petter Selasky };
50*d6b92ffaSHans Petter Selasky 
51*d6b92ffaSHans Petter Selasky enum {
52*d6b92ffaSHans Petter Selasky 	MLX4_WQE_BIND_TYPE_2		= (1<<31),
53*d6b92ffaSHans Petter Selasky 	MLX4_WQE_BIND_ZERO_BASED	= (1<<30),
54*d6b92ffaSHans Petter Selasky };
55*d6b92ffaSHans Petter Selasky 
56*d6b92ffaSHans Petter Selasky enum {
57*d6b92ffaSHans Petter Selasky 	MLX4_INLINE_SEG		= 1 << 31,
58*d6b92ffaSHans Petter Selasky 	MLX4_INLINE_ALIGN	= 64,
59*d6b92ffaSHans Petter Selasky };
60*d6b92ffaSHans Petter Selasky 
61*d6b92ffaSHans Petter Selasky enum {
62*d6b92ffaSHans Petter Selasky 	MLX4_INVALID_LKEY	= 0x100,
63*d6b92ffaSHans Petter Selasky };
64*d6b92ffaSHans Petter Selasky 
65*d6b92ffaSHans Petter Selasky struct mlx4_wqe_ctrl_seg {
66*d6b92ffaSHans Petter Selasky 	uint32_t		owner_opcode;
67*d6b92ffaSHans Petter Selasky 	union {
68*d6b92ffaSHans Petter Selasky 		struct {
69*d6b92ffaSHans Petter Selasky 			uint8_t			reserved[3];
70*d6b92ffaSHans Petter Selasky 			uint8_t			fence_size;
71*d6b92ffaSHans Petter Selasky 		};
72*d6b92ffaSHans Petter Selasky 		uint32_t	bf_qpn;
73*d6b92ffaSHans Petter Selasky 	};
74*d6b92ffaSHans Petter Selasky 	/*
75*d6b92ffaSHans Petter Selasky 	 * High 24 bits are SRC remote buffer; low 8 bits are flags:
76*d6b92ffaSHans Petter Selasky 	 * [7]   SO (strong ordering)
77*d6b92ffaSHans Petter Selasky 	 * [5]   TCP/UDP checksum
78*d6b92ffaSHans Petter Selasky 	 * [4]   IP checksum
79*d6b92ffaSHans Petter Selasky 	 * [3:2] C (generate completion queue entry)
80*d6b92ffaSHans Petter Selasky 	 * [1]   SE (solicited event)
81*d6b92ffaSHans Petter Selasky 	 * [0]   FL (force loopback)
82*d6b92ffaSHans Petter Selasky 	 */
83*d6b92ffaSHans Petter Selasky 	uint32_t		srcrb_flags;
84*d6b92ffaSHans Petter Selasky 	/*
85*d6b92ffaSHans Petter Selasky 	 * imm is immediate data for send/RDMA write w/ immediate;
86*d6b92ffaSHans Petter Selasky 	 * also invalidation key for send with invalidate; input
87*d6b92ffaSHans Petter Selasky 	 * modifier for WQEs on CCQs.
88*d6b92ffaSHans Petter Selasky 	 */
89*d6b92ffaSHans Petter Selasky 	uint32_t		imm;
90*d6b92ffaSHans Petter Selasky };
91*d6b92ffaSHans Petter Selasky 
92*d6b92ffaSHans Petter Selasky struct mlx4_wqe_datagram_seg {
93*d6b92ffaSHans Petter Selasky 	uint32_t		av[8];
94*d6b92ffaSHans Petter Selasky 	uint32_t		dqpn;
95*d6b92ffaSHans Petter Selasky 	uint32_t		qkey;
96*d6b92ffaSHans Petter Selasky 	uint16_t		vlan;
97*d6b92ffaSHans Petter Selasky 	uint8_t			mac[6];
98*d6b92ffaSHans Petter Selasky };
99*d6b92ffaSHans Petter Selasky 
100*d6b92ffaSHans Petter Selasky struct mlx4_wqe_data_seg {
101*d6b92ffaSHans Petter Selasky 	uint32_t		byte_count;
102*d6b92ffaSHans Petter Selasky 	uint32_t		lkey;
103*d6b92ffaSHans Petter Selasky 	uint64_t		addr;
104*d6b92ffaSHans Petter Selasky };
105*d6b92ffaSHans Petter Selasky 
106*d6b92ffaSHans Petter Selasky struct mlx4_wqe_inline_seg {
107*d6b92ffaSHans Petter Selasky 	uint32_t		byte_count;
108*d6b92ffaSHans Petter Selasky };
109*d6b92ffaSHans Petter Selasky 
110*d6b92ffaSHans Petter Selasky struct mlx4_wqe_srq_next_seg {
111*d6b92ffaSHans Petter Selasky 	uint16_t		reserved1;
112*d6b92ffaSHans Petter Selasky 	uint16_t		next_wqe_index;
113*d6b92ffaSHans Petter Selasky 	uint32_t		reserved2[3];
114*d6b92ffaSHans Petter Selasky };
115*d6b92ffaSHans Petter Selasky 
116*d6b92ffaSHans Petter Selasky struct mlx4_wqe_local_inval_seg {
117*d6b92ffaSHans Petter Selasky 	uint64_t		reserved1;
118*d6b92ffaSHans Petter Selasky 	uint32_t		mem_key;
119*d6b92ffaSHans Petter Selasky 	uint32_t		reserved2;
120*d6b92ffaSHans Petter Selasky 	uint64_t		reserved3[2];
121*d6b92ffaSHans Petter Selasky };
122*d6b92ffaSHans Petter Selasky 
123*d6b92ffaSHans Petter Selasky enum {
124*d6b92ffaSHans Petter Selasky 	MLX4_WQE_MW_REMOTE_READ   = 1 << 29,
125*d6b92ffaSHans Petter Selasky 	MLX4_WQE_MW_REMOTE_WRITE  = 1 << 30,
126*d6b92ffaSHans Petter Selasky 	MLX4_WQE_MW_ATOMIC        = 1 << 31
127*d6b92ffaSHans Petter Selasky };
128*d6b92ffaSHans Petter Selasky 
129*d6b92ffaSHans Petter Selasky struct mlx4_wqe_raddr_seg {
130*d6b92ffaSHans Petter Selasky 	uint64_t		raddr;
131*d6b92ffaSHans Petter Selasky 	uint32_t		rkey;
132*d6b92ffaSHans Petter Selasky 	uint32_t		reserved;
133*d6b92ffaSHans Petter Selasky };
134*d6b92ffaSHans Petter Selasky 
135*d6b92ffaSHans Petter Selasky struct mlx4_wqe_atomic_seg {
136*d6b92ffaSHans Petter Selasky 	uint64_t		swap_add;
137*d6b92ffaSHans Petter Selasky 	uint64_t		compare;
138*d6b92ffaSHans Petter Selasky };
139*d6b92ffaSHans Petter Selasky 
140*d6b92ffaSHans Petter Selasky struct mlx4_wqe_bind_seg {
141*d6b92ffaSHans Petter Selasky 	uint32_t		flags1;
142*d6b92ffaSHans Petter Selasky 	uint32_t		flags2;
143*d6b92ffaSHans Petter Selasky 	uint32_t		new_rkey;
144*d6b92ffaSHans Petter Selasky 	uint32_t		lkey;
145*d6b92ffaSHans Petter Selasky 	uint64_t		addr;
146*d6b92ffaSHans Petter Selasky 	uint64_t		length;
147*d6b92ffaSHans Petter Selasky };
148*d6b92ffaSHans Petter Selasky 
149*d6b92ffaSHans Petter Selasky #endif /* WQE_H */
150