blob: 6888f03c6d61007b6f4d86c1f73b403908e08279 [file] [log] [blame]
Ralph Campbellf9315512010-05-23 21:44:54 -07001/*
Mike Marciniszyn1dd173b2013-06-15 17:07:14 -04002 * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved.
Mike Marciniszyn1fb9fed2012-07-16 17:11:06 +00003 * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
Ralph Campbellf9315512010-05-23 21:44:54 -07004 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 */
34
35#ifndef QIB_VERBS_H
36#define QIB_VERBS_H
37
38#include <linux/types.h>
39#include <linux/spinlock.h>
40#include <linux/kernel.h>
41#include <linux/interrupt.h>
42#include <linux/kref.h>
43#include <linux/workqueue.h>
Mike Marciniszyn85caafe2013-06-04 15:05:37 -040044#include <linux/kthread.h>
Mike Marciniszyn6a826492012-06-27 18:33:12 -040045#include <linux/completion.h>
Ralph Campbellf9315512010-05-23 21:44:54 -070046#include <rdma/ib_pack.h>
47#include <rdma/ib_user_verbs.h>
Dennis Dalessandro2dc05ab2016-01-22 12:44:29 -080048#include <rdma/rdma_vt.h>
Harish Chegondi4bb88e52016-01-22 13:07:36 -080049#include <rdma/rdmavt_cq.h>
Ralph Campbellf9315512010-05-23 21:44:54 -070050
51struct qib_ctxtdata;
52struct qib_pportdata;
53struct qib_devdata;
54struct qib_verbs_txreq;
55
56#define QIB_MAX_RDMA_ATOMIC 16
57#define QIB_GUIDS_PER_PORT 5
Harish Chegondi70696ea2016-02-03 14:20:27 -080058#define QIB_PSN_SHIFT 8
Ralph Campbellf9315512010-05-23 21:44:54 -070059
Ralph Campbellf9315512010-05-23 21:44:54 -070060/*
61 * Increment this value if any changes that break userspace ABI
62 * compatibility are made.
63 */
64#define QIB_UVERBS_ABI_VERSION 2
65
Ralph Campbellf9315512010-05-23 21:44:54 -070066#define IB_SEQ_NAK (3 << 29)
67
68/* AETH NAK opcode values */
69#define IB_RNR_NAK 0x20
70#define IB_NAK_PSN_ERROR 0x60
71#define IB_NAK_INVALID_REQUEST 0x61
72#define IB_NAK_REMOTE_ACCESS_ERROR 0x62
73#define IB_NAK_REMOTE_OPERATIONAL_ERROR 0x63
74#define IB_NAK_INVALID_RD_REQUEST 0x64
75
Ralph Campbellf9315512010-05-23 21:44:54 -070076/* IB Performance Manager status values */
77#define IB_PMA_SAMPLE_STATUS_DONE 0x00
78#define IB_PMA_SAMPLE_STATUS_STARTED 0x01
79#define IB_PMA_SAMPLE_STATUS_RUNNING 0x02
80
81/* Mandatory IB performance counter select values. */
82#define IB_PMA_PORT_XMIT_DATA cpu_to_be16(0x0001)
83#define IB_PMA_PORT_RCV_DATA cpu_to_be16(0x0002)
84#define IB_PMA_PORT_XMIT_PKTS cpu_to_be16(0x0003)
85#define IB_PMA_PORT_RCV_PKTS cpu_to_be16(0x0004)
86#define IB_PMA_PORT_XMIT_WAIT cpu_to_be16(0x0005)
87
88#define QIB_VENDOR_IPG cpu_to_be16(0xFFA0)
89
90#define IB_BTH_REQ_ACK (1 << 31)
91#define IB_BTH_SOLICITED (1 << 23)
92#define IB_BTH_MIG_REQ (1 << 22)
93
94/* XXX Should be defined in ib_verbs.h enum ib_port_cap_flags */
95#define IB_PORT_OTHER_LOCAL_CHANGES_SUP (1 << 26)
96
97#define IB_GRH_VERSION 6
98#define IB_GRH_VERSION_MASK 0xF
99#define IB_GRH_VERSION_SHIFT 28
100#define IB_GRH_TCLASS_MASK 0xFF
101#define IB_GRH_TCLASS_SHIFT 20
102#define IB_GRH_FLOW_MASK 0xFFFFF
103#define IB_GRH_FLOW_SHIFT 0
104#define IB_GRH_NEXT_HDR 0x1B
105
106#define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL)
107
108/* Values for set/get portinfo VLCap OperationalVLs */
109#define IB_VL_VL0 1
110#define IB_VL_VL0_1 2
111#define IB_VL_VL0_3 3
112#define IB_VL_VL0_7 4
113#define IB_VL_VL0_14 5
114
115static inline int qib_num_vls(int vls)
116{
117 switch (vls) {
118 default:
119 case IB_VL_VL0:
120 return 1;
121 case IB_VL_VL0_1:
122 return 2;
123 case IB_VL_VL0_3:
124 return 4;
125 case IB_VL_VL0_7:
126 return 8;
127 case IB_VL_VL0_14:
128 return 15;
129 }
130}
131
132struct ib_reth {
133 __be64 vaddr;
134 __be32 rkey;
135 __be32 length;
Mike Marciniszyn78a58862013-10-24 11:40:37 -0400136} __packed;
Ralph Campbellf9315512010-05-23 21:44:54 -0700137
138struct ib_atomic_eth {
139 __be32 vaddr[2]; /* unaligned so access as 2 32-bit words */
140 __be32 rkey;
141 __be64 swap_data;
142 __be64 compare_data;
Mike Marciniszyn78a58862013-10-24 11:40:37 -0400143} __packed;
Ralph Campbellf9315512010-05-23 21:44:54 -0700144
145struct qib_other_headers {
146 __be32 bth[3];
147 union {
148 struct {
149 __be32 deth[2];
150 __be32 imm_data;
151 } ud;
152 struct {
153 struct ib_reth reth;
154 __be32 imm_data;
155 } rc;
156 struct {
157 __be32 aeth;
158 __be32 atomic_ack_eth[2];
159 } at;
160 __be32 imm_data;
161 __be32 aeth;
162 struct ib_atomic_eth atomic_eth;
163 } u;
Mike Marciniszyn78a58862013-10-24 11:40:37 -0400164} __packed;
Ralph Campbellf9315512010-05-23 21:44:54 -0700165
166/*
167 * Note that UD packets with a GRH header are 8+40+12+8 = 68 bytes
168 * long (72 w/ imm_data). Only the first 56 bytes of the IB header
169 * will be in the eager header buffer. The remaining 12 or 16 bytes
170 * are in the data buffer.
171 */
172struct qib_ib_header {
173 __be16 lrh[4];
174 union {
175 struct {
176 struct ib_grh grh;
177 struct qib_other_headers oth;
178 } l;
179 struct qib_other_headers oth;
180 } u;
Mike Marciniszyn78a58862013-10-24 11:40:37 -0400181} __packed;
Ralph Campbellf9315512010-05-23 21:44:54 -0700182
183struct qib_pio_header {
184 __le32 pbc[2];
185 struct qib_ib_header hdr;
Mike Marciniszyn78a58862013-10-24 11:40:37 -0400186} __packed;
Ralph Campbellf9315512010-05-23 21:44:54 -0700187
188/*
Dennis Dalessandroffc26902016-01-22 12:45:11 -0800189 * qib specific data structure that will be hidden from rvt after the queue pair
190 * is made common.
191 */
Dennis Dalessandroffc26902016-01-22 12:45:11 -0800192struct qib_qp_priv {
193 struct qib_ib_header *s_hdr; /* next packet header to send */
194 struct list_head iowait; /* link for wait PIO buf */
195 atomic_t s_dma_busy;
196 struct qib_verbs_txreq *s_tx;
197 struct work_struct s_work;
198 wait_queue_head_t wait_dma;
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800199 struct rvt_qp *owner;
Ralph Campbellf9315512010-05-23 21:44:54 -0700200};
201
Ralph Campbellf9315512010-05-23 21:44:54 -0700202#define QIB_PSN_CREDIT 16
203
Ralph Campbellf9315512010-05-23 21:44:54 -0700204struct qib_opcode_stats {
205 u64 n_packets; /* number of packets */
206 u64 n_bytes; /* total number of bytes */
207};
208
Mike Marciniszynddb88762013-06-15 17:07:03 -0400209struct qib_opcode_stats_perctx {
210 struct qib_opcode_stats stats[128];
211};
212
Mike Marciniszyn7d7632a2014-03-07 08:40:55 -0500213struct qib_pma_counters {
214 u64 n_unicast_xmit; /* total unicast packets sent */
215 u64 n_unicast_rcv; /* total unicast packets received */
216 u64 n_multicast_xmit; /* total multicast packets sent */
217 u64 n_multicast_rcv; /* total multicast packets received */
218};
219
Ralph Campbellf9315512010-05-23 21:44:54 -0700220struct qib_ibport {
Harish Chegondif24a6d42016-01-22 12:56:02 -0800221 struct rvt_ibport rvp;
Dennis Dalessandro4eadd8f2016-02-14 12:10:55 -0800222 struct rvt_ah *smi_ah;
Ralph Campbellf9315512010-05-23 21:44:54 -0700223 __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */
Mike Marciniszyn7d7632a2014-03-07 08:40:55 -0500224 struct qib_pma_counters __percpu *pmastats;
225 u64 z_unicast_xmit; /* starting count for PMA */
226 u64 z_unicast_rcv; /* starting count for PMA */
227 u64 z_multicast_xmit; /* starting count for PMA */
228 u64 z_multicast_rcv; /* starting count for PMA */
Ralph Campbellf9315512010-05-23 21:44:54 -0700229 u64 z_symbol_error_counter; /* starting count for PMA */
230 u64 z_link_error_recovery_counter; /* starting count for PMA */
231 u64 z_link_downed_counter; /* starting count for PMA */
232 u64 z_port_rcv_errors; /* starting count for PMA */
233 u64 z_port_rcv_remphys_errors; /* starting count for PMA */
234 u64 z_port_xmit_discards; /* starting count for PMA */
235 u64 z_port_xmit_data; /* starting count for PMA */
236 u64 z_port_rcv_data; /* starting count for PMA */
237 u64 z_port_xmit_packets; /* starting count for PMA */
238 u64 z_port_rcv_packets; /* starting count for PMA */
239 u32 z_local_link_integrity_errors; /* starting count for PMA */
240 u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */
241 u32 z_vl15_dropped; /* starting count for PMA */
Ralph Campbellf9315512010-05-23 21:44:54 -0700242 u8 sl_to_vl[16];
Ralph Campbellf9315512010-05-23 21:44:54 -0700243};
244
245struct qib_ibdev {
Dennis Dalessandro2dc05ab2016-01-22 12:44:29 -0800246 struct rvt_dev_info rdi;
Ralph Campbellf9315512010-05-23 21:44:54 -0700247
Ralph Campbellf9315512010-05-23 21:44:54 -0700248 struct list_head piowait; /* list for wait PIO buf */
249 struct list_head dmawait; /* list for wait DMA */
250 struct list_head txwait; /* list for wait qib_verbs_txreq */
251 struct list_head memwait; /* list for wait kernel memory */
252 struct list_head txreq_free;
253 struct timer_list mem_timer;
Ralph Campbellf9315512010-05-23 21:44:54 -0700254 struct qib_pio_header *pio_hdrs;
255 dma_addr_t pio_hdrs_phys;
Mike Marciniszynaf061a62011-09-23 13:16:44 -0400256 u32 qp_rnd; /* random bytes for hash */
Ralph Campbellf9315512010-05-23 21:44:54 -0700257
258 u32 n_piowait;
259 u32 n_txwait;
260
Mike Marciniszynddb88762013-06-15 17:07:03 -0400261#ifdef CONFIG_DEBUG_FS
262 /* per HCA debugfs */
263 struct dentry *qib_ibdev_dbg;
264#endif
Ralph Campbellf9315512010-05-23 21:44:54 -0700265};
266
267struct qib_verbs_counters {
268 u64 symbol_error_counter;
269 u64 link_error_recovery_counter;
270 u64 link_downed_counter;
271 u64 port_rcv_errors;
272 u64 port_rcv_remphys_errors;
273 u64 port_xmit_discards;
274 u64 port_xmit_data;
275 u64 port_rcv_data;
276 u64 port_xmit_packets;
277 u64 port_rcv_packets;
278 u32 local_link_integrity_errors;
279 u32 excessive_buffer_overrun_errors;
280 u32 vl15_dropped;
281};
282
Ralph Campbellf9315512010-05-23 21:44:54 -0700283static inline struct qib_ibdev *to_idev(struct ib_device *ibdev)
284{
Dennis Dalessandro2dc05ab2016-01-22 12:44:29 -0800285 struct rvt_dev_info *rdi;
286
287 rdi = container_of(ibdev, struct rvt_dev_info, ibdev);
288 return container_of(rdi, struct qib_ibdev, rdi);
Ralph Campbellf9315512010-05-23 21:44:54 -0700289}
290
291/*
292 * Send if not busy or waiting for I/O and either
293 * a RC response is pending or we can process send work requests.
294 */
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800295static inline int qib_send_ok(struct rvt_qp *qp)
Ralph Campbellf9315512010-05-23 21:44:54 -0700296{
Harish Chegondi01ba79d2016-01-22 12:56:46 -0800297 return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) &&
298 (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) ||
299 !(qp->s_flags & RVT_S_ANY_WAIT_SEND));
Ralph Campbellf9315512010-05-23 21:44:54 -0700300}
301
Mike Marciniszyn46a80d62016-02-14 12:10:04 -0800302void _qib_schedule_send(struct rvt_qp *qp);
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800303void qib_schedule_send(struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700304
305static inline int qib_pkey_ok(u16 pkey1, u16 pkey2)
306{
307 u16 p1 = pkey1 & 0x7FFF;
308 u16 p2 = pkey2 & 0x7FFF;
309
310 /*
311 * Low 15 bits must be non-zero and match, and
312 * one of the two must be a full member.
313 */
314 return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0);
315}
316
317void qib_bad_pqkey(struct qib_ibport *ibp, __be16 trap_num, u32 key, u32 sl,
318 u32 qp1, u32 qp2, __be16 lid1, __be16 lid2);
Harish Chegondi530a5d82016-02-03 14:20:52 -0800319void qib_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num);
Ralph Campbellf9315512010-05-23 21:44:54 -0700320void qib_sys_guid_chg(struct qib_ibport *ibp);
321void qib_node_desc_chg(struct qib_ibport *ibp);
322int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
Ira Weinya97e2d82015-05-31 17:15:30 -0400323 const struct ib_wc *in_wc, const struct ib_grh *in_grh,
Ira Weiny4cd7c942015-06-06 14:38:31 -0400324 const struct ib_mad_hdr *in, size_t in_mad_size,
325 struct ib_mad_hdr *out, size_t *out_mad_size,
326 u16 *out_mad_pkey_index);
Dennis Dalessandro5196aa92016-01-22 13:07:30 -0800327void qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx);
328void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx);
Ralph Campbellf9315512010-05-23 21:44:54 -0700329
330/*
331 * Compare the lower 24 bits of the two values.
332 * Returns an integer <, ==, or > than zero.
333 */
334static inline int qib_cmp24(u32 a, u32 b)
335{
336 return (((int) a) - ((int) b)) << 8;
337}
338
Ralph Campbellf9315512010-05-23 21:44:54 -0700339int qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords,
340 u64 *rwords, u64 *spkts, u64 *rpkts,
341 u64 *xmit_wait);
342
343int qib_get_counters(struct qib_pportdata *ppd,
344 struct qib_verbs_counters *cntrs);
345
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800346__be32 qib_compute_aeth(struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700347
Harish Chegondi47c7ea62016-01-22 12:56:52 -0800348/*
349 * Functions provided by qib driver for rdmavt to use
350 */
351unsigned qib_free_all_qps(struct rvt_dev_info *rdi);
Harish Chegondi20f333b2016-02-14 12:09:55 -0800352void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, gfp_t gfp);
353void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp);
354void qib_notify_qp_reset(struct rvt_qp *qp);
355int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
356 enum ib_qp_type type, u8 port, gfp_t gfp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700357
Mike Marciniszyn1dd173b2013-06-15 17:07:14 -0400358#ifdef CONFIG_DEBUG_FS
359
360struct qib_qp_iter;
361
362struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev);
363
364int qib_qp_iter_next(struct qib_qp_iter *iter);
365
366void qib_qp_iter_print(struct seq_file *s, struct qib_qp_iter *iter);
367
368#endif
369
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800370void qib_get_credit(struct rvt_qp *qp, u32 aeth);
Ralph Campbellf9315512010-05-23 21:44:54 -0700371
372unsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult);
373
374void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail);
375
376void qib_put_txreq(struct qib_verbs_txreq *tx);
377
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800378int qib_verbs_send(struct rvt_qp *qp, struct qib_ib_header *hdr,
379 u32 hdrwords, struct rvt_sge_state *ss, u32 len);
Ralph Campbellf9315512010-05-23 21:44:54 -0700380
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800381void qib_copy_sge(struct rvt_sge_state *ss, void *data, u32 length,
Ralph Campbellf9315512010-05-23 21:44:54 -0700382 int release);
383
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800384void qib_skip_sge(struct rvt_sge_state *ss, u32 length, int release);
Ralph Campbellf9315512010-05-23 21:44:54 -0700385
386void qib_uc_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800387 int has_grh, void *data, u32 tlen, struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700388
389void qib_rc_rcv(struct qib_ctxtdata *rcd, struct qib_ib_header *hdr,
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800390 int has_grh, void *data, u32 tlen, struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700391
392int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr);
393
Mike Marciniszyn46a80d62016-02-14 12:10:04 -0800394int qib_check_send_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe);
395
Mike Marciniszyn1fb9fed2012-07-16 17:11:06 +0000396struct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid);
397
Ralph Campbellf9315512010-05-23 21:44:54 -0700398void qib_rc_rnr_retry(unsigned long arg);
399
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800400void qib_rc_send_complete(struct rvt_qp *qp, struct qib_ib_header *hdr);
Ralph Campbellf9315512010-05-23 21:44:54 -0700401
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800402void qib_rc_error(struct rvt_qp *qp, enum ib_wc_status err);
Ralph Campbellf9315512010-05-23 21:44:54 -0700403
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800404int qib_post_ud_send(struct rvt_qp *qp, struct ib_send_wr *wr);
Ralph Campbellf9315512010-05-23 21:44:54 -0700405
406void qib_ud_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800407 int has_grh, void *data, u32 tlen, struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700408
Mike Marciniszyn8aac4cc2012-06-27 18:33:19 -0400409void mr_rcu_callback(struct rcu_head *list);
410
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800411int qib_get_rwqe(struct rvt_qp *qp, int wr_id_only);
Ralph Campbellf9315512010-05-23 21:44:54 -0700412
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800413void qib_migrate_qp(struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700414
415int qib_ruc_check_hdr(struct qib_ibport *ibp, struct qib_ib_header *hdr,
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800416 int has_grh, struct rvt_qp *qp, u32 bth0);
Ralph Campbellf9315512010-05-23 21:44:54 -0700417
418u32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr,
419 struct ib_global_route *grh, u32 hwords, u32 nwords);
420
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800421void qib_make_ruc_header(struct rvt_qp *qp, struct qib_other_headers *ohdr,
Ralph Campbellf9315512010-05-23 21:44:54 -0700422 u32 bth0, u32 bth2);
423
Harish Chegondidb3ef0e2016-01-22 13:07:42 -0800424void _qib_do_send(struct work_struct *work);
425
426void qib_do_send(struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700427
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800428void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,
Ralph Campbellf9315512010-05-23 21:44:54 -0700429 enum ib_wc_status status);
430
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800431void qib_send_rc_ack(struct rvt_qp *qp);
Ralph Campbellf9315512010-05-23 21:44:54 -0700432
Mike Marciniszyn747f4d72016-04-12 10:46:10 -0700433int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags);
Ralph Campbellf9315512010-05-23 21:44:54 -0700434
Mike Marciniszyn747f4d72016-04-12 10:46:10 -0700435int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags);
Ralph Campbellf9315512010-05-23 21:44:54 -0700436
Mike Marciniszyn747f4d72016-04-12 10:46:10 -0700437int qib_make_ud_req(struct rvt_qp *qp, unsigned long *flags);
Ralph Campbellf9315512010-05-23 21:44:54 -0700438
439int qib_register_ib_device(struct qib_devdata *);
440
441void qib_unregister_ib_device(struct qib_devdata *);
442
443void qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32);
444
445void qib_ib_piobufavail(struct qib_devdata *);
446
447unsigned qib_get_npkeys(struct qib_devdata *);
448
449unsigned qib_get_pkey(struct qib_ibport *, unsigned);
450
451extern const enum ib_wc_opcode ib_qib_wc_opcode[];
452
453/*
454 * Below HCA-independent IB PhysPortState values, returned
455 * by the f_ibphys_portstate() routine.
456 */
457#define IB_PHYSPORTSTATE_SLEEP 1
458#define IB_PHYSPORTSTATE_POLL 2
459#define IB_PHYSPORTSTATE_DISABLED 3
460#define IB_PHYSPORTSTATE_CFG_TRAIN 4
461#define IB_PHYSPORTSTATE_LINKUP 5
462#define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6
463#define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8
464#define IB_PHYSPORTSTATE_CFG_IDLE 0xB
465#define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC
466#define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE
467#define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF
468#define IB_PHYSPORTSTATE_CFG_ENH 0x10
469#define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13
470
Harish Chegondidb3ef0e2016-01-22 13:07:42 -0800471extern const int ib_rvt_state_ops[];
Ralph Campbellf9315512010-05-23 21:44:54 -0700472
473extern __be64 ib_qib_sys_image_guid; /* in network order */
474
Dennis Dalessandro7c2e11f2016-01-22 12:45:59 -0800475extern unsigned int ib_rvt_lkey_table_size;
Ralph Campbellf9315512010-05-23 21:44:54 -0700476
477extern unsigned int ib_qib_max_cqes;
478
479extern unsigned int ib_qib_max_cqs;
480
481extern unsigned int ib_qib_max_qp_wrs;
482
483extern unsigned int ib_qib_max_qps;
484
485extern unsigned int ib_qib_max_sges;
486
487extern unsigned int ib_qib_max_mcast_grps;
488
489extern unsigned int ib_qib_max_mcast_qp_attached;
490
491extern unsigned int ib_qib_max_srqs;
492
493extern unsigned int ib_qib_max_srq_sges;
494
495extern unsigned int ib_qib_max_srq_wrs;
496
497extern const u32 ib_qib_rnr_table[];
498
Ralph Campbellf9315512010-05-23 21:44:54 -0700499#endif /* QIB_VERBS_H */