Skip to contentSkip to conversation

libxl/xl: drop support for netchannel2

PATCH In review Ian Campbell 3 participants 4 messages Apr 6, 2011 – Apr 8, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl/xl: drop support for netchannel2

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1302106139 -3600
# Node ID a28b8b3880ab73aa663cbce07bc127a87868b348 # Parent ae59c473da8dcd57d473d8d92210db8233f46cfd libxl/xl: drop support for netchannel2

netchannel2 was never widely deployed and no supported kernel includes either the front- or back-ends. The last known kernel with this support was the xen.git 2.6.31 branch which has been unsupported for ages.

xl will warn the user if it spots a "vif2" configration item but otherwise support is completely removed.

Work is ongoing to add the interesting features of netchannel2 as protocol extensions to netchannel1.

tools/libxl/libxl.c +0 -221
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl.c
@@ -1379,227 +1379,6 @@ err:
 }
 
 /******************************************************************************/
-void libxl_device_net2_init(libxl_device_net2 *net2_info, int devnum)
-{
-    const uint8_t *r;
-    libxl_uuid uuid;
-
-    libxl_uuid_generate(&uuid);
-    r = libxl_uuid_bytearray(&uuid);
-    memset(net2_info, '\0', sizeof(*net2_info));
-
-    net2_info->devid = devnum;
-    net2_info->front_mac[0] = 0x00;
-    net2_info->front_mac[1] = 0x16;
-    net2_info->front_mac[2] = 0x3e;;
-    net2_info->front_mac[3] = 0x7f & r[0];
-    net2_info->front_mac[4] = r[1];
-    net2_info->front_mac[5] = r[2];
-    net2_info->back_mac[0] = 0x00;
-    net2_info->back_mac[1] = 0x16;
-    net2_info->back_mac[2] = 0x3e;
-    net2_info->back_mac[3] = 0x7f & r[3];
-    net2_info->back_mac[4] = r[4];
-    net2_info->back_mac[5] = r[5];
-    net2_info->back_trusted = 1;
-    net2_info->filter_mac = 1;
-    net2_info->max_bypasses = 5;
-    net2_info->bridge = strdup("xenbr0");
-}
-
-int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net2)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    flexarray_t *front, *back;
-    libxl__device device;
-    char *dompath, *dom, **l;
-    unsigned int nb;
-    int rc;
-
-    front = flexarray_make(16, 1);
-    if (!front) {
-        rc = ERROR_NOMEM;
-        goto err;
-    }
-    back = flexarray_make(16, 1);
-    if (!back) {
-        rc = ERROR_NOMEM;
-        goto err_free;
-    }
-
-    if (!(dompath = libxl__xs_get_dompath(&gc, domid))) {
-        rc = ERROR_FAIL;
-        goto err_free;
-    }
-    dom = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/name", dompath));
-
-    if (net2->devid == -1) {
-        if (!(l = libxl__xs_directory(&gc, XBT_NULL,
-                                     libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb))) {
-            net2->devid = 0;
-        } else {
-            net2->devid = strtoul(l[nb - 1], NULL, 10) + 1;
-        }
-    }
-
-    device.backend_devid = net2->devid;
-    device.backend_domid = net2->backend_domid;
-    device.backend_kind = DEVICE_VIF2;
-    device.devid = net2->devid;
-    device.domid = net2->domid;
-    device.kind = DEVICE_VIF2;
-
-    flexarray_append(back, "domain");
-    flexarray_append(back, dom);
-    flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->domid));
-
-    flexarray_append(back, "local-trusted");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->back_trusted));
-    flexarray_append(back, "mac");
-    flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
-                                                 net2->back_mac[0], net2->back_mac[1],
-                                                 net2->back_mac[2], net2->back_mac[3],
-                                                 net2->back_mac[4], net2->back_mac[5]));
-
-    flexarray_append(back, "remote-trusted");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->trusted));
-    flexarray_append(back, "remote-mac");
-    flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
-                                                 net2->front_mac[0], net2->front_mac[1],
-                                                 net2->front_mac[2], net2->front_mac[3],
-                                                 net2->front_mac[4], net2->front_mac[5]));
-
-    flexarray_append(back, "max-bypasses");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->max_bypasses));
-    flexarray_append(back, "filter-mac");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
-    flexarray_append(back, "handle");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->devid));
-    flexarray_append(back, "online");
-    flexarray_append(back, "1");
-    flexarray_append(back, "state");
-    flexarray_append(back, "1");
-
-    flexarray_append(front, "backend-id");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", net2->backend_domid));
-
-    flexarray_append(front, "local-trusted");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", net2->trusted));
-    flexarray_append(front, "mac");
-    flexarray_append(front, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
-                                                  net2->front_mac[0], net2->front_mac[1],
-                                                  net2->front_mac[2], net2->front_mac[3],
-                                                  net2->front_mac[4], net2->front_mac[5]));
-
-    flexarray_append(front, "remote-trusted");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", net2->back_trusted));
-    flexarray_append(front, "remote-mac");
-    flexarray_append(front, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
-                                                  net2->back_mac[0], net2->back_mac[1],
-                                                  net2->back_mac[2], net2->back_mac[3],
-                                                  net2->back_mac[4], net2->back_mac[5]));
-
-    flexarray_append(front, "filter-mac");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
-    flexarray_append(front, "state");
-    flexarray_append(front, "1");
-
-    libxl__device_generic_add(&gc, &device,
-                             libxl__xs_kvs_of_flexarray(&gc, back, back->count),
-                             libxl__xs_kvs_of_flexarray(&gc, front, front->count));
-
-    /* FIXME: wait for plug */
-    rc = 0;
-err_free:
-    flexarray_free(back);
-    flexarray_free(front);
-err:
-    libxl__free_all(&gc);
-    return rc;
-}
-
-libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *dompath, *net2_path_fe;
-    char **l;
-    char *val, *tok;
-    unsigned int nb_net2s, i;
-    libxl_net2info *res, *net2s;
-
-    dompath = libxl__xs_get_dompath(&gc, domid);
-    if (!dompath)
-        goto err;
-    l = libxl__xs_directory(&gc, XBT_NULL,
-                           libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb_net2s);
-    if (!l)
-        goto err;
-    res = calloc(nb_net2s, sizeof (libxl_net2info));
-    if (!res)
-        goto err;
-    net2s = res;
-    for (*nb = nb_net2s; nb_net2s > 0; --nb_net2s, ++l, ++net2s) {
-        net2_path_fe = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, *l);
-
-        net2s->backend = libxl__xs_read(&gc, XBT_NULL,
-                                       libxl__sprintf(&gc, "%s/backend", net2_path_fe));
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2_path_fe));
-        net2s->backend_id = val ? strtoul(val, NULL, 10) : -1;
-
-        net2s->devid = strtoul(*l, NULL, 10);
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", net2_path_fe));
-        net2s->state = val ? strtoul(val, NULL, 10) : -1;
-
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2_path_fe));
-        for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
-             ++i, tok = strtok(NULL, ":")) {
-            net2s->mac[i] = strtoul(tok, NULL, 16);
-        }
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", net2_path_fe));
-        net2s->trusted = val ? strtoul(val, NULL, 10) : -1;
-
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2_path_fe));
-        for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
-             ++i, tok = strtok(NULL, ":")) {
-            net2s->back_mac[i] = strtoul(tok, NULL, 16);
-        }
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2_path_fe));
-        net2s->filter_mac = val ? strtoul(val, NULL, 10) : -1;
-
-        net2s->frontend = libxl__xs_read(&gc, XBT_NULL,
-                                        libxl__sprintf(&gc, "%s/frontend", net2s->backend));
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", net2s->backend));
-        net2s->frontend_id = val ? strtoul(val, NULL, 10) : -1;
-    }
-
-    libxl__free_all(&gc);
-    return res;
-err:
-    libxl__free_all(&gc);
-    return NULL;
-}
-
-int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    libxl__device device;
-    int rc;
-
-    device.backend_devid    = net2->devid;
-    device.backend_domid    = net2->backend_domid;
-    device.backend_kind     = DEVICE_VIF2;
-    device.devid            = net2->devid;
-    device.domid            = net2->domid;
-    device.kind             = DEVICE_VIF2;
-
-    rc = libxl__device_del(&gc, &device, wait);
-    libxl__free_all(&gc);
-    return rc;
-}
-
-
-/******************************************************************************/
 int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
tools/libxl/libxl.h +1 -10
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl.h
@@ -262,11 +262,10 @@ typedef struct {
     libxl_domain_build_info b_info;
     libxl_device_model_info dm_info;
 
-    int num_disks, num_vifs, num_vif2s, num_pcidevs, num_vfbs, num_vkbs;
+    int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
 
     libxl_device_disk *disks;
     libxl_device_nic *vifs;
-    libxl_device_net2 *vif2s;
     libxl_device_pci *pcidevs;
     libxl_device_vfb *vfbs;
     libxl_device_vkb *vkbs;
@@ -535,14 +534,6 @@ int libxl_tmem_shared_auth(libxl_ctx *ct
                            int auth);
 int libxl_tmem_freeable(libxl_ctx *ctx);
 
-void libxl_device_net2_init(libxl_device_net2 *net2, int dev_num);
-int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid,
-                          libxl_device_net2 *net2);
-libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid,
-                                       unsigned int *nb);
-int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2,
-                          int wait);
-
 int libxl_get_freecpus(libxl_ctx *ctx, libxl_cpumap *cpumap);
 int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
tools/libxl/libxl.idl +0 -28
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl.idl
@@ -228,21 +228,6 @@ libxl_device_nic = Struct("device_nic", 
     ("nictype", libxl_nic_type),
     ])
 
-libxl_device_net2 = Struct("device_net2", [
-    ("devid", integer),
-    ("front_mac", libxl_mac),
-    ("back_mac", libxl_mac),
-    ("backend_domid", uint32),
-    ("domid", domid),
-    ("trusted", BitField(uint32, 1)),
-    ("back_trusted", BitField(uint32, 1)),
-    ("filter_mac", BitField(uint32, 1)),
-    ("front_filter_mac", BitField(uint32, 1)),
-    ("pdev", uint32),
-    ("max_bypasses", uint32),
-    ("bridge", string),
-    ])
-
 libxl_device_pci = Struct("device_pci", [
     ("func",      uint8),
     ("dev",       uint8),
@@ -316,16 +301,3 @@ libxl_sched_credit = Struct("sched_credi
     ("weight", integer),
     ("cap", integer),
     ], destructor_fn=None)
-
-libxl_net2info = Struct("net2info", [
-    ("backend", string),
-    ("backend_id", uint32),
-    ("frontend", string),
-    ("frontend_id", uint32),
-    ("devid", integer),
-    ("state", integer),
-    ("mac", libxl_mac),
-    ("trusted", integer),
-    ("back_mac", libxl_mac),
-    ("filter_mac", integer),
-    ])
tools/libxl/libxl_create.c +0 -15
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl_create.c
@@ -43,10 +43,6 @@ void libxl_domain_config_destroy(libxl_d
         libxl_device_nic_destroy(&d_config->vifs[i]);
     free(d_config->vifs);
 
-    for (i=0; i<d_config->num_vif2s; i++)
-        libxl_device_net2_destroy(&d_config->vif2s[i]);
-    free(d_config->vif2s);
-
     for (i=0; i<d_config->num_pcidevs; i++)
         libxl_device_pci_destroy(&d_config->pcidevs[i]);
     free(d_config->pcidevs);
@@ -464,17 +460,6 @@ static int do_domain_create(libxl__gc *g
             goto error_out;
         }
     }
-    if (!d_config->c_info.hvm) {
-        for (i = 0; i < d_config->num_vif2s; i++) {
-            d_config->vif2s[i].domid = domid;
-            ret = libxl_device_net2_add(ctx, domid, &d_config->vif2s[i]);
-            if (ret) {
-                fprintf(stderr, "cannot add net2 %d to domain: %d\n", i, ret);
-                ret = ERROR_FAIL;
-                goto error_out;
-            }
-        }
-    }
     if (d_config->c_info.hvm) {
         libxl_device_console console;
 
tools/libxl/libxl_device.c +0 -1
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl_device.c
@@ -30,7 +30,6 @@
 
 static const char *string_of_kinds[] = {
     [DEVICE_VIF] = "vif",
-    [DEVICE_VIF2] = "vif2",
     [DEVICE_VBD] = "vbd",
     [DEVICE_TAP] = "tap",
     [DEVICE_QDISK] = "qdisk",
tools/libxl/libxl_utils.c +0 -69

75 lines not on this page · raw message

tools/libxl/libxl_utils.h +0 -5
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/libxl_utils.h
@@ -66,11 +66,6 @@ int libxl_devid_to_device_nic(libxl_ctx 
 int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
                                const char *devid, libxl_device_disk *disk);
 
-int libxl_strtomac(const char *mac_s, uint8_t *mac);
-
-int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid,
-                               const char *devid, libxl_device_net2 *net2);
-
 /* check the version of qemu
  * return 1 if is the new one
  * return 0 if is the old one
tools/libxl/xl_cmdimpl.c +3 -225

246 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +0 -18
diff -r ae59c473da8d -r a28b8b3880ab tools/libxl/xl_cmdtable.c
@@ -320,24 +320,6 @@ struct cmd_spec cmd_table[] = {
       "Get information about how much freeable memory (MB) is in-use by tmem",
       "",
     },
-    { "network2-attach",
-      &main_network2attach,
-      "Create a new version 2 virtual network device",
-      "<Domain> [front_mac=<mac>] [back_mac=<mac>] [backend=<BackDomain>]"
-      " [trusted=<0|1>] [back_trusted=<0|1>] [bridge=<bridge>]"
-      " [filter_mac=<0|1>] [front_filter_mac=<0|1>] [pdev=<PDEV>]"
-      " [max_bypasses=n]",
-    },
-    { "network2-list",
-      &main_network2list,
-      "list version 2 virtual network interfaces for a domain",
-      "<Domain(s)>",
-    },
-    { "network2-detach",
-      &main_network2detach,
-      "destroy a domain's version 2 virtual network device",
-      "<Domain> <DevId>",
-    },
     { "cpupool-create",
       &main_cpupoolcreate,
       "Create a CPU pool based an ConfigFile",
#1 lore raw
Quoted 12 lines · Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1302106139 -3600
# Node ID a28b8b3880ab73aa663cbce07bc127a87868b348 # Parent ae59c473da8dcd57d473d8d92210db8233f46cfd libxl/xl: drop support for netchannel2

netchannel2 was never widely deployed and no supported kernel includes either the front- or back-ends. The last known kernel with this support was the xen.git 2.6.31 branch which has been unsupported for ages.

Quoted 7 lines

xl will warn the user if it spots a "vif2" configration item but otherwise support is completely removed.

Work is ongoing to add the interesting features of netchannel2 as protocol extensions to netchannel1.

Missed one. Do you want a resend or can you fold this in?

tools/libxl/libxl_internal.h +0 -1
@@ -96,7 +96,6 @@ struct libxl__ctx {
 
 typedef enum {
     DEVICE_VIF = 1,
-    DEVICE_VIF2,
     DEVICE_VBD,
     DEVICE_QDISK,
     DEVICE_PCI,
#2 lore raw

Ian Campbell writes ("[Xen-devel] Re: [PATCH] libxl/xl: drop support for netchannel2"):

Quoted 1 line

Missed one. Do you want a resend or can you fold this in?

I've folded it in.

Ian.