On 05/07/2015 08:38 PM, Ciara Loftus wrote:
This patch adds support for a new port type to the userspace
datapath called dpdkvhostuser.

A new dpdkvhostuser port will create a unix domain socket which
when provided to QEMU is used to facilitate communication between
the virtio-net device on the VM and the OVS port on the host.

vhost-cuse ('dpdkvhost') ports are still available, and will be
enabled if vhost-cuse support is detected in the DPDK build
specified during compilation of the switch. Otherwise, vhost-user
ports are enabled.

Signed-off-by: Ciara Loftus <[email protected]>
---

diff --git a/acinclude.m4 b/acinclude.m4
index e9d0ed9..1566380 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -218,6 +218,12 @@ AC_DEFUN([OVS_CHECK_DPDK], [
      DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
      AC_SUBST([DPDK_vswitchd_LDFLAGS])
      AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
+
+    # Check what version of vhost is being used in the DPDK build
+    # Set VHOST_CUSE if vhost-cuse build is found
+    if test -f $RTE_SDK/build/lib/librte_vhost/vhost_cuse/vhost-net-cdev.o; 
then
+      AC_DEFINE([VHOST_CUSE], [1], [DPDK vhost-cuse support enabled, 
vhost-user disabled.])
+    fi
    else
      RTE_SDK=
    fi

Eek, NAK. You can't assume a full build tree of an external library to be available.

As I suggested before: fish the DPDK config from rte_config.h, that's what its there for. If somebody is building bits of DPDK by overriding config via make cli *and* building OVS on top of such a build then they're only getting all the breakage they're asking for. DPDK itself uses rte_config.h in places so its unlikely such a practise is "supported" anyway.

[...]

  static int
+netdev_dpdk_vhost_user_construct(struct netdev *netdev_)
+{
+    int err;
+
+    if (rte_eal_init_ret) {
+        return rte_eal_init_ret;
+    }
+
+    ovs_mutex_lock(&dpdk_mutex);
+    err = netdev_dpdk_init(netdev_, -1, DPDK_DEV_VHOST_USER);
+    ovs_mutex_unlock(&dpdk_mutex);
+
+    return err;
+}

Its not a whole lot of code, but the duplication could be easily avoided since the vhost-cuse and vhost-user cases only differ by the type passed to netdev_dpdk_init so they could use a common helper for the actual construct job, eg:

static int
netdev_dpdk_vhost_construct(struct netdev *netdev_)
{
    return vhost_construct_helper(netdev_, DPDK_DEV_VHOST);
}

static int
netdev_dpdk_vhost_user_construct(struct netdev *netdev_)
{
    return vhost_construct_helper(netdev_, DPDK_DEV_VHOST_USER);
}


diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index a1b33da..82a715b 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -254,7 +254,9 @@ usage(void)
      printf("\nDPDK options:\n"
             "  --dpdk options            Initialize DPDK datapath.\n"
             "  --cuse_dev_name BASENAME  override default character device 
name\n"
-           "                            for use with userspace vHost.\n");
+           "                            for use with userspace vHost.\n"
+           "  --vhost_sock_dir DIR      override default directory where\n"
+           "                            vhost-user sockets are created.\n");
      printf("\nOther options:\n"
             "  --unixctl=SOCKET          override default control socket 
name\n"
             "  -h, --help                display this help message\n"


Advertising and accepting both vhost-cuse and vhost-user options when only one can be active is confusing to users, might be worth those couple of extra ifdef's now that the vast majority of them is gone (which is nice).

Another possibility to avoid that could be using a common --vhost-path argument which just behaves differently internally depending whether vhost cuse/user is active, but that might be even more confusing. Dunno.

        - Panu -
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to