rpma_write(3)

πŸ“¦
version 1.3.0 Β· 3 versions
, in ubuntu noble

✨ rpma_write β€” bestie edition ✨

okay so you're here for rpma_write(3) from the RPMA Programmer's Manual and honestly? you came to the right place πŸ’– this is the one that makes your local memory yeet itself over to the remote side. let's get into it.


🌸 NAME 🌸

rpma_write β€” initiate the write operation

like, it starts the whole thing. it's giving main character energy for your data transfer πŸ¦‹


⭐ SYNOPSIS ⭐

#include <librpma.h>

struct rpma_conn;
struct rpma_mr_local;
struct rpma_mr_remote;
int rpma_write(struct rpma_conn *conn,
                struct rpma_mr_remote *dst, size_t dst_offset,
                const struct rpma_mr_local *src, size_t src_offset,
                size_t len, int flags, const void *op_context);

πŸ’… DESCRIPTION πŸ’…

so rpma_write() initiates transferring data from the local memory to the remote memory. that's it, that's the whole vibe ✨

and listen β€” to write a 0 bytes message, set src and dst to NULL and src_offset, dst_offset and len to 0. yes bestie, a zero-byte message is a real thing, it's valid, it's iconic, we respect it πŸŽ€

the attribute flags set the completion notification indicator, which is basically "when do you wanna hear back from me":

  • RPMA_F_COMPLETION_ON_ERROR β€” generate the completion on error
  • RPMA_F_COMPLETION_ALWAYS β€” generate the completion regardless of result of the operation.

and op_context? it gets returned in the wr_id field of the completion (that's a struct ibv_wc btw) so you can tell which operation just finished. it's like a little name tag for your write 🏷️


πŸ’– RETURN VALUE πŸ’–

rpma_write() returns 0 on success or a negative error code on failure. no cap. if you see a negative number, something went sideways 😭


πŸ”₯ ERRORS πŸ”₯

rpma_write() can fail with the following errors, and honestly she's dramatic about it:

  • RPMA_E_INVAL β€” conn == NULL || flags == 0
  • RPMA_E_INVAL β€” dst == NULL && (src != NULL || src_offset != 0 || dst_offset != 0 || len != 0)
  • RPMA_E_INVAL β€” src == NULL && (dst != NULL || src_offset != 0 || dst_offset != 0 || len != 0)
  • RPMA_E_PROVIDER β€” ibv_post_send(3) failed
ngl those first three are all about not mixing NULL pointers with nonzero offsets/lengths, so like... read them carefully before you come for me πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

rpma_conn_req_connect(3), rpma_mr_reg(3), rpma_mr_remote_from_descriptor(3), librpma(7) and https://pmem.io/rpma/


and that's the whole page bestie, slay πŸ’…βœ¨πŸ¦‹

this was brought to you by the RPMA crew, dated 01 April 2024, and yeah the date is real, not a prank, iykyk πŸŽ€πŸ’–πŸŒΈ

πŸ“¦ where this page comes from