net/tap: net_init_tap(): merge fd=, fds= and helper= cases into one
Now fd= and helper= cases are just a duplication of fds= case with queues=1. Let's merge them all. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Ben Chaney <bchaney@akamai.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
committed by
Jason Wang
parent
7a3c892c3d
commit
14d7eb1355
26
net/tap.c
26
net/tap.c
@@ -903,19 +903,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (tap->fd) {
|
||||
vnet_hdr = tap_probe_vnet_hdr(fds[0], errp);
|
||||
if (vnet_hdr < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!net_init_tap_one(tap, peer, name, NULL,
|
||||
NULL, NULL,
|
||||
vhost_fds ? vhost_fds[0] : -1,
|
||||
vnet_hdr, fds[0], errp)) {
|
||||
goto fail;
|
||||
}
|
||||
} else if (tap->fds) {
|
||||
if (fds) {
|
||||
for (i = 0; i < queues; i++) {
|
||||
if (i == 0) {
|
||||
vnet_hdr = tap_probe_vnet_hdr(fds[i], errp);
|
||||
@@ -935,18 +923,6 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
} else if (tap->helper) {
|
||||
vnet_hdr = tap_probe_vnet_hdr(fds[0], errp);
|
||||
if (vnet_hdr < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!net_init_tap_one(tap, peer, name, ifname,
|
||||
NULL, NULL,
|
||||
vhost_fds ? vhost_fds[0] : -1,
|
||||
vnet_hdr, fds[0], errp)) {
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
g_autofree char *script =
|
||||
tap_parse_script(tap->script, DEFAULT_NETWORK_SCRIPT);
|
||||
|
||||
Reference in New Issue
Block a user