Skip to content

Commit

Permalink
Merge pull request #26 from DouglasGray/update-docs
Browse files Browse the repository at this point in the history
update docs after move to libxdp
  • Loading branch information
DouglasGray authored Apr 30, 2024
2 parents f9957c1 + 50adbb9 commit 78afe8a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
Cargo.lock
perf*
*.svg
*.svg
.idea
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# xsk-rs

A Rust interface for Linux AF_XDP sockets using libbpf.
A Rust interface for Linux AF_XDP sockets using libxdp.

[API documentation](https://docs.rs/xsk-rs).

Expand Down
4 changes: 2 additions & 2 deletions src/config/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ impl ConfigBuilder {
self
}

/// Set the [`LibbpfFlags`]. Default is no flags set.
pub fn libbpf_flags(&mut self, flags: LibxdpFlags) -> &mut Self {
/// Set the [`LibxdpFlags`]. Default is no flags set.
pub fn libxdp_flags(&mut self, flags: LibxdpFlags) -> &mut Self {
self.config.libxdp_flags = flags;
self
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
//! panic!("no matching packets received")
//! ```
#![deny(missing_docs)]
#![deny(rustdoc::missing_doc_code_examples)]
#![deny(missing_debug_implementations)]
#![deny(unsafe_op_in_unsafe_fn)]
use cfg_if::cfg_if;
Expand Down
4 changes: 2 additions & 2 deletions src/socket/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ impl AsRawFd for Fd {
///
/// May be required, for example, in the case where the default
/// libbpf program has not been loaded (using the
/// [`XSK_LIBBPF_FLAGS_INHIBIT_PROG_LOAD`] flag) and the socket's
/// [`XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD`] flag) and the socket's
/// file descriptor must be available to register it in the
/// `XSKMAP`.
///
/// [`XSK_LIBBPF_FLAGS_INHIBIT_PROG_LOAD`]: crate::config::LibbpfFlags::XSK_LIBBPF_FLAGS_INHIBIT_PROG_LOAD
/// [`XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD`]: crate::config::LibxdpFlags::XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD
#[inline]
fn as_raw_fd(&self) -> RawFd {
self.id
Expand Down
15 changes: 7 additions & 8 deletions src/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,20 @@ impl Socket {
/// May require root permissions to create successfully.
///
/// Whether you can expect the returned `Option<(FillQueue,
/// CompQueue)>` to be [`Some`](Option::Some) or
/// [`None`](Option::None) depends on a couple of things:
/// CompQueue)>` to be [`Some`] or [`None`] depends on a couple of
/// things:
///
/// 1. If the [`Umem`] is currently shared (i.e. being used for
/// >=1 AF_XDP sockets elsewhere):
///
/// - If the `(if_name, queue_id)` pair is not bound to,
/// expect [`Some`](Option::Some).
/// - If the `(if_name, queue_id)` pair is not bound to, expect
/// [`Some`].
///
/// - If the `(if_name, queue_id)` pair is bound to, expect
/// [`None`](Option::None) and use the [`FillQueue`] and
/// [`CompQueue`] originally returned for this pair.
/// [`None`] and use the [`FillQueue`] and [`CompQueue`]
/// originally returned for this pair.
///
/// 2. If the [`Umem`] is not currently shared, expect
/// [`Some`](Option::Some).
/// 2. If the [`Umem`] is not currently shared, expect [`Some`].
///
/// For further details on using a shared [`Umem`] please see the
/// [docs](https://www.kernel.org/doc/html/latest/networking/af_xdp.html#xdp-shared-umem-bind-flag).
Expand Down
4 changes: 2 additions & 2 deletions tests/umem_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async fn shared_umem_does_not_return_new_fq_and_cq_when_sockets_are_bound_to_sam

let (_sender_tx_q, _sender_rx_q, sender_fq_and_cq) = Socket::new(
SocketConfig::builder()
.libbpf_flags(LibxdpFlags::XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD)
.libxdp_flags(LibxdpFlags::XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD)
.build(),
&umem,
&dev1_config.if_name().parse().unwrap(),
Expand All @@ -94,7 +94,7 @@ async fn shared_umem_does_not_return_new_fq_and_cq_when_sockets_are_bound_to_sam

let (_receiver_tx_q, _receiver_rx_q, receiver_fq_and_cq) = Socket::new(
SocketConfig::builder()
.libbpf_flags(LibxdpFlags::XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD)
.libxdp_flags(LibxdpFlags::XSK_LIBXDP_FLAGS_INHIBIT_PROG_LOAD)
.build(),
&umem,
&dev1_config.if_name().parse().unwrap(),
Expand Down

0 comments on commit 78afe8a

Please sign in to comment.