diff options
author | Thomas Haller <thaller@redhat.com> | 2021-01-08 18:39:27 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-01-15 11:32:34 +0100 |
commit | 126681a965ac96f3d0544b0e4d00ce45b822fd40 (patch) | |
tree | 9a0f294f493f96228e49d921822924cfcf3f67f2 | |
parent | 2bb5c8b13ba5ace145f77538d8c004520573bae6 (diff) | |
download | NetworkManager-126681a965ac96f3d0544b0e4d00ce45b822fd40.tar.gz |
platform: move types from "nm-platform-utils.h" to nmp-base.h"
Thereby, also no longer include "nm-platform.h" and "nm-setting-wired.h"
in "nm-platform-utils.h".
-rw-r--r-- | shared/nm-platform/nmp-base.h | 86 | ||||
-rw-r--r-- | src/platform/nm-platform-utils.c | 7 | ||||
-rw-r--r-- | src/platform/nm-platform-utils.h | 71 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 12 | ||||
-rw-r--r-- | src/platform/wifi/nm-wifi-utils-wext.c | 1 |
5 files changed, 92 insertions, 85 deletions
diff --git a/shared/nm-platform/nmp-base.h b/shared/nm-platform/nmp-base.h index f4e50dd0b5..210c26d6bb 100644 --- a/shared/nm-platform/nmp-base.h +++ b/shared/nm-platform/nmp-base.h @@ -3,6 +3,92 @@ #ifndef __NMP_FWD_H__ #define __NMP_FWD_H__ +#include "nm-base/nm-base.h" + +/*****************************************************************************/ + +typedef enum { + NM_PLATFORM_LINK_DUPLEX_UNKNOWN, + NM_PLATFORM_LINK_DUPLEX_HALF, + NM_PLATFORM_LINK_DUPLEX_FULL, +} NMPlatformLinkDuplexType; + +/*****************************************************************************/ + +typedef struct { + /* We don't want to include <linux/ethtool.h> in header files, + * thus create a ABI compatible version of struct ethtool_drvinfo.*/ + guint32 _private_cmd; + char driver[32]; + char version[32]; + char fw_version[32]; + char _private_bus_info[32]; + char _private_erom_version[32]; + char _private_reserved2[12]; + guint32 _private_n_priv_flags; + guint32 _private_n_stats; + guint32 _private_testinfo_len; + guint32 _private_eedump_len; + guint32 _private_regdump_len; +} NMPUtilsEthtoolDriverInfo; + +typedef struct { + NMEthtoolID ethtool_id; + + guint8 n_kernel_names; + + /* one NMEthtoolID refers to one or more kernel_names. The reason for supporting this complexity + * (where one NMSettingEthtool option refers to multiple kernel features) is to follow what + * ethtool does, where "tx" is an alias for multiple features. */ + const char *const *kernel_names; +} NMEthtoolFeatureInfo; + +typedef struct { + const NMEthtoolFeatureInfo *info; + + guint idx_ss_features; + + /* one NMEthtoolFeatureInfo references one or more kernel_names. This is the index + * of the matching info->kernel_names */ + guint8 idx_kernel_name; + + bool available : 1; + bool requested : 1; + bool active : 1; + bool never_changed : 1; +} NMEthtoolFeatureState; + +typedef struct { + guint n_states; + + guint n_ss_features; + + /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */ + const NMEthtoolFeatureState *const *states_indexed[_NM_ETHTOOL_ID_FEATURE_NUM]; + + /* the same content, here as a list of n_states entries. */ + const NMEthtoolFeatureState states_list[]; +} NMEthtoolFeatureStates; + +/*****************************************************************************/ + +typedef struct { + guint32 + s[_NM_ETHTOOL_ID_COALESCE_NUM /* indexed by (NMEthtoolID - _NM_ETHTOOL_ID_COALESCE_FIRST) */ + ]; +} NMEthtoolCoalesceState; + +/*****************************************************************************/ + +typedef struct { + guint32 rx_pending; + guint32 rx_mini_pending; + guint32 rx_jumbo_pending; + guint32 tx_pending; +} NMEthtoolRingState; + +/*****************************************************************************/ + typedef struct _NMPNetns NMPNetns; #endif /* __NMP_FWD_H__ */ diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c index d615489b2d..a1b14b8679 100644 --- a/src/platform/nm-platform-utils.c +++ b/src/platform/nm-platform-utils.c @@ -18,12 +18,13 @@ #include <fcntl.h> #include <libudev.h> -#include "nm-utils.h" -#include "nm-setting-wired.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h" - +#include "nm-utils.h" +#include "nm-platform.h" #include "nm-core-utils.h" +/*****************************************************************************/ + #define ONOFF(bool_val) ((bool_val) ? "on" : "off") /****************************************************************************** diff --git a/src/platform/nm-platform-utils.h b/src/platform/nm-platform-utils.h index e411544b35..3de40a27d0 100644 --- a/src/platform/nm-platform-utils.h +++ b/src/platform/nm-platform-utils.h @@ -6,9 +6,8 @@ #ifndef __NM_PLATFORM_UTILS_H__ #define __NM_PLATFORM_UTILS_H__ -#include "nm-platform.h" -#include "nm-setting-wired.h" #include "nm-base/nm-base.h" +#include "nm-platform/nmp-base.h" /*****************************************************************************/ @@ -32,63 +31,8 @@ gboolean nmp_utils_ethtool_set_link_settings(int ifindex, gboolean nmp_utils_ethtool_get_permanent_address(int ifindex, guint8 *buf, size_t *length); -typedef struct { - /* We don't want to include <linux/ethtool.h> in header files, - * thus create a ABI compatible version of struct ethtool_drvinfo.*/ - guint32 _private_cmd; - char driver[32]; - char version[32]; - char fw_version[32]; - char _private_bus_info[32]; - char _private_erom_version[32]; - char _private_reserved2[12]; - guint32 _private_n_priv_flags; - guint32 _private_n_stats; - guint32 _private_testinfo_len; - guint32 _private_eedump_len; - guint32 _private_regdump_len; -} NMPUtilsEthtoolDriverInfo; - gboolean nmp_utils_ethtool_get_driver_info(int ifindex, NMPUtilsEthtoolDriverInfo *data); -typedef struct { - NMEthtoolID ethtool_id; - - guint8 n_kernel_names; - - /* one NMEthtoolID refers to one or more kernel_names. The reason for supporting this complexity - * (where one NMSettingEthtool option refers to multiple kernel features) is to follow what - * ethtool does, where "tx" is an alias for multiple features. */ - const char *const *kernel_names; -} NMEthtoolFeatureInfo; - -typedef struct { - const NMEthtoolFeatureInfo *info; - - guint idx_ss_features; - - /* one NMEthtoolFeatureInfo references one or more kernel_names. This is the index - * of the matching info->kernel_names */ - guint8 idx_kernel_name; - - bool available : 1; - bool requested : 1; - bool active : 1; - bool never_changed : 1; -} NMEthtoolFeatureState; - -struct _NMEthtoolFeatureStates { - guint n_states; - - guint n_ss_features; - - /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */ - const NMEthtoolFeatureState *const *states_indexed[_NM_ETHTOOL_ID_FEATURE_NUM]; - - /* the same content, here as a list of n_states entries. */ - const NMEthtoolFeatureState states_list[]; -}; - NMEthtoolFeatureStates *nmp_utils_ethtool_get_features(int ifindex); gboolean nmp_utils_ethtool_set_features( @@ -97,23 +41,10 @@ gboolean nmp_utils_ethtool_set_features( const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */, gboolean do_set /* or reset */); -struct _NMEthtoolCoalesceState { - guint32 - s[_NM_ETHTOOL_ID_COALESCE_NUM /* indexed by (NMEthtoolID - _NM_ETHTOOL_ID_COALESCE_FIRST) */ - ]; -}; - gboolean nmp_utils_ethtool_get_coalesce(int ifindex, NMEthtoolCoalesceState *coalesce); gboolean nmp_utils_ethtool_set_coalesce(int ifindex, const NMEthtoolCoalesceState *coalesce); -struct _NMEthtoolRingState { - guint32 rx_pending; - guint32 rx_mini_pending; - guint32 rx_jumbo_pending; - guint32 tx_pending; -}; - gboolean nmp_utils_ethtool_get_ring(int ifindex, NMEthtoolRingState *ring); gboolean nmp_utils_ethtool_set_ring(int ifindex, const NMEthtoolRingState *ring); diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 26f2afd5d6..7770492f63 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -979,12 +979,6 @@ typedef struct { } NMPlatformLnkWireGuard; typedef enum { - NM_PLATFORM_LINK_DUPLEX_UNKNOWN, - NM_PLATFORM_LINK_DUPLEX_HALF, - NM_PLATFORM_LINK_DUPLEX_FULL, -} NMPlatformLinkDuplexType; - -typedef enum { NM_PLATFORM_WIREGUARD_CHANGE_FLAG_NONE = 0, NM_PLATFORM_WIREGUARD_CHANGE_FLAG_REPLACE_PEERS = (1LL << 0), NM_PLATFORM_WIREGUARD_CHANGE_FLAG_HAS_PRIVATE_KEY = (1LL << 1), @@ -2343,8 +2337,6 @@ gboolean nm_platform_ethtool_get_link_settings(NMPlatform * self, guint32 * out_speed, NMPlatformLinkDuplexType *out_duplex); -typedef struct _NMEthtoolFeatureStates NMEthtoolFeatureStates; - NMEthtoolFeatureStates *nm_platform_ethtool_get_link_features(NMPlatform *self, int ifindex); gboolean nm_platform_ethtool_set_features( NMPlatform * self, @@ -2353,8 +2345,6 @@ gboolean nm_platform_ethtool_set_features( const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */, gboolean do_set /* or reset */); -typedef struct _NMEthtoolCoalesceState NMEthtoolCoalesceState; - gboolean nm_platform_ethtool_get_link_coalesce(NMPlatform * self, int ifindex, NMEthtoolCoalesceState *coalesce); @@ -2363,8 +2353,6 @@ gboolean nm_platform_ethtool_set_coalesce(NMPlatform * self, int ifindex, const NMEthtoolCoalesceState *coalesce); -typedef struct _NMEthtoolRingState NMEthtoolRingState; - gboolean nm_platform_ethtool_get_link_ring(NMPlatform *self, int ifindex, NMEthtoolRingState *ring); gboolean diff --git a/src/platform/wifi/nm-wifi-utils-wext.c b/src/platform/wifi/nm-wifi-utils-wext.c index 070b21092b..4d024174c8 100644 --- a/src/platform/wifi/nm-wifi-utils-wext.c +++ b/src/platform/wifi/nm-wifi-utils-wext.c @@ -25,6 +25,7 @@ #include "nm-utils.h" #include "platform/nm-platform-utils.h" #include "nm-core-internal.h" +#include "nm-core-utils.h" typedef struct { NMWifiUtils parent; |