diff options
author | Dan Williams <dcbw@redhat.com> | 2013-10-04 16:56:34 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-10-26 11:46:30 -0500 |
commit | d2850720931025b15eeb3ef8f1de1b74baa4f535 (patch) | |
tree | 474b9c1dc591972233c269c88e8a1296480be263 | |
parent | bff2caea7fdb29a0ed6052bc9bbdbe02d3b596c6 (diff) | |
download | NetworkManager-dcbw/dcb.tar.gz |
core: set up and tear down DCB/FCoE when DCB is enableddcbw/dcb
-rw-r--r-- | include/NetworkManager.h | 3 | ||||
-rw-r--r-- | introspection/nm-device.xml | 5 | ||||
-rw-r--r-- | src/devices/nm-device-ethernet.c | 29 |
3 files changed, 37 insertions, 0 deletions
diff --git a/include/NetworkManager.h b/include/NetworkManager.h index a635706656..192f9a5178 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -545,6 +545,9 @@ typedef enum { /* A secondary connection of the base connection failed */ NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED = 54, + /* DCB or FCoE setup failed */ + NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED = 55, + /* Unused */ NM_DEVICE_STATE_REASON_LAST = 0xFFFF } NMDeviceStateReason; diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml index fb84fe376e..7c63a3d738 100644 --- a/introspection/nm-device.xml +++ b/introspection/nm-device.xml @@ -579,6 +579,11 @@ A secondary connection of the base connection failed. </tp:docstring> </tp:enumvalue> + <tp:enumvalue suffix="DCB_FCOE_FAILED" value="55"> + <tp:docstring> + DCB or FCoE setup failed. + </tp:docstring> + </tp:enumvalue> </tp:enum> <tp:struct name="NM_DEVICE_STATE_REASON_STRUCT"> diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 91a39ed18d..83f27b86b3 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -55,6 +55,7 @@ #include "nm-enum-types.h" #include "nm-dbus-manager.h" #include "nm-platform.h" +#include "nm-dcb.h" #include "nm-device-ethernet-glue.h" @@ -1045,9 +1046,24 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) NMSettingConnection *s_con; const char *connection_type; 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); + /* 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)); g_assert (s_con); @@ -1113,6 +1129,8 @@ deactivate (NMDevice *device) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device); NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); + NMSettingDcb *s_dcb; + GError *error = NULL; /* Clear wired secrets tries when deactivating */ clear_secrets_tries (device); @@ -1129,6 +1147,17 @@ deactivate (NMDevice *device) 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 */ nm_device_set_hw_addr (device, priv->initial_hw_addr, "reset", LOGD_ETHER); } |