diff options
author | Hal Rosenstock <halr@voltaire.com> | 2005-07-27 14:45:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:26:09 -0400 |
commit | 824c8ae7d05bb4d21af707832c5bfa45d5494ec8 (patch) | |
tree | ce268a0f9268efae69fc4735b0d650d19aeec6e6 /drivers/infiniband/include/ib_mad.h | |
parent | b82cab6b331b51d82f90d2207f3bbfdf09361ac9 (diff) |
[PATCH] IB: Add MAD helper functions
Add new helper routines for allocating MADs for sending and formatting a send
WR.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/include/ib_mad.h')
-rw-r--r-- | drivers/infiniband/include/ib_mad.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/infiniband/include/ib_mad.h b/drivers/infiniband/include/ib_mad.h index 60378c1a9ccf..a6f06b8c4acf 100644 --- a/drivers/infiniband/include/ib_mad.h +++ b/drivers/infiniband/include/ib_mad.h | |||
@@ -39,6 +39,8 @@ | |||
39 | #if !defined( IB_MAD_H ) | 39 | #if !defined( IB_MAD_H ) |
40 | #define IB_MAD_H | 40 | #define IB_MAD_H |
41 | 41 | ||
42 | #include <linux/pci.h> | ||
43 | |||
42 | #include <ib_verbs.h> | 44 | #include <ib_verbs.h> |
43 | 45 | ||
44 | /* Management base version */ | 46 | /* Management base version */ |
@@ -73,6 +75,7 @@ | |||
73 | #define IB_QP0 0 | 75 | #define IB_QP0 0 |
74 | #define IB_QP1 __constant_htonl(1) | 76 | #define IB_QP1 __constant_htonl(1) |
75 | #define IB_QP1_QKEY 0x80010000 | 77 | #define IB_QP1_QKEY 0x80010000 |
78 | #define IB_QP_SET_QKEY 0x80000000 | ||
76 | 79 | ||
77 | struct ib_grh { | 80 | struct ib_grh { |
78 | u32 version_tclass_flow; | 81 | u32 version_tclass_flow; |
@@ -124,6 +127,30 @@ struct ib_vendor_mad { | |||
124 | u8 data[216]; | 127 | u8 data[216]; |
125 | } __attribute__ ((packed)); | 128 | } __attribute__ ((packed)); |
126 | 129 | ||
130 | /** | ||
131 | * ib_mad_send_buf - MAD data buffer and work request for sends. | ||
132 | * @mad: References an allocated MAD data buffer. The size of the data | ||
133 | * buffer is specified in the @send_wr.length field. | ||
134 | * @mapping: DMA mapping information. | ||
135 | * @mad_agent: MAD agent that allocated the buffer. | ||
136 | * @context: User-controlled context fields. | ||
137 | * @send_wr: An initialized work request structure used when sending the MAD. | ||
138 | * The wr_id field of the work request is initialized to reference this | ||
139 | * data structure. | ||
140 | * @sge: A scatter-gather list referenced by the work request. | ||
141 | * | ||
142 | * Users are responsible for initializing the MAD buffer itself, with the | ||
143 | * exception of specifying the payload length field in any RMPP MAD. | ||
144 | */ | ||
145 | struct ib_mad_send_buf { | ||
146 | struct ib_mad *mad; | ||
147 | DECLARE_PCI_UNMAP_ADDR(mapping) | ||
148 | struct ib_mad_agent *mad_agent; | ||
149 | void *context[2]; | ||
150 | struct ib_send_wr send_wr; | ||
151 | struct ib_sge sge; | ||
152 | }; | ||
153 | |||
127 | struct ib_mad_agent; | 154 | struct ib_mad_agent; |
128 | struct ib_mad_send_wc; | 155 | struct ib_mad_send_wc; |
129 | struct ib_mad_recv_wc; | 156 | struct ib_mad_recv_wc; |
@@ -402,4 +429,37 @@ struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp, | |||
402 | int ib_process_mad_wc(struct ib_mad_agent *mad_agent, | 429 | int ib_process_mad_wc(struct ib_mad_agent *mad_agent, |
403 | struct ib_wc *wc); | 430 | struct ib_wc *wc); |
404 | 431 | ||
432 | /** | ||
433 | * ib_create_send_mad - Allocate and initialize a data buffer and work request | ||
434 | * for sending a MAD. | ||
435 | * @mad_agent: Specifies the registered MAD service to associate with the MAD. | ||
436 | * @remote_qpn: Specifies the QPN of the receiving node. | ||
437 | * @pkey_index: Specifies which PKey the MAD will be sent using. This field | ||
438 | * is valid only if the remote_qpn is QP 1. | ||
439 | * @ah: References the address handle used to transfer to the remote node. | ||
440 | * @hdr_len: Indicates the size of the data header of the MAD. This length | ||
441 | * should include the common MAD header, RMPP header, plus any class | ||
442 | * specific header. | ||
443 | * @data_len: Indicates the size of any user-transfered data. The call will | ||
444 | * automatically adjust the allocated buffer size to account for any | ||
445 | * additional padding that may be necessary. | ||
446 | * @gfp_mask: GFP mask used for the memory allocation. | ||
447 | * | ||
448 | * This is a helper routine that may be used to allocate a MAD. Users are | ||
449 | * not required to allocate outbound MADs using this call. The returned | ||
450 | * MAD send buffer will reference a data buffer usable for sending a MAD, along | ||
451 | * with an intialized work request structure. | ||
452 | */ | ||
453 | struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, | ||
454 | u32 remote_qpn, u16 pkey_index, | ||
455 | struct ib_ah *ah, | ||
456 | int hdr_len, int data_len, | ||
457 | unsigned int __nocast gfp_mask); | ||
458 | |||
459 | /** | ||
460 | * ib_free_send_mad - Returns data buffers used to send a MAD. | ||
461 | * @send_buf: Previously allocated send data buffer. | ||
462 | */ | ||
463 | void ib_free_send_mad(struct ib_mad_send_buf *send_buf); | ||
464 | |||
405 | #endif /* IB_MAD_H */ | 465 | #endif /* IB_MAD_H */ |