Search code examples
rdmainfiniband

`libibverbs`: Is it possible to know the size of a receiving data buffer?


Is it possible to call ibv_post_send() with a size of a buffer (ibv_sge.length) smaller than the the size of the buffer in the receiver side (ibv_post_recv())? So that we only specify on the receiver side the maximum buffer size and the sender can send any size smaller or equals than this value.

If this is the case, on the receiver side, is it possible to know the size of the buffer sent after calling ibv_post_recv(), once the message is received? Or should I use send with immediate in this case?


Solution

  • Yes, it is definitely fine to post a send that is smaller than the matching receive. The only restriction is that the size of the send cannot be larger than the buffer where it will be received.

    The amount of data actually transferred will be reported in the ibv_wc.byte_len field of the completion for the receive work request on the receiver side.