Skip to content

Commit c884322

Browse files
erenonBenedek Thaler
and
Benedek Thaler
authored
Add notif and related SendZc docs (#299)
* Add notif that checks for IORING_CQE_F_NOTIF * Add extra documentation to SendZc --------- Co-authored-by: Benedek Thaler <[email protected]>
1 parent 0a2283a commit c884322

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

io-uring-test/src/tests/net.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1662,10 +1662,12 @@ pub fn test_udp_sendzc_with_dest<S: squeue::EntryMarker, C: cqueue::EntryMarker>
16621662
// First SendZc notification
16631663
11 => {
16641664
assert!(cqueue::more(cqe.flags()));
1665+
assert!(!cqueue::notif(cqe.flags()));
16651666
}
16661667
// Last SendZc notification
16671668
0 => {
16681669
assert!(!cqueue::more(cqe.flags()));
1670+
assert!(cqueue::notif(cqe.flags()));
16691671
}
16701672
_ => panic!("wrong result for notification"),
16711673
},

src/cqueue.rs

+8
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,11 @@ pub fn more(flags: u32) -> bool {
333333
pub fn sock_nonempty(flags: u32) -> bool {
334334
flags & sys::IORING_CQE_F_SOCK_NONEMPTY != 0
335335
}
336+
337+
/// Returns whether this completion event is a notification.
338+
///
339+
/// This corresponds to the `IORING_CQE_F_NOTIF` flag,
340+
/// currently used by the [SendZc](crate::opcode::SendZc) operation.
341+
pub fn notif(flags: u32) -> bool {
342+
flags & sys::IORING_CQE_F_NOTIF != 0
343+
}

src/opcode.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,12 @@ opcode! {
16621662
///
16631663
/// A fixed (pre-mapped) buffer can optionally be used from pre-mapped buffers that have been
16641664
/// previously registered with [`Submitter::register_buffers`](crate::Submitter::register_buffers).
1665+
///
1666+
/// This operation might result in two completion queue entries.
1667+
/// See the `IORING_OP_SEND_ZC` section at [io_uring_enter][] for the exact semantics.
1668+
/// Notifications posted by this operation can be checked with [notif](crate::cqueue::notif).
1669+
///
1670+
/// [io_uring_enter]: https://man7.org/linux/man-pages/man2/io_uring_enter.2.html
16651671
pub struct SendZc {
16661672
fd: { impl sealed::UseFixed },
16671673
buf: { *const u8 },

0 commit comments

Comments
 (0)