blob: 11d55fc2ded7b18c95c5caa89f4e21987534881e [file] [log] [blame]
Steve Wisecfdda9d2010-04-21 15:30:06 -07001/*
2 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 * - Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials
20 * provided with the distribution.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * SOFTWARE.
30 */
31#ifndef __T4_H__
32#define __T4_H__
33
34#include "t4_hw.h"
35#include "t4_regs.h"
Hariprasad S74217d42015-06-09 18:23:12 +053036#include "t4_values.h"
Steve Wisecfdda9d2010-04-21 15:30:06 -070037#include "t4_msg.h"
38#include "t4fw_ri_api.h"
39
Steve Wise1cf24dc2013-08-06 21:04:35 +053040#define T4_MAX_NUM_PD 65536
Steve Wisea2de1492013-08-06 21:04:39 +053041#define T4_MAX_MR_SIZE (~0ULL)
Steve Wisecfdda9d2010-04-21 15:30:06 -070042#define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */
43#define T4_STAG_UNSET 0xffffffff
44#define T4_FW_MAJ 0
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +053045#define PCIE_MA_SYNC_A 0x30b4
Steve Wisecfdda9d2010-04-21 15:30:06 -070046
47struct t4_status_page {
48 __be32 rsvd1; /* flit 0 - hw owns */
49 __be16 rsvd2;
50 __be16 qid;
51 __be16 cidx;
52 __be16 pidx;
53 u8 qp_err; /* flit 1 - sw owns */
54 u8 db_off;
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +053055 u8 pad[2];
Vipul Pandya422eea02012-05-18 15:29:30 +053056 u16 host_wq_pidx;
57 u16 host_cidx;
58 u16 host_pidx;
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +053059 u16 pad2;
60 u32 srqidx;
Steve Wisecfdda9d2010-04-21 15:30:06 -070061};
62
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +053063#define T4_RQT_ENTRY_SHIFT 6
64#define T4_RQT_ENTRY_SIZE BIT(T4_RQT_ENTRY_SHIFT)
Steve Wised37ac312010-06-10 19:03:00 +000065#define T4_EQ_ENTRY_SIZE 64
Steve Wisecfdda9d2010-04-21 15:30:06 -070066
Steve Wise40dbf6e2010-09-17 15:40:15 -050067#define T4_SQ_NUM_SLOTS 5
Steve Wised37ac312010-06-10 19:03:00 +000068#define T4_SQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_SQ_NUM_SLOTS)
Steve Wisecfdda9d2010-04-21 15:30:06 -070069#define T4_MAX_SEND_SGE ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_send_wr) - \
70 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge))
71#define T4_MAX_SEND_INLINE ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_send_wr) - \
72 sizeof(struct fw_ri_immd)))
73#define T4_MAX_WRITE_INLINE ((T4_SQ_NUM_BYTES - \
74 sizeof(struct fw_ri_rdma_write_wr) - \
75 sizeof(struct fw_ri_immd)))
76#define T4_MAX_WRITE_SGE ((T4_SQ_NUM_BYTES - \
77 sizeof(struct fw_ri_rdma_write_wr) - \
78 sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge))
79#define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \
Steve Wise40dbf6e2010-09-17 15:40:15 -050080 sizeof(struct fw_ri_immd)) & ~31UL)
Steve Wisea03d9f92014-04-09 09:38:27 -050081#define T4_MAX_FR_IMMD_DEPTH (T4_MAX_FR_IMMD / sizeof(u64))
82#define T4_MAX_FR_DSGL 1024
83#define T4_MAX_FR_DSGL_DEPTH (T4_MAX_FR_DSGL / sizeof(u64))
84
85static inline int t4_max_fr_depth(int use_dsgl)
86{
87 return use_dsgl ? T4_MAX_FR_DSGL_DEPTH : T4_MAX_FR_IMMD_DEPTH;
88}
Steve Wisecfdda9d2010-04-21 15:30:06 -070089
90#define T4_RQ_NUM_SLOTS 2
Steve Wised37ac312010-06-10 19:03:00 +000091#define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS)
Steve Wisef64b8842010-05-20 16:58:05 -050092#define T4_MAX_RECV_SGE 4
Steve Wisecfdda9d2010-04-21 15:30:06 -070093
94union t4_wr {
95 struct fw_ri_res_wr res;
96 struct fw_ri_wr ri;
97 struct fw_ri_rdma_write_wr write;
98 struct fw_ri_send_wr send;
99 struct fw_ri_rdma_read_wr read;
100 struct fw_ri_bind_mw_wr bind;
101 struct fw_ri_fr_nsmr_wr fr;
Steve Wise49b53a92016-09-16 07:54:52 -0700102 struct fw_ri_fr_nsmr_tpte_wr fr_tpte;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700103 struct fw_ri_inv_lstag_wr inv;
104 struct t4_status_page status;
Steve Wised37ac312010-06-10 19:03:00 +0000105 __be64 flits[T4_EQ_ENTRY_SIZE / sizeof(__be64) * T4_SQ_NUM_SLOTS];
Steve Wisecfdda9d2010-04-21 15:30:06 -0700106};
107
108union t4_recv_wr {
109 struct fw_ri_recv_wr recv;
110 struct t4_status_page status;
Steve Wised37ac312010-06-10 19:03:00 +0000111 __be64 flits[T4_EQ_ENTRY_SIZE / sizeof(__be64) * T4_RQ_NUM_SLOTS];
Steve Wisecfdda9d2010-04-21 15:30:06 -0700112};
113
114static inline void init_wr_hdr(union t4_wr *wqe, u16 wrid,
115 enum fw_wr_opcodes opcode, u8 flags, u8 len16)
116{
Steve Wisecfdda9d2010-04-21 15:30:06 -0700117 wqe->send.opcode = (u8)opcode;
118 wqe->send.flags = flags;
119 wqe->send.wrid = wrid;
120 wqe->send.r1[0] = 0;
121 wqe->send.r1[1] = 0;
122 wqe->send.r1[2] = 0;
123 wqe->send.len16 = len16;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700124}
125
126/* CQE/AE status codes */
127#define T4_ERR_SUCCESS 0x0
128#define T4_ERR_STAG 0x1 /* STAG invalid: either the */
129 /* STAG is offlimt, being 0, */
130 /* or STAG_key mismatch */
131#define T4_ERR_PDID 0x2 /* PDID mismatch */
132#define T4_ERR_QPID 0x3 /* QPID mismatch */
133#define T4_ERR_ACCESS 0x4 /* Invalid access right */
134#define T4_ERR_WRAP 0x5 /* Wrap error */
135#define T4_ERR_BOUND 0x6 /* base and bounds voilation */
136#define T4_ERR_INVALIDATE_SHARED_MR 0x7 /* attempt to invalidate a */
137 /* shared memory region */
138#define T4_ERR_INVALIDATE_MR_WITH_MW_BOUND 0x8 /* attempt to invalidate a */
139 /* shared memory region */
140#define T4_ERR_ECC 0x9 /* ECC error detected */
141#define T4_ERR_ECC_PSTAG 0xA /* ECC error detected when */
142 /* reading PSTAG for a MW */
143 /* Invalidate */
144#define T4_ERR_PBL_ADDR_BOUND 0xB /* pbl addr out of bounds: */
145 /* software error */
146#define T4_ERR_SWFLUSH 0xC /* SW FLUSHED */
147#define T4_ERR_CRC 0x10 /* CRC error */
148#define T4_ERR_MARKER 0x11 /* Marker error */
149#define T4_ERR_PDU_LEN_ERR 0x12 /* invalid PDU length */
150#define T4_ERR_OUT_OF_RQE 0x13 /* out of RQE */
151#define T4_ERR_DDP_VERSION 0x14 /* wrong DDP version */
152#define T4_ERR_RDMA_VERSION 0x15 /* wrong RDMA version */
153#define T4_ERR_OPCODE 0x16 /* invalid rdma opcode */
154#define T4_ERR_DDP_QUEUE_NUM 0x17 /* invalid ddp queue number */
155#define T4_ERR_MSN 0x18 /* MSN error */
156#define T4_ERR_TBIT 0x19 /* tag bit not set correctly */
157#define T4_ERR_MO 0x1A /* MO not 0 for TERMINATE */
158 /* or READ_REQ */
159#define T4_ERR_MSN_GAP 0x1B
160#define T4_ERR_MSN_RANGE 0x1C
161#define T4_ERR_IRD_OVERFLOW 0x1D
162#define T4_ERR_RQE_ADDR_BOUND 0x1E /* RQE addr out of bounds: */
163 /* software error */
164#define T4_ERR_INTERNAL_ERR 0x1F /* internal error (opcode */
165 /* mismatch) */
166/*
167 * CQE defs
168 */
169struct t4_cqe {
170 __be32 header;
171 __be32 len;
172 union {
173 struct {
174 __be32 stag;
175 __be32 msn;
176 } rcqe;
177 struct {
Leon Romanovsky35fb2a882017-10-25 07:41:11 +0300178 __be32 stag;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700179 u16 nada2;
180 u16 cidx;
181 } scqe;
182 struct {
183 __be32 wrid_hi;
184 __be32 wrid_low;
185 } gen;
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530186 struct {
187 __be32 stag;
188 __be32 msn;
189 __be32 reserved;
190 __be32 abs_rqe_idx;
191 } srcqe;
192 struct {
193 __be64 imm_data;
194 } imm_data_rcqe;
195
Steve Wise4fe7c292016-12-22 07:04:59 -0800196 u64 drain_cookie;
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530197 __be64 flits[3];
Steve Wisecfdda9d2010-04-21 15:30:06 -0700198 } u;
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530199 __be64 reserved[3];
Steve Wisecfdda9d2010-04-21 15:30:06 -0700200 __be64 bits_type_ts;
201};
202
203/* macros for flit 0 of the cqe */
204
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530205#define CQE_QPID_S 12
206#define CQE_QPID_M 0xFFFFF
207#define CQE_QPID_G(x) ((((x) >> CQE_QPID_S)) & CQE_QPID_M)
208#define CQE_QPID_V(x) ((x)<<CQE_QPID_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700209
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530210#define CQE_SWCQE_S 11
211#define CQE_SWCQE_M 0x1
212#define CQE_SWCQE_G(x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M)
213#define CQE_SWCQE_V(x) ((x)<<CQE_SWCQE_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700214
Steve Wise96a236e2017-12-19 10:29:25 -0800215#define CQE_DRAIN_S 10
216#define CQE_DRAIN_M 0x1
217#define CQE_DRAIN_G(x) ((((x) >> CQE_DRAIN_S)) & CQE_DRAIN_M)
218#define CQE_DRAIN_V(x) ((x)<<CQE_DRAIN_S)
219
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530220#define CQE_STATUS_S 5
221#define CQE_STATUS_M 0x1F
222#define CQE_STATUS_G(x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M)
223#define CQE_STATUS_V(x) ((x)<<CQE_STATUS_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700224
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530225#define CQE_TYPE_S 4
226#define CQE_TYPE_M 0x1
227#define CQE_TYPE_G(x) ((((x) >> CQE_TYPE_S)) & CQE_TYPE_M)
228#define CQE_TYPE_V(x) ((x)<<CQE_TYPE_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700229
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530230#define CQE_OPCODE_S 0
231#define CQE_OPCODE_M 0xF
232#define CQE_OPCODE_G(x) ((((x) >> CQE_OPCODE_S)) & CQE_OPCODE_M)
233#define CQE_OPCODE_V(x) ((x)<<CQE_OPCODE_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700234
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530235#define SW_CQE(x) (CQE_SWCQE_G(be32_to_cpu((x)->header)))
Steve Wise96a236e2017-12-19 10:29:25 -0800236#define DRAIN_CQE(x) (CQE_DRAIN_G(be32_to_cpu((x)->header)))
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530237#define CQE_QPID(x) (CQE_QPID_G(be32_to_cpu((x)->header)))
238#define CQE_TYPE(x) (CQE_TYPE_G(be32_to_cpu((x)->header)))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700239#define SQ_TYPE(x) (CQE_TYPE((x)))
240#define RQ_TYPE(x) (!CQE_TYPE((x)))
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530241#define CQE_STATUS(x) (CQE_STATUS_G(be32_to_cpu((x)->header)))
242#define CQE_OPCODE(x) (CQE_OPCODE_G(be32_to_cpu((x)->header)))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700243
244#define CQE_SEND_OPCODE(x)( \
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530245 (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND) || \
246 (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE) || \
247 (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_INV) || \
248 (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE_INV))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700249
250#define CQE_LEN(x) (be32_to_cpu((x)->len))
251
252/* used for RQ completion processing */
253#define CQE_WRID_STAG(x) (be32_to_cpu((x)->u.rcqe.stag))
254#define CQE_WRID_MSN(x) (be32_to_cpu((x)->u.rcqe.msn))
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +0530255#define CQE_ABS_RQE_IDX(x) (be32_to_cpu((x)->u.srcqe.abs_rqe_idx))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700256
257/* used for SQ completion processing */
258#define CQE_WRID_SQ_IDX(x) ((x)->u.scqe.cidx)
Steve Wise49b53a92016-09-16 07:54:52 -0700259#define CQE_WRID_FR_STAG(x) (be32_to_cpu((x)->u.scqe.stag))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700260
261/* generic accessor macros */
Hariprasad Shenai031cf472014-07-14 21:34:53 +0530262#define CQE_WRID_HI(x) (be32_to_cpu((x)->u.gen.wrid_hi))
263#define CQE_WRID_LOW(x) (be32_to_cpu((x)->u.gen.wrid_low))
Steve Wise4fe7c292016-12-22 07:04:59 -0800264#define CQE_DRAIN_COOKIE(x) ((x)->u.drain_cookie)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700265
266/* macros for flit 3 of the cqe */
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530267#define CQE_GENBIT_S 63
268#define CQE_GENBIT_M 0x1
269#define CQE_GENBIT_G(x) (((x) >> CQE_GENBIT_S) & CQE_GENBIT_M)
270#define CQE_GENBIT_V(x) ((x)<<CQE_GENBIT_S)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700271
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530272#define CQE_OVFBIT_S 62
273#define CQE_OVFBIT_M 0x1
274#define CQE_OVFBIT_G(x) ((((x) >> CQE_OVFBIT_S)) & CQE_OVFBIT_M)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700275
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530276#define CQE_IQTYPE_S 60
277#define CQE_IQTYPE_M 0x3
278#define CQE_IQTYPE_G(x) ((((x) >> CQE_IQTYPE_S)) & CQE_IQTYPE_M)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700279
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530280#define CQE_TS_M 0x0fffffffffffffffULL
281#define CQE_TS_G(x) ((x) & CQE_TS_M)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700282
Hariprasad Shenaia56c66e2015-01-16 09:24:47 +0530283#define CQE_OVFBIT(x) ((unsigned)CQE_OVFBIT_G(be64_to_cpu((x)->bits_type_ts)))
284#define CQE_GENBIT(x) ((unsigned)CQE_GENBIT_G(be64_to_cpu((x)->bits_type_ts)))
285#define CQE_TS(x) (CQE_TS_G(be64_to_cpu((x)->bits_type_ts)))
Steve Wisecfdda9d2010-04-21 15:30:06 -0700286
287struct t4_swsqe {
288 u64 wr_id;
289 struct t4_cqe cqe;
290 int read_len;
291 int opcode;
292 int complete;
293 int signaled;
294 u16 idx;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530295 int flushed;
Arnd Bergmannf8109d92017-11-27 12:44:53 +0100296 ktime_t host_time;
Hariprasad Shenai7730b4c2014-07-14 21:34:54 +0530297 u64 sge_ts;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700298};
299
Steve Wisec6d7b262010-09-13 11:23:57 -0500300static inline pgprot_t t4_pgprot_wc(pgprot_t prot)
301{
Nishanth Aravamudane297d9d2011-03-14 10:36:11 +0000302#if defined(__i386__) || defined(__x86_64__) || defined(CONFIG_PPC64)
Steve Wisec6d7b262010-09-13 11:23:57 -0500303 return pgprot_writecombine(prot);
Steve Wisec6d7b262010-09-13 11:23:57 -0500304#else
305 return pgprot_noncached(prot);
306#endif
307}
308
Steve Wisec6d7b262010-09-13 11:23:57 -0500309enum {
310 T4_SQ_ONCHIP = (1<<0),
311};
312
Steve Wisecfdda9d2010-04-21 15:30:06 -0700313struct t4_sq {
314 union t4_wr *queue;
315 dma_addr_t dma_addr;
FUJITA Tomonorif38926a2010-06-03 05:37:50 +0000316 DEFINE_DMA_UNMAP_ADDR(mapping);
Steve Wisec6d7b262010-09-13 11:23:57 -0500317 unsigned long phys_addr;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700318 struct t4_swsqe *sw_sq;
319 struct t4_swsqe *oldest_read;
Hariprasad S74217d42015-06-09 18:23:12 +0530320 void __iomem *bar2_va;
321 u64 bar2_pa;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700322 size_t memsize;
Hariprasad S74217d42015-06-09 18:23:12 +0530323 u32 bar2_qid;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700324 u32 qid;
325 u16 in_use;
326 u16 size;
327 u16 cidx;
328 u16 pidx;
Steve Wised37ac312010-06-10 19:03:00 +0000329 u16 wq_pidx;
Steve Wise05eb2382014-03-14 21:52:08 +0530330 u16 wq_pidx_inc;
Steve Wisec6d7b262010-09-13 11:23:57 -0500331 u16 flags;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530332 short flush_cidx;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700333};
334
335struct t4_swrqe {
336 u64 wr_id;
Arnd Bergmannf8109d92017-11-27 12:44:53 +0100337 ktime_t host_time;
Hariprasad Shenai7730b4c2014-07-14 21:34:54 +0530338 u64 sge_ts;
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +0530339 int valid;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700340};
341
342struct t4_rq {
343 union t4_recv_wr *queue;
344 dma_addr_t dma_addr;
FUJITA Tomonorif38926a2010-06-03 05:37:50 +0000345 DEFINE_DMA_UNMAP_ADDR(mapping);
Steve Wisecfdda9d2010-04-21 15:30:06 -0700346 struct t4_swrqe *sw_rq;
Hariprasad S74217d42015-06-09 18:23:12 +0530347 void __iomem *bar2_va;
348 u64 bar2_pa;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700349 size_t memsize;
Hariprasad S74217d42015-06-09 18:23:12 +0530350 u32 bar2_qid;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700351 u32 qid;
352 u32 msn;
353 u32 rqt_hwaddr;
354 u16 rqt_size;
355 u16 in_use;
356 u16 size;
357 u16 cidx;
358 u16 pidx;
Steve Wised37ac312010-06-10 19:03:00 +0000359 u16 wq_pidx;
Steve Wise05eb2382014-03-14 21:52:08 +0530360 u16 wq_pidx_inc;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700361};
362
363struct t4_wq {
364 struct t4_sq sq;
365 struct t4_rq rq;
366 void __iomem *db;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700367 struct c4iw_rdev *rdev;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530368 int flushed;
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +0530369 u8 *qp_errp;
370 u32 *srqidxp;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700371};
372
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +0530373struct t4_srq_pending_wr {
374 u64 wr_id;
375 union t4_recv_wr wqe;
376 u8 len16;
377};
378
379struct t4_srq {
380 union t4_recv_wr *queue;
381 dma_addr_t dma_addr;
382 DECLARE_PCI_UNMAP_ADDR(mapping);
383 struct t4_swrqe *sw_rq;
384 void __iomem *bar2_va;
385 u64 bar2_pa;
386 size_t memsize;
387 u32 bar2_qid;
388 u32 qid;
389 u32 msn;
390 u32 rqt_hwaddr;
391 u32 rqt_abs_idx;
392 u16 rqt_size;
393 u16 size;
394 u16 cidx;
395 u16 pidx;
396 u16 wq_pidx;
397 u16 wq_pidx_inc;
398 u16 in_use;
399 struct t4_srq_pending_wr *pending_wrs;
400 u16 pending_cidx;
401 u16 pending_pidx;
402 u16 pending_in_use;
403 u16 ooo_count;
404};
405
406static inline u32 t4_srq_avail(struct t4_srq *srq)
407{
408 return srq->size - 1 - srq->in_use;
409}
410
411static inline void t4_srq_produce(struct t4_srq *srq, u8 len16)
412{
413 srq->in_use++;
414 if (++srq->pidx == srq->size)
415 srq->pidx = 0;
416 srq->wq_pidx += DIV_ROUND_UP(len16 * 16, T4_EQ_ENTRY_SIZE);
417 if (srq->wq_pidx >= srq->size * T4_RQ_NUM_SLOTS)
418 srq->wq_pidx %= srq->size * T4_RQ_NUM_SLOTS;
419 srq->queue[srq->size].status.host_pidx = srq->pidx;
420}
421
422static inline void t4_srq_produce_pending_wr(struct t4_srq *srq)
423{
424 srq->pending_in_use++;
425 srq->in_use++;
426 if (++srq->pending_pidx == srq->size)
427 srq->pending_pidx = 0;
428}
429
430static inline void t4_srq_consume_pending_wr(struct t4_srq *srq)
431{
432 srq->pending_in_use--;
433 srq->in_use--;
434 if (++srq->pending_cidx == srq->size)
435 srq->pending_cidx = 0;
436}
437
438static inline void t4_srq_produce_ooo(struct t4_srq *srq)
439{
440 srq->in_use--;
441 srq->ooo_count++;
442}
443
444static inline void t4_srq_consume_ooo(struct t4_srq *srq)
445{
446 srq->cidx++;
447 if (srq->cidx == srq->size)
448 srq->cidx = 0;
449 srq->queue[srq->size].status.host_cidx = srq->cidx;
450 srq->ooo_count--;
451}
452
453static inline void t4_srq_consume(struct t4_srq *srq)
454{
455 srq->in_use--;
456 if (++srq->cidx == srq->size)
457 srq->cidx = 0;
458 srq->queue[srq->size].status.host_cidx = srq->cidx;
459}
460
Steve Wisecfdda9d2010-04-21 15:30:06 -0700461static inline int t4_rqes_posted(struct t4_wq *wq)
462{
463 return wq->rq.in_use;
464}
465
466static inline int t4_rq_empty(struct t4_wq *wq)
467{
468 return wq->rq.in_use == 0;
469}
470
471static inline int t4_rq_full(struct t4_wq *wq)
472{
473 return wq->rq.in_use == (wq->rq.size - 1);
474}
475
476static inline u32 t4_rq_avail(struct t4_wq *wq)
477{
478 return wq->rq.size - 1 - wq->rq.in_use;
479}
480
Steve Wised37ac312010-06-10 19:03:00 +0000481static inline void t4_rq_produce(struct t4_wq *wq, u8 len16)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700482{
483 wq->rq.in_use++;
484 if (++wq->rq.pidx == wq->rq.size)
485 wq->rq.pidx = 0;
Steve Wised37ac312010-06-10 19:03:00 +0000486 wq->rq.wq_pidx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE);
487 if (wq->rq.wq_pidx >= wq->rq.size * T4_RQ_NUM_SLOTS)
488 wq->rq.wq_pidx %= wq->rq.size * T4_RQ_NUM_SLOTS;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700489}
490
491static inline void t4_rq_consume(struct t4_wq *wq)
492{
493 wq->rq.in_use--;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700494 if (++wq->rq.cidx == wq->rq.size)
495 wq->rq.cidx = 0;
496}
497
Vipul Pandya422eea02012-05-18 15:29:30 +0530498static inline u16 t4_rq_host_wq_pidx(struct t4_wq *wq)
499{
500 return wq->rq.queue[wq->rq.size].status.host_wq_pidx;
501}
502
503static inline u16 t4_rq_wq_size(struct t4_wq *wq)
504{
505 return wq->rq.size * T4_RQ_NUM_SLOTS;
506}
507
Steve Wisec6d7b262010-09-13 11:23:57 -0500508static inline int t4_sq_onchip(struct t4_sq *sq)
509{
510 return sq->flags & T4_SQ_ONCHIP;
511}
512
Steve Wisecfdda9d2010-04-21 15:30:06 -0700513static inline int t4_sq_empty(struct t4_wq *wq)
514{
515 return wq->sq.in_use == 0;
516}
517
518static inline int t4_sq_full(struct t4_wq *wq)
519{
520 return wq->sq.in_use == (wq->sq.size - 1);
521}
522
523static inline u32 t4_sq_avail(struct t4_wq *wq)
524{
525 return wq->sq.size - 1 - wq->sq.in_use;
526}
527
Steve Wised37ac312010-06-10 19:03:00 +0000528static inline void t4_sq_produce(struct t4_wq *wq, u8 len16)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700529{
530 wq->sq.in_use++;
531 if (++wq->sq.pidx == wq->sq.size)
532 wq->sq.pidx = 0;
Steve Wised37ac312010-06-10 19:03:00 +0000533 wq->sq.wq_pidx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE);
534 if (wq->sq.wq_pidx >= wq->sq.size * T4_SQ_NUM_SLOTS)
535 wq->sq.wq_pidx %= wq->sq.size * T4_SQ_NUM_SLOTS;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700536}
537
538static inline void t4_sq_consume(struct t4_wq *wq)
539{
Steve Wise1cf24dc2013-08-06 21:04:35 +0530540 if (wq->sq.cidx == wq->sq.flush_cidx)
541 wq->sq.flush_cidx = -1;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700542 wq->sq.in_use--;
543 if (++wq->sq.cidx == wq->sq.size)
544 wq->sq.cidx = 0;
545}
546
Vipul Pandya422eea02012-05-18 15:29:30 +0530547static inline u16 t4_sq_host_wq_pidx(struct t4_wq *wq)
548{
549 return wq->sq.queue[wq->sq.size].status.host_wq_pidx;
550}
551
552static inline u16 t4_sq_wq_size(struct t4_wq *wq)
553{
554 return wq->sq.size * T4_SQ_NUM_SLOTS;
555}
556
Steve Wisefa658a92014-04-09 09:38:25 -0500557/* This function copies 64 byte coalesced work request to memory
558 * mapped BAR2 space. For coalesced WRs, the SGE fetches data
559 * from the FIFO instead of from Host.
560 */
561static inline void pio_copy(u64 __iomem *dst, u64 *src)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700562{
Steve Wisefa658a92014-04-09 09:38:25 -0500563 int count = 8;
564
565 while (count) {
566 writeq(*src, dst);
567 src++;
568 dst++;
569 count--;
570 }
571}
572
Raju Rangoju7fc7a7c2018-07-25 21:22:13 +0530573static inline void t4_ring_srq_db(struct t4_srq *srq, u16 inc, u8 len16,
574 union t4_recv_wr *wqe)
575{
576 /* Flush host queue memory writes. */
577 wmb();
578 if (inc == 1 && srq->bar2_qid == 0 && wqe) {
579 pr_debug("%s : WC srq->pidx = %d; len16=%d\n",
580 __func__, srq->pidx, len16);
581 pio_copy(srq->bar2_va + SGE_UDB_WCDOORBELL, (u64 *)wqe);
582 } else {
583 pr_debug("%s: DB srq->pidx = %d; len16=%d\n",
584 __func__, srq->pidx, len16);
585 writel(PIDX_T5_V(inc) | QID_V(srq->bar2_qid),
586 srq->bar2_va + SGE_UDB_KDOORBELL);
587 }
588 /* Flush user doorbell area writes. */
589 wmb();
590}
591
Hariprasad S963cab52015-09-23 17:19:27 +0530592static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, union t4_wr *wqe)
Steve Wisefa658a92014-04-09 09:38:25 -0500593{
594
595 /* Flush host queue memory writes. */
Steve Wisecfdda9d2010-04-21 15:30:06 -0700596 wmb();
Hariprasad S74217d42015-06-09 18:23:12 +0530597 if (wq->sq.bar2_va) {
598 if (inc == 1 && wq->sq.bar2_qid == 0 && wqe) {
Bharat Potnuri548ddb12017-09-27 13:05:49 +0530599 pr_debug("WC wq->sq.pidx = %d\n", wq->sq.pidx);
Hariprasad S74217d42015-06-09 18:23:12 +0530600 pio_copy((u64 __iomem *)
601 (wq->sq.bar2_va + SGE_UDB_WCDOORBELL),
602 (u64 *)wqe);
Steve Wisefa658a92014-04-09 09:38:25 -0500603 } else {
Bharat Potnuri548ddb12017-09-27 13:05:49 +0530604 pr_debug("DB wq->sq.pidx = %d\n", wq->sq.pidx);
Hariprasad S74217d42015-06-09 18:23:12 +0530605 writel(PIDX_T5_V(inc) | QID_V(wq->sq.bar2_qid),
606 wq->sq.bar2_va + SGE_UDB_KDOORBELL);
Steve Wisefa658a92014-04-09 09:38:25 -0500607 }
608
609 /* Flush user doorbell area writes. */
610 wmb();
611 return;
612 }
Hariprasad Shenaif612b812015-01-05 16:30:43 +0530613 writel(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db);
Steve Wisecfdda9d2010-04-21 15:30:06 -0700614}
615
Hariprasad S963cab52015-09-23 17:19:27 +0530616static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc,
Steve Wisefa658a92014-04-09 09:38:25 -0500617 union t4_recv_wr *wqe)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700618{
Steve Wisefa658a92014-04-09 09:38:25 -0500619
620 /* Flush host queue memory writes. */
Steve Wisecfdda9d2010-04-21 15:30:06 -0700621 wmb();
Hariprasad S74217d42015-06-09 18:23:12 +0530622 if (wq->rq.bar2_va) {
623 if (inc == 1 && wq->rq.bar2_qid == 0 && wqe) {
Bharat Potnuri548ddb12017-09-27 13:05:49 +0530624 pr_debug("WC wq->rq.pidx = %d\n", wq->rq.pidx);
Hariprasad S74217d42015-06-09 18:23:12 +0530625 pio_copy((u64 __iomem *)
626 (wq->rq.bar2_va + SGE_UDB_WCDOORBELL),
627 (void *)wqe);
Steve Wisefa658a92014-04-09 09:38:25 -0500628 } else {
Bharat Potnuri548ddb12017-09-27 13:05:49 +0530629 pr_debug("DB wq->rq.pidx = %d\n", wq->rq.pidx);
Hariprasad S74217d42015-06-09 18:23:12 +0530630 writel(PIDX_T5_V(inc) | QID_V(wq->rq.bar2_qid),
631 wq->rq.bar2_va + SGE_UDB_KDOORBELL);
Steve Wisefa658a92014-04-09 09:38:25 -0500632 }
633
634 /* Flush user doorbell area writes. */
635 wmb();
636 return;
637 }
Hariprasad Shenaif612b812015-01-05 16:30:43 +0530638 writel(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db);
Steve Wisecfdda9d2010-04-21 15:30:06 -0700639}
640
641static inline int t4_wq_in_error(struct t4_wq *wq)
642{
Raju Rangoju6a0b6172018-07-25 21:22:14 +0530643 return *wq->qp_errp;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700644}
645
Raju Rangoju6a0b6172018-07-25 21:22:14 +0530646static inline void t4_set_wq_in_error(struct t4_wq *wq, u32 srqidx)
Steve Wisecfdda9d2010-04-21 15:30:06 -0700647{
Raju Rangoju6a0b6172018-07-25 21:22:14 +0530648 if (srqidx)
649 *wq->srqidxp = srqidx;
650 *wq->qp_errp = 1;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700651}
652
653static inline void t4_disable_wq_db(struct t4_wq *wq)
654{
Steve Wisecfdda9d2010-04-21 15:30:06 -0700655 wq->rq.queue[wq->rq.size].status.db_off = 1;
656}
657
658static inline void t4_enable_wq_db(struct t4_wq *wq)
659{
Steve Wisecfdda9d2010-04-21 15:30:06 -0700660 wq->rq.queue[wq->rq.size].status.db_off = 0;
661}
662
663static inline int t4_wq_db_enabled(struct t4_wq *wq)
664{
Steve Wisec6d7b262010-09-13 11:23:57 -0500665 return !wq->rq.queue[wq->rq.size].status.db_off;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700666}
667
Steve Wise678ea9b2014-07-31 14:35:43 -0500668enum t4_cq_flags {
669 CQ_ARMED = 1,
670};
671
Steve Wisecfdda9d2010-04-21 15:30:06 -0700672struct t4_cq {
673 struct t4_cqe *queue;
674 dma_addr_t dma_addr;
FUJITA Tomonorif38926a2010-06-03 05:37:50 +0000675 DEFINE_DMA_UNMAP_ADDR(mapping);
Steve Wisecfdda9d2010-04-21 15:30:06 -0700676 struct t4_cqe *sw_queue;
677 void __iomem *gts;
Hariprasad S74217d42015-06-09 18:23:12 +0530678 void __iomem *bar2_va;
679 u64 bar2_pa;
680 u32 bar2_qid;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700681 struct c4iw_rdev *rdev;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700682 size_t memsize;
Steve Wise84172de2010-05-20 16:57:43 -0500683 __be64 bits_type_ts;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700684 u32 cqid;
Hariprasad S09ece8b2015-04-22 01:45:00 +0530685 u32 qid_mask;
Hariprasad Shenaicf38be62014-06-06 21:40:42 +0530686 int vector;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700687 u16 size; /* including status page */
688 u16 cidx;
689 u16 sw_pidx;
690 u16 sw_cidx;
691 u16 sw_in_use;
692 u16 cidx_inc;
693 u8 gen;
694 u8 error;
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530695 u8 *qp_errp;
Steve Wise678ea9b2014-07-31 14:35:43 -0500696 unsigned long flags;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700697};
698
Hariprasad S74217d42015-06-09 18:23:12 +0530699static inline void write_gts(struct t4_cq *cq, u32 val)
700{
701 if (cq->bar2_va)
702 writel(val | INGRESSQID_V(cq->bar2_qid),
703 cq->bar2_va + SGE_UDB_GTS);
704 else
705 writel(val | INGRESSQID_V(cq->cqid), cq->gts);
706}
707
Steve Wise678ea9b2014-07-31 14:35:43 -0500708static inline int t4_clear_cq_armed(struct t4_cq *cq)
709{
710 return test_and_clear_bit(CQ_ARMED, &cq->flags);
711}
712
Steve Wisecfdda9d2010-04-21 15:30:06 -0700713static inline int t4_arm_cq(struct t4_cq *cq, int se)
714{
715 u32 val;
716
Steve Wise678ea9b2014-07-31 14:35:43 -0500717 set_bit(CQ_ARMED, &cq->flags);
Hariprasad Shenaif612b812015-01-05 16:30:43 +0530718 while (cq->cidx_inc > CIDXINC_M) {
Hariprasad S74217d42015-06-09 18:23:12 +0530719 val = SEINTARM_V(0) | CIDXINC_V(CIDXINC_M) | TIMERREG_V(7);
720 write_gts(cq, val);
Hariprasad Shenaif612b812015-01-05 16:30:43 +0530721 cq->cidx_inc -= CIDXINC_M;
Steve Wise7ec45b92010-05-20 16:57:49 -0500722 }
Hariprasad S74217d42015-06-09 18:23:12 +0530723 val = SEINTARM_V(se) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(6);
724 write_gts(cq, val);
Steve Wise7ec45b92010-05-20 16:57:49 -0500725 cq->cidx_inc = 0;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700726 return 0;
727}
728
729static inline void t4_swcq_produce(struct t4_cq *cq)
730{
731 cq->sw_in_use++;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530732 if (cq->sw_in_use == cq->size) {
Bharat Potnuri4d45b752017-09-27 13:05:50 +0530733 pr_warn("%s cxgb4 sw cq overflow cqid %u\n",
734 __func__, cq->cqid);
Steve Wise1cf24dc2013-08-06 21:04:35 +0530735 cq->error = 1;
Steve Wiseba97b742017-11-02 14:11:03 -0700736 cq->sw_in_use--;
737 return;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530738 }
Steve Wisecfdda9d2010-04-21 15:30:06 -0700739 if (++cq->sw_pidx == cq->size)
740 cq->sw_pidx = 0;
741}
742
743static inline void t4_swcq_consume(struct t4_cq *cq)
744{
745 cq->sw_in_use--;
746 if (++cq->sw_cidx == cq->size)
747 cq->sw_cidx = 0;
748}
749
750static inline void t4_hwcq_consume(struct t4_cq *cq)
751{
Steve Wise84172de2010-05-20 16:57:43 -0500752 cq->bits_type_ts = cq->queue[cq->cidx].bits_type_ts;
Hariprasad Shenaif612b812015-01-05 16:30:43 +0530753 if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_M) {
Steve Wiseffc3f742011-03-11 22:30:42 +0000754 u32 val;
755
Hariprasad S74217d42015-06-09 18:23:12 +0530756 val = SEINTARM_V(0) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(7);
757 write_gts(cq, val);
Steve Wise7ec45b92010-05-20 16:57:49 -0500758 cq->cidx_inc = 0;
Steve Wiseffc3f742011-03-11 22:30:42 +0000759 }
Steve Wisecfdda9d2010-04-21 15:30:06 -0700760 if (++cq->cidx == cq->size) {
761 cq->cidx = 0;
762 cq->gen ^= 1;
763 }
764}
765
766static inline int t4_valid_cqe(struct t4_cq *cq, struct t4_cqe *cqe)
767{
768 return (CQE_GENBIT(cqe) == cq->gen);
769}
770
Bharat Potnuricff069b2016-08-23 20:27:33 +0530771static inline int t4_cq_notempty(struct t4_cq *cq)
772{
773 return cq->sw_in_use || t4_valid_cqe(cq, &cq->queue[cq->cidx]);
774}
775
Steve Wisecfdda9d2010-04-21 15:30:06 -0700776static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe)
777{
Steve Wise84172de2010-05-20 16:57:43 -0500778 int ret;
779 u16 prev_cidx;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700780
Steve Wise84172de2010-05-20 16:57:43 -0500781 if (cq->cidx == 0)
782 prev_cidx = cq->size - 1;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700783 else
Steve Wise84172de2010-05-20 16:57:43 -0500784 prev_cidx = cq->cidx - 1;
785
786 if (cq->queue[prev_cidx].bits_type_ts != cq->bits_type_ts) {
787 ret = -EOVERFLOW;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700788 cq->error = 1;
Joe Perches700456b2017-02-09 14:23:50 -0800789 pr_err("cq overflow cqid %u\n", cq->cqid);
Steve Wise84172de2010-05-20 16:57:43 -0500790 } else if (t4_valid_cqe(cq, &cq->queue[cq->cidx])) {
Steve Wisedef47712014-04-09 09:38:26 -0500791
792 /* Ensure CQE is flushed to memory */
793 rmb();
Steve Wise84172de2010-05-20 16:57:43 -0500794 *cqe = &cq->queue[cq->cidx];
795 ret = 0;
796 } else
797 ret = -ENODATA;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700798 return ret;
799}
800
801static inline struct t4_cqe *t4_next_sw_cqe(struct t4_cq *cq)
802{
Steve Wise1cf24dc2013-08-06 21:04:35 +0530803 if (cq->sw_in_use == cq->size) {
Bharat Potnuri4d45b752017-09-27 13:05:50 +0530804 pr_warn("%s cxgb4 sw cq overflow cqid %u\n",
805 __func__, cq->cqid);
Steve Wise1cf24dc2013-08-06 21:04:35 +0530806 cq->error = 1;
Steve Wise1cf24dc2013-08-06 21:04:35 +0530807 return NULL;
808 }
Steve Wisecfdda9d2010-04-21 15:30:06 -0700809 if (cq->sw_in_use)
810 return &cq->sw_queue[cq->sw_cidx];
811 return NULL;
812}
813
814static inline int t4_next_cqe(struct t4_cq *cq, struct t4_cqe **cqe)
815{
816 int ret = 0;
817
818 if (cq->error)
819 ret = -ENODATA;
820 else if (cq->sw_in_use)
821 *cqe = &cq->sw_queue[cq->sw_cidx];
822 else
823 ret = t4_next_hw_cqe(cq, cqe);
824 return ret;
825}
826
827static inline int t4_cq_in_error(struct t4_cq *cq)
828{
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530829 return *cq->qp_errp;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700830}
831
832static inline void t4_set_cq_in_error(struct t4_cq *cq)
833{
Raju Rangoju65ca8d92018-07-05 18:26:01 +0530834 *cq->qp_errp = 1;
Steve Wisecfdda9d2010-04-21 15:30:06 -0700835}
836#endif
Steve Wise05eb2382014-03-14 21:52:08 +0530837
838struct t4_dev_status_page {
839 u8 db_off;
Hariprasad Sc5dfb002015-12-11 13:02:01 +0530840 u8 pad1;
841 u16 pad2;
842 u32 pad3;
843 u64 qp_start;
844 u64 qp_size;
845 u64 cq_start;
846 u64 cq_size;
Steve Wise05eb2382014-03-14 21:52:08 +0530847};