mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 13:30:28 +01:00
ovsdb: set DPDK port MTU when creating them
The DPDK port will not have a link after the devbind which is needed for
configuring an interface to be a DPDK port. The MTU is being committed
during the link change but for DPDK ports there is no link.
The DPDK port MTU should be set on ovsdb right after the interface is
added to ovsdb. This way the users will be able to set MTU for DPDK
ports and modify it.
Please see the following results:
```
port 2: iface0 (dpdk: configured_rx_queues=1, configured_rxq_descriptors=2048, configured_tx_queues=3,
configured_txq_descriptors=2048, lsc_interrupt_mode=false, mtu=2000, requested_rx_queues=1,
requested_rxq_descriptors=2048, requested_tx_queues=3, requested_txq_descriptors=2048, rx_csum_offload=true, tx_tso_offload=false)
```
(cherry picked from commit 59c60cccf5)
This commit is contained in:
parent
966413e78f
commit
355f7c63de
1 changed files with 45 additions and 1 deletions
|
|
@ -15,7 +15,8 @@
|
|||
#include "nm-active-connection.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-ovs-port.h"
|
||||
#include "nm-setting-ovs-port.h"
|
||||
#include "nm-setting-ovs-interface.h"
|
||||
#include "nm-setting-wired.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceOvsPort
|
||||
#include "devices/nm-device-logging.h"
|
||||
|
|
@ -87,6 +88,33 @@ add_iface_cb(GError *error, gpointer user_data)
|
|||
g_object_unref(slave);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_ovs_interface_is_dpdk(NMDevice *device)
|
||||
{
|
||||
NMSettingOvsInterface *s_ovs_iface;
|
||||
|
||||
s_ovs_iface = nm_device_get_applied_setting(device, NM_TYPE_SETTING_OVS_INTERFACE);
|
||||
|
||||
g_return_val_if_fail(s_ovs_iface, FALSE);
|
||||
|
||||
return nm_streq(nm_setting_ovs_interface_get_interface_type(s_ovs_iface), "dpdk");
|
||||
}
|
||||
|
||||
static void
|
||||
set_mtu_cb(GError *error, gpointer user_data)
|
||||
{
|
||||
NMDevice *self = user_data;
|
||||
|
||||
if (error && !g_error_matches(error, NM_UTILS_ERROR, NM_UTILS_ERROR_CANCELLED_DISPOSING)) {
|
||||
_LOGW(LOGD_DEVICE,
|
||||
"could not change mtu of '%s': %s",
|
||||
nm_device_get_iface(self),
|
||||
error->message);
|
||||
}
|
||||
|
||||
g_object_unref(self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
enslave_slave(NMDevice *device, NMDevice *slave, NMConnection *connection, gboolean configure)
|
||||
{
|
||||
|
|
@ -94,6 +122,7 @@ enslave_slave(NMDevice *device, NMDevice *slave, NMConnection *connection, gbool
|
|||
NMActiveConnection *ac_port = NULL;
|
||||
NMActiveConnection *ac_bridge = NULL;
|
||||
NMDevice *bridge_device;
|
||||
NMSettingWired *s_wired;
|
||||
|
||||
if (!configure)
|
||||
return TRUE;
|
||||
|
|
@ -122,6 +151,21 @@ enslave_slave(NMDevice *device, NMDevice *slave, NMConnection *connection, gbool
|
|||
add_iface_cb,
|
||||
g_object_ref(slave));
|
||||
|
||||
/* DPDK ports does not have a link after the devbind, so the MTU must be
|
||||
* set on ovsdb after adding the interface. */
|
||||
if (NM_IS_DEVICE_OVS_INTERFACE(slave) && _ovs_interface_is_dpdk(slave)) {
|
||||
s_wired = nm_device_get_applied_setting(slave, NM_TYPE_SETTING_WIRED);
|
||||
|
||||
if (!s_wired || !nm_setting_wired_get_mtu(s_wired))
|
||||
return TRUE;
|
||||
|
||||
nm_ovsdb_set_interface_mtu(nm_ovsdb_get(),
|
||||
nm_device_get_ip_iface(slave),
|
||||
nm_setting_wired_get_mtu(s_wired),
|
||||
set_mtu_cb,
|
||||
g_object_ref(slave));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue