rpma_write_with_imm(3)

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

πŸ’– rpma_write_with_imm β€” RPMA Programmer's Manual, section 3 πŸ’–

okay bestie, gather round, because this one is lowkey iconic and you're gonna want it in your notes. it's rpma_write_with_imm(3), it lives in the RPMA Programmer's Manual, and it's about to be your new fave 🫢


✨ NAME ✨

rpma_write_with_imm β€” initiate the write operation with immediate data

like. it writes. and there's immediate data. the name ate, honestly. πŸ’…


🌸 SYNOPSIS 🌸

#include <librpma.h>

struct rpma_conn;
struct rpma_mr_local;
struct rpma_mr_remote;
int rpma_write_with_imm(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, uint32_t imm,
                const void *op_context);

yes bestie, that's a lot of parameters. she's high maintenance but she delivers ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so rpma_write_with_imm() initiates the write operation with immediate data β€” which is the fancy way of saying it transfers data from the local memory to the remote memory. main character energy fr fr. πŸŽ€

and here's the cute lil trick: if you wanna write a 0 bytes message, you set src and dst to NULL and src_offset, dst_offset and len to 0. that's it. that's the whole vibe check. ⭐


πŸ’« the flags situation

the attribute flags sets the completion notification indicator, and you have exactly two options, so choose wisely:

  • 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 (struct ibv_wc). so like, don't lose track of it, she comes back around πŸ’œ


πŸ”₯ RETURN VALUE πŸ”₯

rpma_write_with_imm() returns 0 on success or a negative error code on failure. no in-between, no gray area, she's decisive like that πŸ’…


πŸ’€ ERRORS πŸ’€

not me having to tell you the ways this can go wrong 😭 but bestie, forewarned is forearmed. rpma_write_with_imm() can fail with the following errors:

  • 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
ok so real talk: those RPMA_E_INVAL ones are literally just "your arguments don't vibe together". either conn is NULL, or flags is 0, or you set one of src/dst to NULL while leaving the other side or the offsets or len doing something. mixed signals = error, periodt. πŸ™ˆ

🌈 SEE ALSO 🌈

go be nosy, bestie, these are all connected:


and that's the whole page, you're officially educated πŸ’– this lil masterpiece came out of the RPMA Programmer's Manual and it's dated 01 April 2024. go forth and write_with_imm responsibly, bestie πŸ§šβœ¨πŸ“

πŸ“¦ where this page comes from