dev
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
July 2025
- 2 participants
- 4 discussions
This series introduces iov_tail to convey frame information
between functions.
This is only an API change, for the moment the memory pool
is only able to store contiguous buffer, so, except for
vhost-user in a special case, we only play with iovec array
with only one entry.
v7:
- Add a patch to fix comment style of 'Return:'
- Fix ignore_arp()/accept_arp()
- Fix coverity error
- Fix several comments
v6:
- Replaced iov_slice() with the clearer iov_tail_clone()
for creating iovec subsets.
- Standardized local header variable names (to *_storage suffix).
- Renamed functions for better semantics (e.g., ignore_arp to
accept_arp, packet_data to packet_get).
- Corrected OPTLEN_MAX definition in TCP.
- Addressed minor logic issues (e.g., DHCPv6 FQDN flags, NDP null check).
- Updated ipv6_l4hdr() return type to boolean.
- Improved comments and documentation across several modules.
v5:
- store in the pool iovec array with several entries
v4:
Prepare to introduce iovec array in the pool:
- passe iov_tail rather than pool to ndp,icmp, dhcp, dhcpv6 and arp
- remove unused pool macros
- add memory regions in the pool structure, this will allow us to use
the buf pointer to store the iovec array for vhost-user
v3:
Address comments from David
Laurent Vivier (31):
style: Fix 'Return' comment style
arp: Don't mix incoming and outgoing buffers
iov: Introduce iov_tail_clone() and iov_tail_drop().
iov: Update IOV_REMOVE_HEADER() and IOV_PEEK_HEADER()
tap: Use iov_tail with tap_add_packet()
packet: Use iov_tail with packet_add()
packet: Add packet_data()
arp: Convert to iov_tail
ndp: Convert to iov_tail
icmp: Convert to iov_tail
udp: Convert to iov_tail
tcp: Convert tcp_tap_handler() to use iov_tail
tcp: Convert tcp_data_from_tap() to use iov_tail
dhcpv6: move offset initialization out of dhcpv6_opt()
dhcpv6: Extract sending of NotOnLink status
dhcpv6: Convert to iov_tail
dhcpv6: Use iov_tail in dhcpv6_opt()
dhcp: Convert to iov_tail
ip: Use iov_tail in ipv6_l4hdr()
tap: Convert tap4_handler() to iov_tail
tap: Convert tap6_handler() to iov_tail
packet: rename packet_data() to packet_get()
arp: use iov_tail rather than pool
dhcp: use iov_tail rather than pool
dhcpv6: use iov_tail rather than pool
icmp: use iov_tail rather than pool
ndp: use iov_tail rather than pool
packet: remove PACKET_POOL() and PACKET_POOL_P()
packet: remove unused parameter from PACKET_POOL_DECL()
packet: add memory regions information into pool
packet: use buf to store iovec array
arp.c | 86 ++++++++++++-------
arp.h | 2 +-
checksum.c | 4 +-
conf.c | 12 +--
dhcp.c | 48 ++++++-----
dhcp.h | 2 +-
dhcpv6.c | 223 +++++++++++++++++++++++++++++++-------------------
dhcpv6.h | 2 +-
flow.c | 4 +-
flow_table.h | 2 +-
icmp.c | 43 ++++++----
icmp.h | 2 +-
inany.c | 4 +-
iov.c | 118 ++++++++++++++++++++++----
iov.h | 58 +++++++++----
ip.c | 32 ++++----
ip.h | 3 +-
lineread.c | 2 +-
ndp.c | 16 +++-
ndp.h | 4 +-
packet.c | 227 ++++++++++++++++++++++++++++++++++++++-------------
packet.h | 57 ++++++-------
pcap.c | 1 +
tap.c | 134 +++++++++++++++++-------------
tap.h | 8 +-
tcp.c | 67 ++++++++++-----
tcp_buf.c | 2 +-
tcp_splice.c | 4 +-
tcp_vu.c | 4 +-
udp.c | 37 ++++++---
udp_vu.c | 6 +-
util.c | 6 +-
util.h | 4 +-
vhost_user.c | 72 ++++++++--------
virtio.c | 6 +-
virtio.h | 24 ++++--
vu_common.c | 48 ++++-------
37 files changed, 870 insertions(+), 504 deletions(-)
--
2.49.0
2
33
18 Jul '25
The commit updates the style of function comments by adding parentheses
to function names in the descriptions where they are missing.
Done with:
---------8<------ fix_function_name.awk ---------8<------
/^\/\*\*/ {
check_next = 1;
print $0
next
}
check_next == 1 && / \* struct/ {
check_next = 0
print $0
next
}
check_next == 1 && / \* enum/ {
check_next = 0
print $0
next
}
check_next == 1 && /^ \* [^ (]* -/ {
modified_line = gensub(/^ \* ([^ ]*) -(.*)$/, " * \\1() -\\2", "g", $0)
print modified_line
check_next = 0;
next
}
{
print $0
check_next = 0
}
---------8<------ fix_function_name.awk ---------8<------
Then
for file in *.[ch]; do
cp ${file} ${file}.tmp && \
awk -f fix_function_name.awk ${file}.tmp > ${file}
done
Signed-off-by: Laurent Vivier <lvivier(a)redhat.com>
---
checksum.c | 4 ++--
conf.c | 4 ++--
fwd.h | 2 +-
iov.c | 2 +-
netlink.c | 2 +-
siphash.h | 2 +-
vhost_user.h | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/checksum.c b/checksum.c
index 0894eca89570..bebcb8aae50e 100644
--- a/checksum.c
+++ b/checksum.c
@@ -452,7 +452,7 @@ less_than_128_bytes:
}
/**
- * csum_unfolded - Calculate the unfolded checksum of a data buffer.
+ * csum_unfolded() - Calculate the unfolded checksum of a data buffer.
*
* @buf: Input buffer
* @len: Input length
@@ -481,7 +481,7 @@ uint32_t csum_unfolded(const void *buf, size_t len, uint32_t init)
}
#else /* __AVX2__ */
/**
- * csum_unfolded - Calculate the unfolded checksum of a data buffer.
+ * csum_unfolded() - Calculate the unfolded checksum of a data buffer.
*
* @buf: Input buffer
* @len: Input length
diff --git a/conf.c b/conf.c
index 36845e26d826..5969c9e856e7 100644
--- a/conf.c
+++ b/conf.c
@@ -65,7 +65,7 @@
const char *pasta_default_ifn = "tap0";
/**
- * next_chunk - Return the next piece of a string delimited by a character
+ * next_chunk() - Return the next piece of a string delimited by a character
* @s: String to search
* @c: Delimiter character
*
@@ -80,7 +80,7 @@ static char *next_chunk(const char *s, char c)
}
/**
- * port_range - Represents a non-empty range of ports
+ * port_range() - Represents a non-empty range of ports
* @first: First port number in the range
* @last: Last port number in the range (inclusive)
*
diff --git a/fwd.h b/fwd.h
index 0458a3c5078d..65c7c9641f55 100644
--- a/fwd.h
+++ b/fwd.h
@@ -27,7 +27,7 @@ enum fwd_ports_mode {
#define PORT_BITMAP_SIZE DIV_ROUND_UP(NUM_PORTS, 8)
/**
- * fwd_ports - Describes port forwarding for one protocol and direction
+ * fwd_ports() - Describes port forwarding for one protocol and direction
* @mode: Overall forwarding mode (all, none, auto, specific ports)
* @scan4: /proc/net fd to scan for IPv4 ports when in AUTO mode
* @scan6: /proc/net fd to scan for IPv6 ports when in AUTO mode
diff --git a/iov.c b/iov.c
index 91e87a740f0a..d69df61d0d17 100644
--- a/iov.c
+++ b/iov.c
@@ -181,7 +181,7 @@ bool iov_tail_prune(struct iov_tail *tail)
}
/**
- * iov_tail_size - Calculate the total size of an IO vector tail
+ * iov_tail_size() - Calculate the total size of an IO vector tail
* @tail: IO vector tail
*
* Returns: The total size in bytes.
diff --git a/netlink.c b/netlink.c
index ee9325a054a2..8f82e73bb2d1 100644
--- a/netlink.c
+++ b/netlink.c
@@ -199,7 +199,7 @@ static struct nlmsghdr *nl_next(int s, char *buf, struct nlmsghdr *nh, ssize_t *
}
/**
- * nl_foreach - 'for' type macro to step through netlink response messages
+ * nl_foreach() - 'for' type macro to step through netlink response messages
* nl_foreach_oftype - as above, but only messages of expected type
* @nh: Steps through each response header (struct nlmsghdr *)
* @status: When loop exits indicates if there was an error (ssize_t)
diff --git a/siphash.h b/siphash.h
index a2ca2a9989d5..e760236e8063 100644
--- a/siphash.h
+++ b/siphash.h
@@ -99,7 +99,7 @@ static inline void siphash_feed(struct siphash_state *state, uint64_t in)
}
/**
- * siphash_final - Finalize SipHash calculations
+ * siphash_final() - Finalize SipHash calculations
* @v: siphash state (4 x 64-bit integers)
* @len: Total length of input data
* @tail: Final data for the hash (<= 7 bytes)
diff --git a/vhost_user.h b/vhost_user.h
index f2ae2da63b38..e806a9e54e00 100644
--- a/vhost_user.h
+++ b/vhost_user.h
@@ -217,7 +217,7 @@ struct vhost_user_msg {
})
/**
- * vu_queue_enabled - Return state of a virtqueue
+ * vu_queue_enabled() - Return state of a virtqueue
* @vq: virtqueue to check
*
* Return: true if the virqueue is enabled, false otherwise
@@ -228,7 +228,7 @@ static inline bool vu_queue_enabled(const struct vu_virtq *vq)
}
/**
- * vu_queue_started - Return state of a virtqueue
+ * vu_queue_started() - Return state of a virtqueue
* @vq: virtqueue to check
*
* Return: true if the virqueue is started, false otherwise
--
2.49.0
2
1
We always use imperative (no 'Returns:'), no tab after the ':' and
only one space, the first character is always lowercase.
This is fixed with:
sed -i "s/Returns:/Return:/;s/Return: /Return: /;s/Return: */Return: /;s/Return: \([A-Z]\)/Return: \L\1/" *.[ch]
And manually updated to fix alignment of multiline comment and words
that must keep uppercase (like IPv4, TCP, UDP, Layer-4).
Signed-off-by: Laurent Vivier <lvivier(a)redhat.com>
---
checksum.c | 4 ++--
conf.c | 12 ++++++------
flow.c | 4 ++--
flow_table.h | 2 +-
icmp.c | 2 +-
inany.c | 4 ++--
iov.c | 22 +++++++++++-----------
iov.h | 8 ++++----
lineread.c | 2 +-
tap.h | 4 ++--
tcp.c | 6 +++---
tcp_splice.c | 4 ++--
tcp_vu.c | 4 ++--
udp.c | 4 ++--
udp_vu.c | 4 ++--
util.c | 6 +++---
util.h | 4 ++--
vhost_user.c | 44 ++++++++++++++++++++++----------------------
virtio.c | 2 +-
virtio.h | 6 +++---
20 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/checksum.c b/checksum.c
index 0894eca89570..13c8e33c2282 100644
--- a/checksum.c
+++ b/checksum.c
@@ -145,7 +145,7 @@ uint16_t csum_ip4_header(uint16_t l3len, uint8_t protocol,
* @proto: Protocol number
* @saddr: Source address
* @daddr: Destination address
- * Returns: Partial checksum of the IPv4 header
+ * Return: partial checksum of the IPv4 header
*/
uint32_t proto_ipv4_header_psum(uint16_t l4len, uint8_t protocol,
struct in_addr saddr, struct in_addr daddr)
@@ -225,7 +225,7 @@ void csum_icmp4(struct icmphdr *icmp4hr, const void *payload, size_t dlen)
* @proto: Protocol number
* @saddr: Source address
* @daddr: Destination address
- * Returns: Partial checksum of the IPv6 header
+ * Return: partial checksum of the IPv6 header
*/
uint32_t proto_ipv6_header_psum(uint16_t payload_len, uint8_t protocol,
const struct in6_addr *saddr,
diff --git a/conf.c b/conf.c
index 36845e26d826..a80a05364bcc 100644
--- a/conf.c
+++ b/conf.c
@@ -69,7 +69,7 @@ const char *pasta_default_ifn = "tap0";
* @s: String to search
* @c: Delimiter character
*
- * Return: If another @c is found in @s, returns a pointer to the
+ * Return: if another @c is found in @s, returns a pointer to the
* character *after* the delimiter, if no further @c is in @s,
* return NULL
*/
@@ -384,7 +384,7 @@ mode_conflict:
* @addr: Guest nameserver IPv4 address
* @idx: Index of free entry in array of IPv4 resolvers
*
- * Return: Number of entries added (0 or 1)
+ * Return: number of entries added (0 or 1)
*/
static unsigned add_dns4(struct ctx *c, const struct in_addr *addr,
unsigned idx)
@@ -402,7 +402,7 @@ static unsigned add_dns4(struct ctx *c, const struct in_addr *addr,
* @addr: Guest nameserver IPv6 address
* @idx: Index of free entry in array of IPv6 resolvers
*
- * Return: Number of entries added (0 or 1)
+ * Return: number of entries added (0 or 1)
*/
static unsigned add_dns6(struct ctx *c, const struct in6_addr *addr,
unsigned idx)
@@ -656,7 +656,7 @@ static void conf_pasta_ns(int *netns_only, char *userns, char *netns,
/** conf_ip4_prefix() - Parse an IPv4 prefix length or netmask
* @arg: Netmask in dotted decimal or prefix length
*
- * Return: Validated prefix length on success, -1 on failure
+ * Return: validated prefix length on success, -1 on failure
*/
static int conf_ip4_prefix(const char *arg)
{
@@ -683,7 +683,7 @@ static int conf_ip4_prefix(const char *arg)
* @ifi: Host interface to attempt (0 to determine one)
* @ip4: IPv4 context (will be written)
*
- * Return: Interface index for IPv4, or 0 on failure.
+ * Return: interface index for IPv4, or 0 on failure.
*/
static unsigned int conf_ip4(unsigned int ifi, struct ip4_ctx *ip4)
{
@@ -755,7 +755,7 @@ static void conf_ip4_local(struct ip4_ctx *ip4)
* @ifi: Host interface to attempt (0 to determine one)
* @ip6: IPv6 context (will be written)
*
- * Return: Interface index for IPv6, or 0 on failure.
+ * Return: interface index for IPv6, or 0 on failure.
*/
static unsigned int conf_ip6(unsigned int ifi, struct ip6_ctx *ip6)
{
diff --git a/flow.c b/flow.c
index da5c8131c1af..00885f67f365 100644
--- a/flow.c
+++ b/flow.c
@@ -627,7 +627,7 @@ static uint64_t flow_sidx_hash(const struct ctx *c, flow_sidx_t sidx)
* @hash: Raw hash value for flow & side
* @sidx: Flow and side to find bucket for
*
- * Return: If @sidx is in the hash table, its current bucket, otherwise a
+ * Return: if @sidx is in the hash table, its current bucket, otherwise a
* suitable free bucket for it.
*/
static inline unsigned flow_hash_probe_(uint64_t hash, flow_sidx_t sidx)
@@ -647,7 +647,7 @@ static inline unsigned flow_hash_probe_(uint64_t hash, flow_sidx_t sidx)
* @c: Execution context
* @sidx: Flow and side to find bucket for
*
- * Return: If @sidx is in the hash table, its current bucket, otherwise a
+ * Return: if @sidx is in the hash table, its current bucket, otherwise a
* suitable free bucket for it.
*/
static inline unsigned flow_hash_probe(const struct ctx *c, flow_sidx_t sidx)
diff --git a/flow_table.h b/flow_table.h
index 3f3f4b7527bf..5ee13acc7253 100644
--- a/flow_table.h
+++ b/flow_table.h
@@ -140,7 +140,7 @@ static inline uint8_t pif_at_sidx(flow_sidx_t sidx)
/** flowside_at_sidx() - Retrieve a specific flowside
* @sidx: Flow & side index
*
- * Return: Flowside for the flow & side given by @sidx
+ * Return: flowside for the flow & side given by @sidx
*/
static inline const struct flowside *flowside_at_sidx(flow_sidx_t sidx)
{
diff --git a/icmp.c b/icmp.c
index 7e2b3423a8d1..95f38c1e2a3a 100644
--- a/icmp.c
+++ b/icmp.c
@@ -163,7 +163,7 @@ static void icmp_ping_close(const struct ctx *c,
* @saddr: Source address
* @daddr: Destination address
*
- * Return: Newly opened ping flow, or NULL on failure
+ * Return: newly opened ping flow, or NULL on failure
*/
static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c,
sa_family_t af, uint16_t id,
diff --git a/inany.c b/inany.c
index f5483bfc65f7..65a39f9e258c 100644
--- a/inany.c
+++ b/inany.c
@@ -25,7 +25,7 @@ const union inany_addr inany_any4 = INANY_INIT4(IN4ADDR_ANY_INIT);
* @dst: output buffer, minimum INANY_ADDRSTRLEN bytes
* @size: size of buffer at @dst
*
- * Return: On success, a non-null pointer to @dst, NULL on failure
+ * Return: on success, a non-null pointer to @dst, NULL on failure
*/
const char *inany_ntop(const union inany_addr *src, char *dst, socklen_t size)
{
@@ -41,7 +41,7 @@ const char *inany_ntop(const union inany_addr *src, char *dst, socklen_t size)
* @src: IPv[46] address
* @dst: output buffer, filled with parsed address
*
- * Return: On success, 1, if no parseable address is found, 0
+ * Return: on success, 1, if no parseable address is found, 0
*/
int inany_pton(const char *src, union inany_addr *dst)
{
diff --git a/iov.c b/iov.c
index 91e87a740f0a..f72145b30d1b 100644
--- a/iov.c
+++ b/iov.c
@@ -67,7 +67,7 @@ size_t iov_skip_bytes(const struct iovec *iov, size_t n,
* @buf: Pointer to the source buffer containing the data to copy.
* @bytes: Total number of bytes to copy from buf to iov.
*
- * Returns: The number of bytes successfully copied.
+ * Return: the number of bytes successfully copied.
*/
size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt,
size_t offset, const void *buf, size_t bytes)
@@ -107,7 +107,7 @@ size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt,
* @buf: Pointer to the destination buffer where data will be copied.
* @bytes: Total number of bytes to copy from iov to buf.
*
- * Returns: The number of bytes successfully copied.
+ * Return: the number of bytes successfully copied.
*/
/* cppcheck-suppress unusedFunction */
size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt,
@@ -144,7 +144,7 @@ size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt,
* scatter/gather I/O vector.
* @iov_cnt: Number of elements in the iov array.
*
- * Returns: The total size in bytes.
+ * Return: the total size in bytes.
*/
size_t iov_size(const struct iovec *iov, size_t iov_cnt)
{
@@ -167,7 +167,7 @@ size_t iov_size(const struct iovec *iov, size_t iov_cnt)
* includes buffers that are actually needed. This will avoid stepping through
* unnecessary elements of the underlying IO vector on future operations.
*
- * Return: true if the tail still contains any bytes, otherwise false
+ * Return: true if the tail still contains any bytes, otherwise false
*/
bool iov_tail_prune(struct iov_tail *tail)
{
@@ -184,7 +184,7 @@ bool iov_tail_prune(struct iov_tail *tail)
* iov_tail_size - Calculate the total size of an IO vector tail
* @tail: IO vector tail
*
- * Returns: The total size in bytes.
+ * Return: the total size in bytes.
*/
size_t iov_tail_size(struct iov_tail *tail)
{
@@ -200,9 +200,9 @@ size_t iov_tail_size(struct iov_tail *tail)
*
* @tail may be pruned, but will represent the same bytes as before.
*
- * Returns: Pointer to the first @len logical bytes of the tail, NULL if that
- * overruns the IO vector, is not contiguous or doesn't have the
- * requested alignment.
+ * Return: pointer to the first @len logical bytes of the tail, NULL if that
+ * overruns the IO vector, is not contiguous or doesn't have the
+ * requested alignment.
*/
/* cppcheck-suppress [staticFunction,unmatchedSuppression] */
void *iov_peek_header_(struct iov_tail *tail, size_t len, size_t align)
@@ -234,9 +234,9 @@ void *iov_peek_header_(struct iov_tail *tail, size_t len, size_t align)
* On success, @tail is updated so that it longer includes the bytes of the
* returned header.
*
- * Returns: Pointer to the first @len logical bytes of the tail, NULL if that
- * overruns the IO vector, is not contiguous or doesn't have the
- * requested alignment.
+ * Return: pointer to the first @len logical bytes of the tail, NULL if that
+ * overruns the IO vector, is not contiguous or doesn't have the
+ * requested alignment.
*/
void *iov_remove_header_(struct iov_tail *tail, size_t len, size_t align)
{
diff --git a/iov.h b/iov.h
index 9855bf0c0c32..3fc96ab9755a 100644
--- a/iov.h
+++ b/iov.h
@@ -82,8 +82,8 @@ void *iov_remove_header_(struct iov_tail *tail, size_t len, size_t align);
*
* @tail_ may be pruned, but will represent the same bytes as before.
*
- * Returns: Pointer of type (@type_ *) located at the start of @tail_, NULL if
- * we can't get a contiguous and aligned pointer.
+ * Return: pointer of type (@type_ *) located at the start of @tail_, NULL if
+ * we can't get a contiguous and aligned pointer.
*/
#define IOV_PEEK_HEADER(tail_, type_) \
((type_ *)(iov_peek_header_((tail_), \
@@ -97,8 +97,8 @@ void *iov_remove_header_(struct iov_tail *tail, size_t len, size_t align);
* On success, @tail_ is updated so that it longer includes the bytes of the
* returned header.
*
- * Returns: Pointer of type (@type_ *) located at the old start of @tail_, NULL
- * if we can't get a contiguous and aligned pointer.
+ * Return: pointer of type (@type_ *) located at the old start of @tail_, NULL
+ * if we can't get a contiguous and aligned pointer.
*/
#define IOV_REMOVE_HEADER(tail_, type_) \
((type_ *)(iov_remove_header_((tail_), \
diff --git a/lineread.c b/lineread.c
index 0387f4a0c5b2..4225de6145d8 100644
--- a/lineread.c
+++ b/lineread.c
@@ -70,7 +70,7 @@ static ssize_t peek_line(struct lineread *lr, bool eof)
* @lr: Line reader state structure
* @line: Place a pointer to the next line in this variable
*
- * Return: Length of line read on success, 0 on EOF, negative on error
+ * Return: length of line read on success, 0 on EOF, negative on error
*/
ssize_t lineread_get(struct lineread *lr, char **line)
{
diff --git a/tap.h b/tap.h
index 6fe3d15d1337..936ae9371fd6 100644
--- a/tap.h
+++ b/tap.h
@@ -46,8 +46,8 @@ struct tap_hdr {
* @c: Execution context
* @taph: Pointer to tap specific header buffer
*
- * Returns: A struct iovec covering the correct portion of @taph to use as the
- * tap specific header in the current configuration.
+ * Return: a struct iovec covering the correct portion of @taph to use as the
+ * tap specific header in the current configuration.
*/
static inline struct iovec tap_hdr_iov(const struct ctx *c,
struct tap_hdr *thdr)
diff --git a/tcp.c b/tcp.c
index f43c1e27c112..2b8846636e73 100644
--- a/tcp.c
+++ b/tcp.c
@@ -438,7 +438,7 @@ static struct tcp_tap_conn *conn_at_sidx(flow_sidx_t sidx)
* @conn: Pointer to the TCP connection structure
* @offset: Offset in bytes
*
- * Return: -1 when it fails, 0 otherwise.
+ * Return: -1 when it fails, 0 otherwise.
*/
int tcp_set_peek_offset(const struct tcp_tap_conn *conn, int offset)
{
@@ -1319,7 +1319,7 @@ static int tcp_conn_new_sock(sa_family_t af)
* tcp_conn_sock() - Obtain a connectable socket in the host/init namespace
* @af: Address family (AF_INET or AF_INET6)
*
- * Return: Socket fd on success, -errno on failure
+ * Return: socket fd on success, -errno on failure
*/
int tcp_conn_sock(sa_family_t af)
{
@@ -2606,7 +2606,7 @@ static bool tcp_probe_peek_offset_cap(sa_family_t af)
/**
* tcp_probe_tcp_info() - Check what data TCP_INFO reports
*
- * Return: Number of bytes returned by TCP_INFO getsockopt()
+ * Return: number of bytes returned by TCP_INFO getsockopt()
*/
static socklen_t tcp_probe_tcp_info(void)
{
diff --git a/tcp_splice.c b/tcp_splice.c
index 60455d6459b9..26cb63064583 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -95,7 +95,7 @@ static int tcp_conn_sock_ns(const struct ctx *c, sa_family_t af);
* conn_at_sidx() - Get spliced TCP connection specific flow at given sidx
* @sidx: Flow and side to retrieve
*
- * Return: Spliced TCP connection at @sidx, or NULL of @sidx is invalid.
+ * Return: spliced TCP connection at @sidx, or NULL of @sidx is invalid.
* Asserts if the flow at @sidx is not FLOW_TCP_SPLICE.
*/
static struct tcp_splice_conn *conn_at_sidx(flow_sidx_t sidx)
@@ -402,7 +402,7 @@ static int tcp_splice_connect(const struct ctx *c, struct tcp_splice_conn *conn)
* @c: Execution context
* @af: Address family (AF_INET or AF_INET6)
*
- * Return: Socket fd in the namespace on success, -errno on failure
+ * Return: socket fd in the namespace on success, -errno on failure
*/
static int tcp_conn_sock_ns(const struct ctx *c, sa_family_t af)
{
diff --git a/tcp_vu.c b/tcp_vu.c
index f3914c7c2195..cb39bc20355b 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -43,7 +43,7 @@ static int head[VIRTQUEUE_MAX_SIZE + 1];
* tcp_vu_hdrlen() - return the size of the header in level 2 frame (TCP)
* @v6: Set for IPv6 packet
*
- * Return: Return the size of the header
+ * Return: return the size of the header
*/
static size_t tcp_vu_hdrlen(bool v6)
{
@@ -351,7 +351,7 @@ static void tcp_vu_prepare(const struct ctx *c, struct tcp_tap_conn *conn,
* @c: Execution context
* @conn: Connection pointer
*
- * Return: Negative on connection reset, 0 otherwise
+ * Return: negative on connection reset, 0 otherwise
*/
int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn)
{
diff --git a/udp.c b/udp.c
index 65a52e0755c0..75edc2054d4a 100644
--- a/udp.c
+++ b/udp.c
@@ -656,7 +656,7 @@ fail:
* (only used if @sidx == FLOW_SIDX_NONE)
* @port: Local port number of @s (only used if @sidx == FLOW_SIDX_NONE)
*
- * Return: Number of errors handled, or < 0 if we have an unrecoverable error
+ * Return: number of errors handled, or < 0 if we have an unrecoverable error
*/
static int udp_sock_errs(const struct ctx *c, int s, flow_sidx_t sidx,
uint8_t pif, in_port_t port)
@@ -739,7 +739,7 @@ static int udp_peek_addr(int s, union sockaddr_inany *src,
* @mmh: mmsghdr array to receive into
* @n: Maximum number of datagrams to receive
*
- * Return: Number of datagrams received
+ * Return: number of datagrams received
*
* #syscalls recvmmsg arm:recvmmsg_time64 i686:recvmmsg_time64
*/
diff --git a/udp_vu.c b/udp_vu.c
index 1f89509c6f72..2fb7b900ca31 100644
--- a/udp_vu.c
+++ b/udp_vu.c
@@ -40,7 +40,7 @@ static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE];
* udp_vu_hdrlen() - return the size of the header in level 2 frame (UDP)
* @v6: Set for IPv6 packet
*
- * Return: Return the size of the header
+ * Return: return the size of the header
*/
static size_t udp_vu_hdrlen(bool v6)
{
@@ -64,7 +64,7 @@ static size_t udp_vu_hdrlen(bool v6)
* @v6: Set for IPv6 connections
* @dlen: Size of received data (output)
*
- * Return: Number of iov entries used to store the datagram
+ * Return: number of iov entries used to store the datagram
*/
static int udp_vu_sock_recv(const struct ctx *c, int s, bool v6, ssize_t *dlen)
{
diff --git a/util.c b/util.c
index 7b245ccc01f9..3e93d475839f 100644
--- a/util.c
+++ b/util.c
@@ -764,7 +764,7 @@ int read_remainder(int fd, const struct iovec *iov, size_t cnt, size_t skip)
* @dst: output buffer, minimum SOCKADDR_STRLEN bytes
* @size: size of buffer at @dst
*
- * Return: On success, a non-null pointer to @dst, NULL on failure
+ * Return: on success, a non-null pointer to @dst, NULL on failure
*/
const char *sockaddr_ntop(const void *sa, char *dst, socklen_t size)
{
@@ -824,7 +824,7 @@ const char *sockaddr_ntop(const void *sa, char *dst, socklen_t size)
* @dst: Output buffer, minimum ETH_ADDRSTRLEN bytes
* @size: Size of buffer at @dst
*
- * Return: On success, a non-null pointer to @dst, NULL on failure
+ * Return: on success, a non-null pointer to @dst, NULL on failure
*/
const char *eth_ntop(const unsigned char *mac, char *dst, size_t size)
{
@@ -841,7 +841,7 @@ const char *eth_ntop(const unsigned char *mac, char *dst, size_t size)
/** str_ee_origin() - Convert socket extended error origin to a string
* @ee: Socket extended error structure
*
- * Return: Static string describing error origin
+ * Return: static string describing error origin
*/
const char *str_ee_origin(const struct sock_extended_err *ee)
{
diff --git a/util.h b/util.h
index 5947337a9b27..b5b1b31b8ff8 100644
--- a/util.h
+++ b/util.h
@@ -152,7 +152,7 @@ void abort_with_msg(const char *fmt, ...)
* ntohl_unaligned() - Read 32-bit BE value from a possibly unaligned address
* @p: Pointer to the BE value in memory
*
- * Returns: Host-order value of 32-bit BE quantity at @p
+ * Return: host-order value of 32-bit BE quantity at @p
*/
static inline uint32_t ntohl_unaligned(const void *p)
{
@@ -231,7 +231,7 @@ bool snprintf_check(char *str, size_t size, const char *format, ...);
* af_name() - Return name of an address family
* @af: Address/protocol family (AF_INET or AF_INET6)
*
- * Returns: Name of the protocol family as a string
+ * Return: name of the protocol family as a string
*/
static inline const char *af_name(sa_family_t af)
{
diff --git a/vhost_user.c b/vhost_user.c
index e8377bb68608..e7fb0496132a 100644
--- a/vhost_user.c
+++ b/vhost_user.c
@@ -183,7 +183,7 @@ static void vmsg_set_reply_u64(struct vhost_user_msg *vmsg, uint64_t val)
* @conn_fd: vhost-user command socket
* @vmsg: vhost-user message
*
- * Return: 0 if recvmsg() has been interrupted or if there's no data to read,
+ * Return: 0 if recvmsg() has been interrupted or if there's no data to read,
* 1 if a message has been received
*/
static int vu_message_read_default(int conn_fd, struct vhost_user_msg *vmsg)
@@ -316,7 +316,7 @@ static void vu_send_reply(int conn_fd, struct vhost_user_msg *vmsg)
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as a reply is requested
+ * Return: true as a reply is requested
*/
static bool vu_get_features_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -354,7 +354,7 @@ static void vu_set_enable_all_rings(struct vu_dev *vdev, bool enable)
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_features_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -379,7 +379,7 @@ static bool vu_set_features_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_owner_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -396,7 +396,7 @@ static bool vu_set_owner_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vq: Virtqueue
*
- * Return: True if ring cannot be mapped to our address space
+ * Return: true if ring cannot be mapped to our address space
*/
static bool map_ring(struct vu_dev *vdev, struct vu_virtq *vq)
{
@@ -418,7 +418,7 @@ static bool map_ring(struct vu_dev *vdev, struct vu_virtq *vq)
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*
* #syscalls:vu mmap|mmap2 munmap
*/
@@ -566,7 +566,7 @@ void vu_log_write(const struct vu_dev *vdev, uint64_t address, uint64_t length)
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as a reply is requested
+ * Return: true as a reply is requested
*
* #syscalls:vu mmap|mmap2 munmap
*/
@@ -610,7 +610,7 @@ static bool vu_set_log_base_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_log_fd_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -633,7 +633,7 @@ static bool vu_set_log_fd_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_num_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -653,7 +653,7 @@ static bool vu_set_vring_num_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_addr_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -699,7 +699,7 @@ static bool vu_set_vring_addr_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_base_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -720,7 +720,7 @@ static bool vu_set_vring_base_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as a reply is requested
+ * Return: true as a reply is requested
*/
static bool vu_get_vring_base_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -794,7 +794,7 @@ static void vu_check_queue_msg_file(struct vhost_user_msg *vmsg)
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_kick_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -834,7 +834,7 @@ static bool vu_set_vring_kick_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_call_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -869,7 +869,7 @@ static bool vu_set_vring_call_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_err_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -898,7 +898,7 @@ static bool vu_set_vring_err_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as a reply is requested
+ * Return: true as a reply is requested
*/
static bool vu_get_protocol_features_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -919,7 +919,7 @@ static bool vu_get_protocol_features_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_protocol_features_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -938,7 +938,7 @@ static bool vu_set_protocol_features_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as a reply is requested
+ * Return: true as a reply is requested
*/
static bool vu_get_queue_num_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -955,7 +955,7 @@ static bool vu_get_queue_num_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_set_vring_enable_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -981,7 +981,7 @@ static bool vu_set_vring_enable_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: False as no reply is requested
+ * Return: false as no reply is requested
*/
static bool vu_send_rarp_exec(struct vu_dev *vdev,
struct vhost_user_msg *vmsg)
@@ -1004,7 +1004,7 @@ static bool vu_send_rarp_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as the reply contains 0 to indicate success
+ * Return: true as the reply contains 0 to indicate success
* and set bit 8 as we don't provide our own fd.
*/
static bool vu_set_device_state_fd_exec(struct vu_dev *vdev,
@@ -1037,7 +1037,7 @@ static bool vu_set_device_state_fd_exec(struct vu_dev *vdev,
* @vdev: vhost-user device
* @vmsg: vhost-user message
*
- * Return: True as the reply contains the migration result
+ * Return: true as the reply contains the migration result
*/
/* cppcheck-suppress constParameterCallback */
static bool vu_check_device_state_exec(struct vu_dev *vdev,
diff --git a/virtio.c b/virtio.c
index 83906aab8d02..ed7842b4c78a 100644
--- a/virtio.c
+++ b/virtio.c
@@ -571,7 +571,7 @@ void vu_queue_unpop(struct vu_virtq *vq)
* @vq: Virtqueue
* @num: Number of element to unpop
*
- * Return: True on success, false if not
+ * Return: true on success, false if not
*/
bool vu_queue_rewind(struct vu_virtq *vq, unsigned int num)
{
diff --git a/virtio.h b/virtio.h
index d8beb884c61d..32757458ea95 100644
--- a/virtio.h
+++ b/virtio.h
@@ -140,7 +140,7 @@ struct vu_virtq_element {
* @features: Features set
* @fb: Feature bit to check
*
- * Return: True if the feature bit is set
+ * Return: true if the feature bit is set
*/
static inline bool has_feature(uint64_t features, unsigned int fbit)
{
@@ -152,7 +152,7 @@ static inline bool has_feature(uint64_t features, unsigned int fbit)
* @vdev: Vhost-user device
* @fbit: Feature to check
*
- * Return: True if the feature is available
+ * Return: true if the feature is available
*/
static inline bool vu_has_feature(const struct vu_dev *vdev,
unsigned int fbit)
@@ -165,7 +165,7 @@ static inline bool vu_has_feature(const struct vu_dev *vdev,
* @vdev: Vhost-user device
* @fbit: Feature to check
*
- * Return: True if the feature is available
+ * Return: true if the feature is available
*/
/* cppcheck-suppress unusedFunction */
static inline bool vu_has_protocol_feature(const struct vu_dev *vdev,
--
2.49.0
2
1
vhost-net is a kernel device that allows to read packets from a tap
device using virtio queues instead of regular read(2) and write(2).
This enables a more eficient packet processing, as the memory can
be written directly by the kernel to the userspace and back, instead
of wasting bandwith on copies, and it enables to batch many packets
in a single notification (through eventfds) both tx and rx.
Namespace tx performance improves from ~26.3Gbit/s to ~36.9Gbit/s.
Namespace rx performance improves from ~16BGbit/s to ~17.26Gbit/s.
RFC: At this moment only these are supported:
* Receive l2 packets from the vhost kernel to pasta
* Send l4 tcp socket received data through vhost-kernel to namespace.
TODO: Add vhost zerocopy in the tests, and compare with veth.
TODO: Implement at least UDP tx. Or maybe we want UDP to be write(2) because
of latency?
TODO: Check style for variable declarations in for loops and use of curly
brackets as long as they wrap more than a line.
TODO: kerneldoc style function header comments
--
v2: Add TCP tx, and integrated some comments from the previous series. Please
check each patch message for details.
Eugenio Pérez (11):
tap: implement vhost_call_cb
tap: add die() on vhost error
Replace tx tap hdr with virtio_nethdr_mrg_rxbuf
tcp: export memory regions to vhost
virtio: Fill .next in tx queue
tap: move static iov_sock to tcp_buf_data_from_sock
tap: support tx through vhost
tap: add tap_free_old_xmit
tcp: start conversion to circular buffer
Add poll(2) to used_idx
tcp_buf: adding TCP tx circular buffer
arp.c | 2 +-
epoll_type.h | 4 +
passt.c | 12 +-
passt.h | 11 +-
tap.c | 489 +++++++++++++++++++++++++++++++++++++++++++++++++--
tap.h | 13 +-
tcp.c | 2 +-
tcp_buf.c | 179 +++++++++++++++----
tcp_buf.h | 19 ++
udp.c | 2 +-
10 files changed, 675 insertions(+), 58 deletions(-)
--
2.50.0
2
12