ovs: introduce new "ovs-dpdk.lsc-interrupt" property

Introduce a new "ovs-dpdk.lsc-interrupt", used to configure the Link
State Change (LSC) detection mode.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2149
This commit is contained in:
Beniamino Galvani
2025-03-04 10:08:58 +01:00
parent 4b572a1a4a
commit 0e4330f2b4
9 changed files with 104 additions and 11 deletions

4
NEWS
View File

@@ -8,7 +8,9 @@ subject to change and not guaranteed to be compatible with
the later release. the later release.
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Added systemd services to provide networking in the initrd. * Add systemd services to provide networking in the initrd.
* Introduce a new "ovs-dpdk.lsc-interrupt" property to configure the
Link State Change (LSC) detection mode for OVS DPDK interfaces.
============================================= =============================================
NetworkManager-1.52 NetworkManager-1.52

View File

@@ -907,11 +907,13 @@ _insert_interface(json_t *params,
guint32 n_rxq; guint32 n_rxq;
guint32 n_rxq_desc; guint32 n_rxq_desc;
guint32 n_txq_desc; guint32 n_txq_desc;
NMSettingOvsDpdkLscInterrupt lsc_int;
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); n_rxq = nm_setting_ovs_dpdk_get_n_rxq(s_ovs_dpdk);
n_rxq_desc = nm_setting_ovs_dpdk_get_n_rxq_desc(s_ovs_dpdk); n_rxq_desc = nm_setting_ovs_dpdk_get_n_rxq_desc(s_ovs_dpdk);
n_txq_desc = nm_setting_ovs_dpdk_get_n_txq_desc(s_ovs_dpdk); n_txq_desc = nm_setting_ovs_dpdk_get_n_txq_desc(s_ovs_dpdk);
lsc_int = nm_setting_ovs_dpdk_get_lsc_interrupt(s_ovs_dpdk);
dpdk_array = json_array(); dpdk_array = json_array();
@@ -933,6 +935,17 @@ _insert_interface(json_t *params,
json_pack("[s,s]", "n_txq_desc", nm_sprintf_buf(sbuf, "%u", n_txq_desc))); json_pack("[s,s]", "n_txq_desc", nm_sprintf_buf(sbuf, "%u", n_txq_desc)));
} }
switch (lsc_int) {
case NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE:
break;
case NM_SETTING_OVS_DPDK_LSC_INTERRUPT_ENABLED:
json_array_append_new(dpdk_array, json_pack("[s,s]", "dpdk-lsc-interrupt", "true"));
break;
case NM_SETTING_OVS_DPDK_LSC_INTERRUPT_DISABLED:
json_array_append_new(dpdk_array, json_pack("[s,s]", "dpdk-lsc-interrupt", "false"));
break;
}
json_array_append_new(options, dpdk_array); json_array_append_new(options, dpdk_array);
} else if (s_ovs_patch) { } else if (s_ovs_patch) {

View File

@@ -2053,4 +2053,6 @@ libnm_1_54_0 {
global: global:
nm_setting_ip_config_forwarding_get_type; nm_setting_ip_config_forwarding_get_type;
nm_setting_ip_config_get_forwarding; nm_setting_ip_config_get_forwarding;
nm_setting_ovs_dpdk_get_lsc_interrupt;
nm_setting_ovs_dpdk_lsc_interrupt_get_type;
} libnm_1_52_0; } libnm_1_52_0;

View File

@@ -2128,6 +2128,10 @@
dbus-type="s" dbus-type="s"
gprop-type="gchararray" gprop-type="gchararray"
/> />
<property name="lsc-interrupt"
dbus-type="i"
gprop-type="gint"
/>
<property name="n-rxq" <property name="n-rxq"
dbus-type="u" dbus-type="u"
gprop-type="guint" gprop-type="guint"

View File

@@ -22,7 +22,11 @@
/*****************************************************************************/ /*****************************************************************************/
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DEVARGS, PROP_N_RXQ, PROP_N_RXQ_DESC, PROP_N_TXQ_DESC, ); NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DEVARGS,
PROP_N_RXQ,
PROP_N_RXQ_DESC,
PROP_N_TXQ_DESC,
PROP_LSC_INTERRUPT, );
/** /**
* NMSettingOvsDpdk: * NMSettingOvsDpdk:
@@ -36,6 +40,7 @@ struct _NMSettingOvsDpdk {
guint32 n_rxq; guint32 n_rxq;
guint32 n_rxq_desc; guint32 n_rxq_desc;
guint32 n_txq_desc; guint32 n_txq_desc;
int lsc_interrupt;
}; };
struct _NMSettingOvsDpdkClass { struct _NMSettingOvsDpdkClass {
@@ -110,6 +115,22 @@ nm_setting_ovs_dpdk_get_n_txq_desc(NMSettingOvsDpdk *self)
return self->n_txq_desc; return self->n_txq_desc;
} }
/**
* nm_setting_ovs_dpdk_get_lsc_interrupt:
* @self: the #NMSettingOvsDpdk
*
* Returns: the #NMSettingOvsDpdk:lsc-interrupt property of the setting
*
* Since: 1.54
**/
NMSettingOvsDpdkLscInterrupt
nm_setting_ovs_dpdk_get_lsc_interrupt(NMSettingOvsDpdk *self)
{
g_return_val_if_fail(NM_IS_SETTING_OVS_DPDK(self), NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE);
return self->lsc_interrupt;
}
/*****************************************************************************/ /*****************************************************************************/
static gboolean static gboolean
@@ -257,6 +278,29 @@ nm_setting_ovs_dpdk_class_init(NMSettingOvsDpdkClass *klass)
NMSettingOvsDpdk, NMSettingOvsDpdk,
n_txq_desc); n_txq_desc);
/**
* NMSettingOvsDpdk:lsc-interrupt:
*
* Configures the Link State Change (LSC) detection mode for the OVS DPDK interface.
* When set to %NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE, NetworkManager doesn't
* change the default value configured by Open vSwitch.
* %NM_SETTING_OVS_DPDK_LSC_INTERRUPT_ENABLED enables interrupts.
* %NM_SETTING_OVS_DPDK_LSC_INTERRUPT_DISABLED disables interrupts, thus setting the
* interface in poll mode.
*
* Since: 1.54
**/
_nm_setting_property_define_direct_enum(properties_override,
obj_properties,
NM_SETTING_OVS_DPDK_LSC_INTERRUPT,
PROP_LSC_INTERRUPT,
NM_TYPE_SETTING_OVS_DPDK_LSC_INTERRUPT,
NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE,
NM_SETTING_PARAM_NONE,
NULL,
NMSettingOvsDpdk,
lsc_interrupt);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
_nm_setting_class_commit(setting_class, _nm_setting_class_commit(setting_class,

View File

@@ -31,9 +31,27 @@ G_BEGIN_DECLS
#define NM_SETTING_OVS_DPDK_N_RXQ "n-rxq" #define NM_SETTING_OVS_DPDK_N_RXQ "n-rxq"
#define NM_SETTING_OVS_DPDK_N_RXQ_DESC "n-rxq-desc" #define NM_SETTING_OVS_DPDK_N_RXQ_DESC "n-rxq-desc"
#define NM_SETTING_OVS_DPDK_N_TXQ_DESC "n-txq-desc" #define NM_SETTING_OVS_DPDK_N_TXQ_DESC "n-txq-desc"
#define NM_SETTING_OVS_DPDK_LSC_INTERRUPT "lsc-interrupt"
typedef struct _NMSettingOvsDpdkClass NMSettingOvsDpdkClass; typedef struct _NMSettingOvsDpdkClass NMSettingOvsDpdkClass;
/**
* NMSettingOvsDpdkLscInterrupt:
* @NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE: leave the value set to Open vSwitch default
* @NM_SETTING_OVS_DPDK_LSC_INTERRUPT_DISABLED: interrupt disabled (poll mode)
* @NM_SETTING_OVS_DPDK_LSC_INTERRUPT_ENABLED: interrupt enabled
*
* #NMSettingOvsDpdkLscInterrupt indicates whether the interface uses interrupts
* or poll mode for Link State Change (LSC) detection on the OVS DPDK interface.
*
* Since: 1.54
*/
typedef enum {
NM_SETTING_OVS_DPDK_LSC_INTERRUPT_IGNORE = -1,
NM_SETTING_OVS_DPDK_LSC_INTERRUPT_DISABLED = 0,
NM_SETTING_OVS_DPDK_LSC_INTERRUPT_ENABLED = 1,
} NMSettingOvsDpdkLscInterrupt;
NM_AVAILABLE_IN_1_20 NM_AVAILABLE_IN_1_20
GType nm_setting_ovs_dpdk_get_type(void); GType nm_setting_ovs_dpdk_get_type(void);
NM_AVAILABLE_IN_1_20 NM_AVAILABLE_IN_1_20
@@ -47,6 +65,8 @@ NM_AVAILABLE_IN_1_42
guint32 nm_setting_ovs_dpdk_get_n_rxq_desc(NMSettingOvsDpdk *self); guint32 nm_setting_ovs_dpdk_get_n_rxq_desc(NMSettingOvsDpdk *self);
NM_AVAILABLE_IN_1_42 NM_AVAILABLE_IN_1_42
guint32 nm_setting_ovs_dpdk_get_n_txq_desc(NMSettingOvsDpdk *self); guint32 nm_setting_ovs_dpdk_get_n_txq_desc(NMSettingOvsDpdk *self);
NM_AVAILABLE_IN_1_54
NMSettingOvsDpdkLscInterrupt nm_setting_ovs_dpdk_get_lsc_interrupt(NMSettingOvsDpdk *self);
G_END_DECLS G_END_DECLS

View File

@@ -7309,6 +7309,9 @@ static const NMMetaPropertyInfo *const property_infos_OVS_DPDK[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_DPDK_N_TXQ_DESC, PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_DPDK_N_TXQ_DESC,
.property_type = &_pt_gobject_int, .property_type = &_pt_gobject_int,
), ),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_DPDK_LSC_INTERRUPT,
.property_type = &_pt_gobject_enum,
),
NULL NULL
}; };

View File

@@ -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_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_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_DEVARGS N_("Open vSwitch DPDK device arguments.")
#define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_LSC_INTERRUPT N_("Configures the Link State Change (LSC) detection mode for the OVS DPDK interface. When set to \"ignore\" (-1), NetworkManager doesn't change the default value configured by Open vSwitch. \"enabled\" (1) enables interrupts. \"disabled\" (0) disables interrupts, thus setting the interface in poll mode.")
#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_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_DPDK_N_RXQ_DESC N_("The rx queue size (number of rx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors.") #define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_N_RXQ_DESC N_("The rx queue size (number of rx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors.")
#define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_N_TXQ_DESC N_("The tx queue size (number of tx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors.") #define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_N_TXQ_DESC N_("The tx queue size (number of tx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors.")

View File

@@ -1763,6 +1763,10 @@
nmcli-description="The tx queue size (number of tx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors." nmcli-description="The tx queue size (number of tx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors."
format="integer" format="integer"
values="0 - 4096" /> values="0 - 4096" />
<property name="lsc-interrupt"
nmcli-description="Configures the Link State Change (LSC) detection mode for the OVS DPDK interface. When set to &quot;ignore&quot; (-1), NetworkManager doesn&apos;t change the default value configured by Open vSwitch. &quot;enabled&quot; (1) enables interrupts. &quot;disabled&quot; (0) disables interrupts, thus setting the interface in poll mode."
format="choice (NMSettingOvsDpdkLscInterrupt)"
values="ignore (-1), disabled (0), enabled (1)" />
</setting> </setting>
<setting name="ovs-external-ids" > <setting name="ovs-external-ids" >
</setting> </setting>