mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
tap: add VNET_LE/VNET_BE operations
The linux tap and macvtap backends can be told to parse vnet headers according to little or big endian. This is done through the TUNSETVNETLE and TUNSETVNETBE ioctls. This patch brings all the plumbing for QEMU to use these APIs. Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
04b7a1523d
commit
c80cd6bb9c
6 changed files with 78 additions and 0 deletions
|
@ -198,6 +198,40 @@ void tap_fd_set_vnet_hdr_len(int fd, int len)
|
|||
}
|
||||
}
|
||||
|
||||
int tap_fd_set_vnet_le(int fd, int is_le)
|
||||
{
|
||||
int arg = is_le ? 1 : 0;
|
||||
|
||||
if (!ioctl(fd, TUNSETVNETLE, &arg)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if our kernel supports TUNSETVNETLE */
|
||||
if (errno == EINVAL) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
error_report("TUNSETVNETLE ioctl() failed: %s.\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
|
||||
int tap_fd_set_vnet_be(int fd, int is_be)
|
||||
{
|
||||
int arg = is_be ? 1 : 0;
|
||||
|
||||
if (!ioctl(fd, TUNSETVNETBE, &arg)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if our kernel supports TUNSETVNETBE */
|
||||
if (errno == EINVAL) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
error_report("TUNSETVNETBE ioctl() failed: %s.\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
|
||||
void tap_fd_set_offload(int fd, int csum, int tso4,
|
||||
int tso6, int ecn, int ufo)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue