mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 03:48:09 +02:00
core: optimize hash table search in _ethtool_fec_set
Break the loop as soon as we've found the value. Fixes:19bed3121f('ethtool: support Forward Error Correction(fec)') (cherry picked from commit245f0e0b35) (cherry picked from commit094a542546) (cherry picked from commit8e11dc83a6)
This commit is contained in:
parent
2d10cb1706
commit
495c0ffdb6
1 changed files with 5 additions and 7 deletions
|
|
@ -2633,13 +2633,11 @@ _ethtool_fec_set(NMDevice *self,
|
||||||
|
|
||||||
g_hash_table_iter_init(&iter, hash);
|
g_hash_table_iter_init(&iter, hash);
|
||||||
while (g_hash_table_iter_next(&iter, (gpointer *) &name, (gpointer *) &variant)) {
|
while (g_hash_table_iter_next(&iter, (gpointer *) &name, (gpointer *) &variant)) {
|
||||||
NMEthtoolID ethtool_id = nm_ethtool_id_get_by_name(name);
|
if (nm_ethtool_id_is_fec(nm_ethtool_id_get_by_name(name))) {
|
||||||
|
nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32));
|
||||||
if (!nm_ethtool_id_is_fec(ethtool_id))
|
fec_mode = g_variant_get_uint32(variant);
|
||||||
continue;
|
break;
|
||||||
|
}
|
||||||
nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32));
|
|
||||||
fec_mode = g_variant_get_uint32(variant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The NM_SETTING_ETHTOOL_FEC_MODE_NONE is query only value, hence do nothing. */
|
/* The NM_SETTING_ETHTOOL_FEC_MODE_NONE is query only value, hence do nothing. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue