Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocrdma_sli.h
Go to the documentation of this file.
1 /*******************************************************************
2  * This file is part of the Emulex RoCE Device Driver for *
3  * RoCE (RDMA over Converged Ethernet) adapters. *
4  * Copyright (C) 2008-2012 Emulex. All rights reserved. *
5  * EMULEX and SLI are trademarks of Emulex. *
6  * www.emulex.com *
7  * *
8  * This program is free software; you can redistribute it and/or *
9  * modify it under the terms of version 2 of the GNU General *
10  * Public License as published by the Free Software Foundation. *
11  * This program is distributed in the hope that it will be useful. *
12  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
13  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
14  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
15  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16  * TO BE LEGALLY INVALID. See the GNU General Public License for *
17  * more details, a copy of which can be found in the file COPYING *
18  * included with this package. *
19  *
20  * Contact Information:
22  *
23  * Emulex
24  * 3333 Susan Street
25  * Costa Mesa, CA 92626
26  *******************************************************************/
27 
28 #ifndef __OCRDMA_SLI_H__
29 #define __OCRDMA_SLI_H__
30 
31 #define Bit(_b) (1 << (_b))
32 
33 #define OCRDMA_GEN1_FAMILY 0xB
34 #define OCRDMA_GEN2_FAMILY 0x2
35 
36 #define OCRDMA_SUBSYS_ROCE 10
37 enum {
41 
44 
49 
59 
64 
67 
69 };
70 
71 #define OCRDMA_SUBSYS_COMMON 1
72 enum {
82 };
83 
84 enum {
85  QTYPE_EQ = 1,
86  QTYPE_CQ = 2,
88 };
89 
90 #define OCRDMA_MAX_SGID (8)
91 
92 #define OCRDMA_MAX_QP 2048
93 #define OCRDMA_MAX_CQ 2048
94 
95 enum {
106 };
107 
108 #define OCRDMA_DB_CQ_RING_ID_MASK 0x3FF /* bits 0 - 9 */
109 #define OCRDMA_DB_CQ_RING_ID_EXT_MASK 0x0C00 /* bits 10-11 of qid at 12-11 */
110 /* qid #2 msbits at 12-11 */
111 #define OCRDMA_DB_CQ_RING_ID_EXT_MASK_SHIFT 0x1
112 #define OCRDMA_DB_CQ_NUM_POPPED_SHIFT (16) /* bits 16 - 28 */
113 /* Rearm bit */
114 #define OCRDMA_DB_CQ_REARM_SHIFT (29) /* bit 29 */
115 /* solicited bit */
116 #define OCRDMA_DB_CQ_SOLICIT_SHIFT (31) /* bit 31 */
117 
118 #define OCRDMA_EQ_ID_MASK 0x1FF /* bits 0 - 8 */
119 #define OCRDMA_EQ_ID_EXT_MASK 0x3e00 /* bits 9-13 */
120 #define OCRDMA_EQ_ID_EXT_MASK_SHIFT (2) /* qid bits 9-13 at 11-15 */
121 
122 /* Clear the interrupt for this eq */
123 #define OCRDMA_EQ_CLR_SHIFT (9) /* bit 9 */
124 /* Must be 1 */
125 #define OCRDMA_EQ_TYPE_SHIFT (10) /* bit 10 */
126 /* Number of event entries processed */
127 #define OCRDMA_NUM_EQE_SHIFT (16) /* bits 16 - 28 */
128 /* Rearm bit */
129 #define OCRDMA_REARM_SHIFT (29) /* bit 29 */
130 
131 #define OCRDMA_MQ_ID_MASK 0x7FF /* bits 0 - 10 */
132 /* Number of entries posted */
133 #define OCRDMA_MQ_NUM_MQE_SHIFT (16) /* bits 16 - 29 */
134 
135 #define OCRDMA_MIN_HPAGE_SIZE (4096)
136 
137 #define OCRDMA_MIN_Q_PAGE_SIZE (4096)
138 #define OCRDMA_MAX_Q_PAGES (8)
139 
140 /*
141 # 0: 4K Bytes
142 # 1: 8K Bytes
143 # 2: 16K Bytes
144 # 3: 32K Bytes
145 # 4: 64K Bytes
146 */
147 #define OCRDMA_MAX_Q_PAGE_SIZE_CNT (5)
148 #define OCRDMA_Q_PAGE_BASE_SIZE (OCRDMA_MIN_Q_PAGE_SIZE * OCRDMA_MAX_Q_PAGES)
149 
150 #define MAX_OCRDMA_QP_PAGES (8)
151 #define OCRDMA_MAX_WQE_MEM_SIZE (MAX_OCRDMA_QP_PAGES * OCRDMA_MIN_HQ_PAGE_SIZE)
152 
153 #define OCRDMA_CREATE_CQ_MAX_PAGES (4)
154 #define OCRDMA_DPP_CQE_SIZE (4)
155 
156 #define OCRDMA_GEN2_MAX_CQE 1024
157 #define OCRDMA_GEN2_CQ_PAGE_SIZE 4096
158 #define OCRDMA_GEN2_WQE_SIZE 256
159 #define OCRDMA_MAX_CQE 4095
160 #define OCRDMA_CQ_PAGE_SIZE 16384
161 #define OCRDMA_WQE_SIZE 128
162 #define OCRDMA_WQE_STRIDE 8
163 #define OCRDMA_WQE_ALIGN_BYTES 16
164 
165 #define MAX_OCRDMA_SRQ_PAGES MAX_OCRDMA_QP_PAGES
166 
167 enum {
172 };
173 
174 /* mailbox cmd header */
177  u32 timeout; /* in seconds */
180 } __packed;
181 
182 enum {
187 
192 };
193 
194 /* mailbox cmd response */
200 } __packed;
201 
202 enum {
205 };
206 
211 } __packed;
212 
213 enum {
220 };
221 
228 } __packed;
229 
232  u8 pyld[220];
233 } __packed;
234 
235 struct ocrdma_mqe {
237  union {
239  struct {
240  struct ocrdma_mqe_sge sge[19];
241  } nonemb_req;
242  u8 cmd[236];
244  } u;
245 } __packed;
246 
247 #define OCRDMA_EQ_LEN 4096
248 #define OCRDMA_MQ_CQ_LEN 256
249 #define OCRDMA_MQ_LEN 128
250 
251 #define PAGE_SHIFT_4K 12
252 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
253 
254 /* Returns number of pages spanned by the data starting at the given addr */
255 #define PAGES_4K_SPANNED(_address, size) \
256  ((u32)((((size_t)(_address) & (PAGE_SIZE_4K - 1)) + \
257  (size) + (PAGE_SIZE_4K - 1)) >> PAGE_SHIFT_4K))
258 
262 } __packed;
263 
264 struct ocrdma_pa {
267 } __packed;
268 
269 #define MAX_OCRDMA_EQ_PAGES (8)
278 } __packed;
279 
280 enum {
284 };
285 
289 };
290 
291 #define OCRDMA_EQ_MINOR_OTHER (0x1)
292 
293 enum {
306 };
307 
308 struct ocrdma_mcqe {
313 } __packed;
314 
315 enum {
318 
329 };
335 } __packed;
336 
337 enum {
341 
352 };
353 
359 } __packed;
360 
361 enum {
367 
378 };
379 
385 } __packed;
386 
387 #define OCRDMA_ASYNC_EVE_CODE 0x14
388 
400 };
401 
402 /* mailbox command request and responses */
403 enum {
411 
418 
424 
430 
440 
447 
454 
458 
465 
472 
479 };
480 
505 } __packed;
506 
510 
512 } __packed;
513 
517 
522  struct {
530  u32 rsvd[6];
531  } ulp[2];
537 
538 } __packed;
539 
540 enum {
542 };
543 
544 enum {
546 
550 
555 
558 };
559 
560 enum {
565 
572 };
573 
582 };
583 
587 } __packed;
588 
589 enum {
591 };
592 
596 } __packed;
597 
601 } __packed;
602 
603 enum {
609 };
610 
617  struct ocrdma_pa pa[8];
618 } __packed;
619 
627  struct ocrdma_pa pa[8];
628 } __packed;
629 
632  union {
635  };
636 } __packed;
637 
641 } __packed;
642 
643 enum {
649 };
650 
654 
656 } __packed;
657 
661 } __packed;
662 
663 enum {
667 };
668 
669 enum {
676 
682 
688 
710 
716 
722 
728 
734 
740 };
741 
742 enum {
745 };
746 
747 #define MAX_OCRDMA_IRD_PAGES 4
748 
751  OCRDMA_QP_LKEY0 = (1 << 1),
752  OCRDMA_QP_FAST_REG = (1 << 2),
753  OCRDMA_QP_INB_RD = (1 << 6),
754  OCRDMA_QP_INB_WR = (1 << 7),
755 };
756 
766 };
767 
771 
785 } __packed;
786 
787 enum {
790 
796 
802 
806 
812 
818 
826 };
827 
831 
839 } __packed;
840 
845 } __packed;
846 
850 } __packed;
851 
852 enum {
855 
883 
888 };
889 
890 enum {
893 
899 
905 
918 
924 
930 
936 
942 
951 
957 
969 
975 };
976 
989  u8 sgid[16];
990  u8 dgid[16];
994 } __packed;
995 
996 
1000 
1005 } __packed;
1006 
1007 enum {
1013 
1019 };
1023 
1026 } __packed;
1027 
1031 
1032 #define OCRDMA_QUERY_UP_QP_ID_SHIFT 0
1033 #define OCRDMA_QUERY_UP_QP_ID_MASK 0xFFFFFF
1035 } __packed;
1036 
1041 } __packed;
1042 
1043 enum {
1049 
1054 
1060 };
1061 
1065 
1070 } __packed;
1071 
1072 enum {
1075 
1081 };
1082 
1086 
1089 } __packed;
1090 
1091 enum {
1094 
1100 };
1101 
1105 
1108 } __packed;
1109 
1110 enum {
1113 };
1114 
1118 
1120 } __packed;
1121 
1122 enum {
1128 
1134 };
1135 
1139 
1142 } __packed;
1143 
1144 enum {
1147 };
1148 
1152 
1154 } __packed;
1155 
1156 enum {
1160 };
1161 
1166 } __packed;
1167 
1168 enum {
1172 };
1173 
1178 } __packed;
1179 
1184 } __packed;
1185 
1189 } __packed;
1190 
1191 enum {
1194 };
1195 
1196 enum {
1199 
1217 };
1218 
1222 
1225 } __packed;
1226 
1230 
1233 } __packed;
1234 
1238 
1241 } __packed;
1242 
1246 } __packed;
1247 
1248 #define MAX_OCRDMA_NSMR_PBL (u32)22
1249 #define MAX_OCRDMA_PBL_SIZE 65536
1250 #define MAX_OCRDMA_PBL_PER_LKEY 32767
1251 
1252 enum {
1258 
1264 
1286 };
1287 
1291 
1302 } __packed;
1303 
1304 enum {
1310 
1313 };
1314 
1318 
1322 
1324 } __packed;
1325 
1326 struct ocrdma_pbe {
1329 } __packed;
1330 
1331 enum {
1334 };
1338 
1341 } __packed;
1342 
1343 enum {
1349 
1353 };
1354 
1358 
1361 } __packed;
1362 
1363 enum {
1366 };
1367 
1371 
1373 } __packed;
1374 
1375 enum {
1378 };
1379 
1383 
1385 } __packed;
1386 
1391  u8 mgid[16];
1394 } __packed;
1395 
1399 } __packed;
1400 
1405  u8 mgid[16];
1408 } __packed;
1409 
1413 } __packed;
1414 
1415 enum {
1419 
1423 
1427 };
1428 
1429 #define OCRDMA_AH_TBL_PAGES 8
1430 
1434 
1436  struct ocrdma_pa tbl_addr[8];
1437 } __packed;
1438 
1443 } __packed;
1444 
1449 } __packed;
1450 
1454 } __packed;
1455 
1456 enum {
1463 };
1464 
1465 struct ocrdma_eqe {
1467 } __packed;
1468 
1492 };
1493 
1494 enum {
1495  /* w0 */
1498 
1499  /* w1 */
1503 
1504  /* w2 */
1506  OCRDMA_CQE_QPN_MASK = 0x0000FFFF,
1507 
1510 
1511  /* w3 */
1524 };
1525 
1526 struct ocrdma_cqe {
1527  union {
1528  /* w0 to w2 */
1529  struct {
1533  } wq;
1534  struct {
1538  } rq;
1539  struct {
1540  u32 lkey_immdt;
1542  u32 buftag_qpn;
1543  } ud;
1544  struct {
1547  u32 qpn;
1548  } cmn;
1549  };
1551 } __packed;
1552 
1553 #define is_cqe_valid(cq, cqe) \
1554  (((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_VALID)\
1555  == cq->phase) ? 1 : 0)
1556 #define is_cqe_for_sq(cqe) \
1557  ((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_QTYPE) ? 0 : 1)
1558 #define is_cqe_for_rq(cqe) \
1559  ((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_QTYPE) ? 1 : 0)
1560 #define is_cqe_invalidated(cqe) \
1561  ((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_INVALIDATE) ? \
1562  1 : 0)
1563 #define is_cqe_imm(cqe) \
1564  ((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_IMM) ? 1 : 0)
1565 #define is_cqe_wr_imm(cqe) \
1566  ((le32_to_cpu(cqe->flags_status_srcqpn) & OCRDMA_CQE_WRITE_IMM) ? 1 : 0)
1567 
1568 struct ocrdma_sge {
1573 } __packed;
1574 
1575 enum {
1582 
1583  /* Stag flags */
1588 };
1589 
1592  OCRDMA_READ = 0x0C,
1594  OCRDMA_SEND = 0x00,
1601 };
1602 
1603 enum {
1606 };
1607 
1608 enum {
1613  OCRDMA_WQE_TYPE_MASK = 0x00030000,
1617 
1620 };
1621 
1622 /* header WQE for all the SQ and RQ operations */
1625  union {
1628  };
1629  union {
1632  };
1634 } __packed;
1635 
1641 } __packed;
1642 
1644  u8 dmac[6];
1645  u8 smac[6];
1647 } __packed;
1648 
1650  u8 dmac[6];
1651  u8 smac[6];
1654 #define OCRDMA_ROCE_ETH_TYPE 0x8915
1656 } __packed;
1657 
1658 struct ocrdma_grh {
1661  u8 sgid[16];
1662  u8 dgid[16];
1664 } __packed;
1665 
1666 #define OCRDMA_AV_VALID Bit(0)
1667 #define OCRDMA_AV_VLAN_VALID Bit(1)
1668 
1669 struct ocrdma_av {
1671  struct ocrdma_grh grh;
1673 } __packed;
1674 
1675 #endif /* __OCRDMA_SLI_H__ */