summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-12-12 16:43:37 +0100
committerLubomir Rintel <lkundrak@v3.sk>2014-12-12 16:44:30 +0100
commit057fed567a27c73f5b161fc83265efbdbed23fc1 (patch)
treeb62b5e6806ee5e0f0a7c08217bed53c8f47a613c
parent77bfcdc2e7c71adde9034a13f6902073f5fce002 (diff)
downloadNetworkManager-lr/qdisc.tar.gz
WIP qdisc propertylr/qdisc
does nothing yet
-rw-r--r--clients/cli/settings.c12
-rw-r--r--libnm-core/nm-setting-connection.c49
-rw-r--r--libnm-core/nm-setting-connection.h3
-rw-r--r--libnm-core/tests/test-general.c1
-rw-r--r--libnm-util/nm-setting-connection.c20
-rw-r--r--libnm-util/nm-setting-connection.h4
-rw-r--r--libnm-util/tests/test-general.c1
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c5
8 files changed, 94 insertions, 1 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 7d2a46c8c9..ae1482568b 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -53,6 +53,7 @@ NmcOutputField nmc_fields_setting_connection[] = {
SETTING_FIELD (NM_SETTING_CONNECTION_SLAVE_TYPE, 20), /* 12 */
SETTING_FIELD (NM_SETTING_CONNECTION_SECONDARIES, 40), /* 13 */
SETTING_FIELD (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, 30), /* 14 */
+ SETTING_FIELD (NM_SETTING_CONNECTION_QDISC, 20), /* 15 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTING_CONNECTION_ALL "name"","\
@@ -69,7 +70,8 @@ NmcOutputField nmc_fields_setting_connection[] = {
NM_SETTING_CONNECTION_MASTER","\
NM_SETTING_CONNECTION_SLAVE_TYPE","\
NM_SETTING_CONNECTION_SECONDARIES","\
- NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT
+ NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT","\
+ NM_SETTING_CONNECTION_QDISC
#define NMC_FIELDS_SETTING_CONNECTION_COMMON NMC_FIELDS_SETTING_CONNECTION_ALL
/* Available fields for NM_SETTING_WIRED_SETTING_NAME */
@@ -1048,6 +1050,7 @@ DEFINE_GETTER (nmc_property_connection_get_master, NM_SETTING_CONNECTION_MASTER)
DEFINE_GETTER (nmc_property_connection_get_slave_type, NM_SETTING_CONNECTION_SLAVE_TYPE)
DEFINE_GETTER (nmc_property_connection_get_secondaries, NM_SETTING_CONNECTION_SECONDARIES)
DEFINE_GETTER (nmc_property_connection_get_gateway_ping_timeout, NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT)
+DEFINE_GETTER (nmc_property_connection_get_qdisc, NM_SETTING_CONNECTION_QDISC)
/* --- NM_SETTING_DCB_SETTING_NAME property get functions --- */
static char *
@@ -5222,6 +5225,13 @@ nmc_properties_init (void)
NULL,
NULL,
NULL);
+ nmc_add_prop_funcs (GLUE (CONNECTION, ID),
+ nmc_property_connection_get_qdisc,
+ nmc_property_set_string,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
/* Add editable properties for NM_SETTING_DCB_SETTING_NAME */
nmc_add_prop_funcs (GLUE (DCB, APP_FCOE_FLAGS),
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c
index 01f5d423c1..fa4ba71211 100644
--- a/libnm-core/nm-setting-connection.c
+++ b/libnm-core/nm-setting-connection.c
@@ -74,6 +74,7 @@ typedef struct {
char *zone;
GSList *secondaries; /* secondary connections to activate with the base connection */
guint gateway_ping_timeout;
+ char *qdisc;
} NMSettingConnectionPrivate;
enum {
@@ -92,6 +93,7 @@ enum {
PROP_SLAVE_TYPE,
PROP_SECONDARIES,
PROP_GATEWAY_PING_TIMEOUT,
+ PROP_QDISC,
LAST_PROP
};
@@ -738,6 +740,22 @@ nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting)
return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->gateway_ping_timeout;
}
+/**
+ * nm_setting_connection_get_qdisc:
+ * @setting: the #NMSettingConnection
+ *
+ * Returns the #NMSettingConnection:qdisc property of the connection.
+ *
+ * Returns: the queueing discipline for this connection is, if any
+ */
+const char *
+nm_setting_connection_get_qdisc (NMSettingConnection *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), NULL);
+
+ return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->qdisc;
+}
+
static void
_set_error_missing_base_setting (GError **error, const char *type)
{
@@ -1128,6 +1146,10 @@ set_property (GObject *object, guint prop_id,
case PROP_GATEWAY_PING_TIMEOUT:
priv->gateway_ping_timeout = g_value_get_uint (value);
break;
+ case PROP_QDISC:
+ g_free (priv->qdisc);
+ priv->qdisc = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1198,6 +1220,9 @@ get_property (GObject *object, guint prop_id,
case PROP_GATEWAY_PING_TIMEOUT:
g_value_set_uint (value, priv->gateway_ping_timeout);
break;
+ case PROP_QDISC:
+ g_value_set_string (value, nm_setting_connection_get_qdisc (setting));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1566,4 +1591,28 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingConnection:qdisc:
+ *
+ * Interface's queueing discipline.
+ * Only parameter-less qdiscs are supported.
+ **/
+ /* ---ifcfg-rh---
+ * property: gateway-ping-timeout
+ * variable: QDISC(+)
+ * description: Interface's queueing discipline.
+ * Only parameter-less qdiscs are supported.
+ * example: QDISC=fq_codel
+ * ---end---
+ */
+ g_object_class_install_property
+ (object_class, PROP_QDISC,
+ g_param_spec_uint (NM_SETTING_CONNECTION_QDISC, "", "",
+ 0, 30, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_FUZZY_IGNORE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
}
diff --git a/libnm-core/nm-setting-connection.h b/libnm-core/nm-setting-connection.h
index d1ad0fe1e5..d564421157 100644
--- a/libnm-core/nm-setting-connection.h
+++ b/libnm-core/nm-setting-connection.h
@@ -58,6 +58,7 @@ G_BEGIN_DECLS
#define NM_SETTING_CONNECTION_SLAVE_TYPE "slave-type"
#define NM_SETTING_CONNECTION_SECONDARIES "secondaries"
#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
+#define NM_SETTING_CONNECTION_QDISC "qdisc"
/**
* NMSettingConnection:
@@ -120,6 +121,8 @@ gboolean nm_setting_connection_remove_secondary_by_value (NMSettingConnection
guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
+const char *nm_setting_connection_get_qdisc (NMSettingConnection *setting);
+
G_END_DECLS
#endif /* __NM_SETTING_CONNECTION_H__ */
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 46d58ca3d9..1fc33dd685 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -1802,6 +1802,7 @@ test_connection_diff_a_only (void)
{ NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_SECONDARIES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_CONNECTION_QDISC, NM_SETTING_DIFF_RESULT_IN_A },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }
} },
{ NM_SETTING_WIRED_SETTING_NAME, {
diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c
index 162ae7cb02..2bdffa2443 100644
--- a/libnm-util/nm-setting-connection.c
+++ b/libnm-util/nm-setting-connection.c
@@ -109,6 +109,7 @@ enum {
PROP_SLAVE_TYPE,
PROP_SECONDARIES,
PROP_GATEWAY_PING_TIMEOUT,
+ PROP_QDISC,
LAST_PROP
};
@@ -1332,4 +1333,23 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+
+
+ /**
+ * NMSettingConnection:qdisc:
+ *
+ * Interface's queueing discipline.
+ * Only parameter-less qdiscs are supported.
+ *
+ * Since: 1.0
+ **/
+ g_object_class_install_property
+ (object_class, PROP_QDISC,
+ g_param_spec_uint (NM_SETTING_CONNECTION_QDISC, "", "",
+ 0, 30, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_FUZZY_IGNORE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
}
diff --git a/libnm-util/nm-setting-connection.h b/libnm-util/nm-setting-connection.h
index 143fa11d58..950f2845d8 100644
--- a/libnm-util/nm-setting-connection.h
+++ b/libnm-util/nm-setting-connection.h
@@ -78,6 +78,7 @@ GQuark nm_setting_connection_error_quark (void);
#define NM_SETTING_CONNECTION_SLAVE_TYPE "slave-type"
#define NM_SETTING_CONNECTION_SECONDARIES "secondaries"
#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
+#define NM_SETTING_CONNECTION_QDISC "qdisc"
/**
* NMSettingConnection:
@@ -146,6 +147,9 @@ gboolean nm_setting_connection_remove_secondary_by_value (NMSettingConnection
NM_AVAILABLE_IN_0_9_10
guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
+NM_AVAILABLE_IN_1_0
+const char *nm_setting_connection_get_qdisc (NMSettingConnection *setting);
+
G_END_DECLS
#endif /* NM_SETTING_CONNECTION_H */
diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c
index f748fcf595..45e6631bd5 100644
--- a/libnm-util/tests/test-general.c
+++ b/libnm-util/tests/test-general.c
@@ -1248,6 +1248,7 @@ test_connection_diff_a_only (void)
{ NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_SECONDARIES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_CONNECTION_QDISC, NM_SETTING_DIFF_RESULT_IN_A },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }
} },
{ NM_SETTING_WIRED_SETTING_NAME, {
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 145a0a3915..cfdcb9a80e 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -248,6 +248,11 @@ make_connection_setting (const char *file,
g_free (value);
}
+ value = svGetValue (ifcfg, "QDISC", FALSE);
+ if (value && strlen (value))
+ g_object_set (s_con, NM_SETTING_CONNECTION_QDISC, value, NULL);
+ g_free (value);
+
return NM_SETTING (s_con);
}