Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | * Driver for Solarflare Solarstorm network controllers and boards |
| 3 | * Copyright 2005-2006 Fen Systems Ltd. |
Ben Hutchings | 0a6f40c | 2011-02-25 00:01:34 +0000 | [diff] [blame] | 4 | * Copyright 2006-2010 Solarflare Communications Inc. |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License version 2 as published |
| 8 | * by the Free Software Foundation, incorporated herein by reference. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/netdevice.h> |
| 12 | #include <linux/ethtool.h> |
| 13 | #include <linux/rtnetlink.h> |
Ben Hutchings | c39d35e | 2010-12-07 19:11:26 +0000 | [diff] [blame] | 14 | #include <linux/in.h> |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 15 | #include "net_driver.h" |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 16 | #include "workarounds.h" |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 17 | #include "selftest.h" |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 18 | #include "efx.h" |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 19 | #include "filter.h" |
Ben Hutchings | 744093c | 2009-11-29 15:12:08 +0000 | [diff] [blame] | 20 | #include "nic.h" |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 21 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 22 | struct efx_ethtool_stat { |
| 23 | const char *name; |
| 24 | enum { |
| 25 | EFX_ETHTOOL_STAT_SOURCE_mac_stats, |
| 26 | EFX_ETHTOOL_STAT_SOURCE_nic, |
Ben Hutchings | 119226c | 2011-02-18 19:14:13 +0000 | [diff] [blame] | 27 | EFX_ETHTOOL_STAT_SOURCE_channel, |
| 28 | EFX_ETHTOOL_STAT_SOURCE_tx_queue |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 29 | } source; |
| 30 | unsigned offset; |
| 31 | u64(*get_stat) (void *field); /* Reader function */ |
| 32 | }; |
| 33 | |
| 34 | /* Initialiser for a struct #efx_ethtool_stat with type-checking */ |
| 35 | #define EFX_ETHTOOL_STAT(stat_name, source_name, field, field_type, \ |
| 36 | get_stat_function) { \ |
| 37 | .name = #stat_name, \ |
| 38 | .source = EFX_ETHTOOL_STAT_SOURCE_##source_name, \ |
| 39 | .offset = ((((field_type *) 0) == \ |
| 40 | &((struct efx_##source_name *)0)->field) ? \ |
| 41 | offsetof(struct efx_##source_name, field) : \ |
| 42 | offsetof(struct efx_##source_name, field)), \ |
| 43 | .get_stat = get_stat_function, \ |
| 44 | } |
| 45 | |
| 46 | static u64 efx_get_uint_stat(void *field) |
| 47 | { |
| 48 | return *(unsigned int *)field; |
| 49 | } |
| 50 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 51 | static u64 efx_get_u64_stat(void *field) |
| 52 | { |
| 53 | return *(u64 *) field; |
| 54 | } |
| 55 | |
| 56 | static u64 efx_get_atomic_stat(void *field) |
| 57 | { |
| 58 | return atomic_read((atomic_t *) field); |
| 59 | } |
| 60 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 61 | #define EFX_ETHTOOL_U64_MAC_STAT(field) \ |
Ben Hutchings | 9c636ba | 2012-01-05 17:19:45 +0000 | [diff] [blame] | 62 | EFX_ETHTOOL_STAT(field, mac_stats, field, \ |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 63 | u64, efx_get_u64_stat) |
| 64 | |
| 65 | #define EFX_ETHTOOL_UINT_NIC_STAT(name) \ |
| 66 | EFX_ETHTOOL_STAT(name, nic, n_##name, \ |
| 67 | unsigned int, efx_get_uint_stat) |
| 68 | |
| 69 | #define EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(field) \ |
| 70 | EFX_ETHTOOL_STAT(field, nic, field, \ |
| 71 | atomic_t, efx_get_atomic_stat) |
| 72 | |
| 73 | #define EFX_ETHTOOL_UINT_CHANNEL_STAT(field) \ |
| 74 | EFX_ETHTOOL_STAT(field, channel, n_##field, \ |
| 75 | unsigned int, efx_get_uint_stat) |
| 76 | |
Ben Hutchings | 119226c | 2011-02-18 19:14:13 +0000 | [diff] [blame] | 77 | #define EFX_ETHTOOL_UINT_TXQ_STAT(field) \ |
| 78 | EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \ |
| 79 | unsigned int, efx_get_uint_stat) |
| 80 | |
Ben Hutchings | 18e83e4 | 2012-01-05 19:05:20 +0000 | [diff] [blame] | 81 | static const struct efx_ethtool_stat efx_ethtool_stats[] = { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 82 | EFX_ETHTOOL_U64_MAC_STAT(tx_bytes), |
| 83 | EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes), |
| 84 | EFX_ETHTOOL_U64_MAC_STAT(tx_bad_bytes), |
Ben Hutchings | f9c7625 | 2011-10-12 17:20:25 +0100 | [diff] [blame] | 85 | EFX_ETHTOOL_U64_MAC_STAT(tx_packets), |
| 86 | EFX_ETHTOOL_U64_MAC_STAT(tx_bad), |
| 87 | EFX_ETHTOOL_U64_MAC_STAT(tx_pause), |
| 88 | EFX_ETHTOOL_U64_MAC_STAT(tx_control), |
| 89 | EFX_ETHTOOL_U64_MAC_STAT(tx_unicast), |
| 90 | EFX_ETHTOOL_U64_MAC_STAT(tx_multicast), |
| 91 | EFX_ETHTOOL_U64_MAC_STAT(tx_broadcast), |
| 92 | EFX_ETHTOOL_U64_MAC_STAT(tx_lt64), |
| 93 | EFX_ETHTOOL_U64_MAC_STAT(tx_64), |
| 94 | EFX_ETHTOOL_U64_MAC_STAT(tx_65_to_127), |
| 95 | EFX_ETHTOOL_U64_MAC_STAT(tx_128_to_255), |
| 96 | EFX_ETHTOOL_U64_MAC_STAT(tx_256_to_511), |
| 97 | EFX_ETHTOOL_U64_MAC_STAT(tx_512_to_1023), |
| 98 | EFX_ETHTOOL_U64_MAC_STAT(tx_1024_to_15xx), |
| 99 | EFX_ETHTOOL_U64_MAC_STAT(tx_15xx_to_jumbo), |
| 100 | EFX_ETHTOOL_U64_MAC_STAT(tx_gtjumbo), |
| 101 | EFX_ETHTOOL_U64_MAC_STAT(tx_collision), |
| 102 | EFX_ETHTOOL_U64_MAC_STAT(tx_single_collision), |
| 103 | EFX_ETHTOOL_U64_MAC_STAT(tx_multiple_collision), |
| 104 | EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_collision), |
| 105 | EFX_ETHTOOL_U64_MAC_STAT(tx_deferred), |
| 106 | EFX_ETHTOOL_U64_MAC_STAT(tx_late_collision), |
| 107 | EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_deferred), |
| 108 | EFX_ETHTOOL_U64_MAC_STAT(tx_non_tcpudp), |
| 109 | EFX_ETHTOOL_U64_MAC_STAT(tx_mac_src_error), |
| 110 | EFX_ETHTOOL_U64_MAC_STAT(tx_ip_src_error), |
Ben Hutchings | 119226c | 2011-02-18 19:14:13 +0000 | [diff] [blame] | 111 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts), |
| 112 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers), |
| 113 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets), |
| 114 | EFX_ETHTOOL_UINT_TXQ_STAT(pushes), |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 115 | EFX_ETHTOOL_U64_MAC_STAT(rx_bytes), |
| 116 | EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes), |
| 117 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes), |
Ben Hutchings | f9c7625 | 2011-10-12 17:20:25 +0100 | [diff] [blame] | 118 | EFX_ETHTOOL_U64_MAC_STAT(rx_packets), |
| 119 | EFX_ETHTOOL_U64_MAC_STAT(rx_good), |
| 120 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad), |
| 121 | EFX_ETHTOOL_U64_MAC_STAT(rx_pause), |
| 122 | EFX_ETHTOOL_U64_MAC_STAT(rx_control), |
| 123 | EFX_ETHTOOL_U64_MAC_STAT(rx_unicast), |
| 124 | EFX_ETHTOOL_U64_MAC_STAT(rx_multicast), |
| 125 | EFX_ETHTOOL_U64_MAC_STAT(rx_broadcast), |
| 126 | EFX_ETHTOOL_U64_MAC_STAT(rx_lt64), |
| 127 | EFX_ETHTOOL_U64_MAC_STAT(rx_64), |
| 128 | EFX_ETHTOOL_U64_MAC_STAT(rx_65_to_127), |
| 129 | EFX_ETHTOOL_U64_MAC_STAT(rx_128_to_255), |
| 130 | EFX_ETHTOOL_U64_MAC_STAT(rx_256_to_511), |
| 131 | EFX_ETHTOOL_U64_MAC_STAT(rx_512_to_1023), |
| 132 | EFX_ETHTOOL_U64_MAC_STAT(rx_1024_to_15xx), |
| 133 | EFX_ETHTOOL_U64_MAC_STAT(rx_15xx_to_jumbo), |
| 134 | EFX_ETHTOOL_U64_MAC_STAT(rx_gtjumbo), |
| 135 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad_lt64), |
| 136 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad_64_to_15xx), |
| 137 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad_15xx_to_jumbo), |
| 138 | EFX_ETHTOOL_U64_MAC_STAT(rx_bad_gtjumbo), |
| 139 | EFX_ETHTOOL_U64_MAC_STAT(rx_overflow), |
| 140 | EFX_ETHTOOL_U64_MAC_STAT(rx_missed), |
| 141 | EFX_ETHTOOL_U64_MAC_STAT(rx_false_carrier), |
| 142 | EFX_ETHTOOL_U64_MAC_STAT(rx_symbol_error), |
| 143 | EFX_ETHTOOL_U64_MAC_STAT(rx_align_error), |
| 144 | EFX_ETHTOOL_U64_MAC_STAT(rx_length_error), |
| 145 | EFX_ETHTOOL_U64_MAC_STAT(rx_internal_error), |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 146 | EFX_ETHTOOL_UINT_NIC_STAT(rx_nodesc_drop_cnt), |
| 147 | EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset), |
| 148 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc), |
| 149 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err), |
| 150 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tcp_udp_chksum_err), |
Ben Hutchings | c1ac403 | 2009-11-28 05:36:29 +0000 | [diff] [blame] | 151 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch), |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 152 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc), |
Ben Hutchings | 85740cdf | 2013-01-29 23:33:15 +0000 | [diff] [blame] | 153 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_nodesc_trunc), |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 154 | }; |
| 155 | |
| 156 | /* Number of ethtool statistics */ |
| 157 | #define EFX_ETHTOOL_NUM_STATS ARRAY_SIZE(efx_ethtool_stats) |
| 158 | |
Ben Hutchings | 4a5b504 | 2008-09-01 12:47:16 +0100 | [diff] [blame] | 159 | #define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB |
Ben Hutchings | 4a5b504 | 2008-09-01 12:47:16 +0100 | [diff] [blame] | 160 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 161 | /************************************************************************** |
| 162 | * |
| 163 | * Ethtool operations |
| 164 | * |
| 165 | ************************************************************************** |
| 166 | */ |
| 167 | |
| 168 | /* Identify device by flashing LEDs */ |
Ben Hutchings | c5e129a | 2011-04-02 00:43:46 +0100 | [diff] [blame] | 169 | static int efx_ethtool_phys_id(struct net_device *net_dev, |
| 170 | enum ethtool_phys_id_state state) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 171 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 172 | struct efx_nic *efx = netdev_priv(net_dev); |
Allan, Bruce W | fce5592 | 2011-04-13 13:09:10 +0000 | [diff] [blame] | 173 | enum efx_led_mode mode = EFX_LED_DEFAULT; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 174 | |
Ben Hutchings | c5e129a | 2011-04-02 00:43:46 +0100 | [diff] [blame] | 175 | switch (state) { |
| 176 | case ETHTOOL_ID_ON: |
| 177 | mode = EFX_LED_ON; |
| 178 | break; |
| 179 | case ETHTOOL_ID_OFF: |
| 180 | mode = EFX_LED_OFF; |
| 181 | break; |
| 182 | case ETHTOOL_ID_INACTIVE: |
| 183 | mode = EFX_LED_DEFAULT; |
| 184 | break; |
Allan, Bruce W | fce5592 | 2011-04-13 13:09:10 +0000 | [diff] [blame] | 185 | case ETHTOOL_ID_ACTIVE: |
| 186 | return 1; /* cycle on/off once per second */ |
Ben Hutchings | c5e129a | 2011-04-02 00:43:46 +0100 | [diff] [blame] | 187 | } |
Ben Hutchings | 398468e | 2009-11-23 16:03:45 +0000 | [diff] [blame] | 188 | |
Ben Hutchings | c5e129a | 2011-04-02 00:43:46 +0100 | [diff] [blame] | 189 | efx->type->set_id_led(efx, mode); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 190 | return 0; |
| 191 | } |
| 192 | |
| 193 | /* This must be called with rtnl_lock held. */ |
stephen hemminger | d215697 | 2010-10-18 05:27:31 +0000 | [diff] [blame] | 194 | static int efx_ethtool_get_settings(struct net_device *net_dev, |
| 195 | struct ethtool_cmd *ecmd) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 196 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 197 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 198 | struct efx_link_state *link_state = &efx->link_state; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 199 | |
| 200 | mutex_lock(&efx->mac_lock); |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 201 | efx->phy_op->get_settings(efx, ecmd); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 202 | mutex_unlock(&efx->mac_lock); |
| 203 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 204 | /* Both MACs support pause frames (bidirectional and respond-only) */ |
| 205 | ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; |
| 206 | |
| 207 | if (LOOPBACK_INTERNAL(efx)) { |
David Decotigny | 7073949 | 2011-04-27 18:32:40 +0000 | [diff] [blame] | 208 | ethtool_cmd_speed_set(ecmd, link_state->speed); |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 209 | ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; |
| 210 | } |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 211 | |
| 212 | return 0; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | /* This must be called with rtnl_lock held. */ |
stephen hemminger | d215697 | 2010-10-18 05:27:31 +0000 | [diff] [blame] | 216 | static int efx_ethtool_set_settings(struct net_device *net_dev, |
| 217 | struct ethtool_cmd *ecmd) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 218 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 219 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 220 | int rc; |
| 221 | |
Ben Hutchings | 754c653 | 2010-02-03 09:31:57 +0000 | [diff] [blame] | 222 | /* GMAC does not support 1000Mbps HD */ |
David Decotigny | 25db033 | 2011-04-27 18:32:39 +0000 | [diff] [blame] | 223 | if ((ethtool_cmd_speed(ecmd) == SPEED_1000) && |
| 224 | (ecmd->duplex != DUPLEX_FULL)) { |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 225 | netif_dbg(efx, drv, efx->net_dev, |
| 226 | "rejecting unsupported 1000Mbps HD setting\n"); |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 227 | return -EINVAL; |
| 228 | } |
| 229 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 230 | mutex_lock(&efx->mac_lock); |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 231 | rc = efx->phy_op->set_settings(efx, ecmd); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 232 | mutex_unlock(&efx->mac_lock); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 233 | return rc; |
| 234 | } |
| 235 | |
| 236 | static void efx_ethtool_get_drvinfo(struct net_device *net_dev, |
| 237 | struct ethtool_drvinfo *info) |
| 238 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 239 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 240 | |
Ben Hutchings | c5d5f5f | 2010-06-23 11:30:26 +0000 | [diff] [blame] | 241 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 242 | strlcpy(info->version, EFX_DRIVER_VERSION, sizeof(info->version)); |
Ben Hutchings | 8880f4e | 2009-11-29 15:15:41 +0000 | [diff] [blame] | 243 | if (efx_nic_rev(efx) >= EFX_REV_SIENA_A0) |
Ben Hutchings | e5f0fd2 | 2011-02-24 23:57:47 +0000 | [diff] [blame] | 244 | efx_mcdi_print_fwver(efx, info->fw_version, |
| 245 | sizeof(info->fw_version)); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 246 | strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); |
| 247 | } |
| 248 | |
Ben Hutchings | 5b98c1b | 2010-06-21 03:06:53 +0000 | [diff] [blame] | 249 | static int efx_ethtool_get_regs_len(struct net_device *net_dev) |
| 250 | { |
| 251 | return efx_nic_get_regs_len(netdev_priv(net_dev)); |
| 252 | } |
| 253 | |
| 254 | static void efx_ethtool_get_regs(struct net_device *net_dev, |
| 255 | struct ethtool_regs *regs, void *buf) |
| 256 | { |
| 257 | struct efx_nic *efx = netdev_priv(net_dev); |
| 258 | |
| 259 | regs->version = efx->type->revision; |
| 260 | efx_nic_get_regs(efx, buf); |
| 261 | } |
| 262 | |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 263 | static u32 efx_ethtool_get_msglevel(struct net_device *net_dev) |
| 264 | { |
| 265 | struct efx_nic *efx = netdev_priv(net_dev); |
| 266 | return efx->msg_enable; |
| 267 | } |
| 268 | |
| 269 | static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) |
| 270 | { |
| 271 | struct efx_nic *efx = netdev_priv(net_dev); |
| 272 | efx->msg_enable = msg_enable; |
| 273 | } |
| 274 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 275 | /** |
| 276 | * efx_fill_test - fill in an individual self-test entry |
| 277 | * @test_index: Index of the test |
| 278 | * @strings: Ethtool strings, or %NULL |
| 279 | * @data: Ethtool test results, or %NULL |
| 280 | * @test: Pointer to test result (used only if data != %NULL) |
Ben Hutchings | 740ced9 | 2008-12-12 21:41:55 -0800 | [diff] [blame] | 281 | * @unit_format: Unit name format (e.g. "chan\%d") |
| 282 | * @unit_id: Unit id (e.g. 0 for "chan0") |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 283 | * @test_format: Test name format (e.g. "loopback.\%s.tx.sent") |
Ben Hutchings | 740ced9 | 2008-12-12 21:41:55 -0800 | [diff] [blame] | 284 | * @test_id: Test id (e.g. "PHYXS" for "loopback.PHYXS.tx_sent") |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 285 | * |
| 286 | * Fill in an individual self-test entry. |
| 287 | */ |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 288 | static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 289 | int *test, const char *unit_format, int unit_id, |
| 290 | const char *test_format, const char *test_id) |
| 291 | { |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 292 | char unit_str[ETH_GSTRING_LEN], test_str[ETH_GSTRING_LEN]; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 293 | |
| 294 | /* Fill data value, if applicable */ |
| 295 | if (data) |
| 296 | data[test_index] = *test; |
| 297 | |
| 298 | /* Fill string, if applicable */ |
| 299 | if (strings) { |
Ben Hutchings | 11e6696 | 2008-12-12 22:05:48 -0800 | [diff] [blame] | 300 | if (strchr(unit_format, '%')) |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 301 | snprintf(unit_str, sizeof(unit_str), |
Ben Hutchings | 11e6696 | 2008-12-12 22:05:48 -0800 | [diff] [blame] | 302 | unit_format, unit_id); |
| 303 | else |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 304 | strcpy(unit_str, unit_format); |
| 305 | snprintf(test_str, sizeof(test_str), test_format, test_id); |
| 306 | snprintf(strings + test_index * ETH_GSTRING_LEN, |
| 307 | ETH_GSTRING_LEN, |
| 308 | "%-6s %-24s", unit_str, test_str); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 309 | } |
| 310 | } |
| 311 | |
Ben Hutchings | 740ced9 | 2008-12-12 21:41:55 -0800 | [diff] [blame] | 312 | #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 313 | #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->queue |
| 314 | #define EFX_RX_QUEUE_NAME(_rx_queue) "rxq%d", _rx_queue->queue |
| 315 | #define EFX_LOOPBACK_NAME(_mode, _counter) \ |
Ben Hutchings | c459302 | 2009-11-23 16:08:17 +0000 | [diff] [blame] | 316 | "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_loopback_mode) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * efx_fill_loopback_test - fill in a block of loopback self-test entries |
| 320 | * @efx: Efx NIC |
| 321 | * @lb_tests: Efx loopback self-test results structure |
| 322 | * @mode: Loopback test mode |
| 323 | * @test_index: Starting index of the test |
| 324 | * @strings: Ethtool strings, or %NULL |
| 325 | * @data: Ethtool test results, or %NULL |
| 326 | */ |
| 327 | static int efx_fill_loopback_test(struct efx_nic *efx, |
| 328 | struct efx_loopback_self_tests *lb_tests, |
| 329 | enum efx_loopback_mode mode, |
| 330 | unsigned int test_index, |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 331 | u8 *strings, u64 *data) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 332 | { |
Ben Hutchings | 1ac0226 | 2012-09-13 02:22:52 +0100 | [diff] [blame] | 333 | struct efx_channel *channel = |
| 334 | efx_get_channel(efx, efx->tx_channel_offset); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 335 | struct efx_tx_queue *tx_queue; |
| 336 | |
Ben Hutchings | f7d12cd | 2010-09-10 06:41:47 +0000 | [diff] [blame] | 337 | efx_for_each_channel_tx_queue(tx_queue, channel) { |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 338 | efx_fill_test(test_index++, strings, data, |
| 339 | &lb_tests->tx_sent[tx_queue->queue], |
| 340 | EFX_TX_QUEUE_NAME(tx_queue), |
| 341 | EFX_LOOPBACK_NAME(mode, "tx_sent")); |
| 342 | efx_fill_test(test_index++, strings, data, |
| 343 | &lb_tests->tx_done[tx_queue->queue], |
| 344 | EFX_TX_QUEUE_NAME(tx_queue), |
| 345 | EFX_LOOPBACK_NAME(mode, "tx_done")); |
| 346 | } |
| 347 | efx_fill_test(test_index++, strings, data, |
| 348 | &lb_tests->rx_good, |
Ben Hutchings | 11e6696 | 2008-12-12 22:05:48 -0800 | [diff] [blame] | 349 | "rx", 0, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 350 | EFX_LOOPBACK_NAME(mode, "rx_good")); |
| 351 | efx_fill_test(test_index++, strings, data, |
| 352 | &lb_tests->rx_bad, |
Ben Hutchings | 11e6696 | 2008-12-12 22:05:48 -0800 | [diff] [blame] | 353 | "rx", 0, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 354 | EFX_LOOPBACK_NAME(mode, "rx_bad")); |
| 355 | |
| 356 | return test_index; |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * efx_ethtool_fill_self_tests - get self-test details |
| 361 | * @efx: Efx NIC |
| 362 | * @tests: Efx self-test results structure, or %NULL |
| 363 | * @strings: Ethtool strings, or %NULL |
| 364 | * @data: Ethtool test results, or %NULL |
| 365 | */ |
| 366 | static int efx_ethtool_fill_self_tests(struct efx_nic *efx, |
| 367 | struct efx_self_tests *tests, |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 368 | u8 *strings, u64 *data) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 369 | { |
| 370 | struct efx_channel *channel; |
Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 371 | unsigned int n = 0, i; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 372 | enum efx_loopback_mode mode; |
| 373 | |
Ben Hutchings | 4f16c07 | 2010-02-03 09:30:50 +0000 | [diff] [blame] | 374 | efx_fill_test(n++, strings, data, &tests->phy_alive, |
| 375 | "phy", 0, "alive", NULL); |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 376 | efx_fill_test(n++, strings, data, &tests->nvram, |
| 377 | "core", 0, "nvram", NULL); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 378 | efx_fill_test(n++, strings, data, &tests->interrupt, |
| 379 | "core", 0, "interrupt", NULL); |
| 380 | |
| 381 | /* Event queues */ |
| 382 | efx_for_each_channel(channel, efx) { |
| 383 | efx_fill_test(n++, strings, data, |
| 384 | &tests->eventq_dma[channel->channel], |
| 385 | EFX_CHANNEL_NAME(channel), |
| 386 | "eventq.dma", NULL); |
| 387 | efx_fill_test(n++, strings, data, |
| 388 | &tests->eventq_int[channel->channel], |
| 389 | EFX_CHANNEL_NAME(channel), |
| 390 | "eventq.int", NULL); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 391 | } |
| 392 | |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 393 | efx_fill_test(n++, strings, data, &tests->registers, |
| 394 | "core", 0, "registers", NULL); |
Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 395 | |
Ben Hutchings | c1c4f45 | 2009-11-29 15:08:55 +0000 | [diff] [blame] | 396 | if (efx->phy_op->run_tests != NULL) { |
| 397 | EFX_BUG_ON_PARANOID(efx->phy_op->test_name == NULL); |
| 398 | |
| 399 | for (i = 0; true; ++i) { |
| 400 | const char *name; |
| 401 | |
| 402 | EFX_BUG_ON_PARANOID(i >= EFX_MAX_PHY_TESTS); |
| 403 | name = efx->phy_op->test_name(efx, i); |
| 404 | if (name == NULL) |
| 405 | break; |
| 406 | |
Ben Hutchings | 4f16c07 | 2010-02-03 09:30:50 +0000 | [diff] [blame] | 407 | efx_fill_test(n++, strings, data, &tests->phy_ext[i], |
Ben Hutchings | c1c4f45 | 2009-11-29 15:08:55 +0000 | [diff] [blame] | 408 | "phy", 0, name, NULL); |
| 409 | } |
| 410 | } |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 411 | |
| 412 | /* Loopback tests */ |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 413 | for (mode = LOOPBACK_NONE; mode <= LOOPBACK_TEST_MAX; mode++) { |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 414 | if (!(efx->loopback_modes & (1 << mode))) |
| 415 | continue; |
| 416 | n = efx_fill_loopback_test(efx, |
| 417 | &tests->loopback[mode], mode, n, |
| 418 | strings, data); |
| 419 | } |
| 420 | |
| 421 | return n; |
| 422 | } |
| 423 | |
Ben Hutchings | 3594e13 | 2008-09-01 12:48:12 +0100 | [diff] [blame] | 424 | static int efx_ethtool_get_sset_count(struct net_device *net_dev, |
| 425 | int string_set) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 426 | { |
Ben Hutchings | 3594e13 | 2008-09-01 12:48:12 +0100 | [diff] [blame] | 427 | switch (string_set) { |
| 428 | case ETH_SS_STATS: |
| 429 | return EFX_ETHTOOL_NUM_STATS; |
| 430 | case ETH_SS_TEST: |
| 431 | return efx_ethtool_fill_self_tests(netdev_priv(net_dev), |
| 432 | NULL, NULL, NULL); |
| 433 | default: |
| 434 | return -EINVAL; |
| 435 | } |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 436 | } |
| 437 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 438 | static void efx_ethtool_get_strings(struct net_device *net_dev, |
| 439 | u32 string_set, u8 *strings) |
| 440 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 441 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 442 | int i; |
| 443 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 444 | switch (string_set) { |
| 445 | case ETH_SS_STATS: |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 446 | for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 447 | strlcpy(strings + i * ETH_GSTRING_LEN, |
| 448 | efx_ethtool_stats[i].name, ETH_GSTRING_LEN); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 449 | break; |
| 450 | case ETH_SS_TEST: |
Ben Hutchings | b681e57 | 2012-12-14 22:18:55 +0000 | [diff] [blame^] | 451 | efx_ethtool_fill_self_tests(efx, NULL, strings, NULL); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 452 | break; |
| 453 | default: |
| 454 | /* No other string sets */ |
| 455 | break; |
| 456 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | static void efx_ethtool_get_stats(struct net_device *net_dev, |
| 460 | struct ethtool_stats *stats, |
| 461 | u64 *data) |
| 462 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 463 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 464 | struct efx_mac_stats *mac_stats = &efx->mac_stats; |
Ben Hutchings | 18e83e4 | 2012-01-05 19:05:20 +0000 | [diff] [blame] | 465 | const struct efx_ethtool_stat *stat; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 466 | struct efx_channel *channel; |
Ben Hutchings | 119226c | 2011-02-18 19:14:13 +0000 | [diff] [blame] | 467 | struct efx_tx_queue *tx_queue; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 468 | int i; |
| 469 | |
| 470 | EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS); |
| 471 | |
Ben Hutchings | 1cb3452 | 2011-09-02 23:23:00 +0100 | [diff] [blame] | 472 | spin_lock_bh(&efx->stats_lock); |
| 473 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 474 | /* Update MAC and NIC statistics */ |
Ben Hutchings | 1cb3452 | 2011-09-02 23:23:00 +0100 | [diff] [blame] | 475 | efx->type->update_stats(efx); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 476 | |
| 477 | /* Fill detailed statistics buffer */ |
| 478 | for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) { |
| 479 | stat = &efx_ethtool_stats[i]; |
| 480 | switch (stat->source) { |
| 481 | case EFX_ETHTOOL_STAT_SOURCE_mac_stats: |
| 482 | data[i] = stat->get_stat((void *)mac_stats + |
| 483 | stat->offset); |
| 484 | break; |
| 485 | case EFX_ETHTOOL_STAT_SOURCE_nic: |
| 486 | data[i] = stat->get_stat((void *)efx + stat->offset); |
| 487 | break; |
| 488 | case EFX_ETHTOOL_STAT_SOURCE_channel: |
| 489 | data[i] = 0; |
| 490 | efx_for_each_channel(channel, efx) |
| 491 | data[i] += stat->get_stat((void *)channel + |
| 492 | stat->offset); |
| 493 | break; |
Ben Hutchings | 119226c | 2011-02-18 19:14:13 +0000 | [diff] [blame] | 494 | case EFX_ETHTOOL_STAT_SOURCE_tx_queue: |
| 495 | data[i] = 0; |
| 496 | efx_for_each_channel(channel, efx) { |
| 497 | efx_for_each_channel_tx_queue(tx_queue, channel) |
| 498 | data[i] += |
| 499 | stat->get_stat((void *)tx_queue |
| 500 | + stat->offset); |
| 501 | } |
| 502 | break; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 503 | } |
| 504 | } |
Ben Hutchings | 1cb3452 | 2011-09-02 23:23:00 +0100 | [diff] [blame] | 505 | |
| 506 | spin_unlock_bh(&efx->stats_lock); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 507 | } |
| 508 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 509 | static void efx_ethtool_self_test(struct net_device *net_dev, |
| 510 | struct ethtool_test *test, u64 *data) |
| 511 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 512 | struct efx_nic *efx = netdev_priv(net_dev); |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 513 | struct efx_self_tests *efx_tests; |
Ben Hutchings | 2ef3068 | 2008-12-26 13:47:04 -0800 | [diff] [blame] | 514 | int already_up; |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 515 | int rc = -ENOMEM; |
| 516 | |
| 517 | efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); |
| 518 | if (!efx_tests) |
| 519 | goto fail; |
| 520 | |
Ben Hutchings | f16aeea | 2012-07-27 19:31:16 +0100 | [diff] [blame] | 521 | if (efx->state != STATE_READY) { |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 522 | rc = -EIO; |
| 523 | goto fail1; |
| 524 | } |
| 525 | |
Ben Hutchings | ac33ac6 | 2010-12-07 18:29:52 +0000 | [diff] [blame] | 526 | netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", |
| 527 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); |
| 528 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 529 | /* We need rx buffers and interrupts. */ |
| 530 | already_up = (efx->net_dev->flags & IFF_UP); |
| 531 | if (!already_up) { |
| 532 | rc = dev_open(efx->net_dev); |
| 533 | if (rc) { |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 534 | netif_err(efx, drv, efx->net_dev, |
| 535 | "failed opening device.\n"); |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 536 | goto fail1; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 537 | } |
| 538 | } |
| 539 | |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 540 | rc = efx_selftest(efx, efx_tests, test->flags); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 541 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 542 | if (!already_up) |
| 543 | dev_close(efx->net_dev); |
| 544 | |
Ben Hutchings | ac33ac6 | 2010-12-07 18:29:52 +0000 | [diff] [blame] | 545 | netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", |
| 546 | rc == 0 ? "passed" : "failed", |
| 547 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 548 | |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 549 | fail1: |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 550 | /* Fill ethtool results structures */ |
Eric Dumazet | 28801f3 | 2011-02-16 03:48:38 +0000 | [diff] [blame] | 551 | efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); |
| 552 | kfree(efx_tests); |
| 553 | fail: |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 554 | if (rc) |
| 555 | test->flags |= ETH_TEST_FL_FAILED; |
| 556 | } |
| 557 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 558 | /* Restart autonegotiation */ |
| 559 | static int efx_ethtool_nway_reset(struct net_device *net_dev) |
| 560 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 561 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 562 | |
Ben Hutchings | 68e7f45 | 2009-04-29 08:05:08 +0000 | [diff] [blame] | 563 | return mdio45_nway_restart(&efx->mdio); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 564 | } |
| 565 | |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 566 | /* |
| 567 | * Each channel has a single IRQ and moderation timer, started by any |
| 568 | * completion (or other event). Unless the module parameter |
| 569 | * separate_tx_channels is set, IRQs and moderation are therefore |
| 570 | * shared between RX and TX completions. In this case, when RX IRQ |
| 571 | * moderation is explicitly changed then TX IRQ moderation is |
| 572 | * automatically changed too, but otherwise we fail if the two values |
| 573 | * are requested to be different. |
| 574 | * |
Ben Hutchings | 1322597 | 2011-09-05 07:43:49 +0000 | [diff] [blame] | 575 | * The hardware does not support a limit on the number of completions |
| 576 | * before an IRQ, so we do not use the max_frames fields. We should |
| 577 | * report and require that max_frames == (usecs != 0), but this would |
| 578 | * invalidate existing user documentation. |
| 579 | * |
| 580 | * The hardware does not have distinct settings for interrupt |
| 581 | * moderation while the previous IRQ is being handled, so we should |
| 582 | * not use the 'irq' fields. However, an earlier developer |
| 583 | * misunderstood the meaning of the 'irq' fields and the driver did |
| 584 | * not support the standard fields. To avoid invalidating existing |
| 585 | * user documentation, we report and accept changes through either the |
| 586 | * standard or 'irq' fields. If both are changed at the same time, we |
| 587 | * prefer the standard field. |
| 588 | * |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 589 | * We implement adaptive IRQ moderation, but use a different algorithm |
| 590 | * from that assumed in the definition of struct ethtool_coalesce. |
| 591 | * Therefore we do not use any of the adaptive moderation parameters |
| 592 | * in it. |
| 593 | */ |
| 594 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 595 | static int efx_ethtool_get_coalesce(struct net_device *net_dev, |
| 596 | struct ethtool_coalesce *coalesce) |
| 597 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 598 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 599 | unsigned int tx_usecs, rx_usecs; |
| 600 | bool rx_adaptive; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 601 | |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 602 | efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 603 | |
Ben Hutchings | 1322597 | 2011-09-05 07:43:49 +0000 | [diff] [blame] | 604 | coalesce->tx_coalesce_usecs = tx_usecs; |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 605 | coalesce->tx_coalesce_usecs_irq = tx_usecs; |
Ben Hutchings | 1322597 | 2011-09-05 07:43:49 +0000 | [diff] [blame] | 606 | coalesce->rx_coalesce_usecs = rx_usecs; |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 607 | coalesce->rx_coalesce_usecs_irq = rx_usecs; |
| 608 | coalesce->use_adaptive_rx_coalesce = rx_adaptive; |
Ben Hutchings | 0d86ebd | 2009-10-23 08:32:13 +0000 | [diff] [blame] | 609 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 610 | return 0; |
| 611 | } |
| 612 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 613 | static int efx_ethtool_set_coalesce(struct net_device *net_dev, |
| 614 | struct ethtool_coalesce *coalesce) |
| 615 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 616 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 617 | struct efx_channel *channel; |
Ben Hutchings | b548f97 | 2011-09-05 07:41:44 +0000 | [diff] [blame] | 618 | unsigned int tx_usecs, rx_usecs; |
Ben Hutchings | 9e393b3 | 2011-09-05 07:43:04 +0000 | [diff] [blame] | 619 | bool adaptive, rx_may_override_tx; |
| 620 | int rc; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 621 | |
Ben Hutchings | 6fb70fd | 2009-03-20 13:30:37 +0000 | [diff] [blame] | 622 | if (coalesce->use_adaptive_tx_coalesce) |
Ben Hutchings | 9f85ee9 | 2011-09-05 07:41:27 +0000 | [diff] [blame] | 623 | return -EINVAL; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 624 | |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 625 | efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive); |
| 626 | |
Ben Hutchings | 1322597 | 2011-09-05 07:43:49 +0000 | [diff] [blame] | 627 | if (coalesce->rx_coalesce_usecs != rx_usecs) |
| 628 | rx_usecs = coalesce->rx_coalesce_usecs; |
| 629 | else |
| 630 | rx_usecs = coalesce->rx_coalesce_usecs_irq; |
| 631 | |
Ben Hutchings | 6fb70fd | 2009-03-20 13:30:37 +0000 | [diff] [blame] | 632 | adaptive = coalesce->use_adaptive_rx_coalesce; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 633 | |
Ben Hutchings | a0c4faf | 2011-09-05 07:42:25 +0000 | [diff] [blame] | 634 | /* If channels are shared, TX IRQ moderation can be quietly |
| 635 | * overridden unless it is changed from its old value. |
| 636 | */ |
Ben Hutchings | 1322597 | 2011-09-05 07:43:49 +0000 | [diff] [blame] | 637 | rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs && |
| 638 | coalesce->tx_coalesce_usecs_irq == tx_usecs); |
| 639 | if (coalesce->tx_coalesce_usecs != tx_usecs) |
| 640 | tx_usecs = coalesce->tx_coalesce_usecs; |
| 641 | else |
| 642 | tx_usecs = coalesce->tx_coalesce_usecs_irq; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 643 | |
Ben Hutchings | 9e393b3 | 2011-09-05 07:43:04 +0000 | [diff] [blame] | 644 | rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive, |
| 645 | rx_may_override_tx); |
| 646 | if (rc != 0) |
| 647 | return rc; |
| 648 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 649 | efx_for_each_channel(channel, efx) |
Ben Hutchings | ef2b90e | 2009-11-29 03:42:31 +0000 | [diff] [blame] | 650 | efx->type->push_irq_moderation(channel); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 651 | |
| 652 | return 0; |
| 653 | } |
| 654 | |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 655 | static void efx_ethtool_get_ringparam(struct net_device *net_dev, |
| 656 | struct ethtool_ringparam *ring) |
| 657 | { |
| 658 | struct efx_nic *efx = netdev_priv(net_dev); |
| 659 | |
| 660 | ring->rx_max_pending = EFX_MAX_DMAQ_SIZE; |
| 661 | ring->tx_max_pending = EFX_MAX_DMAQ_SIZE; |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 662 | ring->rx_pending = efx->rxq_entries; |
| 663 | ring->tx_pending = efx->txq_entries; |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | static int efx_ethtool_set_ringparam(struct net_device *net_dev, |
| 667 | struct ethtool_ringparam *ring) |
| 668 | { |
| 669 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 7e6d06f | 2012-07-30 15:57:44 +0000 | [diff] [blame] | 670 | u32 txq_entries; |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 671 | |
| 672 | if (ring->rx_mini_pending || ring->rx_jumbo_pending || |
| 673 | ring->rx_pending > EFX_MAX_DMAQ_SIZE || |
| 674 | ring->tx_pending > EFX_MAX_DMAQ_SIZE) |
| 675 | return -EINVAL; |
| 676 | |
Ben Hutchings | 7e6d06f | 2012-07-30 15:57:44 +0000 | [diff] [blame] | 677 | if (ring->rx_pending < EFX_RXQ_MIN_ENT) { |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 678 | netif_err(efx, drv, efx->net_dev, |
Ben Hutchings | 7e6d06f | 2012-07-30 15:57:44 +0000 | [diff] [blame] | 679 | "RX queues cannot be smaller than %u\n", |
| 680 | EFX_RXQ_MIN_ENT); |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 681 | return -EINVAL; |
| 682 | } |
| 683 | |
Ben Hutchings | 7e6d06f | 2012-07-30 15:57:44 +0000 | [diff] [blame] | 684 | txq_entries = max(ring->tx_pending, EFX_TXQ_MIN_ENT(efx)); |
| 685 | if (txq_entries != ring->tx_pending) |
| 686 | netif_warn(efx, drv, efx->net_dev, |
| 687 | "increasing TX queue size to minimum of %u\n", |
| 688 | txq_entries); |
| 689 | |
| 690 | return efx_realloc_channels(efx, ring->rx_pending, txq_entries); |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 691 | } |
| 692 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 693 | static int efx_ethtool_set_pauseparam(struct net_device *net_dev, |
| 694 | struct ethtool_pauseparam *pause) |
| 695 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 696 | struct efx_nic *efx = netdev_priv(net_dev); |
David S. Miller | b5626946 | 2011-05-17 17:53:22 -0400 | [diff] [blame] | 697 | u8 wanted_fc, old_fc; |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 698 | u32 old_adv; |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 699 | int rc = 0; |
| 700 | |
| 701 | mutex_lock(&efx->mac_lock); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 702 | |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 703 | wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) | |
| 704 | (pause->tx_pause ? EFX_FC_TX : 0) | |
| 705 | (pause->autoneg ? EFX_FC_AUTO : 0)); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 706 | |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 707 | if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) { |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 708 | netif_dbg(efx, drv, efx->net_dev, |
| 709 | "Flow control unsupported: tx ON rx OFF\n"); |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 710 | rc = -EINVAL; |
| 711 | goto out; |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 712 | } |
| 713 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 714 | if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) { |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 715 | netif_dbg(efx, drv, efx->net_dev, |
| 716 | "Autonegotiation is disabled\n"); |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 717 | rc = -EINVAL; |
| 718 | goto out; |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 719 | } |
| 720 | |
Ben Hutchings | 9dd3a13 | 2012-09-13 01:11:25 +0100 | [diff] [blame] | 721 | /* Hook for Falcon bug 11482 workaround */ |
| 722 | if (efx->type->prepare_enable_fc_tx && |
| 723 | (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX)) |
| 724 | efx->type->prepare_enable_fc_tx(efx); |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 725 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 726 | old_adv = efx->link_advertising; |
| 727 | old_fc = efx->wanted_fc; |
| 728 | efx_link_set_wanted_fc(efx, wanted_fc); |
| 729 | if (efx->link_advertising != old_adv || |
| 730 | (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { |
| 731 | rc = efx->phy_op->reconfigure(efx); |
| 732 | if (rc) { |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 733 | netif_err(efx, drv, efx->net_dev, |
| 734 | "Unable to advertise requested flow " |
| 735 | "control setting\n"); |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 736 | goto out; |
| 737 | } |
| 738 | } |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 739 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 740 | /* Reconfigure the MAC. The PHY *may* generate a link state change event |
| 741 | * if the user just changed the advertised capabilities, but there's no |
| 742 | * harm doing this twice */ |
Ben Hutchings | 710b208 | 2011-09-03 00:15:00 +0100 | [diff] [blame] | 743 | efx->type->reconfigure_mac(efx); |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 744 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 745 | out: |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 746 | mutex_unlock(&efx->mac_lock); |
| 747 | |
Ben Hutchings | d3245b2 | 2009-11-29 03:42:41 +0000 | [diff] [blame] | 748 | return rc; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | static void efx_ethtool_get_pauseparam(struct net_device *net_dev, |
| 752 | struct ethtool_pauseparam *pause) |
| 753 | { |
Ben Hutchings | 767e468 | 2008-09-01 12:43:14 +0100 | [diff] [blame] | 754 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 755 | |
Ben Hutchings | 04cc8ca | 2008-12-12 21:50:46 -0800 | [diff] [blame] | 756 | pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX); |
| 757 | pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX); |
| 758 | pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | |
Ben Hutchings | 89c758f | 2009-11-29 03:43:07 +0000 | [diff] [blame] | 762 | static void efx_ethtool_get_wol(struct net_device *net_dev, |
| 763 | struct ethtool_wolinfo *wol) |
| 764 | { |
| 765 | struct efx_nic *efx = netdev_priv(net_dev); |
| 766 | return efx->type->get_wol(efx, wol); |
| 767 | } |
| 768 | |
| 769 | |
| 770 | static int efx_ethtool_set_wol(struct net_device *net_dev, |
| 771 | struct ethtool_wolinfo *wol) |
| 772 | { |
| 773 | struct efx_nic *efx = netdev_priv(net_dev); |
| 774 | return efx->type->set_wol(efx, wol->wolopts); |
| 775 | } |
| 776 | |
stephen hemminger | d215697 | 2010-10-18 05:27:31 +0000 | [diff] [blame] | 777 | static int efx_ethtool_reset(struct net_device *net_dev, u32 *flags) |
Ben Hutchings | eb9f674 | 2009-11-29 03:43:15 +0000 | [diff] [blame] | 778 | { |
| 779 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 0e2a9c7 | 2011-06-24 20:50:07 +0100 | [diff] [blame] | 780 | int rc; |
Ben Hutchings | eb9f674 | 2009-11-29 03:43:15 +0000 | [diff] [blame] | 781 | |
Ben Hutchings | 0e2a9c7 | 2011-06-24 20:50:07 +0100 | [diff] [blame] | 782 | rc = efx->type->map_reset_flags(flags); |
| 783 | if (rc < 0) |
| 784 | return rc; |
Ben Hutchings | eb9f674 | 2009-11-29 03:43:15 +0000 | [diff] [blame] | 785 | |
Ben Hutchings | 0e2a9c7 | 2011-06-24 20:50:07 +0100 | [diff] [blame] | 786 | return efx_reset(efx, rc); |
Ben Hutchings | eb9f674 | 2009-11-29 03:43:15 +0000 | [diff] [blame] | 787 | } |
| 788 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 789 | /* MAC address mask including only I/G bit */ |
| 790 | static const u8 mac_addr_ig_mask[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; |
Ben Hutchings | c274d65 | 2012-02-02 22:41:49 +0000 | [diff] [blame] | 791 | |
Ben Hutchings | 0e0c340 | 2012-09-06 02:11:04 +0100 | [diff] [blame] | 792 | #define IP4_ADDR_FULL_MASK ((__force __be32)~0) |
| 793 | #define PORT_FULL_MASK ((__force __be16)~0) |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 794 | #define ETHER_TYPE_FULL_MASK ((__force __be16)~0) |
Ben Hutchings | 0e0c340 | 2012-09-06 02:11:04 +0100 | [diff] [blame] | 795 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 796 | static int efx_ethtool_get_class_rule(struct efx_nic *efx, |
| 797 | struct ethtool_rx_flow_spec *rule) |
| 798 | { |
| 799 | struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; |
| 800 | struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; |
Ben Hutchings | c274d65 | 2012-02-02 22:41:49 +0000 | [diff] [blame] | 801 | struct ethhdr *mac_entry = &rule->h_u.ether_spec; |
| 802 | struct ethhdr *mac_mask = &rule->m_u.ether_spec; |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 803 | struct efx_filter_spec spec; |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 804 | int rc; |
| 805 | |
| 806 | rc = efx_filter_get_filter_safe(efx, EFX_FILTER_PRI_MANUAL, |
| 807 | rule->location, &spec); |
| 808 | if (rc) |
| 809 | return rc; |
| 810 | |
Ben Hutchings | f26e958 | 2012-10-30 01:01:52 +0000 | [diff] [blame] | 811 | if (spec.dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP) |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 812 | rule->ring_cookie = RX_CLS_FLOW_DISC; |
| 813 | else |
| 814 | rule->ring_cookie = spec.dmaq_id; |
| 815 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 816 | if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) && |
| 817 | spec.ether_type == htons(ETH_P_IP) && |
| 818 | (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) && |
| 819 | (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) && |
| 820 | !(spec.match_flags & |
| 821 | ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID | |
| 822 | EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST | |
| 823 | EFX_FILTER_MATCH_IP_PROTO | |
| 824 | EFX_FILTER_MATCH_LOC_PORT | EFX_FILTER_MATCH_REM_PORT))) { |
| 825 | rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? |
| 826 | TCP_V4_FLOW : UDP_V4_FLOW); |
| 827 | if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) { |
| 828 | ip_entry->ip4dst = spec.loc_host[0]; |
| 829 | ip_mask->ip4dst = IP4_ADDR_FULL_MASK; |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 830 | } |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 831 | if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) { |
| 832 | ip_entry->ip4src = spec.rem_host[0]; |
| 833 | ip_mask->ip4src = IP4_ADDR_FULL_MASK; |
| 834 | } |
| 835 | if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) { |
| 836 | ip_entry->pdst = spec.loc_port; |
| 837 | ip_mask->pdst = PORT_FULL_MASK; |
| 838 | } |
| 839 | if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) { |
| 840 | ip_entry->psrc = spec.rem_port; |
| 841 | ip_mask->psrc = PORT_FULL_MASK; |
| 842 | } |
| 843 | } else if (!(spec.match_flags & |
| 844 | ~(EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG | |
| 845 | EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_ETHER_TYPE | |
| 846 | EFX_FILTER_MATCH_OUTER_VID))) { |
| 847 | rule->flow_type = ETHER_FLOW; |
| 848 | if (spec.match_flags & |
| 849 | (EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG)) { |
| 850 | memcpy(mac_entry->h_dest, spec.loc_mac, ETH_ALEN); |
| 851 | if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC) |
| 852 | memset(mac_mask->h_dest, ~0, ETH_ALEN); |
| 853 | else |
| 854 | memcpy(mac_mask->h_dest, mac_addr_ig_mask, |
| 855 | ETH_ALEN); |
| 856 | } |
| 857 | if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) { |
| 858 | memcpy(mac_entry->h_source, spec.rem_mac, ETH_ALEN); |
| 859 | memset(mac_mask->h_source, ~0, ETH_ALEN); |
| 860 | } |
| 861 | if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) { |
| 862 | mac_entry->h_proto = spec.ether_type; |
| 863 | mac_mask->h_proto = ETHER_TYPE_FULL_MASK; |
| 864 | } |
| 865 | } else { |
| 866 | /* The above should handle all filters that we insert */ |
| 867 | WARN_ON(1); |
| 868 | return -EINVAL; |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 869 | } |
| 870 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 871 | if (spec.match_flags & EFX_FILTER_MATCH_OUTER_VID) { |
| 872 | rule->flow_type |= FLOW_EXT; |
| 873 | rule->h_ext.vlan_tci = spec.outer_vid; |
| 874 | rule->m_ext.vlan_tci = htons(0xfff); |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 875 | } |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 876 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 877 | return rc; |
| 878 | } |
| 879 | |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 880 | static int |
| 881 | efx_ethtool_get_rxnfc(struct net_device *net_dev, |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 882 | struct ethtool_rxnfc *info, u32 *rule_locs) |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 883 | { |
| 884 | struct efx_nic *efx = netdev_priv(net_dev); |
| 885 | |
| 886 | switch (info->cmd) { |
| 887 | case ETHTOOL_GRXRINGS: |
| 888 | info->data = efx->n_rx_channels; |
| 889 | return 0; |
| 890 | |
| 891 | case ETHTOOL_GRXFH: { |
| 892 | unsigned min_revision = 0; |
| 893 | |
| 894 | info->data = 0; |
| 895 | switch (info->flow_type) { |
| 896 | case TCP_V4_FLOW: |
| 897 | info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
| 898 | /* fall through */ |
| 899 | case UDP_V4_FLOW: |
| 900 | case SCTP_V4_FLOW: |
| 901 | case AH_ESP_V4_FLOW: |
| 902 | case IPV4_FLOW: |
| 903 | info->data |= RXH_IP_SRC | RXH_IP_DST; |
| 904 | min_revision = EFX_REV_FALCON_B0; |
| 905 | break; |
| 906 | case TCP_V6_FLOW: |
| 907 | info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
| 908 | /* fall through */ |
| 909 | case UDP_V6_FLOW: |
| 910 | case SCTP_V6_FLOW: |
| 911 | case AH_ESP_V6_FLOW: |
| 912 | case IPV6_FLOW: |
| 913 | info->data |= RXH_IP_SRC | RXH_IP_DST; |
| 914 | min_revision = EFX_REV_SIENA_A0; |
| 915 | break; |
| 916 | default: |
| 917 | break; |
| 918 | } |
| 919 | if (efx_nic_rev(efx) < min_revision) |
| 920 | info->data = 0; |
| 921 | return 0; |
| 922 | } |
| 923 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 924 | case ETHTOOL_GRXCLSRLCNT: |
| 925 | info->data = efx_filter_get_rx_id_limit(efx); |
| 926 | if (info->data == 0) |
| 927 | return -EOPNOTSUPP; |
| 928 | info->data |= RX_CLS_LOC_SPECIAL; |
| 929 | info->rule_cnt = |
| 930 | efx_filter_count_rx_used(efx, EFX_FILTER_PRI_MANUAL); |
| 931 | return 0; |
| 932 | |
| 933 | case ETHTOOL_GRXCLSRULE: |
| 934 | if (efx_filter_get_rx_id_limit(efx) == 0) |
| 935 | return -EOPNOTSUPP; |
| 936 | return efx_ethtool_get_class_rule(efx, &info->fs); |
| 937 | |
| 938 | case ETHTOOL_GRXCLSRLALL: { |
| 939 | s32 rc; |
| 940 | info->data = efx_filter_get_rx_id_limit(efx); |
| 941 | if (info->data == 0) |
| 942 | return -EOPNOTSUPP; |
| 943 | rc = efx_filter_get_rx_ids(efx, EFX_FILTER_PRI_MANUAL, |
| 944 | rule_locs, info->rule_cnt); |
| 945 | if (rc < 0) |
| 946 | return rc; |
| 947 | info->rule_cnt = rc; |
| 948 | return 0; |
| 949 | } |
| 950 | |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 951 | default: |
| 952 | return -EOPNOTSUPP; |
| 953 | } |
| 954 | } |
| 955 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 956 | static int efx_ethtool_set_class_rule(struct efx_nic *efx, |
| 957 | struct ethtool_rx_flow_spec *rule) |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 958 | { |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 959 | struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; |
| 960 | struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; |
| 961 | struct ethhdr *mac_entry = &rule->h_u.ether_spec; |
| 962 | struct ethhdr *mac_mask = &rule->m_u.ether_spec; |
| 963 | struct efx_filter_spec spec; |
Ben Hutchings | c39d35e | 2010-12-07 19:11:26 +0000 | [diff] [blame] | 964 | int rc; |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 965 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 966 | /* Check that user wants us to choose the location */ |
Ben Hutchings | 9e0f9a1 | 2012-09-04 18:57:25 +0100 | [diff] [blame] | 967 | if (rule->location != RX_CLS_LOC_ANY) |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 968 | return -EINVAL; |
| 969 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 970 | /* Range-check ring_cookie */ |
| 971 | if (rule->ring_cookie >= efx->n_rx_channels && |
| 972 | rule->ring_cookie != RX_CLS_FLOW_DISC) |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 973 | return -EINVAL; |
| 974 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 975 | /* Check for unsupported extensions */ |
| 976 | if ((rule->flow_type & FLOW_EXT) && |
Ben Hutchings | 0e0c340 | 2012-09-06 02:11:04 +0100 | [diff] [blame] | 977 | (rule->m_ext.vlan_etype || rule->m_ext.data[0] || |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 978 | rule->m_ext.data[1])) |
| 979 | return -EINVAL; |
Ben Hutchings | c39d35e | 2010-12-07 19:11:26 +0000 | [diff] [blame] | 980 | |
Ben Hutchings | 85740cdf | 2013-01-29 23:33:15 +0000 | [diff] [blame] | 981 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, |
| 982 | efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 983 | (rule->ring_cookie == RX_CLS_FLOW_DISC) ? |
Ben Hutchings | f26e958 | 2012-10-30 01:01:52 +0000 | [diff] [blame] | 984 | EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie); |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 985 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 986 | switch (rule->flow_type & ~FLOW_EXT) { |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 987 | case TCP_V4_FLOW: |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 988 | case UDP_V4_FLOW: |
| 989 | spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE | |
| 990 | EFX_FILTER_MATCH_IP_PROTO); |
| 991 | spec.ether_type = htons(ETH_P_IP); |
| 992 | spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V4_FLOW ? |
| 993 | IPPROTO_TCP : IPPROTO_UDP); |
| 994 | if (ip_mask->ip4dst) { |
| 995 | if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) |
| 996 | return -EINVAL; |
| 997 | spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST; |
| 998 | spec.loc_host[0] = ip_entry->ip4dst; |
| 999 | } |
| 1000 | if (ip_mask->ip4src) { |
| 1001 | if (ip_mask->ip4src != IP4_ADDR_FULL_MASK) |
| 1002 | return -EINVAL; |
| 1003 | spec.match_flags |= EFX_FILTER_MATCH_REM_HOST; |
| 1004 | spec.rem_host[0] = ip_entry->ip4src; |
| 1005 | } |
| 1006 | if (ip_mask->pdst) { |
| 1007 | if (ip_mask->pdst != PORT_FULL_MASK) |
| 1008 | return -EINVAL; |
| 1009 | spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT; |
| 1010 | spec.loc_port = ip_entry->pdst; |
| 1011 | } |
| 1012 | if (ip_mask->psrc) { |
| 1013 | if (ip_mask->psrc != PORT_FULL_MASK) |
| 1014 | return -EINVAL; |
| 1015 | spec.match_flags |= EFX_FILTER_MATCH_REM_PORT; |
| 1016 | spec.rem_port = ip_entry->psrc; |
| 1017 | } |
| 1018 | if (ip_mask->tos) |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 1019 | return -EINVAL; |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 1020 | break; |
Ben Hutchings | c39d35e | 2010-12-07 19:11:26 +0000 | [diff] [blame] | 1021 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 1022 | case ETHER_FLOW: |
| 1023 | if (!is_zero_ether_addr(mac_mask->h_dest)) { |
| 1024 | if (ether_addr_equal(mac_mask->h_dest, |
| 1025 | mac_addr_ig_mask)) |
| 1026 | spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG; |
| 1027 | else if (is_broadcast_ether_addr(mac_mask->h_dest)) |
| 1028 | spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC; |
Ben Hutchings | c274d65 | 2012-02-02 22:41:49 +0000 | [diff] [blame] | 1029 | else |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 1030 | return -EINVAL; |
| 1031 | memcpy(spec.loc_mac, mac_entry->h_dest, ETH_ALEN); |
Ben Hutchings | c274d65 | 2012-02-02 22:41:49 +0000 | [diff] [blame] | 1032 | } |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 1033 | if (!is_zero_ether_addr(mac_mask->h_source)) { |
| 1034 | if (!is_broadcast_ether_addr(mac_mask->h_source)) |
| 1035 | return -EINVAL; |
| 1036 | spec.match_flags |= EFX_FILTER_MATCH_REM_MAC; |
| 1037 | memcpy(spec.rem_mac, mac_entry->h_source, ETH_ALEN); |
Ben Hutchings | c274d65 | 2012-02-02 22:41:49 +0000 | [diff] [blame] | 1038 | } |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 1039 | if (mac_mask->h_proto) { |
| 1040 | if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) |
| 1041 | return -EINVAL; |
| 1042 | spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE; |
| 1043 | spec.ether_type = mac_entry->h_proto; |
| 1044 | } |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 1045 | break; |
Ben Hutchings | c39d35e | 2010-12-07 19:11:26 +0000 | [diff] [blame] | 1046 | |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 1047 | default: |
| 1048 | return -EINVAL; |
| 1049 | } |
| 1050 | |
Ben Hutchings | 7c460d9 | 2012-10-27 00:33:28 +0100 | [diff] [blame] | 1051 | if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) { |
| 1052 | if (rule->m_ext.vlan_tci != htons(0xfff)) |
| 1053 | return -EINVAL; |
| 1054 | spec.match_flags |= EFX_FILTER_MATCH_OUTER_VID; |
| 1055 | spec.outer_vid = rule->h_ext.vlan_tci; |
| 1056 | } |
| 1057 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 1058 | rc = efx_filter_insert_filter(efx, &spec, true); |
| 1059 | if (rc < 0) |
| 1060 | return rc; |
Ben Hutchings | 47a8467 | 2011-05-14 02:35:25 +0100 | [diff] [blame] | 1061 | |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 1062 | rule->location = rc; |
| 1063 | return 0; |
| 1064 | } |
| 1065 | |
| 1066 | static int efx_ethtool_set_rxnfc(struct net_device *net_dev, |
| 1067 | struct ethtool_rxnfc *info) |
| 1068 | { |
| 1069 | struct efx_nic *efx = netdev_priv(net_dev); |
| 1070 | |
| 1071 | if (efx_filter_get_rx_id_limit(efx) == 0) |
| 1072 | return -EOPNOTSUPP; |
| 1073 | |
| 1074 | switch (info->cmd) { |
| 1075 | case ETHTOOL_SRXCLSRLINS: |
| 1076 | return efx_ethtool_set_class_rule(efx, &info->fs); |
| 1077 | |
| 1078 | case ETHTOOL_SRXCLSRLDEL: |
| 1079 | return efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_MANUAL, |
| 1080 | info->fs.location); |
| 1081 | |
| 1082 | default: |
| 1083 | return -EOPNOTSUPP; |
| 1084 | } |
Ben Hutchings | b4187e4 | 2010-09-20 08:43:42 +0000 | [diff] [blame] | 1085 | } |
| 1086 | |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1087 | static u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev) |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1088 | { |
| 1089 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1090 | |
Ben Hutchings | cd2d5b5 | 2012-02-14 00:48:07 +0000 | [diff] [blame] | 1091 | return ((efx_nic_rev(efx) < EFX_REV_FALCON_B0 || |
| 1092 | efx->n_rx_channels == 1) ? |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1093 | 0 : ARRAY_SIZE(efx->rx_indir_table)); |
| 1094 | } |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1095 | |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1096 | static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev, u32 *indir) |
| 1097 | { |
| 1098 | struct efx_nic *efx = netdev_priv(net_dev); |
| 1099 | |
| 1100 | memcpy(indir, efx->rx_indir_table, sizeof(efx->rx_indir_table)); |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1101 | return 0; |
| 1102 | } |
| 1103 | |
| 1104 | static int efx_ethtool_set_rxfh_indir(struct net_device *net_dev, |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1105 | const u32 *indir) |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1106 | { |
| 1107 | struct efx_nic *efx = netdev_priv(net_dev); |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1108 | |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1109 | memcpy(efx->rx_indir_table, indir, sizeof(efx->rx_indir_table)); |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1110 | efx_nic_push_rx_indir_table(efx); |
| 1111 | return 0; |
| 1112 | } |
| 1113 | |
Ben Hutchings | 62ebac9 | 2013-04-08 17:34:58 +0100 | [diff] [blame] | 1114 | int efx_ethtool_get_ts_info(struct net_device *net_dev, |
| 1115 | struct ethtool_ts_info *ts_info) |
| 1116 | { |
| 1117 | struct efx_nic *efx = netdev_priv(net_dev); |
| 1118 | |
| 1119 | /* Software capabilities */ |
| 1120 | ts_info->so_timestamping = (SOF_TIMESTAMPING_RX_SOFTWARE | |
| 1121 | SOF_TIMESTAMPING_SOFTWARE); |
| 1122 | ts_info->phc_index = -1; |
| 1123 | |
| 1124 | efx_ptp_get_ts_info(efx, ts_info); |
| 1125 | return 0; |
| 1126 | } |
| 1127 | |
Stuart Hodgson | c087bd2 | 2012-05-01 18:50:43 +0100 | [diff] [blame] | 1128 | static int efx_ethtool_get_module_eeprom(struct net_device *net_dev, |
| 1129 | struct ethtool_eeprom *ee, |
| 1130 | u8 *data) |
| 1131 | { |
| 1132 | struct efx_nic *efx = netdev_priv(net_dev); |
| 1133 | int ret; |
| 1134 | |
| 1135 | if (!efx->phy_op || !efx->phy_op->get_module_eeprom) |
| 1136 | return -EOPNOTSUPP; |
| 1137 | |
| 1138 | mutex_lock(&efx->mac_lock); |
| 1139 | ret = efx->phy_op->get_module_eeprom(efx, ee, data); |
| 1140 | mutex_unlock(&efx->mac_lock); |
| 1141 | |
| 1142 | return ret; |
| 1143 | } |
| 1144 | |
| 1145 | static int efx_ethtool_get_module_info(struct net_device *net_dev, |
| 1146 | struct ethtool_modinfo *modinfo) |
| 1147 | { |
| 1148 | struct efx_nic *efx = netdev_priv(net_dev); |
| 1149 | int ret; |
| 1150 | |
| 1151 | if (!efx->phy_op || !efx->phy_op->get_module_info) |
| 1152 | return -EOPNOTSUPP; |
| 1153 | |
| 1154 | mutex_lock(&efx->mac_lock); |
| 1155 | ret = efx->phy_op->get_module_info(efx, modinfo); |
| 1156 | mutex_unlock(&efx->mac_lock); |
| 1157 | |
| 1158 | return ret; |
| 1159 | } |
| 1160 | |
Stephen Hemminger | 0fc0b73 | 2009-09-02 01:03:33 -0700 | [diff] [blame] | 1161 | const struct ethtool_ops efx_ethtool_ops = { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1162 | .get_settings = efx_ethtool_get_settings, |
| 1163 | .set_settings = efx_ethtool_set_settings, |
| 1164 | .get_drvinfo = efx_ethtool_get_drvinfo, |
Ben Hutchings | 5b98c1b | 2010-06-21 03:06:53 +0000 | [diff] [blame] | 1165 | .get_regs_len = efx_ethtool_get_regs_len, |
| 1166 | .get_regs = efx_ethtool_get_regs, |
Ben Hutchings | 62776d0 | 2010-06-23 11:30:07 +0000 | [diff] [blame] | 1167 | .get_msglevel = efx_ethtool_get_msglevel, |
| 1168 | .set_msglevel = efx_ethtool_set_msglevel, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1169 | .nway_reset = efx_ethtool_nway_reset, |
Ben Hutchings | ed4ba4b | 2010-12-09 12:10:25 +0000 | [diff] [blame] | 1170 | .get_link = ethtool_op_get_link, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1171 | .get_coalesce = efx_ethtool_get_coalesce, |
| 1172 | .set_coalesce = efx_ethtool_set_coalesce, |
Ben Hutchings | 4642610 | 2010-09-10 06:42:33 +0000 | [diff] [blame] | 1173 | .get_ringparam = efx_ethtool_get_ringparam, |
| 1174 | .set_ringparam = efx_ethtool_set_ringparam, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1175 | .get_pauseparam = efx_ethtool_get_pauseparam, |
| 1176 | .set_pauseparam = efx_ethtool_set_pauseparam, |
Ben Hutchings | 3594e13 | 2008-09-01 12:48:12 +0100 | [diff] [blame] | 1177 | .get_sset_count = efx_ethtool_get_sset_count, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 1178 | .self_test = efx_ethtool_self_test, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1179 | .get_strings = efx_ethtool_get_strings, |
Ben Hutchings | c5e129a | 2011-04-02 00:43:46 +0100 | [diff] [blame] | 1180 | .set_phys_id = efx_ethtool_phys_id, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1181 | .get_ethtool_stats = efx_ethtool_get_stats, |
Ben Hutchings | 89c758f | 2009-11-29 03:43:07 +0000 | [diff] [blame] | 1182 | .get_wol = efx_ethtool_get_wol, |
| 1183 | .set_wol = efx_ethtool_set_wol, |
Ben Hutchings | eb9f674 | 2009-11-29 03:43:15 +0000 | [diff] [blame] | 1184 | .reset = efx_ethtool_reset, |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1185 | .get_rxnfc = efx_ethtool_get_rxnfc, |
Ben Hutchings | b2bb7b7 | 2012-01-03 12:05:47 +0000 | [diff] [blame] | 1186 | .set_rxnfc = efx_ethtool_set_rxnfc, |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 1187 | .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, |
Ben Hutchings | 765c9f4 | 2010-06-30 05:06:28 +0000 | [diff] [blame] | 1188 | .get_rxfh_indir = efx_ethtool_get_rxfh_indir, |
| 1189 | .set_rxfh_indir = efx_ethtool_set_rxfh_indir, |
Ben Hutchings | 62ebac9 | 2013-04-08 17:34:58 +0100 | [diff] [blame] | 1190 | .get_ts_info = efx_ethtool_get_ts_info, |
Stuart Hodgson | c087bd2 | 2012-05-01 18:50:43 +0100 | [diff] [blame] | 1191 | .get_module_info = efx_ethtool_get_module_info, |
| 1192 | .get_module_eeprom = efx_ethtool_get_module_eeprom, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1193 | }; |