Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 1 | /* |
Mike Marciniszyn | 1dd173b | 2013-06-15 17:07:14 -0400 | [diff] [blame] | 2 | * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. |
Mike Marciniszyn | 1fb9fed | 2012-07-16 17:11:06 +0000 | [diff] [blame] | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 4 | * 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 Marciniszyn | 85caafe | 2013-06-04 15:05:37 -0400 | [diff] [blame] | 44 | #include <linux/kthread.h> |
Mike Marciniszyn | 6a82649 | 2012-06-27 18:33:12 -0400 | [diff] [blame] | 45 | #include <linux/completion.h> |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 46 | #include <rdma/ib_pack.h> |
| 47 | #include <rdma/ib_user_verbs.h> |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 48 | #include <rdma/ib_hdrs.h> |
Dennis Dalessandro | 2dc05ab | 2016-01-22 12:44:29 -0800 | [diff] [blame] | 49 | #include <rdma/rdma_vt.h> |
Harish Chegondi | 4bb88e5 | 2016-01-22 13:07:36 -0800 | [diff] [blame] | 50 | #include <rdma/rdmavt_cq.h> |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 51 | |
| 52 | struct qib_ctxtdata; |
| 53 | struct qib_pportdata; |
| 54 | struct qib_devdata; |
| 55 | struct qib_verbs_txreq; |
| 56 | |
| 57 | #define QIB_MAX_RDMA_ATOMIC 16 |
| 58 | #define QIB_GUIDS_PER_PORT 5 |
Harish Chegondi | 70696ea | 2016-02-03 14:20:27 -0800 | [diff] [blame] | 59 | #define QIB_PSN_SHIFT 8 |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 60 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 61 | /* |
| 62 | * Increment this value if any changes that break userspace ABI |
| 63 | * compatibility are made. |
| 64 | */ |
| 65 | #define QIB_UVERBS_ABI_VERSION 2 |
| 66 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 67 | /* IB Performance Manager status values */ |
| 68 | #define IB_PMA_SAMPLE_STATUS_DONE 0x00 |
| 69 | #define IB_PMA_SAMPLE_STATUS_STARTED 0x01 |
| 70 | #define IB_PMA_SAMPLE_STATUS_RUNNING 0x02 |
| 71 | |
| 72 | /* Mandatory IB performance counter select values. */ |
| 73 | #define IB_PMA_PORT_XMIT_DATA cpu_to_be16(0x0001) |
| 74 | #define IB_PMA_PORT_RCV_DATA cpu_to_be16(0x0002) |
| 75 | #define IB_PMA_PORT_XMIT_PKTS cpu_to_be16(0x0003) |
| 76 | #define IB_PMA_PORT_RCV_PKTS cpu_to_be16(0x0004) |
| 77 | #define IB_PMA_PORT_XMIT_WAIT cpu_to_be16(0x0005) |
| 78 | |
| 79 | #define QIB_VENDOR_IPG cpu_to_be16(0xFFA0) |
| 80 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 81 | /* XXX Should be defined in ib_verbs.h enum ib_port_cap_flags */ |
| 82 | #define IB_PORT_OTHER_LOCAL_CHANGES_SUP (1 << 26) |
| 83 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 84 | #define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL) |
| 85 | |
| 86 | /* Values for set/get portinfo VLCap OperationalVLs */ |
| 87 | #define IB_VL_VL0 1 |
| 88 | #define IB_VL_VL0_1 2 |
| 89 | #define IB_VL_VL0_3 3 |
| 90 | #define IB_VL_VL0_7 4 |
| 91 | #define IB_VL_VL0_14 5 |
| 92 | |
| 93 | static inline int qib_num_vls(int vls) |
| 94 | { |
| 95 | switch (vls) { |
| 96 | default: |
| 97 | case IB_VL_VL0: |
| 98 | return 1; |
| 99 | case IB_VL_VL0_1: |
| 100 | return 2; |
| 101 | case IB_VL_VL0_3: |
| 102 | return 4; |
| 103 | case IB_VL_VL0_7: |
| 104 | return 8; |
| 105 | case IB_VL_VL0_14: |
| 106 | return 15; |
| 107 | } |
| 108 | } |
| 109 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 110 | struct qib_pio_header { |
| 111 | __le32 pbc[2]; |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 112 | struct ib_header hdr; |
Mike Marciniszyn | 78a5886 | 2013-10-24 11:40:37 -0400 | [diff] [blame] | 113 | } __packed; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 114 | |
| 115 | /* |
Dennis Dalessandro | ffc2690 | 2016-01-22 12:45:11 -0800 | [diff] [blame] | 116 | * qib specific data structure that will be hidden from rvt after the queue pair |
| 117 | * is made common. |
| 118 | */ |
Dennis Dalessandro | ffc2690 | 2016-01-22 12:45:11 -0800 | [diff] [blame] | 119 | struct qib_qp_priv { |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 120 | struct ib_header *s_hdr; /* next packet header to send */ |
Dennis Dalessandro | ffc2690 | 2016-01-22 12:45:11 -0800 | [diff] [blame] | 121 | struct list_head iowait; /* link for wait PIO buf */ |
| 122 | atomic_t s_dma_busy; |
| 123 | struct qib_verbs_txreq *s_tx; |
| 124 | struct work_struct s_work; |
| 125 | wait_queue_head_t wait_dma; |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 126 | struct rvt_qp *owner; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 127 | }; |
| 128 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 129 | #define QIB_PSN_CREDIT 16 |
| 130 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 131 | struct qib_opcode_stats { |
| 132 | u64 n_packets; /* number of packets */ |
| 133 | u64 n_bytes; /* total number of bytes */ |
| 134 | }; |
| 135 | |
Mike Marciniszyn | ddb8876 | 2013-06-15 17:07:03 -0400 | [diff] [blame] | 136 | struct qib_opcode_stats_perctx { |
| 137 | struct qib_opcode_stats stats[128]; |
| 138 | }; |
| 139 | |
Mike Marciniszyn | 7d7632a | 2014-03-07 08:40:55 -0500 | [diff] [blame] | 140 | struct qib_pma_counters { |
| 141 | u64 n_unicast_xmit; /* total unicast packets sent */ |
| 142 | u64 n_unicast_rcv; /* total unicast packets received */ |
| 143 | u64 n_multicast_xmit; /* total multicast packets sent */ |
| 144 | u64 n_multicast_rcv; /* total multicast packets received */ |
| 145 | }; |
| 146 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 147 | struct qib_ibport { |
Harish Chegondi | f24a6d4 | 2016-01-22 12:56:02 -0800 | [diff] [blame] | 148 | struct rvt_ibport rvp; |
Dennis Dalessandro | 4eadd8f | 2016-02-14 12:10:55 -0800 | [diff] [blame] | 149 | struct rvt_ah *smi_ah; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 150 | __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */ |
Mike Marciniszyn | 7d7632a | 2014-03-07 08:40:55 -0500 | [diff] [blame] | 151 | struct qib_pma_counters __percpu *pmastats; |
| 152 | u64 z_unicast_xmit; /* starting count for PMA */ |
| 153 | u64 z_unicast_rcv; /* starting count for PMA */ |
| 154 | u64 z_multicast_xmit; /* starting count for PMA */ |
| 155 | u64 z_multicast_rcv; /* starting count for PMA */ |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 156 | u64 z_symbol_error_counter; /* starting count for PMA */ |
| 157 | u64 z_link_error_recovery_counter; /* starting count for PMA */ |
| 158 | u64 z_link_downed_counter; /* starting count for PMA */ |
| 159 | u64 z_port_rcv_errors; /* starting count for PMA */ |
| 160 | u64 z_port_rcv_remphys_errors; /* starting count for PMA */ |
| 161 | u64 z_port_xmit_discards; /* starting count for PMA */ |
| 162 | u64 z_port_xmit_data; /* starting count for PMA */ |
| 163 | u64 z_port_rcv_data; /* starting count for PMA */ |
| 164 | u64 z_port_xmit_packets; /* starting count for PMA */ |
| 165 | u64 z_port_rcv_packets; /* starting count for PMA */ |
| 166 | u32 z_local_link_integrity_errors; /* starting count for PMA */ |
| 167 | u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */ |
| 168 | u32 z_vl15_dropped; /* starting count for PMA */ |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 169 | u8 sl_to_vl[16]; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 170 | }; |
| 171 | |
| 172 | struct qib_ibdev { |
Dennis Dalessandro | 2dc05ab | 2016-01-22 12:44:29 -0800 | [diff] [blame] | 173 | struct rvt_dev_info rdi; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 174 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 175 | struct list_head piowait; /* list for wait PIO buf */ |
| 176 | struct list_head dmawait; /* list for wait DMA */ |
| 177 | struct list_head txwait; /* list for wait qib_verbs_txreq */ |
| 178 | struct list_head memwait; /* list for wait kernel memory */ |
| 179 | struct list_head txreq_free; |
| 180 | struct timer_list mem_timer; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 181 | struct qib_pio_header *pio_hdrs; |
| 182 | dma_addr_t pio_hdrs_phys; |
Mike Marciniszyn | af061a6 | 2011-09-23 13:16:44 -0400 | [diff] [blame] | 183 | u32 qp_rnd; /* random bytes for hash */ |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 184 | |
| 185 | u32 n_piowait; |
| 186 | u32 n_txwait; |
| 187 | |
Mike Marciniszyn | ddb8876 | 2013-06-15 17:07:03 -0400 | [diff] [blame] | 188 | #ifdef CONFIG_DEBUG_FS |
| 189 | /* per HCA debugfs */ |
| 190 | struct dentry *qib_ibdev_dbg; |
| 191 | #endif |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | struct qib_verbs_counters { |
| 195 | u64 symbol_error_counter; |
| 196 | u64 link_error_recovery_counter; |
| 197 | u64 link_downed_counter; |
| 198 | u64 port_rcv_errors; |
| 199 | u64 port_rcv_remphys_errors; |
| 200 | u64 port_xmit_discards; |
| 201 | u64 port_xmit_data; |
| 202 | u64 port_rcv_data; |
| 203 | u64 port_xmit_packets; |
| 204 | u64 port_rcv_packets; |
| 205 | u32 local_link_integrity_errors; |
| 206 | u32 excessive_buffer_overrun_errors; |
| 207 | u32 vl15_dropped; |
| 208 | }; |
| 209 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 210 | static inline struct qib_ibdev *to_idev(struct ib_device *ibdev) |
| 211 | { |
Dennis Dalessandro | 2dc05ab | 2016-01-22 12:44:29 -0800 | [diff] [blame] | 212 | struct rvt_dev_info *rdi; |
| 213 | |
| 214 | rdi = container_of(ibdev, struct rvt_dev_info, ibdev); |
| 215 | return container_of(rdi, struct qib_ibdev, rdi); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | /* |
| 219 | * Send if not busy or waiting for I/O and either |
| 220 | * a RC response is pending or we can process send work requests. |
| 221 | */ |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 222 | static inline int qib_send_ok(struct rvt_qp *qp) |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 223 | { |
Harish Chegondi | 01ba79d | 2016-01-22 12:56:46 -0800 | [diff] [blame] | 224 | return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && |
| 225 | (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) || |
| 226 | !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Mike Marciniszyn | 46a80d6 | 2016-02-14 12:10:04 -0800 | [diff] [blame] | 229 | void _qib_schedule_send(struct rvt_qp *qp); |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 230 | void qib_schedule_send(struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 231 | |
| 232 | static inline int qib_pkey_ok(u16 pkey1, u16 pkey2) |
| 233 | { |
| 234 | u16 p1 = pkey1 & 0x7FFF; |
| 235 | u16 p2 = pkey2 & 0x7FFF; |
| 236 | |
| 237 | /* |
| 238 | * Low 15 bits must be non-zero and match, and |
| 239 | * one of the two must be a full member. |
| 240 | */ |
| 241 | return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0); |
| 242 | } |
| 243 | |
| 244 | void qib_bad_pqkey(struct qib_ibport *ibp, __be16 trap_num, u32 key, u32 sl, |
| 245 | u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); |
Harish Chegondi | 530a5d8 | 2016-02-03 14:20:52 -0800 | [diff] [blame] | 246 | void qib_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 247 | void qib_sys_guid_chg(struct qib_ibport *ibp); |
| 248 | void qib_node_desc_chg(struct qib_ibport *ibp); |
| 249 | int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, |
Ira Weiny | a97e2d8 | 2015-05-31 17:15:30 -0400 | [diff] [blame] | 250 | const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
Ira Weiny | 4cd7c94 | 2015-06-06 14:38:31 -0400 | [diff] [blame] | 251 | const struct ib_mad_hdr *in, size_t in_mad_size, |
| 252 | struct ib_mad_hdr *out, size_t *out_mad_size, |
| 253 | u16 *out_mad_pkey_index); |
Dennis Dalessandro | 5196aa9 | 2016-01-22 13:07:30 -0800 | [diff] [blame] | 254 | void qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx); |
| 255 | void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 256 | |
| 257 | /* |
| 258 | * Compare the lower 24 bits of the two values. |
| 259 | * Returns an integer <, ==, or > than zero. |
| 260 | */ |
| 261 | static inline int qib_cmp24(u32 a, u32 b) |
| 262 | { |
| 263 | return (((int) a) - ((int) b)) << 8; |
| 264 | } |
| 265 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 266 | int qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords, |
| 267 | u64 *rwords, u64 *spkts, u64 *rpkts, |
| 268 | u64 *xmit_wait); |
| 269 | |
| 270 | int qib_get_counters(struct qib_pportdata *ppd, |
| 271 | struct qib_verbs_counters *cntrs); |
| 272 | |
Harish Chegondi | 47c7ea6 | 2016-01-22 12:56:52 -0800 | [diff] [blame] | 273 | /* |
| 274 | * Functions provided by qib driver for rdmavt to use |
| 275 | */ |
| 276 | unsigned qib_free_all_qps(struct rvt_dev_info *rdi); |
Harish Chegondi | 20f333b | 2016-02-14 12:09:55 -0800 | [diff] [blame] | 277 | void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, gfp_t gfp); |
| 278 | void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); |
| 279 | void qib_notify_qp_reset(struct rvt_qp *qp); |
| 280 | int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, |
| 281 | enum ib_qp_type type, u8 port, gfp_t gfp); |
Venkata Sandeep Dhanalakota | b4238e7 | 2017-02-08 05:27:25 -0800 | [diff] [blame] | 282 | void qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait); |
Mike Marciniszyn | 1dd173b | 2013-06-15 17:07:14 -0400 | [diff] [blame] | 283 | #ifdef CONFIG_DEBUG_FS |
| 284 | |
| 285 | struct qib_qp_iter; |
| 286 | |
| 287 | struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev); |
| 288 | |
| 289 | int qib_qp_iter_next(struct qib_qp_iter *iter); |
| 290 | |
| 291 | void qib_qp_iter_print(struct seq_file *s, struct qib_qp_iter *iter); |
| 292 | |
| 293 | #endif |
| 294 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 295 | unsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult); |
| 296 | |
| 297 | void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail); |
| 298 | |
| 299 | void qib_put_txreq(struct qib_verbs_txreq *tx); |
| 300 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 301 | int qib_verbs_send(struct rvt_qp *qp, struct ib_header *hdr, |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 302 | u32 hdrwords, struct rvt_sge_state *ss, u32 len); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 303 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 304 | void qib_copy_sge(struct rvt_sge_state *ss, void *data, u32 length, |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 305 | int release); |
| 306 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 307 | void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 308 | int has_grh, void *data, u32 tlen, struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 309 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 310 | void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 311 | int has_grh, void *data, u32 tlen, struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 312 | |
Dasaratharaman Chandramouli | 9089885 | 2017-04-29 14:41:18 -0400 | [diff] [blame] | 313 | int qib_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 314 | |
Mike Marciniszyn | 46a80d6 | 2016-02-14 12:10:04 -0800 | [diff] [blame] | 315 | int qib_check_send_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe); |
| 316 | |
Mike Marciniszyn | 1fb9fed | 2012-07-16 17:11:06 +0000 | [diff] [blame] | 317 | struct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid); |
| 318 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 319 | void qib_rc_rnr_retry(unsigned long arg); |
| 320 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 321 | void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 322 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 323 | int qib_post_ud_send(struct rvt_qp *qp, struct ib_send_wr *wr); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 324 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 325 | void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 326 | int has_grh, void *data, u32 tlen, struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 327 | |
Mike Marciniszyn | 8aac4cc | 2012-06-27 18:33:19 -0400 | [diff] [blame] | 328 | void mr_rcu_callback(struct rcu_head *list); |
| 329 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 330 | int qib_get_rwqe(struct rvt_qp *qp, int wr_id_only); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 331 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 332 | void qib_migrate_qp(struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 333 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 334 | int qib_ruc_check_hdr(struct qib_ibport *ibp, struct ib_header *hdr, |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 335 | int has_grh, struct rvt_qp *qp, u32 bth0); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 336 | |
| 337 | u32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr, |
Dasaratharaman Chandramouli | d8966fc | 2017-04-29 14:41:28 -0400 | [diff] [blame^] | 338 | const struct ib_global_route *grh, u32 hwords, u32 nwords); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 339 | |
Mike Marciniszyn | 261a435 | 2016-09-06 04:35:05 -0700 | [diff] [blame] | 340 | void qib_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr, |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 341 | u32 bth0, u32 bth2); |
| 342 | |
Harish Chegondi | db3ef0e | 2016-01-22 13:07:42 -0800 | [diff] [blame] | 343 | void _qib_do_send(struct work_struct *work); |
| 344 | |
| 345 | void qib_do_send(struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 346 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 347 | void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 348 | enum ib_wc_status status); |
| 349 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 350 | void qib_send_rc_ack(struct rvt_qp *qp); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 351 | |
Mike Marciniszyn | 747f4d7 | 2016-04-12 10:46:10 -0700 | [diff] [blame] | 352 | int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 353 | |
Mike Marciniszyn | 747f4d7 | 2016-04-12 10:46:10 -0700 | [diff] [blame] | 354 | int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 355 | |
Mike Marciniszyn | 747f4d7 | 2016-04-12 10:46:10 -0700 | [diff] [blame] | 356 | int qib_make_ud_req(struct rvt_qp *qp, unsigned long *flags); |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 357 | |
| 358 | int qib_register_ib_device(struct qib_devdata *); |
| 359 | |
| 360 | void qib_unregister_ib_device(struct qib_devdata *); |
| 361 | |
| 362 | void qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32); |
| 363 | |
| 364 | void qib_ib_piobufavail(struct qib_devdata *); |
| 365 | |
| 366 | unsigned qib_get_npkeys(struct qib_devdata *); |
| 367 | |
| 368 | unsigned qib_get_pkey(struct qib_ibport *, unsigned); |
| 369 | |
| 370 | extern const enum ib_wc_opcode ib_qib_wc_opcode[]; |
| 371 | |
| 372 | /* |
| 373 | * Below HCA-independent IB PhysPortState values, returned |
| 374 | * by the f_ibphys_portstate() routine. |
| 375 | */ |
| 376 | #define IB_PHYSPORTSTATE_SLEEP 1 |
| 377 | #define IB_PHYSPORTSTATE_POLL 2 |
| 378 | #define IB_PHYSPORTSTATE_DISABLED 3 |
| 379 | #define IB_PHYSPORTSTATE_CFG_TRAIN 4 |
| 380 | #define IB_PHYSPORTSTATE_LINKUP 5 |
| 381 | #define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6 |
| 382 | #define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8 |
| 383 | #define IB_PHYSPORTSTATE_CFG_IDLE 0xB |
| 384 | #define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC |
| 385 | #define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE |
| 386 | #define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF |
| 387 | #define IB_PHYSPORTSTATE_CFG_ENH 0x10 |
| 388 | #define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13 |
| 389 | |
Harish Chegondi | db3ef0e | 2016-01-22 13:07:42 -0800 | [diff] [blame] | 390 | extern const int ib_rvt_state_ops[]; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 391 | |
| 392 | extern __be64 ib_qib_sys_image_guid; /* in network order */ |
| 393 | |
Dennis Dalessandro | 7c2e11f | 2016-01-22 12:45:59 -0800 | [diff] [blame] | 394 | extern unsigned int ib_rvt_lkey_table_size; |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 395 | |
| 396 | extern unsigned int ib_qib_max_cqes; |
| 397 | |
| 398 | extern unsigned int ib_qib_max_cqs; |
| 399 | |
| 400 | extern unsigned int ib_qib_max_qp_wrs; |
| 401 | |
| 402 | extern unsigned int ib_qib_max_qps; |
| 403 | |
| 404 | extern unsigned int ib_qib_max_sges; |
| 405 | |
| 406 | extern unsigned int ib_qib_max_mcast_grps; |
| 407 | |
| 408 | extern unsigned int ib_qib_max_mcast_qp_attached; |
| 409 | |
| 410 | extern unsigned int ib_qib_max_srqs; |
| 411 | |
| 412 | extern unsigned int ib_qib_max_srq_sges; |
| 413 | |
| 414 | extern unsigned int ib_qib_max_srq_wrs; |
| 415 | |
| 416 | extern const u32 ib_qib_rnr_table[]; |
| 417 | |
Mike Marciniszyn | 9ec4faa | 2016-07-01 16:02:18 -0700 | [diff] [blame] | 418 | extern const struct rvt_operation_params qib_post_parms[]; |
| 419 | |
Ralph Campbell | f931551 | 2010-05-23 21:44:54 -0700 | [diff] [blame] | 420 | #endif /* QIB_VERBS_H */ |