mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-27 12:50:33 +01:00
fixup! WIP: support ethtool Forward Error Correction(fec)
Use PROPERTY_INFO_ETHTOOL instead of PROPERTY_INFO_WITH_DESC and adjust the _get_fcn_ethtool() and _set_fcn_ethtool().
This commit is contained in:
parent
b0d5386de3
commit
6a5e684749
6 changed files with 11 additions and 52 deletions
|
|
@ -99,6 +99,7 @@ const NMEthtoolData *const nm_ethtool_data[_NM_ETHTOOL_ID_NUM + 1] = {
|
|||
ETHT_DATA(FEATURE_TX_UDP_SEGMENTATION),
|
||||
ETHT_DATA(FEATURE_TX_UDP_TNL_CSUM_SEGMENTATION),
|
||||
ETHT_DATA(FEATURE_TX_UDP_TNL_SEGMENTATION),
|
||||
ETHT_DATA(FEC),
|
||||
ETHT_DATA(FEATURE_TX_VLAN_STAG_HW_INSERT),
|
||||
ETHT_DATA(PAUSE_AUTONEG),
|
||||
ETHT_DATA(PAUSE_RX),
|
||||
|
|
@ -111,7 +112,6 @@ const NMEthtoolData *const nm_ethtool_data[_NM_ETHTOOL_ID_NUM + 1] = {
|
|||
ETHT_DATA(CHANNELS_TX),
|
||||
ETHT_DATA(CHANNELS_OTHER),
|
||||
ETHT_DATA(CHANNELS_COMBINED),
|
||||
ETHT_DATA(FEC),
|
||||
[_NM_ETHTOOL_ID_NUM] = NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1981,7 +1981,7 @@ global:
|
|||
|
||||
libnm_1_48_0 {
|
||||
global:
|
||||
nm_ethtool_fec_get_type;
|
||||
nm_ethtool_optname_is_fec;
|
||||
nm_setting_connection_down_on_poweroff_get_type;
|
||||
nm_setting_connection_get_down_on_poweroff;
|
||||
nm_setting_ip_config_get_dhcp_send_release;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ nm_ethtool_optname_is_pause(const char *optname)
|
|||
*
|
||||
* Returns: %TRUE, if @optname is valid
|
||||
*
|
||||
* Since: 1.32
|
||||
* Since: 1.48
|
||||
*/
|
||||
gboolean
|
||||
nm_ethtool_optname_is_fec(const char *optname)
|
||||
|
|
|
|||
|
|
@ -4441,6 +4441,7 @@ _get_fcn_ethtool(ARGS_GET_FCN)
|
|||
case NM_ETHTOOL_TYPE_CHANNELS:
|
||||
case NM_ETHTOOL_TYPE_COALESCE:
|
||||
case NM_ETHTOOL_TYPE_RING:
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
if (!nm_setting_option_get_uint32(setting, nm_ethtool_data[ethtool_id]->optname, &u32)) {
|
||||
NM_SET_OUT(out_is_default, TRUE);
|
||||
return NULL;
|
||||
|
|
@ -4459,8 +4460,6 @@ _get_fcn_ethtool(ARGS_GET_FCN)
|
|||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
s = gettext(s);
|
||||
return s;
|
||||
// NM_ETHTOOL_TYPE_FEC is not using `_pt_ethtool`, hence unreachable here
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
case NM_ETHTOOL_TYPE_UNKNOWN:
|
||||
nm_assert_not_reached();
|
||||
}
|
||||
|
|
@ -4482,6 +4481,7 @@ _set_fcn_ethtool(ARGS_SET_FCN)
|
|||
case NM_ETHTOOL_TYPE_CHANNELS:
|
||||
case NM_ETHTOOL_TYPE_COALESCE:
|
||||
case NM_ETHTOOL_TYPE_RING:
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
i64 = _nm_utils_ascii_str_to_int64(value, 10, 0, G_MAXUINT32, -1);
|
||||
if (i64 == -1) {
|
||||
nm_utils_error_set(
|
||||
|
|
@ -4514,8 +4514,6 @@ _set_fcn_ethtool(ARGS_SET_FCN)
|
|||
|
||||
nm_setting_option_set_boolean(setting, nm_ethtool_data[ethtool_id]->optname, !!t);
|
||||
return TRUE;
|
||||
// NM_ETHTOOL_TYPE_FEC is not using `_pt_ethtool`, hence unreachable here
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
case NM_ETHTOOL_TYPE_UNKNOWN:
|
||||
nm_assert_not_reached();
|
||||
}
|
||||
|
|
@ -5992,42 +5990,7 @@ static const NMMetaPropertyInfo *const property_infos_ETHTOOL[] = {
|
|||
PROPERTY_INFO_ETHTOOL (CHANNELS_TX),
|
||||
PROPERTY_INFO_ETHTOOL (CHANNELS_OTHER),
|
||||
PROPERTY_INFO_ETHTOOL (CHANNELS_COMBINED),
|
||||
// PROPERTY_INFO_WITH_DESC (NM_ETHTOOL_OPTNAME_FEC,
|
||||
PROPERTY_INFO(NM_ETHTOOL_OPTNAME_FEC, "TODO doc",
|
||||
.property_type = &_pt_gobject_enum,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA
|
||||
(
|
||||
PROPERTY_TYP_DATA_SUBTYPE
|
||||
(gobject_enum,
|
||||
.get_gtype = nm_ethtool_fec_get_type,
|
||||
.value_infos = ENUM_VALUE_INFOS
|
||||
(
|
||||
{
|
||||
.value = NM_ETHTOOL_FEC_AUTO,
|
||||
.nick = "auto",
|
||||
},
|
||||
{
|
||||
.value = NM_ETHTOOL_FEC_OFF,
|
||||
.nick = "off",
|
||||
},
|
||||
{
|
||||
.value = NM_ETHTOOL_FEC_RS,
|
||||
.nick = "rs",
|
||||
},
|
||||
{
|
||||
.value = NM_ETHTOOL_FEC_BASER,
|
||||
.nick = "baser",
|
||||
},
|
||||
{
|
||||
.value = NM_ETHTOOL_FEC_LLRS,
|
||||
.nick = "llrs",
|
||||
},
|
||||
),
|
||||
),
|
||||
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
|
||||
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_ETHTOOL (FEC),
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -117,14 +117,12 @@ get_ethtool_format(const NMMetaPropertyInfo *prop_info)
|
|||
case NM_ETHTOOL_TYPE_CHANNELS:
|
||||
case NM_ETHTOOL_TYPE_COALESCE:
|
||||
case NM_ETHTOOL_TYPE_RING:
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
return g_strdup("integer");
|
||||
case NM_ETHTOOL_TYPE_FEATURE:
|
||||
case NM_ETHTOOL_TYPE_PAUSE:
|
||||
case NM_ETHTOOL_TYPE_EEE:
|
||||
return g_strdup("ternary");
|
||||
// NM_ETHTOOL_TYPE_FEC is not using NM_META_PROPERTY_TYPE_FORMAT_ETHTOOL,
|
||||
// hence unreachable.
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
case NM_ETHTOOL_TYPE_UNKNOWN:
|
||||
nm_assert_not_reached();
|
||||
};
|
||||
|
|
@ -324,6 +322,7 @@ append_ethtool_valid_values(const NMMetaPropertyInfo *prop_info, GPtrArray *vali
|
|||
case NM_ETHTOOL_TYPE_CHANNELS:
|
||||
case NM_ETHTOOL_TYPE_COALESCE:
|
||||
case NM_ETHTOOL_TYPE_RING:
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
g_ptr_array_add(valid_values, g_strdup_printf("0 - %u", G_MAXUINT32));
|
||||
break;
|
||||
case NM_ETHTOOL_TYPE_FEATURE:
|
||||
|
|
@ -331,9 +330,6 @@ append_ethtool_valid_values(const NMMetaPropertyInfo *prop_info, GPtrArray *vali
|
|||
case NM_ETHTOOL_TYPE_EEE:
|
||||
append_vals(valid_values, "on", "off", "ignore");
|
||||
break;
|
||||
case NM_ETHTOOL_TYPE_FEC:
|
||||
append_enum_valid_values(prop_info, valid_values);
|
||||
break;
|
||||
case NM_ETHTOOL_TYPE_UNKNOWN:
|
||||
nm_assert_not_reached();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1079,9 +1079,9 @@
|
|||
format="integer"
|
||||
values="0 - 4294967295" />
|
||||
<property name="fec"
|
||||
format="flags (NMEthtoolFec)"
|
||||
nmcli-description="The Forward Error Correction(FEC) encoding modes to set. Not all devices support all options. May be any combination of "auto" (0x2), "off" (0x4), "rs" (0x8), "baser" (0x10), "llrs" (0x20)"
|
||||
values="auto(0x2), off(0x4), rs(0x8), baser(0x10), llrs(0x20)"/>
|
||||
format="integer"
|
||||
nmcli-description="The Forward Error Correction(FEC) encoding modes to set. Not all devices support all options. May be any combination of "auto" (0x2), "off" (0x4), "rs" (0x8), "baser" (0x10), "llrs" (0x20)"
|
||||
values="0 - 4294967295" />
|
||||
</setting>
|
||||
<setting name="generic" >
|
||||
<property name="device-handler"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue