ethtool.c 32 KB

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