idnits 2.17.1 draft-ietf-nfsv4-rpcrdma-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 16. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 1541. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 1551. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 1558. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 1564. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == The document seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. -- The exact meaning of the all-uppercase expression 'NOT REQUIRED' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: Flow control for RDMA Send operations is implemented as a simple request/grant protocol in the RPC over RDMA header associated with each RPC message. The RPC over RDMA header for RPC call messages contains a requested credit value for the RPC server, which MAY be dynamically adjusted by the caller to match its expected needs. The RPC over RDMA header for the RPC reply messages provides the granted result, which MAY have any value except it MAY NOT be zero when no in-progress operations are present at the server, since such a value would result in deadlock. The value MAY be adjusted up or down at each opportunity to match the server's needs or policies. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: The RPC over RDMA header begins with four 32-bit fields that are always present and which control the RDMA interaction including RDMA-specific flow control. These are then followed by a number of items such as chunk lists and padding which MAY or MAY NOT be present depending on the type of transmission. The four fields which are always present are: == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: 3. Flow control credit value. When sent in an RPC call message, the requested value is provided. When sent in an RPC reply message, the granted value is returned. RPC calls SHOULD not be sent in excess of the currently granted limit. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (May 7, 2007) is 6191 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '8' on line 1001 ** Downref: Normative reference to an Informational RFC: RFC 1094 ** Obsolete normative reference: RFC 1831 (Obsoleted by RFC 5531) ** Downref: Normative reference to an Informational RFC: RFC 1813 ** Obsolete normative reference: RFC 3530 (Obsoleted by RFC 7530) Summary: 5 errors (**), 0 flaws (~~), 5 warnings (==), 11 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NFSv4 Working Group Tom Talpey 3 Internet-Draft Network Appliance, Inc. 4 Intended status: Standards Track Brent Callaghan 5 Expires: November 8, 2007 Apple Computer, Inc. 6 May 7, 2007 8 RDMA Transport for ONC RPC 9 draft-ietf-nfsv4-rpcrdma-05 11 Status of this Memo 13 By submitting this Internet-Draft, each author represents that any 14 applicable patent or other IPR claims of which he or she is aware 15 have been or will be disclosed, and any of which he or she becomes 16 aware will be disclosed, in accordance with Section 6 of BCP 79. 18 Internet-Drafts are working documents of the Internet Engineering 19 Task Force (IETF), its areas, and its working groups. Note that 20 other groups may also distribute working documents as Internet- 21 Drafts. 23 Internet-Drafts are draft documents valid for a maximum of six 24 months and may be updated, replaced, or obsoleted by other 25 documents at any time. It is inappropriate to use Internet-Drafts 26 as reference material or to cite them other than as "work in 27 progress." 29 The list of current Internet-Drafts can be accessed at 30 http://www.ietf.org/ietf/1id-abstracts.txt 32 The list of Internet-Draft Shadow Directories can be accessed at 33 http://www.ietf.org/shadow.html. 35 This Internet-Draft will expire on November 8, 2007. 37 Copyright Notice 39 Copyright (C) The IETF Trust (2007). 41 Abstract 43 A protocol is described providing RDMA as a new transport for ONC 44 RPC. The RDMA transport binding conveys the benefits of efficient, 45 bulk data transport over high speed networks, while providing for 46 minimal change to RPC applications and with no required revision of 47 the application RPC protocol, or the RPC protocol itself. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 52 2. Abstract RDMA Requirements . . . . . . . . . . . . . . . . . 3 53 3. Protocol Outline . . . . . . . . . . . . . . . . . . . . . . 4 54 3.1. Short Messages . . . . . . . . . . . . . . . . . . . . . . 5 55 3.2. Data Chunks . . . . . . . . . . . . . . . . . . . . . . . 5 56 3.3. Flow Control . . . . . . . . . . . . . . . . . . . . . . . 6 57 3.4. XDR Encoding with Chunks . . . . . . . . . . . . . . . . . 7 58 3.5. XDR Decoding with Read Chunks . . . . . . . . . . . . . 11 59 3.6. XDR Decoding with Write Chunks . . . . . . . . . . . . . 11 60 3.7. XDR Roundup and Chunks . . . . . . . . . . . . . . . . . 12 61 3.8. RPC Call and Reply . . . . . . . . . . . . . . . . . . . 13 62 3.9. Padding . . . . . . . . . . . . . . . . . . . . . . . . 16 63 4. RPC RDMA Message Layout . . . . . . . . . . . . . . . . . 17 64 4.1. RPC over RDMA Header . . . . . . . . . . . . . . . . . . 17 65 4.2. RPC over RDMA header errors . . . . . . . . . . . . . . 19 66 4.3. XDR Language Description . . . . . . . . . . . . . . . . 19 67 5. Long Messages . . . . . . . . . . . . . . . . . . . . . . 22 68 5.1. Message as an RDMA Read Chunk . . . . . . . . . . . . . 22 69 5.2. RDMA Write of Long Replies (Reply Chunks) . . . . . . . 24 70 6. Connection Configuration Protocol . . . . . . . . . . . . 25 71 6.1. Initial Connection State . . . . . . . . . . . . . . . . 26 72 6.2. Protocol Description . . . . . . . . . . . . . . . . . . 26 73 7. Memory Registration Overhead . . . . . . . . . . . . . . . 28 74 8. Errors and Error Recovery . . . . . . . . . . . . . . . . 28 75 9. Node Addressing . . . . . . . . . . . . . . . . . . . . . 28 76 10. RPC Binding . . . . . . . . . . . . . . . . . . . . . . . 29 77 11. Security . . . . . . . . . . . . . . . . . . . . . . . . 30 78 12. IANA Considerations . . . . . . . . . . . . . . . . . . . 30 79 13. Acknowledgements . . . . . . . . . . . . . . . . . . . . 31 80 14. Normative References . . . . . . . . . . . . . . . . . . 31 81 15. Informative References . . . . . . . . . . . . . . . . . 32 82 16. Authors' Addresses . . . . . . . . . . . . . . . . . . . 33 83 17. Intellectual Property and Copyright Statements . . . . . 33 84 Acknowledgment . . . . . . . . . . . . . . . . . . . . . . . . 34 86 Requirements Language 88 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 89 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in 90 this document are to be interpreted as described in [RFC2119]. 92 1. Introduction 94 RDMA is a technique for efficient movement of data between end 95 nodes, which becomes increasingly compelling over high speed 96 transports. By directing data into destination buffers as it is 97 sent on a network, and placing it via direct memory access by 98 hardware, the double benefit of faster transfers and reduced host 99 overhead is obtained. 101 ONC RPC [RFC1831] is a remote procedure call protocol that has been 102 run over a variety of transports. Most RPC implementations today 103 use UDP or TCP. RPC messages are defined in terms of an eXternal 104 Data Representation (XDR) [RFC4506] which provides a canonical data 105 representation across a variety of host architectures. An XDR data 106 stream is conveyed differently on each type of transport. On UDP, 107 RPC messages are encapsulated inside datagrams, while on a TCP byte 108 stream, RPC messages are delineated by a record marking protocol. 109 An RDMA transport also conveys RPC messages in a unique fashion 110 that must be fully described if client and server implementations 111 are to interoperate. 113 RDMA transports present new semantics unlike the behaviors of 114 either UDP and TCP alone. They retain message delineations like 115 UDP while also providing a reliable, sequenced data transfer like 116 TCP. And, they provide the new efficient, bulk transfer service of 117 RDMA. RDMA transports are therefore naturally viewed as a new 118 transport type by ONC RPC. 120 RDMA as a transport will benefit the performance of RPC protocols 121 that move large "chunks" of data, since RDMA hardware excels at 122 moving data efficiently between host memory and a high speed 123 network with little or no host CPU involvement. In this context, 124 the NFS protocol, in all its versions [RFC1094] [RFC1813] [RFC3530] 125 [NFSv4.1], is an obvious beneficiary of RDMA. A complete problem 126 statement is discussed in [NFSRDMAPS], and related NFSv4 issues are 127 discussed in [NFSv4.1]. Many other RPC-based protocols will also 128 benefit. 130 Although the RDMA transport described here provides relatively 131 transparent support for any RPC application, the proposal goes 132 further in describing mechanisms that can optimize the use of RDMA 133 with more active participation by the RPC application. 135 2. Abstract RDMA Requirements 137 An RPC transport is responsible for conveying an RPC message from a 138 sender to a receiver. An RPC message is either an RPC call from a 139 client to a server, or an RPC reply from the server back to the 140 client. An RPC message contains an RPC call header followed by 141 arguments if the message is an RPC call, or an RPC reply header 142 followed by results if the message is an RPC reply. The call 143 header contains a transaction ID (XID) followed by the program and 144 procedure number as well as a security credential. An RPC reply 145 header begins with an XID that matches that of the RPC call 146 message, followed by a security verifier and results. All data in 147 an RPC message is XDR encoded. For a complete description of the 148 RPC protocol and XDR encoding, see [RFC1831] and [RFC4506]. 150 This protocol assumes the following abstract model for RDMA 151 transports. These terms, common in the RDMA lexicon, are used in 152 this document. A more complete glossary of RDMA terms can be found 153 in [RDMAP]. 155 o Registered Memory 156 All data moved via tagged RDMA operations is resident in 157 registered memory at its destination. This protocol assumes 158 that each segment of registered memory MUST be identified with 159 a steering tag of no more than 32 bits and memory addresses of 160 up to 64 bits in length. 162 o RDMA Send 163 The RDMA provider supports an RDMA Send operation with 164 completion signalled at the receiver when data is placed in a 165 pre-posted buffer. The amount of transferred data is limited 166 only by the size of the receiver's buffer. Sends complete at 167 the receiver in the order they were issued at the sender. 169 o RDMA Write 170 The RDMA provider supports an RDMA Write operation to directly 171 place data in the receiver's buffer. An RDMA Write is 172 initiated by the sender and completion is signalled at the 173 sender. No completion is signalled at the receiver. The 174 sender uses a steering tag, memory address and length of the 175 remote destination buffer. RDMA Writes are not necessarily 176 ordered with respect to one another, but are ordered with 177 respect to RDMA Sends; a subsequent RDMA Send completion 178 obtained at the receiver guarantees that prior RDMA Write data 179 has been successfully placed in the receiver's memory. 181 o RDMA Read 182 The RDMA provider supports an RDMA Read operation to directly 183 place peer source data in the requester's buffer. An RDMA 184 Read is initiated by the receiver and completion is signalled 185 at the receiver. The receiver provides steering tags, memory 186 addresses and a length for the remote source and local 187 destination buffers. Since the peer at the data source 188 receives no notification of RDMA Read completion, there is an 189 assumption that on receiving the data the receiver will signal 190 completion with an RDMA Send message, so that the peer can 191 free the source buffers and the associated steering tags. 193 This protocol is designed to be carried over all RDMA transports 194 meeting the stated requirements. This protocol conveys to the RPC 195 peer, information sufficient for that RPC peer to direct an RDMA 196 layer to perform transfers containing RPC data, and to communicate 197 their result(s). For example, it is readily carried over RDMA 198 transports such as iWARP [RDDP] or Infiniband [IB]. 200 3. Protocol Outline 202 An RPC message can be conveyed in identical fashion, whether it is 203 a call or reply message. In each case, the transmission of the 204 message proper is preceded by transmission of a transport-specific 205 header for use by RPC over RDMA transports. This header is 206 analogous to the record marking used for RPC over TCP, but is more 207 extensive, since RDMA transports support several modes of data 208 transfer and it is important to allow the client and server to use 209 the most efficient mode for any given transfer. Multiple segments 210 of a message may be transferred in different ways to different 211 remote memory destinations. 213 All transfers of a call or reply begin with an RDMA Send which 214 transfers at least the RPC over RDMA header, usually with the call 215 or reply message appended, or at least some part thereof. Because 216 the size of what may be transmitted via RDMA Send is limited by the 217 size of the receiver's pre-posted buffer, the RPC over RDMA 218 transport provides a number of methods to reduce the amount 219 transferred by means of the RDMA Send, when necessary, by 220 transferring various parts of the message using RDMA Read and RDMA 221 Write. 223 RPC over RDMA framing replaces all other RPC framing (such as TCP 224 record marking) when used atop an RPC/RDMA association, even though 225 the underlying RDMA protocol may itself be layered atop a protocol 226 with a defined RPC framing (such as TCP). An upper layer may 227 however define an exchange to dynamically enable RPC/RDMA on an 228 existing RPC association. Any such exchange must be carefully 229 architected so as to prevent any ambiguity as to the framing in use 230 for each side of the connection. Because RPC/RDMA framing delimits 231 an entire RPC request or reply, any such shift must occur between 232 distinct RPC messages. 234 3.1. Short Messages 236 Many RPC messages are quite short. For example, the NFS version 3 237 GETATTR request, is only 56 bytes: 20 bytes of RPC header plus a 32 238 byte filehandle argument and 4 bytes of length. The reply to this 239 common request is about 100 bytes. 241 There is no benefit in transferring such small messages with an 242 RDMA Read or Write operation. The overhead in transferring 243 steering tags and memory addresses is justified only by large 244 transfers. The critical message size that justifies RDMA transfer 245 will vary depending on the RDMA implementation and network, but is 246 typically of the order of a few kilobytes. It is appropriate to 247 transfer a short message with an RDMA Send to a pre-posted buffer. 248 The RPC over RDMA header with the short message (call or reply) 249 immediately following is transferred using a single RDMA Send 250 operation. 252 Short RPC messages over an RDMA transport: 254 RPC Client RPC Server 255 | RPC Call | 256 Send | ------------------------------> | 257 | | 258 | RPC Reply | 259 | <------------------------------ | Send 261 3.2. Data Chunks 263 Some protocols, like NFS, have RPC procedures that can transfer 264 very large "chunks" of data in the RPC call or reply and would 265 cause the maximum send size to be exceeded if one tried to transfer 266 them as part of the RDMA Send. These large chunks typically range 267 from a kilobyte to a megabyte or more. An RDMA transport can 268 transfer large chunks of data more efficiently via the direct 269 placement of an RDMA Read or RDMA Write operation. Using direct 270 placement instead of inline transfer not only avoids expensive data 271 copies, but provides correct data alignment at the destination. 273 3.3. Flow Control 275 It is critical to provide RDMA Send flow control for an RDMA 276 connection. RDMA receive operations will fail if a pre-posted 277 receive buffer is not available to accept an incoming RDMA Send, 278 and repeated occurrences of such errors can be fatal to the 279 connection. This is a departure from conventional TCP/IP 280 networking where buffers are allocated dynamically on an as-needed 281 basis, and where pre-posting is not required. 283 It is not practical to provide for fixed credit limits at the RPC 284 server. Fixed limits scale poorly, since posted buffers are 285 dedicated to the associated connection until consumed by receive 286 operations. Additionally for protocol correctness, the RPC server 287 must always be able to reply to client requests, whether or not new 288 buffers have been posted to accept future receives. (Note that the 289 RPC server may in fact be a client at some other layer. For 290 example, NFSv4 callbacks are processed by the NFSv4 client, acting 291 as an RPC server. The credit discussions apply equally in either 292 case.) 294 Flow control for RDMA Send operations is implemented as a simple 295 request/grant protocol in the RPC over RDMA header associated with 296 each RPC message. The RPC over RDMA header for RPC call messages 297 contains a requested credit value for the RPC server, which MAY be 298 dynamically adjusted by the caller to match its expected needs. 299 The RPC over RDMA header for the RPC reply messages provides the 300 granted result, which MAY have any value except it MAY NOT be zero 301 when no in-progress operations are present at the server, since 302 such a value would result in deadlock. The value MAY be adjusted 303 up or down at each opportunity to match the server's needs or 304 policies. 306 The RPC client MUST NOT send unacknowledged requests in excess of 307 this granted RPC server credit limit. If the limit is exceeded, 308 the RDMA layer may signal an error, possibly terminating the 309 connection. Even if an error does not occur, it is NOT REQUIRED 310 that the server handle the excess request(s), and it MAY return an 311 RPC error to the client. Also note that the never-zero requirement 312 implies that an RPC server MUST always provide at least one credit 313 to each connected RPC client. It does however NOT REQUIRE that the 314 server always be prepared to receive a request from each client, 315 for example when the server is busy processing all granted client 316 requests. 318 While RPC calls complete in any order, the current flow control 319 limit at the RPC server is known to the RPC client from the Send 320 ordering properties. It is always the most recent server-granted 321 credit value minus the number of requests in flight. 323 Certain RDMA implementations may impose additional flow control 324 restrictions, such as limits on RDMA Read operations in progress at 325 the responder. Because these operations are outside the scope of 326 this protocol, they are not addressed and SHOULD be provided for by 327 other layers. For example, a simple upper layer RPC consumer might 328 perform single-issue RDMA Read requests, while a more 329 sophisticated, multithreaded RPC consumer might implement its own 330 FIFO queue of such operations. For further discussion of possible 331 protocol implementations capable of negotiating these values, see 332 section 6 "Connection Configuration Protocol" of this draft, or 333 [NFSv4.1]. 335 3.4. XDR Encoding with Chunks 337 The data comprising an RPC call or reply message is marshaled or 338 serialized into a contiguous stream by an XDR routine. XDR data 339 types such as integers, strings, arrays and linked lists are 340 commonly implemented over two very simple functions that encode 341 either an XDR data unit (32 bits) or an array of bytes. 343 Normally, the separate data items in an RPC call or reply are 344 encoded as a contiguous sequence of bytes for network transmission 345 over UDP or TCP. However, in the case of an RDMA transport, local 346 routines such as XDR encode can determine that (for instance) an 347 opaque byte array is large enough to be more efficiently moved via 348 an RDMA data transfer operation like RDMA Read or RDMA Write. 350 Semantically speaking, the protocol has no restriction regarding 351 data types which may or may not be represented by a read or write 352 chunk. In practice however, efficiency considerations lead to the 353 conclusion that certain data types are not generally "chunkable". 354 Typically, only opaque and aggregate data types which may attain 355 substantial size are considered to be eligible. With today's 356 hardware this size may be a kilobyte or more. However any object 357 MAY be chosen for chunking in any given message. 359 The eligibility of XDR data items to be candidates for being moved 360 as data chunks (as opposed to being marshaled inline) is not 361 specified by the RPC over RDMA protocol. Chunk eligibility 362 criteria MUST be determined by each upper layer in order to provide 363 for an interoperable specification. One such example with 364 rationale, for the NFS protocol family, is provided in [NFSDDP]. 366 The interface by which an upper layer implementation communicates 367 the eligibility of a data item locally to RPC for chunking is out 368 of scope for this specification. In many implementations, it is 369 possible to implement a transparent RPC chunking facility. 370 However, such implementations may lead to inefficiencies, either 371 because they require the RPC layer to perform expensive 372 registration and deregistration of memory "on the fly", or they may 373 require using RDMA chunks in reply messages, along with the 374 resulting additional handshaking with the RPC over RDMA peer. 375 However, these issues are internal and generally confined to the 376 local interface between RPC and its upper layers, one in which 377 implementations are free to innovate. The only requirement is that 378 the resulting RPC RDMA protocol sent to the peer is valid for the 379 upper layer. See for example [NFSDDP]. 381 When sending any message (request or reply) that contains an 382 eligible large data chunk, the XDR encoding routine avoids moving 383 the data into the XDR stream. Instead, it does not encode the data 384 portion, but records the address and size of each chunk in a 385 separate "read chunk list" encoded within RPC RDMA transport- 386 specific headers. Such chunks will be transferred via RDMA Read 387 operations initiated by the receiver. 389 When the read chunks are to be moved via RDMA, the memory for each 390 chunk is registered. This registration may take place within XDR 391 itself, providing for full transparency to upper layers, or it may 392 be performed by any other specific local implementation. 394 Additionally, when making an RPC call that can result in bulk data 395 transferred in the reply, it is desirable to provide chunks to 396 accept the data directly via RDMA Write. These write chunks will 397 therefore be pre-filled by the RPC server prior to responding, and 398 XDR decode of the data at the client will not be required. These 399 chunks undergo a similar registration and advertisement via "write 400 chunk lists" built as a part of XDR encoding. 402 Some RPC client implementations are not able to determine where an 403 RPC call's results reside during the "encode" phase. This makes it 404 difficult or impossible for the RPC client layer to encode the 405 write chunk list at the time of building the request. In this 406 case, it is difficult for the RPC implementation to provide 407 transparency to the RPC consumer, which may require recoding to 408 provide result information at this earlier stage. 410 Therefore if the RPC client does not make a write chunk list 411 available to receive the result, then the RPC server MAY return 412 data inline in the reply, or if the upper layer specification 413 permits, it MAY be returned via a read chunk list. It is NOT 414 RECOMMENDED that upper layer RPC client protocol specifcations omit 415 write chunk lists for eligible replies, due to the lower 416 performance of the additional handshaking to perform data transfer, 417 and the requirement that the RPC server must expose (and preserve) 418 the reply data for a period of time. In the absence of a server- 419 provided read chunk list in the reply, if the encoded reply 420 overflows the posted receive buffer, the RPC will fail with an RDMA 421 transport error. 423 When any data within a message is provided via either read or write 424 chunks, the chunk itself refers only to the data portion of the XDR 425 stream element. In particular, for counted fields (e.g. a "<>" 426 encoding) the byte count which is encoded as part of the field 427 remains in the XDR stream, and is also encoded in the chunk list. 428 The data portion is however elided from the encoded XDR stream, and 429 is transferred as part of chunk list processing. This is important 430 to maintain upper layer implementation compatibility - both the 431 count and the data must be transferred as part of the logical XDR 432 stream. While the chunk list processing results in the data being 433 available to the upper layer peer for XDR decoding, the length 434 present in the chunk list entries is not. Any byte count in the 435 XDR stream MUST match the sum of the byte counts present in the 436 corresponding read or write chunk list. If they do not agree, an 437 RPC protocol encoding error results. 439 The following items are contained in a chunk list entry. 441 Handle 442 Steering tag or handle obtained when the chunk memory is 443 registered for RDMA. 445 Length 446 The length of the chunk in bytes. 448 Offset 449 The offset or beginning memory address of the chunk. In order 450 to support the widest array of RDMA implementations, as well 451 as the most general steering tag scheme, this field is 452 unconditionally included in each chunk list entry. 454 While zero-based offset schemes are available in many RDMA 455 implementations, their use by RPC requires individual 456 registration of each read or write chunk. On many such 457 implementations this can be a significant overhead. By 458 providing an offset in each chunk, many pre-registration or 459 region-based registrations can be readily supported, and by 460 using a single, universal chunk representation, the RPC RDMA 461 protocol implementation is simplified to its most general 462 form. 464 Position 465 For data which is to be encoded, the position in the XDR 466 stream where the chunk would normally reside. Note that the 467 chunk therefore inserts its data into the XDR stream at this 468 position, but its transfer is no longer "inline". Also note 469 therefore that all chunks belonging to a single RPC argument 470 or result will have the same position. For data which is to 471 be decoded, no position is used. 473 When XDR marshaling is complete, the chunk list is XDR encoded, 474 then sent to the receiver prepended to the RPC message. Any source 475 data for a read chunk, or the destination of a write chunk, remain 476 behind in the sender's registered memory and their actual payload 477 is not marshaled into the request or reply. 479 +----------------+----------------+------------- 480 | RPC over RDMA | | 481 | header w/ | RPC Header | Non-chunk args/results 482 | chunks | | 483 +----------------+----------------+------------- 485 Read chunk lists and write chunk lists are structured somewhat 486 differently. This is due to the different usage - read chunks are 487 decoded and indexed by their argument's or result's position in the 488 XDR data stream; their size is always known. Write chunks on the 489 other hand are used only for results, and have neither a 490 preassigned offset in the XDR stream, nor a size until the results 491 are produced, since the buffers may be only partially filled, or 492 may not be used for results at all. Their presence in the XDR 493 stream is therefore not known until the reply is processed. The 494 mapping of Write chunks onto designated NFS procedures and their 495 results is described in [NFSDDP]. 497 Therefore, read chunks are encoded into a read chunk list as a 498 single array, with each entry tagged by its (known) size and its 499 argument's or result's position in the XDR stream. Write chunks 500 are encoded as a list of arrays of RDMA buffers, with each list 501 element (an array) providing buffers for a separate result. 502 Individual write chunk list elements MAY thereby result in being 503 partially or fully filled, or in fact not being filled at all. 504 Unused write chunks, or unused bytes in write chunk buffer lists, 505 are not returned as results, and their memory is returned to the 506 upper layer as part of RPC completion. However, the RPC layer 507 SHOULD NOT assume that the buffers have not been modified. 509 3.5. XDR Decoding with Read Chunks 511 The XDR decode process moves data from an XDR stream into a data 512 structure provided by the RPC client or server application. Where 513 elements of the destination data structure are buffers or strings, 514 the RPC application can either pre-allocate storage to receive the 515 data, or leave the string or buffer fields null and allow the XDR 516 decode stage of RPC processing to automatically allocate storage of 517 sufficient size. 519 When decoding a message from an RDMA transport, the receiver first 520 XDR decodes the chunk lists from the RPC over RDMA header, then 521 proceeds to decode the body of the RPC message (arguments or 522 results). Whenever the XDR offset in the decode stream matches 523 that of a chunk in the read chunk list, the XDR routine initiates 524 an RDMA Read to bring over the chunk data into locally registered 525 memory for the destination buffer. 527 When processing an RPC request, the RPC receiver (RPC server) 528 acknowledges its completion of use of the source buffers by simply 529 replying to the RPC sender (client), and the peer may then free all 530 source buffers advertised by the request. 532 When processing an RPC reply, after completing such a transfer the 533 RPC receiver (client) MUST issue an RDMA_DONE message (described in 534 Section 3.8) to notify the peer (server) that the source buffers 535 can be freed. 537 The read chunk list is constructed and used entirely within the 538 RPC/XDR layer. Other than specifying the minimum chunk size, the 539 management of the read chunk list is automatic and transparent to 540 an RPC application. 542 3.6. XDR Decoding with Write Chunks 544 When a "write chunk list" is provided for the results of the RPC 545 call, the RPC server MUST provide any corresponding data via RDMA 546 Write to the memory referenced in the chunk list entries. The RPC 547 reply conveys this by returning the write chunk list to the client 548 with the lengths rewritten to match the actual transfer. The XDR 549 "decode" of the reply therefore performs no local data transfer but 550 merely returns the length obtained from the reply. 552 Each decoded result consumes one entry in the write chunk list, 553 which in turn consists of an array of RDMA segments. The length is 554 therefore the sum of all returned lengths in all segments 555 comprising the corresponding list entry. As each list entry is 556 "decoded", the entire entry is consumed. 558 The write chunk list is constructed and used by the RPC 559 application. The RPC/XDR layer simply conveys the list between 560 client and server and initiates the RDMA Writes back to the client. 561 The mapping of write chunk list entries to procedure arguments MUST 562 be determined for each protocol. An example of a mapping is 563 described in [NFSDDP]. 565 3.7. XDR Roundup and Chunks 567 The XDR protocol requires 4-byte alignment of each new encoded 568 element in any XDR stream. This requirement is for efficiency and 569 ease of decode/unmarshaling at the receiver - if the XDR stream 570 buffer begins on a native machine boundary, then the XDR elements 571 will lie on similarly predictable offsets in memory. 573 Within XDR, when non-4-byte encodes (such as an odd-length string 574 or bulk data) are marshaled, their length is encoded literally, 575 while their data is padded to begin the next element at a 4-byte 576 boundary in the XDR stream. For TCP or RDMA inline encoding, this 577 minimal overhead is required because the transport-specific framing 578 relies on the fact that the relative offset of the elements in the 579 XDR stream from the start of the message determines the XDR 580 position during decode. 582 On the other hand, RPC/RDMA Read chunks carry the XDR position of 583 each chunked element and length of the Chunk segment, and can be 584 placed by the receiver exactly where they belong in the receiver's 585 memory without regard to the alignment of their position in the XDR 586 stream. Since any rounded-up data is not actually part of the 587 upper layer's message, the receiver will not reference it, and 588 there is no reason to set it to any particular value in the 589 receiver's memory. 591 When roundup is present at the end of a sequence of chunks, the 592 length of the sequence will terminate it at an non-4-byte XDR 593 position. When the receiver proceeds to decode the remaining part 594 of the XDR stream, it inspects the XDR position indicated by the 595 next chunk. Because this position will not match (else roundup 596 would not have occurred), the receiver decoding will fall back to 597 inspecting the remaining inline portion. If in turn, no data 598 remains to be decoded from the inline portion, then the receiver 599 MUST conclude that roundup is present, and therefore advances the 600 XDR decode position to that indicated by the next chunk (if any). 601 In this way, roundup is passed without ever actually transferring 602 additional XDR bytes. 604 Some protocol operations over RPC/RDMA, for instance NFS writes of 605 data encountered at the end of a file or in direct i/o situations, 606 commonly yield these roundups within RDMA Read Chunks. Because any 607 roundup bytes are not actually present in the data buffers being 608 written, memory for these bytes would come from noncontiguous 609 buffers, either as an additional memory registration segment, or as 610 an additional Chunk. The overhead of these operations can be 611 significant to both the sender to marshal them, and even higher to 612 the receiver which to transfer them. Senders SHOULD therefore 613 avoid encoding indivudual RDMA Read Chunks for roundup whenever 614 possible. It is acceptable, but not necessary, to include roundup 615 data in an existing RDMA Read Chunk, but only if it is already 616 present in the XDR stream to carry upper layer data. 618 Note that there is no exposure of additional data at the sender due 619 to eliding roundup data from the XDR stream, since any additional 620 sender buffers are never exposed to the peer. The data is 621 literally not there to be transferred. 623 For RDMA Write Chunks, a simpler encoding method applies. Again, 624 roundup bytes are not transferred, instead the chunk length sent to 625 the receiver in the reply is simply increased to include any 626 roundup. Because of the requirement that the RDMA Write chunks are 627 filled sequentially without gaps, this situation can only occur on 628 the final chunk receiving data. Therefore there is no opportunity 629 for roundup data to insert misalignment or positional gaps into the 630 XDR stream. 632 3.8. RPC Call and Reply 634 The RDMA transport for RPC provides three methods of moving data 635 between RPC client and server: 637 Inline 638 Data are moved between RPC client and server within an RDMA 639 Send. 641 RDMA Read 642 Data are moved between RPC client and server via an RDMA Read 643 operation via steering tag, address and offset obtained from a 644 read chunk list. 646 RDMA Write 647 Result data is moved from RPC server to client via an RDMA 648 Write operation via steering tag, address and offset obtained 649 from a write chunk list or reply chunk in the client's RPC 650 call message. 652 These methods of data movement may occur in combinations within a 653 single RPC. For instance, an RPC call may contain some inline data 654 along with some large chunks to be transferred via RDMA Read to the 655 server. The reply to that call may have some result chunks that 656 the server RDMA Writes back to the client. The following protocol 657 interactions illustrate RPC calls that use these methods to move 658 RPC message data: 660 An RPC with write chunks in the call message: 662 RPC Client RPC Server 663 | RPC Call + Write Chunk list | 664 Send | ------------------------------> | 665 | | 666 | Chunk 1 | 667 | <------------------------------ | Write 668 | : | 669 | Chunk n | 670 | <------------------------------ | Write 671 | | 672 | RPC Reply | 673 | <------------------------------ | Send 675 In the presence of write chunks, RDMA ordering provides the 676 guarantee that all data in the RDMA Write operations has been 677 placed in memory prior to the client's RPC reply processing. 679 An RPC with read chunks in the call message: 681 RPC Client RPC Server 682 | RPC Call + Read Chunk list | 683 Send | ------------------------------> | 684 | | 685 | Chunk 1 | 686 | +------------------------------ | Read 687 | v-----------------------------> | 688 | : | 689 | Chunk n | 690 | +------------------------------ | Read 691 | v-----------------------------> | 692 | | 693 | RPC Reply | 694 | <------------------------------ | Send 696 An RPC with read chunks in the reply message: 698 RPC Client RPC Server 699 | RPC Call | 700 Send | ------------------------------> | 701 | | 702 | RPC Reply + Read Chunk list | 703 | <------------------------------ | Send 704 | | 705 | Chunk 1 | 706 Read | ------------------------------+ | 707 | <-----------------------------v | 708 | : | 709 | Chunk n | 710 Read | ------------------------------+ | 711 | <-----------------------------v | 712 | | 713 | Done | 714 Send | ------------------------------> | 716 The final Done message allows the RPC client to signal the server 717 that it has received the chunks, so the server can de-register and 718 free the memory holding the chunks. A Done completion is not 719 necessary for an RPC call, since the RPC reply Send is itself a 720 receive completion notification. In the event that the client 721 fails to return the Done message within some timeout period, the 722 server MAY conclude that a protocol violation has occurred and 723 close the RPC connection, or it MAY proceed with a de-register and 724 free its chunk buffers. This may result in a fatal RDMA error if 725 the client later attempts to perform an RDMA Read operation, which 726 amounts to the same thing. 728 The use of read chunks in RPC reply messages is much less efficient 729 than providing write chunks in the originating RPC calls, due to 730 the additional message exchanges, the need for the RPC server to 731 advertise buffers to the peer, the necessity of the server 732 maintaining a timer for the purpose of recovery from misbehaving 733 clients, and the need for additional memory registration. Their 734 use is NOT RECOMMENDED by upper layers where efficiency is a 735 primary concern. [NFSDDP] However, they MAY be employed by upper 736 layer protocol bindings which are primarily concerned with 737 transparency, since they can frequently be implemented completely 738 within the RPC lower layers. 740 It is important to note that the Done message consumes a credit at 741 the RPC server. The RPC server SHOULD provide sufficient credits 742 to the client to allow the Done message to be sent without deadlock 743 (driving the outstanding credit count to zero). The RPC client 744 MUST account for its required Done messages to the server in its 745 accounting of available credits, and the server SHOULD replenish 746 any credit consumed by its use of such exchanges at its earliest 747 opportunity. 749 Finally, it is possible to conceive of RPC exchanges that involve 750 any or all combinations of write chunks in the RPC call, read 751 chunks in the RPC call, and read chunks in the RPC reply. Support 752 for such exchanges is straightforward from a protocol perspective, 753 but in practice such exchanges would be quite rare, limited to 754 upper layer protocol exchanges which transferred bulk data in both 755 the call and corresponding reply. 757 3.9. Padding 759 Alignment of specific opaque data enables certain scatter/gather 760 optimizations. Padding leverages the useful property that RDMA 761 transfers preserve alignment of data, even when they are placed 762 into pre-posted receive buffers by Sends. 764 Many servers can make good use of such padding. Padding allows the 765 chaining of RDMA receive buffers such that any data transferred by 766 RDMA on behalf of RPC requests will be placed into appropriately 767 aligned buffers on the system that receives the transfer. In this 768 way, the need for servers to perform RDMA Read to satisfy all but 769 the largest client writes is obviated. 771 The effect of padding is demonstrated below showing prior bytes on 772 an XDR stream (XXX) followed by an opaque field consisting of four 773 length bytes (LLLL) followed by data bytes (DDDD). The receiver of 774 the RDMA Send has posted two chained receive buffers. Without 775 padding, the opaque data is split across the two buffers. With the 776 addition of padding bytes (ppp) prior to the first data byte, the 777 data can be forced to align correctly in the second buffer. 779 Buffer 1 Buffer 2 780 Unpadded -------------- -------------- 782 XXXXXXXLLLLDDDDDDDDDDDDDD ---> XXXXXXXLLLLDDD DDDDDDDDDDD 784 Padded 786 XXXXXXXLLLLpppDDDDDDDDDDDDDD ---> XXXXXXXLLLLppp DDDDDDDDDDDDDD 788 Padding is implemented completely within the RDMA transport 789 encoding, flagged with a specific message type. Where padding is 790 applied, two values are passed to the peer: an "rdma_align" which 791 is the padding value used, and "rdma_thresh", which is the opaque 792 data size at or above which padding is applied. For instance, if 793 the server is using chained 4 KB receive buffers, then up to (4 KB 794 - 1) padding bytes could be used to achieve alignment of the data. 795 The XDR routine at the peer MUST consult these values when decoding 796 opaque values. Where the decoded length exceeds the rdma_thresh, 797 the XDR decode MUST skip over the appropriate padding as indicated 798 by rdma_align and the current XDR stream position. 800 4. RPC RDMA Message Layout 802 RPC call and reply messages are conveyed across an RDMA transport 803 with a prepended RPC over RDMA header. The RPC over RDMA header 804 includes data for RDMA flow control credits, padding parameters and 805 lists of addresses that provide direct data placement via RDMA Read 806 and Write operations. The layout of the RPC message itself is 807 unchanged from that described in [RFC1831] except for the possible 808 exclusion of large data chunks that will be moved by RDMA Read or 809 Write operations. If the RPC message (along with the RPC over RDMA 810 header) is too long for the posted receive buffer (even after any 811 large chunks are removed), then the entire RPC message MAY be moved 812 separately as a chunk, leaving just the RPC over RDMA header in the 813 RDMA Send. 815 4.1. RPC over RDMA Header 817 The RPC over RDMA header begins with four 32-bit fields that are 818 always present and which control the RDMA interaction including 819 RDMA-specific flow control. These are then followed by a number of 820 items such as chunk lists and padding which MAY or MAY NOT be 821 present depending on the type of transmission. The four fields 822 which are always present are: 824 1. Transaction ID (XID). 825 The XID generated for the RPC call and reply. Having the XID 826 at the beginning of the message makes it easy to establish the 827 message context. This XID mirrors the XID in the RPC header, 828 and takes precedence. The receiver MAY ignore the XID in the 829 RPC header, if it so chooses. 831 2. Version number. 832 This version of the RPC RDMA message protocol is 1. The 833 version number MUST be increased by one whenever the format of 834 the RPC RDMA messages is changed. 836 3. Flow control credit value. 837 When sent in an RPC call message, the requested value is 838 provided. When sent in an RPC reply message, the granted 839 value is returned. RPC calls SHOULD not be sent in excess of 840 the currently granted limit. 842 4. Message type. 844 o RDMA_MSG = 0 indicates that chunk lists and RPC message 845 follow. 847 o RDMA_NOMSG = 1 indicates that after the chunk lists there 848 is no RPC message. In this case, the chunk lists provide 849 information to allow the message proper to be transferred 850 using RDMA Read or write and thus is not appended to the 851 RPC over RDMA header. 853 o RDMA_MSGP = 2 indicates that a chunk list and RPC message 854 with some padding follow. 856 0 RDMA_DONE = 3 indicates that the message signals the 857 completion of a chunk transfer via RDMA Read. 859 o RDMA_ERROR = 4 is used to signal any detected error(s) in 860 the RPC RDMA chunk encoding. 862 Because the version number is encoded as part of this header, and 863 the RDMA_ERROR message type is used to indicate errors, these first 864 four fields and the start of the following message body MUST always 865 remain aligned at these fixed offsets for all versions of the RPC 866 over RDMA header. 868 For a message of type RDMA_MSG or RDMA_NOMSG, the Read and Write 869 chunk lists follow. If the Read chunk list is null (a 32 bit word 870 of zeros), then there are no chunks to be transferred separately 871 and the RPC message follows in its entirety. If non-null, then 872 it's the beginning of an XDR encoded sequence of Read chunk list 873 entries. If the Write chunk list is non-null, then an XDR encoded 874 sequence of Write chunk entries follows. 876 If the message type is RDMA_MSGP, then two additional fields that 877 specify the padding alignment and threshold are inserted prior to 878 the Read and Write chunk lists. 880 A header of message type RDMA_MSG or RDMA_MSGP MUST be followed by 881 the RPC call or RPC reply message body, beginning with the XID. 882 The XID in the RDMA_MSG or RDMA_MSGP header MUST match this. 884 +--------+---------+---------+-----------+-------------+---------- 885 | | | | Message | NULLs | RPC Call 886 | XID | Version | Credits | Type | or | or 887 | | | | | Chunk Lists | Reply Msg 888 +--------+---------+---------+-----------+-------------+---------- 890 Note that in the case of RDMA_DONE and RDMA_ERROR, no chunk list or 891 RPC message follows. As an implementation hint: a gather operation 892 on the Send of the RDMA RPC message can be used to marshal the 893 initial header, the chunk list, and the RPC message itself. 895 4.2. RPC over RDMA header errors 897 When a peer receives an RPC RDMA message, it MUST perform the 898 following basic validity checks on the header and chunk contents. 899 If such errors are detected in the request, an RDMA_ERROR reply 900 MUST be generated. 902 Two types of errors are defined, version mismatch and invalid chunk 903 format. When the peer detects an RPC over RDMA header version 904 which it does not support (currently this draft defines only 905 version 1), it replies with an error code of ERR_VERS, and provides 906 the low and high inclusive version numbers it does, in fact, 907 support. The version number in this reply MAY be any value 908 otherwise valid at the receiver. When other decoding errors are 909 detected in the header or chunks, either an RPC decode error MAY be 910 returned, or the RPC/RDMA error code ERR_CHUNK MUST be returned. 912 4.3. XDR Language Description 914 Here is the message layout in XDR language. 916 struct xdr_rdma_segment { 917 uint32 handle; /* Registered memory handle */ 918 uint32 length; /* Length of the chunk in bytes */ 919 uint64 offset; /* Chunk virtual address or offset */ 920 }; 922 struct xdr_read_chunk { 923 uint32 position; /* Position in XDR stream */ 924 struct xdr_rdma_segment target; 925 }; 927 struct xdr_read_list { 928 struct xdr_read_chunk entry; 929 struct xdr_read_list *next; 930 }; 932 struct xdr_write_chunk { 933 struct xdr_rdma_segment target<>; 934 }; 936 struct xdr_write_list { 937 struct xdr_write_chunk entry; 938 struct xdr_write_list *next; 939 }; 941 struct rdma_msg { 942 uint32 rdma_xid; /* Mirrors the RPC header xid */ 943 uint32 rdma_vers; /* Version of this protocol */ 944 uint32 rdma_credit; /* Buffers requested/granted */ 945 rdma_body rdma_body; 946 }; 948 enum rdma_proc { 949 RDMA_MSG=0, /* An RPC call or reply msg */ 950 RDMA_NOMSG=1, /* An RPC call or reply msg - separate body */ 951 RDMA_MSGP=2, /* An RPC call or reply msg with padding */ 952 RDMA_DONE=3, /* Client signals reply completion */ 953 RDMA_ERROR=4 /* An RPC RDMA encoding error */ 954 }; 955 union rdma_body switch (rdma_proc proc) { 956 case RDMA_MSG: 957 rpc_rdma_header rdma_msg; 958 case RDMA_NOMSG: 959 rpc_rdma_header_nomsg rdma_nomsg; 960 case RDMA_MSGP: 961 rpc_rdma_header_padded rdma_msgp; 962 case RDMA_DONE: 963 void; 964 case RDMA_ERROR: 965 rpc_rdma_error rdma_error; 966 }; 968 struct rpc_rdma_header { 969 struct xdr_read_list *rdma_reads; 970 struct xdr_write_list *rdma_writes; 971 struct xdr_write_chunk *rdma_reply; 972 /* rpc body follows */ 973 }; 975 struct rpc_rdma_header_nomsg { 976 struct xdr_read_list *rdma_reads; 977 struct xdr_write_list *rdma_writes; 978 struct xdr_write_chunk *rdma_reply; 979 }; 981 struct rpc_rdma_header_padded { 982 uint32 rdma_align; /* Padding alignment */ 983 uint32 rdma_thresh; /* Padding threshold */ 984 struct xdr_read_list *rdma_reads; 985 struct xdr_write_list *rdma_writes; 986 struct xdr_write_chunk *rdma_reply; 987 /* rpc body follows */ 988 }; 989 enum rpc_rdma_errcode { 990 ERR_VERS = 1, 991 ERR_CHUNK = 2 992 }; 994 union rpc_rdma_error switch (rpc_rdma_errcode) { 995 case ERR_VERS: 996 uint32 rdma_vers_low; 997 uint32 rdma_vers_high; 998 case ERR_CHUNK: 999 void; 1000 default: 1001 uint32 rdma_extra[8]; 1002 }; 1004 5. Long Messages 1006 The receiver of RDMA Send messages is required by RDMA to have 1007 previously posted one or more adequately sized buffers. The RPC 1008 client can inform the server of the maximum size of its RDMA Send 1009 messages via the Connection Configuration Protocol described later 1010 in this document. 1012 Since RPC messages are frequently small, memory savings can be 1013 achieved by posting small buffers. Even large messages like NFS 1014 READ or WRITE will be quite small once the chunks are removed from 1015 the message. However, there may be large messages that would 1016 demand a very large buffer be posted, where the contents of the 1017 buffer may not be a chunkable XDR element. A good example is an 1018 NFS READDIR reply which may contain a large number of small 1019 filename strings. Also, the NFS version 4 protocol [RFC3530] 1020 features COMPOUND request and reply messages of unbounded length. 1022 Ideally, each upper layer will negotiate these limits. However, it 1023 is frequently necessary to provide a transparent solution. 1025 5.1. Message as an RDMA Read Chunk 1027 One relatively simple method is to have the client identify any RPC 1028 message that exceeds the RPC server's posted buffer size and move 1029 it separately as a chunk, i.e. reference it as the first entry in 1030 the read chunk list with an XDR position of zero. 1032 Normal Message 1034 +--------+---------+---------+------------+-------------+---------- 1035 | | | | | | RPC Call 1036 | XID | Version | Credits | RDMA_MSG | Chunk Lists | or 1037 | | | | | | Reply Msg 1038 +--------+---------+---------+------------+-------------+---------- 1040 Long Message 1042 +--------+---------+---------+------------+-------------+ 1043 | | | | | | 1044 | XID | Version | Credits | RDMA_NOMSG | Chunk Lists | 1045 | | | | | | 1046 +--------+---------+---------+------------+-------------+ 1047 | 1048 | +---------- 1049 | | Long RPC Call 1050 +->| or 1051 | Reply Message 1052 +---------- 1054 If the receiver gets an RPC over RDMA header with a message type of 1055 RDMA_NOMSG and finds an initial read chunk list entry with a zero 1056 XDR position, it allocates a registered buffer and issues an RDMA 1057 Read of the long RPC message into it. The receiver then proceeds 1058 to XDR decode the RPC message as if it had received it inline with 1059 the Send data. Further decoding may issue additional RDMA Reads to 1060 bring over additional chunks. 1062 Although the handling of long messages requires one extra network 1063 turnaround, in practice these messages will be rare if the posted 1064 receive buffers are correctly sized, and of course they will be 1065 non-existent for RDMA-aware upper layers. 1067 A long call RPC with request supplied via RDMA Read 1069 RPC Client RPC Server 1070 | RDMA over RPC Header | 1071 Send | ------------------------------> | 1072 | | 1073 | Long RPC Call Msg | 1074 | +------------------------------ | Read 1075 | v-----------------------------> | 1076 | | 1077 | RDMA over RPC Reply | 1078 | <------------------------------ | Send 1080 An RPC with long reply returned via RDMA Read 1082 RPC Client RPC Server 1083 | RPC Call | 1084 Send | ------------------------------> | 1085 | | 1086 | RDMA over RPC Header | 1087 | <------------------------------ | Send 1088 | | 1089 | Long RPC Reply Msg | 1090 Read | ------------------------------+ | 1091 | <-----------------------------v | 1092 | | 1093 | Done | 1094 Send | ------------------------------> | 1096 It is possible for a single RPC procedure to employ both a long 1097 call for its arguments, and a long reply for its results. However, 1098 such an operation is atypical, as few upper layers define such 1099 exchanges. 1101 5.2. RDMA Write of Long Replies (Reply Chunks) 1103 A superior method of handling long RPC replies is to have the RPC 1104 client post a large buffer into which the server can write a large 1105 RPC reply. This has the advantage that an RDMA Write may be 1106 slightly faster in network latency than an RDMA Read, and does not 1107 require the server to wait for the completion as it must for RDMA 1108 Read. Additionally, for a reply it removes the need for an 1109 RDMA_DONE message if the large reply is returned as a Read chunk. 1111 This protocol supports direct return of a large reply via the 1112 inclusion of an OPTIONAL rdma_reply write chunk after the read 1113 chunk list and the write chunk list. The client allocates a buffer 1114 sized to receive a large reply and enters its steering tag, address 1115 and length in the rdma_reply write chunk. If the reply message is 1116 too long to return inline with an RDMA Send (exceeds the size of 1117 the client's posted receive buffer), even with read chunks removed, 1118 then the RPC server performs an RDMA Write of the RPC reply message 1119 into the buffer indicated by the rdma_reply chunk. If the client 1120 doesn't provide an rdma_reply chunk, or if it's too small, then if 1121 the upper layer specification permits, the message MAY be returned 1122 as a Read chunk. 1124 An RPC with long reply returned via RDMA Write 1126 RPC Client RPC Server 1127 | RPC Call with rdma_reply | 1128 Send | ------------------------------> | 1129 | | 1130 | Long RPC Reply Msg | 1131 | <------------------------------ | Write 1132 | | 1133 | RDMA over RPC Header | 1134 | <------------------------------ | Send 1136 The use of RDMA Write to return long replies requires that the 1137 client application anticipate a long reply and have some knowledge 1138 of its size so that an adequately sized buffer can be allocated. 1139 This is certainly true of NFS READDIR replies; where the client 1140 already provides an upper bound on the size of the encoded 1141 directory fragment to be returned by the server. 1143 The use of these "reply chunks" is highly efficient and convenient 1144 for both RPC client and server. Their use is encouraged for 1145 eligible RPC operations such as NFS READDIR, which would otherwise 1146 require extensive chunk management within the results or use of 1147 RDMA Read and a Done message. [NFSDDP] 1149 6. Connection Configuration Protocol 1151 RDMA Send operations require the receiver to post one or more 1152 buffers at the RDMA connection endpoint, each large enough to 1153 receive the largest Send message. Buffers are consumed as Send 1154 messages are received. If a buffer is too small, or if there are 1155 no buffers posted, the RDMA transport MAY return an error and break 1156 the RDMA connection. The receiver MUST post sufficient, adequately 1157 buffers to avoid buffer overrun or capacity errors. 1159 The protocol described above includes only a mechanism for managing 1160 the number of such receive buffers, and no explicit features to 1161 allow the RPC client and server to provision or control buffer 1162 sizing, nor any other session parameters. 1164 In the past, this type of connection management has not been 1165 necessary for RPC. RPC over UDP or TCP does not have a protocol to 1166 negotiate the link. The server can get a rough idea of the maximum 1167 size of messages from the server protocol code. However, a 1168 protocol to negotiate transport features on a more dynamic basis is 1169 desirable. 1171 The Connection Configuration Protocol allows the client to pass its 1172 connection requirements to the server, and allows the server to 1173 inform the client of its connection limits. 1175 Use of the Connection Configuration Protocol by an upper layer is 1176 OPTIONAL. 1178 6.1. Initial Connection State 1180 This protocol MAY be used for connection setup prior to the use of 1181 another RPC protocol that uses the RDMA transport. It operates in- 1182 band, i.e. it uses the connection itself to negotiate the 1183 connection parameters. To provide a basis for connection 1184 negotiation, the connection is assumed to provide a basic level of 1185 interoperability: the ability to exchange at least one RPC message 1186 at a time that is at least 1 KB in size. The server MAY exceed 1187 this basic level of configuration, but the client MUST NOT assume 1188 it. 1190 6.2. Protocol Description 1192 Version 1 of the Connection Configuration protocol consists of a 1193 single procedure that allows the client to inform the server of its 1194 connection requirements and the server to return connection 1195 information to the client. 1197 The maxcall_sendsize argument is the maximum size of an RPC call 1198 message that the client MUST send inline in an RDMA Send message to 1199 the server. The server MAY return a maxcall_sendsize value that is 1200 smaller or larger than the client's request. The client MUST NOT 1201 send an inline call message larger than what the server will 1202 accept. The maxcall_sendsize limits only the size of inline RPC 1203 calls. It does not limit the size of long RPC messages transferred 1204 as an initial chunk in the Read chunk list. 1206 The maxreply_sendsize is the maximum size of an inline RPC message 1207 that the client will accept from the server. 1209 The maxrdmaread is the maximum number of RDMA Reads which may be 1210 active at the peer. This number correlates to the RDMA incoming 1211 RDMA Read count ("IRD") configured into each originating endpoint 1212 by the client or server. If more than this number of RDMA Read 1213 operations by the connected peer are issued simultaneously, 1214 connection loss or suboptimal flow control may result, therefore 1215 the value SHOULD be observed at all times. The peers' values need 1216 not be equal. If zero, the peer MUST NOT issue requests which 1217 require RDMA Read to satisfy, as no transfer will be possible. 1219 The align value is the value recommended by the server for opaque 1220 data values such as strings and counted byte arrays. The client 1221 MAY use this value to compute the number of prepended pad bytes 1222 when XDR encoding opaque values in the RPC call message. 1224 typedef unsigned int uint32; 1226 struct config_rdma_req { 1227 uint32 maxcall_sendsize; 1228 /* max size of inline RPC call */ 1229 uint32 maxreply_sendsize; 1230 /* max size of inline RPC reply */ 1231 uint32 maxrdmaread; 1232 /* max active RDMA Reads at client */ 1233 }; 1235 struct config_rdma_reply { 1236 uint32 maxcall_sendsize; 1237 /* max call size accepted by server */ 1238 uint32 align; 1239 /* server's receive buffer alignment */ 1240 uint32 maxrdmaread; 1241 /* max active RDMA Reads at server */ 1242 }; 1244 program CONFIG_RDMA_PROG { 1245 version VERS1 { 1246 /* 1247 * Config call/reply 1248 */ 1249 config_rdma_reply CONF_RDMA(config_rdma_req) = 1; 1250 } = 1; 1251 } = 100400; 1253 7. Memory Registration Overhead 1255 RDMA requires that all data be transferred between registered 1256 memory regions at the source and destination. All protocol headers 1257 as well as separately transferred data chunks use registered 1258 memory. Since the cost of registering and de-registering memory 1259 can be a large proportion of the RDMA transaction cost, it is 1260 important to minimize registration activity. This is easily 1261 achieved within RPC controlled memory by allocating chunk list data 1262 and RPC headers in a reusable way from pre-registered pools. 1264 The data chunks transferred via RDMA MAY occupy memory that 1265 persists outside the bounds of the RPC transaction. Hence, the 1266 default behavior of an RPC over RDMA transport is to register and 1267 de-register these chunks on every transaction. However, this is 1268 not a limitation of the protocol - only of the existing local RPC 1269 API. The API is easily extended through such functions as 1270 rpc_control(3) to change the default behavior so that the 1271 application can assume responsibility for controlling memory 1272 registration through an RPC-provided registered memory allocator. 1274 8. Errors and Error Recovery 1276 RPC RDMA protocol errors are described in section 4. RPC errors 1277 and RPC error recovery are not affected by the protocol, and 1278 proceed as for any RPC error condition. RDMA Transport error 1279 reporting and recovery are outside the scope of this protocol. 1281 It is assumed that the link itself will provide some degree of 1282 error detection and retransmission. iWARP's MPA layer (when used 1283 over TCP), SCTP, as well as the Infiniband link layer all provide 1284 CRC protection of the RDMA payload, and CRC-class protection is a 1285 general attribute of such transports. Additionally, the RPC layer 1286 itself can accept errors from the link level and recover via 1287 retransmission. RPC recovery can handle complete loss and re- 1288 establishment of the link. 1290 See section 11 for further discussion of the use of RPC-level 1291 integrity schemes to detect errors, and related efficiency issues. 1293 9. Node Addressing 1295 In setting up a new RDMA connection, the first action by an RPC 1296 client will be to obtain a transport address for the server. The 1297 mechanism used to obtain this address, and to open an RDMA 1298 connection is dependent on the type of RDMA transport, and is the 1299 responsibility of each RPC protocol binding and its local 1300 implementation. 1302 10. RPC Binding 1304 RPC services normally register with a portmap or rpcbind [RFC1833] 1305 service, which associates an RPC program number with a service 1306 address. (In the case of UDP or TCP, the service address for NFS 1307 is normally port 2049.) This policy is no different with RDMA 1308 interconnects, although it may require the allocation of port 1309 numbers appropriate to each upper layer binding which uses the RPC 1310 framing defined here. 1312 When mapped atop the iWARP [RDDP] transport, which uses IP port 1313 addressing due to its layering on TCP and/or SCTP, port mapping is 1314 trivial and consists merely of issuing the port in the connection 1315 process. 1317 When mapped atop Infiniband [IB], which uses a GID-based service 1318 endpoint naming scheme, a translation MUST be employed. One such 1319 translation is defined in the Infiniband Port Addressing Annex 1320 [IBPORT], which is appropriate for translating IP port addressing 1321 to the Infiniband network. Therefore, in this case, IP port 1322 addressing may be readily employed by the upper layer. 1324 When a mapping standard or convention exists for IP ports on an 1325 RDMA interconnect, there are several possibilities for each upper 1326 layer to consider: 1328 One possibility is to have an upper layer server register its 1329 mapped IP port with the rpcbind service, under the netid (or 1330 netid's) defined here. An RPC/RDMA-aware client can then 1331 resolve its desired service to a mappable port, and proceed to 1332 connect. This is the most flexible and compatible approach, 1333 for those upper layers which are defined to use the rpcbind 1334 service. 1336 A second possibility is to have the server's portmapper 1337 register itself on the RDMA interconnect at a "well known" 1338 service address. (On UDP or TCP, this corresponds to port 1339 111.) A client could connect to this service address and use 1340 the portmap protocol to obtain a service address in response 1341 to a program number, e.g. an iWARP port number, or an 1342 Infiniband GID. 1344 Alternatively, the client could simply connect to the mapped 1345 well-known port for the service itself, if it is appropriately 1346 defined. 1348 Historically, different RPC protocols have taken different 1349 approaches to their port assignment, therefore the specific method 1350 is left to each RPC/RDMA-enabled upper layer binding, and not 1351 addressed here. 1353 This specification defines a new "netid", to be used for 1354 registration of upper layers atop iWARP [RDDP] and (when a suitable 1355 port translation service is available) Infiniband [IB] in section 1356 12, "IANA Considerations." Additional RDMA-capable networks MAY 1357 define their own netids, or if they provide a port translation, MAY 1358 share the one defined here. 1360 11. Security 1362 ONC RPC provides its own security via the RPCSEC_GSS framework 1363 [RFC2203]. RPCSEC_GSS can provide message authentication, 1364 integrity checking, and privacy. This security mechanism will be 1365 unaffected by the RDMA transport. The data integrity and privacy 1366 features alter the body of the message, presenting it as a single 1367 chunk. For large messages the chunk may be large enough to qualify 1368 for RDMA Read transfer. However, there is much data movement 1369 associated with computation and verification of integrity, or 1370 encryption/decryption, so certain performance advantages may be 1371 lost. 1373 For efficiency, more appropriate security mechanism for RDMA links 1374 may be link-level protection, such as IPSec, which may be co- 1375 located in the RDMA hardware. The use of link-level protection MAY 1376 be negotiated through the use of a new RPCSEC_GSS mechanism like 1377 the Credential Cache GSS Mechanism [CCM]. Use of such mechanisms 1378 is RECOMMENDED where end-to-end integrity and/or privacy is 1379 desired, and where efficiency is required. 1381 There are no new issues here with exposed addresses. The only 1382 exposed addresses here are in the chunk list and in the transport 1383 packets transferred via RDMA. The data contained in these 1384 addresses continues to be protected by RPCSEC_GSS integrity and 1385 privacy. 1387 12. IANA Considerations 1389 The new RPC transport is to be assigned a new RPC "netid", which is 1390 an rpcbind [RFC1833] string used to describe the underlying 1391 protocol in order for RPC to select the appropriate transport 1392 framing, as well as the format of the service ports. 1394 The following string is to be added to the "nc_proto" registry on 1395 page 5 of [RFC1833]: 1397 NC_RDMA "rdma" 1399 This netid MAY be used for any RDMA network satisfying the 1400 requirements of section 2, and able to identify service endpoints 1401 using IP port addressing, possibly through use of a translation 1402 service as described above in section 10, RPC Binding. 1404 As a new RPC transport, this protocol has no effect on RPC program 1405 numbers or existing registered port numbers. However, new port 1406 numbers MAY be registered for use by RPC/RDMA-enabled services, as 1407 appropriate to the new networks over which the services will 1408 operate. 1410 The OPTIONAL Connection Configuration protocol described herein 1411 requires an RPC program number assignment. The value "100400" is 1412 assigned: 1414 rdmaconfig 100400 rpc.rdmaconfig 1416 Currently, these numbers are not assigned by IANA, they are merely 1417 republished [IANA-RPC]. 1419 13. Acknowledgements 1421 The authors wish to thank Rob Thurlow, John Howard, Chet Juszczak, 1422 Alex Chiu, Peter Staubach, Dave Noveck, Brian Pawlowski, Steve 1423 Kleiman, Mike Eisler, Mark Wittle, Shantanu Mehendale, David 1424 Robinson and Mallikarjun Chadalapaka for their contributions to 1425 this document. 1427 14. Normative References 1429 [RFC2119] 1430 S. Bradner, "Key words for use in RFCs to Indicate Requirement 1431 Levels", Best Current Practice, BCP 14, RFC 2119, March 1997. 1433 [RFC1094] 1434 Sun Microsystems, "NFS: Network File System Protocol 1435 Specification", (NFS version 2) Informational RFC, 1436 http://www.ietf.org/rfc/rfc1094.txt 1438 [RFC1831] 1439 R. Srinivasan, "RPC: Remote Procedure Call Protocol 1440 Specification Version 2", Standards Track RFC, 1441 http://www.ietf.org/rfc/rfc1831.txt 1443 [RFC4506] 1444 M. Eisler Ed., "XDR: External Data Representation Standard", 1445 Standards Track RFC, http://www.ietf.org/rfc/rfc4506.txt 1447 [RFC1813] 1448 B. Callaghan, B. Pawlowski, P. Staubach, "NFS Version 3 1449 Protocol Specification", Informational RFC, 1450 http://www.ietf.org/rfc/rfc1813.txt 1452 [RFC1833] 1453 R. Srinivasan, "Binding Protocols for ONC RPC Version 2", 1454 Standards Track RFC, http://www.ietf.org/rfc/rfc1833.txt 1456 [RFC3530] 1457 S. Shepler, B. Callaghan, D. Robinson, R. Thurlow, C. Beame, 1458 M. Eisler, D. Noveck, "NFS version 4 Protocol", Standards 1459 Track RFC, http://www.ietf.org/rfc/rfc3530.txt 1461 [RFC2203] 1462 M. Eisler, A. Chiu, L. Ling, "RPCSEC_GSS Protocol 1463 Specification", Standards Track RFC, 1464 http://www.ietf.org/rfc/rfc2203.txt 1466 15. Informative References 1468 [RDMAP] 1469 R. Recio et. al., "A Remote Direct Memory Access Protocol 1470 Specification", Standards Track RFC, draft-ietf-rddp-rdmap 1472 [CCM] 1473 M. Eisler, N. Williams, "CCM: The Credential Cache GSS 1474 Mechanism", Internet Draft Work in Progress, draft-ietf- 1475 nfsv4-ccm 1477 [NFSDDP] 1478 B. Callaghan, T. Talpey, "NFS Direct Data Placement" Internet 1479 Draft Work in Progress, draft-ietf-nfsv4-nfsdirect 1481 [RDDP] 1482 H. Shah et. al., "Direct Data Placement over Reliable 1483 Transports", Standards Track RFC, draft-ietf-rddp-ddp 1485 [NFSRDMAPS] 1486 T. Talpey, C. Juszczak, "NFS RDMA Problem Statement", Internet 1487 Draft Work in Progress, draft-ietf-nfsv4-nfs-rdma-problem- 1488 statement 1490 [NFSv4.1] 1491 S. Shepler et. al., ed., "NFSv4 Minor Version 1" Internet 1492 Draft Work in Progress, draft-ietf-nfsv4-minorversion1 1494 [IB] 1495 Infiniband Architecture Specification, available from 1496 http://www.infinibandta.org 1498 [IBPORT] 1499 Infiniband Trade Association, "IP Addressing Annex", available 1500 from http://www.infinibandta.org 1502 [IANA-RPC] 1503 IANA Sun RPC number statement, 1504 http://www.iana.org/assignments/sun-rpc-numbers 1506 16. Authors' Addresses 1508 Tom Talpey 1509 Network Appliance, Inc. 1510 375 Totten Pond Road 1511 Waltham, MA 02451 USA 1513 Phone: +1 781 768 5329 1514 EMail: thomas.talpey@netapp.com 1516 Brent Callaghan 1517 Apple Computer, Inc. 1518 MS: 302-4K 1519 2 Infinite Loop 1520 Cupertino, CA 95014 USA 1522 EMail: brentc@apple.com 1524 17. Intellectual Property and Copyright Statements 1526 Full Copyright Statement 1528 Copyright (C) The IETF Trust (2007). 1530 This document is subject to the rights, licenses and restrictions 1531 contained in BCP 78, and except as set forth therein, the authors 1532 retain all their rights. 1534 This document and the information contained herein are provided on 1535 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 1536 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 1537 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 1538 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 1539 WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE 1540 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 1541 FOR A PARTICULAR PURPOSE. 1543 Intellectual Property 1544 The IETF takes no position regarding the validity or scope of any 1545 Intellectual Property Rights or other rights that might be claimed 1546 to pertain to the implementation or use of the technology described 1547 in this document or the extent to which any license under such 1548 rights might or might not be available; nor does it represent that 1549 it has made any independent effort to identify any such rights. 1550 Information on the procedures with respect to rights in RFC 1551 documents can be found in BCP 78 and BCP 79. 1553 Copies of IPR disclosures made to the IETF Secretariat and any 1554 assurances of licenses to be made available, or the result of an 1555 attempt made to obtain a general license or permission for the use 1556 of such proprietary rights by implementers or users of this 1557 specification can be obtained from the IETF on-line IPR repository 1558 at http://www.ietf.org/ipr. 1560 The IETF invites any interested party to bring to its attention any 1561 copyrights, patents or patent applications, or other proprietary 1562 rights that may cover technology that may be required to implement 1563 this standard. Please address the information to the IETF at ietf- 1564 ipr@ietf.org. 1566 Acknowledgment 1567 Funding for the RFC Editor function is provided by the IETF 1568 Administrative Support Activity (IASA).