libnm: show ethtool options in "gen-metadata-nm-settings-libnm-core.xml"

This commit is contained in:
Thomas Haller
2022-11-09 12:29:05 +01:00
parent 171f2c4ce3
commit 412a5d2d08
2 changed files with 413 additions and 39 deletions

View File

@@ -5,6 +5,9 @@
#include "libnm-glib-aux/nm-str-buf.h"
#include "libnm-core-intern/nm-meta-setting-base.h"
#include "libnm-core-intern/nm-core-internal.h"
#include "libnm-base/nm-ethtool-base.h"
#include "libnm-core-public/nm-setting-ethtool.h"
#define INDENT 4
@@ -37,45 +40,48 @@ main(int argc, char *argv[])
const NMSettInfoSetting *sett_info_settings = nmtst_sett_info_settings();
NMMetaSettingType meta_type;
g_print("<!--\n"
" This file is generated.\n"
"\n"
" This XML contains meta data of NetworkManager connection profiles.\n"
"\n"
" NetworkManager's connection profiles are a bunch of settings, and this\n"
" contains the known properties. See also `man nm-settings-{dbus,nmcli,keyfile}`.\n"
"\n"
" Note that there are different manifestations of these properties. We have them\n"
" on the D-Bus API (`man nm-settings-dbus`), in keyfile format (`man "
"nm-settings-keyfile`)\n"
" in libnm's NMConnection and NMSetting API, and in nmcli (`man nm-settings-nmcli`).\n"
" There are similarities between these, but also subtle differencs. For example,\n"
" a property might not be shown in nmcli, or a property might be named different\n"
" on D-Bus or keyfile. Also, the data types may differ due to the differences of the\n"
" technology.\n"
"\n"
" This list of properties is not directly the properties as they are in any of\n"
" those manifestations. Instead, it's a general idea that this property exists in\n"
" NetworkManager. Whether and how it is represented in nmcli or keyfile, may differ.\n"
" The XML however aims to provide information for various backends.\n"
"\n"
" <setting> Attributes:\n"
" \"name\": the name of the setting.\n"
" \"gtype\": the typename of the NMSetting class in libnm.\n"
"\n"
" <property> Attributes:\n"
" \"name\": the name of the property.\n"
" \"is-deprecated\": whether this property is deprecated.\n"
" \"is-secret\": whether this property is a secret.\n"
" \"is-secret-flags\": whether this property is a secret flags property.\n"
" \"dbus-type\": if this property is exposed on D-Bus. In that case, this\n"
" is the D-Bus type format. Also, \"name\" is the actual name of the field\n"
" \"dbus-deprecated\": if this property is on D-Bus and that representation is\n"
" deprecated. This usually means, that there is a replacement D-Bus property\n"
" that should be used instead.\n"
" \"gprop-type\": if this is a GObject property in the NMSetting class, this\n"
" is the GParamSpec.value_type of the property.\n"
" -->\n");
g_print(
"<!--\n"
" This file is generated.\n"
"\n"
" This XML contains meta data of NetworkManager connection profiles.\n"
"\n"
" NetworkManager's connection profiles are a bunch of settings, and this\n"
" contains the known properties. See also `man nm-settings-{dbus,nmcli,keyfile}`.\n"
"\n"
" Note that there are different manifestations of these properties. We have them\n"
" on the D-Bus API (`man nm-settings-dbus`), in keyfile format (`man "
"nm-settings-keyfile`)\n"
" in libnm's NMConnection and NMSetting API, and in nmcli (`man nm-settings-nmcli`).\n"
" There are similarities between these, but also subtle differencs. For example,\n"
" a property might not be shown in nmcli, or a property might be named different\n"
" on D-Bus or keyfile. Also, the data types may differ due to the differences of the\n"
" technology.\n"
"\n"
" This list of properties is not directly the properties as they are in any of\n"
" those manifestations. Instead, it's a general idea that this property exists in\n"
" NetworkManager. Whether and how it is represented in nmcli or keyfile, may differ.\n"
" The XML however aims to provide information for various backends.\n"
"\n"
" <setting> Attributes:\n"
" \"name\": the name of the setting.\n"
" \"gtype\": the typename of the NMSetting class in libnm.\n"
"\n"
" <property> Attributes:\n"
" \"name\": the name of the property.\n"
" \"is-deprecated\": whether this property is deprecated.\n"
" \"is-secret\": whether this property is a secret.\n"
" \"is-secret-flags\": whether this property is a secret flags property.\n"
" \"dbus-type\": if this property is exposed on D-Bus. In that case, this\n"
" is the D-Bus type format. Also, \"name\" is the actual name of the field\n"
" \"dbus-deprecated\": if this property is on D-Bus and that representation is\n"
" deprecated. This usually means, that there is a replacement D-Bus property\n"
" that should be used instead.\n"
" \"gprop-type\": if this is a GObject property in the NMSetting class, this\n"
" is the GParamSpec.value_type of the property.\n"
" \"is-setting-option\": whether the property is implemented in libnm's NMSetting\n"
" via the nm_setting_option_*() API.\n"
" -->\n");
g_print("<nm-setting-docs>\n");
for (meta_type = 0; meta_type < _NM_META_SETTING_TYPE_NUM; meta_type++) {
const NMSettInfoSetting *sis = &sett_info_settings[meta_type];
@@ -130,6 +136,24 @@ main(int argc, char *argv[])
g_print("\n%s/>\n", _indent_level(2 * INDENT + 10));
}
if (nm_streq(msi->setting_name, NM_SETTING_ETHTOOL_SETTING_NAME)) {
NMEthtoolID ethtool_id;
/* NMSettingEthtool's properties are "gendata" options. They are implemented differently. */
for (ethtool_id = _NM_ETHTOOL_ID_FIRST; ethtool_id <= _NM_ETHTOOL_ID_LAST;
ethtool_id++) {
g_print("%s<property", _indent_level(2 * INDENT));
g_print(" name=%s", _xml_escape_attr(&sbuf1, nm_ethtool_data[ethtool_id]->optname));
g_print(
"\n%sdbus-type=%s",
_indent_level(2 * INDENT + 10),
_xml_escape_attr(&sbuf1,
(const char *) nm_ethtool_id_get_variant_type(ethtool_id)));
g_print("\n%sis-setting-option=\"1\"", _indent_level(2 * INDENT + 10));
g_print("\n%s/>\n", _indent_level(2 * INDENT + 10));
}
}
g_print("%s</setting>\n", _indent_level(INDENT));
}
g_print("</nm-setting-docs>\n");

View File

@@ -35,6 +35,8 @@
that should be used instead.
"gprop-type": if this is a GObject property in the NMSetting class, this
is the GParamSpec.value_type of the property.
"is-setting-option": whether the property is implemented in libnm's NMSetting
via the nm_setting_option_*() API.
-->
<nm-setting-docs>
<setting name="6lowpan"
@@ -935,6 +937,354 @@
<setting name="ethtool"
gtype="NMSettingEthtool"
>
<property name="coalesce-adaptive-rx"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-adaptive-tx"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-pkt-rate-high"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-pkt-rate-low"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-frames"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-frames-high"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-frames-irq"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-frames-low"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-usecs"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-usecs-high"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-usecs-irq"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-rx-usecs-low"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-sample-interval"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-stats-block-usecs"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-frames"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-frames-high"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-frames-irq"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-frames-low"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-usecs"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-usecs-high"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-usecs-irq"
dbus-type="u"
is-setting-option="1"
/>
<property name="coalesce-tx-usecs-low"
dbus-type="u"
is-setting-option="1"
/>
<property name="feature-esp-hw-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-esp-tx-csum-hw-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-fcoe-mtu"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-gro"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-gso"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-highdma"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-hw-tc-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-l2-fwd-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-loopback"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-lro"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-macsec-hw-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-ntuple"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rxhash"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rxvlan"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-all"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-fcs"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-gro-hw"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-gro-list"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-udp-gro-forwarding"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-udp_tunnel-port-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-vlan-filter"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-vlan-stag-filter"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-rx-vlan-stag-hw-parse"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-sg"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tls-hw-record"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tls-hw-rx-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tls-hw-tx-offload"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tso"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-txvlan"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-checksum-fcoe-crc"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-checksum-ipv4"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-checksum-ipv6"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-checksum-ip-generic"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-checksum-sctp"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-esp-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-fcoe-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-gre-csum-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-gre-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-gso-list"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-gso-partial"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-gso-robust"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-ipxip4-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-ipxip6-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-nocache-copy"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-scatter-gather"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-scatter-gather-fraglist"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-sctp-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-tcp6-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-tcp-ecn-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-tcp-mangleid-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-tcp-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-tunnel-remcsum-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-udp-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-udp_tnl-csum-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-udp_tnl-segmentation"
dbus-type="b"
is-setting-option="1"
/>
<property name="feature-tx-vlan-stag-hw-insert"
dbus-type="b"
is-setting-option="1"
/>
<property name="pause-autoneg"
dbus-type="b"
is-setting-option="1"
/>
<property name="pause-rx"
dbus-type="b"
is-setting-option="1"
/>
<property name="pause-tx"
dbus-type="b"
is-setting-option="1"
/>
<property name="ring-rx"
dbus-type="u"
is-setting-option="1"
/>
<property name="ring-rx-jumbo"
dbus-type="u"
is-setting-option="1"
/>
<property name="ring-rx-mini"
dbus-type="u"
is-setting-option="1"
/>
<property name="ring-tx"
dbus-type="u"
is-setting-option="1"
/>
</setting>
<setting name="generic"
gtype="NMSettingGeneric"