mlx5dv_devx_get_event(3)

✨ NAME ✨

mlx5dv_devx_get_event(3) β€” get an asynchronous event. Like, that's the whole vibe: grabbing an async event from an mlx5 event channel, and honestly? iconic little kernel-adjacent main character behavior πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

#include <infiniband/mlx5dv.h>

struct mlx5dv_devx_async_event_hdr {
    uint64_t    cookie;
    uint8_t     out_data[];
};

ssize_t mlx5dv_devx_get_event(struct mlx5dv_devx_event_channel *event_channel,
                              struct mlx5dv_devx_async_event_hdr *event_data,
                              size_t event_resp_len)

🌸 DESCRIPTION 🌸

Okay so bestie, mlx5dv_devx_get_event() gets a device event on the event_channel you pass in. Once you've posted a successful subscription over the event channel by calling mlx5dv_devx_subscribe_devx_event(), the application should use this API to get the response when an event has occurred. No cap.

When the response comes back, the cookie that you supplied during the subscription is returned, and out_data includes the data itself. Tiny plot twist: out_data may be omitted if the channel was created with the omit data flag πŸ™ˆ

The application must supply a large enough buffer to hold the event according to the device specification. The buffer size is given by the input event_resp_len parameter. So size it correctly, bestie β€” this is not a vibes-only situation ✨

πŸ¦‹ ARGUMENTS πŸ¦‹

  • event_channel β€” the channel to get the event over. That's the event portal, the runway, the whole access point πŸ’«
  • event_data β€” the output data from the asynchronous event.
  • event_resp_len β€” the output buffer size to hold the response.

πŸ”₯ RETURN VALUE πŸ”₯

On success, mlx5dv_devx_get_event returns the number of bytes read. Otherwise, it returns -1, and errno was set. Simple as that, bestie πŸ’€

πŸ’œ NOTES πŸ’œ

If the event_channel was created with the omit data flag, events having the same type may be combined per subscription and be reported once with the matching cookie. In that mode of work, ordering is not preserved between those events and other ones on this channel. Iykyk β€” same-type events can get bundled, but don't expect the timeline to stay ordered 😭

On the other hand, when each event should hold the device data, ordering is preserved. However, events might be loose as of lack of kernel memory β€” and in that case EOVERFLOW will be reported. So if you see EOVERFLOW, that's the kernel-memory shortage vibe check, not a drill 🫢

🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Yishai Hadas <yishaih@mellanox.com>

πŸ’– Source/version vibes: mlx5dv_devx_get_event(3) in the mlx5dv manual. Date: not printed in the original footer, bestie β€” so we're not inventing one. Periodt. πŸŽ€

πŸ“¦ where this page comes from