idnits 2.17.1 draft-ietf-nfsv4-rpcrdma-version-two-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. 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 and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (4 February 2021) is 1170 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Obsolete informational reference (is this intentional?): RFC 793 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 5661 (Obsoleted by RFC 8881) -- Obsolete informational reference (is this intentional?): RFC 5666 (Obsoleted by RFC 8166) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network File System Version 4 C. Lever, Ed. 3 Internet-Draft Oracle 4 Intended status: Standards Track D. Noveck 5 Expires: 8 August 2021 NetApp 6 4 February 2021 8 RPC-over-RDMA Version 2 Protocol 9 draft-ietf-nfsv4-rpcrdma-version-two-04 11 Abstract 13 This document specifies the second version of a transport protocol 14 that conveys Remote Procedure Call (RPC) messages using Remote Direct 15 Memory Access (RDMA). This version of the protocol is extensible. 17 Note 19 Discussion of this draft takes place on the NFSv4 working group 20 mailing list (nfsv4@ietf.org), which is archived at 21 https://mailarchive.ietf.org/arch/browse/nfsv4/. Working Group 22 information can be found at https://datatracker.ietf.org/wg/nfsv4/ 23 about/. 25 This note is to be removed before publishing as an RFC. 27 The source for this draft is maintained in GitHub. Suggested changes 28 can be submitted as pull requests at https://github.com/chucklever/ 29 i-d-rpcrdma-version-two. Instructions are on that page as well. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at https://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on 8 August 2021. 48 Copyright Notice 50 Copyright (c) 2021 IETF Trust and the persons identified as the 51 document authors. All rights reserved. 53 This document is subject to BCP 78 and the IETF Trust's Legal 54 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 55 license-info) in effect on the date of publication of this document. 56 Please review these documents carefully, as they describe your rights 57 and restrictions with respect to this document. Code Components 58 extracted from this document must include Simplified BSD License text 59 as described in Section 4.e of the Trust Legal Provisions and are 60 provided without warranty as described in the Simplified BSD License. 62 This document may contain material from IETF Documents or IETF 63 Contributions published or made publicly available before November 64 10, 2008. The person(s) controlling the copyright in some of this 65 material may not have granted the IETF Trust the right to allow 66 modifications of such material outside the IETF Standards Process. 67 Without obtaining an adequate license from the person(s) controlling 68 the copyright in such materials, this document may not be modified 69 outside the IETF Standards Process, and derivative works of it may 70 not be created outside the IETF Standards Process, except to format 71 it for publication as an RFC or to translate it into languages other 72 than English. 74 Table of Contents 76 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 77 1.1. Design Goals . . . . . . . . . . . . . . . . . . . . . . 4 78 1.2. Motivation for a New Version . . . . . . . . . . . . . . 5 79 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 6 80 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6 81 3.1. Remote Procedure Calls . . . . . . . . . . . . . . . . . 6 82 3.2. Remote Direct Memory Access . . . . . . . . . . . . . . . 10 83 4. RPC-over-RDMA Framework . . . . . . . . . . . . . . . . . . . 13 84 4.1. Message Framing . . . . . . . . . . . . . . . . . . . . . 13 85 4.2. Managing Receiver Resources . . . . . . . . . . . . . . . 13 86 4.3. Using Direct Data Placement . . . . . . . . . . . . . . . 17 87 4.4. Encoding Chunks . . . . . . . . . . . . . . . . . . . . . 18 88 4.5. Reverse-Direction Operation . . . . . . . . . . . . . . . 22 89 5. Transport Properties . . . . . . . . . . . . . . . . . . . . 25 90 5.1. Transport Properties Model . . . . . . . . . . . . . . . 26 91 5.2. Current Transport Properties . . . . . . . . . . . . . . 27 92 6. Transport Messages . . . . . . . . . . . . . . . . . . . . . 30 93 6.1. Transport Header Types . . . . . . . . . . . . . . . . . 31 94 6.2. Headers and Chunks . . . . . . . . . . . . . . . . . . . 32 95 6.3. Header Types . . . . . . . . . . . . . . . . . . . . . . 33 96 6.4. Transport Header Prefix . . . . . . . . . . . . . . . . . 41 97 6.5. Remote Invalidation . . . . . . . . . . . . . . . . . . . 41 98 6.6. Payload Formats . . . . . . . . . . . . . . . . . . . . . 42 99 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 48 100 7.1. Basic Transport Stream Parsing Errors . . . . . . . . . . 49 101 7.2. XDR Errors . . . . . . . . . . . . . . . . . . . . . . . 50 102 7.3. Responder RDMA Operational Errors . . . . . . . . . . . . 51 103 7.4. Other Operational Errors . . . . . . . . . . . . . . . . 53 104 7.5. RDMA Transport Errors . . . . . . . . . . . . . . . . . . 54 105 8. XDR Protocol Definition . . . . . . . . . . . . . . . . . . . 54 106 8.1. Code Component License . . . . . . . . . . . . . . . . . 54 107 8.2. Extraction of the XDR Definition . . . . . . . . . . . . 56 108 8.3. XDR Definition for RPC-over-RDMA Version 2 Core 109 Structures . . . . . . . . . . . . . . . . . . . . . . . 57 110 8.4. XDR Definition for RPC-over-RDMA Version 2 Base Header 111 Types . . . . . . . . . . . . . . . . . . . . . . . . . . 59 112 8.5. Use of the XDR Description . . . . . . . . . . . . . . . 62 113 9. RPC Bind Parameters . . . . . . . . . . . . . . . . . . . . . 63 114 10. Implementation Status . . . . . . . . . . . . . . . . . . . . 64 115 11. Security Considerations . . . . . . . . . . . . . . . . . . . 64 116 11.1. Memory Protection . . . . . . . . . . . . . . . . . . . 65 117 11.2. RPC Message Security . . . . . . . . . . . . . . . . . . 66 118 11.3. Transport Properties . . . . . . . . . . . . . . . . . . 69 119 11.4. Host Authentication . . . . . . . . . . . . . . . . . . 70 120 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 70 121 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 70 122 13.1. Normative References . . . . . . . . . . . . . . . . . . 70 123 13.2. Informative References . . . . . . . . . . . . . . . . . 72 124 Appendix A. ULB Specifications . . . . . . . . . . . . . . . . . 74 125 A.1. DDP-Eligibility . . . . . . . . . . . . . . . . . . . . . 74 126 A.2. Maximum Reply Size . . . . . . . . . . . . . . . . . . . 75 127 A.3. Reverse-Direction Operation . . . . . . . . . . . . . . . 76 128 A.4. Additional Considerations . . . . . . . . . . . . . . . . 76 129 A.5. ULP Extensions . . . . . . . . . . . . . . . . . . . . . 76 130 Appendix B. Extending RPC-over-RDMA Version 2 . . . . . . . . . 77 131 B.1. Documentation Requirements . . . . . . . . . . . . . . . 77 132 B.2. Adding New Header Types to RPC-over-RDMA Version 2 . . . 78 133 B.3. Adding New Transport properties to the Protocol . . . . . 79 134 B.4. Adding New Error Codes to the Protocol . . . . . . . . . 80 135 Appendix C. Differences from RPC-over-RDMA Version 1 . . . . . . 80 136 C.1. Changes to the XDR Definition . . . . . . . . . . . . . . 80 137 C.2. Transport Properties . . . . . . . . . . . . . . . . . . 82 138 C.3. Credit Management Changes . . . . . . . . . . . . . . . . 82 139 C.4. Inline Threshold Changes . . . . . . . . . . . . . . . . 83 140 C.5. Message Continuation Changes . . . . . . . . . . . . . . 84 141 C.6. Host Authentication Changes . . . . . . . . . . . . . . . 84 142 C.7. Support for Remote Invalidation . . . . . . . . . . . . . 85 143 C.8. Integration of Reverse-Direction Operation . . . . . . . 86 144 C.9. Error Reporting Changes . . . . . . . . . . . . . . . . . 86 145 C.10. Changes in Terminology . . . . . . . . . . . . . . . . . 87 146 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 87 147 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 88 149 1. Introduction 151 Remote Direct Memory Access (RDMA) [RFC5040] [RFC5041] [IBA] is a 152 technique for moving data efficiently between network nodes. By 153 placing transferred data directly into destination buffers using 154 Direct Memory Access, RDMA delivers the reciprocal benefits of faster 155 data transfer and reduced host CPU overhead. 157 Open Network Computing Remote Procedure Call (ONC RPC, often 158 shortened in NFSv4 documents to RPC) [RFC5531] is a Remote Procedure 159 Call protocol that runs over a variety of transports. Most RPC 160 implementations today use UDP [RFC0768] or TCP [RFC0793]. On UDP, a 161 datagram encapsulates each RPC message. Within a TCP byte stream, a 162 record marking protocol delineates RPC messages. 164 An RDMA transport, too, conveys RPC messages in a fashion that must 165 be fully defined if RPC implementations are to interoperate when 166 using RDMA to transport RPC transactions. Although RDMA transports 167 encapsulate messages like UDP, they deliver them reliably and in 168 order, like TCP. Further, they implement a bulk data transfer 169 service not provided by traditional network transports. Therefore, 170 we treat RDMA as a novel transport type for RPC. 172 1.1. Design Goals 174 The general mission of RPC-over-RDMA transports is to leverage 175 network hardware capabilities to reduce host CPU needs related to the 176 transport of RPC messages. In particular, this includes mitigating 177 host interrupt rates and limiting the necessity to copy RPC payload 178 bytes on receivers. 180 These hardware capabilities benefit both RPC clients and servers. On 181 balance, however, the RPC-over-RDMA protocol design approach has been 182 to bolster clients more than servers, as the client is typically 183 where applications are most hungry for CPU resources. 185 Additionally, RPC-over-RDMA transports are designed to support RPC 186 applications transparently. However, such transports can also 187 provide mechanisms that enable further optimization of data transfer 188 when RPC applications are structured to exploit direct data 189 placement. In this context, the Network File System (NFS) family of 190 protocols (as described in [RFC1094], [RFC1813], [RFC7530], 191 [RFC5661], [RFC7862], and subsequent NFSv4 minor versions) are all 192 potential beneficiaries of RPC-over-RDMA. 194 A complete problem statement appears in [RFC5532]. 196 1.2. Motivation for a New Version 198 Storage administrators have broadly deployed the RPC-over-RDMA 199 version 1 protocol specified in [RFC8166]. However, there are known 200 shortcomings to this protocol: 202 * The protocol's default size of Receive buffers forces the use of 203 RDMA Read and Write transfers for small payloads, and limits the 204 size of reverse-direction messages. 206 * It is difficult to make optimizations or protocol fixes that 207 require changes to on-the-wire behavior. 209 * For some RPC procedures, the maximum reply size is difficult or 210 impossible for an RPC client to estimate in advance. 212 To address these issues in a way that preserves interoperation with 213 existing RPC-over-RDMA version 1 deployments, the current document 214 presents an updated version of the RPC-over-RDMA transport protocol. 216 This version of RPC-over-RDMA is extensible, enabling the 217 introduction of OPTIONAL extensions without impacting existing 218 implementations. See Appendix C.1 for further discussion. It 219 introduces a mechanism to exchange implementation properties to 220 automatically provide further optimization of data transfer. 222 This version also contains incremental changes that relieve 223 performance constraints and enable recovery from unusual corner 224 cases. These changes are outlined in Appendix C and include a larger 225 default inline threshold, the ability to convey a single RPC message 226 using multiple RDMA Send operations, support for authentication of 227 connection peers, richer error reporting, improved credit-based flow 228 control, and support for Remote Invalidation. 230 2. Requirements Language 232 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 233 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 234 "OPTIONAL" in this document are to be interpreted as described in 235 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 236 capitals, as shown here. 238 3. Terminology 240 3.1. Remote Procedure Calls 242 This section highlights critical elements of the RPC protocol 243 [RFC5531] and the External Data Representation (XDR) [RFC4506] it 244 uses. RPC-over-RDMA version 2 enables the transmission of RPC 245 messges built using XDR and also uses XDR internally to describe its 246 header format. 248 3.1.1. Upper-Layer Protocols 250 RPCs are an abstraction used to implement the operations of an Upper- 251 Layer Protocol (ULP). For RPC-over-RDMA, "ULP" refers to an RPC 252 Program and Version tuple, which is a versioned set of procedure 253 calls that comprise a single well-defined API. One example of a ULP 254 is the Network File System Version 4.0 [RFC7530]. In the current 255 document, the term "RPC consumer" refers to an implementation of a 256 ULP running on an RPC client. 258 3.1.2. Requesters and Responders 260 Like a local procedure call, every RPC procedure has a set of 261 "arguments" and a set of "results". A calling context invokes a 262 procedure, passing arguments to it, and the procedure subsequently 263 returns a set of results. Unlike a local procedure call, the called 264 procedure is executed remotely rather than in the local application's 265 execution context. 267 The RPC protocol as described in [RFC5531] is fundamentally a 268 message-passing protocol between one or more clients, where RPC 269 consumers are running, and a server, where a remote execution context 270 is available to process RPC transactions on behalf of these 271 consumers. 273 ONC RPC transactions consist of two types of messages: 275 * A CALL message, or "Call", requests work. An RPC Call message is 276 designated by the value zero (0) in the message's msg_type field. 277 The sender places a unique 32-bit value in the message's XID field 278 to match this RPC Call message to a corresponding RPC Reply 279 message. 281 * A REPLY message, or "Reply", reports the results of work requested 282 by an RPC Call message. An RPC Reply message is designated by the 283 value one (1) in the message's msg_type field. The sender copies 284 the value contained in an RPC Reply message's XID field from the 285 RPC Call message whose results the sender is reporting. 287 Each RPC client endpoint acts as a "Requester", which serializes the 288 procedure's arguments and conveys them to a server endpoint via an 289 RPC Call message. A Call message contains an RPC protocol header, a 290 header describing the requested upper-layer operation, and all 291 arguments. 293 An RPC server endpoint acts as a "Responder", which deserializes the 294 arguments and processes the requested operation. It then serializes 295 the operation's results into an RPC Reply message. An RPC Reply 296 message contains an RPC protocol header, a header describing the 297 upper-layer reply, and all results. 299 The Requester deserializes the results and allows the RPC consumer to 300 proceed. At this point, the RPC transaction designated by the XID in 301 the RPC Call message is complete, and the XID is retired. 303 In summary, Requesters send RPC Call messages to Responders to 304 initiate RPC transactions. Responders send RPC Reply messages to 305 Requesters to complete the processing on an RPC transaction. 307 3.1.3. RPC Transports 309 The role of an "RPC transport" is to mediate the exchange of RPC 310 messages between Requesters and Responders. An RPC transport bridges 311 the gap between the RPC message abstraction and the native operations 312 of a network transport (e.g., a socket). 314 RPC-over-RDMA is a connection-oriented RPC transport. When a 315 transport type is connection-oriented, clients initiate transport 316 connections, while servers wait passively to accept incoming 317 connection requests. 319 3.1.3.1. Transport Failure Recovery 321 So that appropriate and timely recovery action can be taken, the 322 transport implementation is responsible for notifying a Requester 323 when an RPC Call or Reply was not able to be conveyed. Recovery can 324 take the form of establishing a new connection, re-sending RPC Calls, 325 or terminating RPC transactions pending on the Requester. 327 For instance, a connection loss may occur after a Responder has 328 received an RPC Call but before it can send the matching RPC Reply. 329 Once the transport notifies the Requester of the connection loss, the 330 Requester can re-send all pending RPC Calls on a fresh connection. 332 3.1.3.2. Forward Direction 334 Traditionally, an RPC client acts as a Requester, while an RPC 335 service acts as a Responder. The current document refers to this 336 direction of RPC message passing as "forward-direction" operation. 338 3.1.3.3. Reverse-Direction 340 The RPC specification [RFC5531] does not forbid performing RPC 341 transactions in the other direction. An RPC service endpoint can act 342 as a Requester, in which case an RPC client endpoint acts as a 343 Responder. This direction of RPC message passing is known as 344 "reverse-direction" operation. 346 During reverse-direction operation, an RPC client is responsible for 347 establishing transport connections, even though the RPC server 348 originates RPC Calls. 350 RPC clients and servers are usually optimized to perform and scale 351 well when handling traffic in the forward direction. They might not 352 be prepared to handle operation in the reverse direction. Not until 353 NFS version 4.1 [RFC5661] has there been a strong need to handle 354 reverse-direction operation. 356 3.1.3.4. Bi-directional Operation 358 A pair of connected RPC endpoints may choose to use only forward- 359 direction or only reverse-direction operation on a particular 360 transport connection. Or, these endpoints may send Calls in both 361 directions concurrently on the same transport connection. 363 "Bi-directional operation" occurs when both transport endpoints act 364 as a Requester and a Responder at the same time on a single 365 connection. 367 Bi-directionality is an extension of RPC transport connection 368 sharing. Two RPC endpoints wish to exchange independent RPC messages 369 over a shared connection but in opposite directions. These messages 370 may or may not be related to the same workloads or RPC Programs. 372 3.1.3.5. XID Values 374 Section 9 of [RFC5531] introduces the RPC transaction identifier, or 375 "XID" for short. A connection peer interprets the value of an XID in 376 the context of the message's msg_type field. 378 * The XID of a Call is arbitrary but is unique among outstanding 379 Calls from that Requester on that connection. 381 * The XID of a Reply always matches that of the initiating Call. 383 After receiving a Reply, a Requester matches the XID value in that 384 Reply with a Call it previously sent. 386 During bi-directional operation, forward- and reverse- direction XIDs 387 are typically generated on distinct hosts by possibly different 388 algorithms. There is no coordination between the generation of XIDs 389 used in forward-direction and reverse-direction operation. 391 Therefore, a forward-direction Requester MAY use the same XID value 392 at the same time as a reverse-direction Requester on the same 393 transport connection. Although such concurrent requests use the same 394 XID value, they represent distinct RPC transactions. 396 3.1.4. External Data Representation 398 One cannot assume that all Requesters and Responders represent data 399 objects in the same way internally. RPC uses External Data 400 Representation (XDR) to translate native data types and serialize 401 arguments and results [RFC4506]. 403 XDR encodes data independently of the endianness or size of host- 404 native data types, enabling unambiguous decoding of data by a 405 receiver. 407 XDR assumes only that the number of bits in a byte (octet) and their 408 order are the same on both endpoints and the physical network. The 409 smallest indivisible unit of XDR encoding is a group of four octets. 410 XDR can also flatten lists, arrays, and other complex data types into 411 a stream of bytes. 413 We refer to a serialized stream of bytes that is the result of XDR 414 encoding as an "XDR stream". A sender encodes native data into an 415 XDR stream and then transmits that stream to a receiver. The 416 receiver decodes incoming XDR byte streams into its native data 417 representation format. 419 3.1.4.1. XDR Opaque Data 421 Sometimes, a data item is to be transferred as-is, without encoding 422 or decoding. We refer to the contents of such a data item as "opaque 423 data". XDR encoding places the content of opaque data items directly 424 into an XDR stream without altering it in any way. ULPs or 425 applications perform any needed data translation in this case. 426 Examples of opaque data items include the content of files or generic 427 byte strings. 429 3.1.4.2. XDR Roundup 431 The number of octets in a variable-length data item precedes that 432 item in an XDR stream. If the size of an encoded data item is not a 433 multiple of four octets, the sender appends octets containing zero 434 after the end of the data item. These zero octets shift the next 435 encoded data item in the XDR stream so that it always starts on a 436 four-octet boundary. The addition of extra octets does not change 437 the encoded size of the data item. Receivers do not expose the extra 438 octets to ULPs. 440 We refer to this technique as "XDR roundup", and the extra octets as 441 "XDR roundup padding". 443 3.2. Remote Direct Memory Access 445 When a third party transfers large RPC payloads, RPC Requesters and 446 Responders can become more efficient. An example of such a third 447 party might be an intelligent network interface (data movement 448 offload), which places data in the receiver's memory so that no 449 additional adjustment of data alignment is necessary (direct data 450 placement or "DDP"). RDMA transports enable both of these 451 optimizations. 453 In the current document, the standalone term "RDMA" refers to the 454 physical mechanism an RDMA transport utilizes when moving data. 456 3.2.1. Direct Data Placement 458 Typically, RPC implementations copy the contents of RPC messages into 459 a buffer before being sent. An efficient RPC implementation sends 460 bulk data without first copying it into a separate send buffer. 462 However, socket-based RPC implementations are often unable to receive 463 data directly into its final place in memory. Receivers often need 464 to copy incoming data to finish an RPC operation, if only to adjust 465 data alignment. 467 Although it may not be efficient, before an RDMA transfer, a sender 468 may copy data into an intermediate buffer. After an RDMA transfer, a 469 receiver may copy that data again to its final destination. In this 470 document, the term "DDP" refers to any optimized data transfer where 471 a receiving host's CPU does not move transferred data to another 472 location after arrival. 474 RPC-over-RDMA version 2 enables the use of RDMA Read and Write 475 operations to achieve both data movement offload and DDP. However, 476 note that not all RDMA-based data transfer qualifies as DDP, and some 477 mechanisms that do not employ explicit RDMA can place data directly. 479 3.2.2. RDMA Transport Operation 481 RDMA transports require that RDMA consumers provision resources in 482 advance to achieve good performance during receive operations. An 483 RDMA consumer might provide Receive buffers in advance by posting an 484 RDMA Receive Work Request for every expected RDMA Send from a remote 485 peer. These buffers are provided before the remote peer posts RDMA 486 Send Work Requests. Thus this is often referred to as "pre-posting" 487 buffers. 489 An RDMA Receive Work Request remains outstanding until the RDMA 490 provider matches it to an inbound Send operation. The resources 491 associated with that Receive must be retained in host memory, or 492 "pinned", until the Receive completes. 494 Given these tenets of operation, the RPC-over-RDMA version 2 protocol 495 assumes each transport provides the following abstract operations. A 496 more complete discussion of these operations appears in [RFC5040]. 498 3.2.2.1. Memory Registration 500 Memory registration assigns a steering tag to a region of memory, 501 permitting the RDMA provider to perform data-transfer operations. 502 The RPC-over-RDMA version 2 protocol assumes that a steering tag of 503 no more than 32 bits and memory addresses of up to 64 bits in length 504 identifies each registered memory region. 506 3.2.2.2. RDMA Send 508 The RDMA provider supports an RDMA Send operation, with completion 509 signaled on the receiving peer after the RDMA provider has placed 510 data in a pre-posted buffer. Sends complete at the receiver in the 511 order they were posted at the sender. The size of the remote peer's 512 pre-posted buffers limits the amount of data that can be transferred 513 by a single RDMA Send operation. 515 3.2.2.3. RDMA Receive 517 The RDMA provider supports an RDMA Receive operation to receive data 518 conveyed by incoming RDMA Send operations. To reduce the amount of 519 memory that must remain pinned awaiting incoming Sends, the amount of 520 memory posted per Receive is limited. The RDMA consumer (in this 521 case, the RPC-over-RDMA version 2 protocol) provides flow control to 522 prevent overrunning receiver resources. 524 3.2.2.4. RDMA Write 526 The RDMA provider supports an RDMA Write operation to place data 527 directly into a remote memory region. The local host initiates an 528 RDMA Write and the RDMA provider signals completion there. The 529 remote RDMA provider does not signal completion on the remote peer. 530 The local host provides the steering tag, the memory address, and the 531 length of the remote peer's memory region. 533 RDMA Writes are not ordered relative to one another, but are ordered 534 relative to RDMA Sends. Thus, a subsequent RDMA Send completion 535 signaled on the local peer guarantees that prior RDMA Write data has 536 been successfully placed in the remote peer's memory. 538 3.2.2.5. RDMA Read 540 The RDMA provider supports an RDMA Read operation to place remote 541 source data directly into local memory. The local host initiates an 542 RDMA Read and and the RDMA provider signals completion there. The 543 remote RDMA provider does not signal completion on the remote peer. 544 The local host provides the steering tags, the memory addresses, and 545 the lengths for the remote source and local destination memory 546 regions. 548 The RDMA consumer (in this case, the RPC-over-RDMA version 2 549 protocol) signals Read completion to the remote peer as part of a 550 subsequent RDMA Send message. The remote peer can then invalidate 551 steering tags and subsequently free associated source memory regions. 553 4. RPC-over-RDMA Framework 555 Before an RDMA data transfer can occur, an endpoint first exposes 556 regions of its memory to a remote endpoint. The remote endpoint then 557 initiates RDMA Read and Write operations against the exposed memory. 558 A "transfer model" designates which endpoint exposes its memory and 559 which is responsible for initiating the transfer of data. 561 In RPC-over-RDMA version 2, only Requesters expose their memory to 562 the Responder, and only Responders initiate RDMA Read and Write 563 operations. Read access to memory regions enables the Responder to 564 pull RPC arguments or whole RPC Calls from each Requester. The 565 Responder pushes RPC results or whole RPC Replies to a Requester's 566 memory regions to which it has write access. 568 4.1. Message Framing 570 Each RPC-over-RDMA version 2 message consists of at most two XDR 571 streams: 573 * The "Transport stream" contains a header that describes and 574 controls the transfer of the Payload stream in this RPC-over-RDMA 575 message. Every RDMA Send on an RPC-over-RDMA version 2 connection 576 MUST begin with a Transport stream. 578 * The "Payload stream" contains part or all of a single RPC message. 579 The sender MAY divide an RPC message at any convenient boundary 580 but MUST send RPC message fragments in XDR stream order and MUST 581 NOT interleave Payload streams from multiple RPC messages. 583 The RPC-over-RDMA framing mechanism described in this section 584 replaces all other RPC framing mechanisms. Connection peers use RPC- 585 over-RDMA framing even when the underlying RDMA protocol runs on a 586 transport type with well-defined RPC framing, such as TCP. However, 587 a ULP can negotiate the use of RDMA, dynamically enabling the use of 588 RPC-over-RDMA on a connection established on some other transport 589 type. Because RPC framing delimits an entire RPC request or reply, 590 the resulting shift in framing must occur between distinct RPC 591 messages, and in concert with the underlying transport. 593 4.2. Managing Receiver Resources 595 If any pre-posted Receive buffer on the connection is not large 596 enough to accept an incoming RDMA Send, the RDMA provider can 597 terminate the connection. Likewise, if a pre-posted Receive buffer 598 is not available to accept an incoming RDMA Send, the RDMA provider 599 can terminate the connection. Therefore, a sender needs to respect 600 the resource limits of its peer receiver to ensure the longevity of 601 each connection. Two operational parameters communicate these limits 602 between connection peers: credit grants, and inline threshold. 604 4.2.1. Flow Control 606 Therefore, RPC-over-RDMA transports MUST operate only on a reliable 607 Queue Pair (QP) such as the RDMA RC (Reliable Connected) QP type as 608 defined in Section 9.7.7 of [IBA]. The Marker PDU Aligned (MPA) 609 protocol [RFC5044], when deployed on a reliable transport such as 610 TCP, provides similar functionality. The use of a reliable QP type 611 ensures in-transit data integrity and proper recovery from link-layer 612 packet loss or misordering. 614 However, RPC-over-RDMA itself provides a flow control mechanism to 615 prevent a sender from overwhelming receiver resources. RPC-over-RDMA 616 transports employ end-to-end credit-based flow control for this 617 purpose [CBFC]. Credit-based flow control is relatively simple, 618 providing robust operation in the face of bursty traffic and 619 automated management of receive buffer allocation. 621 4.2.1.1. Granting Credits 623 An RPC-over-RDMA version 2 credit is the capability to receive one 624 RPC-over-RDMA version 2 message. This arrangement enables RPC-over- 625 RDMA version 2 to support asymmetrical operation, where a message in 626 one direction might trigger zero, one, or multiple messages in the 627 other direction in response. 629 Each posted Receive buffer on both connection peers receives one 630 credit. Thus, each Requester has a set of Receive credits, and each 631 Responder has a set of Receive credits. These credit values are 632 managed independently of one another. 634 Section 7 of [RFC8166] requires that the 32-bit field containing the 635 credit grant is the third word in the transport header. To conform 636 with that requirement, senders encode the two independent credit 637 values into a single 32-bit field in the fixed portion of the 638 transport header. At the receiver, the low-order two bytes are the 639 number of credits that are newly granted by the sender. The granted 640 credit value MUST NOT be zero since such a value would result in 641 deadlock. The high-order two bytes are the maximum number of credits 642 that can be outstanding at the sender. 644 A sender must avoid posting more RDMA Send messages than the 645 receiver's granted credit limit. If the sender exceeds the granted 646 value, the RDMA provider might signal an error, possibly terminating 647 the connection. 649 The granted credit values MAY be adjusted to match the needs or 650 policies in effect on either peer. For instance, a peer may reduce 651 its granted credit value to accommodate the available resources in a 652 Shared Receive Queue. 654 Certain RDMA implementations may impose additional flow-control 655 restrictions, such as limits on RDMA Read operations in progress at 656 the Responder. Accommodation of such restrictions is considered the 657 responsibility of each RPC-over-RDMA version 2 implementation. 659 4.2.1.2. Asynchronous Credit Grants 661 A special header type enables one peer to refresh its credit grant to 662 the other peer without sending an RPC payload. A receiving peer can 663 use this when the sender's credit grant is exhausted in the midst of 664 a stream of continued messages. See Section 6.3.2 for information 665 about this header type. 667 Receivers MUST always be in a position to receive one such credit 668 grant update message, in addition to payload-bearing messages, to 669 prevent transport deadlock. One way a receiver can do this is to 670 post one more RDMA Receive than the credit value the receiver 671 granted. 673 4.2.2. Inline Threshold 675 An "inline threshold" value is the largest message size (in octets) 676 that can be conveyed in one direction between peer implementations 677 using RDMA Send and Receive channel operations. An inline threshold 678 value is less than the largest number of octets the sender can post 679 in a single RDMA Send operation. It is also less than the largest 680 number of octets the receiver can reliably accept via a single RDMA 681 Receive operation. 683 Each connection has two inline threshold values. There is one for 684 messages flowing from Requester-to-Responder, referred to as the 685 "call inline threshold", and one for messages flowing from Responder- 686 to-Requester, referred to as the "reply inline threshold." 688 Peers can advertise their inline threshold values via RPC-over-RDMA 689 version 2 Transport Properties (see Section 5). In the absence of an 690 exchange of Transport Properties, connection peers MUST assume both 691 inline thresholds are 4096 octets. 693 4.2.3. Initial Connection State 695 When an RPC-over-RDMA version 2 client establishes a connection to a 696 server, its first order of business is to determine the server's 697 highest supported protocol version. 699 Upon connection establishment, a client MUST send only a single RPC- 700 over-RDMA message until it receives a valid RPC-over-RDMA message 701 from the server that grants client credits. 703 The second word of each transport header conveys the transport 704 protocol version. In the interest of clarity, the current document 705 refers to that word as rdma_vers even though in the RPC-over-RDMA 706 version 2 XDR definition, it appears as rdma_start.rdma_vers. 708 Immediately after the client establishes a connection, it sends a 709 single valid RPC-over-RDMA message with the value two (2) in the 710 rdma_vers field. Because the server might support only RPC-over-RDMA 711 version 1, this initial message MUST NOT be larger than the version 1 712 default inline threshold of 1024 octets. 714 4.2.3.1. Server Supports RPC-over-RDMA Version 2 716 If the server supports RPC-over-RDMA version 2, it sends RPC-over- 717 RDMA messages back to the client with the value two (2) in the 718 rdma_vers field. Both peers may assume the default inline threshold 719 value for RPC-over-RDMA version 2 connections (4096 octets). 721 4.2.3.2. Server Does Not Support RPC-over-RDMA Version 2 723 If the server does not support RPC-over-RDMA version 2, it MUST send 724 an RPC-over-RDMA message to the client with an XID that matches the 725 client's first message, RDMA2_ERROR in the rdma_start.rdma_htype 726 field, and with the error code RDMA2_ERR_VERS. This message also 727 reports the range of RPC-over-RDMA protocol versions that the server 728 supports. To continue operation, the client selects a protocol 729 version in that range for subsequent messages on this connection. 731 If the connection is dropped immediately after an RDMA2_ERROR/ 732 RDMA2_ERR_VERS message is received, the client should try to avoid a 733 version negotiation loop when re-establishing another connection. It 734 can assume that the server does not support RPC-over-RDMA version 2. 735 A client can assume the same situation (i.e., no server support for 736 RPC-over-RDMA version 2) if the initial negotiation message is lost 737 or dropped. Once the version negotiation exchange is complete, both 738 peers may use the default inline threshold value for the negotiated 739 transport protocol version. 741 4.2.3.3. Client Does Not Support RPC-over-RDMA Version 2 743 The server examines the RPC-over-RDMA protocol version used in the 744 first RPC-over-RDMA message it receives. If it supports this 745 protocol version, it MUST use it in all subsequent messages it sends 746 on that connection. The client MUST NOT change the protocol version 747 for the duration of the connection. 749 4.3. Using Direct Data Placement 751 RPC-over-RDMA version 2 provides a mechanism for moving part of an 752 RPC message via a data transfer distinct from RDMA Send and Receive. 753 For example, a sender can remove one or more XDR data items from the 754 Payload stream. These items are then conveyed via other mechanisms, 755 such as one or more RDMA Read or Write operations. 757 4.3.1. Chunks and Segments 759 A Requester records the location information for each registered 760 memory region associated with an RPC payload in the transport header 761 of an RPC-over-RDMA message. With this information, the Responder 762 uses RDMA Read and Write operations to retrieve arguments contained 763 in the specified region of the Requester's memory or place results in 764 that region. 766 A "segment" is a transport header data object that contains the 767 precise coordinates of a contiguous registered memory region. Each 768 segment contains the following information: 770 Handle: A steering Tag (STag) or R_key generated by registering this 771 memory with the RDMA provider. 773 Length: The length of the segment's memory region, in octets. The 774 length of a segment MAY be aligned to a single octet. An "empty 775 segment" is defined as a segment with the value zero (0) in its 776 length field. 778 Offset: The offset or beginning memory address of the segment's 779 memory region. 781 The meaning of the values contained in these fields is elaborated in 782 [RFC5040]. 784 A "chunk" is simply a set of segments that have a related purpose. A 785 Requester MAY divide a chunk into segments using any convenient 786 boundaries. The length of a chunk is defined as the sum of the 787 lengths of the segments that comprise it. 789 4.3.2. Reducing a Payload Stream 791 We refer to a data item that a sender removes from a Payload stream 792 to transmit separately as a "reduced" data item. After a sender has 793 finished removing XDR data items from a Payload stream, we refer to 794 it as a "reduced" Payload stream. A set of segments that describe 795 memory regions containing a single reduced data item is categorized 796 as a "data item chunk." 798 Not all XDR data items benefit from Direct Data Placement. For 799 example, small data items or data items that require XDR unmarshaling 800 by the receiver do not benefit from DDP. Moreover, it is impractical 801 for receivers to prepare for every possible XDR data item in a 802 protocol to appear in a data item chunk. 804 Specifying which data items are DDP-eligible is done in separate 805 standards track documents known as "Upper Layer Bindings". A ULB 806 identifies which XDR data items a peer MAY transfer using DDP. We 807 refer to such data items as "DDP-eligible." Senders MUST NOT reduce 808 any other XDR data items. Detailed requirements for ULB 809 specifications appear in Appendix A of the current document. 811 4.3.3. Moving Whole RPC Messages using Explicit RDMA 813 RPC-over-RDMA version 2 also enables the movement of a whole RPC 814 message via data transfer distinct from RDMA Send and Receive. A 815 sender registers the memory containing a Payload stream without 816 regard to data item boundaries or DDP-eligibility. The Payload 817 stream is then conveyed via other mechanisms, such as one or more 818 RDMA Read or Write operations. A set of segments that describe 819 memory regions containing a Payload stream is categorized as a "body 820 chunk". 822 A sender may first reduce that Payload stream if it contains one or 823 more DDP-eligible data items. The sender moves these data items 824 using data items chunks, and the reduced Payload stream using a body 825 chunk. 827 4.4. Encoding Chunks 829 The RPC-over-RDMA version 2 transport protocol does not place a limit 830 on chunk size. However, each ULP may cap the amount of data that can 831 be transferred by a single RPC transaction. For example, NFS 832 implementations typically have settings that restrict the payload 833 size of NFS READ and WRITE operations. The Responder can use such 834 limits to sanity check chunk sizes before using them in RDMA 835 operations. 837 4.4.1. Read Chunks 839 A "Read chunk" contains data that its receiver pulls from the sender. 840 Each Read chunk is a set of one or more "Read segments" encoded as a 841 list. A Read segment consists of a Position field followed by a 842 segment, as defined in Section 4.3.1. 844 Position: The byte offset in the unreduced Payload stream where the 845 receiver reinserts the data item conveyed in the chunk. The 846 sender MUST compute the Position value from the beginning of the 847 unreduced Payload stream, which begins at Position zero. All 848 segments in the same Read chunk share the same Position value, 849 even if one or more of the segments have a non-four-byte-aligned 850 length. The value in this field MUST be a multiple of four. 852 When constructing an RPC-over-RDMA message, the sender registers 853 memory regions containing data intended for RDMA Read operations. It 854 advertises the coordinates of these regions in Read chunks added to 855 the transport header of an RPC-over-RDMA message. 857 The receiver of this message then pulls the chunk's data from the 858 sender using RDMA Read operations. When receiving a Read chunk, the 859 receiver inserts the first Read segment in a Read chunk into the 860 Payload stream at the byte offset indicated by its Position field. 861 The receiver concatenates Read segments whose Position field value 862 matches this offset until there are no more Read segments at that 863 Position value. 865 4.4.1.1. The Read List 867 Each RPC-over-RDMA message carries a list of Read segments that make 868 up the set of Read chunks for that message. When no RDMA Read 869 operations are needed to complete the transmission of the message's 870 Payload stream, the message's Read list is empty. 872 If a Responder receives a Read list whose segment position values do 873 not appear in monotonically increasing order, it MUST discard the 874 message without processing it and respond with an RDMA2_ERROR message 875 with the rdma_xid field set to the XID of the malformed message and 876 the rdma_err field set to RDMA2_ERR_BAD_XDR. 878 4.4.1.2. The Call Chunk 880 The Call chunk is a Read chunk that acts as a body chunk containing 881 an RPC Call message. A Requester can utilize a Call chunk at any 882 time. However, using a Call chunk is less efficient than an RDMA 883 Send. 885 A Read chunk may act as either a data item chunk or a body chunk. 886 When the chunk's position is zero, it acts as a body chunk. 887 Otherwise, it is a data item chunk containing exactly one XDR data 888 item. 890 4.4.1.3. Read Completion 892 A Responder acknowledges that it is finished with the Requester's 893 Read chunk memory regions when it sends the corresponding RPC Reply 894 message. The Requester may then invalidate memory regions belonging 895 to Read chunks associated with the associated RPC Call message. 897 4.4.2. Write Chunks 899 Each "Write chunk" consists of a counted array of zero or more 900 segments, as defined in Section 4.3.1. The function of a Write chunk 901 depends on the direction of the containing RPC-over-RDMA message. In 902 a Call message, a Write chunk advertises registered memory regions 903 into which the Responder may push data. In a Reply message, a Write 904 chunk reports how much data has been pushed. 906 A Requester provisions Write chunks for an RPC transaction long 907 before the Responder has constructed a corresponding Reply message. 908 A Requester typically does not know the actual length of the result 909 data items or Reply to be returned, since the Reply does not yet 910 exist. Thus, a Requester MUST provision Write chunks large enough to 911 accommodate the maximum possible size of each returned data item. 913 An "empty Write chunk" is a Write chunk with a zero segment count. 914 By definition, the length of an empty Write chunk is zero. An 915 "unused Write chunk" has a non-zero segment count, but all of its 916 segments are empty segments. 918 4.4.2.1. The Write List 920 Each RPC-over-RDMA message carries a list of Write chunks. When no 921 DDP-eligible data items are to appear in the Reply to an RPC 922 transaction, the Requester provides an empty Write list in the RPC 923 Call, and the Responder leaves the Write list empty in the matching 924 RPC Reply. When a Write chunk appears in the Write list, it acts 925 only as a data item chunk. 927 For each Write chunk in the Write list, the Responder pushes one DDP- 928 eligible data item to the Requester. It fills the chunk contiguously 929 and in segment array order until the Responder has written that data 930 item to the Requester in its entirety. The Responder MUST copy the 931 segment count and all segments from the Requester-provided Write 932 chunk into the RPC Reply message's transport header. As it does so, 933 the Responder updates each segment length field to reflect the actual 934 amount of data returned in that segment. 936 The Responder then sends the RPC Reply message via an RDMA Send 937 operation. 939 4.4.2.2. The Reply Chunk 941 The Reply chunk is a single Write chunk that acts as a body chunk. 942 that contains an RPC Reply message. When a Requester estimates that 943 the Reply message can exceed the connection's ability to convey that 944 Reply using RDMA Send operations, it should provision a Reply chunk. 946 4.4.2.3. Write Completion 948 A Responder acknowledges that it is finished updating the Requester's 949 Write chunk memory regions when it sends the corresponding RPC Reply 950 message. The RDMA provider guarantees that the written data is at 951 rest before the next Receive operation, which typically contains the 952 corresponding RPC Reply, completes. The Requester may then 953 invalidate memory regions belonging to Write chunks associated with 954 the associated RPC Call message. 956 4.4.2.4. Write Chunk Roundup 958 When provisioning a Write chunk for a variable-length result data 959 item, the Requester MUST NOT include additional space for XDR roundup 960 padding. A Responder MUST NOT write XDR roundup padding into a Write 961 chunk, even if the result is shorter than the available space in the 962 chunk. 964 4.4.3. Reducing Complex XDR Data Types 966 XDR data items may appear in body chunks without regard to their DDP- 967 eligibility. As body chunks contain a Payload stream, they MUST 968 include all appropriate XDR roundup padding to maintain proper XDR 969 alignment of their contents. 971 However, a data item chunk MUST contain only one XDR data item, and 972 the chunk MUST occupy a four-byte aligned length in the Payload 973 stream so that subsequent data items remain properly aligned once the 974 reduced data item is removed from the Payload stream. 976 4.4.3.1. Variable-Length Data Items 978 When a sender reduces a variable-length XDR data item, the length of 979 the item MUST remain in the Payload stream. The sender MUST omit the 980 item's XDR roundup padding from the Payload stream and the chunk. 981 The chunk's total length MUST be the same as the encoded length of 982 the data item. 984 4.4.3.2. Counted Arrays 986 When reducing a data item that is a counted array data type, the 987 count of array elements MUST remain in the Payload stream. The 988 sender MUST move the array elements into the chunk. For example, 989 when encoding an opaque byte array as a chunk, the count of bytes 990 stays in the Payload stream, and the sender places the bytes in the 991 array in the chunk. 993 Individual array elements appear in a chunk in their entirety. For 994 example, when encoding an array of arrays as a chunk, the count of 995 items in the enclosing array stays in the Payload stream. But each 996 enclosed array, including its item count, is transferred as part of 997 the chunk. 999 4.4.3.3. Optional-Data 1001 Similar to a counted array, when reducing an optional-data data type, 1002 the discriminator field MUST remain in the Payload stream. The 1003 sender MUST place the data, when present, in the chunk. 1005 4.4.3.4. XDR Unions 1007 A union data type MUST NOT be made DDP-eligible. However, one or 1008 more of its arms MAY be made DDP-eligible, subject to the other 1009 requirements in this section. 1011 4.5. Reverse-Direction Operation 1013 The terminology used in this section is introduced in 1014 Section 3.1.3.3. 1016 4.5.1. Sending a Reverse-Direction RPC Call 1018 An RPC-over-RDMA server endpoint constructs the transport header for 1019 a reverse-direction RPC Call as follows: 1021 * The server generates a new XID value (see Section 3.1.3.5 for full 1022 requirements) and places it in the rdma_xid field of the transport 1023 header and the xid field of the RPC Call message. The RPC Call 1024 header MUST start with the same XID value that is present in the 1025 transport header. 1027 * The rdma_vers field of each reverse-direction Call MUST contain 1028 the same value as forward-direction Calls on the same connection. 1030 * The server fills in the rdma_credits with the credit values for 1031 the connection, as described in Section 4.2.1.1. 1033 * The server determines the Payload format for the RPC message and 1034 fills in the rdma_htype field as appropriate (see Sections 6.6 and 1035 4.5.4). Section 4.5.4 also covers the disposition of the chunk 1036 lists. 1038 4.5.2. Sending a Reverse-Direction RPC Reply 1040 An RPC-over-RDMA client endpoint constructs the transport header for 1041 a reverse-direction RPC Reply as follows: 1043 * The client copies the XID value from the matching RPC Call and 1044 places it in the rdma_xid field of the transport header and the 1045 xid field of the RPC Reply message. The RPC Reply header MUST 1046 start with the same XID value that is present in the transport 1047 header. 1049 * The rdma_vers field of each reverse-direction Call MUST contain 1050 the same value as forward-direction Replies on the same 1051 connection. 1053 * The client fills in the rdma_credits with the credit values for 1054 the connection, as described in Section 4.2.1.1. 1056 * The client determines the Payload format for the RPC message and 1057 fills in the rdma_htype field as appropriate (see Sections 6.6 and 1058 4.5.4). Section 4.5.4 also covers the disposition of the chunk 1059 lists. 1061 4.5.3. When Reverse-Direction Operation is Not Supported 1063 An RPC-over-RDMA transport endpoint does not have to support reverse- 1064 direction operation. There might be no mechanism in the transport 1065 implementation to do so. Or, the transport implementation might 1066 support operation in the reverse direction, but the Upper-Layer 1067 Protocol might not configure the transport to handle reverse- 1068 direction traffic. 1070 If an endpoint is unprepared to receive a reverse-direction message, 1071 loss of the RDMA connection might result. Thus a denial of service 1072 can occur if an RPC server continues to send reverse-direction 1073 messages after a client that is not prepared to receive them 1074 reconnects to that server. 1076 Connection peers indicate their support for reverse-direction 1077 operation as part of the exchange of Transport Properties just after 1078 a connection is established (see Section 5.2.5). 1080 When dealing with the possibility that the remote peer has no 1081 transport level support for reverse-direction operation, the Upper- 1082 Layer Protocol is responsible for informing peers when reverse- 1083 direction operation is supported. Otherwise, even a simple reverse- 1084 direction RPC NULL procedure from a peer could result in a lost 1085 connection. Therefore, an Upper-Layer Protocol MUST NOT perform 1086 reverse-direction RPC operations until the RPC client indicates 1087 support for them. 1089 4.5.4. Using Chunks During Reverse-Direction Operation 1091 Reverse-direction operations can use chunks for DDP-eligible data 1092 items and Special payload formats the same way chunks are used in 1093 forward-direction operation. Connection peers indicate their support 1094 for using chunks in the reverse direction as part of the exchange of 1095 Transport Properties just after a connection is established (see 1096 Section 5.2.5). 1098 However, an implementation might support only Upper-Layer Protocols 1099 that have no DDP-eligible data items. Such Upper-Layer Protocols can 1100 use only small messages, or they might have a native mechanism for 1101 restricting the size of reverse-direction RPC messages, obviating the 1102 need to handle chunks in the reverse direction. 1104 When there is no Upper-Layer Protocol need for chunks in the reverse 1105 direction, implementers MAY choose not to provide support for chunks 1106 in the reverse direction, thus avoiding the complexity of 1107 implementing support for RDMA Reads and Writes in the reverse 1108 direction. When an RPC-over-RDMA transport implementation does not 1109 support chunks in the reverse direction, RPC endpoints use only the 1110 Simple Payload format without data item chunks or the Continued 1111 Payload format without data item chunks to send RPC messages in the 1112 reverse direction. 1114 If a reverse-direction Requester provides a non-empty chunk list to a 1115 Responder that does not support chunks, the Responder MUST report its 1116 lack of support using one of the error values defined in Section 7.3. 1118 4.5.5. Reverse-Direction Retransmission 1120 In rare cases, an RPC server cannot complete an RPC transaction and 1121 cannot send a Reply. In these cases, the Requester may send the RPC 1122 transaction again using the same RPC XID. We refer to this as an 1123 "RPC retransmission" or a "replay." 1125 In the forward direction, an RPC client is the Requester. The client 1126 is always responsible for ensuring a transport connection is in place 1127 before sending a dropped Call again. 1129 With reverse-direction operation, an RPC server is the Requester. 1130 Because an RPC server is not responsible for establishing transport 1131 connections with clients, the Requester is unable to retransmit a 1132 reverse-direction Call whenever there is no transport connection. In 1133 this case, the RPC server must wait for the RPC client to re- 1134 establish a transport connection before it can retransmit reverse- 1135 direction RPC Calls. 1137 If the forward-direction Requester has no work to do, it can be some 1138 time before the RPC client re-establishes a transport connection. An 1139 RPC server may need to abandon a pending reverse-direction RPC Call 1140 to avoid waiting indefinitely for the client to re-establish a 1141 transport connection. 1143 Therefore forward-direction Requesters SHOULD maintain a transport 1144 connection as long as the RPC server might send reverse-direction 1145 Calls. For example, while an NFS version 4.1 client has open 1146 delegated files or active pNFS layouts, it maintains one or more 1147 transport connections to enable the NFS server to perform callback 1148 operations. 1150 5. Transport Properties 1152 RPC-over-RDMA version 2 enables connection endpoints to exchange 1153 information about implementation properties. Compatible endpoints 1154 use this information to optimize data transfer. Initially, only a 1155 small set of transport properties are defined. The protocol provides 1156 header types to exchange transport properties (see 6.3.3 and 6.3.4). 1158 Both the set of transport properties and the operations used to 1159 communicate them may be extended. Within RPC-over-RDMA version 2, 1160 such extensions are OPTIONAL. A discussion of extending the set of 1161 transport properties appears in Appendix B.3. 1163 5.1. Transport Properties Model 1165 The current document specifies a basic set of receiver and sender 1166 properties. Such properties are specified using a code point that 1167 identifies the particular transport property and a nominally opaque 1168 array containing the XDR encoding of the property. 1170 The following XDR types handle transport properties: 1172 1173 typedef rpcrdma2_propid uint32; 1175 struct rpcrdma2_propval { 1176 rpcrdma2_propid rdma_which; 1177 opaque rdma_data<>; 1178 }; 1180 typedef rpcrdma2_propval rpcrdma2_propset<>; 1182 typedef uint32 rpcrdma2_propsubset<>; 1183 1185 The rpcrdma2_propid type specifies a distinct transport property. 1186 The property code points are defined as const values rather than 1187 elements in an enum type to enable the extension by concatenating XDR 1188 definition files. 1190 The rpcrdma2_propval type carries the value of a transport property. 1191 The rdma_which field identifies the particular property, and the 1192 rdma_data field contains the associated value of that property. A 1193 zero-length rdma_data field represents the default value of the 1194 property specified by rdma_which. 1196 Although the rdma_data field is opaque, receivers interpret its 1197 contents using the XDR type associated with the property specified by 1198 rdma_which. When the contents of the rdma_data field do not conform 1199 to that XDR type, the receiver MUST return the error 1200 RDMA2_ERR_BAD_PROPVAL using the header type RDMA2_ERROR, as described 1201 in Section 6.3.1. 1203 For example, the receiver of a message containing a valid 1204 rpcrdma2_propval returns this error if the length of rdma_data is 1205 greater than the length of the transferred message. Also, when the 1206 receiver recognizes the rpcrdma2_propid contained in rdma_which, it 1207 MUST report the error RDMA2_ERR_BAD_PROPVAL if either of the 1208 following occurs: 1210 * The nominally opaque data within rdma_data is not valid when 1211 interpreted using the property-associated typedef. 1213 * The length of rdma_data is insufficient to contain the data 1214 represented by the property-associated typedef. 1216 A receiver does not report an error if it does not recognize the 1217 value contained in rdma_which. In that case, the receiver does not 1218 process that rpcrdma2_propval. Processing continues with the next 1219 rpcrdma2_propval, if any. 1221 The rpcrdma2_propset type specifies a set of transport properties. 1222 The protocol does not impose a particular ordering of the 1223 rpcrdma2_propval items within it. 1225 The rpcrdma2_propsubset type identifies a subset of the properties in 1226 a rpcrdma2_propset. Each bit in the mask denotes a particular 1227 element in a previously specified rpcrdma2_propset. If a particular 1228 rpcrdma2_propval is at position N in the array, then bit number N mod 1229 32 in word N div 32 specifies whether the defined subset includes 1230 that particular rpcrdma2_propval. Words beyond the last one 1231 specified are assumed to contain zero. 1233 5.2. Current Transport Properties 1235 Table 1 specifies a basic set of transport properties. The columns 1236 contain the following information: 1238 * The column labeled "Property" contains a name of the transport 1239 property described by the current row. 1241 * The column labeled "Code" specifies the code point that identifies 1242 this property. 1244 * The column labeled "XDR type" gives the XDR type of the data used 1245 to communicate the value of this property. This data type 1246 overlays the data portion of the nominally opaque rdma_data field. 1248 * The column labeled "Default" gives the default value for the 1249 property. 1251 * The column labeled "Section" indicates the section within the 1252 current document that explains the use of this property. 1254 +===========================+======+==========+=========+=========+ 1255 | Property | Code | XDR type | Default | Section | 1256 +===========================+======+==========+=========+=========+ 1257 | Maximum Send Size | 1 | uint32 | 4096 | 5.2.1 | 1258 +---------------------------+------+----------+---------+---------+ 1259 | Receive Buffer Size | 2 | uint32 | 4096 | 5.2.2 | 1260 +---------------------------+------+----------+---------+---------+ 1261 | Maximum Segment Size | 3 | uint32 | 1048576 | 5.2.3 | 1262 +---------------------------+------+----------+---------+---------+ 1263 | Maximum Segment Count | 4 | uint32 | 16 | 5.2.4 | 1264 +---------------------------+------+----------+---------+---------+ 1265 | Reverse-Direction Support | 5 | uint32 | 0 | 5.2.5 | 1266 +---------------------------+------+----------+---------+---------+ 1267 | Host Auth Message | 6 | opaque<> | N/A | 5.2.6 | 1268 +---------------------------+------+----------+---------+---------+ 1270 Table 1 1272 5.2.1. Maximum Send Size 1274 The value of this property specifies the maximum size, in octets, of 1275 Send payloads. The endpoint receiving this value can size its 1276 Receive buffers based on the value of this property. 1278 1279 const uint32 RDMA2_PROPID_SBSIZ = 1; 1280 typedef uint32 rpcrdma2_prop_sbsiz; 1281 1283 5.2.2. Receive Buffer Size 1285 The value of this property specifies the minimum size, in octets, of 1286 pre-posted receive buffers. 1288 1289 const uint32 RDMA2_PROPID_RBSIZ = 2; 1290 typedef uint32 rpcrdma2_prop_rbsiz; 1291 1293 A sender can subsequently use this value to determine when a message 1294 to be sent fits in pre-posted receive buffers that the receiver has 1295 set up. In particular: 1297 * Requesters may use the value to determine when to use a Call chunk 1298 or Message Continuation when sending a Call. 1300 * Requesters may use the value to determine when to provide a Reply 1301 chunk when sending a Call, based on the maximum possible size of 1302 the Reply. 1304 * Responders may use the value to determine when to use a Reply 1305 chunk provided by the Requester, given the actual size of a Reply. 1307 5.2.3. Maximum Segment Size 1309 The value of this property specifies the maximum size, in octets, of 1310 a segment this endpoint is prepared to send or receive. 1312 1313 const uint32 RDMA2_PROPID_RSSIZ = 3; 1314 typedef uint32 rpcrdma2_prop_rssiz; 1315 1317 5.2.4. Maximum Segment Count 1319 The value of this property specifies the maximum number of segments 1320 that can appear in a Requester's transport header. 1322 1323 const uint32 RDMA2_PROPID_RCSIZ = 4; 1324 typedef uint32 rpcrdma2_prop_rcsiz; 1325 1327 5.2.5. Reverse-Direction Support 1329 The value of this property specifies a client implementation's 1330 readiness to process messages that are part of reverse-direction RPC 1331 requests. 1333 1334 const uint32 RDMA_RVRSDIR_NONE = 0; 1335 const uint32 RDMA_RVRSDIR_SIMPLE = 1; 1336 const uint32 RDMA_RVRSDIR_CONT = 2; 1337 const uint32 RDMA_RVRSDIR_GENL = 3; 1339 const uint32 RDMA2_PROPID_BRS = 5; 1340 typedef uint32 rpcrdma2_prop_brs; 1341 1343 Multiple levels of support are distinguished: 1345 * The value RDMA2_RVRSDIR_NONE indicates that the sender does not 1346 support reverse-direction operation. 1348 * The value RDMA2_RVRSDIR_SIMPLE indicates that the sender supports 1349 using only Simple Format messages without data item chunks for 1350 reverse-direction messages. 1352 * The value RDMA2_RVRSDIR_CONT indicates that the sender supports 1353 using either Simple Format without data item chunks or Continued 1354 Format messages without data item chunks for reverse-direction 1355 messages. 1357 * The value RDMA2_RVRSDIR_GENL indicates that the sender supports 1358 reverse-direction messages in the same way as forward-direction 1359 messages. 1361 When a peer does not provide this property, the default is the peer 1362 does not support reverse-direction operation. 1364 5.2.6. Host Authentication Message 1366 The value of this transport property enables the exchange of host 1367 authentication material. This property can accommodate 1368 authentication handshakes that require multiple challenge-response 1369 interactions and potentially large amounts of material. 1371 1372 const uint32 RDMA2_PROPID_HOSTAUTH = 6; 1373 typedef opaque rpcrdma2_prop_hostauth<>; 1374 1376 When this property is not present, the peer(s) remain 1377 unauthenticated. Local security policy on each peer determines 1378 whether the connection is permitted to continue. 1380 6. Transport Messages 1382 Each transport message consists of multiple sections. 1384 * A transport header prefix, as defined in Section 6.4. Among other 1385 things, this structure indicates the header type. 1387 * The transport header proper, as defined by one of the sub-sections 1388 below. See Section 6.1 for the mapping between header types and 1389 the corresponding header structure. 1391 * Potentially, all or part of an RPC message payload. 1393 This organization differs from that presented in the definition of 1394 RPC-over-RDMA version 1 [RFC8166], which defined the first and second 1395 of the items above as a single XDR data structure. The new 1396 organization is in keeping with RPC-over-RDMA version 2's 1397 extensibility model, which enables the definition of new header types 1398 without modifying the XDR definition of existing header types. 1400 6.1. Transport Header Types 1402 Table 2 lists the RPC-over-RDMA version 2 header types. The columns 1403 contain the following information: 1405 * The column labeled "Operation" names the particular operation. 1407 * The column labeled "Code" specifies the value of the header type 1408 for this operation. 1410 * The column labeled "XDR type" gives the XDR type of the data 1411 structure used to organize the information in this new header 1412 type. This data immediately follows the universal portion on the 1413 transport header present in every RPC-over-RDMA transport header. 1415 * The column labeled "Msg" indicates whether this operation is 1416 followed (or not) by an RPC message payload. 1418 * The column labeled "Section" refers to the section within the 1419 current document that explains the use of this header type. 1421 +==============+======+=============================+=====+=========+ 1422 | Operation | Code | XDR type | Msg | Section | 1423 +==============+======+=============================+=====+=========+ 1424 | Report | 4 | rpcrdma2_hdr_error | No | 6.3.1 | 1425 | Transport | | | | | 1426 | Error | | | | | 1427 +--------------+------+-----------------------------+-----+---------+ 1428 | Grant | 5 | void | No | 6.3.2 | 1429 | Credits | | | | | 1430 +--------------+------+-----------------------------+-----+---------+ 1431 | Specify | 6 | rpcrdma2_hdr_connprop | No | 6.3.3 | 1432 | Properties | | | | | 1433 | (Middle) | | | | | 1434 +--------------+------+-----------------------------+-----+---------+ 1435 | Specify | 7 | rpcrdma2_hdr_connprop | No | 6.3.4 | 1436 | Properties | | | | | 1437 | (Final) | | | | | 1438 +--------------+------+-----------------------------+-----+---------+ 1439 | Convey | 8 | rpcrdma2_hdr_call_external | No | 6.3.5 | 1440 | External | | | | | 1441 | RPC Call | | | | | 1442 | Message | | | | | 1443 +--------------+------+-----------------------------+-----+---------+ 1444 | Convey | 9 | rpcrdma2_hdr_call_middle | Yes | 6.3.6 | 1445 | Continued | | | | | 1446 | RPC Call | | | | | 1447 | Message | | | | | 1448 +--------------+------+-----------------------------+-----+---------+ 1449 | Convey | 10 | rpcrdma2_hdr_call_inline | Yes | 6.3.7 | 1450 | Inline RPC | | | | | 1451 | Call | | | | | 1452 | Message | | | | | 1453 +--------------+------+-----------------------------+-----+---------+ 1454 | Convey | 11 | rpcrdma2_hdr_reply_external | No | 6.3.8 | 1455 | External | | | | | 1456 | RPC Reply | | | | | 1457 | Message | | | | | 1458 +--------------+------+-----------------------------+-----+---------+ 1459 | Convey | 12 | rpcrdma2_hdr_reply_middle | Yes | 6.3.9 | 1460 | Continued | | | | | 1461 | RPC Reply | | | | | 1462 | Message | | | | | 1463 +--------------+------+-----------------------------+-----+---------+ 1464 | Convey | 13 | rpcrdma2_hdr_reply_inline | Yes | 6.3.10 | 1465 | Inline RPC | | | | | 1466 | Reply | | | | | 1467 | Message | | | | | 1468 +--------------+------+-----------------------------+-----+---------+ 1470 Table 2 1472 RPC-over-RDMA version 2 peers are REQUIRED to support all message 1473 header types in Table 2. RPC-over-RDMA version 2 implementations 1474 that receive an unrecognized header type MUST respond with an 1475 RDMA2_ERROR message with an rdma_err field containing 1476 RDMA2_ERR_INVAL_HTYPE and drop the incoming message without 1477 processing it further. 1479 6.2. Headers and Chunks 1481 Most RPC-over-RDMA version 2 data structures have antecedents in 1482 corresponding structures in RPC-over-RDMA version 1. As is typical 1483 for new versions of an existing protocol, the XDR data structures 1484 have new names, and there are a few small changes in content. In 1485 some cases, there have been structural re-organizations to enable 1486 protocol extensibility. 1488 6.2.1. Common Transport Header Prefix 1490 The rpcrdma_common structure defines the initial part of each RPC- 1491 over-RDMA transport header for RPC-over-RDMA version 2 and subsequent 1492 versions. 1494 1495 struct rpcrdma_common { 1496 uint32 rdma_xid; 1497 uint32 rdma_vers; 1498 uint32 rdma_credit; 1499 uint32 rdma_htype; 1500 }; 1501 1503 RPC-over-RDMA version 2's use of these first four words aligns with 1504 that of version 1 as required by Section 4.2 of [RFC8166]. However, 1505 there are crucial structural differences in the XDR definition of 1506 RPC-over-RDMA version 2: in the way that these words are described by 1507 the respective XDR descriptions: 1509 * The header type is represented as a uint32 rather than as an enum 1510 type. An enum would need to be modified to reflect additions to 1511 the set of header types made by later extensions. 1513 * The header type field is part of an XDR structure devoted to 1514 representing the transport header prefix, rather than being part 1515 of a discriminated union, that includes the body of each transport 1516 header type. 1518 * There is now a prefix structure (see Section 6.4) of which the 1519 rpcrdma_common structure is the initial segment. This prefix is a 1520 newly defined XDR object within the protocol description, which 1521 constrains the universal portion of all header types to the four 1522 words in rpcrdma_common. 1524 These changes are part of a more considerable structural change in 1525 the XDR definition of RPC-over-RDMA version 2 that facilitates a 1526 cleaner treatment of protocol extension. The XDR appearing in 1527 Section 8 reflects these changes, which Appendix C.1 discusses in 1528 further detail. 1530 6.3. Header Types 1532 The header types defined and used in RPC-over-RDMA version 1 are not 1533 carried over into RPC-over-RDMA version 2, although there are easy 1534 equivalents to the version 1 procedures: 1536 * The RDMA2_ERROR header (defined in Section 6.3.1) has an XDR 1537 definition that differs from that in RPC-over-RDMA version 1, and 1538 its modifications are all compatible extensions. 1540 * Senders use RDMA2_CALL_INLINE or RDMA2_REPLY_FINAL (defined in 1541 Sections 6.3.7 and 6.3.10) in place of RDMA_MSG. There are minor 1542 differences in the on-the-wire format between the version 1 1543 procedure and the version 2 header types. 1545 * Senders use RDMA2_CALL_EXTERNAL or RDMA2_REPLY_EXTERNAL (defined 1546 in Sections 6.3.5 and 6.3.8) in place of RDMA_NOMSG. There are 1547 minor differences in the on-the-wire format between the version 1 1548 procedure and the version 2 header types. 1550 * RDMA2_CONNPROP_MIDDLE and RDMA2_CONNPROP_FINAL (defined in 1551 Sections 6.3.3 and 6.3.4) are new header types devoted to enabling 1552 connection peers to exchange information about their transport 1553 properties. 1555 6.3.1. RDMA2_ERROR: Report Transport Error 1557 RDMA2_ERROR reports a transport layer error on a previous 1558 transmission. 1560 1561 const rpcrdma2_proc RDMA2_ERROR = 4; 1563 struct rpcrdma2_err_vers { 1564 uint32 rdma_vers_low; 1565 uint32 rdma_vers_high; 1566 }; 1568 struct rpcrdma2_err_write { 1569 uint32 rdma_chunk_index; 1570 uint32 rdma_length_needed; 1571 }; 1573 union rpcrdma2_hdr_error switch (rpcrdma2_errcode rdma_err) { 1574 case RDMA2_ERR_VERS: 1575 rpcrdma2_err_vers rdma_vrange; 1576 case RDMA2_ERR_READ_CHUNKS: 1577 uint32 rdma_max_chunks; 1578 case RDMA2_ERR_WRITE_CHUNKS: 1579 uint32 rdma_max_chunks; 1580 case RDMA2_ERR_SEGMENTS: 1581 uint32 rdma_max_segments; 1582 case RDMA2_ERR_WRITE_RESOURCE: 1583 rpcrdma2_err_write rdma_writeres; 1584 case RDMA2_ERR_REPLY_RESOURCE: 1585 uint32 rdma_length_needed; 1586 default: 1587 void; 1588 }; 1589 1591 See Section 7 for details on the use of this header type. 1593 6.3.2. RDMA2_GRANT: Grant Credits 1595 The RDMA2_GRANT header type enables a connection peer to grant 1596 additional credits to its remote peer without conveying a payload. 1598 1599 const rpcrdma2_proc RDMA2_GRANT = 5; 1600 1602 This message carries no payload except for a struct 1603 rpcrdma2_hdr_prefix. The rdma_xid field is unused. Senders MUST set 1604 the rdma_xid field to zero and receivers MUST ignore the value in 1605 this field. 1607 6.3.3. RDMA2_CONNPROP_MIDDLE: Exchange Transport Properties 1609 The RDMA2_CONNPROP_MIDDLE header type enables a connection peer to 1610 publish the properties of its implementation to its remote peer. 1612 1613 const rpcrdma2_proc RDMA2_CONNPROP_MIDDLE = 6; 1615 struct rpcrdma2_hdr_connprop { 1616 rpcrdma2_propset rdma_props; 1617 }; 1618 1620 A peer sends an RDMA2_CONNPROP_MIDDLE header type when it has one or 1621 more properties to send that do not fit within the default inline 1622 threshold for the RPC-over-RDMA version that is in effect. 1624 A peer may encounter properties that it does not recognize or 1625 support. In such cases, the receiver ignores unsupported properties 1626 without generating an error response. 1628 If a peer sends follows an RDMA2_CONNPROP_MIDDLE header type with 1629 anything other than another RDMA2_CONNPROP_MIDDLE message or an 1630 RDMA2_CONNPROP_FINAL message, the receiver MUST respond with an 1631 RDMA2_ERROR header type and set its rdma_err field to 1632 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1633 it further. 1635 6.3.4. RDMA2_CONNPROP_FINAL: Exchange Transport Properties 1637 The RDMA2_CONNPROP_FINAL header type enables a connection peer to 1638 publish the properties of its implementation to its remote peer. 1640 1641 const rpcrdma2_proc RDMA2_CONNPROP_FINAL = 7; 1643 struct rpcrdma2_hdr_connprop { 1644 rpcrdma2_propset rdma_props; 1645 }; 1646 1648 Each peer sends an RDMA2_CONNPROP_FINAL header type as the final 1649 CONNPROP-type message after the client has established a connection. 1650 The size of this message is limited to the default inline threshold 1651 for the RPC-over-RDMA version that is in effect. 1653 A peer may encounter properties that it does not recognize or 1654 support. In such cases, the receiver ignores unsupported properties 1655 without generating an error response. 1657 If a peer sends a CONNPROP-type message on a connection after it has 1658 sent an RDMA2_CONNPROP_FINAL message, the receiver MUST respond with 1659 an RDMA2_ERROR header type and set its rdma_err field to 1660 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1661 it further. 1663 6.3.5. RDMA2_CALL_EXTERNAL: Convey External RPC Call Message 1665 RDMA2_CALL_EXTERNAL conveys an RPC Call message payload using 1666 explicit RDMA operations. The Responder reads the Payload stream 1667 from a memory area specified by the Call chunk. The sender MUST set 1668 the rdma_xid field to the same value as the xid of the RPC Reply 1669 message payload. 1671 1672 const rpcrdma2_proc RDMA2_CALL_EXTERNAL = 8; 1674 struct rpcrdma2_hdr_call_external { 1675 uint32 rdma_inv_handle; 1677 struct rpcrdma2_read_list *rdma_call; 1678 struct rpcrdma2_read_list *rdma_reads; 1679 struct rpcrdma2_write_list *rdma_provisional_writes; 1680 struct rpcrdma2_write_chunk *rdma_provisional_reply; 1681 }; 1682 1684 rdma_inv_handle: The rdma_inv_handle field contains a 32-bit RDMA 1685 handle that the Responder may use in a Send With Invalidation 1686 operation. See Section 6.5. 1688 rdma_call: The rdma_call field anchors a list of one or more Read 1689 segments that contain the RPC Call's Payload stream. 1691 rdma_reads: The rdma_reads field anchors a list of zero or more Read 1692 segments that contain data item chunks. 1694 rdma_provisional_writes: The rdma_writes field anchors a list of 1695 zero or more provisional Write chunks. 1697 rdma_provisional_reply: The rdma_reply field is a list containing 1698 zero or one provisional Reply chunk. 1700 6.3.6. RDMA2_CALL_MIDDLE: Convey Continued RPC Call Message 1702 RDMA2_CALL_MIDDLE conveys a beginning or middle portion of an RPC 1703 Call message immediately following the transport header in the send 1704 buffer. The sender MUST set the rdma_xid field to the same value as 1705 the xid of the RPC Reply message payload. The sender sets the 1706 rdma_remaining field to the number of bytes in the RPC Call message 1707 payload that remain to be sent. The rdma_rpc_first_word field 1708 demarks the first word of the Payload stream. 1710 1711 const rpcrdma2_proc RDMA2_CALL_MIDDLE = 9; 1713 struct rpcrdma2_hdr_call_middle { 1714 uint32 rdma_remaining; 1716 /* The rpc message starts here and continues 1717 * through the end of the transmission. */ 1718 uint32 rdma_rpc_first_word; 1719 }; 1720 1722 If a peer sends follows an RDMA2_CALL_MIDDLE header type with 1723 anything other than an RDMA2_CALL_MIDDLE message or an 1724 RDMA2_CALL_INLINE message, the receiver MUST respond with an 1725 RDMA2_ERROR header type and set its rdma_err field to 1726 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1727 it further. 1729 6.3.7. RDMA2_CALL_INLINE: Convey Inline RPC Call Message 1731 RDMA2_CALL_INLINE conveys the only or final portion of an RPC Call 1732 message. The rdma_rpc_first_word field demarks the first word of 1733 this Payload stream. 1735 1736 const rpcrdma2_proc RDMA2_CALL_INLINE = 10; 1738 struct rpcrdma2_hdr_call_inline { 1739 uint32 rdma_inv_handle; 1741 struct rpcrdma2_read_list *rdma_reads; 1742 struct rpcrdma2_write_list *rdma_provisional_writes; 1743 struct rpcrdma2_write_chunk *rdma_provisional_reply; 1745 /* The rpc message starts here and continues 1746 * through the end of the transmission. */ 1747 uint32 rdma_rpc_first_word; 1748 }; 1749 1751 rdma_inv_handle: The rdma_inv_handle field contains a 32-bit RDMA 1752 handle that the Responder may use in a Send With Invalidation 1753 operation. See Section 6.5. 1755 rdma_reads: The rdma_reads field anchors a list of zero or more Read 1756 segments that contain only data item chunks. A Requester MUST NOT 1757 insert Position-zero Read chunks in this list. 1759 rdma_provisional_writes: The rdma_writes field anchors a list of 1760 zero or more provisional Write chunks. 1762 rdma_provisional_reply: The rdma_reply field is a list containing 1763 zero or one provisional Reply chunk. 1765 6.3.8. RDMA2_REPLY_EXTERNAL: Convey External RPC Reply Message 1767 RDMA2_REPLY_EXTERNAL conveys an RPC Reply message payload using 1768 explicit RDMA operations. In particular, it is referred to as a 1769 Special Format Reply when the Responder writes the RPC payload into a 1770 memory area specified by a Reply chunk. The sender MUST set the 1771 rdma_xid field to the same value as the xid of the RPC Reply message 1772 payload. 1774 1775 const rpcrdma2_proc RDMA2_REPLY_EXTERNAL = 11; 1777 struct rpcrdma2_hdr_reply_external { 1778 struct rpcrdma2_write_list *rdma_writes; 1779 struct rpcrdma2_write_chunk *rdma_reply; 1780 }; 1781 1782 rdma_writes: The rdma_writes field anchors a list of zero or more 1783 Write chunks that are either empty or contain reduced data items. 1785 rdma_reply: The rdma_reply field is a list that MUST contain exactly 1786 one Reply chunk. 1788 6.3.9. RDMA2_REPLY_MIDDLE: Convey Continued RPC Reply Message 1790 RDMA2_REPLY_MIDDLE conveys a beginning or middle portion of an RPC 1791 Reply message immediately following the transport header in the send 1792 buffer. The sender MUST set the rdma_xid field to the same value as 1793 the xid of the RPC Reply message payload. The sender sets the 1794 rdma_remaining field to the number of bytes in the RPC Call message 1795 payload that remain to be sent. The rdma_rpc_first_word field 1796 demarks the first word of the Payload stream. 1798 1799 const rpcrdma2_proc RDMA2_REPLY_MIDDLE = 12; 1801 struct rpcrdma2_hdr_reply_middle { 1802 uint32 rdma_remaining; 1804 /* The rpc message starts here and continues 1805 * through the end of the transmission. */ 1806 uint32 rdma_rpc_first_word; 1807 }; 1808 1810 If a peer sends follows an RDMA2_REPLY_MIDDLE header type with 1811 anything other than an RDMA2_REPLY_MIDDLE message or an 1812 RDMA2_REPLY_INLINE message, the receiver MUST respond with an 1813 RDMA2_ERROR header type and set its rdma_err field to 1814 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1815 it further. 1817 6.3.10. RDMA2_REPLY_INLINE: Convey RPC Reply Message Inline 1819 RDMA2_REPLY_INLINE conveys the only or final portion of an RPC Reply 1820 message immediately following the transport header in the send 1821 buffer. If the Reply message payload has been reduced, the 1822 rdma_chunks object carries the reduced data item chunks. 1824 1825 const rpcrdma2_proc RDMA2_REPLY_INLINE = 13; 1827 struct rpcrdma2_hdr_reply_inline { 1828 struct rpcrdma2_write_list *rdma_writes; 1830 /* The rpc message starts here and continues 1831 * through the end of the transmission. */ 1832 uint32 rdma_rpc_first_word; 1833 }; 1834 1836 rdma_writes: The rdma_writes field anchors a list of zero or more 1837 Write chunks that are either empty or contain reduced data items. 1839 6.4. Transport Header Prefix 1841 The following prefix structure appears at the start of each RPC-over- 1842 RDMA version 2 transport header. 1844 1845 struct rpcrdma2_hdr_prefix { 1846 struct rpcrdma_common rdma_start; 1847 }; 1848 1850 6.5. Remote Invalidation 1852 To solicit the use of Remote Invalidation, a Requester sets the value 1853 of the rdma_inv_handle field in an RPC Call's transport header to a 1854 non-zero value that matches one of the rdma_handle fields in that 1855 header. If the Responder may invalidate none of the rdma_handle 1856 values in the header conveying the Call, the Requester sets the RPC 1857 Call's rdma_inv_handle field to the value zero. 1859 If the Responder chooses not to use remote invalidation for this 1860 particular RPC Reply, or the RPC Call's rdma_inv_handle field 1861 contains the value zero, the Responder simply uses RDMA Send to 1862 transmit the matching RPC reply. However, if the Responder chooses 1863 to use Remote Invalidation, it uses RDMA Send With Invalidate to 1864 transmit the RPC Reply. It MUST use the value in the corresponding 1865 Call's rdma_inv_handle field to construct the Send With Invalidate 1866 Work Request. 1868 A Responder never uses a Send With Invalidate Work Request when 1869 sending a control plane header type. This includes the RDMA2_ERROR 1870 header type, the RDMA2_GRANT header type, the RDMA2_CONNPROP_MIDDLE 1871 header type, and the RDMA2_CONNPROP_FINAL header type. 1873 6.6. Payload Formats 1875 RPC-over-RDMA version 2 provides several ways, known as "payload 1876 formats", to convey an RPC-over-RDMA message. A sender chooses the 1877 payload format for each message based on several factors: 1879 * The existence of DDP-eligible data items in the RPC message 1880 payload 1882 * The size of the RPC message payload 1884 * The direction of the RPC message (i.e., Call or Reply) 1886 * The available hardware resources 1888 * The arrangement of source and sink memory buffers 1890 The following subsections describe in detail how Requesters and 1891 Responders format RPC-over-RDMA message payloads. 1893 6.6.1. Simple Format 1895 All RPC messages conveyed via RPC-over-RDMA version 2 need at least 1896 one RDMA Send operation to convey. Thus, the most efficient way to 1897 send an RPC message that is smaller than the inline threshold is to 1898 append the Payload stream directly to the Transport stream and use an 1899 RDMA Send to convey both. When no chunks are present, senders 1900 construct Calls and Replies the same way, and no other operations are 1901 needed. 1903 6.6.1.1. Simple Format with Data Item Chunks 1905 If DDP-eligible data items are present in a Payload stream, a sender 1906 MAY reduce some or all of these items, removing them from the Payload 1907 stream. The sender then uses a separate mechanism to transfer the 1908 reduced data items. The Transport stream immediately followed by the 1909 reduced Payload stream is then transferred using one RDMA Send 1910 operation. 1912 When data item chunks are present, senders construct Calls 1913 differently than Replies. 1915 Simple Call 1916 After receiving the Transport and Payload streams of an RPC Call 1917 message with Read chunks, the Responder uses RDMA Read operations 1918 to move the reduced data items contained in the Read chunks. RPC- 1919 over-RDMA Calls can carry Write chunks for the Responder to use 1920 when sending the matching Reply. 1922 Simple Reply 1923 The Responder uses RDMA Write operations to move reduced data 1924 items contained in Write chunks. Afterward, it sends the 1925 Transport and Payload streams of the RPC Reply message using one 1926 RDMA Send. RPC-over-RDMA Replies always carry an empty Read chunk 1927 list. 1929 6.6.1.2. Simple Format Examples 1931 Requester Responder 1932 | RDMA Send (RDMA2_CALL_INLINE) | 1933 Call | ----------------------------------> | 1934 | | 1935 | | Processing 1936 | | 1937 | RDMA Send (RDMA2_REPLY_INLINE) | 1938 | <---------------------------------- | Reply 1940 Figure 1: A Simple Call without data item chunks and a Simple 1941 Reply without data item chunks 1943 Requester Responder 1944 | RDMA Send (RDMA2_CALL_INLINE) | 1945 Call | ----------------------------------> | 1946 | RDMA Read | 1947 | <---------------------------------- | 1948 | RDMA Response (arg data) | 1949 | ----------------------------------> | 1950 | | 1951 | | Processing 1952 | | 1953 | RDMA Send (RDMA2_REPLY_INLINE) | 1954 | <---------------------------------- | Reply 1956 Figure 2: A Simple Call with a Read chunk and a Simple Reply 1957 without data item chunks 1959 Requester Responder 1960 | RDMA Send (RDMA2_CALL_INLINE) | 1961 Call | ----------------------------------> | 1962 | | 1963 | | Processing 1964 | | 1965 | RDMA Write (result data) | 1966 | <---------------------------------- | 1967 | RDMA Send (RDMA2_REPLY_INLINE) | 1968 | <---------------------------------- | Reply 1970 Figure 3: A Simple Call without data item chunks and a Simple 1971 Reply with a Write chunk 1973 6.6.2. Continued Format 1975 For various reasons, a sender can choose to split a message payload 1976 over multiple RPC-over-RDMA messages. The Payload stream of each 1977 RPC-over-RDMA message contains a part of the RPC message. The 1978 receiver reconstructs the original RPC message by concatenating the 1979 Payload stream of each RPC-over-RDMA message in received order. A 1980 sender MAY split the Payload stream on any convenient boundary. 1982 6.6.2.1. Continued Format with Data Item Chunks 1984 If DDP-eligible data items are present in the Payload stream, a 1985 sender MAY reduce some or all of these items, removing them from the 1986 Payload stream. The sender then uses a separate mechanism to 1987 transfer the reduced data items. The Transport stream immediately 1988 follwed by the reduced Payload stream is then transferred using one 1989 RDMA Send operation. 1991 As with Simple Format messages, when chunks are present, senders 1992 construct Calls differently than Replies. 1994 Continued Call 1995 After receiving the Transport and Payload streams of an RPC Call 1996 message with Read chunks, the Responder uses RDMA Read operations 1997 to move the reduced data items contained in Read chunks. RPC- 1998 over-RDMA Calls can carry Write chunks for the Responder to use 1999 when sending the matching Reply. 2001 Continued Reply 2002 The Responder uses RDMA Write operations to move reduced data 2003 items contained in Write chunks. Afterward, it sends the 2004 Transport and Payload streams of the RPC Reply message using 2005 multiple RDMA Sends. RPC-over-RDMA Replies always carry an empty 2006 Read chunk list. 2008 6.6.2.2. Continued Format Examples 2009 Requester Responder 2010 | RDMA Send (RDMA2_CALL_MIDDLE) | 2011 Call | ----------------------------------> | 2012 | RDMA Send (RDMA2_CALL_MIDDLE) | 2013 | ----------------------------------> | 2014 | RDMA Send (RDMA2_CALL_INLINE) | 2015 | ----------------------------------> | 2016 | | 2017 | | Processing 2018 | | 2019 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2020 | <---------------------------------- | Reply 2021 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2022 | <---------------------------------- | 2023 | RDMA Send (RDMA2_REPLY_INLINE) | 2024 | <---------------------------------- | 2026 Figure 4: A Continued Call without data item chunks and a 2027 Continued Reply without data item chunks 2029 Requester Responder 2030 | RDMA Send (RDMA2_CALL_MIDDLE) | 2031 Call | ----------------------------------> | 2032 | RDMA Send (RDMA2_CALL_MIDDLE) | 2033 | ----------------------------------> | 2034 | RDMA Send (RDMA2_CALL_INLINE) | 2035 | ----------------------------------> | 2036 | RDMA Read | 2037 | <---------------------------------- | 2038 | RDMA Response (arg data) | 2039 | ----------------------------------> | 2040 | | 2041 | | Processing 2042 | | 2043 | RDMA Send (RDMA2_REPLY_INLINE) | 2044 | <---------------------------------- | Reply 2046 Figure 5: A Continued Call with a Read chunk and a Simple Reply 2047 without data item chunks 2049 Requester Responder 2050 | RDMA Send (RDMA2_CALL_INLINE) | 2051 Call | ----------------------------------> | 2052 | | 2053 | | Processing 2054 | | 2055 | RDMA Write (result data) | 2056 | <---------------------------------- | 2057 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2058 | <---------------------------------- | Reply 2059 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2060 | <---------------------------------- | 2061 | RDMA Send (RDMA2_REPLY_INLINE) | 2062 | <---------------------------------- | 2064 Figure 6: A Simple Call without data item chunks and a Continued 2065 Reply with a Write chunk 2067 6.6.3. Special Format 2069 Even after DDP-eligible data items have been removed, a Payload 2070 stream can sometimes be too large to send using only RDMA Send 2071 operations. In those cases, the sender can use RDMA Read or Write 2072 operations to convey the entire RPC message. We refer to this as a 2073 "Special Format" message. 2075 To transmit a Special Format message, the sender transmits only the 2076 Transport stream with an RDMA Send operation. The sender does not 2077 include the Payload stream in the send buffer. Instead, the 2078 Requester provides a body chunk that the Responder uses to move the 2079 Payload stream. 2081 Because chunks are always present in Special Format messages, the 2082 sender always handles Calls and Replies differently. 2084 Special Call 2085 The Requester provides a Read chunk that contains the RPC Call 2086 message's Payload stream. Every Read segment in this chunk MUST 2087 contain zero (0) in its Position field. This type of Read chunk 2088 is a body chunk known as a Call chunk. 2090 Special Reply 2091 The Requester provisions a Reply chunk in advance. This body 2092 chunk is a Write chunk into which the Responder places the RPC 2093 Reply message's Payload stream. The Requester provisions the 2094 Reply chunk to accommodate the maximum expected reply size for 2095 that upper-layer operation. 2097 One purpose of a Special Format message is to handle large RPC 2098 messages. However, Requesters MAY use a Special Format message at 2099 any time to convey an RPC Call message. 2101 When it has alternatives, a Responder chooses which Format to use 2102 based on the chunks provided by the Requester. If a Requester 2103 provided a Write chunk and the Responder has a DDP-eligible result, 2104 it first reduces the reply Payload stream. If a Requester provided a 2105 Reply chunk and the reduced Payload stream is larger than the reply 2106 inline threshold, the Responder MUST use the Requester-provided Reply 2107 chunk for the reply. 2109 6.6.3.1. Special Format Examples 2111 Requester Responder 2112 | RDMA Send (RDMA2_CALL_EXTERNAL) | 2113 Call | ----------------------------------> | 2114 | RDMA Read | 2115 | <---------------------------------- | 2116 | RDMA Response (RPC call) | 2117 | ----------------------------------> | 2118 | | 2119 | | Processing 2120 | | 2121 | RDMA Send (RDMA2_REPLY_INLINE) | 2122 | <---------------------------------- | Reply 2124 Figure 7: A Special Call and a Simple Reply without data item chunks 2126 Requester Responder 2127 | RDMA Send (RDMA2_CALL_INLINE) | 2128 Call | ----------------------------------> | 2129 | | 2130 | | Processing 2131 | | 2132 | RDMA Write (RPC reply) | 2133 | <---------------------------------- | 2134 | RDMA Send (RDMA2_REPLY_EXTERNAL) | 2135 | <---------------------------------- | Reply 2137 Figure 8: A Simple Call without data item chunks and a Special Reply 2139 6.6.4. Choosing a Reply Payload Format 2141 A Requester provisions all necessary registered memory resources for 2142 both an RPC Call and its matching RPC Reply. A Requester constructs 2143 each RPC Call, thus it can compute the exact memory resources needed 2144 to send every Call. However, the Requester allocates memory 2145 resources to receive the corresponding Reply before the Responder has 2146 constructed it. Occasionally, it is challenging for the Requester to 2147 know in advance precisely what resources are needed to receive the 2148 Reply. 2150 In RPC-over-RDMA version 2, a Requester can provide a Reply chunk for 2151 any transaction. The Responder can use the provided Reply chunk or 2152 it can decide to use another means to convey the RPC Reply. If the 2153 combination of the provided Write chunk list and Reply chunk is not 2154 adequate to convey a Reply, the Responder SHOULD use Message 2155 Continuation to send that Reply. If even that is not possible, the 2156 Responder sends an RDMA2_ERROR message to the Requester, as described 2157 in Section 6.3.1: 2159 * If the Write chunk list cannot accommodate the ULP's DDP-eligible 2160 data payload, the Responder sends an RDMA2_ERR_WRITE_RESOURCE 2161 error. 2163 * If the Reply chunk cannot accommodate the parts of the Reply that 2164 are not DDP-eligible, the Responder sends an 2165 RDMA2_ERR_REPLY_RESOURCE error. 2167 When receiving such errors, the Requester can retry the ULP call 2168 using more substantial reply resources. In cases where retrying the 2169 ULP request is not possible (e.g., the request is non-idempotent), 2170 the Requester terminates the RPC transaction and presents an error to 2171 the RPC consumer. 2173 7. Error Handling 2175 A receiver performs validity checks on each ingress RPC-over-RDMA 2176 message before it assembles that message's Payload stream and passes 2177 it to the RPC layer. For example, if an ingress RPC-over-RDMA 2178 message is not as long as the size of struct rpcrdma2_hdr_prefix (20 2179 octets), the receiver cannot trust the value of the rdma_xid field. 2180 In this case, the receiver MUST silently discard the ingress message 2181 without processing it further, and without a response to the sender. 2183 When a request (for instance, an RPC Call or a control plane 2184 operation) is made, typically an RPC consumer blocks while waiting 2185 for the response. Thus when an incoming message conveys a request 2186 and that request cannot be acted upon, the receiver of that request 2187 needs to report the problem to its sender in order to unblock 2188 waiters. Likewise, if, after processing a request, a sender is 2189 unable to transmit the response on an otherwise healthy connection, 2190 the sender needs to report that problem for the same reason. 2192 The RDMA2_ERROR header type is used for this purpose. To form an 2193 RDMA2_ERROR type header: 2195 * The rdma_xid field MUST contain the same XID that was in the 2196 rdma_xid field in the ingress request. 2198 * The rdma_vers field MUST contain the same version that was in the 2199 rdma_vers field in the ingress request. 2201 * The sender sets the rdma_credit field to the credit values in 2202 effect for this connection. 2204 * The rdma_htype field MUST contain the value RDMA2_ERROR. 2206 * The rdma_err field contains a value that reflects the type of 2207 error that occurred, as described in the subsections below. 2209 When a peer receives an RDMA2_ERROR message type with an unrecognized 2210 or unsupported value in its rdma_err field, it MUST silently discard 2211 the message without processing it further. 2213 7.1. Basic Transport Stream Parsing Errors 2215 7.1.1. RDMA2_ERR_VERS 2217 When a Responder detects an RPC-over-RDMA header version that it does 2218 not support (the current document defines version 2), it MUST respond 2219 with an RDMA2_ERROR message type and set its rdma_err field to 2220 RDMA2_ERR_VERS. The Responder then fills in the rpcrdma2_err_vers 2221 structure with the RPC-over-RDMA versions it supports. The Responder 2222 MUST silently discard the ingress message without passing it to the 2223 RPC layer 2225 When a Requester receives this error, it uses the information in the 2226 rpcrdma2_err_vers structure to select an RPC-over-RDMA version that 2227 both peers support for subsequent operations on the connection. A 2228 Requester MUST NOT subsequently send a message that uses a version 2229 that the Responder has indciated it does not support. RDMA2_ERR_VERS 2230 indicates a permanent error. Receipt of this error completes the RPC 2231 transaction associated with XID in the rdma_xid field. 2233 7.1.2. RDMA2_ERR_INVAL_HTYPE 2235 If a Responder recognizes the value in an ingress rdma_vers field, 2236 but it does not recognize the value in the rdma_htype field or does 2237 not support that header type, it MUST set the rdma_err field to 2238 RDMA2_ERR_INVAL_HTYPE. The Responder MUST silently discard the 2239 incoming message without passing it to the RPC layer. 2241 A Requester MUST NOT subsequently send a message on the connection 2242 that uses an htype that the Responder has indicated it does not 2243 support. RDMA2_ERR_INVAL_HTYPE indicates a permanent error. Receipt 2244 of this error completes the RPC transaction associated with XID in 2245 the rdma_xid field. 2247 7.1.3. RDMA2_ERR_INVAL_CONT 2249 If a Responder detects a problem with an ingress RPC-over-RDMA 2250 message that is part of a Message Continuation sequence, the 2251 Responder MUST set the rdma_err field to RDMA2_ERR_INVAL_CONT. The 2252 Responder MUST silently discard all ingress messages with an rdma_xid 2253 field that matches the failing message without reassembling the 2254 payload. 2256 RDMA2_ERR_INVAL_CONT indicates a permanent error. Receipt of this 2257 error completes the RPC transaction associated with XID in the 2258 rdma_xid field. 2260 7.2. XDR Errors 2262 A receiver might encounter an XDR parsing error that prevents it from 2263 processing an ingress Transport stream. Examples of such errors 2264 include: 2266 * The value of the rdma_xid field does not match the value of the 2267 XID field in the accompanying RPC message. 2269 * The receive buffer ends before the end of a data object contained 2270 in the Transport stream. 2272 Moreover, when a Responder receives a valid RPC-over-RDMA header but 2273 the Responder's ULP implementation cannot parse the RPC arguments in 2274 the RPC Call, the Responder returns an RPC Reply with status 2275 GARBAGE_ARGS, using an RDMA2_REPLY_INLINE message type. This type of 2276 parsing failure might be due to mismatches between chunk sizes or 2277 offsets and the contents of the Payload stream, for example. In this 2278 case, the error is permanent, but the Requester has no way to know 2279 how much processing the Responder has completed for this RPC 2280 transaction. 2282 7.2.1. RDMA2_ERR_BAD_XDR 2284 If a Responder recognizes the values in the rdma_vers field, but it 2285 cannot otherwise parse the ingress Transport stream, it MUST set the 2286 rdma_err field to RDMA2_ERR_BAD_XDR. The Responder MUST silently 2287 discard the ingress message without passing it to the RPC layer. 2289 RDMA2_ERR_BAD_XDR indicates a permanent error. Receipt of this error 2290 completes the RPC transaction associated with XID in the rdma_xid 2291 field. 2293 7.2.2. RDMA2_ERR_BAD_PROPVAL 2295 If a receiver recognizes the value in an ingress rdma_which field, 2296 but it cannot parse the accompanying propval, it MUST set the 2297 rdma_err field to RDMA2_ERR_BAD_PROPVAL (see Section 5.1). The 2298 receiver MUST silently discard the ingress message without applying 2299 any of its property settings. 2301 7.3. Responder RDMA Operational Errors 2303 In RPC-over-RDMA version 2, the Responder initiates RDMA Read and 2304 Write operations that target the Requester's memory. Problems might 2305 arise as the Responder attempts to use Requester-provided resources 2306 for RDMA operations. For example: 2308 * Usually, chunks can be validated only by using their contents to 2309 perform data transfers. If chunk contents are invalid (e.g., a 2310 memory region is no longer registered or a chunk length exceeds 2311 the end of the registered memory region), a Remote Access Error 2312 occurs. 2314 * If a Requester's Receive buffer is too small, the Responder's Send 2315 operation completes with a Local Length Error. 2317 * If the Requester-provided Reply chunk is too small to accommodate 2318 a large RPC Reply message, a Remote Access Error occurs. A 2319 Responder might detect this problem before attempting to write 2320 past the end of the Reply chunk. 2322 RDMA operational errors can be fatal to the connection. To avoid a 2323 retransmission loop and repeated connection loss that deadlocks the 2324 connection, once the Requester has re-established a connection, the 2325 Responder SHOULD send an RDMA2_ERROR response to indicate that no 2326 RPC-level reply is possible for that transaction. 2328 7.3.1. RDMA2_ERR_READ_CHUNKS 2330 If a Requester presents more DDP-eligible arguments than a Responder 2331 is prepared to Read, the Responder MUST set the rdma_err field to 2332 RDMA2_ERR_READ_CHUNKS and set the rdma_max_chunks field to the 2333 maximum number of Read chunks the Responder can process. If the 2334 Responder implementation cannot handle any Read chunks for a request, 2335 it MUST set the rdma_max_chunks to zero in this response. The 2336 Responder MUST silently discard the ingress message without 2337 processing it further. 2339 The Requester can reconstruct the Call using Message Continuation or 2340 a Special Format payload and resend it. If the Requester chooses not 2341 to resend the Call, it MUST terminate this RPC transaction with an 2342 error. 2344 7.3.2. RDMA2_ERR_WRITE_CHUNKS 2346 If a Requester has constructed an RPC Call with more DDP-eligible 2347 results than the Responder is prepared to Write, the Responder MUST 2348 set the rdma_err field to RDMA2_ERR_WRITE_CHUNKS and set the 2349 rdma_max_chunks field to the maximum number of Write chunks the 2350 Responder can return. The Requester can reconstruct the Call with no 2351 Write chunks and a Reply chunk of appropriate size. If the Requester 2352 does not resend the Call, it MUST terminate this RPC transaction with 2353 an error. 2355 If the Responder implementation cannot handle any Write chunks for a 2356 request and cannot send the Reply using Message Continuation, it MUST 2357 return a response of RDMA2_ERR_REPLY_RESOURCE instead (see below). 2359 7.3.3. RDMA2_ERR_SEGMENTS 2361 If a Requester has constructed an RPC Call with a chunk that contains 2362 more segments than the Responder supports, the Responder MUST set the 2363 rdma_err field to RDMA2_ERR_SEGMENTS and set the rdma_max_segments 2364 field to the maximum number of segments the Responder can process. 2365 The Requester can reconstruct the Call and resend it. If the 2366 Requester does not resend the Call, it MUST terminate this RPC 2367 transaction with an error. 2369 7.3.4. RDMA2_ERR_WRITE_RESOURCE 2371 If a Requester has provided a Write chunk that is not large enough to 2372 contain a DDP-eligible result, the Responder MUST set the rdma_err 2373 field to RDMA2_ERR_WRITE_RESOURCE. The Responder MUST set the 2374 rdma_chunk_index field to point to the first Write chunk in the 2375 transport header that is too short, or to zero to indicate that it 2376 was not possible to determine which chunk is too small. Indexing 2377 starts at one (1), which represents the first Write chunk. The 2378 Responder MUST set the rdma_length_needed to the number of bytes 2379 needed in that chunk to convey the result data item. 2381 The Requester can reconstruct the Call with more reply resources and 2382 resend it. If the Requester does not resend the Call (for instance, 2383 if the Responder set the index and length fields to zero), it MUST 2384 terminate this RPC transaction with an error. 2386 7.3.5. RDMA2_ERR_REPLY_RESOURCE 2388 If a Responder cannot send an RPC Reply using Message Continuation 2389 and the Reply does not fit in the Reply chunk, the Responder MUST set 2390 the rdma_err field to RDMA2_ERR_REPLY_RESOURCE. The Responder MUST 2391 set the rdma_length_needed to the number of Reply chunk bytes needed 2392 to convey the reply. The Requester can reconstruct the Call with 2393 more reply resources and resend it. If the Requester does not resend 2394 the Call (for instance, if the Responder set the length field to 2395 zero), it MUST terminate this RPC transaction with an error. 2397 7.4. Other Operational Errors 2399 While a Requester is constructing an RPC Call message, an 2400 unrecoverable problem might occur that prevents the Requester from 2401 posting further RDMA Work Requests on behalf of that message. As 2402 with other transports, if a Requester is unable to construct and 2403 transmit an RPC Call, the associated RPC transaction fails 2404 immediately. 2406 After a Requester has received a Reply, if it is unable to invalidate 2407 a memory region due to an unrecoverable problem, the Requester MUST 2408 close the connection to protect that memory from Responder access 2409 before the associated RPC transaction is complete. 2411 While a Responder is constructing an RPC Reply message or error 2412 message, an unrecoverable problem might occur that prevents the 2413 Responder from posting further RDMA Work Requests on behalf of that 2414 message. If a Responder is unable to construct and transmit an RPC 2415 Reply or RPC-over-RDMA error message, the Responder MUST close the 2416 connection to signal to the Requester that a reply was lost. 2418 7.4.1. RDMA2_ERR_SYSTEM 2420 If some problem occurs on a Responder that does not fit into the 2421 above categories, the Responder MAY report it to the Requester by 2422 setting the rdma_err field to RDMA2_ERR_SYSTEM. The Responder MUST 2423 silently discard the message(s) associated with the failing 2424 transaction without further processing. 2426 RDMA2_ERR_SYSTEM is a permanent error. This error does not indicate 2427 how much of the transaction the Responder has processed, nor does it 2428 indicate a particular recovery action for the Requester. A Requester 2429 that receives this error MUST terminate the RPC transaction 2430 associated with the XID value in the RDMA2_ERROR message's rdma_xid 2431 field. 2433 7.5. RDMA Transport Errors 2435 The RDMA connection and physical link provide some degree of error 2436 detection and retransmission. The Marker PDU Aligned Framing (MPA) 2437 protocol (as described in Section 7.1 of [RFC5044]) as well as the 2438 InfiniBand link layer [IBA] provide Cyclic Redundancy Check (CRC) 2439 protection of RDMA payloads. CRC-class protection is a general 2440 attribute of such transports. 2442 Additionally, the RPC layer itself can accept errors from the 2443 transport and recover via retransmission. RPC recovery can typically 2444 handle complete loss and re-establishment of a transport connection. 2446 The details of reporting and recovery from RDMA link-layer errors are 2447 described in specific link-layer APIs and operational specifications 2448 and are outside the scope of this protocol specification. See 2449 Section 11 for further discussion of RPC-level integrity schemes. 2451 8. XDR Protocol Definition 2453 This section contains a description of the core features of the RPC- 2454 over-RDMA version 2 protocol expressed in the XDR language [RFC4506]. 2455 It organizes the description to make it simple to extract into a form 2456 that is ready to compile or combine with similar descriptions 2457 published later as extensions to RPC-over-RDMA version 2. 2459 8.1. Code Component License 2461 Code Components extracted from the current document must include the 2462 following license text. When combining the extracted XDR code with 2463 other XDR code which has an identical license, only a single copy of 2464 the license text needs to be retained. 2466 2467 /// /* 2468 /// * Copyright (c) 2010, 2020 IETF Trust and the persons 2469 /// * identified as authors of the code. All rights reserved. 2470 /// * 2471 /// * The authors of the code are: 2472 /// * B. Callaghan, T. Talpey, C. Lever, and D. Noveck. 2473 /// * 2474 /// * Redistribution and use in source and binary forms, with 2475 /// * or without modification, are permitted provided that the 2476 /// * following conditions are met: 2477 /// * 2478 /// * - Redistributions of source code must retain the above 2479 /// * copyright notice, this list of conditions and the 2480 /// * following disclaimer. 2481 /// * 2482 /// * - Redistributions in binary form must reproduce the above 2483 /// * copyright notice, this list of conditions and the 2484 /// * following disclaimer in the documentation and/or other 2485 /// * materials provided with the distribution. 2486 /// * 2487 /// * - Neither the name of Internet Society, IETF or IETF 2488 /// * Trust, nor the names of specific contributors, may be 2489 /// * used to endorse or promote products derived from this 2490 /// * software without specific prior written permission. 2491 /// * 2492 /// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 2493 /// * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 2494 /// * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2495 /// * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2496 /// * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 2497 /// * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2498 /// * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2499 /// * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2500 /// * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2501 /// * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2502 /// * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2503 /// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2504 /// * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 2505 /// * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2506 /// * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2507 /// */ 2508 /// 2509 2511 8.2. Extraction of the XDR Definition 2513 Implementers can apply the following sed script to the current 2514 document to produce a machine-readable XDR description of the base 2515 RPC-over-RDMA version 2 protocol. 2517 2518 sed -n -e 's:^ */// ::p' -e 's:^ *///$::p' 2519 2521 That is, if this document is in a file called "spec.txt", then 2522 implementers can do the following to extract an XDR description file 2523 and store it in the file rpcrdma-v2.x. 2525 2526 sed -n -e 's:^ */// ::p' -e 's:^ *///$::p' \ 2527 < spec.txt > rpcrdma-v2.x 2528 2530 Although this file is a usable description of the base protocol, when 2531 extensions are to be supported, it may be desirable to divide the 2532 description into multiple files. The following script achieves that 2533 purpose: 2535 2536 #!/usr/local/bin/perl 2537 open(IN,"rpcrdma-v2.x"); 2538 open(OUT,">temp.x"); 2539 while() 2540 { 2541 if (m/FILE ENDS: (.*)$/) 2542 { 2543 close(OUT); 2544 rename("temp.x", $1); 2545 open(OUT,">temp.x"); 2546 } 2547 else 2548 { 2549 print OUT $_; 2550 } 2551 } 2552 close(IN); 2553 close(OUT); 2554 2556 Running the above script results in two files: 2558 * The file common.x, containing the license plus the shared XDR 2559 definitions that need to be made available to both the base 2560 protocol and any subsequent extensions. 2562 * The file baseops.x containing the XDR definitions for the base 2563 protocol defined in this document. 2565 Extensions to RPC-over-RDMA version 2, published as Standards Track 2566 documents, should have similarly structured XDR definitions. Once an 2567 implementer has extracted the XDR for all desired extensions and the 2568 base XDR definition contained in the current document, she can 2569 concatenate them to produce a consolidated XDR definition that 2570 reflects the set of extensions selected for her RPC-over-RDMA version 2571 2 implementation. 2573 Alternatively, the XDR descriptions can be compiled separately. In 2574 that case, the combination of common.x and baseops.x defines the base 2575 transport. The combination of common.x and the XDR description of 2576 each extension produces a full XDR definition of that extension. 2578 8.3. XDR Definition for RPC-over-RDMA Version 2 Core Structures 2580 2581 /// /*************************************************************** 2582 /// * Transport Header Prefixes 2583 /// ***************************************************************/ 2584 /// 2585 /// struct rpcrdma_common { 2586 /// uint32 rdma_xid; 2587 /// uint32 rdma_vers; 2588 /// uint32 rdma_credit; 2589 /// uint32 rdma_htype; 2590 /// }; 2591 /// 2592 /// struct rpcrdma2_hdr_prefix { 2593 /// struct rpcrdma_common rdma_start; 2594 /// }; 2595 /// 2596 /// /*************************************************************** 2597 /// * Chunks and Chunk Lists 2598 /// ***************************************************************/ 2599 /// 2600 /// struct rpcrdma2_segment { 2601 /// uint32 rdma_handle; 2602 /// uint32 rdma_length; 2603 /// uint64 rdma_offset; 2604 /// }; 2605 /// 2606 /// struct rpcrdma2_read_segment { 2607 /// uint32 rdma_position; 2608 /// struct rpcrdma2_segment rdma_target; 2609 /// }; 2610 /// 2611 /// struct rpcrdma2_read_list { 2612 /// struct rpcrdma2_read_segment rdma_entry; 2613 /// struct rpcrdma2_read_list *rdma_next; 2614 /// }; 2615 /// 2616 /// struct rpcrdma2_write_chunk { 2617 /// struct rpcrdma2_segment rdma_target<>; 2618 /// }; 2619 /// 2620 /// struct rpcrdma2_write_list { 2621 /// struct rpcrdma2_write_chunk rdma_entry; 2622 /// struct rpcrdma2_write_list *rdma_next; 2623 /// }; 2624 /// 2625 /// /*************************************************************** 2626 /// * Transport Properties 2627 /// ***************************************************************/ 2628 /// 2629 /// /* 2630 /// * Types for transport properties model 2631 /// */ 2632 /// typedef rpcrdma2_propid uint32; 2633 /// 2634 /// struct rpcrdma2_propval { 2635 /// rpcrdma2_propid rdma_which; 2636 /// opaque rdma_data<>; 2637 /// }; 2638 /// 2639 /// typedef rpcrdma2_propval rpcrdma2_propset<>; 2640 /// typedef uint32 rpcrdma2_propsubset<>; 2641 /// 2642 /// /* 2643 /// * Transport propid values for basic properties 2644 /// */ 2645 /// const RDMA2_PROPID_SBSIZ = 1; 2646 /// const RDMA2_PROPID_RBSIZ = 2; 2647 /// const RDMA2_PROPID_RSSIZ = 3; 2648 /// const RDMA2_PROPID_RCSIZ = 4; 2649 /// const RDMA2_PROPID_BRS = 5; 2650 /// const RDMA2_PROPID_HOSTAUTH = 6; 2651 /// 2652 /// /* 2653 /// * Types specific to particular properties 2654 /// */ 2655 /// typedef uint32 rpcrdma2_prop_sbsiz; 2656 /// typedef uint32 rpcrdma2_prop_rbsiz; 2657 /// typedef uint32 rpcrdma2_prop_rssiz; 2658 /// typedef uint32 rpcrdma2_prop_rcsiz; 2659 /// typedef uint32 rpcrdma2_prop_brs; 2660 /// typedef opaque rpcrdma2_prop_hostauth<>; 2661 /// 2662 /// const RDMA2_RVRSDIR_NONE = 0; 2663 /// const RDMA2_RVRSDIR_SIMPLE = 1; 2664 /// const RDMA2_RVRSDIR_CONT = 2; 2665 /// const RDMA2_RVRSDIR_GENL = 3; 2666 /// 2667 /// /* FILE ENDS: common.x; */ 2668 2670 8.4. XDR Definition for RPC-over-RDMA Version 2 Base Header Types 2672 2673 /// /*************************************************************** 2674 /// * Descriptions of RPC-over-RDMA Header Types 2675 /// ***************************************************************/ 2676 /// 2677 /// /* 2678 /// * Header Type Codes: Control plane operations. 2679 /// */ 2680 /// const RDMA2_ERROR = 4; 2681 /// const RDMA2_GRANT = 5; 2682 /// const RDMA2_CONNPROP_MIDDLE = 6; 2683 /// const RDMA2_CONNPROP_FINAL = 7; 2684 /// 2685 /// /* 2686 /// * Header Type Codes: Call messages. 2687 /// */ 2688 /// const RDMA2_CALL_EXTERNAL = 8; 2689 /// const RDMA2_CALL_MIDDLE = 9; 2690 /// const RDMA2_CALL_INLINE = 10; 2691 /// 2692 /// /* 2693 /// * Header Type Codes: Reply messages. 2694 /// */ 2695 /// const RDMA2_REPLY_EXTERNAL = 11; 2696 /// const RDMA2_REPLY_MIDDLE = 12; 2697 /// const RDMA2_REPLY_INLINE = 13; 2698 /// 2699 /// /* 2700 /// * Header Type to Report Errors. 2701 /// */ 2702 /// const RDMA2_ERR_VERS = 1; 2703 /// const RDMA2_ERR_BAD_XDR = 2; 2704 /// const RDMA2_ERR_BAD_PROPVAL = 3; 2705 /// const RDMA2_ERR_INVAL_HTYPE = 4; 2706 /// const RDMA2_ERR_INVAL_CONT = 5; 2707 /// const RDMA2_ERR_READ_CHUNKS = 6; 2708 /// const RDMA2_ERR_WRITE_CHUNKS = 7; 2709 /// const RDMA2_ERR_SEGMENTS = 8; 2710 /// const RDMA2_ERR_WRITE_RESOURCE = 9; 2711 /// const RDMA2_ERR_REPLY_RESOURCE = 10; 2712 /// const RDMA2_ERR_SYSTEM = 100; 2713 /// 2714 /// struct rpcrdma2_err_vers { 2715 /// uint32 rdma_vers_low; 2716 /// uint32 rdma_vers_high; 2717 /// }; 2718 /// 2719 /// struct rpcrdma2_err_write { 2720 /// uint32 rdma_chunk_index; 2721 /// uint32 rdma_length_needed; 2722 /// }; 2723 /// 2724 /// union rpcrdma2_hdr_error switch (rpcrdma2_errcode rdma_err) { 2725 /// case RDMA2_ERR_VERS: 2726 /// rpcrdma2_err_vers rdma_vrange; 2727 /// case RDMA2_ERR_READ_CHUNKS: 2728 /// uint32 rdma_max_chunks; 2729 /// case RDMA2_ERR_WRITE_CHUNKS: 2730 /// uint32 rdma_max_chunks; 2731 /// case RDMA2_ERR_SEGMENTS: 2732 /// uint32 rdma_max_segments; 2733 /// case RDMA2_ERR_WRITE_RESOURCE: 2734 /// rpcrdma2_err_write rdma_writeres; 2735 /// case RDMA2_ERR_REPLY_RESOURCE: 2736 /// uint32 rdma_length_needed; 2737 /// default: 2738 /// void; 2739 /// }; 2740 /// 2741 /// /* 2742 /// * Header Type to Exchange Transport Properties. 2743 /// */ 2744 /// struct rpcrdma2_hdr_connprop { 2745 /// rpcrdma2_propset rdma_props; 2746 /// }; 2747 /// 2748 /// /* 2749 /// * Header Types to Convey RPC Messages. 2751 /// */ 2752 /// struct rpcrdma2_hdr_call_external { 2753 /// uint32 rdma_inv_handle; 2754 /// 2755 /// struct rpcrdma2_read_list *rdma_call; 2756 /// struct rpcrdma2_read_list *rdma_reads; 2757 /// struct rpcrdma2_write_list *rdma_provisional_writes; 2758 /// struct rpcrdma2_write_chunk *rdma_provisional_reply; 2759 /// }; 2760 /// 2761 /// struct rpcrdma2_hdr_call_middle { 2762 /// uint32 rdma_remaining; 2763 /// 2764 /// /* The rpc message starts here and continues 2765 /// * through the end of the transmission. */ 2766 /// uint32 rdma_rpc_first_word; 2767 /// }; 2768 /// 2769 /// struct rpcrdma2_hdr_call_inline { 2770 /// uint32 rdma_inv_handle; 2771 /// 2772 /// struct rpcrdma2_read_list *rdma_reads; 2773 /// struct rpcrdma2_write_list *rdma_provisional_writes; 2774 /// struct rpcrdma2_write_chunk *rdma_provisional_reply; 2775 /// 2776 /// /* The rpc message starts here and continues 2777 /// * through the end of the transmission. */ 2778 /// uint32 rdma_rpc_first_word; 2779 /// }; 2780 /// 2781 /// struct rpcrdma2_hdr_reply_external { 2782 /// struct rpcrdma2_write_list *rdma_writes; 2783 /// struct rpcrdma2_write_chunk *rdma_reply; 2784 /// }; 2785 /// 2786 /// struct rpcrdma2_hdr_reply_middle { 2787 /// uint32 rdma_remaining; 2788 /// 2789 /// /* The rpc message starts here and continues 2790 /// * through the end of the transmission. */ 2791 /// uint32 rdma_rpc_first_word; 2792 /// }; 2793 /// 2794 /// struct rpcrdma2_hdr_reply_inline { 2795 /// struct rpcrdma2_write_list *rdma_writes; 2796 /// 2797 /// /* The rpc message starts here and continues 2798 /// * through the end of the transmission. */ 2799 /// uint32 rdma_rpc_first_word; 2800 /// }; 2801 /// 2802 /// /* FILE ENDS: baseops.x; */ 2803 2805 8.5. Use of the XDR Description 2807 The files common.x and baseops.x, when combined with the XDR 2808 descriptions for extension defined later, produce a human-readable 2809 and compilable description of the RPC-over-RDMA version 2 protocol 2810 with the included extensions. 2812 Although this XDR description can generate encoders and decoders for 2813 the Transport and Payload streams, there are elements of the 2814 operation of RPC-over-RDMA version 2 that cannot be expressed within 2815 the XDR language. Implementations that use the output of an 2816 automated XDR processor need to provide additional code to bridge 2817 these gaps. 2819 * The Transport stream is not a single XDR object. Instead, the 2820 header prefix is one XDR data item, and the rest of the header is 2821 a separate XDR data item. Table 2 expresses the mapping between 2822 the header type in the header prefix and the XDR object 2823 representing the header type. 2825 * The relationship between the Transport stream and the Payload 2826 stream is not specified using XDR. Comments within the XDR text 2827 make clear where transported messages, described by their own XDR 2828 definitions, need to appear. Such data is opaque to the 2829 transport. 2831 * Continuation of RPC messages across transport message boundaries 2832 requires that message assembly facilities not specifiable within 2833 XDR are part of transport implementations. 2835 * Transport properties are constant integer values. Table 1 2836 expresses the mapping between each property's code point and the 2837 XDR typedef that represents the structure of the property's value. 2838 XDR does not possess the facility to express that mapping in an 2839 extensible way. 2841 The role of XDR in RPC-over-RDMA specifications is more limited than 2842 for protocols where the totality of the protocol is expressible 2843 within XDR. XDR lacks the facility to represent the embedding of 2844 XDR-encoded payload material. Also, the need to cleanly accommodate 2845 extensions has meant that those using rpcgen in their applications 2846 need to take an active role to provide the facilities that cannot be 2847 expressed within XDR. 2849 9. RPC Bind Parameters 2851 Before establishing a new connection, an RPC client obtains a 2852 transport address for the RPC server. The means used to obtain this 2853 address and to open an RDMA connection is dependent on the type of 2854 RDMA transport and is the responsibility of each RPC protocol binding 2855 and its local implementation. 2857 RPC services typically register with a portmap or rpcbind service 2858 [RFC1833], which associates an RPC Program number with a service 2859 address. This policy is no different with RDMA transports. However, 2860 a distinct service address (port number) is sometimes required for 2861 operation on RPC-over-RDMA. 2863 When mapped atop MPA [RFC5044], which uses IP port addressing due to 2864 its layering on TCP or SCTP, port mapping is trivial and consists 2865 merely of issuing the port in the connection process. The NFS/RDMA 2866 protocol service address has been assigned port 20049 by IANA for 2867 this deployment scenario [RFC8267]. 2869 When mapped atop InfiniBand [IBA], which uses a service endpoint 2870 naming scheme based on a Group Identifier (GID), a translation MUST 2871 be employed. One such translation is described in Annexes A3 2872 (Application Specific Identifiers), A4 (Sockets Direct Protocol 2873 (SDP)), and A11 (RDMA IP CM Service) of [IBA], which is appropriate 2874 for translating IP port addressing to the InfiniBand network. 2875 Therefore, in this case, IP port addressing may be readily employed 2876 by the upper layer. 2878 When a mapping standard or convention exists for IP ports on an RDMA 2879 interconnect, there are several possibilities for each upper layer to 2880 consider: 2882 * One possibility is to have the server register its mapped IP port 2883 with the rpcbind service under the netid (or netids) defined in 2884 [RFC8166]. An RPC-over-RDMA-aware RPC client can then resolve its 2885 desired service to a mappable port and proceed to connect. This 2886 method is the most flexible and compatible approach for those 2887 upper layers that are defined to use the rpcbind service. 2889 * A second possibility is to have the RPC server's portmapper 2890 register itself on the RDMA interconnect at a "well-known" service 2891 address (on UDP or TCP, this corresponds to port 111). An RPC 2892 client can connect to this service address and use the portmap 2893 protocol to obtain a service address in response to a program 2894 number (e.g., a TCP port number or an InfiniBand GID). 2896 * Alternately, an RPC client can connect to the mapped well-known 2897 port for the service itself, if it is appropriately defined. By 2898 convention, the NFS/RDMA service, when operating atop an 2899 InfiniBand fabric, uses the same 20049 assignment as for MPA. 2901 Historically, different RPC protocols have taken different approaches 2902 to their port assignments. The current document leaves the specific 2903 method for each RPC-over-RDMA-enabled ULB. 2905 [RFC8166] defines two new netid values to be used for registration of 2906 upper layers atop MPA and (when a suitable port translation service 2907 is available) InfiniBand. Additional RDMA-capable networks MAY 2908 define their own netids, or if they provide a port translation, they 2909 MAY share the one defined in [RFC8166]. 2911 10. Implementation Status 2913 This section is to be removed before publishing as an RFC. 2915 This section records the status of known implementations of the 2916 protocol defined by this specification at the time of posting of this 2917 Internet-Draft, and is based on a proposal described in [RFC7942]. 2918 The description of implementations in this section is intended to 2919 assist the IETF in its decision processes in progressing drafts to 2920 RFCs. 2922 Please note that the listing of any individual implementation here 2923 does not imply endorsement by the IETF. Furthermore, no effort has 2924 been spent to verify the information presented here that was supplied 2925 by IETF contributors. This is not intended as, and must not be 2926 construed to be, a catalog of available implementations or their 2927 features. Readers are advised to note that other implementations may 2928 exist. 2930 At this time, no known implementations of the protocol described in 2931 the current document exist. 2933 11. Security Considerations 2934 11.1. Memory Protection 2936 A primary consideration is the protection of the integrity and 2937 confidentiality of host memory by an RPC-over-RDMA transport. The 2938 use of an RPC-over-RDMA transport protocol MUST NOT introduce 2939 vulnerabilities to system memory contents nor memory owned by user 2940 processes. Any RDMA provider used for RPC transport MUST conform to 2941 the requirements of [RFC5042] to satisfy these protections. 2943 11.1.1. Protection Domains 2945 The use of a Protection Domain to limit the exposure of memory 2946 regions to a single connection is critical. Any attempt by an 2947 endpoint not participating in that connection to reuse memory handles 2948 needs to result in immediate failure of that connection. Because ULP 2949 security mechanisms rely on this aspect of Reliable Connected 2950 behavior, implementations SHOULD cryptographically authenticate 2951 connection endpoints. 2953 11.1.2. Handle (STag) Predictability 2955 Implementations should use unpredictable memory handles for any 2956 operation requiring exposed memory regions. Exposing a continuously 2957 registered memory region allows a remote host to read or write to 2958 that region even when an RPC involving that memory is not underway. 2959 Therefore, implementations should avoid the use of persistently 2960 registered memory. 2962 11.1.3. Memory Protection 2964 Requesters should register memory regions for remote access only when 2965 they are about to be the target of an RPC transaction that involves 2966 an RDMA Read or Write. 2968 Requesters should invalidate memory regions as soon as related RPC 2969 operations are complete. Invalidation and DMA unmapping of memory 2970 regions should complete before the receiver checks message integrity, 2971 and before the RPC consumer can use or alter the contents of the 2972 exposed memory region. 2974 An RPC transaction on a Requester can terminate before a Reply 2975 arrives, for example, if the RPC consumer is signaled, or a 2976 segmentation fault occurs. When an RPC terminates abnormally, memory 2977 regions associated with that RPC should be invalidated before the 2978 Requester reuses those regions for other purposes. 2980 11.1.4. Denial of Service 2982 A detailed discussion of denial-of-service exposures that can result 2983 from the use of an RDMA transport appears in Section 6.4 of 2984 [RFC5042]. 2986 A Responder is not obliged to pull unreasonably large Read chunks. A 2987 Responder can use an RDMA2_ERROR response to terminate RPCs with 2988 unreadable Read chunks. If a Responder transmits more data than a 2989 Requester is prepared to receive in a Write or Reply chunk, the RDMA 2990 provider typically terminates the connection. For further 2991 discussion, see Section 6.3.1. Such repeated connection termination 2992 can deny service to other users sharing the connection from the 2993 errant Requester. 2995 An RPC-over-RDMA transport implementation is not responsible for 2996 throttling the RPC request rate, other than to keep the number of 2997 concurrent RPC transactions at or under the number of credits granted 2998 per connection (see Section 4.2.1). A sender can trigger a self- 2999 denial of service by exceeding the credit grant repeatedly. 3001 When an RPC transaction terminates due to a signal or premature exit 3002 of an application process, a Requester should invalidate the RPC's 3003 Write and Reply chunks. Invalidation prevents the subsequent arrival 3004 of the Responder's Reply from altering the memory regions associated 3005 with those chunks after the Requester has released that memory. 3007 On the Requester, a malfunctioning application or a malicious user 3008 can create a situation where RPCs initiate and abort continuously, 3009 resulting in Responder replies that terminate the underlying RPC- 3010 over-RDMA connection repeatedly. Such situations can deny service to 3011 other users sharing the connection from that Requester. 3013 11.2. RPC Message Security 3015 ONC RPC provides cryptographic security via the RPCSEC_GSS framework 3016 [RFC7861]. RPCSEC_GSS implements message authentication 3017 (rpc_gss_svc_none), per-message integrity checking 3018 (rpc_gss_svc_integrity), and per-message confidentiality 3019 (rpc_gss_svc_privacy) in a layer above the RPC-over-RDMA transport. 3020 The integrity and privacy services require significant computation 3021 and movement of data on each endpoint host. Some performance 3022 benefits enabled by RDMA transports can be lost. 3024 11.2.1. RPC-over-RDMA Protection at Other Layers 3026 For any RPC transport, utilizing RPCSEC_GSS integrity or privacy 3027 services has performance implications. Protection below the RPC 3028 implementation is often a better choice in performance-sensitive 3029 deployments, especially if it, too, can be offloaded. Certain 3030 implementations of IPsec can be co-located in RDMA hardware, for 3031 example, without change to RDMA consumers and with little loss of 3032 data movement efficiency. Such arrangements can also provide a 3033 higher degree of privacy by hiding endpoint identity or altering the 3034 frequency at which messages are exchanged, at a performance cost. 3036 Implementations MAY negotiate the use of protection in another layer 3037 through the use of an RPCSEC_GSS security flavor defined in [RFC7861] 3038 in conjunction with the Channel Binding mechanism [RFC5056] and IPsec 3039 Channel Connection Latching [RFC5660]. 3041 11.2.2. RPCSEC_GSS on RPC-over-RDMA Transports 3043 Not all RDMA devices and fabrics support the above protection 3044 mechanisms. Also, NFS clients, where multiple users can access NFS 3045 files, still require per-message authentication. In these cases, 3046 RPCSEC_GSS can protect NFS traffic conveyed on RPC-over-RDMA 3047 connections. 3049 RPCSEC_GSS extends the ONC RPC protocol without changing the format 3050 of RPC messages. By observing the conventions described in this 3051 section, an RPC-over-RDMA transport can convey RPCSEC_GSS-protected 3052 RPC messages interoperably. 3054 Senders MUST NOT reduce protocol elements of RPCSEC_GSS that appear 3055 in the Payload stream of an RPC-over-RDMA message. Such elements 3056 include control messages exchanged as part of establishing or 3057 destroying a security context, or data items that are part of 3058 RPCSEC_GSS authentication material. 3060 11.2.2.1. RPCSEC_GSS Context Negotiation 3062 Some NFS client implementations use a separate connection to 3063 establish a Generic Security Service (GSS) context for NFS operation. 3064 Such clients use TCP and the standard NFS port (2049) for context 3065 establishment. Therefore, an NFS server MUST also provide a TCP- 3066 based NFS service on port 2049 to enable the use of RPCSEC_GSS with 3067 NFS/RDMA. 3069 11.2.2.2. RPC-over-RDMA with RPCSEC_GSS Authentication 3071 The RPCSEC_GSS authentication service has no impact on the DDP- 3072 eligibility of data items in a ULP. 3074 However, RPCSEC_GSS authentication material appearing in an RPC 3075 message header can be larger than, say, an AUTH_SYS authenticator. 3076 In particular, when an RPCSEC_GSS pseudoflavor is in use, a Requester 3077 needs to accommodate a larger RPC credential when marshaling RPC 3078 Calls and needs to provide for a maximum size RPCSEC_GSS verifier 3079 when allocating reply buffers and Reply chunks. 3081 RPC messages, and thus Payload streams, are larger on average as a 3082 result. ULP operations that fit in a Simple Format message when a 3083 simpler form of authentication is in use might need to be reduced or 3084 conveyed via a Special Format message when RPCSEC_GSS authentication 3085 is in use. It is therefore more likely that a Requester provisions 3086 both a Read list and a Reply chunk in the same RPC-over-RDMA 3087 Transport header to convey a Special Format Call and provision a 3088 receptacle for a Special Format Reply. 3090 In addition to this cost, the XDR encoding and decoding of each RPC 3091 message using RPCSEC_GSS authentication requires per-message host 3092 compute resources to construct the GSS verifier. 3094 11.2.2.3. RPC-over-RDMA with RPCSEC_GSS Integrity or Privacy 3096 The RPCSEC_GSS integrity service enables endpoints to detect the 3097 modification of RPC messages in flight. The RPCSEC_GSS privacy 3098 service prevents all but the intended recipient from viewing the 3099 cleartext content of RPC arguments and results. RPCSEC_GSS integrity 3100 and privacy services are end-to-end. They protect RPC arguments and 3101 results from application to server endpoint, and back. 3103 The RPCSEC_GSS integrity and encryption services operate on whole RPC 3104 messages after they have been XDR encoded, and before they have been 3105 XDR decoded after receipt. Connection endpoints use intermediate 3106 buffers to prevent exposure of encrypted or unverified cleartext data 3107 to RPC consumers. After a sender has verified, encrypted, and 3108 wrapped a message, the transport layer MAY use RDMA data transfer 3109 between these intermediate buffers. 3111 The process of reducing a DDP-eligible data item removes the data 3112 item and its XDR padding from an encoded Payload stream. In a non- 3113 protected RPC-over-RDMA message, a reduced data item does not include 3114 XDR padding. After reduction, the Payload stream contains fewer 3115 octets than the whole XDR stream did beforehand. XDR padding octets 3116 are often zero bytes, but they don't have to be. Thus, reducing DDP- 3117 eligible items affects the result of message integrity verification 3118 and encryption. 3120 Therefore, a sender MUST NOT reduce a Payload stream when RPCSEC_GSS 3121 integrity or encryption services are in use. Effectively, no data 3122 item is DDP-eligible in this situation. Senders can use only Simple 3123 and Continued Formats without data item chunks, or Special Format. 3124 In this mode, an RPC-over-RDMA transport operates in the same manner 3125 as a transport that does not support DDP. 3127 11.2.2.4. Protecting RPC-over-RDMA Transport Headers 3129 Like the header fields in an RPC message (e.g., the xid and mtype 3130 fields), RPCSEC_GSS does not protect the RPC-over-RDMA Transport 3131 stream. XIDs, connection credit limits, and chunk lists (though not 3132 the content of the data items they refer to) are exposed to malicious 3133 behavior, which can redirect data that is transferred by the RPC- 3134 over-RDMA message, result in spurious retransmits, or trigger 3135 connection loss. 3137 In particular, if an attacker alters the information contained in the 3138 chunk lists of an RPC-over-RDMA Transport header, data contained in 3139 those chunks can be redirected to other registered memory regions on 3140 Requesters. An attacker might alter the arguments of RDMA Read and 3141 RDMA Write operations on the wire to gain a similar effect. If such 3142 alterations occur, the use of RPCSEC_GSS integrity or privacy 3143 services enables a Requester to detect unexpected material in a 3144 received RPC message. 3146 Encryption at other layers, as described in Section 11.2.1, protects 3147 the content of the Transport stream. RDMA transport implementations 3148 should conform to [RFC5042] to address attacks on RDMA protocols 3149 themselves. 3151 11.3. Transport Properties 3153 Like other fields that appear in the Transport stream, transport 3154 properties are sent in the clear with no integrity protection, making 3155 them vulnerable to man-in-the-middle attacks. 3157 For example, if a man-in-the-middle were to change the value of the 3158 Receive buffer size, it could reduce connection performance or 3159 trigger loss of connection. Repeated connection loss can impact 3160 performance or even prevent a new connection from being established. 3161 The recourse is to deploy on a private network or use transport layer 3162 encryption. 3164 11.4. Host Authentication 3166 [ cel: This subsection is unfinished. ] 3168 Wherein we use the relevant sections of [RFC3552] to analyze the 3169 addition of host authentication to this RPC-over-RDMA transport. 3171 The authors refer readers to Appendix C of [RFC8446] for information 3172 on how to design and test a secure authentication handshake 3173 implementation. 3175 12. IANA Considerations 3177 The RPC-over-RDMA family of transports have been assigned RPC netids 3178 by [RFC8166]. A netid is an rpcbind [RFC1833] string used to 3179 identify the underlying protocol in order for RPC to select 3180 appropriate transport framing and the format of the service addresses 3181 and ports. 3183 The following netid registry strings are already defined for this 3184 purpose: 3186 NC_RDMA "rdma" 3187 NC_RDMA6 "rdma6" 3189 The "rdma" netid is to be used when IPv4 addressing is employed by 3190 the underlying transport, and "rdma6" when IPv6 addressing is 3191 employed. The netid assignment policy and registry are defined in 3192 [RFC5665]. The current document does not alter these netid 3193 assignments. 3195 These netids MAY be used for any RDMA network that satisfies the 3196 requirements of Section 3.2.2 and that is able to identify service 3197 endpoints using IP port addressing, possibly through use of a 3198 translation service as described in Section 9. 3200 13. References 3202 13.1. Normative References 3204 [RFC1833] Srinivasan, R., "Binding Protocols for ONC RPC Version 2", 3205 RFC 1833, DOI 10.17487/RFC1833, August 1995, 3206 . 3208 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3209 Requirement Levels", BCP 14, RFC 2119, 3210 DOI 10.17487/RFC2119, March 1997, 3211 . 3213 [RFC4506] Eisler, M., Ed., "XDR: External Data Representation 3214 Standard", STD 67, RFC 4506, DOI 10.17487/RFC4506, May 3215 2006, . 3217 [RFC5042] Pinkerton, J. and E. Deleganes, "Direct Data Placement 3218 Protocol (DDP) / Remote Direct Memory Access Protocol 3219 (RDMAP) Security", RFC 5042, DOI 10.17487/RFC5042, October 3220 2007, . 3222 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 3223 Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007, 3224 . 3226 [RFC5531] Thurlow, R., "RPC: Remote Procedure Call Protocol 3227 Specification Version 2", RFC 5531, DOI 10.17487/RFC5531, 3228 May 2009, . 3230 [RFC5660] Williams, N., "IPsec Channels: Connection Latching", 3231 RFC 5660, DOI 10.17487/RFC5660, October 2009, 3232 . 3234 [RFC5665] Eisler, M., "IANA Considerations for Remote Procedure Call 3235 (RPC) Network Identifiers and Universal Address Formats", 3236 RFC 5665, DOI 10.17487/RFC5665, January 2010, 3237 . 3239 [RFC7861] Adamson, A. and N. Williams, "Remote Procedure Call (RPC) 3240 Security Version 3", RFC 7861, DOI 10.17487/RFC7861, 3241 November 2016, . 3243 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 3244 Code: The Implementation Status Section", BCP 205, 3245 RFC 7942, DOI 10.17487/RFC7942, July 2016, 3246 . 3248 [RFC8166] Lever, C., Ed., Simpson, W., and T. Talpey, "Remote Direct 3249 Memory Access Transport for Remote Procedure Call Version 3250 1", RFC 8166, DOI 10.17487/RFC8166, June 2017, 3251 . 3253 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3254 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3255 May 2017, . 3257 [RFC8267] Lever, C., "Network File System (NFS) Upper-Layer Binding 3258 to RPC-over-RDMA Version 1", RFC 8267, 3259 DOI 10.17487/RFC8267, October 2017, 3260 . 3262 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 3263 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 3264 . 3266 13.2. Informative References 3268 [CBFC] Kung, H.T., Blackwell, T., and A. Chapman, "Credit-Based 3269 Flow Control for ATM Networks: Credit Update Protocol, 3270 Adaptive Credit Allocation, and Statistical Multiplexing", 3271 Proc. ACM SIGCOMM '94 Symposium on Communications 3272 Architectures, Protocols and Applications, pp. 101-114., 3273 August 1994. 3275 [I-D.ietf-nfsv4-rpc-tls] 3276 Myklebust, T. and C. Lever, "Towards Remote Procedure Call 3277 Encryption By Default", Work in Progress, Internet-Draft, 3278 draft-ietf-nfsv4-rpc-tls-11, 23 November 2020, 3279 . 3281 [IBA] InfiniBand Trade Association, "InfiniBand Architecture 3282 Specification Volume 1", Release 1.3, March 2015. 3283 Available from https://www.infinibandta.org/ 3285 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 3286 DOI 10.17487/RFC0768, August 1980, 3287 . 3289 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 3290 RFC 793, DOI 10.17487/RFC0793, September 1981, 3291 . 3293 [RFC1094] Nowicki, B., "NFS: Network File System Protocol 3294 specification", RFC 1094, DOI 10.17487/RFC1094, March 3295 1989, . 3297 [RFC1813] Callaghan, B., Pawlowski, B., and P. Staubach, "NFS 3298 Version 3 Protocol Specification", RFC 1813, 3299 DOI 10.17487/RFC1813, June 1995, 3300 . 3302 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 3303 Text on Security Considerations", BCP 72, RFC 3552, 3304 DOI 10.17487/RFC3552, July 2003, 3305 . 3307 [RFC5040] Recio, R., Metzler, B., Culley, P., Hilland, J., and D. 3308 Garcia, "A Remote Direct Memory Access Protocol 3309 Specification", RFC 5040, DOI 10.17487/RFC5040, October 3310 2007, . 3312 [RFC5041] Shah, H., Pinkerton, J., Recio, R., and P. Culley, "Direct 3313 Data Placement over Reliable Transports", RFC 5041, 3314 DOI 10.17487/RFC5041, October 2007, 3315 . 3317 [RFC5044] Culley, P., Elzur, U., Recio, R., Bailey, S., and J. 3318 Carrier, "Marker PDU Aligned Framing for TCP 3319 Specification", RFC 5044, DOI 10.17487/RFC5044, October 3320 2007, . 3322 [RFC5532] Talpey, T. and C. Juszczak, "Network File System (NFS) 3323 Remote Direct Memory Access (RDMA) Problem Statement", 3324 RFC 5532, DOI 10.17487/RFC5532, May 2009, 3325 . 3327 [RFC5661] Shepler, S., Ed., Eisler, M., Ed., and D. Noveck, Ed., 3328 "Network File System (NFS) Version 4 Minor Version 1 3329 Protocol", RFC 5661, DOI 10.17487/RFC5661, January 2010, 3330 . 3332 [RFC5662] Shepler, S., Ed., Eisler, M., Ed., and D. Noveck, Ed., 3333 "Network File System (NFS) Version 4 Minor Version 1 3334 External Data Representation Standard (XDR) Description", 3335 RFC 5662, DOI 10.17487/RFC5662, January 2010, 3336 . 3338 [RFC5666] Talpey, T. and B. Callaghan, "Remote Direct Memory Access 3339 Transport for Remote Procedure Call", RFC 5666, 3340 DOI 10.17487/RFC5666, January 2010, 3341 . 3343 [RFC7530] Haynes, T., Ed. and D. Noveck, Ed., "Network File System 3344 (NFS) Version 4 Protocol", RFC 7530, DOI 10.17487/RFC7530, 3345 March 2015, . 3347 [RFC7862] Haynes, T., "Network File System (NFS) Version 4 Minor 3348 Version 2 Protocol", RFC 7862, DOI 10.17487/RFC7862, 3349 November 2016, . 3351 [RFC8167] Lever, C., "Bidirectional Remote Procedure Call on RPC- 3352 over-RDMA Transports", RFC 8167, DOI 10.17487/RFC8167, 3353 June 2017, . 3355 Appendix A. ULB Specifications 3357 Typically, an Upper-Layer Protocol (ULP) is defined without regard to 3358 a particular RPC transport. An Upper-Layer Binding (ULB) 3359 specification provides guidance that helps a ULP interoperate 3360 correctly and efficiently over a particular transport. For RPC-over- 3361 RDMA version 2, a ULB may provide: 3363 * A taxonomy of XDR data items that are eligible for DDP 3365 * Constraints on which upper-layer procedures a sender may reduce, 3366 and on how many chunks may appear in a single RPC message 3368 * A method enabling a Requester to determine the maximum size of the 3369 reply Payload stream for all procedures in the ULP 3371 * An rpcbind port assignment for the RPC Program and Version when 3372 operating on the particular transport 3374 Each RPC Program and Version tuple that operates on RPC-over-RDMA 3375 version 2 needs to have a ULB specification. 3377 A.1. DDP-Eligibility 3379 A ULB designates specific XDR data items as eligible for DDP. As a 3380 sender constructs an RPC-over-RDMA message, it can remove DDP- 3381 eligible data items from the Payload stream so that the RDMA provider 3382 can place them directly in the receiver's memory. An XDR data item 3383 should be considered for DDP-eligibility if there is a clear benefit 3384 to moving the contents of the item directly from the sender's memory 3385 to the receiver's memory. 3387 Criteria for DDP-eligibility include: 3389 * The XDR data item is frequently sent or received, and its size is 3390 often much larger than typical inline thresholds. 3392 * If the XDR data item is a result, its maximum size must be 3393 predictable in advance by the Requester. 3395 * Transport-level processing of the XDR data item is not needed. 3396 For example, the data item is an opaque byte array, which requires 3397 no XDR encoding and decoding of its content. 3399 * The content of the XDR data item is sensitive to address 3400 alignment. For example, a data copy operation would be required 3401 on the receiver to enable the message to be parsed correctly, or 3402 to enable the data item to be accessed. 3404 * The XDR data item itself does not contain DDP-eligible data items. 3406 In addition to defining the set of data items that are DDP-eligible, 3407 a ULB may limit the use of chunks to particular upper-layer 3408 procedures. If more than one data item in a procedure is DDP- 3409 eligible, the ULB may limit the number of chunks that a Requester can 3410 provide for a particular upper-layer procedure. 3412 Senders never reduce data items that are not DDP-eligible. Such data 3413 items can, however, be part of a Special Format payload. 3415 The programming interface by which an upper-layer implementation 3416 indicates the DDP-eligibility of a data item to the RPC transport is 3417 not described by this specification. The only requirements are that 3418 the receiver can re-assemble the transmitted RPC-over-RDMA message 3419 into a valid XDR stream and that DDP-eligibility rules specified by 3420 the ULB are respected. 3422 There is no provision to express DDP-eligibility within the XDR 3423 language. The only definitive specification of DDP-eligibility is a 3424 ULB. 3426 In general, a DDP-eligibility violation occurs when: 3428 * A Requester reduces a non-DDP-eligible argument data item. The 3429 Responder reports the violation as described in Section 6.3.1. 3431 * A Responder reduces a non-DDP-eligible result data item. The 3432 Requester terminates the pending RPC transaction and reports an 3433 appropriate permanent error to the RPC consumer. 3435 * A Responder does not reduce a DDP-eligible result data item into 3436 an available Write chunk. The Requester terminates the pending 3437 RPC transaction and reports an appropriate permanent error to the 3438 RPC consumer. 3440 A.2. Maximum Reply Size 3442 When expecting small and moderately-sized Replies, a Requester should 3443 rely on Message Continuation rather than provision a Reply chunk. 3444 For each ULP procedure where there is no clear Reply size maximum and 3445 the maximum can be substantial, the ULB should specify a dependable 3446 means for determining the maximum Reply size. 3448 A.3. Reverse-Direction Operation 3450 The direction of operation does not preclude the need for DDP- 3451 eligibility statements. 3453 Reverse-direction operation occurs on an already-established 3454 connection. Specification of RPC binding parameters is usually not 3455 necessary in this case. 3457 Other considerations may apply when distinct RPC Programs share an 3458 RPC-over-RDMA transport connection concurrently. 3460 A.4. Additional Considerations 3462 There may be other details provided in a ULB. 3464 * A ULB may recommend inline threshold values or other transport- 3465 related parameters for RPC-over-RDMA version 2 connections bearing 3466 that ULP. 3468 * A ULP may provide a means to communicate transport-related 3469 parameters between peers. 3471 * Multiple ULPs may share a single RPC-over-RDMA version 2 3472 connection when their ULBs allow the use of RPC-over-RDMA version 3473 2 and the rpcbind port assignments for those protocols permit 3474 connection sharing. In this case, the same transport parameters 3475 (such as inline threshold) apply to all ULPs using that 3476 connection. 3478 Each ULB needs to be designed to allow correct interoperation without 3479 regard to the transport parameters actually in use. Furthermore, 3480 implementations of ULPs must be designed to interoperate correctly 3481 regardless of the connection parameters in effect on a connection. 3483 A.5. ULP Extensions 3485 An RPC Program and Version tuple may be extensible. For instance, 3486 the RPC version number may not reflect a ULP minor versioning scheme, 3487 or the ULP may allow the specification of additional features after 3488 the publication of the original RPC Program specification. ULBs are 3489 provided for interoperable RPC Programs and Versions by extending 3490 existing ULBs to reflect the changes made necessary by each addition 3491 to the existing XDR. 3493 [ cel: The final sentence is unclear, and may be inaccurate. I 3494 believe I copied this section directly from RFC 8166. Is there more 3495 to be said, now that we have some experience? ] 3497 Appendix B. Extending RPC-over-RDMA Version 2 3499 This Appendix is not addressed to protocol implementers, but rather 3500 to authors of documents that extend the protocol specified in the 3501 current document. 3503 RPC-over-RDMA version 2 extensibility facilitates limited extensions 3504 to the base protocol presented in the current document so that new 3505 optional capabilities can be introduced without a protocol version 3506 change while maintaining robust interoperability with existing RPC- 3507 over-RDMA version 2 implementations. It allows extensions to be 3508 defined, including the definition of new protocol elements, without 3509 requiring modification or recompilation of the XDR for the base 3510 protocol. 3512 Standards Track documents may introduce extensions to the base RPC- 3513 over-RDMA version 2 protocol in two ways: 3515 * They may introduce new OPTIONAL transport header types. 3516 Appendix B.2 covers such transport header types. 3518 * They may define new OPTIONAL transport properties. Appendix B.3 3519 describes such transport properties. 3521 These documents may also add the following sorts of ancillary 3522 protocol elements to the protocol to support the addition of new 3523 transport properties and header types: 3525 * They may create new error codes, as described in Appendix B.4. 3527 New capabilities can be proposed and developed independently of each 3528 other. Implementers can choose among them, making it straightforward 3529 to create and document experimental features and then bring them 3530 through the standards process. 3532 B.1. Documentation Requirements 3534 As described earlier, a Standards Track document introduces a set of 3535 new protocol elements. Together these elements are considered an 3536 OPTIONAL feature. Each implementation is either aware of all the 3537 protocol elements introduced by that feature or is aware of none of 3538 them. 3540 Documents specifying extensions to RPC-over-RDMA version 2 should 3541 contain: 3543 * An explanation of the purpose and use of each new protocol 3544 element. 3546 * An XDR description including all of the new protocol elements, and 3547 a script to extract it. 3549 * A discussion of interactions with other extensions. This 3550 discussion includes requirements for other OPTIONAL features to be 3551 present, or that a particular level of support for an OPTIONAL 3552 facility is required. 3554 Implementers combine the XDR descriptions of the new features they 3555 intend to use with the XDR description of the base protocol in the 3556 current document. This combination is necessary to create a valid 3557 XDR input file because extensions are free to use XDR types defined 3558 in the base protocol, and later extensions may use types defined by 3559 earlier extensions. 3561 The XDR description for the RPC-over-RDMA version 2 base protocol 3562 combined with that for any selected extensions should provide a 3563 human-readable and compilable definition of the extended protocol. 3565 B.2. Adding New Header Types to RPC-over-RDMA Version 2 3567 New transport header types are defined similar to Sections 6.3.5 3568 through 6.3.10. In particular, what is needed is: 3570 * A description of the function and use of the new header type. 3572 * A complete XDR description of the new header type. 3574 * A description of how receivers report errors, including mechanisms 3575 for reporting errors outside the available choices already 3576 available in the base protocol or other extensions. 3578 * An indication of whether a Payload stream must be present, and a 3579 description of its contents and how receivers use such Payload 3580 streams to reconstruct RPC messages. 3582 * As appropriate, a statement of whether a Responder may use Remote 3583 Invalidation when sending messages that contain the new header 3584 type. 3586 There needs to be additional documentation that is made necessary due 3587 to the OPTIONAL status of new transport header types: 3589 * The document should discuss constraints on support for the new 3590 header types. For example, if support for one header type is 3591 implied or foreclosed by another one, this needs to be documented. 3593 * The document should describe the preferred method by which a 3594 sender determines whether its peer supports a particular header 3595 type. It is always possible to send a test invocation of a 3596 particular header type to see if support is available. However, 3597 when more efficient means are available (e.g., the value of a 3598 transport property), this should be noted. 3600 B.3. Adding New Transport properties to the Protocol 3602 A Standards Track document defining a new transport property should 3603 include the following information paralleling that provided in this 3604 document for the transport properties defined herein: 3606 * The rpcrdma2_propid value identifying the new property. 3608 * The XDR typedef specifying the structure of its property value. 3610 * A description of the new property. 3612 * An explanation of how the receiver can use this information. 3614 * The default value if a peer never receives the new property. 3616 There is no requirement that propid assignments occur in a continuous 3617 range of values. Implementations should not rely on all such values 3618 being small integers. 3620 Before the defining Standards Track document is published, the nfsv4 3621 Working Group should select a unique propid value, and ensure that: 3623 * rpcrdma2_propid values specified in the document do not conflict 3624 with those currently assigned or in use by other pending working 3625 group documents defining transport properties. 3627 * rpcrdma2_propid values specified in the document do not conflict 3628 with the range reserved for experimental use, as defined in 3629 Section 8.2. 3631 [ cel: There is no longer a section 8.2 or an experimental range 3632 of propid values. Should we request the creation of an IANA 3633 registry for propid values? ]. 3635 When a Standards Track document proposes additional transport 3636 properties, reviewers should deal with possible security issues 3637 exposed by those new transport properties. 3639 B.4. Adding New Error Codes to the Protocol 3641 The same Standards Track document that defines a new header type may 3642 introduce new error codes used to support it. A Standards Track 3643 document may similarly define new error codes that an existing header 3644 type can return. 3646 For error codes that do not require the return of additional 3647 information, a peer can use the existing RDMA_ERR2 header type to 3648 report the new error. The sender sets the new error code as the 3649 value of rdma_err with the result that the default switch arm of the 3650 rpcrdma2_error (i.e., void) is selected. 3652 For error codes that do require the return of related information 3653 together with the error, a new header type should be defined that 3654 returns the error together with the related information. The sender 3655 of a new header type needs to be prepared to accept header types 3656 necessary to report associated errors. 3658 Appendix C. Differences from RPC-over-RDMA Version 1 3660 The primary goal of RPC-over-RDMA version 2 is to relieve constraints 3661 that have become evident in RPC-over-RDMA version 1 with deployment 3662 experience: 3664 * RPC-over-RDMA version 1 has been challenging to update to address 3665 shortcomings or improve data transfer efficiency. 3667 * The average size of NFSv4 COMPOUNDs is significantly greater than 3668 NFSv3 requests, requiring the use of Long messages for frequent 3669 operations. 3671 * Reply size estimation is difficult more often than first expected. 3673 This section details specific changes in RPC-over-RDMA version 2 that 3674 address these constraints directly, in addition to other changes to 3675 make implementation easier. 3677 C.1. Changes to the XDR Definition 3679 Several XDR structural changes enable within-version protocol 3680 extensibility. 3682 [RFC8166] defines the RPC-over-RDMA version 1 transport header as a 3683 single XDR object, with an RPC message potentially following it. In 3684 RPC-over-RDMA version 2, there are separate XDR definitions of the 3685 transport header prefix (see Section 6.4), which specifies the 3686 transport header type to be used, and the transport header itself 3687 (defined within one of the subsections of Section 6.3). This 3688 construction is similar to an RPC message, which consists of an RPC 3689 header (defined in [RFC5531]) followed by a message defined by an 3690 Upper-Layer Protocol. 3692 As a new version of the RPC-over-RDMA transport protocol, RPC-over- 3693 RDMA version 2 exists within the versioning rules defined in 3694 [RFC8166]. In particular, it maintains the first four words of the 3695 protocol header, as specified in Section 4.2 of [RFC8166], even 3696 though, as explained in Section 6.2.1 of the current document, the 3697 XDR definition of those words is structured differently. 3699 Although each of the first four fields retains its semantic function, 3700 there are differences in interpretation: 3702 * The first word of the header, the rdma_xid field, retains the 3703 format and function that it had in RPC-over-RDMA version 1. 3704 Because RPC-over-RDMA version 2 messages can convey non-RPC 3705 messages, a receiver should not use the contents of this field 3706 without consideration of the protocol version and header type. 3708 * The second word of the header, the rdma_vers field, retains the 3709 format and function that it had in RPC-over-RDMA version 1. To 3710 clearly distinguish version 1 and version 2 messages, senders need 3711 to fill in the correct version (fixed after version negotiation). 3712 Receivers should check that the content of the rdma_vers is 3713 correct before using the content of any other header field. 3715 * The third word of the header, the rdma_credit field, retains the 3716 size and general purpose that it had in RPC-over-RDMA version 1. 3717 However, RPC-over-RDMA version 2 divides this field into two 3718 16-bit subfields. See Section 4.2.1 for further details. 3720 * The fourth word of the header, previously the union discriminator 3721 field rdma_proc, retains its format and general function even 3722 though the set of valid values has changed. Within RPC-over-RDMA 3723 version 2, this word is the rdma_htype field of the structure 3724 rdma_start. The value of this field is now an unsigned 32-bit 3725 integer rather than an enum type, to facilitate header type 3726 extension. 3728 Beyond conforming to the restrictions specified in [RFC8166], RPC- 3729 over-RDMA version 2 attempts to limit the scope of the changes made 3730 to ensure interoperability. Although it introduces the Call chunk 3731 and splits the two version 1 workhorse procedure types RDMA_MSG and 3732 RDMA_NOMSG into several variants, RPC-over-RDMA version 2 otherwise 3733 expresses chunks in the same format and utilizes them the same way. 3735 C.2. Transport Properties 3737 RPC-over-RDMA version 2 provides a mechanism for exchanging an 3738 implementation's operational properties. The purpose of this 3739 exchange is to help endpoints improve the efficiency of data transfer 3740 by exploiting the characteristics of both peers rather than falling 3741 back on the lowest common denominator default settings. A full 3742 discussion of transport properties appears in Section 5. 3744 C.3. Credit Management Changes 3746 RPC-over-RDMA transports employ credit-based flow control to ensure 3747 that a Requester does not emit more RDMA Sends than the Responder is 3748 prepared to receive. 3750 Section 3.3.1 of [RFC8166] explains the operation of RPC-over-RDMA 3751 version 1 credit management in detail. In that design, each RDMA 3752 Send from a Requester contains an RPC Call with a credit request, and 3753 each RDMA Send from a Responder contains an RPC Reply with a credit 3754 grant. The credit grant implies that enough Receives have been 3755 posted on the Responder to handle the credit grant minus the number 3756 of pending RPC transactions (the number of remaining Receive buffers 3757 might be zero). 3759 Each RPC Reply acts as an implicit ACK for a previous RPC Call from 3760 the Requester. Without an RPC Reply message, the Requester has no 3761 way to know that the Responder is ready for subsequent RPC Calls. 3763 Because version 1 embeds credit management in each message, there is 3764 a strict one-to-one ratio between RDMA Send and RPC message. There 3765 are interesting use cases that might be enabled if this relationship 3766 were more flexible: 3768 * RPC-over-RDMA operations that do not carry an RPC message, e.g., 3769 control plane operations. 3771 * A single RDMA Send that conveys more than one RPC message, e.g., 3772 for interrupt mitigation. 3774 * An RPC message that requires several sequential RDMA Sends, e.g., 3775 to reduce the use of explicit RDMA operations for moderate-sized 3776 RPC messages. 3778 * An RPC transaction that requires multiple exchanges or an odd 3779 number of RPC-over-RDMA operations to complete. 3781 RPC-over-RDMA version 2 provides a more sophisticated credit 3782 accounting mechanism to address these shortcomings. Section 4.2.1 3783 explains the new mechanism in detail. 3785 C.4. Inline Threshold Changes 3787 An "inline threshold" value is the largest message size (in octets) 3788 that can be conveyed on an RDMA connection using only RDMA Send and 3789 Receive. Each connection has two inline threshold values: one for 3790 messages flowing from client-to-server (referred to as the "client- 3791 to-server inline threshold") and one for messages flowing from 3792 server-to-client (referred to as the "server-to-client inline 3793 threshold"). 3795 A connection's inline thresholds determine, among other things, when 3796 RDMA Read or Write operations are required because an RPC message 3797 cannot be conveyed via a single RDMA Send and Receive pair. When an 3798 RPC message does not contain DDP-eligible data items, a Requester can 3799 prepare a Special Format Call or Reply to convey the whole RPC 3800 message using RDMA Read or Write operations. 3802 RDMA Read and Write operations require that data payloads reside in 3803 memory registered with the local RNIC. When an RPC completes, that 3804 memory is invalidated to fence it from the Responder. Memory 3805 registration and invalidation typically have a latency cost that is 3806 insignificant compared to data handling costs. 3808 When a data payload is small, however, the cost of registering and 3809 invalidating memory where the payload resides becomes a significant 3810 part of total RPC latency. Therefore the most efficient operation of 3811 an RPC-over-RDMA transport occurs when the peers use explicit RDMA 3812 Read and Write operations for large payloads but avoid those 3813 operations for small payloads. 3815 When the authors of [RFC8166] first conceived RPC-over-RDMA version 3816 1, the average size of RPC messages that did not involve a 3817 significant data payload was under 500 bytes. A 1024-byte inline 3818 threshold adequately minimized the frequency of inefficient Long 3819 messages. 3821 With NFS version 4 [RFC7530], the increased size of NFS COMPOUND 3822 operations resulted in RPC messages that are, on average, larger than 3823 previous versions of NFS. With a 1024-byte inline threshold, 3824 frequent operations such as GETATTR and LOOKUP require RDMA Read or 3825 Write operations, reducing the efficiency of data transport. 3827 To reduce the frequency of Special Format messages, RPC-over-RDMA 3828 version 2 increases the default size of inline thresholds. This 3829 change also increases the maximum size of reverse-direction RPC 3830 messages. 3832 C.5. Message Continuation Changes 3834 In addition to a larger default inline threshold, RPC-over-RDMA 3835 version 2 introduces Message Continuation. Message Continuation is a 3836 mechanism that enables the transmission of a data payload using more 3837 than one RDMA Send. The purpose of Message Continuation is to 3838 provide relief in several essential cases: 3840 * If a Requester finds that it is inefficient to convey a 3841 moderately-sized data payload using Read chunks, the Requester can 3842 use Message Continuation to send the RPC Call. 3844 * If a Requester has provided insufficient Reply chunk space for a 3845 Responder to send an RPC Reply, the Responder can use Message 3846 Continuation to send the RPC Reply. 3848 * If a sender has to convey a sizeable non-RPC data payload (e.g., a 3849 large transport property), the sender can use Message Continuation 3850 to avoid having to register memory. 3852 C.6. Host Authentication Changes 3854 For the general operation of NFS on open networks, we eventually 3855 intend to rely on RPC-on-TLS [I-D.ietf-nfsv4-rpc-tls] to provide 3856 cryptographic authentication of the two ends of each connection. In 3857 turn, this can improve the trustworthiness of AUTH_SYS-style user 3858 identities that flow on TCP, which are not cryptographically 3859 protected. We do not have a similar solution for RPC-over-RDMA, 3860 however. 3862 Here, the RDMA transport layer already provides a strong guarantee of 3863 message integrity. On some network fabrics, IPsec or TLS can protect 3864 the privacy of in-transit data. However, this is not the case for 3865 all fabrics (e.g., InfiniBand [IBA]). 3867 Thus, RPC-over-RDMA version 2 introduces a mechanism for 3868 authenticating connection peers (see Section 5.2.6). And like GSS 3869 channel binding, there is also a way to determine when the use of 3870 host authentication is unnecessary. 3872 C.7. Support for Remote Invalidation 3874 When an RDMA consumer uses FRWR or Memory Windows to register memory, 3875 that memory may be invalidated remotely [RFC5040]. These mechanisms 3876 are available when a Requester's RNIC supports MEM_MGT_EXTENSIONS. 3878 For this discussion, there are two classes of STags. Dynamically- 3879 registered STags appear in a single RPC, then are invalidated. 3880 Persistently-registered STags survive longer than one RPC. They may 3881 persist for the life of an RPC-over-RDMA connection or even longer. 3883 An RPC-over-RDMA Requester can provide more than one STag in a 3884 transport header. It may provide a combination of dynamically- and 3885 persistently-registered STags in one RPC message, or any combination 3886 of these in a series of RPCs on the same connection. Only 3887 dynamically-registered STags using Memory Windows or FRWR may be 3888 invalidated remotely. 3890 There is no transport-level mechanism by which a Responder can 3891 determine how a Requester-provided STag was registered, nor whether 3892 it is eligible to be invalidated remotely. A Requester that mixes 3893 persistently- and dynamically-registered STags in one RPC, or mixes 3894 them across RPCs on the same connection, must, therefore, indicate 3895 which STag the Responder may invalidate remotely via a mechanism 3896 provided in the Upper-Layer Protocol. RPC-over-RDMA version 2 3897 provides such a mechanism. 3899 A sender uses the RDMA Send With Invalidate operation to invalidate 3900 an STag on the remote peer. It is available only when both peers 3901 support MEM_MGT_EXTENSIONS (can send and process an IETH). 3903 Existing RPC-over-RDMA transport protocol specifications [RFC8166] 3904 [RFC8167] do not forbid direct data placement in the reverse 3905 direction. Moreover, there is currently no Upper-Layer Protocol that 3906 makes data items in reverse-direction operations eligible for direct 3907 data placement. 3909 When chunks are present in a reverse-direction RPC request, Remote 3910 Invalidation enables the Responder to trigger invalidation of a 3911 Requester's STags as part of sending an RPC Reply, the same way as is 3912 done in the forward direction. 3914 However, in the reverse direction, the server acts as the Requester, 3915 and the client is the Responder. The server's RNIC, therefore, must 3916 support receiving an IETH, and the server must have registered its 3917 STags with an appropriate registration mechanism. 3919 C.8. Integration of Reverse-Direction Operation 3921 Because [RFC5666] did not include specification of reverse-direction 3922 operation, [RFC8166] does not include it either. Reverse-direction 3923 operation in RPC-over-RDMA version 1 is specified by a separate 3924 standards track document [RFC8167]. 3926 Reverse-direction operation in RPC-over-RDMA version 1 was 3927 constrained by the limited ability to extend that version of the 3928 protocol. The most awkward issue is that a receiver needs to peek at 3929 ingress RPC message payloads to determine whether it is a Call or 3930 Reply message. This is necessary because the meaning of several 3931 fields in the RPC-over-RDMA transport header is determined by the 3932 direction of the RPC message payload: 3934 * The meaning of the value in the rdma_xid field is determined by 3935 the direction of the message because the XID spaces in the forward 3936 and reverse directions are distinct. 3938 * The meaning of the value in the rdma_credits field is determined 3939 by the direction of the message because credits are granted 3940 separately for forward and reverse direction operation. 3942 * The purpose of Write chunks and the meaning of their length fields 3943 is determined by the direction of the message because in Call 3944 messages, they are provisional, but in Reply messages, they 3945 represent returned results. 3947 The current document remedies this awkwardness by integrating 3948 reverse-direction operation into RPC-over-RDMA version 2 so that it 3949 can make use of all facilities that are available in the forward- 3950 direction, including body chunks, remote invalidation, and message 3951 continuation. To enable this integration, the direction of the RPC 3952 message payload is encoded in each RPC-over-RDMA version 2 transport 3953 header. 3955 C.9. Error Reporting Changes 3957 RPC-over-RDMA version 2 expands the repertoire of errors that 3958 connection peers may report to each other. The goals of this 3959 expansion are: 3961 * To fill in details of peer recovery actions. 3963 * To enable retrying certain conditions caused by mis-estimation of 3964 the maximum reply size. 3966 * To minimize the likelihood of a Requester waiting forever for a 3967 Reply when there are communications problems that prevent the 3968 Responder from sending it. 3970 C.10. Changes in Terminology 3972 The RPC-over-RDMA version 2 specification makes the following changes 3973 in terminology. These changes do not result in changes in the 3974 behavior or operation of the protocol. 3976 * The current document explicitly acknowledges the different 3977 semantics and purpose of Write chunks appearing in Call messages 3978 and those appearing in Reply messages. 3980 * The current document introduces the term "payload format" to 3981 describe the selection of a mechanism for reducing and conveying 3982 an RPC message payload. It replaces the terms "short message" and 3983 "long message" with the terms "simple format" and "special format" 3984 because this selection is not based only on the size of the 3985 payload. 3987 * The current document introduces the terms "data item chunk" and 3988 "body chunk" in order to distinguish the purpose and operation of 3989 these two categories of chunk. 3991 * For improved readability, the current document replaces the terms 3992 "RDMA segment" and "plain segment" with the term "segment", and 3993 the term "RDMA read segment" with the term "Read segment". 3995 * The current document refers specifically to the RDMAP, DDP, and 3996 MPA standards track protocols rather than using the nebulous term 3997 "iWARP". 3999 Acknowledgments 4001 The authors gratefully acknowledge the work of Brent Callaghan and 4002 Tom Talpey on the original RPC-over-RDMA version 1 specification 4003 [RFC5666]. The authors also wish to thank Bill Baker, Greg Marsden, 4004 and Matt Benjamin for their support of this work. 4006 The XDR extraction conventions were first described by the authors of 4007 the NFS version 4.1 XDR specification [RFC5662]. Herbert van den 4008 Bergh suggested the replacement sed script used in this document. 4010 Special thanks go to Transport Area Director Magnus Westerlund, NFSV4 4011 Working Group Chairs Spencer Shepler, and Brian Pawlowski, and NFSV4 4012 Working Group Secretary Thomas Haynes for their support. 4014 Authors' Addresses 4016 Charles Lever (editor) 4017 Oracle Corporation 4018 United States of America 4020 Email: chuck.lever@oracle.com 4022 David Noveck 4023 NetApp 4024 1601 Trapelo Road 4025 Waltham, MA 02451 4026 United States of America 4028 Phone: +1 781 572 8038 4029 Email: davenoveck@gmail.com