mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-22 14:00:53 +02:00
libnm,core: merge branch 'ac/ovs2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1052
This commit is contained in:
commit
a7466c1b58
10 changed files with 102 additions and 14 deletions
|
|
@ -741,7 +741,7 @@ _j_create_external_ids_array_update(const char *connection_uuid,
|
|||
/**
|
||||
* _insert_interface:
|
||||
*
|
||||
* Returns an commands that adds new interface from a given connection.
|
||||
* Returns a command that adds new interface from a given connection.
|
||||
*/
|
||||
static void
|
||||
_insert_interface(json_t *params,
|
||||
|
|
@ -752,6 +752,10 @@ _insert_interface(json_t *params,
|
|||
const char *type = NULL;
|
||||
NMSettingOvsInterface *s_ovs_iface;
|
||||
NMSettingOvsDpdk *s_ovs_dpdk;
|
||||
const char *devargs;
|
||||
guint32 n_rxq;
|
||||
char sbuf[64];
|
||||
json_t *dpdk_array;
|
||||
NMSettingOvsPatch *s_ovs_patch;
|
||||
json_t *options = json_array();
|
||||
json_t *row;
|
||||
|
|
@ -777,9 +781,21 @@ _insert_interface(json_t *params,
|
|||
s_ovs_patch = nm_connection_get_setting_ovs_patch(interface);
|
||||
|
||||
if (s_ovs_dpdk) {
|
||||
json_array_append_new(
|
||||
options,
|
||||
json_pack("[[s, s]]", "dpdk-devargs", nm_setting_ovs_dpdk_get_devargs(s_ovs_dpdk)));
|
||||
devargs = nm_setting_ovs_dpdk_get_devargs(s_ovs_dpdk);
|
||||
n_rxq = nm_setting_ovs_dpdk_get_n_rxq(s_ovs_dpdk);
|
||||
|
||||
dpdk_array = json_array();
|
||||
|
||||
if (devargs)
|
||||
json_array_append_new(dpdk_array, json_pack("[s,s]", "dpdk-devargs", devargs));
|
||||
|
||||
if (n_rxq != 0) {
|
||||
json_array_append_new(dpdk_array,
|
||||
json_pack("[s,s]", "n_rxq", nm_sprintf_buf(sbuf, "%u", n_rxq)));
|
||||
}
|
||||
|
||||
json_array_append_new(options, dpdk_array);
|
||||
|
||||
} else if (s_ovs_patch) {
|
||||
json_array_append_new(
|
||||
options,
|
||||
|
|
|
|||
|
|
@ -1816,3 +1816,8 @@ global:
|
|||
nm_setting_connection_get_dns_over_tls;
|
||||
nm_setting_connection_dns_over_tls_get_type;
|
||||
} libnm_1_32_4;
|
||||
|
||||
libnm_1_36_0 {
|
||||
global:
|
||||
nm_setting_ovs_dpdk_get_n_rxq;
|
||||
} libnm_1_34_0;
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include "nm-connection-private.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-private.h"
|
||||
#include "nm-utils-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:nm-setting-ovs-dpdk
|
||||
|
|
@ -21,7 +22,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DEVARGS, );
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DEVARGS, PROP_N_RXQ, );
|
||||
|
||||
/**
|
||||
* NMSettingOvsDpdk:
|
||||
|
|
@ -31,7 +32,8 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DEVARGS, );
|
|||
struct _NMSettingOvsDpdk {
|
||||
NMSetting parent;
|
||||
|
||||
char *devargs;
|
||||
char *devargs;
|
||||
guint32 n_rxq;
|
||||
};
|
||||
|
||||
struct _NMSettingOvsDpdkClass {
|
||||
|
|
@ -58,6 +60,22 @@ nm_setting_ovs_dpdk_get_devargs(NMSettingOvsDpdk *self)
|
|||
return self->devargs;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_dpdk_get_n_rxq:
|
||||
* @self: the #NMSettingOvsDpdk
|
||||
*
|
||||
* Returns: the #NMSettingOvsDpdk:n-rxq property of the setting
|
||||
*
|
||||
* Since: 1.36
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ovs_dpdk_get_n_rxq(NMSettingOvsDpdk *self)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_OVS_DPDK(self), 0);
|
||||
|
||||
return self->n_rxq;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
@ -70,7 +88,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
g_value_set_string(value, self->devargs);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +104,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
self->devargs = g_value_dup_string(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -125,8 +143,9 @@ finalize(GObject *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);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
|
||||
GArray *properties_override = _nm_sett_info_property_override_create_array();
|
||||
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
|
|
@ -146,7 +165,31 @@ nm_setting_ovs_dpdk_class_init(NMSettingOvsDpdkClass *klass)
|
|||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMSettingOvsDpdk:n-rxq:
|
||||
*
|
||||
* Open vSwitch DPDK number of rx queues.
|
||||
* Defaults to zero which means to leave the parameter in OVS unspecified
|
||||
* and effectively configures one queue.
|
||||
*
|
||||
* Since: 1.36
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_OVS_DPDK_N_RXQ,
|
||||
PROP_N_RXQ,
|
||||
0,
|
||||
G_MAXUINT32,
|
||||
0,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingOvsDpdk,
|
||||
n_rxq);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
_nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_DPDK, NULL, NULL, 0);
|
||||
_nm_setting_class_commit(setting_class,
|
||||
NM_META_SETTING_TYPE_OVS_DPDK,
|
||||
NULL,
|
||||
properties_override,
|
||||
0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ gboolean _nm_setting_clear_secrets(NMSetting *setting,
|
|||
|
||||
/* The property of the #NMSetting should be considered during comparisons that
|
||||
* use the %NM_SETTING_COMPARE_FLAG_INFERRABLE flag. Properties that don't have
|
||||
* this flag, are ignored when doing an infrerrable comparison. This flag should
|
||||
* this flag, are ignored when doing an inferrable comparison. This flag should
|
||||
* be set on all properties that are read from the kernel or the system when a
|
||||
* connection is generated. eg, IP addresses/routes can be read from the
|
||||
* kernel, but the 'autoconnect' property cannot, so
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ G_BEGIN_DECLS
|
|||
#define NM_SETTING_OVS_DPDK_SETTING_NAME "ovs-dpdk"
|
||||
|
||||
#define NM_SETTING_OVS_DPDK_DEVARGS "devargs"
|
||||
#define NM_SETTING_OVS_DPDK_N_RXQ "n-rxq"
|
||||
|
||||
typedef struct _NMSettingOvsDpdkClass NMSettingOvsDpdkClass;
|
||||
|
||||
|
|
@ -38,6 +39,8 @@ NMSetting *nm_setting_ovs_dpdk_new(void);
|
|||
|
||||
NM_AVAILABLE_IN_1_20
|
||||
const char *nm_setting_ovs_dpdk_get_devargs(NMSettingOvsDpdk *self);
|
||||
NM_AVAILABLE_IN_1_36
|
||||
guint32 nm_setting_ovs_dpdk_get_n_rxq(NMSettingOvsDpdk *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -69,13 +69,14 @@
|
|||
#define NM_VERSION_1_30 (NM_ENCODE_VERSION (1, 30, 0))
|
||||
#define NM_VERSION_1_32 (NM_ENCODE_VERSION (1, 32, 0))
|
||||
#define NM_VERSION_1_34 (NM_ENCODE_VERSION (1, 34, 0))
|
||||
#define NM_VERSION_1_36 (NM_ENCODE_VERSION (1, 36, 0))
|
||||
|
||||
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
||||
*
|
||||
* For development builds, NM_API_VERSION is the next
|
||||
* stable API after NM_VERSION. When you run a development
|
||||
* version, you are already using the future API, even if
|
||||
* it is not yet release. Hence, the currently used API
|
||||
* it is not yet released. Hence, the currently used API
|
||||
* version is the future one. */
|
||||
#define NM_API_VERSION \
|
||||
(((NM_MINOR_VERSION % 2) == 1) \
|
||||
|
|
|
|||
|
|
@ -299,6 +299,20 @@
|
|||
#define NM_AVAILABLE_IN_1_34
|
||||
#endif
|
||||
|
||||
#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_36
|
||||
#define NM_DEPRECATED_IN_1_36 G_DEPRECATED
|
||||
#define NM_DEPRECATED_IN_1_36_FOR(f) G_DEPRECATED_FOR(f)
|
||||
#else
|
||||
#define NM_DEPRECATED_IN_1_36
|
||||
#define NM_DEPRECATED_IN_1_36_FOR(f)
|
||||
#endif
|
||||
|
||||
#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_36
|
||||
#define NM_AVAILABLE_IN_1_36 G_UNAVAILABLE(1, 36)
|
||||
#else
|
||||
#define NM_AVAILABLE_IN_1_36
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Synchronous API for calling D-Bus in libnm is deprecated. See
|
||||
* https://developer.gnome.org/libnm/stable/usage.html#sync-api
|
||||
|
|
|
|||
|
|
@ -6685,7 +6685,10 @@ static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = {
|
|||
static const NMMetaPropertyInfo *const property_infos_OVS_DPDK[] = {
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_DPDK_DEVARGS,
|
||||
.property_type = &_pt_gobject_string,
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_DPDK_N_RXQ,
|
||||
.property_type = &_pt_gobject_int,
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -303,6 +303,7 @@
|
|||
#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_DPDK_DEVARGS N_("Open vSwitch DPDK device arguments.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_N_RXQ N_("Open vSwitch DPDK number of rx queues. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures one queue.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_EXTERNAL_IDS_DATA N_("A dictionary of key/value pairs with exernal-ids for OVS.")
|
||||
#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 name of the interface for the other side of the patch. The patch on the other side must also set this interface as peer.")
|
||||
|
|
|
|||
|
|
@ -818,6 +818,8 @@
|
|||
<setting name="ovs-dpdk" >
|
||||
<property name="devargs"
|
||||
description="Open vSwitch DPDK device arguments." />
|
||||
<property name="n-rxq"
|
||||
description="Open vSwitch DPDK number of rx queues. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures one queue." />
|
||||
</setting>
|
||||
<setting name="ovs-external-ids" >
|
||||
</setting>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue