RDMA_GET_SRC_PORT(3)

✨ RDMA_GET_SRC_PORT ✨

okay bestie, welcome to the rdma_get_src_port page from the Librdmacm Programmer's Manual πŸ’– this one is short, sweet, and honestly iconic β€” it's the "hey what port am I even on??" function. let's go πŸ¦‹


🌸 NAME 🌸

rdma_get_src_port β€” returns the local port number of a bound rdma_cm_id.

like... literally that's the whole thing. it hands you back the local port. no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <rdma/rdma_cma.h>

uint16_t rdma_get_src_port (struct rdma_cm_id *id);

look at her. one include, one function, zero drama ✨


🫢 ARGUMENTS 🫢

  • id β€” the RDMA identifier. this is your rdma_cm_id, the main character of every RDMA cm story 🌈

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe: this function returns the local port number for an rdma_cm_id that has been bound to a local address.

that's it. that's the function. if you've already bound your id to a local address, this tells you which local port you're sitting on. lowkey essential, highkey simple 🌸

ngl though β€” the "bound to a local address" part is doing a LOT of work in that sentence. peep RETURN VALUE below before you go assuming things πŸ‘€

πŸ‘‘ RETURN VALUE πŸ‘‘

it returns the 16-bit port identifier associated with the local endpoint. slay πŸ’…

but β€” and this is the part everyone skips β€” if the rdma_cm_id is not bound to a port, the returned value is 0.

so if you're staring at a 0 and going "bestie why 😭" β€” it's not a bug, it's just not bound. go bind it (rdma_bind_addr(3) is right there in SEE ALSO, iykyk) 🧚


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group honestly 🫢 go read them together, they make so much more sense as a squad ✨


and that's the page!! this absolute banger of a manual page comes to you from librdmacm, dated 2007-05-15 β€” yes she's been serving since 2007 and she has not missed a day πŸ’–πŸŽ€ mwah, ily, go bind your ports ⭐

πŸ“¦ where this page comes from