Skip to content

Commit

Permalink
net: move tap_probe_vnet_hdr() to tap-linux.c
Browse files Browse the repository at this point in the history
Only Linux has support for IFF_VNET_HDR

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
markmc authored and Anthony Liguori committed Oct 30, 2009
1 parent 15ac913 commit dc69004
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
4 changes: 4 additions & 0 deletions net/tap-aix.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ int tap_set_sndbuf(int fd, QemuOpts *opts)
return 0;
}

int tap_probe_vnet_hdr(int fd)
{
return 0;
}
5 changes: 5 additions & 0 deletions net/tap-bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ int tap_set_sndbuf(int fd, QemuOpts *opts)
{
return 0;
}

int tap_probe_vnet_hdr(int fd)
{
return 0;
}
12 changes: 12 additions & 0 deletions net/tap-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,15 @@ int tap_set_sndbuf(int fd, QemuOpts *opts)
}
return 0;
}

int tap_probe_vnet_hdr(int fd)
{
struct ifreq ifr;

if (ioctl(fd, TUNGETIFF, &ifr) != 0) {
qemu_error("TUNGETIFF ioctl() failed: %s\n", strerror(errno));
return 0;
}

return ifr.ifr_flags & IFF_VNET_HDR;
}
5 changes: 5 additions & 0 deletions net/tap-solaris.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,8 @@ int tap_set_sndbuf(int fd, QemuOpts *opts)
{
return 0;
}

int tap_probe_vnet_hdr(int fd)
{
return 0;
}
12 changes: 0 additions & 12 deletions net/tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,6 @@ void tap_using_vnet_hdr(VLANClientState *vc, int using_vnet_hdr)
s->using_vnet_hdr = using_vnet_hdr;
}

static int tap_probe_vnet_hdr(int fd)
{
struct ifreq ifr;

if (ioctl(fd, TUNGETIFF, &ifr) != 0) {
qemu_error("TUNGETIFF ioctl() failed: %s\n", strerror(errno));
return 0;
}

return ifr.ifr_flags & IFF_VNET_HDR;
}

void tap_set_offload(VLANClientState *vc, int csum, int tso4,
int tso6, int ecn, int ufo)
{
Expand Down
1 change: 1 addition & 0 deletions net/tap.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ void tap_using_vnet_hdr(VLANClientState *vc, int using_vnet_hdr);
void tap_set_offload(VLANClientState *vc, int csum, int tso4, int tso6, int ecn, int ufo);

int tap_set_sndbuf(int fd, QemuOpts *opts);
int tap_probe_vnet_hdr(int fd);

#endif /* QEMU_NET_TAP_H */

0 comments on commit dc69004

Please sign in to comment.