News for hackers. Stuff that matters.
Re:Io_uring and Networking in 2023 [pdf] by twic on Friday February 17, 2023 @10:34AM (#34835804)
In this code:

  for (i = 0; i < BUFS_IN_GROUP; i++) {
    /* add each buffer, we'll use i buffer ID */
    io_uring_buf_ring_add(br, bufs[i], BUF_SIZE, i,
            io_uring_buf_ring_mask(BUFS_IN_GROUP), i);
   }
Where did bufs come from? Should that be br.bufs[i]?
Re:Io_uring and Networking in 2023 [pdf] by espoal on Friday February 17, 2023 @10:50AM (#34836016)
i think it should be br[i]
Re:Io_uring and Networking in 2023 [pdf] by cgh on Friday February 17, 2023 @03:18PM (#34839948)
I think so, yes. struct io_uring_buf_ring is a union that includes a bufs member:

    struct io_uring_buf    bufs[0];
Re:Io_uring and Networking in 2023 [pdf] by axboe on Friday February 17, 2023 @04:27PM (#34840793)
The buffers are supplied elsewhere outside that example, just consider it an array of pointers to buffers of size BUF_SIZE. br->bufs[] is the shared space, it holds information on the address/size/id of a given buffer.