aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/osmo_io_uring.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-11-18 18:46:24 +0100
committerlaforge <laforge@osmocom.org>2023-11-22 12:20:12 +0000
commit987a86af88d22e8c095e0dff13e0ba785520a41f (patch)
treece40d487fbac001b3b6e2bc7668f4007a9d27fc0 /src/core/osmo_io_uring.c
parent641cc3c60da1ae4b1f442609ca381b052a5ecb44 (diff)
io_uring: add some more source code comments/docs
Diffstat (limited to 'src/core/osmo_io_uring.c')
-rw-r--r--src/core/osmo_io_uring.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index a6395fea..abeea798 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -59,6 +59,8 @@ struct osmo_io_uring {
static __thread struct osmo_io_uring g_ring;
static void iofd_uring_cqe(struct io_uring *ring);
+
+/*! read call-back for eventfd notifying us if entries are in the completion queue */
static int iofd_uring_poll_cb(struct osmo_fd *ofd, unsigned int what)
{
struct io_uring *ring = ofd->data;
@@ -157,6 +159,7 @@ static void iofd_uring_submit_recv(struct osmo_io_fd *iofd, enum iofd_msg_action
iofd->u.uring.read_msghdr = msghdr;
}
+/*! completion call-back for READ/RECVFROM */
static void iofd_uring_handle_recv(struct iofd_msghdr *msghdr, int rc)
{
struct osmo_io_fd *iofd = msghdr->iofd;
@@ -179,6 +182,7 @@ static void iofd_uring_handle_recv(struct iofd_msghdr *msghdr, int rc)
static int iofd_uring_submit_tx(struct osmo_io_fd *iofd);
+/*! completion call-back for WRITE/SENDTO */
static void iofd_uring_handle_tx(struct iofd_msghdr *msghdr, int rc)
{
struct osmo_io_fd *iofd = msghdr->iofd;
@@ -220,10 +224,12 @@ out_free:
out:
iofd->u.uring.write_msghdr = NULL;
+ /* submit the next to-be-transmitted message for this file descriptor */
if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
iofd_uring_submit_tx(iofd);
}
+/*! handle completion of a single I/O message */
static void iofd_uring_handle_completion(struct iofd_msghdr *msghdr, int res)
{
struct osmo_io_fd *iofd = msghdr->iofd;
@@ -250,6 +256,7 @@ static void iofd_uring_handle_completion(struct iofd_msghdr *msghdr, int res)
talloc_free(iofd);
}
+/*! process all pending completion queue entries in given io_uring */
static void iofd_uring_cqe(struct io_uring *ring)
{
int rc;
@@ -274,6 +281,7 @@ static void iofd_uring_cqe(struct io_uring *ring)
}
}
+/*! will submit the next to-be-transmitted message for given iofd */
static int iofd_uring_submit_tx(struct osmo_io_fd *iofd)
{
struct io_uring_sqe *sqe;