diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-03-08 17:53:25 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-03-14 16:57:43 +0100 |
commit | d3eb0d7b59f6a1f3e78efc04c44e1c700b907332 (patch) | |
tree | dec4b921ed3b6bcc76fa239ab399a6a1ddf5960c /tap.h | |
parent | 4db947d17c8c7dac3b344c8ce0a266f7be159200 (diff) | |
download | passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar.gz passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar.bz2 passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar.lz passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar.xz passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.tar.zst passt-d3eb0d7b59f6a1f3e78efc04c44e1c700b907332.zip |
tap: Rename tap_iov_{base,len}
These two functions are typically used to calculate values to go into the
iov_base and iov_len fields of a struct iovec. They don't have to be used
for that, though. Rename them in terms of what they actually do: calculate
the base address and total length of the complete frame, including both L2
and tap specific headers.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.h')
-rw-r--r-- | tap.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -27,30 +27,30 @@ static inline size_t tap_hdr_len_(const struct ctx *c) } /** - * tap_iov_base() - Find start of tap frame + * tap_frame_base() - Find start of tap frame * @c: Execution context - * @taph: Pointer to L2 header buffer + * @taph: Pointer to L2 and tap specific header buffer * * Returns: pointer to the start of tap frame - suitable for an * iov_base to be passed to tap_send_frames()) */ -static inline void *tap_iov_base(const struct ctx *c, struct tap_hdr *taph) +static inline void *tap_frame_base(const struct ctx *c, struct tap_hdr *taph) { return (char *)(taph + 1) - tap_hdr_len_(c); } /** - * tap_iov_len() - Finalize tap frame and return total length + * tap_frame_len() - Finalize tap frame and return total length * @c: Execution context * @taph: Tap header to finalize - * @plen: L2 payload length (excludes L2 and tap specific headers) + * @plen: L3 packet length (excludes L2 and tap specific headers) * * Returns: length of the tap frame including L2 and tap specific * headers - suitable for an iov_len to be passed to * tap_send_frames() */ -static inline size_t tap_iov_len(const struct ctx *c, struct tap_hdr *taph, - size_t plen) +static inline size_t tap_frame_len(const struct ctx *c, struct tap_hdr *taph, + size_t plen) { if (c->mode == MODE_PASST) taph->vnet_len = htonl(plen + sizeof(taph->eh)); |