1f931551bSRalph Campbell /* 21dd173b0SMike Marciniszyn * Copyright (c) 2012, 2013 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> 492dc05ab5SDennis Dalessandro #include <rdma/rdma_vt.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 /* XXX Should be defined in ib_verbs.h enum ib_port_cap_flags */ 82f931551bSRalph Campbell #define IB_PORT_OTHER_LOCAL_CHANGES_SUP (1 << 26) 83f931551bSRalph Campbell 84f931551bSRalph Campbell #define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL) 85f931551bSRalph Campbell 86f931551bSRalph Campbell /* Values for set/get portinfo VLCap OperationalVLs */ 87f931551bSRalph Campbell #define IB_VL_VL0 1 88f931551bSRalph Campbell #define IB_VL_VL0_1 2 89f931551bSRalph Campbell #define IB_VL_VL0_3 3 90f931551bSRalph Campbell #define IB_VL_VL0_7 4 91f931551bSRalph Campbell #define IB_VL_VL0_14 5 92f931551bSRalph Campbell 93f931551bSRalph Campbell static inline int qib_num_vls(int vls) 94f931551bSRalph Campbell { 95f931551bSRalph Campbell switch (vls) { 96f931551bSRalph Campbell default: 97f931551bSRalph Campbell case IB_VL_VL0: 98f931551bSRalph Campbell return 1; 99f931551bSRalph Campbell case IB_VL_VL0_1: 100f931551bSRalph Campbell return 2; 101f931551bSRalph Campbell case IB_VL_VL0_3: 102f931551bSRalph Campbell return 4; 103f931551bSRalph Campbell case IB_VL_VL0_7: 104f931551bSRalph Campbell return 8; 105f931551bSRalph Campbell case IB_VL_VL0_14: 106f931551bSRalph Campbell return 15; 107f931551bSRalph Campbell } 108f931551bSRalph Campbell } 109f931551bSRalph Campbell 110f931551bSRalph Campbell struct qib_pio_header { 111f931551bSRalph Campbell __le32 pbc[2]; 112261a4351SMike Marciniszyn struct ib_header hdr; 11378a58864SMike Marciniszyn } __packed; 114f931551bSRalph Campbell 115f931551bSRalph Campbell /* 116ffc26907SDennis Dalessandro * qib specific data structure that will be hidden from rvt after the queue pair 117ffc26907SDennis Dalessandro * is made common. 118ffc26907SDennis Dalessandro */ 119ffc26907SDennis Dalessandro struct qib_qp_priv { 120261a4351SMike Marciniszyn struct ib_header *s_hdr; /* next packet header to send */ 121ffc26907SDennis Dalessandro struct list_head iowait; /* link for wait PIO buf */ 122ffc26907SDennis Dalessandro atomic_t s_dma_busy; 123ffc26907SDennis Dalessandro struct qib_verbs_txreq *s_tx; 124ffc26907SDennis Dalessandro struct work_struct s_work; 125ffc26907SDennis Dalessandro wait_queue_head_t wait_dma; 1267c2e11feSDennis Dalessandro struct rvt_qp *owner; 127f931551bSRalph Campbell }; 128f931551bSRalph Campbell 129f931551bSRalph Campbell #define QIB_PSN_CREDIT 16 130f931551bSRalph Campbell 131f931551bSRalph Campbell struct qib_opcode_stats { 132f931551bSRalph Campbell u64 n_packets; /* number of packets */ 133f931551bSRalph Campbell u64 n_bytes; /* total number of bytes */ 134f931551bSRalph Campbell }; 135f931551bSRalph Campbell 136ddb88765SMike Marciniszyn struct qib_opcode_stats_perctx { 137ddb88765SMike Marciniszyn struct qib_opcode_stats stats[128]; 138ddb88765SMike Marciniszyn }; 139ddb88765SMike Marciniszyn 1407d7632adSMike Marciniszyn struct qib_pma_counters { 1417d7632adSMike Marciniszyn u64 n_unicast_xmit; /* total unicast packets sent */ 1427d7632adSMike Marciniszyn u64 n_unicast_rcv; /* total unicast packets received */ 1437d7632adSMike Marciniszyn u64 n_multicast_xmit; /* total multicast packets sent */ 1447d7632adSMike Marciniszyn u64 n_multicast_rcv; /* total multicast packets received */ 1457d7632adSMike Marciniszyn }; 1467d7632adSMike Marciniszyn 147f931551bSRalph Campbell struct qib_ibport { 148f24a6d48SHarish Chegondi struct rvt_ibport rvp; 1494eadd8ffSDennis Dalessandro struct rvt_ah *smi_ah; 150f931551bSRalph Campbell __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */ 1517d7632adSMike Marciniszyn struct qib_pma_counters __percpu *pmastats; 1527d7632adSMike Marciniszyn u64 z_unicast_xmit; /* starting count for PMA */ 1537d7632adSMike Marciniszyn u64 z_unicast_rcv; /* starting count for PMA */ 1547d7632adSMike Marciniszyn u64 z_multicast_xmit; /* starting count for PMA */ 1557d7632adSMike Marciniszyn u64 z_multicast_rcv; /* starting count for PMA */ 156f931551bSRalph Campbell u64 z_symbol_error_counter; /* starting count for PMA */ 157f931551bSRalph Campbell u64 z_link_error_recovery_counter; /* starting count for PMA */ 158f931551bSRalph Campbell u64 z_link_downed_counter; /* starting count for PMA */ 159f931551bSRalph Campbell u64 z_port_rcv_errors; /* starting count for PMA */ 160f931551bSRalph Campbell u64 z_port_rcv_remphys_errors; /* starting count for PMA */ 161f931551bSRalph Campbell u64 z_port_xmit_discards; /* starting count for PMA */ 162f931551bSRalph Campbell u64 z_port_xmit_data; /* starting count for PMA */ 163f931551bSRalph Campbell u64 z_port_rcv_data; /* starting count for PMA */ 164f931551bSRalph Campbell u64 z_port_xmit_packets; /* starting count for PMA */ 165f931551bSRalph Campbell u64 z_port_rcv_packets; /* starting count for PMA */ 166f931551bSRalph Campbell u32 z_local_link_integrity_errors; /* starting count for PMA */ 167f931551bSRalph Campbell u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */ 168f931551bSRalph Campbell u32 z_vl15_dropped; /* starting count for PMA */ 169f931551bSRalph Campbell u8 sl_to_vl[16]; 170f931551bSRalph Campbell }; 171f931551bSRalph Campbell 172f931551bSRalph Campbell struct qib_ibdev { 1732dc05ab5SDennis Dalessandro struct rvt_dev_info rdi; 174f931551bSRalph Campbell 175f931551bSRalph Campbell struct list_head piowait; /* list for wait PIO buf */ 176f931551bSRalph Campbell struct list_head dmawait; /* list for wait DMA */ 177f931551bSRalph Campbell struct list_head txwait; /* list for wait qib_verbs_txreq */ 178f931551bSRalph Campbell struct list_head memwait; /* list for wait kernel memory */ 179f931551bSRalph Campbell struct list_head txreq_free; 180f931551bSRalph Campbell struct timer_list mem_timer; 181f931551bSRalph Campbell struct qib_pio_header *pio_hdrs; 182f931551bSRalph Campbell dma_addr_t pio_hdrs_phys; 183af061a64SMike Marciniszyn u32 qp_rnd; /* random bytes for hash */ 184f931551bSRalph Campbell 185f931551bSRalph Campbell u32 n_piowait; 186f931551bSRalph Campbell u32 n_txwait; 187f931551bSRalph Campbell 188ddb88765SMike Marciniszyn #ifdef CONFIG_DEBUG_FS 189ddb88765SMike Marciniszyn /* per HCA debugfs */ 190ddb88765SMike Marciniszyn struct dentry *qib_ibdev_dbg; 191ddb88765SMike Marciniszyn #endif 192f931551bSRalph Campbell }; 193f931551bSRalph Campbell 194f931551bSRalph Campbell struct qib_verbs_counters { 195f931551bSRalph Campbell u64 symbol_error_counter; 196f931551bSRalph Campbell u64 link_error_recovery_counter; 197f931551bSRalph Campbell u64 link_downed_counter; 198f931551bSRalph Campbell u64 port_rcv_errors; 199f931551bSRalph Campbell u64 port_rcv_remphys_errors; 200f931551bSRalph Campbell u64 port_xmit_discards; 201f931551bSRalph Campbell u64 port_xmit_data; 202f931551bSRalph Campbell u64 port_rcv_data; 203f931551bSRalph Campbell u64 port_xmit_packets; 204f931551bSRalph Campbell u64 port_rcv_packets; 205f931551bSRalph Campbell u32 local_link_integrity_errors; 206f931551bSRalph Campbell u32 excessive_buffer_overrun_errors; 207f931551bSRalph Campbell u32 vl15_dropped; 208f931551bSRalph Campbell }; 209f931551bSRalph Campbell 210f931551bSRalph Campbell static inline struct qib_ibdev *to_idev(struct ib_device *ibdev) 211f931551bSRalph Campbell { 2122dc05ab5SDennis Dalessandro struct rvt_dev_info *rdi; 2132dc05ab5SDennis Dalessandro 2142dc05ab5SDennis Dalessandro rdi = container_of(ibdev, struct rvt_dev_info, ibdev); 2152dc05ab5SDennis Dalessandro return container_of(rdi, struct qib_ibdev, rdi); 216f931551bSRalph Campbell } 217f931551bSRalph Campbell 218f931551bSRalph Campbell /* 219f931551bSRalph Campbell * Send if not busy or waiting for I/O and either 220f931551bSRalph Campbell * a RC response is pending or we can process send work requests. 221f931551bSRalph Campbell */ 2227c2e11feSDennis Dalessandro static inline int qib_send_ok(struct rvt_qp *qp) 223f931551bSRalph Campbell { 22401ba79d4SHarish Chegondi return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && 22501ba79d4SHarish Chegondi (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) || 22601ba79d4SHarish Chegondi !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); 227f931551bSRalph Campbell } 228f931551bSRalph Campbell 22946a80d62SMike Marciniszyn void _qib_schedule_send(struct rvt_qp *qp); 2307c2e11feSDennis Dalessandro void qib_schedule_send(struct rvt_qp *qp); 231f931551bSRalph Campbell 232f931551bSRalph Campbell static inline int qib_pkey_ok(u16 pkey1, u16 pkey2) 233f931551bSRalph Campbell { 234f931551bSRalph Campbell u16 p1 = pkey1 & 0x7FFF; 235f931551bSRalph Campbell u16 p2 = pkey2 & 0x7FFF; 236f931551bSRalph Campbell 237f931551bSRalph Campbell /* 238f931551bSRalph Campbell * Low 15 bits must be non-zero and match, and 239f931551bSRalph Campbell * one of the two must be a full member. 240f931551bSRalph Campbell */ 241f931551bSRalph Campbell return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0); 242f931551bSRalph Campbell } 243f931551bSRalph Campbell 244f931551bSRalph Campbell void qib_bad_pqkey(struct qib_ibport *ibp, __be16 trap_num, u32 key, u32 sl, 245f931551bSRalph Campbell u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); 246530a5d8eSHarish Chegondi void qib_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num); 247f931551bSRalph Campbell void qib_sys_guid_chg(struct qib_ibport *ibp); 248f931551bSRalph Campbell void qib_node_desc_chg(struct qib_ibport *ibp); 249f931551bSRalph Campbell int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 250a97e2d86SIra Weiny const struct ib_wc *in_wc, const struct ib_grh *in_grh, 2514cd7c947SIra Weiny const struct ib_mad_hdr *in, size_t in_mad_size, 2524cd7c947SIra Weiny struct ib_mad_hdr *out, size_t *out_mad_size, 2534cd7c947SIra Weiny u16 *out_mad_pkey_index); 2545196aa96SDennis Dalessandro void qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx); 2555196aa96SDennis Dalessandro void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx); 256f931551bSRalph Campbell 257f931551bSRalph Campbell /* 258f931551bSRalph Campbell * Compare the lower 24 bits of the two values. 259f931551bSRalph Campbell * Returns an integer <, ==, or > than zero. 260f931551bSRalph Campbell */ 261f931551bSRalph Campbell static inline int qib_cmp24(u32 a, u32 b) 262f931551bSRalph Campbell { 263f931551bSRalph Campbell return (((int) a) - ((int) b)) << 8; 264f931551bSRalph Campbell } 265f931551bSRalph Campbell 266f931551bSRalph Campbell int qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords, 267f931551bSRalph Campbell u64 *rwords, u64 *spkts, u64 *rpkts, 268f931551bSRalph Campbell u64 *xmit_wait); 269f931551bSRalph Campbell 270f931551bSRalph Campbell int qib_get_counters(struct qib_pportdata *ppd, 271f931551bSRalph Campbell struct qib_verbs_counters *cntrs); 272f931551bSRalph Campbell 2737c2e11feSDennis Dalessandro __be32 qib_compute_aeth(struct rvt_qp *qp); 274f931551bSRalph Campbell 27547c7ea6dSHarish Chegondi /* 27647c7ea6dSHarish Chegondi * Functions provided by qib driver for rdmavt to use 27747c7ea6dSHarish Chegondi */ 27847c7ea6dSHarish Chegondi unsigned qib_free_all_qps(struct rvt_dev_info *rdi); 27920f333b6SHarish Chegondi void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, gfp_t gfp); 28020f333b6SHarish Chegondi void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); 28120f333b6SHarish Chegondi void qib_notify_qp_reset(struct rvt_qp *qp); 28220f333b6SHarish Chegondi int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 28347c7ea6dSHarish Chegondi enum ib_qp_type type, u8 port, gfp_t gfp); 284f931551bSRalph Campbell 2851dd173b0SMike Marciniszyn #ifdef CONFIG_DEBUG_FS 2861dd173b0SMike Marciniszyn 2871dd173b0SMike Marciniszyn struct qib_qp_iter; 2881dd173b0SMike Marciniszyn 2891dd173b0SMike Marciniszyn struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev); 2901dd173b0SMike Marciniszyn 2911dd173b0SMike Marciniszyn int qib_qp_iter_next(struct qib_qp_iter *iter); 2921dd173b0SMike Marciniszyn 2931dd173b0SMike Marciniszyn void qib_qp_iter_print(struct seq_file *s, struct qib_qp_iter *iter); 2941dd173b0SMike Marciniszyn 2951dd173b0SMike Marciniszyn #endif 2961dd173b0SMike Marciniszyn 2977c2e11feSDennis Dalessandro void qib_get_credit(struct rvt_qp *qp, u32 aeth); 298f931551bSRalph Campbell 299f931551bSRalph Campbell unsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult); 300f931551bSRalph Campbell 301f931551bSRalph Campbell void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail); 302f931551bSRalph Campbell 303f931551bSRalph Campbell void qib_put_txreq(struct qib_verbs_txreq *tx); 304f931551bSRalph Campbell 305261a4351SMike Marciniszyn int qib_verbs_send(struct rvt_qp *qp, struct ib_header *hdr, 3067c2e11feSDennis Dalessandro u32 hdrwords, struct rvt_sge_state *ss, u32 len); 307f931551bSRalph Campbell 3087c2e11feSDennis Dalessandro void qib_copy_sge(struct rvt_sge_state *ss, void *data, u32 length, 309f931551bSRalph Campbell int release); 310f931551bSRalph Campbell 3117c2e11feSDennis Dalessandro void qib_skip_sge(struct rvt_sge_state *ss, u32 length, int release); 312f931551bSRalph Campbell 313261a4351SMike Marciniszyn void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 3147c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 315f931551bSRalph Campbell 316261a4351SMike Marciniszyn void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, 3177c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 318f931551bSRalph Campbell 319f931551bSRalph Campbell int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr); 320f931551bSRalph Campbell 32146a80d62SMike Marciniszyn int qib_check_send_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe); 32246a80d62SMike Marciniszyn 3231fb9fed6SMike Marciniszyn struct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid); 3241fb9fed6SMike Marciniszyn 325f931551bSRalph Campbell void qib_rc_rnr_retry(unsigned long arg); 326f931551bSRalph Campbell 327261a4351SMike Marciniszyn void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr); 328f931551bSRalph Campbell 3297c2e11feSDennis Dalessandro void qib_rc_error(struct rvt_qp *qp, enum ib_wc_status err); 330f931551bSRalph Campbell 3317c2e11feSDennis Dalessandro int qib_post_ud_send(struct rvt_qp *qp, struct ib_send_wr *wr); 332f931551bSRalph Campbell 333261a4351SMike Marciniszyn void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 3347c2e11feSDennis Dalessandro int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 335f931551bSRalph Campbell 3368aac4cc3SMike Marciniszyn void mr_rcu_callback(struct rcu_head *list); 3378aac4cc3SMike Marciniszyn 3387c2e11feSDennis Dalessandro int qib_get_rwqe(struct rvt_qp *qp, int wr_id_only); 339f931551bSRalph Campbell 3407c2e11feSDennis Dalessandro void qib_migrate_qp(struct rvt_qp *qp); 341f931551bSRalph Campbell 342261a4351SMike Marciniszyn int qib_ruc_check_hdr(struct qib_ibport *ibp, struct ib_header *hdr, 3437c2e11feSDennis Dalessandro int has_grh, struct rvt_qp *qp, u32 bth0); 344f931551bSRalph Campbell 345f931551bSRalph Campbell u32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr, 346f931551bSRalph Campbell struct ib_global_route *grh, u32 hwords, u32 nwords); 347f931551bSRalph Campbell 348261a4351SMike Marciniszyn void qib_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr, 349f931551bSRalph Campbell u32 bth0, u32 bth2); 350f931551bSRalph Campbell 351db3ef0ebSHarish Chegondi void _qib_do_send(struct work_struct *work); 352db3ef0ebSHarish Chegondi 353db3ef0ebSHarish Chegondi void qib_do_send(struct rvt_qp *qp); 354f931551bSRalph Campbell 3557c2e11feSDennis Dalessandro void qib_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, 356f931551bSRalph Campbell enum ib_wc_status status); 357f931551bSRalph Campbell 3587c2e11feSDennis Dalessandro void qib_send_rc_ack(struct rvt_qp *qp); 359f931551bSRalph Campbell 360747f4d7aSMike Marciniszyn int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags); 361f931551bSRalph Campbell 362747f4d7aSMike Marciniszyn int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags); 363f931551bSRalph Campbell 364747f4d7aSMike Marciniszyn int qib_make_ud_req(struct rvt_qp *qp, unsigned long *flags); 365f931551bSRalph Campbell 366f931551bSRalph Campbell int qib_register_ib_device(struct qib_devdata *); 367f931551bSRalph Campbell 368f931551bSRalph Campbell void qib_unregister_ib_device(struct qib_devdata *); 369f931551bSRalph Campbell 370f931551bSRalph Campbell void qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32); 371f931551bSRalph Campbell 372f931551bSRalph Campbell void qib_ib_piobufavail(struct qib_devdata *); 373f931551bSRalph Campbell 374f931551bSRalph Campbell unsigned qib_get_npkeys(struct qib_devdata *); 375f931551bSRalph Campbell 376f931551bSRalph Campbell unsigned qib_get_pkey(struct qib_ibport *, unsigned); 377f931551bSRalph Campbell 378f931551bSRalph Campbell extern const enum ib_wc_opcode ib_qib_wc_opcode[]; 379f931551bSRalph Campbell 380f931551bSRalph Campbell /* 381f931551bSRalph Campbell * Below HCA-independent IB PhysPortState values, returned 382f931551bSRalph Campbell * by the f_ibphys_portstate() routine. 383f931551bSRalph Campbell */ 384f931551bSRalph Campbell #define IB_PHYSPORTSTATE_SLEEP 1 385f931551bSRalph Campbell #define IB_PHYSPORTSTATE_POLL 2 386f931551bSRalph Campbell #define IB_PHYSPORTSTATE_DISABLED 3 387f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_TRAIN 4 388f931551bSRalph Campbell #define IB_PHYSPORTSTATE_LINKUP 5 389f931551bSRalph Campbell #define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6 390f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8 391f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_IDLE 0xB 392f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC 393f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE 394f931551bSRalph Campbell #define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF 395f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_ENH 0x10 396f931551bSRalph Campbell #define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13 397f931551bSRalph Campbell 398db3ef0ebSHarish Chegondi extern const int ib_rvt_state_ops[]; 399f931551bSRalph Campbell 400f931551bSRalph Campbell extern __be64 ib_qib_sys_image_guid; /* in network order */ 401f931551bSRalph Campbell 4027c2e11feSDennis Dalessandro extern unsigned int ib_rvt_lkey_table_size; 403f931551bSRalph Campbell 404f931551bSRalph Campbell extern unsigned int ib_qib_max_cqes; 405f931551bSRalph Campbell 406f931551bSRalph Campbell extern unsigned int ib_qib_max_cqs; 407f931551bSRalph Campbell 408f931551bSRalph Campbell extern unsigned int ib_qib_max_qp_wrs; 409f931551bSRalph Campbell 410f931551bSRalph Campbell extern unsigned int ib_qib_max_qps; 411f931551bSRalph Campbell 412f931551bSRalph Campbell extern unsigned int ib_qib_max_sges; 413f931551bSRalph Campbell 414f931551bSRalph Campbell extern unsigned int ib_qib_max_mcast_grps; 415f931551bSRalph Campbell 416f931551bSRalph Campbell extern unsigned int ib_qib_max_mcast_qp_attached; 417f931551bSRalph Campbell 418f931551bSRalph Campbell extern unsigned int ib_qib_max_srqs; 419f931551bSRalph Campbell 420f931551bSRalph Campbell extern unsigned int ib_qib_max_srq_sges; 421f931551bSRalph Campbell 422f931551bSRalph Campbell extern unsigned int ib_qib_max_srq_wrs; 423f931551bSRalph Campbell 424f931551bSRalph Campbell extern const u32 ib_qib_rnr_table[]; 425f931551bSRalph Campbell 4269ec4faa3SMike Marciniszyn extern const struct rvt_operation_params qib_post_parms[]; 4279ec4faa3SMike Marciniszyn 428f931551bSRalph Campbell #endif /* QIB_VERBS_H */ 429