summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-06-11 15:53:05 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-06-14 12:10:20 +0200
commita26abc797ccfe6ef78914f557606dfc8f6b57bdc (patch)
tree57f662cc80860d1d2990dfb951a6a994bd522a22
parentf69dffe1e88127e1ccd9f2be6199b064bcba07e3 (diff)
libnm-core: add ovs-dpdk setting
-rw-r--r--Makefile.am2
-rw-r--r--clients/common/settings-docs.h.in3
-rw-r--r--docs/libnm/libnm-docs.xml1
-rw-r--r--libnm-core/meson.build2
-rw-r--r--libnm-core/nm-core-enum-types.c.template1
-rw-r--r--libnm-core/nm-core-internal.h1
-rw-r--r--libnm-core/nm-core-types.h1
-rw-r--r--libnm-core/nm-setting-ovs-dpdk.c172
-rw-r--r--libnm-core/nm-setting-ovs-dpdk.h54
-rw-r--r--libnm/NetworkManager.h1
-rw-r--r--libnm/libnm.ver3
-rw-r--r--shared/nm-meta-setting.c7
-rw-r--r--shared/nm-meta-setting.h1
13 files changed, 248 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index d0e4ec3786..280d603f30 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -762,6 +762,7 @@ libnm_core_lib_h_pub_real = \
libnm-core/nm-setting-match.h \
libnm-core/nm-setting-olpc-mesh.h \
libnm-core/nm-setting-ovs-bridge.h \
+ libnm-core/nm-setting-ovs-dpdk.h \
libnm-core/nm-setting-ovs-interface.h \
libnm-core/nm-setting-ovs-patch.h \
libnm-core/nm-setting-ovs-port.h \
@@ -835,6 +836,7 @@ libnm_core_lib_c_settings_real = \
libnm-core/nm-setting-match.c \
libnm-core/nm-setting-olpc-mesh.c \
libnm-core/nm-setting-ovs-bridge.c \
+ libnm-core/nm-setting-ovs-dpdk.c \
libnm-core/nm-setting-ovs-interface.c \
libnm-core/nm-setting-ovs-patch.c \
libnm-core/nm-setting-ovs-port.c \
diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in
index d088198c16..5833ed8bd6 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -259,7 +259,8 @@
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.")
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.")
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.")
-#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", \"system\", \"patch\", or empty.")
+#define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_DEVARGS N_("Open vSwitch DPDK device arguments.")
+#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", \"system\", \"patch\", \"dpdk\", or empty.")
#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the unicast destination IP address of a remote Open vSwitch bridge port to connect to.")
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("The time port must be inactive in order to be considered down.")
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".")
diff --git a/docs/libnm/libnm-docs.xml b/docs/libnm/libnm-docs.xml
index 74866acebd..c6471348ca 100644
--- a/docs/libnm/libnm-docs.xml
+++ b/docs/libnm/libnm-docs.xml
@@ -216,6 +216,7 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in
<xi:include href="xml/nm-setting-olpc-mesh.xml"/>
<xi:include href="xml/nm-setting-ovs-bridge.xml"/>
<xi:include href="xml/nm-setting-ovs-interface.xml"/>
+ <xi:include href="xml/nm-setting-ovs-dpdk.xml"/>
<xi:include href="xml/nm-setting-ovs-patch.xml"/>
<xi:include href="xml/nm-setting-ovs-port.xml"/>
<xi:include href="xml/nm-setting-ppp.xml"/>
diff --git a/libnm-core/meson.build b/libnm-core/meson.build
index 361c82bb91..9637afaad5 100644
--- a/libnm-core/meson.build
+++ b/libnm-core/meson.build
@@ -30,6 +30,7 @@ libnm_core_headers = files(
'nm-setting-olpc-mesh.h',
'nm-setting-ovs-bridge.h',
'nm-setting-ovs-interface.h',
+ 'nm-setting-ovs-dpdk.h',
'nm-setting-ovs-patch.h',
'nm-setting-ovs-port.h',
'nm-setting-ppp.h',
@@ -87,6 +88,7 @@ libnm_core_settings_sources = files(
'nm-setting-olpc-mesh.c',
'nm-setting-ovs-bridge.c',
'nm-setting-ovs-interface.c',
+ 'nm-setting-ovs-dpdk.c',
'nm-setting-ovs-patch.c',
'nm-setting-ovs-port.c',
'nm-setting-ppp.c',
diff --git a/libnm-core/nm-core-enum-types.c.template b/libnm-core/nm-core-enum-types.c.template
index 94744827ba..b6cb38eecc 100644
--- a/libnm-core/nm-core-enum-types.c.template
+++ b/libnm-core/nm-core-enum-types.c.template
@@ -30,6 +30,7 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
#include "nm-setting-ovs-interface.h"
+#include "nm-setting-ovs-dpdk.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
#include "nm-setting-ppp.h"
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index aed25521cb..685b2cc0d9 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -61,6 +61,7 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
#include "nm-setting-ovs-interface.h"
+#include "nm-setting-ovs-dpdk.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
#include "nm-setting-ppp.h"
diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h
index 582952d52b..fa8b4c4166 100644
--- a/libnm-core/nm-core-types.h
+++ b/libnm-core/nm-core-types.h
@@ -52,6 +52,7 @@ typedef struct _NMSettingMacvlan NMSettingMacvlan;
typedef struct _NMSettingMatch NMSettingMatch;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
typedef struct _NMSettingOvsBridge NMSettingOvsBridge;
+typedef struct _NMSettingOvsDpdk NMSettingOvsDpdk;
typedef struct _NMSettingOvsInterface NMSettingOvsInterface;
typedef struct _NMSettingOvsPatch NMSettingOvsPatch;
typedef struct _NMSettingOvsPort NMSettingOvsPort;
diff --git a/libnm-core/nm-setting-ovs-dpdk.c b/libnm-core/nm-setting-ovs-dpdk.c
new file mode 100644
index 0000000000..4e831e6e92
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-dpdk.c
@@ -0,0 +1,172 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2019 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+
+#include "nm-setting-ovs-dpdk.h"
+
+#include "nm-connection-private.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-private.h"
+
+/**
+ * SECTION:nm-setting-ovs-dpdk
+ * @short_description: Describes connection properties for Open vSwitch DPDK interfaces.
+ *
+ * The #NMSettingOvsDpdk object is a #NMSetting subclass that describes properties
+ * necessary for Open vSwitch interfaces of type "dpdk".
+ **/
+
+/*****************************************************************************/
+
+NM_GOBJECT_PROPERTIES_DEFINE_BASE (
+ PROP_DEVARGS,
+);
+
+/**
+ * NMSettingOvsDpdk:
+ *
+ * OvsDpdk Link Settings
+ */
+struct _NMSettingOvsDpdk {
+ NMSetting parent;
+
+ char *devargs;
+};
+
+struct _NMSettingOvsDpdkClass {
+ NMSettingClass parent;
+};
+
+G_DEFINE_TYPE (NMSettingOvsDpdk, nm_setting_ovs_dpdk, NM_TYPE_SETTING)
+
+/*****************************************************************************/
+
+/**
+ * nm_setting_ovs_dpdk_get_devargs:
+ * @self: the #NMSettingOvsDpdk
+ *
+ * Returns: the #NMSettingOvsDpdk:devargs property of the setting
+ *
+ * Since: 1.20
+ **/
+const char *
+nm_setting_ovs_dpdk_get_devargs (NMSettingOvsDpdk *self)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_DPDK (self), NULL);
+
+ return self->devargs;
+}
+
+/*****************************************************************************/
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMSettingOvsDpdk *self = NM_SETTING_OVS_DPDK (object);
+
+ switch (prop_id) {
+ case PROP_DEVARGS:
+ g_value_set_string (value, self->devargs);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ NMSettingOvsDpdk *self = NM_SETTING_OVS_DPDK (object);
+
+ switch (prop_id) {
+ case PROP_DEVARGS:
+ g_free (self->devargs);
+ self->devargs = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/*****************************************************************************/
+
+static void
+nm_setting_ovs_dpdk_init (NMSettingOvsDpdk *self)
+{
+}
+
+/**
+ * nm_setting_ovs_dpdk_new:
+ *
+ * Creates a new #NMSettingOvsDpdk object with default values.
+ *
+ * Returns: (transfer full): the new empty #NMSettingOvsDpdk object
+ *
+ * Since: 1.20
+ **/
+NMSetting *
+nm_setting_ovs_dpdk_new (void)
+{
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_DPDK, NULL);
+}
+
+static void
+finalize (GObject *object)
+{
+ NMSettingOvsDpdk *self = NM_SETTING_OVS_DPDK (object);
+
+ g_free (self->devargs);
+
+ G_OBJECT_CLASS (nm_setting_ovs_dpdk_parent_class)->finalize (object);
+}
+
+static void
+nm_setting_ovs_dpdk_class_init (NMSettingOvsDpdkClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ NMSettingClass *setting_class = NM_SETTING_CLASS (klass);
+
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+ object_class->finalize = finalize;
+
+ /**
+ * NMSettingOvsDpdk:devargs:
+ *
+ * Open vSwitch DPDK device arguments.
+ *
+ * Since: 1.20
+ **/
+ obj_properties[PROP_DEVARGS] =
+ g_param_spec_string (NM_SETTING_OVS_DPDK_DEVARGS, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
+
+ _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_OVS_DPDK);
+}
diff --git a/libnm-core/nm-setting-ovs-dpdk.h b/libnm-core/nm-setting-ovs-dpdk.h
new file mode 100644
index 0000000000..75ec6752d5
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-dpdk.h
@@ -0,0 +1,54 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2019 Red Hat, Inc.
+ */
+
+#ifndef __NM_SETTING_OVS_DPDK_H__
+#define __NM_SETTING_OVS_DPDK_H__
+
+#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
+#error "Only <NetworkManager.h> can be included directly."
+#endif
+
+#include "nm-setting.h"
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_SETTING_OVS_DPDK (nm_setting_ovs_dpdk_get_type ())
+#define NM_SETTING_OVS_DPDK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_OVS_DPDK, NMSettingOvsDpdk))
+#define NM_SETTING_OVS_DPDK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_OVS_DPDKCONFIG, NMSettingOvsDpdkClass))
+#define NM_IS_SETTING_OVS_DPDK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_OVS_DPDK))
+#define NM_IS_SETTING_OVS_DPDK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_OVS_DPDK))
+#define NM_SETTING_OVS_DPDK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_OVS_DPDK, NMSettingOvsDpdkClass))
+
+#define NM_SETTING_OVS_DPDK_SETTING_NAME "ovs-dpdk"
+
+#define NM_SETTING_OVS_DPDK_DEVARGS "devargs"
+
+typedef struct _NMSettingOvsDpdkClass NMSettingOvsDpdkClass;
+
+NM_AVAILABLE_IN_1_20
+GType nm_setting_ovs_dpdk_get_type (void);
+NM_AVAILABLE_IN_1_20
+NMSetting *nm_setting_ovs_dpdk_new (void);
+
+NM_AVAILABLE_IN_1_20
+const char *nm_setting_ovs_dpdk_get_devargs (NMSettingOvsDpdk *self);
+
+G_END_DECLS
+
+#endif /* __NM_SETTING_OVS_DPDK_H__ */
diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h
index 19bf13f33f..497dc75330 100644
--- a/libnm/NetworkManager.h
+++ b/libnm/NetworkManager.h
@@ -86,6 +86,7 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
#include "nm-setting-ovs-interface.h"
+#include "nm-setting-ovs-dpdk.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
#include "nm-setting-wifi-p2p.h"
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 7b87112553..3af3c2b90e 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1615,4 +1615,7 @@ global:
nm_device_modem_get_device_id;
nm_device_modem_get_operator_code;
nm_setting_ethtool_get_optnames;
+ nm_setting_ovs_dpdk_get_devargs;
+ nm_setting_ovs_dpdk_get_type;
+ nm_setting_ovs_dpdk_new;
} libnm_1_18_0;
diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c
index 13a259325d..d50739baf1 100644
--- a/shared/nm-meta-setting.c
+++ b/shared/nm-meta-setting.c
@@ -46,6 +46,7 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
#include "nm-setting-ovs-interface.h"
+#include "nm-setting-ovs-dpdk.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
#include "nm-setting-ppp.h"
@@ -304,6 +305,12 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = {
.setting_name = NM_SETTING_OVS_BRIDGE_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_bridge_get_type,
},
+ [NM_META_SETTING_TYPE_OVS_DPDK] = {
+ .meta_type = NM_META_SETTING_TYPE_OVS_DPDK,
+ .setting_priority = NM_SETTING_PRIORITY_HW_BASE,
+ .setting_name = NM_SETTING_OVS_DPDK_SETTING_NAME,
+ .get_setting_gtype = nm_setting_ovs_dpdk_get_type,
+ },
[NM_META_SETTING_TYPE_OVS_INTERFACE] = {
.meta_type = NM_META_SETTING_TYPE_OVS_INTERFACE,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
diff --git a/shared/nm-meta-setting.h b/shared/nm-meta-setting.h
index 0788c8373b..157a715fdb 100644
--- a/shared/nm-meta-setting.h
+++ b/shared/nm-meta-setting.h
@@ -140,6 +140,7 @@ typedef enum {
NM_META_SETTING_TYPE_MACVLAN,
NM_META_SETTING_TYPE_MATCH,
NM_META_SETTING_TYPE_OVS_BRIDGE,
+ NM_META_SETTING_TYPE_OVS_DPDK,
NM_META_SETTING_TYPE_OVS_INTERFACE,
NM_META_SETTING_TYPE_OVS_PATCH,
NM_META_SETTING_TYPE_OVS_PORT,