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