Jeff Garzik | 32c8037 | 2005-10-25 01:56:48 -0400 | [diff] [blame] | 1 | /* Portions Copyright 2001 Sun Microsystems (thockin@sun.com) */ |
| 2 | /* Portions Copyright 2002 Intel (scott.feldman@intel.com) */ |
Ben Hutchings | 5ba70c0 | 2011-11-01 16:48:31 +0000 | [diff] [blame] | 3 | #ifndef ETHTOOL_INTERNAL_H__ |
| 4 | #define ETHTOOL_INTERNAL_H__ |
Jeff Garzik | 32c8037 | 2005-10-25 01:56:48 -0400 | [diff] [blame] | 5 | |
Maciej Żenczykowski | c0a2c04 | 2016-03-11 09:58:14 -0800 | [diff] [blame] | 6 | /* Some platforms (eg. ppc64) need __SANE_USERSPACE_TYPES__ before |
| 7 | * <linux/types.h> to select 'int-ll64.h' and avoid compile warnings |
| 8 | * when printing __u64 with %llu. |
| 9 | */ |
| 10 | #define __SANE_USERSPACE_TYPES__ |
| 11 | |
Alexander Duyck | 8a7c070 | 2011-05-04 11:41:40 -0700 | [diff] [blame] | 12 | #ifdef HAVE_CONFIG_H |
| 13 | #include "ethtool-config.h" |
| 14 | #endif |
David Decotigny | 33133ab | 2016-03-25 09:21:01 -0700 | [diff] [blame] | 15 | #include <stdbool.h> |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 16 | #include <stdio.h> |
Paul Barker | 1e8811a | 2014-10-26 11:44:09 +0000 | [diff] [blame] | 17 | #include <stdint.h> |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 18 | #include <stdlib.h> |
| 19 | #include <string.h> |
Jeff Garzik | 32c8037 | 2005-10-25 01:56:48 -0400 | [diff] [blame] | 20 | #include <sys/types.h> |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 21 | #include <unistd.h> |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 22 | #include <endian.h> |
Alexander Duyck | 8a7c070 | 2011-05-04 11:41:40 -0700 | [diff] [blame] | 23 | #include <sys/ioctl.h> |
| 24 | #include <net/if.h> |
Jeff Garzik | f45bb4f | 2007-07-26 13:32:17 -0400 | [diff] [blame] | 25 | |
Maciej Żenczykowski | d5432a9 | 2019-10-17 11:20:50 -0700 | [diff] [blame] | 26 | #define maybe_unused __attribute__((__unused__)) |
| 27 | |
Ben Hutchings | 4f1d68d | 2010-11-23 15:46:55 +0000 | [diff] [blame] | 28 | /* ethtool.h expects these to be defined by <linux/types.h> */ |
| 29 | #ifndef HAVE_BE_TYPES |
Paul Barker | 1e8811a | 2014-10-26 11:44:09 +0000 | [diff] [blame] | 30 | typedef uint16_t __be16; |
| 31 | typedef uint32_t __be32; |
Alexander Duyck | 9a7baa6 | 2011-05-04 11:41:46 -0700 | [diff] [blame] | 32 | typedef unsigned long long __be64; |
Ben Hutchings | 4f1d68d | 2010-11-23 15:46:55 +0000 | [diff] [blame] | 33 | #endif |
| 34 | |
Jeff Garzik | f45bb4f | 2007-07-26 13:32:17 -0400 | [diff] [blame] | 35 | typedef unsigned long long u64; |
Paul Barker | 1e8811a | 2014-10-26 11:44:09 +0000 | [diff] [blame] | 36 | typedef uint32_t u32; |
| 37 | typedef uint16_t u16; |
| 38 | typedef uint8_t u8; |
| 39 | typedef int32_t s32; |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 40 | |
Ben Hutchings | 4537f8e | 2016-03-13 15:43:29 +0000 | [diff] [blame] | 41 | /* ethtool.h epxects __KERNEL_DIV_ROUND_UP to be defined by <linux/kernel.h> */ |
| 42 | #include <linux/kernel.h> |
| 43 | #ifndef __KERNEL_DIV_ROUND_UP |
| 44 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
| 45 | #endif |
| 46 | |
Alexander Duyck | 8a7c070 | 2011-05-04 11:41:40 -0700 | [diff] [blame] | 47 | #include "ethtool-copy.h" |
Richard Cochran | 0fdcc8c | 2012-04-03 19:58:23 +0200 | [diff] [blame] | 48 | #include "net_tstamp-copy.h" |
Alexander Duyck | 8a7c070 | 2011-05-04 11:41:40 -0700 | [diff] [blame] | 49 | |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 50 | #if __BYTE_ORDER == __BIG_ENDIAN |
| 51 | static inline u16 cpu_to_be16(u16 value) |
| 52 | { |
Alexander Duyck | 9a7baa6 | 2011-05-04 11:41:46 -0700 | [diff] [blame] | 53 | return value; |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 54 | } |
| 55 | static inline u32 cpu_to_be32(u32 value) |
| 56 | { |
Alexander Duyck | 9a7baa6 | 2011-05-04 11:41:46 -0700 | [diff] [blame] | 57 | return value; |
| 58 | } |
| 59 | static inline u64 cpu_to_be64(u64 value) |
| 60 | { |
| 61 | return value; |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 62 | } |
| 63 | #else |
| 64 | static inline u16 cpu_to_be16(u16 value) |
| 65 | { |
| 66 | return (value >> 8) | (value << 8); |
| 67 | } |
| 68 | static inline u32 cpu_to_be32(u32 value) |
| 69 | { |
| 70 | return cpu_to_be16(value >> 16) | (cpu_to_be16(value) << 16); |
| 71 | } |
Alexander Duyck | 9a7baa6 | 2011-05-04 11:41:46 -0700 | [diff] [blame] | 72 | static inline u64 cpu_to_be64(u64 value) |
| 73 | { |
| 74 | return cpu_to_be32(value >> 32) | ((u64)cpu_to_be32(value) << 32); |
| 75 | } |
Ben Hutchings | 18caa78 | 2010-06-25 15:46:58 +0100 | [diff] [blame] | 76 | #endif |
Jeff Garzik | f45bb4f | 2007-07-26 13:32:17 -0400 | [diff] [blame] | 77 | |
Alexander Duyck | 9a7baa6 | 2011-05-04 11:41:46 -0700 | [diff] [blame] | 78 | #define ntohll cpu_to_be64 |
| 79 | #define htonll cpu_to_be64 |
| 80 | |
Ben Hutchings | 5ba70c0 | 2011-11-01 16:48:31 +0000 | [diff] [blame] | 81 | #define BITS_PER_BYTE 8 |
| 82 | #define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) |
| 83 | #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
| 84 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) |
| 85 | |
Ben Hutchings | be76a45 | 2011-10-27 19:11:35 +0100 | [diff] [blame] | 86 | static inline void set_bit(unsigned int nr, unsigned long *addr) |
Ben Hutchings | 5ba70c0 | 2011-11-01 16:48:31 +0000 | [diff] [blame] | 87 | { |
| 88 | addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG); |
| 89 | } |
| 90 | |
Ben Hutchings | be76a45 | 2011-10-27 19:11:35 +0100 | [diff] [blame] | 91 | static inline void clear_bit(unsigned int nr, unsigned long *addr) |
Ben Hutchings | 5ba70c0 | 2011-11-01 16:48:31 +0000 | [diff] [blame] | 92 | { |
| 93 | addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG)); |
| 94 | } |
| 95 | |
| 96 | static inline int test_bit(unsigned int nr, const unsigned long *addr) |
| 97 | { |
| 98 | return !!((1UL << (nr % BITS_PER_LONG)) & |
| 99 | (((unsigned long *)addr)[nr / BITS_PER_LONG])); |
| 100 | } |
| 101 | |
Alexander Duyck | 8a7c070 | 2011-05-04 11:41:40 -0700 | [diff] [blame] | 102 | #ifndef ARRAY_SIZE |
| 103 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| 104 | #endif |
| 105 | |
| 106 | #ifndef SIOCETHTOOL |
| 107 | #define SIOCETHTOOL 0x8946 |
| 108 | #endif |
| 109 | |
Ben Hutchings | e5c984a | 2011-05-13 23:25:26 +0100 | [diff] [blame] | 110 | /* Internal values for old-style offload flags. Values and names |
| 111 | * must not clash with the flags defined for ETHTOOL_{G,S}FLAGS. |
| 112 | */ |
| 113 | #define ETH_FLAG_RXCSUM (1 << 0) |
| 114 | #define ETH_FLAG_TXCSUM (1 << 1) |
| 115 | #define ETH_FLAG_SG (1 << 2) |
| 116 | #define ETH_FLAG_TSO (1 << 3) |
| 117 | #define ETH_FLAG_UFO (1 << 4) |
| 118 | #define ETH_FLAG_GSO (1 << 5) |
| 119 | #define ETH_FLAG_GRO (1 << 6) |
| 120 | #define ETH_FLAG_INT_MASK (ETH_FLAG_RXCSUM | ETH_FLAG_TXCSUM | \ |
| 121 | ETH_FLAG_SG | ETH_FLAG_TSO | ETH_FLAG_UFO | \ |
| 122 | ETH_FLAG_GSO | ETH_FLAG_GRO), |
| 123 | /* Mask of all flags defined for ETHTOOL_{G,S}FLAGS. */ |
| 124 | #define ETH_FLAG_EXT_MASK (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | \ |
| 125 | ETH_FLAG_TXVLAN | ETH_FLAG_NTUPLE | \ |
| 126 | ETH_FLAG_RXHASH) |
| 127 | |
David Decotigny | 33133ab | 2016-03-25 09:21:01 -0700 | [diff] [blame] | 128 | /* internal API for link mode bitmap interaction with kernel. */ |
| 129 | |
| 130 | #define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 \ |
| 131 | (SCHAR_MAX) |
| 132 | #define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS \ |
| 133 | (32 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32) |
| 134 | #define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES \ |
| 135 | (4 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32) |
| 136 | #define ETHTOOL_DECLARE_LINK_MODE_MASK(name) \ |
| 137 | u32 name[ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32] |
| 138 | |
| 139 | struct ethtool_link_usettings { |
| 140 | struct { |
| 141 | __u8 transceiver; |
| 142 | } deprecated; |
| 143 | struct ethtool_link_settings base; |
| 144 | struct { |
| 145 | ETHTOOL_DECLARE_LINK_MODE_MASK(supported); |
| 146 | ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); |
| 147 | ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising); |
| 148 | } link_modes; |
| 149 | }; |
| 150 | |
| 151 | #define ethtool_link_mode_for_each_u32(index) \ |
| 152 | for ((index) = 0; \ |
| 153 | (index) < ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32; \ |
| 154 | ++(index)) |
| 155 | |
| 156 | static inline void ethtool_link_mode_zero(u32 *dst) |
| 157 | { |
| 158 | memset(dst, 0, ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES); |
| 159 | } |
| 160 | |
| 161 | static inline bool ethtool_link_mode_is_empty(const u32 *mask) |
| 162 | { |
| 163 | unsigned int i; |
| 164 | |
| 165 | ethtool_link_mode_for_each_u32(i) { |
| 166 | if (mask[i] != 0) |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | static inline void ethtool_link_mode_copy(u32 *dst, const u32 *src) |
| 174 | { |
| 175 | memcpy(dst, src, ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES); |
| 176 | } |
| 177 | |
| 178 | static inline int ethtool_link_mode_test_bit(unsigned int nr, const u32 *mask) |
| 179 | { |
| 180 | if (nr >= ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS) |
| 181 | return !!0; |
| 182 | return !!(mask[nr / 32] & (1 << (nr % 32))); |
| 183 | } |
| 184 | |
| 185 | static inline int ethtool_link_mode_set_bit(unsigned int nr, u32 *mask) |
| 186 | { |
| 187 | if (nr >= ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS) |
| 188 | return -1; |
| 189 | mask[nr / 32] |= (1 << (nr % 32)); |
| 190 | return 0; |
| 191 | } |
| 192 | |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 193 | /* Context for sub-commands */ |
| 194 | struct cmd_context { |
Ben Hutchings | 743eb0b | 2011-10-29 02:36:48 +0100 | [diff] [blame] | 195 | const char *devname; /* net device name */ |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 196 | int fd; /* socket suitable for ethtool ioctl */ |
| 197 | struct ifreq ifr; /* ifreq suitable for ethtool ioctl */ |
Ben Hutchings | 127f806 | 2011-10-29 01:15:34 +0100 | [diff] [blame] | 198 | int argc; /* number of arguments to the sub-command */ |
| 199 | char **argp; /* arguments to the sub-command */ |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 200 | }; |
| 201 | |
Ben Hutchings | cfe91ed | 2011-10-31 18:42:29 +0000 | [diff] [blame] | 202 | #ifdef TEST_ETHTOOL |
| 203 | int test_cmdline(const char *args); |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 204 | |
Ben Hutchings | 70943b5 | 2012-06-01 23:08:21 +0100 | [diff] [blame] | 205 | struct cmd_expect { |
| 206 | const void *cmd; /* expected command; NULL at end of list */ |
| 207 | size_t cmd_len; /* length to match (might be < sizeof struct) */ |
| 208 | int rc; /* kernel return code */ |
| 209 | const void *resp; /* response to write back; may be NULL */ |
| 210 | size_t resp_len; /* length to write back */ |
| 211 | }; |
| 212 | int test_ioctl(const struct cmd_expect *expect, void *cmd); |
| 213 | #define TEST_IOCTL_MISMATCH (-2) |
| 214 | |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 215 | int test_main(int argc, char **argp); |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 216 | void test_exit(int rc) __attribute__((noreturn)); |
Ben Hutchings | 0732e9a | 2015-10-09 03:59:30 +0100 | [diff] [blame] | 217 | |
| 218 | #ifndef TEST_NO_WRAPPERS |
| 219 | #define main(...) test_main(__VA_ARGS__) |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 220 | #undef exit |
| 221 | #define exit(rc) test_exit(rc) |
| 222 | void *test_malloc(size_t size); |
| 223 | #undef malloc |
| 224 | #define malloc(size) test_malloc(size) |
| 225 | void *test_calloc(size_t nmemb, size_t size); |
| 226 | #undef calloc |
| 227 | #define calloc(nmemb, size) test_calloc(nmemb, size) |
| 228 | char *test_strdup(const char *s); |
| 229 | #undef strdup |
| 230 | #define strdup(s) test_strdup(s) |
Ben Hutchings | 89a949e | 2015-10-09 04:01:18 +0100 | [diff] [blame] | 231 | void test_free(void *ptr); |
Ben Hutchings | dfacc4a | 2011-10-31 18:29:35 +0000 | [diff] [blame] | 232 | #undef free |
| 233 | #define free(ptr) test_free(ptr) |
| 234 | void *test_realloc(void *ptr, size_t size); |
| 235 | #undef realloc |
| 236 | #define realloc(ptr, size) test_realloc(ptr, size) |
| 237 | int test_open(const char *pathname, int flag, ...); |
| 238 | #undef open |
| 239 | #define open(...) test_open(__VA_ARGS__) |
| 240 | int test_socket(int domain, int type, int protocol); |
| 241 | #undef socket |
| 242 | #define socket(...) test_socket(__VA_ARGS__) |
| 243 | int test_close(int fd); |
| 244 | #undef close |
| 245 | #define close(fd) test_close(fd) |
| 246 | FILE *test_fopen(const char *path, const char *mode); |
| 247 | #undef fopen |
| 248 | #define fopen(path, mode) test_fopen(path, mode) |
| 249 | int test_fclose(FILE *fh); |
| 250 | #undef fclose |
| 251 | #define fclose(fh) test_fclose(fh) |
| 252 | #endif |
Ben Hutchings | cfe91ed | 2011-10-31 18:42:29 +0000 | [diff] [blame] | 253 | #endif |
| 254 | |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 255 | int send_ioctl(struct cmd_context *ctx, void *cmd); |
| 256 | |
Ben Hutchings | 2038e9e | 2012-02-17 21:30:06 +0000 | [diff] [blame] | 257 | void dump_hex(FILE *f, const u8 *data, int len, int offset); |
| 258 | |
Jeff Garzik | 32c8037 | 2005-10-25 01:56:48 -0400 | [diff] [blame] | 259 | /* National Semiconductor DP83815, DP83816 */ |
| 260 | int natsemi_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 261 | int natsemi_dump_eeprom(struct ethtool_drvinfo *info, |
| 262 | struct ethtool_eeprom *ee); |
| 263 | |
| 264 | /* Digital/Intel 21040 and 21041 */ |
| 265 | int de2104x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 266 | |
| 267 | /* Intel(R) PRO/1000 Gigabit Adapter Family */ |
| 268 | int e1000_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 269 | |
Nicholas Nunley | ae5505e | 2007-08-15 10:44:01 -0700 | [diff] [blame] | 270 | int igb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 271 | |
Jeff Garzik | 32c8037 | 2005-10-25 01:56:48 -0400 | [diff] [blame] | 272 | /* RealTek PCI */ |
| 273 | int realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 274 | |
| 275 | /* Intel(R) PRO/100 Fast Ethernet Adapter Family */ |
| 276 | int e100_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 277 | |
| 278 | /* Tigon3 */ |
| 279 | int tg3_dump_eeprom(struct ethtool_drvinfo *info, struct ethtool_eeprom *ee); |
| 280 | |
| 281 | /* Advanced Micro Devices AMD8111 based Adapter */ |
| 282 | int amd8111e_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 283 | |
| 284 | /* Advanced Micro Devices PCnet32 Adapter */ |
| 285 | int pcnet32_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 286 | |
| 287 | /* Motorola 8xx FEC Ethernet controller */ |
| 288 | int fec_8xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 289 | |
Eugene Surovegin | a69768a | 2005-10-25 02:29:27 -0400 | [diff] [blame] | 290 | /* PowerPC 4xx on-chip Ethernet controller */ |
| 291 | int ibm_emac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 292 | |
Nicholas Nunley | fb522ac | 2006-09-19 11:27:35 -0700 | [diff] [blame] | 293 | /* Intel(R) PRO/10GBe Gigabit Adapter Family */ |
| 294 | int ixgb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 295 | |
Nicholas Nunley | 4b448ec | 2007-08-15 10:44:11 -0700 | [diff] [blame] | 296 | int ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 297 | |
Jacob Keller | 5c271a2 | 2013-08-27 17:08:49 -0700 | [diff] [blame] | 298 | int ixgbevf_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 299 | |
Michael Chan | 14004d1 | 2005-11-08 12:24:23 -0800 | [diff] [blame] | 300 | /* Broadcom Tigon3 Ethernet controller */ |
| 301 | int tg3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 302 | |
Stephen Hemminger | 8f3b48b | 2006-08-23 14:16:09 -0700 | [diff] [blame] | 303 | /* SysKonnect Gigabit (Genesis and Yukon) */ |
| 304 | int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 305 | |
Stephen Hemminger | ad70259 | 2006-09-26 13:09:14 -0700 | [diff] [blame] | 306 | /* SysKonnect Gigabit (Yukon2) */ |
| 307 | int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 308 | |
Sriram Chidambaram | 8babd79 | 2006-10-24 14:30:41 -0700 | [diff] [blame] | 309 | /* Fabric7 VIOC */ |
| 310 | int vioc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
Steve Glendinning | a5f8ce2 | 2007-07-16 20:04:40 +0100 | [diff] [blame] | 311 | |
| 312 | /* SMSC LAN911x/LAN921x embedded ethernet controller */ |
| 313 | int smsc911x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 314 | |
John W. Linville | c1af441 | 2009-12-23 09:29:47 -0500 | [diff] [blame] | 315 | int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 316 | |
Ben Hutchings | 2c2ee7a | 2010-06-21 14:09:47 +0100 | [diff] [blame] | 317 | /* Solarflare Solarstorm controllers */ |
| 318 | int sfc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 319 | |
Giuseppe CAVALLARO | 02ea0ac | 2010-10-13 10:52:25 +0200 | [diff] [blame] | 320 | /* STMMAC embedded ethernet controller */ |
| 321 | int st_mac100_dump_regs(struct ethtool_drvinfo *info, |
| 322 | struct ethtool_regs *regs); |
| 323 | int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
Alexander Duyck | 8d63f72 | 2011-05-04 11:41:51 -0700 | [diff] [blame] | 324 | |
Mark Einon | 08f7d49 | 2012-10-30 21:57:23 +0000 | [diff] [blame] | 325 | /* Et131x ethernet controller */ |
| 326 | int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 327 | |
Vince Bridgers | 0bbd4f5 | 2014-06-22 19:16:59 -0500 | [diff] [blame] | 328 | /* Altera TSE 10/100/1000 ethernet controller */ |
| 329 | int altera_tse_dump_regs(struct ethtool_drvinfo *info, |
| 330 | struct ethtool_regs *regs); |
| 331 | |
Shrikrishna Khare | 009799a | 2015-09-23 15:19:12 -0700 | [diff] [blame] | 332 | /* VMware vmxnet3 ethernet controller */ |
| 333 | int vmxnet3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 334 | |
Alexander Duyck | 8d63f72 | 2011-05-04 11:41:51 -0700 | [diff] [blame] | 335 | /* Rx flow classification */ |
Ben Hutchings | 127f806 | 2011-10-29 01:15:34 +0100 | [diff] [blame] | 336 | int rxclass_parse_ruleopts(struct cmd_context *ctx, |
Edward Cree | f5d55b9 | 2018-03-09 15:04:12 +0000 | [diff] [blame] | 337 | struct ethtool_rx_flow_spec *fsp, __u32 *rss_context); |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 338 | int rxclass_rule_getall(struct cmd_context *ctx); |
| 339 | int rxclass_rule_get(struct cmd_context *ctx, __u32 loc); |
| 340 | int rxclass_rule_ins(struct cmd_context *ctx, |
Edward Cree | f5d55b9 | 2018-03-09 15:04:12 +0000 | [diff] [blame] | 341 | struct ethtool_rx_flow_spec *fsp, __u32 rss_context); |
Ben Hutchings | 37897ca | 2011-10-29 02:33:30 +0100 | [diff] [blame] | 342 | int rxclass_rule_del(struct cmd_context *ctx, __u32 loc); |
Alexander Duyck | 8d63f72 | 2011-05-04 11:41:51 -0700 | [diff] [blame] | 343 | |
Stuart Hodgson | 2edf567 | 2012-05-18 15:58:45 +0100 | [diff] [blame] | 344 | /* Module EEPROM parsing code */ |
| 345 | void sff8079_show_all(const __u8 *id); |
| 346 | |
Aurelien Guillaume | 749f387 | 2012-12-02 21:21:01 +0100 | [diff] [blame] | 347 | /* Optics diagnostics */ |
| 348 | void sff8472_show_all(const __u8 *id); |
| 349 | |
Vidya Sagar Ravipati | a5e73bb | 2016-08-23 06:30:32 -0700 | [diff] [blame] | 350 | /* QSFP Optics diagnostics */ |
| 351 | void sff8636_show_all(const __u8 *id, __u32 eeprom_len); |
| 352 | |
Taku Izumi | acc3d3a | 2016-11-16 09:55:32 +0900 | [diff] [blame] | 353 | /* FUJITSU Extended Socket network device */ |
| 354 | int fjes_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
Raghuram Chary J | bf66874 | 2018-04-05 11:41:28 +0530 | [diff] [blame] | 355 | |
| 356 | /* MICROCHIP LAN78XX USB ETHERNET Controller */ |
| 357 | int lan78xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 358 | |
Vivien Didelot | cb8e980 | 2018-12-18 14:06:35 -0500 | [diff] [blame] | 359 | /* Distributed Switch Architecture */ |
| 360 | int dsa_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 361 | |
Vivien Didelot | 8612d8b | 2019-02-14 11:15:36 -0500 | [diff] [blame] | 362 | /* i.MX Fast Ethernet Controller */ |
| 363 | int fec_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); |
| 364 | |
Ben Hutchings | 5ba70c0 | 2011-11-01 16:48:31 +0000 | [diff] [blame] | 365 | #endif /* ETHTOOL_INTERNAL_H__ */ |