aboutgitcodebugslistschat
path: root/vu_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'vu_common.c')
-rw-r--r--vu_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/vu_common.c b/vu_common.c
index ce61fa6..c682498 100644
--- a/vu_common.c
+++ b/vu_common.c
@@ -293,3 +293,17 @@ err:
return -1;
}
+
+/**
+ * vu_pad() - Pad 802.3 frame to minimum length (60 bytes) if needed
+ * @iov: Buffer in iovec array where end of 802.3 frame is stored
+ * @l2len: Layer-2 length already filled in frame
+ */
+void vu_pad(struct iovec *iov, size_t l2len)
+{
+ if (l2len >= ETH_ZLEN)
+ return;
+
+ memset((char *)iov->iov_base + iov->iov_len, 0, ETH_ZLEN - l2len);
+ iov->iov_len += ETH_ZLEN - l2len;
+}