core: set up and tear down DCB/FCoE when DCB is enabled
This commit is contained in:
@@ -545,6 +545,9 @@ typedef enum {
|
|||||||
/* A secondary connection of the base connection failed */
|
/* A secondary connection of the base connection failed */
|
||||||
NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED = 54,
|
NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED = 54,
|
||||||
|
|
||||||
|
/* DCB or FCoE setup failed */
|
||||||
|
NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED = 55,
|
||||||
|
|
||||||
/* Unused */
|
/* Unused */
|
||||||
NM_DEVICE_STATE_REASON_LAST = 0xFFFF
|
NM_DEVICE_STATE_REASON_LAST = 0xFFFF
|
||||||
} NMDeviceStateReason;
|
} NMDeviceStateReason;
|
||||||
|
@@ -579,6 +579,11 @@
|
|||||||
A secondary connection of the base connection failed.
|
A secondary connection of the base connection failed.
|
||||||
</tp:docstring>
|
</tp:docstring>
|
||||||
</tp:enumvalue>
|
</tp:enumvalue>
|
||||||
|
<tp:enumvalue suffix="DCB_FCOE_FAILED" value="55">
|
||||||
|
<tp:docstring>
|
||||||
|
DCB or FCoE setup failed.
|
||||||
|
</tp:docstring>
|
||||||
|
</tp:enumvalue>
|
||||||
</tp:enum>
|
</tp:enum>
|
||||||
|
|
||||||
<tp:struct name="NM_DEVICE_STATE_REASON_STRUCT">
|
<tp:struct name="NM_DEVICE_STATE_REASON_STRUCT">
|
||||||
|
@@ -55,6 +55,7 @@
|
|||||||
#include "nm-enum-types.h"
|
#include "nm-enum-types.h"
|
||||||
#include "nm-dbus-manager.h"
|
#include "nm-dbus-manager.h"
|
||||||
#include "nm-platform.h"
|
#include "nm-platform.h"
|
||||||
|
#include "nm-dcb.h"
|
||||||
|
|
||||||
#include "nm-device-ethernet-glue.h"
|
#include "nm-device-ethernet-glue.h"
|
||||||
|
|
||||||
@@ -1045,9 +1046,24 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
|||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
const char *connection_type;
|
const char *connection_type;
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||||
|
NMSettingDcb *s_dcb;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||||
|
|
||||||
|
/* DCB and FCoE setup */
|
||||||
|
s_dcb = (NMSettingDcb *) device_get_setting (device, NM_TYPE_SETTING_DCB);
|
||||||
|
if (s_dcb) {
|
||||||
|
if (!nm_dcb_setup (nm_device_get_iface (device), s_dcb, &error)) {
|
||||||
|
nm_log_warn (LOGD_DEVICE | LOGD_HW,
|
||||||
|
"Activation (%s/wired) failed to enable DCB/FCoE: %s",
|
||||||
|
nm_device_get_iface (device), error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
*reason = NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED;
|
||||||
|
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s_con = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
s_con = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
||||||
g_assert (s_con);
|
g_assert (s_con);
|
||||||
|
|
||||||
@@ -1113,6 +1129,8 @@ deactivate (NMDevice *device)
|
|||||||
{
|
{
|
||||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||||
|
NMSettingDcb *s_dcb;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
/* Clear wired secrets tries when deactivating */
|
/* Clear wired secrets tries when deactivating */
|
||||||
clear_secrets_tries (device);
|
clear_secrets_tries (device);
|
||||||
@@ -1129,6 +1147,17 @@ deactivate (NMDevice *device)
|
|||||||
|
|
||||||
supplicant_interface_release (self);
|
supplicant_interface_release (self);
|
||||||
|
|
||||||
|
/* Tear down DCB/FCoE if it was enabled */
|
||||||
|
s_dcb = (NMSettingDcb *) device_get_setting (device, NM_TYPE_SETTING_DCB);
|
||||||
|
if (s_dcb) {
|
||||||
|
if (!nm_dcb_cleanup (nm_device_get_iface (device), &error)) {
|
||||||
|
nm_log_warn (LOGD_DEVICE | LOGD_HW,
|
||||||
|
"(%s) failed to disable DCB/FCoE: %s",
|
||||||
|
nm_device_get_iface (device), error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset MAC address back to initial address */
|
/* Reset MAC address back to initial address */
|
||||||
nm_device_set_hw_addr (device, priv->initial_hw_addr, "reset", LOGD_ETHER);
|
nm_device_set_hw_addr (device, priv->initial_hw_addr, "reset", LOGD_ETHER);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user