mirror of
https://passt.top/passt
synced 2025-05-28 12:25:34 +02:00
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>
This commit is contained in:
parent
4db947d17c
commit
d3eb0d7b59
3 changed files with 17 additions and 17 deletions
14
tap.h
14
tap.h
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue