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