diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2006-03-04 00:54:13 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-03-20 13:08:23 -0500 |
commit | f36e1793e25513380cae5958a9164d4cc4458ad0 (patch) | |
tree | aa31d34ee07971645af6f21068709166420caee2 /include/rdma | |
parent | 6ecb0c849625e830ab96495d473bb704812c30e1 (diff) |
IB/umad: Add support for large RMPP transfers
Add support for sending and receiving large RMPP transfers. The old
code supports transfers only as large as a single contiguous kernel
memory allocation. This patch uses linked list of memory buffers when
sending and receiving data to avoid needing contiguous pages for
larger transfers.
Receive side: copy the arriving MADs in chunks instead of coalescing
to one large buffer in kernel space.
Send side: split a multipacket MAD buffer to a list of segments,
(multipacket_list) and send these using a gather list of size 2.
Also, save pointer to last sent segment, and retrieve requested
segments by walking list starting at last sent segment. Finally,
save pointer to last-acked segment. When retrying, retrieve
segments for resending relative to this pointer. When updating last
ack, start at this pointer.
Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/ib_mad.h | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index 2c133506742b..51ab8eddb295 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 33 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
34 | * SOFTWARE. | 34 | * SOFTWARE. |
35 | * | 35 | * |
36 | * $Id: ib_mad.h 2775 2005-07-02 13:42:12Z halr $ | 36 | * $Id: ib_mad.h 5596 2006-03-03 01:00:07Z sean.hefty $ |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #if !defined( IB_MAD_H ) | 39 | #if !defined( IB_MAD_H ) |
@@ -208,15 +208,23 @@ struct ib_class_port_info | |||
208 | /** | 208 | /** |
209 | * ib_mad_send_buf - MAD data buffer and work request for sends. | 209 | * ib_mad_send_buf - MAD data buffer and work request for sends. |
210 | * @next: A pointer used to chain together MADs for posting. | 210 | * @next: A pointer used to chain together MADs for posting. |
211 | * @mad: References an allocated MAD data buffer. | 211 | * @mad: References an allocated MAD data buffer for MADs that do not have |
212 | * RMPP active. For MADs using RMPP, references the common and management | ||
213 | * class specific headers. | ||
212 | * @mad_agent: MAD agent that allocated the buffer. | 214 | * @mad_agent: MAD agent that allocated the buffer. |
213 | * @ah: The address handle to use when sending the MAD. | 215 | * @ah: The address handle to use when sending the MAD. |
214 | * @context: User-controlled context fields. | 216 | * @context: User-controlled context fields. |
217 | * @hdr_len: Indicates the size of the data header of the MAD. This length | ||
218 | * includes the common MAD, RMPP, and class specific headers. | ||
219 | * @data_len: Indicates the total size of user-transferred data. | ||
220 | * @seg_count: The number of RMPP segments allocated for this send. | ||
221 | * @seg_size: Size of each RMPP segment. | ||
215 | * @timeout_ms: Time to wait for a response. | 222 | * @timeout_ms: Time to wait for a response. |
216 | * @retries: Number of times to retry a request for a response. | 223 | * @retries: Number of times to retry a request for a response. |
217 | * | 224 | * |
218 | * Users are responsible for initializing the MAD buffer itself, with the | 225 | * Users are responsible for initializing the MAD buffer itself, with the |
219 | * exception of specifying the payload length field in any RMPP MAD. | 226 | * exception of any RMPP header. Additional segment buffer space allocated |
227 | * beyond data_len is padding. | ||
220 | */ | 228 | */ |
221 | struct ib_mad_send_buf { | 229 | struct ib_mad_send_buf { |
222 | struct ib_mad_send_buf *next; | 230 | struct ib_mad_send_buf *next; |
@@ -224,6 +232,10 @@ struct ib_mad_send_buf { | |||
224 | struct ib_mad_agent *mad_agent; | 232 | struct ib_mad_agent *mad_agent; |
225 | struct ib_ah *ah; | 233 | struct ib_ah *ah; |
226 | void *context[2]; | 234 | void *context[2]; |
235 | int hdr_len; | ||
236 | int data_len; | ||
237 | int seg_count; | ||
238 | int seg_size; | ||
227 | int timeout_ms; | 239 | int timeout_ms; |
228 | int retries; | 240 | int retries; |
229 | }; | 241 | }; |
@@ -299,7 +311,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent, | |||
299 | * @mad_recv_wc: Received work completion information on the received MAD. | 311 | * @mad_recv_wc: Received work completion information on the received MAD. |
300 | * | 312 | * |
301 | * MADs received in response to a send request operation will be handed to | 313 | * MADs received in response to a send request operation will be handed to |
302 | * the user after the send operation completes. All data buffers given | 314 | * the user before the send operation completes. All data buffers given |
303 | * to registered agents through this routine are owned by the receiving | 315 | * to registered agents through this routine are owned by the receiving |
304 | * client, except for snooping agents. Clients snooping MADs should not | 316 | * client, except for snooping agents. Clients snooping MADs should not |
305 | * modify the data referenced by @mad_recv_wc. | 317 | * modify the data referenced by @mad_recv_wc. |
@@ -485,17 +497,6 @@ int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent); | |||
485 | int ib_post_send_mad(struct ib_mad_send_buf *send_buf, | 497 | int ib_post_send_mad(struct ib_mad_send_buf *send_buf, |
486 | struct ib_mad_send_buf **bad_send_buf); | 498 | struct ib_mad_send_buf **bad_send_buf); |
487 | 499 | ||
488 | /** | ||
489 | * ib_coalesce_recv_mad - Coalesces received MAD data into a single buffer. | ||
490 | * @mad_recv_wc: Work completion information for a received MAD. | ||
491 | * @buf: User-provided data buffer to receive the coalesced buffers. The | ||
492 | * referenced buffer should be at least the size of the mad_len specified | ||
493 | * by @mad_recv_wc. | ||
494 | * | ||
495 | * This call copies a chain of received MAD segments into a single data buffer, | ||
496 | * removing duplicated headers. | ||
497 | */ | ||
498 | void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf); | ||
499 | 500 | ||
500 | /** | 501 | /** |
501 | * ib_free_recv_mad - Returns data buffers used to receive a MAD. | 502 | * ib_free_recv_mad - Returns data buffers used to receive a MAD. |
@@ -590,9 +591,10 @@ int ib_process_mad_wc(struct ib_mad_agent *mad_agent, | |||
590 | * with an initialized work request structure. Users may modify the returned | 591 | * with an initialized work request structure. Users may modify the returned |
591 | * MAD data buffer before posting the send. | 592 | * MAD data buffer before posting the send. |
592 | * | 593 | * |
593 | * The returned data buffer will be cleared. Users are responsible for | 594 | * The returned MAD header, class specific headers, and any padding will be |
594 | * initializing the common MAD and any class specific headers. If @rmpp_active | 595 | * cleared. Users are responsible for initializing the common MAD header, |
595 | * is set, the RMPP header will be initialized for sending. | 596 | * any class specific header, and MAD data area. |
597 | * If @rmpp_active is set, the RMPP header will be initialized for sending. | ||
596 | */ | 598 | */ |
597 | struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, | 599 | struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, |
598 | u32 remote_qpn, u16 pkey_index, | 600 | u32 remote_qpn, u16 pkey_index, |
@@ -601,6 +603,16 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, | |||
601 | gfp_t gfp_mask); | 603 | gfp_t gfp_mask); |
602 | 604 | ||
603 | /** | 605 | /** |
606 | * ib_get_rmpp_segment - returns the data buffer for a given RMPP segment. | ||
607 | * @send_buf: Previously allocated send data buffer. | ||
608 | * @seg_num: number of segment to return | ||
609 | * | ||
610 | * This routine returns a pointer to the data buffer of an RMPP MAD. | ||
611 | * Users must provide synchronization to @send_buf around this call. | ||
612 | */ | ||
613 | void *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf, int seg_num); | ||
614 | |||
615 | /** | ||
604 | * ib_free_send_mad - Returns data buffers used to send a MAD. | 616 | * ib_free_send_mad - Returns data buffers used to send a MAD. |
605 | * @send_buf: Previously allocated send data buffer. | 617 | * @send_buf: Previously allocated send data buffer. |
606 | */ | 618 | */ |