18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2012 - 2018 Intel Corporation. All rights reserved. 38c2ecf20Sopenharmony_ci * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. 48c2ecf20Sopenharmony_ci * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 78c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 88c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 98c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the 108c2ecf20Sopenharmony_ci * OpenIB.org BSD license below: 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or 138c2ecf20Sopenharmony_ci * without modification, are permitted provided that the following 148c2ecf20Sopenharmony_ci * conditions are met: 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above 178c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 188c2ecf20Sopenharmony_ci * disclaimer. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above 218c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 228c2ecf20Sopenharmony_ci * disclaimer in the documentation and/or other materials 238c2ecf20Sopenharmony_ci * provided with the distribution. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 268c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 278c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 288c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 298c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 308c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 318c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 328c2ecf20Sopenharmony_ci * SOFTWARE. 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#ifndef QIB_VERBS_H 368c2ecf20Sopenharmony_ci#define QIB_VERBS_H 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include <linux/types.h> 398c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 408c2ecf20Sopenharmony_ci#include <linux/kernel.h> 418c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 428c2ecf20Sopenharmony_ci#include <linux/kref.h> 438c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 448c2ecf20Sopenharmony_ci#include <linux/kthread.h> 458c2ecf20Sopenharmony_ci#include <linux/completion.h> 468c2ecf20Sopenharmony_ci#include <rdma/ib_pack.h> 478c2ecf20Sopenharmony_ci#include <rdma/ib_user_verbs.h> 488c2ecf20Sopenharmony_ci#include <rdma/ib_hdrs.h> 498c2ecf20Sopenharmony_ci#include <rdma/rdmavt_qp.h> 508c2ecf20Sopenharmony_ci#include <rdma/rdmavt_cq.h> 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistruct qib_ctxtdata; 538c2ecf20Sopenharmony_cistruct qib_pportdata; 548c2ecf20Sopenharmony_cistruct qib_devdata; 558c2ecf20Sopenharmony_cistruct qib_verbs_txreq; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define QIB_MAX_RDMA_ATOMIC 16 588c2ecf20Sopenharmony_ci#define QIB_GUIDS_PER_PORT 5 598c2ecf20Sopenharmony_ci#define QIB_PSN_SHIFT 8 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* 628c2ecf20Sopenharmony_ci * Increment this value if any changes that break userspace ABI 638c2ecf20Sopenharmony_ci * compatibility are made. 648c2ecf20Sopenharmony_ci */ 658c2ecf20Sopenharmony_ci#define QIB_UVERBS_ABI_VERSION 2 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* IB Performance Manager status values */ 688c2ecf20Sopenharmony_ci#define IB_PMA_SAMPLE_STATUS_DONE 0x00 698c2ecf20Sopenharmony_ci#define IB_PMA_SAMPLE_STATUS_STARTED 0x01 708c2ecf20Sopenharmony_ci#define IB_PMA_SAMPLE_STATUS_RUNNING 0x02 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Mandatory IB performance counter select values. */ 738c2ecf20Sopenharmony_ci#define IB_PMA_PORT_XMIT_DATA cpu_to_be16(0x0001) 748c2ecf20Sopenharmony_ci#define IB_PMA_PORT_RCV_DATA cpu_to_be16(0x0002) 758c2ecf20Sopenharmony_ci#define IB_PMA_PORT_XMIT_PKTS cpu_to_be16(0x0003) 768c2ecf20Sopenharmony_ci#define IB_PMA_PORT_RCV_PKTS cpu_to_be16(0x0004) 778c2ecf20Sopenharmony_ci#define IB_PMA_PORT_XMIT_WAIT cpu_to_be16(0x0005) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define QIB_VENDOR_IPG cpu_to_be16(0xFFA0) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* Values for set/get portinfo VLCap OperationalVLs */ 848c2ecf20Sopenharmony_ci#define IB_VL_VL0 1 858c2ecf20Sopenharmony_ci#define IB_VL_VL0_1 2 868c2ecf20Sopenharmony_ci#define IB_VL_VL0_3 3 878c2ecf20Sopenharmony_ci#define IB_VL_VL0_7 4 888c2ecf20Sopenharmony_ci#define IB_VL_VL0_14 5 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_cistatic inline int qib_num_vls(int vls) 918c2ecf20Sopenharmony_ci{ 928c2ecf20Sopenharmony_ci switch (vls) { 938c2ecf20Sopenharmony_ci default: 948c2ecf20Sopenharmony_ci case IB_VL_VL0: 958c2ecf20Sopenharmony_ci return 1; 968c2ecf20Sopenharmony_ci case IB_VL_VL0_1: 978c2ecf20Sopenharmony_ci return 2; 988c2ecf20Sopenharmony_ci case IB_VL_VL0_3: 998c2ecf20Sopenharmony_ci return 4; 1008c2ecf20Sopenharmony_ci case IB_VL_VL0_7: 1018c2ecf20Sopenharmony_ci return 8; 1028c2ecf20Sopenharmony_ci case IB_VL_VL0_14: 1038c2ecf20Sopenharmony_ci return 15; 1048c2ecf20Sopenharmony_ci } 1058c2ecf20Sopenharmony_ci} 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistruct qib_pio_header { 1088c2ecf20Sopenharmony_ci __le32 pbc[2]; 1098c2ecf20Sopenharmony_ci struct ib_header hdr; 1108c2ecf20Sopenharmony_ci} __packed; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* 1138c2ecf20Sopenharmony_ci * qib specific data structure that will be hidden from rvt after the queue pair 1148c2ecf20Sopenharmony_ci * is made common. 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_cistruct qib_qp_priv { 1178c2ecf20Sopenharmony_ci struct ib_header *s_hdr; /* next packet header to send */ 1188c2ecf20Sopenharmony_ci struct list_head iowait; /* link for wait PIO buf */ 1198c2ecf20Sopenharmony_ci atomic_t s_dma_busy; 1208c2ecf20Sopenharmony_ci struct qib_verbs_txreq *s_tx; 1218c2ecf20Sopenharmony_ci struct work_struct s_work; 1228c2ecf20Sopenharmony_ci wait_queue_head_t wait_dma; 1238c2ecf20Sopenharmony_ci struct rvt_qp *owner; 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define QIB_PSN_CREDIT 16 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistruct qib_opcode_stats { 1298c2ecf20Sopenharmony_ci u64 n_packets; /* number of packets */ 1308c2ecf20Sopenharmony_ci u64 n_bytes; /* total number of bytes */ 1318c2ecf20Sopenharmony_ci}; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistruct qib_opcode_stats_perctx { 1348c2ecf20Sopenharmony_ci struct qib_opcode_stats stats[128]; 1358c2ecf20Sopenharmony_ci}; 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_cistruct qib_pma_counters { 1388c2ecf20Sopenharmony_ci u64 n_unicast_xmit; /* total unicast packets sent */ 1398c2ecf20Sopenharmony_ci u64 n_unicast_rcv; /* total unicast packets received */ 1408c2ecf20Sopenharmony_ci u64 n_multicast_xmit; /* total multicast packets sent */ 1418c2ecf20Sopenharmony_ci u64 n_multicast_rcv; /* total multicast packets received */ 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistruct qib_ibport { 1458c2ecf20Sopenharmony_ci struct rvt_ibport rvp; 1468c2ecf20Sopenharmony_ci struct rvt_ah *smi_ah; 1478c2ecf20Sopenharmony_ci __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */ 1488c2ecf20Sopenharmony_ci struct qib_pma_counters __percpu *pmastats; 1498c2ecf20Sopenharmony_ci u64 z_unicast_xmit; /* starting count for PMA */ 1508c2ecf20Sopenharmony_ci u64 z_unicast_rcv; /* starting count for PMA */ 1518c2ecf20Sopenharmony_ci u64 z_multicast_xmit; /* starting count for PMA */ 1528c2ecf20Sopenharmony_ci u64 z_multicast_rcv; /* starting count for PMA */ 1538c2ecf20Sopenharmony_ci u64 z_symbol_error_counter; /* starting count for PMA */ 1548c2ecf20Sopenharmony_ci u64 z_link_error_recovery_counter; /* starting count for PMA */ 1558c2ecf20Sopenharmony_ci u64 z_link_downed_counter; /* starting count for PMA */ 1568c2ecf20Sopenharmony_ci u64 z_port_rcv_errors; /* starting count for PMA */ 1578c2ecf20Sopenharmony_ci u64 z_port_rcv_remphys_errors; /* starting count for PMA */ 1588c2ecf20Sopenharmony_ci u64 z_port_xmit_discards; /* starting count for PMA */ 1598c2ecf20Sopenharmony_ci u64 z_port_xmit_data; /* starting count for PMA */ 1608c2ecf20Sopenharmony_ci u64 z_port_rcv_data; /* starting count for PMA */ 1618c2ecf20Sopenharmony_ci u64 z_port_xmit_packets; /* starting count for PMA */ 1628c2ecf20Sopenharmony_ci u64 z_port_rcv_packets; /* starting count for PMA */ 1638c2ecf20Sopenharmony_ci u32 z_local_link_integrity_errors; /* starting count for PMA */ 1648c2ecf20Sopenharmony_ci u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */ 1658c2ecf20Sopenharmony_ci u32 z_vl15_dropped; /* starting count for PMA */ 1668c2ecf20Sopenharmony_ci u8 sl_to_vl[16]; 1678c2ecf20Sopenharmony_ci}; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistruct qib_ibdev { 1708c2ecf20Sopenharmony_ci struct rvt_dev_info rdi; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci struct list_head piowait; /* list for wait PIO buf */ 1738c2ecf20Sopenharmony_ci struct list_head dmawait; /* list for wait DMA */ 1748c2ecf20Sopenharmony_ci struct list_head txwait; /* list for wait qib_verbs_txreq */ 1758c2ecf20Sopenharmony_ci struct list_head memwait; /* list for wait kernel memory */ 1768c2ecf20Sopenharmony_ci struct list_head txreq_free; 1778c2ecf20Sopenharmony_ci struct timer_list mem_timer; 1788c2ecf20Sopenharmony_ci struct qib_pio_header *pio_hdrs; 1798c2ecf20Sopenharmony_ci dma_addr_t pio_hdrs_phys; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci u32 n_piowait; 1828c2ecf20Sopenharmony_ci u32 n_txwait; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS 1858c2ecf20Sopenharmony_ci /* per HCA debugfs */ 1868c2ecf20Sopenharmony_ci struct dentry *qib_ibdev_dbg; 1878c2ecf20Sopenharmony_ci#endif 1888c2ecf20Sopenharmony_ci}; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_cistruct qib_verbs_counters { 1918c2ecf20Sopenharmony_ci u64 symbol_error_counter; 1928c2ecf20Sopenharmony_ci u64 link_error_recovery_counter; 1938c2ecf20Sopenharmony_ci u64 link_downed_counter; 1948c2ecf20Sopenharmony_ci u64 port_rcv_errors; 1958c2ecf20Sopenharmony_ci u64 port_rcv_remphys_errors; 1968c2ecf20Sopenharmony_ci u64 port_xmit_discards; 1978c2ecf20Sopenharmony_ci u64 port_xmit_data; 1988c2ecf20Sopenharmony_ci u64 port_rcv_data; 1998c2ecf20Sopenharmony_ci u64 port_xmit_packets; 2008c2ecf20Sopenharmony_ci u64 port_rcv_packets; 2018c2ecf20Sopenharmony_ci u32 local_link_integrity_errors; 2028c2ecf20Sopenharmony_ci u32 excessive_buffer_overrun_errors; 2038c2ecf20Sopenharmony_ci u32 vl15_dropped; 2048c2ecf20Sopenharmony_ci}; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_cistatic inline struct qib_ibdev *to_idev(struct ib_device *ibdev) 2078c2ecf20Sopenharmony_ci{ 2088c2ecf20Sopenharmony_ci struct rvt_dev_info *rdi; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci rdi = container_of(ibdev, struct rvt_dev_info, ibdev); 2118c2ecf20Sopenharmony_ci return container_of(rdi, struct qib_ibdev, rdi); 2128c2ecf20Sopenharmony_ci} 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* 2158c2ecf20Sopenharmony_ci * Send if not busy or waiting for I/O and either 2168c2ecf20Sopenharmony_ci * a RC response is pending or we can process send work requests. 2178c2ecf20Sopenharmony_ci */ 2188c2ecf20Sopenharmony_cistatic inline int qib_send_ok(struct rvt_qp *qp) 2198c2ecf20Sopenharmony_ci{ 2208c2ecf20Sopenharmony_ci return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && 2218c2ecf20Sopenharmony_ci (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) || 2228c2ecf20Sopenharmony_ci !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); 2238c2ecf20Sopenharmony_ci} 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_cibool _qib_schedule_send(struct rvt_qp *qp); 2268c2ecf20Sopenharmony_cibool qib_schedule_send(struct rvt_qp *qp); 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic inline int qib_pkey_ok(u16 pkey1, u16 pkey2) 2298c2ecf20Sopenharmony_ci{ 2308c2ecf20Sopenharmony_ci u16 p1 = pkey1 & 0x7FFF; 2318c2ecf20Sopenharmony_ci u16 p2 = pkey2 & 0x7FFF; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci /* 2348c2ecf20Sopenharmony_ci * Low 15 bits must be non-zero and match, and 2358c2ecf20Sopenharmony_ci * one of the two must be a full member. 2368c2ecf20Sopenharmony_ci */ 2378c2ecf20Sopenharmony_ci return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0); 2388c2ecf20Sopenharmony_ci} 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_civoid qib_bad_pkey(struct qib_ibport *ibp, u32 key, u32 sl, 2418c2ecf20Sopenharmony_ci u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); 2428c2ecf20Sopenharmony_civoid qib_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num); 2438c2ecf20Sopenharmony_civoid qib_sys_guid_chg(struct qib_ibport *ibp); 2448c2ecf20Sopenharmony_civoid qib_node_desc_chg(struct qib_ibport *ibp); 2458c2ecf20Sopenharmony_ciint qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 2468c2ecf20Sopenharmony_ci const struct ib_wc *in_wc, const struct ib_grh *in_grh, 2478c2ecf20Sopenharmony_ci const struct ib_mad *in, struct ib_mad *out, 2488c2ecf20Sopenharmony_ci size_t *out_mad_size, u16 *out_mad_pkey_index); 2498c2ecf20Sopenharmony_civoid qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx); 2508c2ecf20Sopenharmony_civoid qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx); 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci/* 2538c2ecf20Sopenharmony_ci * Compare the lower 24 bits of the two values. 2548c2ecf20Sopenharmony_ci * Returns an integer <, ==, or > than zero. 2558c2ecf20Sopenharmony_ci */ 2568c2ecf20Sopenharmony_cistatic inline int qib_cmp24(u32 a, u32 b) 2578c2ecf20Sopenharmony_ci{ 2588c2ecf20Sopenharmony_ci return (((int) a) - ((int) b)) << 8; 2598c2ecf20Sopenharmony_ci} 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ciint qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords, 2628c2ecf20Sopenharmony_ci u64 *rwords, u64 *spkts, u64 *rpkts, 2638c2ecf20Sopenharmony_ci u64 *xmit_wait); 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ciint qib_get_counters(struct qib_pportdata *ppd, 2668c2ecf20Sopenharmony_ci struct qib_verbs_counters *cntrs); 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci/* 2698c2ecf20Sopenharmony_ci * Functions provided by qib driver for rdmavt to use 2708c2ecf20Sopenharmony_ci */ 2718c2ecf20Sopenharmony_ciunsigned qib_free_all_qps(struct rvt_dev_info *rdi); 2728c2ecf20Sopenharmony_civoid *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp); 2738c2ecf20Sopenharmony_civoid qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); 2748c2ecf20Sopenharmony_civoid qib_notify_qp_reset(struct rvt_qp *qp); 2758c2ecf20Sopenharmony_ciint qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 2768c2ecf20Sopenharmony_ci enum ib_qp_type type, u8 port); 2778c2ecf20Sopenharmony_civoid qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait); 2788c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_civoid qib_qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter); 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci#endif 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ciunsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult); 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_civoid qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail); 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_civoid qib_put_txreq(struct qib_verbs_txreq *tx); 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ciint qib_verbs_send(struct rvt_qp *qp, struct ib_header *hdr, 2918c2ecf20Sopenharmony_ci u32 hdrwords, struct rvt_sge_state *ss, u32 len); 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_civoid qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 2948c2ecf20Sopenharmony_ci int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_civoid qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, 2978c2ecf20Sopenharmony_ci int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ciint qib_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr); 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ciint qib_check_send_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe, 3028c2ecf20Sopenharmony_ci bool *call_send); 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_cistruct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid); 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_civoid qib_rc_rnr_retry(unsigned long arg); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_civoid qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr); 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ciint qib_post_ud_send(struct rvt_qp *qp, const struct ib_send_wr *wr); 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_civoid qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, 3138c2ecf20Sopenharmony_ci int has_grh, void *data, u32 tlen, struct rvt_qp *qp); 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_civoid mr_rcu_callback(struct rcu_head *list); 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_civoid qib_migrate_qp(struct rvt_qp *qp); 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ciint qib_ruc_check_hdr(struct qib_ibport *ibp, struct ib_header *hdr, 3208c2ecf20Sopenharmony_ci int has_grh, struct rvt_qp *qp, u32 bth0); 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ciu32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr, 3238c2ecf20Sopenharmony_ci const struct ib_global_route *grh, u32 hwords, u32 nwords); 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_civoid qib_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr, 3268c2ecf20Sopenharmony_ci u32 bth0, u32 bth2); 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_civoid _qib_do_send(struct work_struct *work); 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_civoid qib_do_send(struct rvt_qp *qp); 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_civoid qib_send_rc_ack(struct rvt_qp *qp); 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ciint qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags); 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ciint qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ciint qib_make_ud_req(struct rvt_qp *qp, unsigned long *flags); 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ciint qib_register_ib_device(struct qib_devdata *); 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_civoid qib_unregister_ib_device(struct qib_devdata *); 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_civoid qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32); 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_civoid qib_ib_piobufavail(struct qib_devdata *); 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ciunsigned qib_get_npkeys(struct qib_devdata *); 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ciunsigned qib_get_pkey(struct qib_ibport *, unsigned); 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ciextern const enum ib_wc_opcode ib_qib_wc_opcode[]; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/* 3558c2ecf20Sopenharmony_ci * Below HCA-independent IB PhysPortState values, returned 3568c2ecf20Sopenharmony_ci * by the f_ibphys_portstate() routine. 3578c2ecf20Sopenharmony_ci */ 3588c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_SLEEP 1 3598c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_POLL 2 3608c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_DISABLED 3 3618c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_CFG_TRAIN 4 3628c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_LINKUP 5 3638c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6 3648c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8 3658c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_CFG_IDLE 0xB 3668c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC 3678c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE 3688c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF 3698c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_CFG_ENH 0x10 3708c2ecf20Sopenharmony_ci#define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ciextern const int ib_rvt_state_ops[]; 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ciextern __be64 ib_qib_sys_image_guid; /* in network order */ 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ciextern unsigned int ib_rvt_lkey_table_size; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_cqes; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_cqs; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_qp_wrs; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_qps; 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_sges; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_mcast_grps; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_mcast_qp_attached; 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_srqs; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_srq_sges; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ciextern unsigned int ib_qib_max_srq_wrs; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ciextern const u32 ib_qib_rnr_table[]; 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ciextern const struct rvt_operation_params qib_post_parms[]; 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci#endif /* QIB_VERBS_H */ 403