1 /* 2 * common.h - common code header 3 * 4 * Declarations for data and functions shared by ioctl and netlink code. 5 */ 6 7 #ifndef ETHTOOL_COMMON_H__ 8 #define ETHTOOL_COMMON_H__ 9 10 #include "internal.h" 11 #include <stddef.h> 12 #include <errno.h> 13 14 #define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) 15 16 struct flag_info { 17 const char *name; 18 u32 value; 19 }; 20 21 extern const struct flag_info flags_msglvl[]; 22 extern const unsigned int n_flags_msglvl; 23 24 struct off_flag_def { 25 const char *short_name; 26 const char *long_name; 27 const char *kernel_name; 28 u32 get_cmd, set_cmd; 29 u32 value; 30 /* For features exposed through ETHTOOL_GFLAGS, the oldest 31 * kernel version for which we can trust the result. Where 32 * the flag was added at the same time the kernel started 33 * supporting the feature, this is 0 (to allow for backports). 34 * Where the feature was supported before the flag was added, 35 * it is the version that introduced the flag. 36 */ 37 u32 min_kernel_ver; 38 }; 39 40 #define OFF_FLAG_DEF_SIZE 12 41 extern const struct off_flag_def off_flag_def[OFF_FLAG_DEF_SIZE]; 42 43 void print_flags(const struct flag_info *info, unsigned int n_info, u32 value); 44 int dump_wol(struct ethtool_wolinfo *wol); 45 void dump_mdix(u8 mdix, u8 mdix_ctrl); 46 void print_indir_table(struct cmd_context *ctx, u64 ring_count, 47 u32 indir_size, u32 *indir); 48 void print_rss_hkey(u8 *hkey, u32 hkey_size); 49 #endif /* ETHTOOL_COMMON_H__ */ 50