2 This software is available to you under a choice of one of two
3 licenses. You may choose to be licensed under the terms of the GNU
4 General Public License (GPL) Version 2, available at
5 <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
6 license, available in the LICENSE.TXT file accompanying this
7 software. These details are also available at
8 <http://openib.org/license.html>.
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
22 #ifndef __ib_driver_h__
23 #define __ib_driver_h__
25 #define MELLANOX_VENDOR_ID 0x15b3
27 #define GLOBAL_PD 0x123456
28 #define GLOBAL_QKEY 0x80010000
30 #define MAD_BUF_SZ 256
31 #define IPOIB_RCV_BUF_SZ 2048
32 #define IPOIB_SND_BUF_SZ 2048
37 #define FL_EOL 255 /* end of free list */
39 #define SEND_CQE_POLL_TOUT 38 /* 2 sec */
40 #define SA_RESP_POLL_TOUT 91 /* 5 seconds */
47 #define BCAST_QPN 0xffffff
49 #define QPN_BASE 0x550000
72 #define HCR_BASE 0x80680
73 #define HCR_OFFSET_GO 0x80698
74 #define HCR_OFFSET_STATUS 0x80698
75 #define HCR_OFFSET_OUTPRM_H 0x8068C
76 #define HCR_OFFSET_OUTPRM_L 0x80690
78 #define MKEY_PREFIX 0x77000000
79 #define MKEY_IDX_MASK 0xffffff
83 /* Completion Events */
84 #define XDEV_EV_TYPE_CQ_COMP 0
86 /* IB - affiliated errors CQ */
87 #define XDEV_EV_TYPE_CQ_ERR 0x04
88 #define XDEV_EV_TYPE_LOCAL_WQ_CATAS_ERR 0x05
90 /* Unaffiliated errors */
91 #define XDEV_EV_TYPE_PORT_ERR 0x09
92 #define XDEV_EV_TYPE_LOCAL_WQ_INVALID_REQ_ERR 0x10
93 #define XDEV_EV_TYPE_LOCAL_WQ_ACCESS_VIOL_ERR 0x11
95 /* NOPCODE field enumeration for doorbells and send-WQEs */
96 #define XDEV_NOPCODE_SEND 10 /* Send */
98 struct ib_gid_u32_st {
104 struct ib_gid_u32_st as_u32;
105 } __attribute__ ((packed));
114 typedef void *udqp_t;
116 typedef void *ud_av_t;
117 typedef void *ud_send_wqe_t;
133 union ib_gid_u port_gid;
134 union ib_gid_u bcast_gid;
135 ud_av_t bcast_av; /* av allocated and used solely for broadcast */
139 static int setup_hca(__u8 port, void **eq_p);
140 static int post_send_req(udqp_t qp, ud_send_wqe_t wqe, __u8 num_gather);
141 static void prep_send_wqe_buf(udqp_t qp,
145 unsigned int offset, __u16 len, __u8 e);
147 static int create_mads_qp(void **qp_pp, void **snd_cq_pp, void **rcv_cq_pp);
149 static int create_ipoib_qp(udqp_t * qp_p,
150 void **snd_cq_pp, void **rcv_cq_pp, __u32 qkey);
152 static int gw_read_cr(__u32 addr, __u32 * result);
153 static int gw_write_cr(__u32 addr, __u32 data);
154 static ud_av_t alloc_ud_av(void);
155 static void free_ud_av(ud_av_t av);
156 static int ib_poll_cq(cq_t cq, struct ib_cqe_st *ib_cqe_p, __u8 * num_cqes);
157 static int add_qp_to_mcast_group(union ib_gid_u mcast_gid, __u8 add);
158 static int clear_interrupt(void);
159 static int poll_cqe_tout(cq_t cqh, __u16 tout, void **wqe, int *good_p);
161 static void *get_inprm_buf(void);
162 static void *get_outprm_buf(void);
163 static __u32 ib_get_qpn(udqp_t qph);
165 static void dev_post_dbell(void *dbell, __u32 offset);
167 static struct ib_data_st ib_data;
169 #endif /* __ib_driver_h__ */