Fixes LP: #1546565
*Update*
- - with the split libs it now nees to be listed in
+ - with the split libs it now needs to be listed in
lib/librte_eal/linuxapp/eal/rte_eal_version.map to work on link steps
- please note that upstream gravitates towards not extending but creating a
new the API in DPDK as long term solution (will take a while)
- But until that is fully working we have to carry the workaround.
- Updated to work with Openvswitch 2.7 (and backward compatible to 2.6)
+*Update*
+ - in 17.05 the patch now needs to be hooked up on a different place in vhost
+ socket.c
+ - also the former rebase dropped a create socket call which is now restored
+
Forwarded: yes
Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
-Last-Update: 2017-05-23
+Last-Update: 2017-08-23
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
-@@ -156,6 +156,25 @@ See the DPDK Getting Started Guides for
+@@ -133,6 +133,25 @@ See the DPDK Getting Started Guides for
Use malloc instead of hugetlbfs.
----------------------------
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
-@@ -95,6 +95,8 @@ eal_long_options[] = {
- {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM },
+@@ -78,6 +78,8 @@ eal_long_options[] = {
{OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM },
- {OPT_XEN_DOM0, 0, NULL, OPT_XEN_DOM0_NUM },
+ {OPT_LEGACY_MEM, 0, NULL, OPT_LEGACY_MEM_NUM },
+ {OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM},
+ {OPT_VHOST_OWNER, 1, NULL, OPT_VHOST_OWNER_NUM },
+ {OPT_VHOST_PERM, 1, NULL, OPT_VHOST_PERM_NUM },
{0, 0, NULL, 0 }
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
-@@ -83,6 +83,10 @@ enum {
- OPT_VMWARE_TSC_MAP_NUM,
- #define OPT_XEN_DOM0 "xen-dom0"
- OPT_XEN_DOM0_NUM,
+@@ -63,6 +63,10 @@ enum {
+ OPT_LEGACY_MEM_NUM,
+ #define OPT_SINGLE_FILE_SEGMENTS "single-file-segments"
+ OPT_SINGLE_FILE_SEGMENTS_NUM,
+#define OPT_VHOST_OWNER "vhost-owner"
+ OPT_VHOST_OWNER_NUM,
+#define OPT_VHOST_PERM "vhost-perm"
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
-@@ -286,6 +286,11 @@ static inline int rte_gettid(void)
- #define RTE_INIT(func) \
- static void __attribute__((constructor, used)) func(void)
+@@ -498,6 +498,11 @@ enum rte_iova_mode rte_eal_iova_mode(voi
+ const char *
+ rte_eal_mbuf_user_pool_ops(void);
+/**
+ * Set owner/permissions on sockets if requested on EAL commandline
#endif
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
-@@ -53,6 +53,9 @@
+@@ -23,6 +23,9 @@
#if defined(RTE_ARCH_X86)
#include <sys/io.h>
#endif
+#include <pwd.h>
+#include <grp.h>
+ #include <rte_compat.h>
#include <rte_common.h>
- #include <rte_debug.h>
-@@ -119,6 +122,12 @@ struct lcore_config lcore_config[RTE_MAX
+@@ -89,6 +92,12 @@ struct lcore_config lcore_config[RTE_MAX
/* internal configuration */
struct internal_config internal_config;
/* used by rte_rdtsc() */
int rte_cycles_vmware_tsc_map;
-@@ -356,6 +365,8 @@ eal_usage(const char *prgname)
- " --"OPT_CREATE_UIO_DEV" Create /dev/uioX (usually done by hotplug)\n"
+@@ -408,6 +417,8 @@ eal_usage(const char *prgname)
" --"OPT_VFIO_INTR" Interrupt mode for VFIO (legacy|msi|msix)\n"
- " --"OPT_XEN_DOM0" Support running on Xen dom0 without hugetlbfs\n"
+ " --"OPT_LEGACY_MEM" Legacy memory mode (no dynamic allocation, contiguous segments)\n"
+ " --"OPT_SINGLE_FILE_SEGMENTS" Put all hugepage memory in single files\n"
+ " --"OPT_VHOST_OWNER" Create vhost-user sockets with this owner:group\n"
+ " --"OPT_VHOST_PERM" Create vhost-user sockets with these permissions\n"
"\n");
/* Allow the application to print its usage message too if hook is set */
if ( rte_application_usage_hook ) {
-@@ -515,6 +526,121 @@ eal_log_level_parse(int argc, char **arg
+@@ -566,6 +577,121 @@ eal_log_level_parse(int argc, char **arg
optarg = old_optarg;
}
/* Parse the argument given in the command line of the application */
static int
eal_parse_args(int argc, char **argv)
-@@ -611,6 +737,26 @@ eal_parse_args(int argc, char **argv)
- internal_config.create_uio_dev = 1;
+@@ -668,6 +794,26 @@ eal_parse_args(int argc, char **argv)
+ strdup(optarg);
break;
+ case OPT_VHOST_OWNER_NUM:
default:
if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
RTE_LOG(ERR, EAL, "Option %c is not supported "
-@@ -995,3 +1141,47 @@ rte_eal_check_module(const char *module_
+@@ -1145,3 +1291,47 @@ rte_eal_check_module(const char *module_
/* Module has been found */
return 1;
}
+ vhost_set_ownership(path);
+ }
+}
---- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
-+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
-@@ -120,6 +120,7 @@ DPDK_2.2 {
- rte_keepalive_register_core;
- rte_xen_dom0_supported;
- rte_xen_mem_phy2mch;
+--- a/lib/librte_eal/rte_eal_version.map
++++ b/lib/librte_eal/rte_eal_version.map
+@@ -116,6 +116,7 @@ DPDK_16.04 {
+
+ rte_cpu_get_flag_name;
+ rte_eal_primary_proc_alive;
+ rte_eal_set_socket_permissions;
- } DPDK_2.1;
+ } DPDK_2.2;
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
-@@ -98,6 +98,8 @@ struct vhost_user {
+@@ -77,6 +77,8 @@ struct vhost_user {
pthread_mutex_t mutex;
};
#define MAX_VIRTIO_BACKLOG 128
static void vhost_user_server_new_connection(int fd, void *data, int *remove);
-@@ -644,7 +646,7 @@ rte_vhost_driver_register(const char *pa
- } else {
- vsocket->is_server = true;
+@@ -374,6 +376,7 @@ vhost_user_start_server(struct vhost_use
+ goto err;
}
-- ret = create_unix_socket(vsocket);
+
+ rte_eal_set_socket_permissions(path);
- if (ret < 0) {
- free(vsocket->path);
- free(vsocket);
+ return 0;
+
+ err: