@samitouri / QOSamiQemu / commits / 14d7eb1355

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>

Vladimir Sementsov-Ogievskiy committed Mar 18, 2026 at 14:31 UTC 14d7eb1355911b60350bb690654d90a7b64d5bb3
1 file changed +1 -25
net/tap.c
+1 -25
@@ -903,19 +903,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
903 goto fail;
904 }
905
906 - if (tap->fd) {
907 - vnet_hdr = tap_probe_vnet_hdr(fds[0], errp);
908 - if (vnet_hdr < 0) {
909 - goto fail;
910 - }
911 -
912 - if (!net_init_tap_one(tap, peer, name, NULL,
913 - NULL, NULL,
914 - vhost_fds ? vhost_fds[0] : -1,
915 - vnet_hdr, fds[0], errp)) {
916 - goto fail;
917 - }
918 - } else if (tap->fds) {
906 + if (fds) {
907 for (i = 0; i < queues; i++) {
908 if (i == 0) {
909 vnet_hdr = tap_probe_vnet_hdr(fds[i], errp);
@@ -935,18 +923,6 @@ int net_init_tap(const Netdev *netdev, const char *name,
923 goto fail;
924 }
925 }
938 - } else if (tap->helper) {
939 - vnet_hdr = tap_probe_vnet_hdr(fds[0], errp);
940 - if (vnet_hdr < 0) {
941 - goto fail;
942 - }
943 -
944 - if (!net_init_tap_one(tap, peer, name, ifname,
945 - NULL, NULL,
946 - vhost_fds ? vhost_fds[0] : -1,
947 - vnet_hdr, fds[0], errp)) {
948 - goto fail;
949 - }
926 } else {
927 g_autofree char *script =
928 tap_parse_script(tap->script, DEFAULT_NETWORK_SCRIPT);