Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
c2_wr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 Ammasso, Inc. All rights reserved.
3  * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
4  *
5  * This software is available to you under a choice of one of two
6  * licenses. You may choose to be licensed under the terms of the GNU
7  * General Public License (GPL) Version 2, available from the file
8  * COPYING in the main directory of this source tree, or the
9  * OpenIB.org BSD license below:
10  *
11  * Redistribution and use in source and binary forms, with or
12  * without modification, are permitted provided that the following
13  * conditions are met:
14  *
15  * - Redistributions of source code must retain the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer.
18  *
19  * - Redistributions in binary form must reproduce the above
20  * copyright notice, this list of conditions and the following
21  * disclaimer in the documentation and/or other materials
22  * provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  */
33 #ifndef _C2_WR_H_
34 #define _C2_WR_H_
35 
36 #ifdef CCDEBUG
37 #define CCWR_MAGIC 0xb07700b0
38 #endif
39 
40 #define C2_QP_NO_ATTR_CHANGE 0xFFFFFFFF
41 
42 /* Maximum allowed size in bytes of private_data exchange
43  * on connect.
44  */
45 #define C2_MAX_PRIVATE_DATA_SIZE 200
46 
47 /*
48  * These types are shared among the adapter, host, and CCIL consumer.
49  */
54 };
55 
61 };
62 
66 };
67 
68 /*
69  * CCIL Work Request Identifiers
70  */
71 enum c2wr_ids {
121  CCWR_INIT, /* WARNING: Don't move this ever again! */
122 
123 
124 
125  /* Add new IDs here */
126 
127 
128 
129  /*
130  * WARNING: CCWR_LAST must always be the last verbs id defined!
131  * All the preceding IDs are fixed, and must not change.
132  * You can add new IDs, but must not remove or reorder
133  * any IDs. If you do, YOU will ruin any hope of
134  * compatibility between versions.
135  */
137 
138  /*
139  * Start over at 1 so that arrays indexed by user wr id's
140  * begin at 1. This is OK since the verbs and user wr id's
141  * are always used on disjoint sets of queues.
142  */
143  /*
144  * The order of the CCWR_SEND_XX verbs must
145  * match the order of the RDMA_OPs
146  */
160 /* WARNING: This must always be the last user wr id defined! */
161 };
162 #define RDMA_SEND_OPCODE_FROM_WR_ID(x) (x+2)
163 
164 /*
165  * SQ/RQ Work Request Types
166  */
180 };
181 
182 struct c2_netaddr {
186 };
187 
188 struct c2_route {
189  u32 ip_addr; /* 0 indicates the default route */
190  u32 netmask; /* netmask associated with dst */
192  union {
193  u32 ipaddr; /* address of the nexthop interface */
194  u8 enaddr[6];
195  } nexthop;
196 };
197 
198 /*
199  * A Scatter Gather Entry.
200  */
201 struct c2_data_addr {
205 };
206 
207 /*
208  * MR and MW flags used by the consumer, RI, and RNIC.
209  */
211  MEM_REMOTE = 0x0001, /* allow mw binds with remote access. */
212  MEM_VA_BASED = 0x0002, /* Not Zero-based */
213  MEM_PBL_COMPLETE = 0x0004, /* PBL array is complete in this msg */
214  MEM_LOCAL_READ = 0x0008, /* allow local reads */
215  MEM_LOCAL_WRITE = 0x0010, /* allow local writes */
216  MEM_REMOTE_READ = 0x0020, /* allow remote reads */
217  MEM_REMOTE_WRITE = 0x0040, /* allow remote writes */
218  MEM_WINDOW_BIND = 0x0080, /* binds allowed */
219  MEM_SHARED = 0x0100, /* set if MR is shared */
220  MEM_STAG_VALID = 0x0200 /* set if STAG is in valid state */
221 };
222 
223 /*
224  * CCIL API ACF flags defined in terms of the low level mem flags.
225  * This minimizes translation needed in the user API
226  */
227 enum c2_acf {
233 };
234 
235 /*
236  * Image types of objects written to flash
237  */
238 #define C2_FLASH_IMG_BITFILE 1
239 #define C2_FLASH_IMG_OPTION_ROM 2
240 #define C2_FLASH_IMG_VPD 3
241 
242 /*
243  * to fix bug 1815 we define the max size allowable of the
244  * terminate message (per the IETF spec).Refer to the IETF
245  * protocol specification, section 12.1.6, page 64)
246  * The message is prefixed by 20 types of DDP info.
247  *
248  * Then the message has 6 bytes for the terminate control
249  * and DDP segment length info plus a DDP header (either
250  * 14 or 18 byts) plus 28 bytes for the RDMA header.
251  * Thus the max size in:
252  * 20 + (6 + 18 + 28) = 72
253  */
254 #define C2_MAX_TERMINATE_MESSAGE_SIZE (72)
255 
256 /*
257  * Build String Length. It must be the same as C2_BUILD_STR_LEN in ccil_api.h
258  */
259 #define WR_BUILD_STR_LEN 64
260 
261 /*
262  * WARNING: All of these structs need to align any 64bit types on
263  * 64 bit boundaries! 64bit types include u64 and u64.
264  */
265 
266 /*
267  * Clustercore Work Request Header. Be sensitive to field layout
268  * and alignment.
269  */
270 struct c2wr_hdr {
271  /* wqe_count is part of the cqe. It is put here so the
272  * adapter can write to it while the wr is pending without
273  * clobbering part of the wr. This word need not be dma'd
274  * from the host to adapter by libccil, but we copy it anyway
275  * to make the memcpy to the adapter better aligned.
276  */
278 
279  /* Put these fields next so that later 32- and 64-bit
280  * quantities are naturally aligned.
281  */
283  u8 result; /* adapter -> host */
284  u8 sge_count; /* host -> adapter */
285  u8 flags; /* host -> adapter */
286 
288 #ifdef CCMSGMAGIC
289  u32 magic;
290  u32 pad;
291 #endif
292 } __attribute__((packed));
293 
294 /*
295  *------------------------ RNIC ------------------------
296  */
297 
298 /*
299  * WR_RNIC_OPEN
300  */
301 
302 /*
303  * Flags for the RNIC WRs
304  */
306  RNIC_IRD_STATIC = 0x0001,
307  RNIC_ORD_STATIC = 0x0002,
308  RNIC_QP_STATIC = 0x0004,
313  RNIC_PRIV_MODE = 0x0080
314 };
315 
317  struct c2wr_hdr hdr;
319  __be16 flags; /* See enum c2_rnic_flags */
321 } __attribute__((packed));
324  struct c2wr_hdr hdr;
326 } __attribute__((packed));
327 
331 } __attribute__((packed));
334  struct c2wr_hdr hdr;
336 } __attribute__((packed));
337 
338 /*
339  * WR_RNIC_QUERY
340  */
342  struct c2wr_hdr hdr;
372 } __attribute__((packed));
373 
377 } __attribute__((packed));
379 /*
380  * WR_RNIC_GETCONFIG
381  */
384  struct c2wr_hdr hdr;
386  u32 option; /* see c2_getconfig_cmd_t */
389 } __attribute__((packed)) ;
392  struct c2wr_hdr hdr;
393  u32 option; /* see c2_getconfig_cmd_t */
394  u32 count_len; /* length of the number of addresses configured */
395 } __attribute__((packed)) ;
400 } __attribute__((packed)) ;
402 /*
403  * WR_RNIC_SETCONFIG
404  */
406  struct c2wr_hdr hdr;
408  __be32 option; /* See c2_setconfig_cmd_t */
409  /* variable data and pad. See c2_netaddr and c2_route */
410  u8 data[0];
411 } __attribute__((packed)) ;
412 
414  struct c2wr_hdr hdr;
415 } __attribute__((packed)) ;
420 } __attribute__((packed)) ;
421 
422 /*
423  * WR_RNIC_CLOSE
424  */
426  struct c2wr_hdr hdr;
428 } __attribute__((packed)) ;
429 
431  struct c2wr_hdr hdr;
432 } __attribute__((packed)) ;
433 
437 } __attribute__((packed)) ;
438 
439 /*
440  *------------------------ CQ ------------------------
441  */
443  struct c2wr_hdr hdr;
450 } __attribute__((packed)) ;
451 
453  struct c2wr_hdr hdr;
457 } __attribute__((packed)) ;
458 
462 } __attribute__((packed)) ;
463 
465  struct c2wr_hdr hdr;
470 } __attribute__((packed)) ;
471 
473  struct c2wr_hdr hdr;
474 } __attribute__((packed)) ;
479 } __attribute__((packed)) ;
480 
482  struct c2wr_hdr hdr;
485 } __attribute__((packed)) ;
486 
488  struct c2wr_hdr hdr;
489 } __attribute__((packed)) ;
490 
494 } __attribute__((packed)) ;
495 
496 /*
497  *------------------------ PD ------------------------
498  */
500  struct c2wr_hdr hdr;
503 } __attribute__((packed)) ;
504 
506  struct c2wr_hdr hdr;
507 } __attribute__((packed)) ;
508 
512 } __attribute__((packed)) ;
513 
515  struct c2wr_hdr hdr;
518 } __attribute__((packed)) ;
519 
521  struct c2wr_hdr hdr;
522 } __attribute__((packed)) ;
523 
527 } __attribute__((packed)) ;
528 
529 /*
530  *------------------------ SRQ ------------------------
531  */
533  struct c2wr_hdr hdr;
541 } __attribute__((packed)) ;
542 
544  struct c2wr_hdr hdr;
551 } __attribute__((packed)) ;
552 
556 } __attribute__((packed)) ;
559  struct c2wr_hdr hdr;
562 } __attribute__((packed)) ;
563 
565  struct c2wr_hdr hdr;
566 } __attribute__((packed)) ;
567 
571 } __attribute__((packed)) ;
572 
573 /*
574  *------------------------ QP ------------------------
575  */
577  QP_RDMA_READ = 0x00000001, /* RDMA read enabled? */
578  QP_RDMA_WRITE = 0x00000002, /* RDMA write enabled? */
579  QP_MW_BIND = 0x00000004, /* MWs enabled */
580  QP_ZERO_STAG = 0x00000008, /* enabled? */
581  QP_REMOTE_TERMINATION = 0x00000010, /* remote end terminated */
582  QP_RDMA_READ_RESPONSE = 0x00000020 /* Remote RDMA read */
583  /* enabled? */
584 };
585 
587  struct c2wr_hdr hdr;
598  __be32 flags; /* see enum c2wr_qp_flags */
605 } __attribute__((packed)) ;
606 
608  struct c2wr_hdr hdr;
623 } __attribute__((packed)) ;
624 
628 } __attribute__((packed)) ;
629 
631  struct c2wr_hdr hdr;
634 } __attribute__((packed)) ;
637  struct c2wr_hdr hdr;
648  u16 flags; /* see c2wr_qp_flags_t */
654  u32 terminate_msg_length; /* 0 if not present */
655  u8 data[0];
656  /* Terminate Message in-line here. */
657 } __attribute__((packed)) ;
658 
662 } __attribute__((packed)) ;
663 
665  struct c2wr_hdr hdr;
676 } __attribute__((packed)) ;
677 
679  struct c2wr_hdr hdr;
690 } __attribute__((packed)) ;
691 
695 } __attribute__((packed)) ;
696 
698  struct c2wr_hdr hdr;
701 } __attribute__((packed)) ;
702 
704  struct c2wr_hdr hdr;
705 } __attribute__((packed)) ;
706 
710 } __attribute__((packed)) ;
711 
712 /*
713  * The CCWR_QP_CONNECT msg is posted on the verbs request queue. It can
714  * only be posted when a QP is in IDLE state. After the connect request is
715  * submitted to the LLP, the adapter moves the QP to CONNECT_PENDING state.
716  * No synchronous reply from adapter to this WR. The results of
717  * connection are passed back in an async event CCAE_ACTIVE_CONNECT_RESULTS
718  * See c2wr_ae_active_connect_results_t
719  */
721  struct c2wr_hdr hdr;
728  u8 private_data[0]; /* Private data in-line. */
729 } __attribute__((packed)) ;
730 
733  /* no synchronous reply. */
734 } __attribute__((packed)) ;
737 /*
738  *------------------------ MM ------------------------
739  */
740 
742  struct c2wr_hdr hdr;
747 } __attribute__((packed)) ;
748 
750  struct c2wr_hdr hdr;
753 } __attribute__((packed)) ;
754 
758 } __attribute__((packed)) ;
759 
761  struct c2wr_hdr hdr;
773  /* array of paddrs (must be aligned on a 64bit boundary) */
775 } __attribute__((packed)) ;
776 
778  struct c2wr_hdr hdr;
781 } __attribute__((packed)) ;
782 
786 } __attribute__((packed)) ;
789  struct c2wr_hdr hdr;
794  /* array of paddrs (must be aligned on a 64bit boundary) */
796 } __attribute__((packed)) ;
797 
799  struct c2wr_hdr hdr;
800 } __attribute__((packed)) ;
801 
805 } __attribute__((packed)) ;
806 
808  struct c2wr_hdr hdr;
811 } __attribute__((packed)) ;
812 
814  struct c2wr_hdr hdr;
816  u8 pad[3];
820 } __attribute__((packed)) ;
821 
825 } __attribute__((packed)) ;
826 
828  struct c2wr_hdr hdr;
831 } __attribute__((packed)) ;
832 
834  struct c2wr_hdr hdr;
836  u8 pad[3];
839 } __attribute__((packed)) ;
840 
844 } __attribute__((packed)) ;
845 
846 
848  struct c2wr_hdr hdr;
851 } __attribute__((packed)) ;
852 
854  struct c2wr_hdr hdr;
855 } __attribute__((packed)) ;
856 
860 } __attribute__((packed)) ;
861 
863  struct c2wr_hdr hdr;
877  /* array of paddrs (must be aligned on a 64bit boundary) */
879 } __attribute__((packed)) ;
880 
882  struct c2wr_hdr hdr;
885 } __attribute__((packed)) ;
886 
890 } __attribute__((packed)) ;
891 
893  struct c2wr_hdr hdr;
901 } __attribute__((packed)) ;
902 
904  struct c2wr_hdr hdr;
906 } __attribute__((packed)) ;
907 
911 } __attribute__((packed)) ;
912 
914  struct c2wr_hdr hdr;
917 } __attribute__((packed)) ;
918 
920  struct c2wr_hdr hdr;
922 } __attribute__((packed)) ;
923 
927 } __attribute__((packed)) ;
928 
929 /*
930  *------------------------ WRs -----------------------
931  */
932 
934  struct c2wr_hdr hdr; /* Has status and WR Type */
935 } __attribute__((packed)) ;
936 
944 };
945 
946 /* Completion queue entry. */
947 struct c2wr_ce {
948  struct c2wr_hdr hdr; /* Has status and WR Type */
949  u64 qp_user_context; /* c2_user_qp_t * */
950  u32 qp_state; /* Current QP State */
951  u32 handle; /* QPID or EP Handle */
952  __be32 bytes_rcvd; /* valid for RECV WCs */
954 } __attribute__((packed)) ;
955 
957 /*
958  * Flags used for all post-sq WRs. These must fit in the flags
959  * field of the struct c2wr_hdr (eight bits).
960  */
961 enum {
962  SQ_SIGNALED = 0x01,
964  SQ_FENCE = 0x04,
965 };
966 
967 /*
968  * Common fields for all post-sq WRs. Namely the standard header and a
969  * secondary header with fields common to all post-sq WRs.
970  */
971 struct c2_sq_hdr {
973 } __attribute__((packed));
975 /*
976  * Same as above but for post-rq WRs.
977  */
978 struct c2_rq_hdr {
980 } __attribute__((packed));
981 
982 /*
983  * use the same struct for all sends.
984  */
989  u8 data[0]; /* SGE array */
990 } __attribute__((packed));
992 union c2wr_send {
994  struct c2wr_ce rep;
995 } __attribute__((packed));
996 
1002  u8 data[0]; /* SGE array */
1003 } __attribute__((packed));
1004 
1007  struct c2wr_ce rep;
1008 } __attribute__((packed));
1009 
1017 } __attribute__((packed));
1018 
1021  struct c2wr_ce rep;
1022 } __attribute__((packed));
1023 
1028  u8 pad[3];
1033 } __attribute__((packed));
1034 
1037  struct c2wr_ce rep;
1038 } __attribute__((packed));
1044  u8 pad[3];
1050  /* array of paddrs (must be aligned on a 64bit boundary) */
1052 } __attribute__((packed));
1053 
1056  struct c2wr_ce rep;
1057 } __attribute__((packed));
1058 
1062  u8 pad[3];
1064 } __attribute__((packed));
1065 
1068  struct c2wr_ce rep;
1069 } __attribute__((packed));
1070 
1071 union c2wr_sqwr {
1082 } __attribute__((packed));
1083 
1085 /*
1086  * RQ WRs
1087  */
1088 struct c2wr_rqwr {
1090  u8 data[0]; /* array of SGEs */
1091 } __attribute__((packed));
1093 union c2wr_recv {
1094  struct c2wr_rqwr req;
1095  struct c2wr_ce rep;
1096 } __attribute__((packed));
1097 
1098 /*
1099  * All AEs start with this header. Most AEs only need to convey the
1100  * information in the header. Some, like LLP connection events, need
1101  * more info. The union typdef c2wr_ae_t has all the possible AEs.
1102  *
1103  * hdr.context is the user_context from the rnic_open WR. NULL If this
1104  * is not affiliated with an rnic
1105  *
1106  * hdr.id is the AE identifier (eg; CCAE_REMOTE_SHUTDOWN,
1107  * CCAE_LLP_CLOSE_COMPLETE)
1108  *
1109  * resource_type is one of: C2_RES_IND_QP, C2_RES_IND_CQ, C2_RES_IND_SRQ
1110  *
1111  * user_context is the context passed down when the host created the resource.
1112  */
1113 struct c2wr_ae_hdr {
1114  struct c2wr_hdr hdr;
1115  u64 user_context; /* user context for this res. */
1116  __be32 resource_type; /* see enum c2_resource_indicator */
1117  __be32 resource; /* handle for resource */
1118  __be32 qp_state; /* current QP State */
1119 } __attribute__((packed));
1120 
1121 /*
1122  * After submitting the CCAE_ACTIVE_CONNECT_RESULTS message on the AEQ,
1123  * the adapter moves the QP into RTS state
1124  */
1132  u8 private_data[0]; /* data is in-line in the msg. */
1133 } __attribute__((packed));
1135 /*
1136  * When connections are established by the stack (and the private data
1137  * MPA frame is received), the adapter will generate an event to the host.
1138  * The details of the connection, any private data, and the new connection
1139  * request handle is passed up via the CCAE_CONNECTION_REQUEST msg on the
1140  * AE queue:
1141  */
1144  u32 cr_handle; /* connreq handle (sock ptr) */
1150  u8 private_data[0]; /* data is in-line in the msg. */
1151 } __attribute__((packed));
1152 
1153 union c2wr_ae {
1157 } __attribute__((packed));
1160  struct c2wr_hdr hdr;
1167 } __attribute__((packed));
1168 
1170  struct c2wr_hdr hdr;
1171 } __attribute__((packed));
1173 union c2wr_init {
1176 } __attribute__((packed));
1177 
1178 /*
1179  * For upgrading flash.
1180  */
1181 
1183  struct c2wr_hdr hdr;
1185 } __attribute__((packed));
1186 
1188  struct c2wr_hdr hdr;
1191 } __attribute__((packed));
1192 
1196 } __attribute__((packed));
1197 
1199  struct c2wr_hdr hdr;
1202 } __attribute__((packed));
1203 
1205  struct c2wr_hdr hdr;
1207 } __attribute__((packed));
1208 
1209 union c2wr_flash {
1212 } __attribute__((packed));
1213 
1215  struct c2wr_hdr hdr;
1218 } __attribute__((packed));
1219 
1221  struct c2wr_hdr hdr;
1222  u32 offset; /* 0 if mem not available */
1223  u32 size; /* 0 if mem not available */
1224 } __attribute__((packed));
1225 
1229 } __attribute__((packed));
1230 
1232  struct c2wr_hdr hdr;
1234  u32 offset; /* Must match value from alloc */
1235  u32 size; /* Must match value from alloc */
1236 } __attribute__((packed));
1237 
1239  struct c2wr_hdr hdr;
1240 } __attribute__((packed));
1241 
1244  struct c2wr_ce rep;
1245 } __attribute__((packed));
1246 
1248  struct c2wr_hdr hdr;
1254 } __attribute__((packed));
1255 
1257  struct c2wr_hdr hdr;
1259 } __attribute__((packed));
1260 
1264 } __attribute__((packed));
1265 
1266 /*
1267  * Messages for LLP connection setup.
1268  */
1269 
1270 /*
1271  * Listen Request. This allocates a listening endpoint to allow passive
1272  * connection setup. Newly established LLP connections are passed up
1273  * via an AE. See c2wr_ae_connection_request_t
1274  */
1276  struct c2wr_hdr hdr;
1277  u64 user_context; /* returned in AEs. */
1279  __be32 local_addr; /* local addr, or 0 */
1280  __be16 local_port; /* 0 means "pick one" */
1282  __be32 backlog; /* tradional tcp listen bl */
1283 } __attribute__((packed));
1284 
1286  struct c2wr_hdr hdr;
1287  u32 ep_handle; /* handle to new listening ep */
1288  u16 local_port; /* resulting port... */
1290 } __attribute__((packed));
1291 
1295 } __attribute__((packed));
1296 
1298  struct c2wr_hdr hdr;
1301 } __attribute__((packed));
1302 
1304  struct c2wr_hdr hdr;
1305 } __attribute__((packed));
1306 
1310 } __attribute__((packed));
1311 
1313  struct c2wr_hdr hdr;
1316 } __attribute__((packed));
1317 
1319  struct c2wr_hdr hdr;
1325 } __attribute__((packed));
1326 
1330 } __attribute__((packed));
1331 
1332 
1333 /*
1334  * The host passes this down to indicate acceptance of a pending iWARP
1335  * connection. The cr_handle was obtained from the CONNECTION_REQUEST
1336  * AE passed up by the adapter. See c2wr_ae_connection_request_t.
1337  */
1339  struct c2wr_hdr hdr;
1341  u32 qp_handle; /* QP to bind to this LLP conn */
1342  u32 ep_handle; /* LLP handle to accept */
1344  u8 private_data[0]; /* data in-line in msg. */
1345 } __attribute__((packed));
1346 
1347 /*
1348  * adapter sends reply when private data is successfully submitted to
1349  * the LLP.
1350  */
1352  struct c2wr_hdr hdr;
1353 } __attribute__((packed));
1354 
1358 } __attribute__((packed));
1359 
1360 /*
1361  * The host sends this down if a given iWARP connection request was
1362  * rejected by the consumer. The cr_handle was obtained from a
1363  * previous c2wr_ae_connection_request_t AE sent by the adapter.
1364  */
1366  struct c2wr_hdr hdr;
1368  u32 ep_handle; /* LLP handle to reject */
1369 } __attribute__((packed));
1370 
1371 /*
1372  * Dunno if this is needed, but we'll add it for now. The adapter will
1373  * send the reject_reply after the LLP endpoint has been destroyed.
1374  */
1376  struct c2wr_hdr hdr;
1377 } __attribute__((packed));
1378 
1382 } __attribute__((packed));
1383 
1384 /*
1385  * console command. Used to implement a debug console over the verbs
1386  * request and reply queues.
1387  */
1388 
1389 /*
1390  * Console request message. It contains:
1391  * - message hdr with id = CCWR_CONSOLE
1392  * - the physaddr/len of host memory to be used for the reply.
1393  * - the command string. eg: "netstat -s" or "zoneinfo"
1394  */
1396  struct c2wr_hdr hdr; /* id = CCWR_CONSOLE */
1397  u64 reply_buf; /* pinned host buf for reply */
1398  u32 reply_buf_len; /* length of reply buffer */
1399  u8 command[0]; /* NUL terminated ascii string */
1400  /* containing the command req */
1401 } __attribute__((packed));
1402 
1403 /*
1404  * flags used in the console reply.
1405  */
1407  CONS_REPLY_TRUNCATED = 0x00000001 /* reply was truncated */
1408 } __attribute__((packed));
1410 /*
1411  * Console reply message.
1412  * hdr.result contains the c2_status_t error if the reply was _not_ generated,
1413  * or C2_OK if the reply was generated.
1414  */
1416  struct c2wr_hdr hdr; /* id = CCWR_CONSOLE */
1418 } __attribute__((packed));
1419 
1423 } __attribute__((packed));
1424 
1425 
1426 /*
1427  * Giant union with all WRs. Makes life easier...
1428  */
1429 union c2wr {
1430  struct c2wr_hdr hdr;
1456  struct c2wr_rqwr rqwr;
1457  struct c2wr_ce ce;
1458  union c2wr_ae ae;
1470 } __attribute__((packed));
1471 
1472 
1473 /*
1474  * Accessors for the wr fields that are packed together tightly to
1475  * reduce the wr message size. The wr arguments are void* so that
1476  * either a struct c2wr*, a struct c2wr_hdr*, or a pointer to any of the types
1477  * in the struct c2wr union can be passed in.
1478  */
1479 static __inline__ u8 c2_wr_get_id(void *wr)
1481  return ((struct c2wr_hdr *) wr)->id;
1483 static __inline__ void c2_wr_set_id(void *wr, u8 id)
1485  ((struct c2wr_hdr *) wr)->id = id;
1487 static __inline__ u8 c2_wr_get_result(void *wr)
1489  return ((struct c2wr_hdr *) wr)->result;
1491 static __inline__ void c2_wr_set_result(void *wr, u8 result)
1493  ((struct c2wr_hdr *) wr)->result = result;
1495 static __inline__ u8 c2_wr_get_flags(void *wr)
1497  return ((struct c2wr_hdr *) wr)->flags;
1499 static __inline__ void c2_wr_set_flags(void *wr, u8 flags)
1501  ((struct c2wr_hdr *) wr)->flags = flags;
1503 static __inline__ u8 c2_wr_get_sge_count(void *wr)
1505  return ((struct c2wr_hdr *) wr)->sge_count;
1507 static __inline__ void c2_wr_set_sge_count(void *wr, u8 sge_count)
1509  ((struct c2wr_hdr *) wr)->sge_count = sge_count;
1511 static __inline__ __be32 c2_wr_get_wqe_count(void *wr)
1512 {
1513  return ((struct c2wr_hdr *) wr)->wqe_count;
1514 }
1515 static __inline__ void c2_wr_set_wqe_count(void *wr, u32 wqe_count)
1516 {
1517  ((struct c2wr_hdr *) wr)->wqe_count = wqe_count;
1518 }
1519 
1520 #endif /* _C2_WR_H_ */