-
I'm successfully using liburing to send out UDP and TCP packets using I'm trying to use registered buffers in order to avoid address mapping between user and kernel space. Following the docs, I create the iovecs: struct iovec iov[QueueDepth]; Then I initialize and register them: for (size_t i{ 0 }; i < DepLibUring::QueueDepth; ++i)
{
this->iov[i].iov_base = malloc(1500);
this->iov[i].iov_len = 1500;
}
err = io_uring_register_buffers(std::addressof(this->ring), this->iov, DepLibUring::QueueDepth); Then, I use it to prepare a UDP send request: auto store = this->iov[idx];
std::memcpy(store.iov_base, data, len);
store.iov_len = len;
io_uring_prep_sendto(sqe, sockfd, store.iov_base, store.iov_len, 0, addr, addrlen);
sqe->buf_index = idx;
sqe->opcode |= IORING_OP_WRITE_FIXED; Upon submitting the requests, I get a If I remove the lines: sqe->buf_index = idx;
sqe->opcode |= IORING_OP_WRITE_FIXED; Then everything works, but obviously the address mapping happen for each request. I wonder if using registered buffers is supported for Any comment is much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The short answer, it's not supported. It can be added to normal sends, but that wouldn't make any performance difference. Is there a use case for that? Note,
|
Beta Was this translation helpful? Give feedback.
The short answer, it's not supported. It can be added to normal sends, but that wouldn't make any performance difference. Is there a use case for that?
Note,
*_OP_SENDZC
supports fixed buffers because it does make a difference for it.IORING_OP_WRITE_FIXED
is not a flag but an opcode, so it's not how it works. For example,_OP_SENDZC
has a bit different way for enabling fixed buffers, you can find it in liburing examples.