1f931551bSRalph Campbell /* 25da0fc9dSDennis Dalessandro * Copyright (c) 2012 - 2018 Intel Corporation. All rights reserved. 31fb9fed6SMike Marciniszyn * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. 4f931551bSRalph Campbell * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 5f931551bSRalph Campbell * 6f931551bSRalph Campbell * This software is available to you under a choice of one of two 7f931551bSRalph Campbell * licenses. You may choose to be licensed under the terms of the GNU 8f931551bSRalph Campbell * General Public License (GPL) Version 2, available from the file 9f931551bSRalph Campbell * COPYING in the main directory of this source tree, or the 10f931551bSRalph Campbell * OpenIB.org BSD license below: 11f931551bSRalph Campbell * 12f931551bSRalph Campbell * Redistribution and use in source and binary forms, with or 13f931551bSRalph Campbell * without modification, are permitted provided that the following 14f931551bSRalph Campbell * conditions are met: 15f931551bSRalph Campbell * 16f931551bSRalph Campbell * - Redistributions of source code must retain the above 17f931551bSRalph Campbell * copyright notice, this list of conditions and the following 18f931551bSRalph Campbell * disclaimer. 19f931551bSRalph Campbell * 20f931551bSRalph Campbell * - Redistributions in binary form must reproduce the above 21f931551bSRalph Campbell * copyright notice, this list of conditions and the following 22f931551bSRalph Campbell * disclaimer in the documentation and/or other materials 23f931551bSRalph Campbell * provided with the distribution. 24f931551bSRalph Campbell * 25f931551bSRalph Campbell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26f931551bSRalph Campbell * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27f931551bSRalph Campbell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28f931551bSRalph Campbell * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29f931551bSRalph Campbell * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30f931551bSRalph Campbell * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31f931551bSRalph Campbell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32f931551bSRalph Campbell * SOFTWARE. 33f931551bSRalph Campbell */ 34f931551bSRalph Campbell 35f931551bSRalph Campbell #ifndef QIB_VERBS_H 36f931551bSRalph Campbell #define QIB_VERBS_H 37f931551bSRalph Campbell 38f931551bSRalph Campbell #include <linux/types.h> 39f931551bSRalph Campbell #include <linux/spinlock.h> 40f931551bSRalph Campbell #include <linux/kernel.h> 41f931551bSRalph Campbell #include <linux/interrupt.h> 42f931551bSRalph Campbell #include <linux/kref.h> 43f931551bSRalph Campbell #include <linux/workqueue.h> 4485caafe3SMike Marciniszyn #include <linux/kthread.h> 456a82649fSMike Marciniszyn #include <linux/completion.h> 46f931551bSRalph Campbell #include <rdma/ib_pack.h> 47f931551bSRalph Campbell #include <rdma/ib_user_verbs.h> 48261a4351SMike Marciniszyn #include <rdma/ib_hdrs.h> 49715ab1a8SMike Marciniszyn #include <rdma/rdmavt_qp.h> 504bb88e5fSHarish Chegondi #include <rdma/rdmavt_cq.h> 51f931551bSRalph Campbell 52f931551bSRalph Campbell struct qib_ctxtdata; 53f931551bSRalph Campbell struct qib_pportdata; 54f931551bSRalph Campbell struct qib_devdata; 55f931551bSRalph Campbell struct qib_verbs_txreq; 56f931551bSRalph Campbell 57f931551bSRalph Campbell #define QIB_MAX_RDMA_ATOMIC 16 58f931551bSRalph Campbell #define QIB_GUIDS_PER_PORT 5 5970696ea7SHarish Chegondi #define QIB_PSN_SHIFT 8 60f931551bSRalph Campbell 61f931551bSRalph Campbell /* 62f931551bSRalph Campbell * Increment this value if any changes that break userspace ABI 63f931551bSRalph Campbell * compatibility are made. 64f931551bSRalph Campbell */ 65f931551bSRalph Campbell #define QIB_UVERBS_ABI_VERSION 2 66f931551bSRalph Campbell 67f931551bSRalph Campbell /* IB Performance Manager status values */ 68f931551bSRalph Campbell #define IB_PMA_SAMPLE_STATUS_DONE 0x00 69f931551bSRalph Campbell #define IB_PMA_SAMPLE_STATUS_STARTED 0x01 70f931551bSRalph Campbell #define IB_PMA_SAMPLE_STATUS_RUNNING 0x02 71f931551bSRalph Campbell 72f931551bSRalph Campbell /* Mandatory IB performance counter select values. */ 73f931551bSRalph Campbell #define IB_PMA_PORT_XMIT_DATA cpu_to_be16(0x0001) 74f931551bSRalph Campbell #define IB_PMA_PORT_RCV_DATA cpu_to_be16(0x0002) 75f931551bSRalph Campbell #define IB_PMA_PORT_XMIT_PKTS cpu_to_be16(0x0003) 76f931551bSRalph Campbell #define IB_PMA_PORT_RCV_PKTS cpu_to_be16(0x0004) 77f931551bSRalph Campbell #define IB_PMA_PORT_XMIT_WAIT cpu_to_be16(0x0005) 78f931551bSRalph Campbell 79f931551bSRalph Campbell #define QIB_VENDOR_IPG cpu_to_be16(0xFFA0) 80f931551bSRalph Campbell 81f931551bSRalph Campbell #define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL) 82f931551bSRalph Campbell 83f931551bSRalph Campbell /* Values for set/get portinfo VLCap OperationalVLs */ 84f931551bSRalph Campbell #define IB_VL_VL0 1 85f931551bSRalph Campbell #define IB_VL_VL0_1 2 86f931551bSRalph Campbell #define IB_VL_VL0_3 3 87f931551bSRalph Campbell #define IB_VL_VL0_7 4 88f931551bSRalph Campbell #define IB_VL_VL0_14 5 89f931551bSRalph Campbell 90f931551bSRalph Campbell static inline int qib_num_vls(int vls) 91f931551bSRalph Campbell { 92f931551bSRalph Campbell switch (vls) { 93f931551bSRalph Campbell default: 94f931551bSRalph Campbell case IB_VL_VL0: 95f931551bSRalph Campbell return 1; 96f931551bSRalph Campbell case IB_VL_VL0_1: 97f931551bSRalph Campbell return 2; 98f931551bSRalph Campbell case IB_VL_VL0_3: 99f931551bSRalph Campbell return 4; 100f931551bSRalph Campbell case IB_VL_VL0_7: 101f931551bSRalph Campbell return 8; 102f931551bSRalph Campbell case IB_VL_VL0_14: 103f931551bSRalph Campbell return 15; 104f931551bSRalph Campbell } 105f931551bSRalph Campbell } 106f931551bSRalph Campbell 107f931551bSRalph Campbell struct qib_pio_header { 108f931551bSRalph Campbell __le32 pbc[2]; 109261a4351SMike Marciniszyn struct ib_header hdr; 11078a58864SMike Marciniszyn } __packed; 111f931551bSRalph Campbell 112f931551bSRalph Campbell /* 113ffc26907SDennis Dalessandro * qib specific data structure that will be hidden from rvt after the queue pair 114ffc26907SDennis Dalessandro * is made common. 115ffc26907SDennis Dalessandro */ 116ffc26907SDennis Dalessandro struct qib_qp_priv { 117261a4351SMike Marciniszyn struct ib_header *s_hdr; /* next packet header to send */ 118ffc26907SDennis Dalessandro struct list_head iowait; /* link for wait PIO buf */ 119ffc26907SDennis Dalessandro atomic_t s_dma_busy; 120ffc26907SDennis Dalessandro struct qib_verbs_txreq *s_tx; 121ffc26907SDennis Dalessandro struct work_struct s_work; 122ffc26907SDennis Dalessandro wait_queue_head_t wait_dma; 1237c2e11feSDennis Dalessandro struct rvt_qp *owner; 124f931551bSRalph Campbell }; 125f931551bSRalph Campbell 126f931551bSRalph Campbell #define QIB_PSN_CREDIT 16 127f931551bSRalph Campbell 128f931551bSRalph Campbell struct qib_opcode_stats { 129f931551bSRalph Campbell u64 n_packets; /* number of packets */ 130f931551bSRalph Campbell u64 n_bytes; /* total number of bytes */ 131f931551bSRalph Campbell }; 132f931551bSRalph Campbell 133ddb88765SMike Marciniszyn struct qib_opcode_stats_perctx { 134ddb88765SMike Marciniszyn struct qib_opcode_stats stats[128]; 135ddb88765SMike Marciniszyn }; 136ddb88765SMike Marciniszyn 1377d7632adSMike Marciniszyn struct qib_pma_counters { 1387d7632adSMike Marciniszyn u64 n_unicast_xmit; /* total unicast packets sent */ 1397d7632adSMike Marciniszyn u64 n_unicast_rcv; /* total unicast packets received */ 1407d7632adSMike Marciniszyn u64 n_multicast_xmit; /* total multicast packets sent */ 1417d7632adSMike Marciniszyn u64 n_multicast_rcv; /* total multicast packets received */ 1427d7632adSMike Marciniszyn }; 1437d7632adSMike Marciniszyn 144f931551bSRalph Campbell struct qib_ibport { 145f24a6d48SHarish Chegondi struct rvt_ibport rvp; 1464eadd8ffSDennis Dalessandro struct rvt_ah *smi_ah; 147f931551bSRalph Campbell __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */ 1487d7632adSMike Marciniszyn struct qib_pma_counters __percpu *pmastats; 1497d7632adSMike Marciniszyn u64 z_unicast_xmit; /* starting count for PMA */ 1507d7632adSMike Marciniszyn u64 z_unicast_rcv; /* starting count for PMA */ 1517d7632adSMike Marciniszyn u64 z_multicast_xmit; /* starting count for PMA */ 1527d7632adSMike Marciniszyn u64 z_multicast_rcv; /* starting count for PMA */ 153f931551bSRalph Campbell u64 z_symbol_error_counter; /* starting count for PMA */ 154f931551bSRalph Campbell u64 z_link_error_recovery_counter; /* starting count for PMA */ 155f931551bSRalph Campbell u64 z_link_downed_counter; /* starting count for PMA */ 156f931551bSRalph Campbell u64 z_port_rcv_errors; /* starting count for PMA */ 157f931551bSRalph Campbell u64 z_port_rcv_remphys_errors; /* starting count for PMA */ 158f931551bSRalph Campbell u64 z_port_xmit_discards; /* starting count for PMA */ 159f931551bSRalph Campbell u64 z_port_xmit_data; /* starting count for PMA */ 160f931551bSRalph Campbell u64 z_port_rcv_data; /* starting count for PMA */ 161f931551bSRalph Campbell u64 z_port_xmit_packets; /* starting count for PMA */ 162f931551bSRalph Campbell u64 z_port_rcv_packets; /* starting count for PMA */ 163f931551bSRalph Campbell u32 z_local_link_integrity_errors; /* starting count for PMA */ 164f931551bSRalph Campbell u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */ 165f931551bSRalph Campbell u32 z_vl15_dropped; /* starting count for PMA */ 166f931551bSRalph Campbell u8 sl_to_vl[16]; 167f931551bSRalph Campbell }; 168f931551bSRalph Campbell 169f931551bSRalph Campbell struct qib_ibdev { 1702dc05ab5SDennis Dalessandro struct rvt_dev_info rdi; 171f931551bSRalph Campbell 172f931551bSRalph Campbell struct list_head piowait; /* list for wait PIO buf */ 173f931551bSRalph Campbell struct list_head dmawait; /* list for wait DMA */ 174f931551bSRalph Campbell struct list_head txwait; /* list for wait qib_verbs_txreq */ 175f931551bSRalph Campbell struct list_head memwait; /* list for wait kernel memory */ 176f931551bSRalph Campbell struct list_head txreq_free; 177f931551bSRalph Campbell struct timer_list mem_timer; 178f931551bSRalph Campbell struct qib_pio_header *pio_hdrs; 179f931551bSRalph Campbell dma_addr_t pio_hdrs_phys; 180af061a64SMike Marciniszyn u32 qp_rnd; /* random bytes for hash */ 181f931551bSRalph Campbell 182f931551bSRalph Campbell u32 n_piowait; 183f931551bSRalph Campbell u32 n_txwait; 184f931551bSRalph Campbell 185ddb88765SMike Marciniszyn #ifdef CONFIG_DEBUG_FS 186ddb88765SMike Marciniszyn /* per HCA debugfs */ 187ddb88765SMike Marciniszyn struct dentry *qib_ibdev_dbg; 188ddb88765SMike Marciniszyn #endif 189f931551bSRalph Campbell }; 190f931551bSRalph Campbell 191f931551bSRalph Campbell struct qib_verbs_counters { 192f931551bSRalph Campbell u64 symbol_error_counter; 193f931551bSRalph Campbell u64 link_error_recovery_counter; 194f931551bSRalph Campbell u64 link_downed_counter; 195f931551bSRalph Campbell u64 port_rcv_errors; 196f931551bSRalph Campbell u64 port_rcv_remphys_errors; 197f931551bSRalph Campbell u64 port_xmit_discards; 198f931551bSRalph Campbell u64 port_xmit_data; 199f931551bSRalph Campbell u64 port_rcv_data; 200f931551bSRalph Campbell u64 port_xmit_packets; 201f931551bSRalph Campbell u64 port_rcv_packets; 202f931551bSRalph Campbell u32 local_link_integrity_errors; 203f931551bSRalph Campbell u32 excessive_buffer_overrun_errors; 204f931551bSRalph Campbell u32 vl15_dropped; 205f931551bSRalph Campbell }; 206f931551bSRalph Campbell 207f931551bSRalph Campbell static inline struct qib_ibdev *to_idev(struct ib_device *ibdev) 208f931551bSRalph Campbell { 2092dc05ab5SDennis Dalessandro struct rvt_dev_info *rdi; 2102dc05ab5SDennis Dalessandro 2112dc05ab5SDennis Dalessandro rdi = container_of(ibdev, struct rvt_dev_info, ibdev); 2122dc05ab5SDennis Dalessandro return container_of(rdi, struct qib_ibdev, rdi); 213f931551bSRalph Campbell } 214f931551bSRalph Campbell 215f931551bSRalph Campbell /* 216f931551bSRalph Campbell * Send if not busy or waiting for I/O and either 217f931551bSRalph Campbell * a RC response is pending or we can process send work requests. 218f931551bSRalph Campbell */ 2197c2e11feSDennis Dalessandro static inline int qib_send_ok(struct rvt_qp *qp) 220f931551bSRalph Campbell { 22101ba79d4SHarish Chegondi return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && 22201ba79d4SHarish Chegondi (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) || 22301ba79d4SHarish Chegondi !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); 224f931551bSRalph Campbell } 225f931551bSRalph Campbell 2265da0fc9dSDennis Dalessandro bool _qib_schedule_send(struct rvt_qp *qp); 2275da0fc9dSDennis Dalessandro bool qib_schedule_send(struct rvt_qp *qp); 228f931551bSRalph Campbell 229f931551bSRalph Campbell static inline int qib_pkey_ok(u16 pkey1, u16 pkey2) 230f931551bSRalph Campbell { 231f931551bSRalph Campbell u16 p1 = pkey1 & 0x7FFF; 232f931551bSRalph Campbell u16 p2 = pkey2 & 0x7FFF; 233f931551bSRalph Campbell 234f931551bSRalph Campbell /* 235f931551bSRalph Campbell * Low 15 bits must be non-zero and match, and 236f931551bSRalph Campbell * one of the two must be a full member. 237f931551bSRalph Campbell */ 238f931551bSRalph Campbell return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0); 239f931551bSRalph Campbell } 240f931551bSRalph Campbell 24113d84914SDennis Dalessandro void qib_bad_pkey(struct qib_ibport *ibp, u32 key, u32 sl, 242f931551bSRalph Campbell u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); 243530a5d8eSHarish Chegondi void qib_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num); 244f931551bSRalph Campbell void qib_sys_guid_chg(struct qib_ibport *ibp); 245f931551bSRalph Campbell void qib_node_desc_chg(struct qib_ibport *ibp); 246f931551bSRalph Campbell int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 247a97e2d86SIra Weiny const struct ib_wc *in_wc, const struct ib_grh *in_grh, 2484cd7c947SIra Weiny const struct ib_mad_hdr *in, size_t in_mad_size, 2494cd7c947SIra Weiny struct ib_mad_hdr *out, size_t *out_mad_size, 2504cd7c947SIra Weiny u16 *out_mad_pkey_index); 2515196aa96SDennis Dalessandro void qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx); 2525196aa96SDennis Dalessandro void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx); 253f931551bSRalph Campbell 254f931551bSRalph Campbell /* 255f931551bSRalph Campbell * Compare the lower 24 bits of the two values. 256f931551bSRalph Campbell * Returns an integer <, ==, or > than zero. 257f931551bSRalph Campbell */ 258f931551bSRalph Campbell static inline int qib_cmp24(u32 a, u32 b) 259f931551bSRalph Campbell { 260f931551bSRalph Campbell return (((int) a) - ((int) b)) << 8; 261f931551bSRalph Campbell } 262f931551bSRalph Campbell 263f931551bSRalph Campbell int qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords, 264f931551bSRalph Campbell u64 *rwords, u64 *spkts, u64 *rpkts, 265f931551bSRalph Campbell u64 *xmit_wait); 266f931551bSRalph Campbell 267f931551bSRalph Campbell int qib_get_counters(struct qib_pportdata *ppd, 268f931551bSRalph Campbell struct qib_verbs_counters *cntrs); 269f931551bSRalph Campbell 27047c7ea6dSHarish Chegondi /* 27147c7ea6dSHarish Chegondi * Functions provided by qib driver for rdmavt to use 27247c7ea6dSHarish Chegondi */ 27347c7ea6dSHarish Chegondi unsigned qib_free_all_qps(struct rvt_dev_info *rdi); 2740f4d027cSLeon Romanovsky void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp); 27520f333b6SHarish Chegondi void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); 27620f333b6SHarish Chegondi void qib_notify_qp_reset(struct rvt_qp *qp); 27720f333b6SHarish Chegondi int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 2780f4d027cSLeon Romanovsky enum ib_qp_type type, u8 port); 279b4238e70SVenkata Sandeep Dhanalakota void qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait); 2801dd173b0SMike Marciniszyn #ifdef CONFIG_DEBUG_FS 2811dd173b0SMike Marciniszyn 282557fafe1SMike Marciniszyn void qib_qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter); 2831dd173b0SMike Marciniszyn 2841dd173b0SMike Marciniszyn #endif 2851dd173b0SMike Marciniszyn 286f931551bSRalph Campbell unsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult); 287f931551bSRalph Campbell 288f931551bSRalph Campbell void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail); 289f931551bSRalph Campbell 290f931551bSRalph Campbell void qib_put_txreq(struct qib_verbs_txreq *tx); 291f931551bSRalph Campbell 292261a4351SMike Marciniszyn int qib_verbs_send(struct rvt_qp *qp, struct ib_header *hdr, 2937c2e11feSDennis Dalessandro u32 hdrwords, struct rvt_sge_state *ss, u32 len); 294f931551bSRalph Campbell 295261a4351SMike Marciniszyn void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 2967c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 297f931551bSRalph Campbell 298261a4351SMike Marciniszyn void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, 2997c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 300f931551bSRalph Campbell 30190898850SDasaratharaman Chandramouli int qib_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr); 302f931551bSRalph Campbell 3030b79b277SMichael J. Ruhl int qib_check_send_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe, 3040b79b277SMichael J. Ruhl bool *call_send); 30546a80d62SMike Marciniszyn 3061fb9fed6SMike Marciniszyn struct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid); 3071fb9fed6SMike Marciniszyn 308f931551bSRalph Campbell void qib_rc_rnr_retry(unsigned long arg); 309f931551bSRalph Campbell 310261a4351SMike Marciniszyn void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr); 311f931551bSRalph Campbell 312f696bf6dSBart Van Assche int qib_post_ud_send(struct rvt_qp *qp, const struct ib_send_wr *wr); 313f931551bSRalph Campbell 314261a4351SMike Marciniszyn void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 3157c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 316f931551bSRalph Campbell 3178aac4cc3SMike Marciniszyn void mr_rcu_callback(struct rcu_head *list); 3188aac4cc3SMike Marciniszyn 3197c2e11feSDennis Dalessandro void qib_migrate_qp(struct rvt_qp *qp); 320f931551bSRalph Campbell 321261a4351SMike Marciniszyn int qib_ruc_check_hdr(struct qib_ibport *ibp, struct ib_header *hdr, 3227c2e11feSDennis Dalessandro int has_grh, struct rvt_qp *qp, u32 bth0); 323f931551bSRalph Campbell 324f931551bSRalph Campbell u32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr, 325d8966fcdSDasaratharaman Chandramouli const struct ib_global_route *grh, u32 hwords, u32 nwords); 326f931551bSRalph Campbell 327261a4351SMike Marciniszyn void qib_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr, 328f931551bSRalph Campbell u32 bth0, u32 bth2); 329f931551bSRalph Campbell 330db3ef0ebSHarish Chegondi void _qib_do_send(struct work_struct *work); 331db3ef0ebSHarish Chegondi 332db3ef0ebSHarish Chegondi void qib_do_send(struct rvt_qp *qp); 333f931551bSRalph Campbell 3347c2e11feSDennis Dalessandro void qib_send_rc_ack(struct rvt_qp *qp); 335f931551bSRalph Campbell 336747f4d7aSMike Marciniszyn int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags); 337f931551bSRalph Campbell 338747f4d7aSMike Marciniszyn int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags); 339f931551bSRalph Campbell 340747f4d7aSMike Marciniszyn int qib_make_ud_req(struct rvt_qp *qp, unsigned long *flags); 341f931551bSRalph Campbell 342f931551bSRalph Campbell int qib_register_ib_device(struct qib_devdata *); 343f931551bSRalph Campbell 344f931551bSRalph Campbell void qib_unregister_ib_device(struct qib_devdata *); 345f931551bSRalph Campbell 346f931551bSRalph Campbell void qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32); 347f931551bSRalph Campbell 348f931551bSRalph Campbell void qib_ib_piobufavail(struct qib_devdata *); 349f931551bSRalph Campbell 350f931551bSRalph Campbell unsigned qib_get_npkeys(struct qib_devdata *); 351f931551bSRalph Campbell 352f931551bSRalph Campbell unsigned qib_get_pkey(struct qib_ibport *, unsigned); 353f931551bSRalph Campbell 354f931551bSRalph Campbell extern const enum ib_wc_opcode ib_qib_wc_opcode[]; 355f931551bSRalph Campbell 356f931551bSRalph Campbell /* 357f931551bSRalph Campbell * Below HCA-independent IB PhysPortState values, returned 358f931551bSRalph Campbell * by the f_ibphys_portstate() routine. 359f931551bSRalph Campbell */ 360f931551bSRalph Campbell #define IB_PHYSPORTSTATE_SLEEP 1 361f931551bSRalph Campbell #define IB_PHYSPORTSTATE_POLL 2 362f931551bSRalph Campbell #define IB_PHYSPORTSTATE_DISABLED 3 363f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_TRAIN 4 364f931551bSRalph Campbell #define IB_PHYSPORTSTATE_LINKUP 5 365f931551bSRalph Campbell #define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6 366f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8 367f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_IDLE 0xB 368f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC 369f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE 370f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF 371f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_ENH 0x10 372f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13 373f931551bSRalph Campbell 374db3ef0ebSHarish Chegondi extern const int ib_rvt_state_ops[]; 375f931551bSRalph Campbell 376f931551bSRalph Campbell extern __be64 ib_qib_sys_image_guid; /* in network order */ 377f931551bSRalph Campbell 3787c2e11feSDennis Dalessandro extern unsigned int ib_rvt_lkey_table_size; 379f931551bSRalph Campbell 380f931551bSRalph Campbell extern unsigned int ib_qib_max_cqes; 381f931551bSRalph Campbell 382f931551bSRalph Campbell extern unsigned int ib_qib_max_cqs; 383f931551bSRalph Campbell 384f931551bSRalph Campbell extern unsigned int ib_qib_max_qp_wrs; 385f931551bSRalph Campbell 386f931551bSRalph Campbell extern unsigned int ib_qib_max_qps; 387f931551bSRalph Campbell 388f931551bSRalph Campbell extern unsigned int ib_qib_max_sges; 389f931551bSRalph Campbell 390f931551bSRalph Campbell extern unsigned int ib_qib_max_mcast_grps; 391f931551bSRalph Campbell 392f931551bSRalph Campbell extern unsigned int ib_qib_max_mcast_qp_attached; 393f931551bSRalph Campbell 394f931551bSRalph Campbell extern unsigned int ib_qib_max_srqs; 395f931551bSRalph Campbell 396f931551bSRalph Campbell extern unsigned int ib_qib_max_srq_sges; 397f931551bSRalph Campbell 398f931551bSRalph Campbell extern unsigned int ib_qib_max_srq_wrs; 399f931551bSRalph Campbell 400f931551bSRalph Campbell extern const u32 ib_qib_rnr_table[]; 401f931551bSRalph Campbell 4029ec4faa3SMike Marciniszyn extern const struct rvt_operation_params qib_post_parms[]; 4039ec4faa3SMike Marciniszyn 404f931551bSRalph Campbell #endif /* QIB_VERBS_H */ 405