idnits 2.17.1 draft-ietf-nfsv4-rpcrdma-version-two-03.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 (10 August 2020) is 1355 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) == Outdated reference: A later version (-11) exists of draft-ietf-nfsv4-rpc-tls-08 -- 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 (~~), 3 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: 11 February 2021 NetApp 6 10 August 2020 8 RPC-over-RDMA Version 2 Protocol 9 draft-ietf-nfsv4-rpcrdma-version-two-03 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 11 February 2021. 48 Copyright Notice 50 Copyright (c) 2020 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 * To simplify interoperability with RPC-over-RDMA version 1, only 1537 the RDMA2_ERROR header (defined in Section 6.3.1) has an XDR 1538 definition that differs from that in RPC-over-RDMA version 1, and 1539 its modifications are all compatible extensions. 1541 * Senders use RDMA2_CALL_INLINE or RDMA2_REPLY_FINAL (defined in 1542 Sections 6.3.7 and 6.3.10) in place of RDMA_MSG. There are minor 1543 differences in the on-the-wire format between the version 1 1544 procedure and the version 2 header types. 1546 * Senders use RDMA2_CALL_EXTERNAL or RDMA2_REPLY_EXTERNAL (defined 1547 in Sections 6.3.5 and 6.3.8) in place of RDMA_NOMSG. There are 1548 minor differences in the on-the-wire format between the version 1 1549 procedure and the version 2 header types. 1551 * RDMA2_CONNPROP_MIDDLE and RDMA2_CONNPROP_FINAL (defined in 1552 Sections 6.3.3 and 6.3.4) is an entirely new header type devoted 1553 to enabling connection peers to exchange information about their 1554 transport properties. 1556 6.3.1. RDMA2_ERROR: Report Transport Error 1558 RDMA2_ERROR reports a transport layer error on a previous 1559 transmission. 1561 1562 const rpcrdma2_proc RDMA2_ERROR = 4; 1564 struct rpcrdma2_err_vers { 1565 uint32 rdma_vers_low; 1566 uint32 rdma_vers_high; 1567 }; 1569 struct rpcrdma2_err_write { 1570 uint32 rdma_chunk_index; 1571 uint32 rdma_length_needed; 1572 }; 1574 union rpcrdma2_hdr_error switch (rpcrdma2_errcode rdma_err) { 1575 case RDMA2_ERR_VERS: 1576 rpcrdma2_err_vers rdma_vrange; 1577 case RDMA2_ERR_READ_CHUNKS: 1578 uint32 rdma_max_chunks; 1579 case RDMA2_ERR_WRITE_CHUNKS: 1580 uint32 rdma_max_chunks; 1581 case RDMA2_ERR_SEGMENTS: 1582 uint32 rdma_max_segments; 1583 case RDMA2_ERR_WRITE_RESOURCE: 1584 rpcrdma2_err_write rdma_writeres; 1585 case RDMA2_ERR_REPLY_RESOURCE: 1586 uint32 rdma_length_needed; 1587 default: 1588 void; 1589 }; 1590 1592 See Section 7 for details on the use of this header type. 1594 6.3.2. RDMA2_GRANT: Grant Credits 1596 The RDMA2_GRANT header type enables a connection peer to grant 1597 additional credits to its remote peer without conveying a payload. 1599 1600 const rpcrdma2_proc RDMA2_GRANT = 5; 1601 1603 This message carries no payload except for a struct 1604 rpcrdma2_hdr_prefix. The rdma_xid field is unused. Senders MUST set 1605 the rdma_xid field to zero and receivers MUST ignore the value in 1606 this field. 1608 6.3.3. RDMA2_CONNPROP_MIDDLE: Exchange Transport Properties 1610 The RDMA2_CONNPROP_MIDDLE header type enables a connection peer to 1611 publish the properties of its implementation to its remote peer. 1613 1614 const rpcrdma2_proc RDMA2_CONNPROP_MIDDLE = 6; 1616 struct rpcrdma2_hdr_connprop { 1617 rpcrdma2_propset rdma_props; 1618 }; 1619 1621 A peer sends an RDMA2_CONNPROP_MIDDLE header type when it has one or 1622 more properties to send that do not fit within the default inline 1623 threshold for the RPC-over-RDMA version that is in effect. 1625 A peer may encounter properties that it does not recognize or 1626 support. In such cases, the receiver ignores unsupported properties 1627 without generating an error response. 1629 If a peer sends follows an RDMA2_CONNPROP_MIDDLE header type with 1630 anything other than another RDMA2_CONNPROP_MIDDLE message or an 1631 RDMA2_CONNPROP_FINAL message, the receiver MUST respond with an 1632 RDMA2_ERROR header type and set its rdma_err field to 1633 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1634 it further. 1636 6.3.4. RDMA2_CONNPROP_FINAL: Exchange Transport Properties 1638 The RDMA2_CONNPROP_FINAL header type enables a connection peer to 1639 publish the properties of its implementation to its remote peer. 1641 1642 const rpcrdma2_proc RDMA2_CONNPROP_FINAL = 7; 1644 struct rpcrdma2_hdr_connprop { 1645 rpcrdma2_propset rdma_props; 1646 }; 1647 1649 Each peer sends an RDMA2_CONNPROP_FINAL header type as the final 1650 CONNPROP-type message after the client has established a connection. 1651 The size of this message is limited to the default inline threshold 1652 for the RPC-over-RDMA version that is in effect. 1654 A peer may encounter properties that it does not recognize or 1655 support. In such cases, the receiver ignores unsupported properties 1656 without generating an error response. 1658 If a peer sends a CONNPROP-type message on a connection after it has 1659 sent an RDMA2_CONNPROP_FINAL message, the receiver MUST respond with 1660 an RDMA2_ERROR header type and set its rdma_err field to 1661 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1662 it further. 1664 6.3.5. RDMA2_CALL_EXTERNAL: Convey External RPC Call Message 1666 RDMA2_CALL_EXTERNAL conveys an RPC Call message payload using 1667 explicit RDMA operations. The Responder reads the Payload stream 1668 from a memory area specified by the Call chunk. The sender MUST set 1669 the rdma_xid field to the same value as the xid of the RPC Reply 1670 message payload. 1672 1673 const rpcrdma2_proc RDMA2_CALL_EXTERNAL = 8; 1675 struct rpcrdma2_hdr_call_external { 1676 uint32 rdma_inv_handle; 1678 struct rpcrdma2_read_list *rdma_call; 1679 struct rpcrdma2_read_list *rdma_reads; 1680 struct rpcrdma2_write_list *rdma_provisional_writes; 1681 struct rpcrdma2_write_chunk *rdma_provisional_reply; 1682 }; 1683 1685 rdma_inv_handle: The rdma_inv_handle field contains a 32-bit RDMA 1686 handle that the Responder may use in a Send With Invalidation 1687 operation. See Section 6.5. 1689 rdma_call: The rdma_call field anchors a list of one or more Read 1690 segments that contain the RPC Call's Payload stream. 1692 rdma_reads: The rdma_reads field anchors a list of zero or more Read 1693 segments that contain data item chunks. 1695 rdma_provisional_writes: The rdma_writes field anchors a list of 1696 zero or more provisional Write chunks. 1698 rdma_provisional_reply: The rdma_reply field is a list containing 1699 zero or one provisional Reply chunk. 1701 6.3.6. RDMA2_CALL_MIDDLE: Convey Continued RPC Call Message 1703 RDMA2_CALL_MIDDLE conveys a beginning or middle portion of an RPC 1704 Call message immediately following the transport header in the send 1705 buffer. The sender MUST set the rdma_xid field to the same value as 1706 the xid of the RPC Reply message payload. The sender sets the 1707 rdma_remaining field to the number of bytes in the RPC Call message 1708 payload that remain to be sent. The rdma_rpc_first_word field 1709 demarks the first word of the Payload stream. 1711 1712 const rpcrdma2_proc RDMA2_CALL_MIDDLE = 9; 1714 struct rpcrdma2_hdr_call_middle { 1715 uint32 rdma_remaining; 1717 /* The rpc message starts here and continues 1718 * through the end of the transmission. */ 1719 uint32 rdma_rpc_first_word; 1720 }; 1721 1723 If a peer sends follows an RDMA2_CALL_MIDDLE header type with 1724 anything other than an RDMA2_CALL_MIDDLE message or an 1725 RDMA2_CALL_INLINE message, the receiver MUST respond with an 1726 RDMA2_ERROR header type and set its rdma_err field to 1727 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1728 it further. 1730 6.3.7. RDMA2_CALL_INLINE: Convey Inline RPC Call Message 1732 RDMA2_CALL_INLINE conveys the only or final portion of an RPC Call 1733 message. The rdma_rpc_first_word field demarks the first word of 1734 this Payload stream. 1736 1737 const rpcrdma2_proc RDMA2_CALL_INLINE = 10; 1739 struct rpcrdma2_hdr_call_inline { 1740 uint32 rdma_inv_handle; 1742 struct rpcrdma2_read_list *rdma_reads; 1743 struct rpcrdma2_write_list *rdma_provisional_writes; 1744 struct rpcrdma2_write_chunk *rdma_provisional_reply; 1746 /* The rpc message starts here and continues 1747 * through the end of the transmission. */ 1748 uint32 rdma_rpc_first_word; 1749 }; 1750 1752 rdma_inv_handle: The rdma_inv_handle field contains a 32-bit RDMA 1753 handle that the Responder may use in a Send With Invalidation 1754 operation. See Section 6.5. 1756 rdma_reads: The rdma_reads field anchors a list of zero or more Read 1757 segments that contain only data item chunks. A Requester MUST NOT 1758 insert Position-zero Read chunks in this list. 1760 rdma_provisional_writes: The rdma_writes field anchors a list of 1761 zero or more provisional Write chunks. 1763 rdma_provisional_reply: The rdma_reply field is a list containing 1764 zero or one provisional Reply chunk. 1766 6.3.8. RDMA2_REPLY_EXTERNAL: Convey External RPC Reply Message 1768 RDMA2_REPLY_EXTERNAL conveys an RPC Reply message payload using 1769 explicit RDMA operations. In particular, it is referred to as a 1770 Special Format Reply when the Responder writes the RPC payload into a 1771 memory area specified by a Reply chunk. The sender MUST set the 1772 rdma_xid field to the same value as the xid of the RPC Reply message 1773 payload. 1775 1776 const rpcrdma2_proc RDMA2_REPLY_EXTERNAL = 11; 1778 struct rpcrdma2_hdr_reply_external { 1779 struct rpcrdma2_write_list *rdma_writes; 1780 struct rpcrdma2_write_chunk *rdma_reply; 1781 }; 1782 1783 rdma_writes: The rdma_writes field anchors a list of zero or more 1784 Write chunks that are either empty or contain reduced data items. 1786 rdma_reply: The rdma_reply field is a list that MUST contain exactly 1787 one Reply chunk. 1789 6.3.9. RDMA2_REPLY_MIDDLE: Convey Continued RPC Reply Message 1791 RDMA2_REPLY_MIDDLE conveys a beginning or middle portion of an RPC 1792 Reply message immediately following the transport header in the send 1793 buffer. The sender MUST set the rdma_xid field to the same value as 1794 the xid of the RPC Reply message payload. The sender sets the 1795 rdma_remaining field to the number of bytes in the RPC Call message 1796 payload that remain to be sent. The rdma_rpc_first_word field 1797 demarks the first word of the Payload stream. 1799 1800 const rpcrdma2_proc RDMA2_REPLY_MIDDLE = 12; 1802 struct rpcrdma2_hdr_reply_middle { 1803 uint32 rdma_remaining; 1805 /* The rpc message starts here and continues 1806 * through the end of the transmission. */ 1807 uint32 rdma_rpc_first_word; 1808 }; 1809 1811 If a peer sends follows an RDMA2_REPLY_MIDDLE header type with 1812 anything other than an RDMA2_REPLY_MIDDLE message or an 1813 RDMA2_REPLY_INLINE message, the receiver MUST respond with an 1814 RDMA2_ERROR header type and set its rdma_err field to 1815 RDMA2_ERR_INVAL_CONT and drop the incoming message without processing 1816 it further. 1818 6.3.10. RDMA2_REPLY_INLINE: Convey RPC Reply Message Inline 1820 RDMA2_REPLY_INLINE conveys the only or final portion of an RPC Reply 1821 message immediately following the transport header in the send 1822 buffer. If the Reply message payload has been reduced, the 1823 rdma_chunks object carries the reduced data item chunks. 1825 1826 const rpcrdma2_proc RDMA2_REPLY_INLINE = 13; 1828 struct rpcrdma2_hdr_reply_inline { 1829 struct rpcrdma2_write_list *rdma_writes; 1831 /* The rpc message starts here and continues 1832 * through the end of the transmission. */ 1833 uint32 rdma_rpc_first_word; 1834 }; 1835 1837 rdma_writes: The rdma_writes field anchors a list of zero or more 1838 Write chunks that are either empty or contain reduced data items. 1840 6.4. Transport Header Prefix 1842 The following prefix structure appears at the start of each RPC-over- 1843 RDMA version 2 transport header. 1845 1846 struct rpcrdma2_hdr_prefix { 1847 struct rpcrdma_common rdma_start; 1848 }; 1849 1851 6.5. Remote Invalidation 1853 To solicit the use of Remote Invalidation, a Requester sets the value 1854 of the rdma_inv_handle field in an RPC Call's transport header to a 1855 non-zero value that matches one of the rdma_handle fields in that 1856 header. If the Responder may invalidate none of the rdma_handle 1857 values in the header conveying the Call, the Requester sets the RPC 1858 Call's rdma_inv_handle field to the value zero. 1860 If the Responder chooses not to use remote invalidation for this 1861 particular RPC Reply, or the RPC Call's rdma_inv_handle field 1862 contains the value zero, the Responder simply uses RDMA Send to 1863 transmit the matching RPC reply. However, if the Responder chooses 1864 to use Remote Invalidation, it uses RDMA Send With Invalidate to 1865 transmit the RPC Reply. It MUST use the value in the corresponding 1866 Call's rdma_inv_handle field to construct the Send With Invalidate 1867 Work Request. 1869 A Responder never uses a Send With Invalidate Work Request when 1870 sending a control plane header type. This includes the RDMA2_ERROR 1871 header type, the RDMA2_GRANT header type, the RDMA2_CONNPROP_MIDDLE 1872 header type, and the RDMA2_CONNPROP_FINAL header type. 1874 6.6. Payload Formats 1876 RPC-over-RDMA version 2 provides several ways, known as "payload 1877 formats", to convey an RPC-over-RDMA message. A sender chooses the 1878 payload format for each message based on several factors: 1880 * The existence of DDP-eligible data items in the RPC message 1881 payload 1883 * The size of the RPC message payload 1885 * The direction of the RPC message (i.e., Call or Reply) 1887 * The available hardware resources 1889 * The arrangement of source and sink memory buffers 1891 The following subsections describe in detail how Requesters and 1892 Responders format RPC-over-RDMA message payloads. 1894 6.6.1. Simple Format 1896 All RPC messages conveyed via RPC-over-RDMA version 2 need at least 1897 one RDMA Send operation to convey. Thus, the most efficient way to 1898 send an RPC message that is smaller than the inline threshold is to 1899 append the Payload stream directly to the Transport stream and use an 1900 RDMA Send to convey both. When no chunks are present, senders 1901 construct Calls and Replies the same way, and no other operations are 1902 needed. 1904 6.6.1.1. Simple Format with Data Item Chunks 1906 If DDP-eligible data items are present in a Payload stream, a sender 1907 MAY reduce some or all of these items, removing them from the Payload 1908 stream. The sender then uses a separate mechanism to transfer the 1909 reduced data items. The Transport stream immediately followed by the 1910 reduced Payload stream is then transferred using one RDMA Send 1911 operation. 1913 When data item chunks are present, senders construct Calls 1914 differently than Replies. 1916 Simple Call 1917 After receiving the Transport and Payload streams of an RPC Call 1918 message with Read chunks, the Responder uses RDMA Read operations 1919 to move the reduced data items contained in the Read chunks. RPC- 1920 over-RDMA Calls can carry Write chunks for the Responder to use 1921 when sending the matching Reply. 1923 Simple Reply 1924 The Responder uses RDMA Write operations to move reduced data 1925 items contained in Write chunks. Afterward, it sends the 1926 Transport and Payload streams of the RPC Reply message using one 1927 RDMA Send. RPC-over-RDMA Replies always carry an empty Read chunk 1928 list. 1930 6.6.1.2. Simple Format Examples 1932 Requester Responder 1933 | RDMA Send (RDMA2_CALL_INLINE) | 1934 Call | ----------------------------------> | 1935 | | 1936 | | Processing 1937 | | 1938 | RDMA Send (RDMA2_REPLY_INLINE) | 1939 | <---------------------------------- | Reply 1941 Figure 1: A Simple Call without data item chunks and a Simple 1942 Reply without data item chunks 1944 Requester Responder 1945 | RDMA Send (RDMA2_CALL_INLINE) | 1946 Call | ----------------------------------> | 1947 | RDMA Read | 1948 | <---------------------------------- | 1949 | RDMA Response (arg data) | 1950 | ----------------------------------> | 1951 | | 1952 | | Processing 1953 | | 1954 | RDMA Send (RDMA2_REPLY_INLINE) | 1955 | <---------------------------------- | Reply 1957 Figure 2: A Simple Call with a Read chunk and a Simple Reply 1958 without data item chunks 1960 Requester Responder 1961 | RDMA Send (RDMA2_CALL_INLINE) | 1962 Call | ----------------------------------> | 1963 | | 1964 | | Processing 1965 | | 1966 | RDMA Write (result data) | 1967 | <---------------------------------- | 1968 | RDMA Send (RDMA2_REPLY_INLINE) | 1969 | <---------------------------------- | Reply 1971 Figure 3: A Simple Call without data item chunks and a Simple 1972 Reply with a Write chunk 1974 6.6.2. Continued Format 1976 For various reasons, a sender can choose to split a message payload 1977 over multiple RPC-over-RDMA messages. The Payload stream of each 1978 RPC-over-RDMA message contains a part of the RPC message. The 1979 receiver reconstructs the original RPC message by concatenating the 1980 Payload stream of each RPC-over-RDMA message in received order. A 1981 sender MAY split the Payload stream on any convenient boundary. 1983 6.6.2.1. Continued Format with Data Item Chunks 1985 If DDP-eligible data items are present in the Payload stream, a 1986 sender MAY reduce some or all of these items, removing them from the 1987 Payload stream. The sender then uses a separate mechanism to 1988 transfer the reduced data items. The Transport stream immediately 1989 follwed by the reduced Payload stream is then transferred using one 1990 RDMA Send operation. 1992 As with Simple Format messages, when chunks are present, senders 1993 construct Calls differently than Replies. 1995 Continued Call 1996 After receiving the Transport and Payload streams of an RPC Call 1997 message with Read chunks, the Responder uses RDMA Read operations 1998 to move the reduced data items contained in Read chunks. RPC- 1999 over-RDMA Calls can carry Write chunks for the Responder to use 2000 when sending the matching Reply. 2002 Continued Reply 2003 The Responder uses RDMA Write operations to move reduced data 2004 items contained in Write chunks. Afterward, it sends the 2005 Transport and Payload streams of the RPC Reply message using 2006 multiple RDMA Sends. RPC-over-RDMA Replies always carry an empty 2007 Read chunk list. 2009 6.6.2.2. Continued Format Examples 2010 Requester Responder 2011 | RDMA Send (RDMA2_CALL_MIDDLE) | 2012 Call | ----------------------------------> | 2013 | RDMA Send (RDMA2_CALL_MIDDLE) | 2014 | ----------------------------------> | 2015 | RDMA Send (RDMA2_CALL_INLINE) | 2016 | ----------------------------------> | 2017 | | 2018 | | Processing 2019 | | 2020 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2021 | <---------------------------------- | Reply 2022 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2023 | <---------------------------------- | 2024 | RDMA Send (RDMA2_REPLY_INLINE) | 2025 | <---------------------------------- | 2027 Figure 4: A Continued Call without data item chunks and a 2028 Continued Reply without data item chunks 2030 Requester Responder 2031 | RDMA Send (RDMA2_CALL_MIDDLE) | 2032 Call | ----------------------------------> | 2033 | RDMA Send (RDMA2_CALL_MIDDLE) | 2034 | ----------------------------------> | 2035 | RDMA Send (RDMA2_CALL_INLINE) | 2036 | ----------------------------------> | 2037 | RDMA Read | 2038 | <---------------------------------- | 2039 | RDMA Response (arg data) | 2040 | ----------------------------------> | 2041 | | 2042 | | Processing 2043 | | 2044 | RDMA Send (RDMA2_REPLY_INLINE) | 2045 | <---------------------------------- | Reply 2047 Figure 5: A Continued Call with a Read chunk and a Simple Reply 2048 without data item chunks 2050 Requester Responder 2051 | RDMA Send (RDMA2_CALL_INLINE) | 2052 Call | ----------------------------------> | 2053 | | 2054 | | Processing 2055 | | 2056 | RDMA Write (result data) | 2057 | <---------------------------------- | 2058 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2059 | <---------------------------------- | Reply 2060 | RDMA Send (RDMA2_REPLY_MIDDLE) | 2061 | <---------------------------------- | 2062 | RDMA Send (RDMA2_REPLY_INLINE) | 2063 | <---------------------------------- | 2065 Figure 6: A Simple Call without data item chunks and a Continued 2066 Reply with a Write chunk 2068 6.6.3. Special Format 2070 Even after DDP-eligible data items have been removed, a Payload 2071 stream can sometimes be too large to send using only RDMA Send 2072 operations. In those cases, the sender can use RDMA Read or Write 2073 operations to convey the entire RPC message. We refer to this as a 2074 "Special Format" message. 2076 To transmit a Special Format message, the sender transmits only the 2077 Transport stream with an RDMA Send operation. The sender does not 2078 include the Payload stream in the send buffer. Instead, the 2079 Requester provides a body chunk that the Responder uses to move the 2080 Payload stream. 2082 Because chunks are always present in Special Format messages, the 2083 sender always handles Calls and Replies differently. 2085 Special Call 2086 The Requester provides a Read chunk that contains the RPC Call 2087 message's Payload stream. Every Read segment in this chunk MUST 2088 contain zero (0) in its Position field. This type of Read chunk 2089 is a body chunk known as a Call chunk. 2091 Special Reply 2092 The Requester provisions a Reply chunk in advance. This body 2093 chunk is a Write chunk into which the Responder places the RPC 2094 Reply message's Payload stream. The Requester provisions the 2095 Reply chunk to accommodate the maximum expected reply size for 2096 that upper-layer operation. 2098 One purpose of a Special Format message is to handle large RPC 2099 messages. However, Requesters MAY use a Special Format message at 2100 any time to convey an RPC Call message. 2102 When it has alternatives, a Responder chooses which Format to use 2103 based on the chunks provided by the Requester. If a Requester 2104 provided a Write chunk and the Responder has a DDP-eligible result, 2105 it first reduces the reply Payload stream. If a Requester provided a 2106 Reply chunk and the reduced Payload stream is larger than the reply 2107 inline threshold, the Responder MUST use the Requester-provided Reply 2108 chunk for the reply. 2110 6.6.3.1. Special Format Examples 2112 Requester Responder 2113 | RDMA Send (RDMA2_CALL_EXTERNAL) | 2114 Call | ----------------------------------> | 2115 | RDMA Read | 2116 | <---------------------------------- | 2117 | RDMA Response (RPC call) | 2118 | ----------------------------------> | 2119 | | 2120 | | Processing 2121 | | 2122 | RDMA Send (RDMA2_REPLY_INLINE) | 2123 | <---------------------------------- | Reply 2125 Figure 7: A Special Call and a Simple Reply without data item chunks 2127 Requester Responder 2128 | RDMA Send (RDMA2_CALL_INLINE) | 2129 Call | ----------------------------------> | 2130 | | 2131 | | Processing 2132 | | 2133 | RDMA Write (RPC reply) | 2134 | <---------------------------------- | 2135 | RDMA Send (RDMA2_REPLY_EXTERNAL) | 2136 | <---------------------------------- | Reply 2138 Figure 8: A Simple Call without data item chunks and a Special Reply 2140 6.6.4. Choosing a Reply Payload Format 2142 A Requester provisions all necessary registered memory resources for 2143 both an RPC Call and its matching RPC Reply. A Requester constructs 2144 each RPC Call, thus it can compute the exact memory resources needed 2145 to send every Call. However, the Requester allocates memory 2146 resources to receive the corresponding Reply before the Responder has 2147 constructed it. Occasionally, it is challenging for the Requester to 2148 know in advance precisely what resources are needed to receive the 2149 Reply. 2151 In RPC-over-RDMA version 2, a Requester can provide a Reply chunk for 2152 any transaction. The Responder can use the provided Reply chunk or 2153 it can decide to use another means to convey the RPC Reply. If the 2154 combination of the provided Write chunk list and Reply chunk is not 2155 adequate to convey a Reply, the Responder SHOULD use Message 2156 Continuation to send that Reply. If even that is not possible, the 2157 Responder sends an RDMA2_ERROR message to the Requester, as described 2158 in Section 6.3.1: 2160 * If the Write chunk list cannot accommodate the ULP's DDP-eligible 2161 data payload, the Responder sends an RDMA2_ERR_WRITE_RESOURCE 2162 error. 2164 * If the Reply chunk cannot accommodate the parts of the Reply that 2165 are not DDP-eligible, the Responder sends an 2166 RDMA2_ERR_REPLY_RESOURCE error. 2168 When receiving such errors, the Requester can retry the ULP call 2169 using more substantial reply resources. In cases where retrying the 2170 ULP request is not possible (e.g., the request is non-idempotent), 2171 the Requester terminates the RPC transaction and presents an error to 2172 the RPC consumer. 2174 7. Error Handling 2176 A receiver performs validity checks on each ingress RPC-over-RDMA 2177 message before it assembles that message's Payload stream and passes 2178 it to the RPC layer. For example, if an ingress RPC-over-RDMA 2179 message is not as long as the size of struct rpcrdma2_hdr_prefix (20 2180 octets), the receiver cannot trust the value of the rdma_xid field. 2181 In this case, the receiver MUST silently discard the ingress message 2182 without processing it further, and without a response to the sender. 2184 When a request (for instance, an RPC Call or a control plane 2185 operation) is made, typically an RPC consumer blocks while waiting 2186 for the response. Thus when an incoming message conveys a request 2187 and that request cannot be acted upon, the receiver of that request 2188 needs to report the problem to its sender in order to unblock 2189 waiters. Likewise, if, after processing a request, a sender is 2190 unable to transmit the response on an otherwise healthy connection, 2191 the sender needs to report that problem for the same reason. 2193 The RDMA2_ERROR header type is used for this purpose. To form an 2194 RDMA2_ERROR type header: 2196 * The rdma_xid field MUST contain the same XID that was in the 2197 rdma_xid field in the ingress request. 2199 * The rdma_vers field MUST contain the same version that was in the 2200 rdma_vers field in the ingress request. 2202 * The sender sets the rdma_credit field to the credit values in 2203 effect for this connection. 2205 * The rdma_htype field MUST contain the value RDMA2_ERROR. 2207 * The rdma_err field contains a value that reflects the type of 2208 error that occurred, as described in the subsections below. 2210 When a peer receives an RDMA2_ERROR message type with an unrecognized 2211 or unsupported value in its rdma_err field, it MUST silently discard 2212 the message without processing it further. 2214 7.1. Basic Transport Stream Parsing Errors 2216 7.1.1. RDMA2_ERR_VERS 2218 When a Responder detects an RPC-over-RDMA header version that it does 2219 not support (the current document defines version 2), it MUST respond 2220 with an RDMA2_ERROR message type and set its rdma_err field to 2221 RDMA2_ERR_VERS. The Responder then fills in the rpcrdma2_err_vers 2222 structure with the RPC-over-RDMA versions it supports. The Responder 2223 MUST silently discard the ingress message without passing it to the 2224 RPC layer 2226 When a Requester receives this error, it uses the information in the 2227 rpcrdma2_err_vers structure to select an RPC-over-RDMA version that 2228 both peers support for subsequent operations on the connection. A 2229 Requester MUST NOT subsequently send a message that uses a version 2230 that the Responder has indciated it does not support. RDMA2_ERR_VERS 2231 indicates a permanent error. Receipt of this error completes the RPC 2232 transaction associated with XID in the rdma_xid field. 2234 7.1.2. RDMA2_ERR_INVAL_HTYPE 2236 If a Responder recognizes the value in an ingress rdma_vers field, 2237 but it does not recognize the value in the rdma_htype field or does 2238 not support that header type, it MUST set the rdma_err field to 2239 RDMA2_ERR_INVAL_HTYPE. The Responder MUST silently discard the 2240 incoming message without passing it to the RPC layer. 2242 A Requester MUST NOT subsequently send a message on the connection 2243 that uses an htype that the Responder has indicated it does not 2244 support. RDMA2_ERR_INVAL_HTYPE indicates a permanent error. Receipt 2245 of this error completes the RPC transaction associated with XID in 2246 the rdma_xid field. 2248 7.1.3. RDMA2_ERR_INVAL_CONT 2250 If a Responder detects a problem with an ingress RPC-over-RDMA 2251 message that is part of a Message Continuation sequence, the 2252 Responder MUST set the rdma_err field to RDMA2_ERR_INVAL_CONT. The 2253 Responder MUST silently discard all ingress messages with an rdma_xid 2254 field that matches the failing message without reassembling the 2255 payload. 2257 RDMA2_ERR_INVAL_CONT indicates a permanent error. Receipt of this 2258 error completes the RPC transaction associated with XID in the 2259 rdma_xid field. 2261 7.2. XDR Errors 2263 A receiver might encounter an XDR parsing error that prevents it from 2264 processing an ingress Transport stream. Examples of such errors 2265 include: 2267 * The value of the rdma_xid field does not match the value of the 2268 XID field in the accompanying RPC message. 2270 * The receive buffer ends before the end of a data object contained 2271 in the Transport stream. 2273 Moreover, when a Responder receives a valid RPC-over-RDMA header but 2274 the Responder's ULP implementation cannot parse the RPC arguments in 2275 the RPC Call, the Responder returns an RPC Reply with status 2276 GARBAGE_ARGS, using an RDMA2_REPLY_INLINE message type. This type of 2277 parsing failure might be due to mismatches between chunk sizes or 2278 offsets and the contents of the Payload stream, for example. In this 2279 case, the error is permanent, but the Requester has no way to know 2280 how much processing the Responder has completed for this RPC 2281 transaction. 2283 7.2.1. RDMA2_ERR_BAD_XDR 2285 If a Responder recognizes the values in the rdma_vers field, but it 2286 cannot otherwise parse the ingress Transport stream, it MUST set the 2287 rdma_err field to RDMA2_ERR_BAD_XDR. The Responder MUST silently 2288 discard the ingress message without passing it to the RPC layer. 2290 RDMA2_ERR_BAD_XDR indicates a permanent error. Receipt of this error 2291 completes the RPC transaction associated with XID in the rdma_xid 2292 field. 2294 7.2.2. RDMA2_ERR_BAD_PROPVAL 2296 If a receiver recognizes the value in an ingress rdma_which field, 2297 but it cannot parse the accompanying propval, it MUST set the 2298 rdma_err field to RDMA2_ERR_BAD_PROPVAL (see Section 5.1). The 2299 receiver MUST silently discard the ingress message without applying 2300 any of its property settings. 2302 7.3. Responder RDMA Operational Errors 2304 In RPC-over-RDMA version 2, the Responder initiates RDMA Read and 2305 Write operations that target the Requester's memory. Problems might 2306 arise as the Responder attempts to use Requester-provided resources 2307 for RDMA operations. For example: 2309 * Usually, chunks can be validated only by using their contents to 2310 perform data transfers. If chunk contents are invalid (e.g., a 2311 memory region is no longer registered or a chunk length exceeds 2312 the end of the registered memory region), a Remote Access Error 2313 occurs. 2315 * If a Requester's Receive buffer is too small, the Responder's Send 2316 operation completes with a Local Length Error. 2318 * If the Requester-provided Reply chunk is too small to accommodate 2319 a large RPC Reply message, a Remote Access Error occurs. A 2320 Responder might detect this problem before attempting to write 2321 past the end of the Reply chunk. 2323 RDMA operational errors can be fatal to the connection. To avoid a 2324 retransmission loop and repeated connection loss that deadlocks the 2325 connection, once the Requester has re-established a connection, the 2326 Responder SHOULD send an RDMA2_ERROR response to indicate that no 2327 RPC-level reply is possible for that transaction. 2329 7.3.1. RDMA2_ERR_READ_CHUNKS 2331 If a Requester presents more DDP-eligible arguments than a Responder 2332 is prepared to Read, the Responder MUST set the rdma_err field to 2333 RDMA2_ERR_READ_CHUNKS and set the rdma_max_chunks field to the 2334 maximum number of Read chunks the Responder can process. If the 2335 Responder implementation cannot handle any Read chunks for a request, 2336 it MUST set the rdma_max_chunks to zero in this response. The 2337 Responder MUST silently discard the ingress message without 2338 processing it further. 2340 The Requester can reconstruct the Call using Message Continuation or 2341 a Special Format payload and resend it. If the Requester chooses not 2342 to resend the Call, it MUST terminate this RPC transaction with an 2343 error. 2345 7.3.2. RDMA2_ERR_WRITE_CHUNKS 2347 If a Requester has constructed an RPC Call with more DDP-eligible 2348 results than the Responder is prepared to Write, the Responder MUST 2349 set the rdma_err field to RDMA2_ERR_WRITE_CHUNKS and set the 2350 rdma_max_chunks field to the maximum number of Write chunks the 2351 Responder can return. The Requester can reconstruct the Call with no 2352 Write chunks and a Reply chunk of appropriate size. If the Requester 2353 does not resend the Call, it MUST terminate this RPC transaction with 2354 an error. 2356 If the Responder implementation cannot handle any Write chunks for a 2357 request and cannot send the Reply using Message Continuation, it MUST 2358 return a response of RDMA2_ERR_REPLY_RESOURCE instead (see below). 2360 7.3.3. RDMA2_ERR_SEGMENTS 2362 If a Requester has constructed an RPC Call with a chunk that contains 2363 more segments than the Responder supports, the Responder MUST set the 2364 rdma_err field to RDMA2_ERR_SEGMENTS and set the rdma_max_segments 2365 field to the maximum number of segments the Responder can process. 2366 The Requester can reconstruct the Call and resend it. If the 2367 Requester does not resend the Call, it MUST terminate this RPC 2368 transaction with an error. 2370 7.3.4. RDMA2_ERR_WRITE_RESOURCE 2372 If a Requester has provided a Write chunk that is not large enough to 2373 contain a DDP-eligible result, the Responder MUST set the rdma_err 2374 field to RDMA2_ERR_WRITE_RESOURCE. The Responder MUST set the 2375 rdma_chunk_index field to point to the first Write chunk in the 2376 transport header that is too short, or to zero to indicate that it 2377 was not possible to determine which chunk is too small. Indexing 2378 starts at one (1), which represents the first Write chunk. The 2379 Responder MUST set the rdma_length_needed to the number of bytes 2380 needed in that chunk to convey the result data item. 2382 The Requester can reconstruct the Call with more reply resources and 2383 resend it. If the Requester does not resend the Call (for instance, 2384 if the Responder set the index and length fields to zero), it MUST 2385 terminate this RPC transaction with an error. 2387 7.3.5. RDMA2_ERR_REPLY_RESOURCE 2389 If a Responder cannot send an RPC Reply using Message Continuation 2390 and the Reply does not fit in the Reply chunk, the Responder MUST set 2391 the rdma_err field to RDMA2_ERR_REPLY_RESOURCE. The Responder MUST 2392 set the rdma_length_needed to the number of Reply chunk bytes needed 2393 to convey the reply. The Requester can reconstruct the Call with 2394 more reply resources and resend it. If the Requester does not resend 2395 the Call (for instance, if the Responder set the length field to 2396 zero), it MUST terminate this RPC transaction with an error. 2398 7.4. Other Operational Errors 2400 While a Requester is constructing an RPC Call message, an 2401 unrecoverable problem might occur that prevents the Requester from 2402 posting further RDMA Work Requests on behalf of that message. As 2403 with other transports, if a Requester is unable to construct and 2404 transmit an RPC Call, the associated RPC transaction fails 2405 immediately. 2407 After a Requester has received a Reply, if it is unable to invalidate 2408 a memory region due to an unrecoverable problem, the Requester MUST 2409 close the connection to protect that memory from Responder access 2410 before the associated RPC transaction is complete. 2412 While a Responder is constructing an RPC Reply message or error 2413 message, an unrecoverable problem might occur that prevents the 2414 Responder from posting further RDMA Work Requests on behalf of that 2415 message. If a Responder is unable to construct and transmit an RPC 2416 Reply or RPC-over-RDMA error message, the Responder MUST close the 2417 connection to signal to the Requester that a reply was lost. 2419 7.4.1. RDMA2_ERR_SYSTEM 2421 If some problem occurs on a Responder that does not fit into the 2422 above categories, the Responder MAY report it to the Requester by 2423 setting the rdma_err field to RDMA2_ERR_SYSTEM. The Responder MUST 2424 silently discard the message(s) associated with the failing 2425 transaction without further processing. 2427 RDMA2_ERR_SYSTEM is a permanent error. This error does not indicate 2428 how much of the transaction the Responder has processed, nor does it 2429 indicate a particular recovery action for the Requester. A Requester 2430 that receives this error MUST terminate the RPC transaction 2431 associated with the XID value in the RDMA2_ERROR message's rdma_xid 2432 field. 2434 7.5. RDMA Transport Errors 2436 The RDMA connection and physical link provide some degree of error 2437 detection and retransmission. The Marker PDU Aligned Framing (MPA) 2438 protocol (as described in Section 7.1 of [RFC5044]) as well as the 2439 InfiniBand link layer [IBA] provide Cyclic Redundancy Check (CRC) 2440 protection of RDMA payloads. CRC-class protection is a general 2441 attribute of such transports. 2443 Additionally, the RPC layer itself can accept errors from the 2444 transport and recover via retransmission. RPC recovery can typically 2445 handle complete loss and re-establishment of a transport connection. 2447 The details of reporting and recovery from RDMA link-layer errors are 2448 described in specific link-layer APIs and operational specifications 2449 and are outside the scope of this protocol specification. See 2450 Section 11 for further discussion of RPC-level integrity schemes. 2452 8. XDR Protocol Definition 2454 This section contains a description of the core features of the RPC- 2455 over-RDMA version 2 protocol expressed in the XDR language [RFC4506]. 2456 It organizes the description to make it simple to extract into a form 2457 that is ready to compile or combine with similar descriptions 2458 published later as extensions to RPC-over-RDMA version 2. 2460 8.1. Code Component License 2462 Code Components extracted from the current document must include the 2463 following license text. When combining the extracted XDR code with 2464 other XDR code which has an identical license, only a single copy of 2465 the license text needs to be retained. 2467 2468 /// /* 2469 /// * Copyright (c) 2010, 2020 IETF Trust and the persons 2470 /// * identified as authors of the code. All rights reserved. 2471 /// * 2472 /// * The authors of the code are: 2473 /// * B. Callaghan, T. Talpey, C. Lever, and D. Noveck. 2474 /// * 2475 /// * Redistribution and use in source and binary forms, with 2476 /// * or without modification, are permitted provided that the 2477 /// * following conditions are met: 2478 /// * 2479 /// * - Redistributions of source code must retain the above 2480 /// * copyright notice, this list of conditions and the 2481 /// * following disclaimer. 2482 /// * 2483 /// * - Redistributions in binary form must reproduce the above 2484 /// * copyright notice, this list of conditions and the 2485 /// * following disclaimer in the documentation and/or other 2486 /// * materials provided with the distribution. 2487 /// * 2488 /// * - Neither the name of Internet Society, IETF or IETF 2489 /// * Trust, nor the names of specific contributors, may be 2490 /// * used to endorse or promote products derived from this 2491 /// * software without specific prior written permission. 2492 /// * 2493 /// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 2494 /// * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 2495 /// * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2496 /// * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2497 /// * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 2498 /// * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2499 /// * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2500 /// * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2501 /// * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2502 /// * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2503 /// * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2504 /// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2505 /// * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 2506 /// * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2507 /// * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2508 /// */ 2509 /// 2510 2512 8.2. Extraction of the XDR Definition 2514 Implementers can apply the following sed script to the current 2515 document to produce a machine-readable XDR description of the base 2516 RPC-over-RDMA version 2 protocol. 2518 2519 sed -n -e 's:^ */// ::p' -e 's:^ *///$::p' 2520 2522 That is, if this document is in a file called "spec.txt", then 2523 implementers can do the following to extract an XDR description file 2524 and store it in the file rpcrdma-v2.x. 2526 2527 sed -n -e 's:^ */// ::p' -e 's:^ *///$::p' \ 2528 < spec.txt > rpcrdma-v2.x 2529 2531 Although this file is a usable description of the base protocol, when 2532 extensions are to be supported, it may be desirable to divide the 2533 description into multiple files. The following script achieves that 2534 purpose: 2536 2537 #!/usr/local/bin/perl 2538 open(IN,"rpcrdma-v2.x"); 2539 open(OUT,">temp.x"); 2540 while() 2541 { 2542 if (m/FILE ENDS: (.*)$/) 2543 { 2544 close(OUT); 2545 rename("temp.x", $1); 2546 open(OUT,">temp.x"); 2547 } 2548 else 2549 { 2550 print OUT $_; 2551 } 2552 } 2553 close(IN); 2554 close(OUT); 2555 2557 Running the above script results in two files: 2559 * The file common.x, containing the license plus the shared XDR 2560 definitions that need to be made available to both the base 2561 protocol and any subsequent extensions. 2563 * The file baseops.x containing the XDR definitions for the base 2564 protocol defined in this document. 2566 Extensions to RPC-over-RDMA version 2, published as Standards Track 2567 documents, should have similarly structured XDR definitions. Once an 2568 implementer has extracted the XDR for all desired extensions and the 2569 base XDR definition contained in the current document, she can 2570 concatenate them to produce a consolidated XDR definition that 2571 reflects the set of extensions selected for her RPC-over-RDMA version 2572 2 implementation. 2574 Alternatively, the XDR descriptions can be compiled separately. In 2575 that case, the combination of common.x and baseops.x defines the base 2576 transport. The combination of common.x and the XDR description of 2577 each extension produces a full XDR definition of that extension. 2579 8.3. XDR Definition for RPC-over-RDMA Version 2 Core Structures 2581 2582 /// /*************************************************************** 2583 /// * Transport Header Prefixes 2584 /// ***************************************************************/ 2585 /// 2586 /// struct rpcrdma_common { 2587 /// uint32 rdma_xid; 2588 /// uint32 rdma_vers; 2589 /// uint32 rdma_credit; 2590 /// uint32 rdma_htype; 2591 /// }; 2592 /// 2593 /// struct rpcrdma2_hdr_prefix { 2594 /// struct rpcrdma_common rdma_start; 2595 /// }; 2596 /// 2597 /// /*************************************************************** 2598 /// * Chunks and Chunk Lists 2599 /// ***************************************************************/ 2600 /// 2601 /// struct rpcrdma2_segment { 2602 /// uint32 rdma_handle; 2603 /// uint32 rdma_length; 2604 /// uint64 rdma_offset; 2605 /// }; 2606 /// 2607 /// struct rpcrdma2_read_segment { 2608 /// uint32 rdma_position; 2609 /// struct rpcrdma2_segment rdma_target; 2610 /// }; 2611 /// 2612 /// struct rpcrdma2_read_list { 2613 /// struct rpcrdma2_read_segment rdma_entry; 2614 /// struct rpcrdma2_read_list *rdma_next; 2615 /// }; 2616 /// 2617 /// struct rpcrdma2_write_chunk { 2618 /// struct rpcrdma2_segment rdma_target<>; 2619 /// }; 2620 /// 2621 /// struct rpcrdma2_write_list { 2622 /// struct rpcrdma2_write_chunk rdma_entry; 2623 /// struct rpcrdma2_write_list *rdma_next; 2624 /// }; 2625 /// 2626 /// /*************************************************************** 2627 /// * Transport Properties 2628 /// ***************************************************************/ 2629 /// 2630 /// /* 2631 /// * Types for transport properties model 2632 /// */ 2633 /// typedef rpcrdma2_propid uint32; 2634 /// 2635 /// struct rpcrdma2_propval { 2636 /// rpcrdma2_propid rdma_which; 2637 /// opaque rdma_data<>; 2638 /// }; 2639 /// 2640 /// typedef rpcrdma2_propval rpcrdma2_propset<>; 2641 /// typedef uint32 rpcrdma2_propsubset<>; 2642 /// 2643 /// /* 2644 /// * Transport propid values for basic properties 2645 /// */ 2646 /// const RDMA2_PROPID_SBSIZ = 1; 2647 /// const RDMA2_PROPID_RBSIZ = 2; 2648 /// const RDMA2_PROPID_RSSIZ = 3; 2649 /// const RDMA2_PROPID_RCSIZ = 4; 2650 /// const RDMA2_PROPID_BRS = 5; 2651 /// const RDMA2_PROPID_HOSTAUTH = 6; 2652 /// 2653 /// /* 2654 /// * Types specific to particular properties 2655 /// */ 2656 /// typedef uint32 rpcrdma2_prop_sbsiz; 2657 /// typedef uint32 rpcrdma2_prop_rbsiz; 2658 /// typedef uint32 rpcrdma2_prop_rssiz; 2659 /// typedef uint32 rpcrdma2_prop_rcsiz; 2660 /// typedef uint32 rpcrdma2_prop_brs; 2661 /// typedef opaque rpcrdma2_prop_hostauth<>; 2662 /// 2663 /// const RDMA2_RVRSDIR_NONE = 0; 2664 /// const RDMA2_RVRSDIR_SIMPLE = 1; 2665 /// const RDMA2_RVRSDIR_CONT = 1; 2666 /// const RDMA2_RVRSDIR_GENL = 3; 2667 /// 2668 /// /* FILE ENDS: common.x; */ 2669 2671 8.4. XDR Definition for RPC-over-RDMA Version 2 Base Header Types 2673 2674 /// /*************************************************************** 2675 /// * Descriptions of RPC-over-RDMA Header Types 2676 /// ***************************************************************/ 2677 /// 2678 /// /* 2679 /// * Header Type Codes: Control plane operations. 2680 /// */ 2681 /// const RDMA2_ERROR = 4; 2682 /// const RDMA2_GRANT = 5; 2683 /// const RDMA2_CONNPROP_MIDDLE = 6; 2684 /// const RDMA2_CONNPROP_FINAL = 7; 2685 /// 2686 /// /* 2687 /// * Header Type Codes: Call messages. 2688 /// */ 2689 /// const RDMA2_CALL_EXTERNAL = 8; 2690 /// const RDMA2_CALL_MIDDLE = 9; 2691 /// const RDMA2_CALL_INLINE = 10; 2692 /// 2693 /// /* 2694 /// * Header Type Codes: Reply messages. 2695 /// */ 2696 /// const RDMA2_REPLY_EXTERNAL = 11; 2697 /// const RDMA2_REPLY_MIDDLE = 12; 2698 /// const RDMA2_REPLY_INLINE = 13; 2699 /// 2700 /// /* 2701 /// * Header Type to Report Errors. 2702 /// */ 2703 /// const RDMA2_ERR_VERS = 1; 2704 /// const RDMA2_ERR_BAD_XDR = 2; 2705 /// const RDMA2_ERR_BAD_PROPVAL = 3; 2706 /// const RDMA2_ERR_INVAL_HTYPE = 4; 2707 /// const RDMA2_ERR_INVAL_CONT = 5; 2708 /// const RDMA2_ERR_READ_CHUNKS = 6; 2709 /// const RDMA2_ERR_WRITE_CHUNKS = 7; 2710 /// const RDMA2_ERR_SEGMENTS = 8; 2711 /// const RDMA2_ERR_WRITE_RESOURCE = 9; 2712 /// const RDMA2_ERR_REPLY_RESOURCE = 10; 2713 /// const RDMA2_ERR_SYSTEM = 100; 2714 /// 2715 /// struct rpcrdma2_err_vers { 2716 /// uint32 rdma_vers_low; 2717 /// uint32 rdma_vers_high; 2718 /// }; 2719 /// 2720 /// struct rpcrdma2_err_write { 2721 /// uint32 rdma_chunk_index; 2722 /// uint32 rdma_length_needed; 2723 /// }; 2724 /// 2725 /// union rpcrdma2_hdr_error switch (rpcrdma2_errcode rdma_err) { 2726 /// case RDMA2_ERR_VERS: 2727 /// rpcrdma2_err_vers rdma_vrange; 2728 /// case RDMA2_ERR_READ_CHUNKS: 2729 /// uint32 rdma_max_chunks; 2730 /// case RDMA2_ERR_WRITE_CHUNKS: 2731 /// uint32 rdma_max_chunks; 2732 /// case RDMA2_ERR_SEGMENTS: 2733 /// uint32 rdma_max_segments; 2734 /// case RDMA2_ERR_WRITE_RESOURCE: 2735 /// rpcrdma2_err_write rdma_writeres; 2736 /// case RDMA2_ERR_REPLY_RESOURCE: 2737 /// uint32 rdma_length_needed; 2738 /// default: 2739 /// void; 2740 /// }; 2741 /// 2742 /// /* 2743 /// * Header Type to Exchange Transport Properties. 2744 /// */ 2745 /// struct rpcrdma2_hdr_connprop { 2746 /// rpcrdma2_propset rdma_props; 2747 /// }; 2748 /// 2749 /// /* 2750 /// * Header Types to Convey RPC Messages. 2752 /// */ 2753 /// struct rpcrdma2_hdr_call_external { 2754 /// uint32 rdma_inv_handle; 2755 /// 2756 /// struct rpcrdma2_read_list *rdma_call; 2757 /// struct rpcrdma2_read_list *rdma_reads; 2758 /// struct rpcrdma2_write_list *rdma_provisional_writes; 2759 /// struct rpcrdma2_write_chunk *rdma_provisional_reply; 2760 /// }; 2761 /// 2762 /// struct rpcrdma2_hdr_call_middle { 2763 /// uint32 rdma_remaining; 2764 /// 2765 /// /* The rpc message starts here and continues 2766 /// * through the end of the transmission. */ 2767 /// uint32 rdma_rpc_first_word; 2768 /// }; 2769 /// 2770 /// struct rpcrdma2_hdr_call_inline { 2771 /// uint32 rdma_inv_handle; 2772 /// 2773 /// struct rpcrdma2_read_list *rdma_reads; 2774 /// struct rpcrdma2_write_list *rdma_provisional_writes; 2775 /// struct rpcrdma2_write_chunk *rdma_provisional_reply; 2776 /// 2777 /// /* The rpc message starts here and continues 2778 /// * through the end of the transmission. */ 2779 /// uint32 rdma_rpc_first_word; 2780 /// }; 2781 /// 2782 /// struct rpcrdma2_hdr_reply_external { 2783 /// struct rpcrdma2_write_list *rdma_writes; 2784 /// struct rpcrdma2_write_chunk *rdma_reply; 2785 /// }; 2786 /// 2787 /// struct rpcrdma2_hdr_reply_middle { 2788 /// uint32 rdma_remaining; 2789 /// 2790 /// /* The rpc message starts here and continues 2791 /// * through the end of the transmission. */ 2792 /// uint32 rdma_rpc_first_word; 2793 /// }; 2794 /// 2795 /// struct rpcrdma2_hdr_reply_inline { 2796 /// struct rpcrdma2_write_list *rdma_writes; 2797 /// 2798 /// /* The rpc message starts here and continues 2799 /// * through the end of the transmission. */ 2800 /// uint32 rdma_rpc_first_word; 2801 /// }; 2802 /// 2803 /// /* FILE ENDS: baseops.x; */ 2804 2806 8.5. Use of the XDR Description 2808 The files common.x and baseops.x, when combined with the XDR 2809 descriptions for extension defined later, produce a human-readable 2810 and compilable description of the RPC-over-RDMA version 2 protocol 2811 with the included extensions. 2813 Although this XDR description can generate encoders and decoders for 2814 the Transport and Payload streams, there are elements of the 2815 operation of RPC-over-RDMA version 2 that cannot be expressed within 2816 the XDR language. Implementations that use the output of an 2817 automated XDR processor need to provide additional code to bridge 2818 these gaps. 2820 * The Transport stream is not a single XDR object. Instead, the 2821 header prefix is one XDR data item, and the rest of the header is 2822 a separate XDR data item. Table 2 expresses the mapping between 2823 the header type in the header prefix and the XDR object 2824 representing the header type. 2826 * The relationship between the Transport stream and the Payload 2827 stream is not specified using XDR. Comments within the XDR text 2828 make clear where transported messages, described by their own XDR 2829 definitions, need to appear. Such data is opaque to the 2830 transport. 2832 * Continuation of RPC messages across transport message boundaries 2833 requires that message assembly facilities not specifiable within 2834 XDR are part of transport implementations. 2836 * Transport properties are constant integer values. Table 1 2837 expresses the mapping between each property's code point and the 2838 XDR typedef that represents the structure of the property's value. 2839 XDR does not possess the facility to express that mapping in an 2840 extensible way. 2842 The role of XDR in RPC-over-RDMA specifications is more limited than 2843 for protocols where the totality of the protocol is expressible 2844 within XDR. XDR lacks the facility to represent the embedding of 2845 XDR-encoded payload material. Also, the need to cleanly accommodate 2846 extensions has meant that those using rpcgen in their applications 2847 need to take an active role to provide the facilities that cannot be 2848 expressed within XDR. 2850 9. RPC Bind Parameters 2852 Before establishing a new connection, an RPC client obtains a 2853 transport address for the RPC server. The means used to obtain this 2854 address and to open an RDMA connection is dependent on the type of 2855 RDMA transport and is the responsibility of each RPC protocol binding 2856 and its local implementation. 2858 RPC services typically register with a portmap or rpcbind service 2859 [RFC1833], which associates an RPC Program number with a service 2860 address. This policy is no different with RDMA transports. However, 2861 a distinct service address (port number) is sometimes required for 2862 operation on RPC-over-RDMA. 2864 When mapped atop MPA [RFC5044], which uses IP port addressing due to 2865 its layering on TCP or SCTP, port mapping is trivial and consists 2866 merely of issuing the port in the connection process. The NFS/RDMA 2867 protocol service address has been assigned port 20049 by IANA for 2868 this deployment scenario [RFC8267]. 2870 When mapped atop InfiniBand [IBA], which uses a service endpoint 2871 naming scheme based on a Group Identifier (GID), a translation MUST 2872 be employed. One such translation is described in Annexes A3 2873 (Application Specific Identifiers), A4 (Sockets Direct Protocol 2874 (SDP)), and A11 (RDMA IP CM Service) of [IBA], which is appropriate 2875 for translating IP port addressing to the InfiniBand network. 2876 Therefore, in this case, IP port addressing may be readily employed 2877 by the upper layer. 2879 When a mapping standard or convention exists for IP ports on an RDMA 2880 interconnect, there are several possibilities for each upper layer to 2881 consider: 2883 * One possibility is to have the server register its mapped IP port 2884 with the rpcbind service under the netid (or netids) defined in 2885 [RFC8166]. An RPC-over-RDMA-aware RPC client can then resolve its 2886 desired service to a mappable port and proceed to connect. This 2887 method is the most flexible and compatible approach for those 2888 upper layers that are defined to use the rpcbind service. 2890 * A second possibility is to have the RPC server's portmapper 2891 register itself on the RDMA interconnect at a "well-known" service 2892 address (on UDP or TCP, this corresponds to port 111). An RPC 2893 client can connect to this service address and use the portmap 2894 protocol to obtain a service address in response to a program 2895 number (e.g., a TCP port number or an InfiniBand GID). 2897 * Alternately, an RPC client can connect to the mapped well-known 2898 port for the service itself, if it is appropriately defined. By 2899 convention, the NFS/RDMA service, when operating atop an 2900 InfiniBand fabric, uses the same 20049 assignment as for MPA. 2902 Historically, different RPC protocols have taken different approaches 2903 to their port assignments. The current document leaves the specific 2904 method for each RPC-over-RDMA-enabled ULB. 2906 [RFC8166] defines two new netid values to be used for registration of 2907 upper layers atop MPA and (when a suitable port translation service 2908 is available) InfiniBand. Additional RDMA-capable networks MAY 2909 define their own netids, or if they provide a port translation, they 2910 MAY share the one defined in [RFC8166]. 2912 10. Implementation Status 2914 This section is to be removed before publishing as an RFC. 2916 This section records the status of known implementations of the 2917 protocol defined by this specification at the time of posting of this 2918 Internet-Draft, and is based on a proposal described in [RFC7942]. 2919 The description of implementations in this section is intended to 2920 assist the IETF in its decision processes in progressing drafts to 2921 RFCs. 2923 Please note that the listing of any individual implementation here 2924 does not imply endorsement by the IETF. Furthermore, no effort has 2925 been spent to verify the information presented here that was supplied 2926 by IETF contributors. This is not intended as, and must not be 2927 construed to be, a catalog of available implementations or their 2928 features. Readers are advised to note that other implementations may 2929 exist. 2931 At this time, no known implementations of the protocol described in 2932 the current document exist. 2934 11. Security Considerations 2935 11.1. Memory Protection 2937 A primary consideration is the protection of the integrity and 2938 confidentiality of host memory by an RPC-over-RDMA transport. The 2939 use of an RPC-over-RDMA transport protocol MUST NOT introduce 2940 vulnerabilities to system memory contents nor memory owned by user 2941 processes. Any RDMA provider used for RPC transport MUST conform to 2942 the requirements of [RFC5042] to satisfy these protections. 2944 11.1.1. Protection Domains 2946 The use of a Protection Domain to limit the exposure of memory 2947 regions to a single connection is critical. Any attempt by an 2948 endpoint not participating in that connection to reuse memory handles 2949 needs to result in immediate failure of that connection. Because ULP 2950 security mechanisms rely on this aspect of Reliable Connected 2951 behavior, implementations SHOULD cryptographically authenticate 2952 connection endpoints. 2954 11.1.2. Handle (STag) Predictability 2956 Implementations should use unpredictable memory handles for any 2957 operation requiring exposed memory regions. Exposing a continuously 2958 registered memory region allows a remote host to read or write to 2959 that region even when an RPC involving that memory is not underway. 2960 Therefore, implementations should avoid the use of persistently 2961 registered memory. 2963 11.1.3. Memory Protection 2965 Requesters should register memory regions for remote access only when 2966 they are about to be the target of an RPC transaction that involves 2967 an RDMA Read or Write. 2969 Requesters should invalidate memory regions as soon as related RPC 2970 operations are complete. Invalidation and DMA unmapping of memory 2971 regions should complete before the receiver checks message integrity, 2972 and before the RPC consumer can use or alter the contents of the 2973 exposed memory region. 2975 An RPC transaction on a Requester can terminate before a Reply 2976 arrives, for example, if the RPC consumer is signaled, or a 2977 segmentation fault occurs. When an RPC terminates abnormally, memory 2978 regions associated with that RPC should be invalidated before the 2979 Requester reuses those regions for other purposes. 2981 11.1.4. Denial of Service 2983 A detailed discussion of denial-of-service exposures that can result 2984 from the use of an RDMA transport appears in Section 6.4 of 2985 [RFC5042]. 2987 A Responder is not obliged to pull unreasonably large Read chunks. A 2988 Responder can use an RDMA2_ERROR response to terminate RPCs with 2989 unreadable Read chunks. If a Responder transmits more data than a 2990 Requester is prepared to receive in a Write or Reply chunk, the RDMA 2991 provider typically terminates the connection. For further 2992 discussion, see Section 6.3.1. Such repeated connection termination 2993 can deny service to other users sharing the connection from the 2994 errant Requester. 2996 An RPC-over-RDMA transport implementation is not responsible for 2997 throttling the RPC request rate, other than to keep the number of 2998 concurrent RPC transactions at or under the number of credits granted 2999 per connection (see Section 4.2.1). A sender can trigger a self- 3000 denial of service by exceeding the credit grant repeatedly. 3002 When an RPC transaction terminates due to a signal or premature exit 3003 of an application process, a Requester should invalidate the RPC's 3004 Write and Reply chunks. Invalidation prevents the subsequent arrival 3005 of the Responder's Reply from altering the memory regions associated 3006 with those chunks after the Requester has released that memory. 3008 On the Requester, a malfunctioning application or a malicious user 3009 can create a situation where RPCs initiate and abort continuously, 3010 resulting in Responder replies that terminate the underlying RPC- 3011 over-RDMA connection repeatedly. Such situations can deny service to 3012 other users sharing the connection from that Requester. 3014 11.2. RPC Message Security 3016 ONC RPC provides cryptographic security via the RPCSEC_GSS framework 3017 [RFC7861]. RPCSEC_GSS implements message authentication 3018 (rpc_gss_svc_none), per-message integrity checking 3019 (rpc_gss_svc_integrity), and per-message confidentiality 3020 (rpc_gss_svc_privacy) in a layer above the RPC-over-RDMA transport. 3021 The integrity and privacy services require significant computation 3022 and movement of data on each endpoint host. Some performance 3023 benefits enabled by RDMA transports can be lost. 3025 11.2.1. RPC-over-RDMA Protection at Other Layers 3027 For any RPC transport, utilizing RPCSEC_GSS integrity or privacy 3028 services has performance implications. Protection below the RPC 3029 implementation is often a better choice in performance-sensitive 3030 deployments, especially if it, too, can be offloaded. Certain 3031 implementations of IPsec can be co-located in RDMA hardware, for 3032 example, without change to RDMA consumers and with little loss of 3033 data movement efficiency. Such arrangements can also provide a 3034 higher degree of privacy by hiding endpoint identity or altering the 3035 frequency at which messages are exchanged, at a performance cost. 3037 Implementations MAY negotiate the use of protection in another layer 3038 through the use of an RPCSEC_GSS security flavor defined in [RFC7861] 3039 in conjunction with the Channel Binding mechanism [RFC5056] and IPsec 3040 Channel Connection Latching [RFC5660]. 3042 11.2.2. RPCSEC_GSS on RPC-over-RDMA Transports 3044 Not all RDMA devices and fabrics support the above protection 3045 mechanisms. Also, NFS clients, where multiple users can access NFS 3046 files, still require per-message authentication. In these cases, 3047 RPCSEC_GSS can protect NFS traffic conveyed on RPC-over-RDMA 3048 connections. 3050 RPCSEC_GSS extends the ONC RPC protocol without changing the format 3051 of RPC messages. By observing the conventions described in this 3052 section, an RPC-over-RDMA transport can convey RPCSEC_GSS-protected 3053 RPC messages interoperably. 3055 Senders MUST NOT reduce protocol elements of RPCSEC_GSS that appear 3056 in the Payload stream of an RPC-over-RDMA message. Such elements 3057 include control messages exchanged as part of establishing or 3058 destroying a security context, or data items that are part of 3059 RPCSEC_GSS authentication material. 3061 11.2.2.1. RPCSEC_GSS Context Negotiation 3063 Some NFS client implementations use a separate connection to 3064 establish a Generic Security Service (GSS) context for NFS operation. 3065 Such clients use TCP and the standard NFS port (2049) for context 3066 establishment. Therefore, an NFS server MUST also provide a TCP- 3067 based NFS service on port 2049 to enable the use of RPCSEC_GSS with 3068 NFS/RDMA. 3070 11.2.2.2. RPC-over-RDMA with RPCSEC_GSS Authentication 3072 The RPCSEC_GSS authentication service has no impact on the DDP- 3073 eligibility of data items in a ULP. 3075 However, RPCSEC_GSS authentication material appearing in an RPC 3076 message header can be larger than, say, an AUTH_SYS authenticator. 3077 In particular, when an RPCSEC_GSS pseudoflavor is in use, a Requester 3078 needs to accommodate a larger RPC credential when marshaling RPC 3079 Calls and needs to provide for a maximum size RPCSEC_GSS verifier 3080 when allocating reply buffers and Reply chunks. 3082 RPC messages, and thus Payload streams, are larger on average as a 3083 result. ULP operations that fit in a Simple Format message when a 3084 simpler form of authentication is in use might need to be reduced or 3085 conveyed via a Special Format message when RPCSEC_GSS authentication 3086 is in use. It is therefore more likely that a Requester provisions 3087 both a Read list and a Reply chunk in the same RPC-over-RDMA 3088 Transport header to convey a Special Format Call and provision a 3089 receptacle for a Special Format Reply. 3091 In addition to this cost, the XDR encoding and decoding of each RPC 3092 message using RPCSEC_GSS authentication requires per-message host 3093 compute resources to construct the GSS verifier. 3095 11.2.2.3. RPC-over-RDMA with RPCSEC_GSS Integrity or Privacy 3097 The RPCSEC_GSS integrity service enables endpoints to detect the 3098 modification of RPC messages in flight. The RPCSEC_GSS privacy 3099 service prevents all but the intended recipient from viewing the 3100 cleartext content of RPC arguments and results. RPCSEC_GSS integrity 3101 and privacy services are end-to-end. They protect RPC arguments and 3102 results from application to server endpoint, and back. 3104 The RPCSEC_GSS integrity and encryption services operate on whole RPC 3105 messages after they have been XDR encoded, and before they have been 3106 XDR decoded after receipt. Connection endpoints use intermediate 3107 buffers to prevent exposure of encrypted or unverified cleartext data 3108 to RPC consumers. After a sender has verified, encrypted, and 3109 wrapped a message, the transport layer MAY use RDMA data transfer 3110 between these intermediate buffers. 3112 The process of reducing a DDP-eligible data item removes the data 3113 item and its XDR padding from an encoded Payload stream. In a non- 3114 protected RPC-over-RDMA message, a reduced data item does not include 3115 XDR padding. After reduction, the Payload stream contains fewer 3116 octets than the whole XDR stream did beforehand. XDR padding octets 3117 are often zero bytes, but they don't have to be. Thus, reducing DDP- 3118 eligible items affects the result of message integrity verification 3119 and encryption. 3121 Therefore, a sender MUST NOT reduce a Payload stream when RPCSEC_GSS 3122 integrity or encryption services are in use. Effectively, no data 3123 item is DDP-eligible in this situation. Senders can use only Simple 3124 and Continued Formats without data item chunks, or Special Format. 3125 In this mode, an RPC-over-RDMA transport operates in the same manner 3126 as a transport that does not support DDP. 3128 11.2.2.4. Protecting RPC-over-RDMA Transport Headers 3130 Like the header fields in an RPC message (e.g., the xid and mtype 3131 fields), RPCSEC_GSS does not protect the RPC-over-RDMA Transport 3132 stream. XIDs, connection credit limits, and chunk lists (though not 3133 the content of the data items they refer to) are exposed to malicious 3134 behavior, which can redirect data that is transferred by the RPC- 3135 over-RDMA message, result in spurious retransmits, or trigger 3136 connection loss. 3138 In particular, if an attacker alters the information contained in the 3139 chunk lists of an RPC-over-RDMA Transport header, data contained in 3140 those chunks can be redirected to other registered memory regions on 3141 Requesters. An attacker might alter the arguments of RDMA Read and 3142 RDMA Write operations on the wire to gain a similar effect. If such 3143 alterations occur, the use of RPCSEC_GSS integrity or privacy 3144 services enables a Requester to detect unexpected material in a 3145 received RPC message. 3147 Encryption at other layers, as described in Section 11.2.1, protects 3148 the content of the Transport stream. RDMA transport implementations 3149 should conform to [RFC5042] to address attacks on RDMA protocols 3150 themselves. 3152 11.3. Transport Properties 3154 Like other fields that appear in the Transport stream, transport 3155 properties are sent in the clear with no integrity protection, making 3156 them vulnerable to man-in-the-middle attacks. 3158 For example, if a man-in-the-middle were to change the value of the 3159 Receive buffer size, it could reduce connection performance or 3160 trigger loss of connection. Repeated connection loss can impact 3161 performance or even prevent a new connection from being established. 3162 The recourse is to deploy on a private network or use transport layer 3163 encryption. 3165 11.4. Host Authentication 3167 [ cel: This subsection is unfinished. ] 3169 Wherein we use the relevant sections of [RFC3552] to analyze the 3170 addition of host authentication to this RPC-over-RDMA transport. 3172 The authors refer readers to Appendix C of [RFC8446] for information 3173 on how to design and test a secure authentication handshake 3174 implementation. 3176 12. IANA Considerations 3178 The RPC-over-RDMA family of transports have been assigned RPC netids 3179 by [RFC8166]. A netid is an rpcbind [RFC1833] string used to 3180 identify the underlying protocol in order for RPC to select 3181 appropriate transport framing and the format of the service addresses 3182 and ports. 3184 The following netid registry strings are already defined for this 3185 purpose: 3187 NC_RDMA "rdma" 3188 NC_RDMA6 "rdma6" 3190 The "rdma" netid is to be used when IPv4 addressing is employed by 3191 the underlying transport, and "rdma6" when IPv6 addressing is 3192 employed. The netid assignment policy and registry are defined in 3193 [RFC5665]. The current document does not alter these netid 3194 assignments. 3196 These netids MAY be used for any RDMA network that satisfies the 3197 requirements of Section 3.2.2 and that is able to identify service 3198 endpoints using IP port addressing, possibly through use of a 3199 translation service as described in Section 9. 3201 13. References 3203 13.1. Normative References 3205 [RFC1833] Srinivasan, R., "Binding Protocols for ONC RPC Version 2", 3206 RFC 1833, DOI 10.17487/RFC1833, August 1995, 3207 . 3209 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3210 Requirement Levels", BCP 14, RFC 2119, 3211 DOI 10.17487/RFC2119, March 1997, 3212 . 3214 [RFC4506] Eisler, M., Ed., "XDR: External Data Representation 3215 Standard", STD 67, RFC 4506, DOI 10.17487/RFC4506, May 3216 2006, . 3218 [RFC5042] Pinkerton, J. and E. Deleganes, "Direct Data Placement 3219 Protocol (DDP) / Remote Direct Memory Access Protocol 3220 (RDMAP) Security", RFC 5042, DOI 10.17487/RFC5042, October 3221 2007, . 3223 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 3224 Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007, 3225 . 3227 [RFC5531] Thurlow, R., "RPC: Remote Procedure Call Protocol 3228 Specification Version 2", RFC 5531, DOI 10.17487/RFC5531, 3229 May 2009, . 3231 [RFC5660] Williams, N., "IPsec Channels: Connection Latching", 3232 RFC 5660, DOI 10.17487/RFC5660, October 2009, 3233 . 3235 [RFC5665] Eisler, M., "IANA Considerations for Remote Procedure Call 3236 (RPC) Network Identifiers and Universal Address Formats", 3237 RFC 5665, DOI 10.17487/RFC5665, January 2010, 3238 . 3240 [RFC7861] Adamson, A. and N. Williams, "Remote Procedure Call (RPC) 3241 Security Version 3", RFC 7861, DOI 10.17487/RFC7861, 3242 November 2016, . 3244 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 3245 Code: The Implementation Status Section", BCP 205, 3246 RFC 7942, DOI 10.17487/RFC7942, July 2016, 3247 . 3249 [RFC8166] Lever, C., Ed., Simpson, W., and T. Talpey, "Remote Direct 3250 Memory Access Transport for Remote Procedure Call Version 3251 1", RFC 8166, DOI 10.17487/RFC8166, June 2017, 3252 . 3254 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3255 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3256 May 2017, . 3258 [RFC8267] Lever, C., "Network File System (NFS) Upper-Layer Binding 3259 to RPC-over-RDMA Version 1", RFC 8267, 3260 DOI 10.17487/RFC8267, October 2017, 3261 . 3263 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 3264 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 3265 . 3267 13.2. Informative References 3269 [CBFC] Kung, H.T., Blackwell, T., and A. Chapman, "Credit-Based 3270 Flow Control for ATM Networks: Credit Update Protocol, 3271 Adaptive Credit Allocation, and Statistical Multiplexing", 3272 Proc. ACM SIGCOMM '94 Symposium on Communications 3273 Architectures, Protocols and Applications, pp. 101-114., 3274 August 1994. 3276 [I-D.ietf-nfsv4-rpc-tls] 3277 Myklebust, T. and C. Lever, "Towards Remote Procedure Call 3278 Encryption By Default", Work in Progress, Internet-Draft, 3279 draft-ietf-nfsv4-rpc-tls-08, 19 June 2020, 3280 . 3282 [IBA] InfiniBand Trade Association, "InfiniBand Architecture 3283 Specification Volume 1", Release 1.3, March 2015. 3284 Available from https://www.infinibandta.org/ 3286 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 3287 DOI 10.17487/RFC0768, August 1980, 3288 . 3290 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 3291 RFC 793, DOI 10.17487/RFC0793, September 1981, 3292 . 3294 [RFC1094] Nowicki, B., "NFS: Network File System Protocol 3295 specification", RFC 1094, DOI 10.17487/RFC1094, March 3296 1989, . 3298 [RFC1813] Callaghan, B., Pawlowski, B., and P. Staubach, "NFS 3299 Version 3 Protocol Specification", RFC 1813, 3300 DOI 10.17487/RFC1813, June 1995, 3301 . 3303 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 3304 Text on Security Considerations", BCP 72, RFC 3552, 3305 DOI 10.17487/RFC3552, July 2003, 3306 . 3308 [RFC5040] Recio, R., Metzler, B., Culley, P., Hilland, J., and D. 3309 Garcia, "A Remote Direct Memory Access Protocol 3310 Specification", RFC 5040, DOI 10.17487/RFC5040, October 3311 2007, . 3313 [RFC5041] Shah, H., Pinkerton, J., Recio, R., and P. Culley, "Direct 3314 Data Placement over Reliable Transports", RFC 5041, 3315 DOI 10.17487/RFC5041, October 2007, 3316 . 3318 [RFC5044] Culley, P., Elzur, U., Recio, R., Bailey, S., and J. 3319 Carrier, "Marker PDU Aligned Framing for TCP 3320 Specification", RFC 5044, DOI 10.17487/RFC5044, October 3321 2007, . 3323 [RFC5532] Talpey, T. and C. Juszczak, "Network File System (NFS) 3324 Remote Direct Memory Access (RDMA) Problem Statement", 3325 RFC 5532, DOI 10.17487/RFC5532, May 2009, 3326 . 3328 [RFC5661] Shepler, S., Ed., Eisler, M., Ed., and D. Noveck, Ed., 3329 "Network File System (NFS) Version 4 Minor Version 1 3330 Protocol", RFC 5661, DOI 10.17487/RFC5661, January 2010, 3331 . 3333 [RFC5662] Shepler, S., Ed., Eisler, M., Ed., and D. Noveck, Ed., 3334 "Network File System (NFS) Version 4 Minor Version 1 3335 External Data Representation Standard (XDR) Description", 3336 RFC 5662, DOI 10.17487/RFC5662, January 2010, 3337 . 3339 [RFC5666] Talpey, T. and B. Callaghan, "Remote Direct Memory Access 3340 Transport for Remote Procedure Call", RFC 5666, 3341 DOI 10.17487/RFC5666, January 2010, 3342 . 3344 [RFC7530] Haynes, T., Ed. and D. Noveck, Ed., "Network File System 3345 (NFS) Version 4 Protocol", RFC 7530, DOI 10.17487/RFC7530, 3346 March 2015, . 3348 [RFC7862] Haynes, T., "Network File System (NFS) Version 4 Minor 3349 Version 2 Protocol", RFC 7862, DOI 10.17487/RFC7862, 3350 November 2016, . 3352 [RFC8167] Lever, C., "Bidirectional Remote Procedure Call on RPC- 3353 over-RDMA Transports", RFC 8167, DOI 10.17487/RFC8167, 3354 June 2017, . 3356 Appendix A. ULB Specifications 3358 Typically, an Upper-Layer Protocol (ULP) is defined without regard to 3359 a particular RPC transport. An Upper-Layer Binding (ULB) 3360 specification provides guidance that helps a ULP interoperate 3361 correctly and efficiently over a particular transport. For RPC-over- 3362 RDMA version 2, a ULB may provide: 3364 * A taxonomy of XDR data items that are eligible for DDP 3366 * Constraints on which upper-layer procedures a sender may reduce, 3367 and on how many chunks may appear in a single RPC message 3369 * A method enabling a Requester to determine the maximum size of the 3370 reply Payload stream for all procedures in the ULP 3372 * An rpcbind port assignment for the RPC Program and Version when 3373 operating on the particular transport 3375 Each RPC Program and Version tuple that operates on RPC-over-RDMA 3376 version 2 needs to have a ULB specification. 3378 A.1. DDP-Eligibility 3380 A ULB designates specific XDR data items as eligible for DDP. As a 3381 sender constructs an RPC-over-RDMA message, it can remove DDP- 3382 eligible data items from the Payload stream so that the RDMA provider 3383 can place them directly in the receiver's memory. An XDR data item 3384 should be considered for DDP-eligibility if there is a clear benefit 3385 to moving the contents of the item directly from the sender's memory 3386 to the receiver's memory. 3388 Criteria for DDP-eligibility include: 3390 * The XDR data item is frequently sent or received, and its size is 3391 often much larger than typical inline thresholds. 3393 * If the XDR data item is a result, its maximum size must be 3394 predictable in advance by the Requester. 3396 * Transport-level processing of the XDR data item is not needed. 3397 For example, the data item is an opaque byte array, which requires 3398 no XDR encoding and decoding of its content. 3400 * The content of the XDR data item is sensitive to address 3401 alignment. For example, a data copy operation would be required 3402 on the receiver to enable the message to be parsed correctly, or 3403 to enable the data item to be accessed. 3405 * The XDR data item itself does not contain DDP-eligible data items. 3407 In addition to defining the set of data items that are DDP-eligible, 3408 a ULB may limit the use of chunks to particular upper-layer 3409 procedures. If more than one data item in a procedure is DDP- 3410 eligible, the ULB may limit the number of chunks that a Requester can 3411 provide for a particular upper-layer procedure. 3413 Senders never reduce data items that are not DDP-eligible. Such data 3414 items can, however, be part of a Special Format payload. 3416 The programming interface by which an upper-layer implementation 3417 indicates the DDP-eligibility of a data item to the RPC transport is 3418 not described by this specification. The only requirements are that 3419 the receiver can re-assemble the transmitted RPC-over-RDMA message 3420 into a valid XDR stream and that DDP-eligibility rules specified by 3421 the ULB are respected. 3423 There is no provision to express DDP-eligibility within the XDR 3424 language. The only definitive specification of DDP-eligibility is a 3425 ULB. 3427 In general, a DDP-eligibility violation occurs when: 3429 * A Requester reduces a non-DDP-eligible argument data item. The 3430 Responder reports the violation as described in Section 6.3.1. 3432 * A Responder reduces a non-DDP-eligible result data item. The 3433 Requester terminates the pending RPC transaction and reports an 3434 appropriate permanent error to the RPC consumer. 3436 * A Responder does not reduce a DDP-eligible result data item into 3437 an available Write chunk. The Requester terminates the pending 3438 RPC transaction and reports an appropriate permanent error to the 3439 RPC consumer. 3441 A.2. Maximum Reply Size 3443 When expecting small and moderately-sized Replies, a Requester should 3444 rely on Message Continuation rather than provision a Reply chunk. 3445 For each ULP procedure where there is no clear Reply size maximum and 3446 the maximum can be substantial, the ULB should specify a dependable 3447 means for determining the maximum Reply size. 3449 A.3. Reverse-Direction Operation 3451 The direction of operation does not preclude the need for DDP- 3452 eligibility statements. 3454 Reverse-direction operation occurs on an already-established 3455 connection. Specification of RPC binding parameters is usually not 3456 necessary in this case. 3458 Other considerations may apply when distinct RPC Programs share an 3459 RPC-over-RDMA transport connection concurrently. 3461 A.4. Additional Considerations 3463 There may be other details provided in a ULB. 3465 * A ULB may recommend inline threshold values or other transport- 3466 related parameters for RPC-over-RDMA version 2 connections bearing 3467 that ULP. 3469 * A ULP may provide a means to communicate transport-related 3470 parameters between peers. 3472 * Multiple ULPs may share a single RPC-over-RDMA version 2 3473 connection when their ULBs allow the use of RPC-over-RDMA version 3474 2 and the rpcbind port assignments for those protocols permit 3475 connection sharing. In this case, the same transport parameters 3476 (such as inline threshold) apply to all ULPs using that 3477 connection. 3479 Each ULB needs to be designed to allow correct interoperation without 3480 regard to the transport parameters actually in use. Furthermore, 3481 implementations of ULPs must be designed to interoperate correctly 3482 regardless of the connection parameters in effect on a connection. 3484 A.5. ULP Extensions 3486 An RPC Program and Version tuple may be extensible. For instance, 3487 the RPC version number may not reflect a ULP minor versioning scheme, 3488 or the ULP may allow the specification of additional features after 3489 the publication of the original RPC Program specification. ULBs are 3490 provided for interoperable RPC Programs and Versions by extending 3491 existing ULBs to reflect the changes made necessary by each addition 3492 to the existing XDR. 3494 [ cel: The final sentence is unclear, and may be inaccurate. I 3495 believe I copied this section directly from RFC 8166. Is there more 3496 to be said, now that we have some experience? ] 3498 Appendix B. Extending RPC-over-RDMA Version 2 3500 This Appendix is not addressed to protocol implementers, but rather 3501 to authors of documents that extend the protocol specified in the 3502 current document. 3504 RPC-over-RDMA version 2 extensibility facilitates limited extensions 3505 to the base protocol presented in the current document so that new 3506 optional capabilities can be introduced without a protocol version 3507 change while maintaining robust interoperability with existing RPC- 3508 over-RDMA version 2 implementations. It allows extensions to be 3509 defined, including the definition of new protocol elements, without 3510 requiring modification or recompilation of the XDR for the base 3511 protocol. 3513 Standards Track documents may introduce extensions to the base RPC- 3514 over-RDMA version 2 protocol in two ways: 3516 * They may introduce new OPTIONAL transport header types. 3517 Appendix B.2 covers such transport header types. 3519 * They may define new OPTIONAL transport properties. Appendix B.3 3520 describes such transport properties. 3522 These documents may also add the following sorts of ancillary 3523 protocol elements to the protocol to support the addition of new 3524 transport properties and header types: 3526 * They may create new error codes, as described in Appendix B.4. 3528 New capabilities can be proposed and developed independently of each 3529 other. Implementers can choose among them, making it straightforward 3530 to create and document experimental features and then bring them 3531 through the standards process. 3533 B.1. Documentation Requirements 3535 As described earlier, a Standards Track document introduces a set of 3536 new protocol elements. Together these elements are considered an 3537 OPTIONAL feature. Each implementation is either aware of all the 3538 protocol elements introduced by that feature or is aware of none of 3539 them. 3541 Documents specifying extensions to RPC-over-RDMA version 2 should 3542 contain: 3544 * An explanation of the purpose and use of each new protocol 3545 element. 3547 * An XDR description including all of the new protocol elements, and 3548 a script to extract it. 3550 * A discussion of interactions with other extensions. This 3551 discussion includes requirements for other OPTIONAL features to be 3552 present, or that a particular level of support for an OPTIONAL 3553 facility is required. 3555 Implementers combine the XDR descriptions of the new features they 3556 intend to use with the XDR description of the base protocol in the 3557 current document. This combination is necessary to create a valid 3558 XDR input file because extensions are free to use XDR types defined 3559 in the base protocol, and later extensions may use types defined by 3560 earlier extensions. 3562 The XDR description for the RPC-over-RDMA version 2 base protocol 3563 combined with that for any selected extensions should provide a 3564 human-readable and compilable definition of the extended protocol. 3566 B.2. Adding New Header Types to RPC-over-RDMA Version 2 3568 New transport header types are defined similar to Sections 6.3.5 3569 through 6.3.10. In particular, what is needed is: 3571 * A description of the function and use of the new header type. 3573 * A complete XDR description of the new header type. 3575 * A description of how receivers report errors, including mechanisms 3576 for reporting errors outside the available choices already 3577 available in the base protocol or other extensions. 3579 * An indication of whether a Payload stream must be present, and a 3580 description of its contents and how receivers use such Payload 3581 streams to reconstruct RPC messages. 3583 * As appropriate, a statement of whether a Responder may use Remote 3584 Invalidation when sending messages that contain the new header 3585 type. 3587 There needs to be additional documentation that is made necessary due 3588 to the OPTIONAL status of new transport header types: 3590 * The document should discuss constraints on support for the new 3591 header types. For example, if support for one header type is 3592 implied or foreclosed by another one, this needs to be documented. 3594 * The document should describe the preferred method by which a 3595 sender determines whether its peer supports a particular header 3596 type. It is always possible to send a test invocation of a 3597 particular header type to see if support is available. However, 3598 when more efficient means are available (e.g., the value of a 3599 transport property), this should be noted. 3601 B.3. Adding New Transport properties to the Protocol 3603 A Standards Track document defining a new transport property should 3604 include the following information paralleling that provided in this 3605 document for the transport properties defined herein: 3607 * The rpcrdma2_propid value identifying the new property. 3609 * The XDR typedef specifying the structure of its property value. 3611 * A description of the new property. 3613 * An explanation of how the receiver can use this information. 3615 * The default value if a peer never receives the new property. 3617 There is no requirement that propid assignments occur in a continuous 3618 range of values. Implementations should not rely on all such values 3619 being small integers. 3621 Before the defining Standards Track document is published, the nfsv4 3622 Working Group should select a unique propid value, and ensure that: 3624 * rpcrdma2_propid values specified in the document do not conflict 3625 with those currently assigned or in use by other pending working 3626 group documents defining transport properties. 3628 * rpcrdma2_propid values specified in the document do not conflict 3629 with the range reserved for experimental use, as defined in 3630 Section 8.2. 3632 [ cel: There is no longer a section 8.2 or an experimental range 3633 of propid values. Should we request the creation of an IANA 3634 registry for propid values? ]. 3636 When a Standards Track document proposes additional transport 3637 properties, reviewers should deal with possible security issues 3638 exposed by those new transport properties. 3640 B.4. Adding New Error Codes to the Protocol 3642 The same Standards Track document that defines a new header type may 3643 introduce new error codes used to support it. A Standards Track 3644 document may similarly define new error codes that an existing header 3645 type can return. 3647 For error codes that do not require the return of additional 3648 information, a peer can use the existing RDMA_ERR2 header type to 3649 report the new error. The sender sets the new error code as the 3650 value of rdma_err with the result that the default switch arm of the 3651 rpcrdma2_error (i.e., void) is selected. 3653 For error codes that do require the return of related information 3654 together with the error, a new header type should be defined that 3655 returns the error together with the related information. The sender 3656 of a new header type needs to be prepared to accept header types 3657 necessary to report associated errors. 3659 Appendix C. Differences from RPC-over-RDMA Version 1 3661 The primary goal of RPC-over-RDMA version 2 is to relieve constraints 3662 that have become evident in RPC-over-RDMA version 1 with deployment 3663 experience: 3665 * RPC-over-RDMA version 1 has been challenging to update to address 3666 shortcomings or improve data transfer efficiency. 3668 * The average size of NFSv4 COMPOUNDs is significantly greater than 3669 NFSv3 requests, requiring the use of Long messages for frequent 3670 operations. 3672 * Reply size estimation is difficult more often than first expected. 3674 This section details specific changes in RPC-over-RDMA version 2 that 3675 address these constraints directly, in addition to other changes to 3676 make implementation easier. 3678 C.1. Changes to the XDR Definition 3680 Several XDR structural changes enable within-version protocol 3681 extensibility. 3683 [RFC8166] defines the RPC-over-RDMA version 1 transport header as a 3684 single XDR object, with an RPC message potentially following it. In 3685 RPC-over-RDMA version 2, there are separate XDR definitions of the 3686 transport header prefix (see Section 6.4), which specifies the 3687 transport header type to be used, and the transport header itself 3688 (defined within one of the subsections of Section 6.3). This 3689 construction is similar to an RPC message, which consists of an RPC 3690 header (defined in [RFC5531]) followed by a message defined by an 3691 Upper-Layer Protocol. 3693 As a new version of the RPC-over-RDMA transport protocol, RPC-over- 3694 RDMA version 2 exists within the versioning rules defined in 3695 [RFC8166]. In particular, it maintains the first four words of the 3696 protocol header, as specified in Section 4.2 of [RFC8166], even 3697 though, as explained in Section 6.2.1 of the current document, the 3698 XDR definition of those words is structured differently. 3700 Although each of the first four fields retains its semantic function, 3701 there are differences in interpretation: 3703 * The first word of the header, the rdma_xid field, retains the 3704 format and function that it had in RPC-over-RDMA version 1. 3705 Because RPC-over-RDMA version 2 messages can convey non-RPC 3706 messages, a receiver should not use the contents of this field 3707 without consideration of the protocol version and header type. 3709 * The second word of the header, the rdma_vers field, retains the 3710 format and function that it had in RPC-over-RDMA version 1. To 3711 clearly distinguish version 1 and version 2 messages, senders need 3712 to fill in the correct version (fixed after version negotiation). 3713 Receivers should check that the content of the rdma_vers is 3714 correct before using the content of any other header field. 3716 * The third word of the header, the rdma_credit field, retains the 3717 size and general purpose that it had in RPC-over-RDMA version 1. 3718 However, RPC-over-RDMA version 2 divides this field into two 3719 16-bit subfields. See Section 4.2.1 for further details. 3721 * The fourth word of the header, previously the union discriminator 3722 field rdma_proc, retains its format and general function even 3723 though the set of valid values has changed. Within RPC-over-RDMA 3724 version 2, this word is the rdma_htype field of the structure 3725 rdma_start. The value of this field is now an unsigned 32-bit 3726 integer rather than an enum type, to facilitate header type 3727 extension. 3729 Beyond conforming to the restrictions specified in [RFC8166], RPC- 3730 over-RDMA version 2 attempts to limit the scope of the changes made 3731 to ensure interoperability. Although it introduces the Call chunk 3732 and splits the two version 1 workhorse procedure types RDMA_MSG and 3733 RDMA_NOMSG into several variants, RPC-over-RDMA version 2 otherwise 3734 expresses chunks in the same format and utilizes them the same way. 3736 C.2. Transport Properties 3738 RPC-over-RDMA version 2 provides a mechanism for exchanging an 3739 implementation's operational properties. The purpose of this 3740 exchange is to help endpoints improve the efficiency of data transfer 3741 by exploiting the characteristics of both peers rather than falling 3742 back on the lowest common denominator default settings. A full 3743 discussion of transport properties appears in Section 5. 3745 C.3. Credit Management Changes 3747 RPC-over-RDMA transports employ credit-based flow control to ensure 3748 that a Requester does not emit more RDMA Sends than the Responder is 3749 prepared to receive. 3751 Section 3.3.1 of [RFC8166] explains the operation of RPC-over-RDMA 3752 version 1 credit management in detail. In that design, each RDMA 3753 Send from a Requester contains an RPC Call with a credit request, and 3754 each RDMA Send from a Responder contains an RPC Reply with a credit 3755 grant. The credit grant implies that enough Receives have been 3756 posted on the Responder to handle the credit grant minus the number 3757 of pending RPC transactions (the number of remaining Receive buffers 3758 might be zero). 3760 Each RPC Reply acts as an implicit ACK for a previous RPC Call from 3761 the Requester. Without an RPC Reply message, the Requester has no 3762 way to know that the Responder is ready for subsequent RPC Calls. 3764 Because version 1 embeds credit management in each message, there is 3765 a strict one-to-one ratio between RDMA Send and RPC message. There 3766 are interesting use cases that might be enabled if this relationship 3767 were more flexible: 3769 * RPC-over-RDMA operations that do not carry an RPC message, e.g., 3770 control plane operations. 3772 * A single RDMA Send that conveys more than one RPC message, e.g., 3773 for interrupt mitigation. 3775 * An RPC message that requires several sequential RDMA Sends, e.g., 3776 to reduce the use of explicit RDMA operations for moderate-sized 3777 RPC messages. 3779 * An RPC transaction that requires multiple exchanges or an odd 3780 number of RPC-over-RDMA operations to complete. 3782 RPC-over-RDMA version 2 provides a more sophisticated credit 3783 accounting mechanism to address these shortcomings. Section 4.2.1 3784 explains the new mechanism in detail. 3786 C.4. Inline Threshold Changes 3788 An "inline threshold" value is the largest message size (in octets) 3789 that can be conveyed on an RDMA connection using only RDMA Send and 3790 Receive. Each connection has two inline threshold values: one for 3791 messages flowing from client-to-server (referred to as the "client- 3792 to-server inline threshold") and one for messages flowing from 3793 server-to-client (referred to as the "server-to-client inline 3794 threshold"). 3796 A connection's inline thresholds determine, among other things, when 3797 RDMA Read or Write operations are required because an RPC message 3798 cannot be conveyed via a single RDMA Send and Receive pair. When an 3799 RPC message does not contain DDP-eligible data items, a Requester can 3800 prepare a Special Format Call or Reply to convey the whole RPC 3801 message using RDMA Read or Write operations. 3803 RDMA Read and Write operations require that data payloads reside in 3804 memory registered with the local RNIC. When an RPC completes, that 3805 memory is invalidated to fence it from the Responder. Memory 3806 registration and invalidation typically have a latency cost that is 3807 insignificant compared to data handling costs. 3809 When a data payload is small, however, the cost of registering and 3810 invalidating memory where the payload resides becomes a significant 3811 part of total RPC latency. Therefore the most efficient operation of 3812 an RPC-over-RDMA transport occurs when the peers use explicit RDMA 3813 Read and Write operations for large payloads but avoid those 3814 operations for small payloads. 3816 When the authors of [RFC8166] first conceived RPC-over-RDMA version 3817 1, the average size of RPC messages that did not involve a 3818 significant data payload was under 500 bytes. A 1024-byte inline 3819 threshold adequately minimized the frequency of inefficient Long 3820 messages. 3822 With NFS version 4 [RFC7530], the increased size of NFS COMPOUND 3823 operations resulted in RPC messages that are, on average, larger than 3824 previous versions of NFS. With a 1024-byte inline threshold, 3825 frequent operations such as GETATTR and LOOKUP require RDMA Read or 3826 Write operations, reducing the efficiency of data transport. 3828 To reduce the frequency of Special Format messages, RPC-over-RDMA 3829 version 2 increases the default size of inline thresholds. This 3830 change also increases the maximum size of reverse-direction RPC 3831 messages. 3833 C.5. Message Continuation Changes 3835 In addition to a larger default inline threshold, RPC-over-RDMA 3836 version 2 introduces Message Continuation. Message Continuation is a 3837 mechanism that enables the transmission of a data payload using more 3838 than one RDMA Send. The purpose of Message Continuation is to 3839 provide relief in several essential cases: 3841 * If a Requester finds that it is inefficient to convey a 3842 moderately-sized data payload using Read chunks, the Requester can 3843 use Message Continuation to send the RPC Call. 3845 * If a Requester has provided insufficient Reply chunk space for a 3846 Responder to send an RPC Reply, the Responder can use Message 3847 Continuation to send the RPC Reply. 3849 * If a sender has to convey a sizeable non-RPC data payload (e.g., a 3850 large transport property), the sender can use Message Continuation 3851 to avoid having to register memory. 3853 C.6. Host Authentication Changes 3855 For the general operation of NFS on open networks, we eventually 3856 intend to rely on RPC-on-TLS [I-D.ietf-nfsv4-rpc-tls] to provide 3857 cryptographic authentication of the two ends of each connection. In 3858 turn, this can improve the trustworthiness of AUTH_SYS-style user 3859 identities that flow on TCP, which are not cryptographically 3860 protected. We do not have a similar solution for RPC-over-RDMA, 3861 however. 3863 Here, the RDMA transport layer already provides a strong guarantee of 3864 message integrity. On some network fabrics, IPsec or TLS can protect 3865 the privacy of in-transit data. However, this is not the case for 3866 all fabrics (e.g., InfiniBand [IBA]). 3868 Thus, RPC-over-RDMA version 2 introduces a mechanism for 3869 authenticating connection peers (see Section 5.2.6). And like GSS 3870 channel binding, there is also a way to determine when the use of 3871 host authentication is unnecessary. 3873 C.7. Support for Remote Invalidation 3875 When an RDMA consumer uses FRWR or Memory Windows to register memory, 3876 that memory may be invalidated remotely [RFC5040]. These mechanisms 3877 are available when a Requester's RNIC supports MEM_MGT_EXTENSIONS. 3879 For this discussion, there are two classes of STags. Dynamically- 3880 registered STags appear in a single RPC, then are invalidated. 3881 Persistently-registered STags survive longer than one RPC. They may 3882 persist for the life of an RPC-over-RDMA connection or even longer. 3884 An RPC-over-RDMA Requester can provide more than one STag in a 3885 transport header. It may provide a combination of dynamically- and 3886 persistently-registered STags in one RPC message, or any combination 3887 of these in a series of RPCs on the same connection. Only 3888 dynamically-registered STags using Memory Windows or FRWR may be 3889 invalidated remotely. 3891 There is no transport-level mechanism by which a Responder can 3892 determine how a Requester-provided STag was registered, nor whether 3893 it is eligible to be invalidated remotely. A Requester that mixes 3894 persistently- and dynamically-registered STags in one RPC, or mixes 3895 them across RPCs on the same connection, must, therefore, indicate 3896 which STag the Responder may invalidate remotely via a mechanism 3897 provided in the Upper-Layer Protocol. RPC-over-RDMA version 2 3898 provides such a mechanism. 3900 A sender uses the RDMA Send With Invalidate operation to invalidate 3901 an STag on the remote peer. It is available only when both peers 3902 support MEM_MGT_EXTENSIONS (can send and process an IETH). 3904 Existing RPC-over-RDMA transport protocol specifications [RFC8166] 3905 [RFC8167] do not forbid direct data placement in the reverse 3906 direction. Moreover, there is currently no Upper-Layer Protocol that 3907 makes data items in reverse-direction operations eligible for direct 3908 data placement. 3910 When chunks are present in a reverse-direction RPC request, Remote 3911 Invalidation enables the Responder to trigger invalidation of a 3912 Requester's STags as part of sending an RPC Reply, the same way as is 3913 done in the forward direction. 3915 However, in the reverse direction, the server acts as the Requester, 3916 and the client is the Responder. The server's RNIC, therefore, must 3917 support receiving an IETH, and the server must have registered its 3918 STags with an appropriate registration mechanism. 3920 C.8. Integration of Reverse-Direction Operation 3922 Because [RFC5666] did not include specification of reverse-direction 3923 operation, [RFC8166] does not include it either. Reverse-direction 3924 operation in RPC-over-RDMA version 1 is specified by a separate 3925 standards track document [RFC8167]. 3927 Reverse-direction operation in RPC-over-RDMA version 1 was 3928 constrained by the limited ability to extend that version of the 3929 protocol. The most awkward issue is that a receiver needs to peek at 3930 ingress RPC message payloads to determine whether it is a Call or 3931 Reply message. This is necessary because the meaning of several 3932 fields in the RPC-over-RDMA transport header is determined by the 3933 direction of the RPC message payload: 3935 * The meaning of the value in the rdma_xid field is determined by 3936 the direction of the message because the XID spaces in the forward 3937 and reverse directions are distinct. 3939 * The meaning of the value in the rdma_credits field is determined 3940 by the direction of the message because credits are granted 3941 separately for forward and reverse direction operation. 3943 * The purpose of Write chunks and the meaning of their length fields 3944 is determined by the direction of the message because in Call 3945 messages, they are provisional, but in Reply messages, they 3946 represent returned results. 3948 The current document remedies this awkwardness by integrating 3949 reverse-direction operation into RPC-over-RDMA version 2 so that it 3950 can make use of all facilities that are available in the forward- 3951 direction, including body chunks, remote invalidation, and message 3952 continuation. To enable this integration, the direction of the RPC 3953 message payload is encoded in each RPC-over-RDMA version 2 transport 3954 header. 3956 C.9. Error Reporting Changes 3958 RPC-over-RDMA version 2 expands the repertoire of errors that 3959 connection peers may report to each other. The goals of this 3960 expansion are: 3962 * To fill in details of peer recovery actions. 3964 * To enable retrying certain conditions caused by mis-estimation of 3965 the maximum reply size. 3967 * To minimize the likelihood of a Requester waiting forever for a 3968 Reply when there are communications problems that prevent the 3969 Responder from sending it. 3971 C.10. Changes in Terminology 3973 The RPC-over-RDMA version 2 specification makes the following changes 3974 in terminology. These changes do not result in changes in the 3975 behavior or operation of the protocol. 3977 * The current document explicitly acknowledges the different 3978 semantics and purpose of Write chunks appearing in Call messages 3979 and those appearing in Reply messages. 3981 * The current document introduces the term "payload format" to 3982 describe the selection of a mechanism for reducing and conveying 3983 an RPC message payload. It replaces the terms "short message" and 3984 "long message" with the terms "simple format" and "special format" 3985 because this selection is not based only on the size of the 3986 payload. 3988 * The current document introduces the terms "data item chunk" and 3989 "body chunk" in order to distinguish the purpose and operation of 3990 these two categories of chunk. 3992 * For improved readability, the current document replaces the terms 3993 "RDMA segment" and "plain segment" with the term "segment", and 3994 the term "RDMA read segment" with the term "Read segment". 3996 * The current document refers specifically to the RDMAP, DDP, and 3997 MPA standards track protocols rather than using the nebulous term 3998 "iWARP". 4000 Acknowledgments 4002 The authors gratefully acknowledge the work of Brent Callaghan and 4003 Tom Talpey on the original RPC-over-RDMA version 1 specification 4004 [RFC5666]. The authors also wish to thank Bill Baker, Greg Marsden, 4005 and Matt Benjamin for their support of this work. 4007 The XDR extraction conventions were first described by the authors of 4008 the NFS version 4.1 XDR specification [RFC5662]. Herbert van den 4009 Bergh suggested the replacement sed script used in this document. 4011 Special thanks go to Transport Area Director Magnus Westerlund, NFSV4 4012 Working Group Chairs Spencer Shepler, and Brian Pawlowski, and NFSV4 4013 Working Group Secretary Thomas Haynes for their support. 4015 Authors' Addresses 4017 Charles Lever (editor) 4018 Oracle Corporation 4019 United States of America 4021 Email: chuck.lever@oracle.com 4023 David Noveck 4024 NetApp 4025 1601 Trapelo Road 4026 Waltham, MA 02451 4027 United States of America 4029 Phone: +1 781 572 8038 4030 Email: davenoveck@gmail.com