RDMA_POST_RECV(3)

πŸ’Œ RDMA_POST_RECV(3) β€” the librdmacm programmer's manual, but make it cute

okay so bestie, welcome to the glow-up of rdma_post_recv from the librdmacm Programmer's Manual. this is the one where you tell the network "hey, i'm ready to receive, send me stuff" 🫢


✨ NAME ✨

rdma_post_recv β€” post a work request to receive an incoming message. literally just "inbox open, bestie" πŸ’–


🌸 SYNOPSIS 🌸

#include <rdma/rdma_verbs.h>

int rdma_post_recv (struct rdma_cm_id *id, void *context, void *addr,
size_t length, struct ibv_mr *mr);

no cap, that's the whole signature. five little arguments and you're posting πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • id β€” a reference to a communication identifier where the message buffer will be posted. this is your main character, the rdma_cm_id everything hangs off of ✨
  • context β€” user-defined context associated with the request. put whatever you want in here, it's your little emotional support pointer πŸ’…
  • addr β€” the address of the memory buffer to post. the actual spot where the incoming data is gonna land πŸ“
  • length β€” the length of the memory buffer. how much room you're giving it, be generous πŸ“
  • mr β€” a registered memory region associated with the posted buffer. registered, bestie, don't forget 🧚

πŸ’œ DESCRIPTION πŸ’œ

Posts a work request to the receive queue of the queue pair associated with the rdma_cm_id. the posted buffer will be queued to receive an incoming message sent by the remote peer.

that's it. that's the vibe. you drop a buffer into the receive queue, and it sits there patiently waiting like a girl who texted first and is now refreshing πŸ₯²


πŸ‘‘ RETURN VALUE πŸ‘‘

Returns 0 on success, or -1 on error. and if it's an error? errno will be set to indicate the failure reason. so check it, don't just assume, okay? πŸ’€


πŸ”₯ NOTES πŸ”₯

okay this part actually matters so listen up bestie:

  • the user is responsible for ensuring that a receive buffer is posted and large enough to contain all sent data before the peer posts the corresponding send message. if you're late, that's on you 😭
  • the message buffer must have been registered before being posted, with the mr parameter referencing the registration.
  • the buffer must remain registered until the receive completes. do not un-register it early, i am begging πŸ™ˆ
  • messages may be posted to an rdma_cm_id only after a queue pair has been associated with it. a queue pair is bound to an rdma_cm_id after calling rdma_create_ep or rdma_create_qp, if the rdma_cm_id is allocated using rdma_create_id.
  • the user-defined context associated with the receive request will be returned to the user through the work completion wr_id, work request identifier, field. so that context you passed in? it comes back to you. it's giving boomerang πŸͺƒ
ngl the ordering rules here are not a suggestion, they're the whole plot. post the buffer first, keep it registered, and only post after the qp is associated. periodt. πŸ’…

🌈 SEE ALSO 🌈


librdmacm Β· 2010-07-19 β€” and that's the whole page, bestie. go forth and receive, you absolute icon πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from