libnm-core: add ovs-dpdk setting

This commit is contained in:
Lubomir Rintel 2019-06-11 15:53:05 +02:00
parent f69dffe1e8
commit a26abc797c
13 changed files with 248 additions and 1 deletions

View file

@ -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 \

View file

@ -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\".")

View file

@ -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"/>

View file

@ -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',

View file

@ -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"

View file

@ -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"

View file

@ -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;

View file

@ -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);
}

View file

@ -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__ */

View file

@ -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"

View file

@ -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;

View file

@ -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,

View file

@ -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,