3.1.5.4 Sending a Data Transfer Message
After a successful negotiation as described in section 3.1.5.7, all further messages sent on the connection MUST be Data Transfer messages as defined in section 2.2.3. The caller passes:
The Connection to use for the Send message.
A buffer containing the message.
An optional remote memory token to be invalidated on the receiving peer.
It MUST be determined if the buffer contains a message that is of a length greater than Connection.MaxFragmentedSendSize. If so, the message cannot be sent and an implementation-specific local error MUST be returned.
If the buffer is empty, no upper-layer payload is present and the following message fields are set:
Reserved MUST be set to 0x0000.
RemainingDataLength MUST be set to 0x00000000.
DataOffset MUST be set to 0x00000000.
DataLength MUST be set to 0x00000000.
Padding and Buffer are not present.
The empty message is sent as specified in section 3.1.5.1.
Otherwise, the buffer MUST be sent in one or more segments.
For each such segment, the DataOffset and DataLength fields MUST be determined to send the segment, as required.
The DataOffset MUST be 8-byte aligned in the message.
DataLength MUST have a maximum value such that DataOffset plus DataLength does not exceed Connection.MaxSendSize.
The value of DataOffset SHOULD be 24, and DataLength SHOULD be the smaller of the size of the passed in buffer, or Connection.MaxSendSize - 24, and both MAY be set to any other valid values.
The following message fields are set in the segment:
If no bytes of the buffer remain to be sent after the current segment, the RemainingDataLength field MUST be set to 0x00000000, otherwise the RemainingDataLength field MUST be set to the total size of the buffer not yet sent.
The DataOffset and DataLength fields MUST be set to the values determined.
Padding MUST be set to 0x00000000 for the length indicated by DataOffset - 20.
Buffer MUST contain the DataLength bytes to transmit.
If the caller provided an optional memory token to be invalidated on the remote peer, the token MUST be requested to be included by the RDMA provider with exactly one segment. Additional segments, if any, are prepared until the RemainingDataLength field is zero.
The resulting sequence of one or more messages MUST be sent in strict sequential order on the Connection via the interface specified in section 3.1.5.1. If any Send messages result in failure, the RDMA layer will have initiated termination of the connection. The result of the operation from the RDMA provider MUST be returned to the caller.