ethtool.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  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. * Fill in a block of loopback self-test entries. Return new test
  221. * index.
  222. */
  223. static int efx_fill_loopback_test(struct efx_nic *efx,
  224. struct efx_loopback_self_tests *lb_tests,
  225. enum efx_loopback_mode mode,
  226. unsigned int test_index,
  227. u8 *strings, u64 *data)
  228. {
  229. struct efx_channel *channel =
  230. efx_get_channel(efx, efx->tx_channel_offset);
  231. struct efx_tx_queue *tx_queue;
  232. efx_for_each_channel_tx_queue(tx_queue, channel) {
  233. efx_fill_test(test_index++, strings, data,
  234. &lb_tests->tx_sent[tx_queue->queue],
  235. EFX_TX_QUEUE_NAME(tx_queue),
  236. EFX_LOOPBACK_NAME(mode, "tx_sent"));
  237. efx_fill_test(test_index++, strings, data,
  238. &lb_tests->tx_done[tx_queue->queue],
  239. EFX_TX_QUEUE_NAME(tx_queue),
  240. EFX_LOOPBACK_NAME(mode, "tx_done"));
  241. }
  242. efx_fill_test(test_index++, strings, data,
  243. &lb_tests->rx_good,
  244. "rx", 0,
  245. EFX_LOOPBACK_NAME(mode, "rx_good"));
  246. efx_fill_test(test_index++, strings, data,
  247. &lb_tests->rx_bad,
  248. "rx", 0,
  249. EFX_LOOPBACK_NAME(mode, "rx_bad"));
  250. return test_index;
  251. }
  252. /**
  253. * efx_ethtool_fill_self_tests - get self-test details
  254. * @efx: Efx NIC
  255. * @tests: Efx self-test results structure, or %NULL
  256. * @strings: Ethtool strings, or %NULL
  257. * @data: Ethtool test results, or %NULL
  258. *
  259. * Get self-test number of strings, strings, and/or test results.
  260. * Return number of strings (== number of test results).
  261. *
  262. * The reason for merging these three functions is to make sure that
  263. * they can never be inconsistent.
  264. */
  265. static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
  266. struct efx_self_tests *tests,
  267. u8 *strings, u64 *data)
  268. {
  269. struct efx_channel *channel;
  270. unsigned int n = 0, i;
  271. enum efx_loopback_mode mode;
  272. efx_fill_test(n++, strings, data, &tests->phy_alive,
  273. "phy", 0, "alive", NULL);
  274. efx_fill_test(n++, strings, data, &tests->nvram,
  275. "core", 0, "nvram", NULL);
  276. efx_fill_test(n++, strings, data, &tests->interrupt,
  277. "core", 0, "interrupt", NULL);
  278. /* Event queues */
  279. efx_for_each_channel(channel, efx) {
  280. efx_fill_test(n++, strings, data,
  281. &tests->eventq_dma[channel->channel],
  282. EFX_CHANNEL_NAME(channel),
  283. "eventq.dma", NULL);
  284. efx_fill_test(n++, strings, data,
  285. &tests->eventq_int[channel->channel],
  286. EFX_CHANNEL_NAME(channel),
  287. "eventq.int", NULL);
  288. }
  289. efx_fill_test(n++, strings, data, &tests->memory,
  290. "core", 0, "memory", NULL);
  291. efx_fill_test(n++, strings, data, &tests->registers,
  292. "core", 0, "registers", NULL);
  293. if (efx->phy_op->run_tests != NULL) {
  294. EFX_BUG_ON_PARANOID(efx->phy_op->test_name == NULL);
  295. for (i = 0; true; ++i) {
  296. const char *name;
  297. EFX_BUG_ON_PARANOID(i >= EFX_MAX_PHY_TESTS);
  298. name = efx->phy_op->test_name(efx, i);
  299. if (name == NULL)
  300. break;
  301. efx_fill_test(n++, strings, data, &tests->phy_ext[i],
  302. "phy", 0, name, NULL);
  303. }
  304. }
  305. /* Loopback tests */
  306. for (mode = LOOPBACK_NONE; mode <= LOOPBACK_TEST_MAX; mode++) {
  307. if (!(efx->loopback_modes & (1 << mode)))
  308. continue;
  309. n = efx_fill_loopback_test(efx,
  310. &tests->loopback[mode], mode, n,
  311. strings, data);
  312. }
  313. return n;
  314. }
  315. static int efx_ethtool_get_sset_count(struct net_device *net_dev,
  316. int string_set)
  317. {
  318. struct efx_nic *efx = netdev_priv(net_dev);
  319. switch (string_set) {
  320. case ETH_SS_STATS:
  321. return efx->type->describe_stats(efx, NULL) +
  322. EFX_ETHTOOL_SW_STAT_COUNT +
  323. efx_ptp_describe_stats(efx, NULL);
  324. case ETH_SS_TEST:
  325. return efx_ethtool_fill_self_tests(efx, NULL, NULL, NULL);
  326. default:
  327. return -EINVAL;
  328. }
  329. }
  330. static void efx_ethtool_get_strings(struct net_device *net_dev,
  331. u32 string_set, u8 *strings)
  332. {
  333. struct efx_nic *efx = netdev_priv(net_dev);
  334. int i;
  335. switch (string_set) {
  336. case ETH_SS_STATS:
  337. strings += (efx->type->describe_stats(efx, strings) *
  338. ETH_GSTRING_LEN);
  339. for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
  340. strlcpy(strings + i * ETH_GSTRING_LEN,
  341. efx_sw_stat_desc[i].name, ETH_GSTRING_LEN);
  342. strings += EFX_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN;
  343. efx_ptp_describe_stats(efx, strings);
  344. break;
  345. case ETH_SS_TEST:
  346. efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
  347. break;
  348. default:
  349. /* No other string sets */
  350. break;
  351. }
  352. }
  353. static void efx_ethtool_get_stats(struct net_device *net_dev,
  354. struct ethtool_stats *stats,
  355. u64 *data)
  356. {
  357. struct efx_nic *efx = netdev_priv(net_dev);
  358. const struct efx_sw_stat_desc *stat;
  359. struct efx_channel *channel;
  360. struct efx_tx_queue *tx_queue;
  361. int i;
  362. spin_lock_bh(&efx->stats_lock);
  363. /* Get NIC statistics */
  364. data += efx->type->update_stats(efx, data, NULL);
  365. /* Get software statistics */
  366. for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++) {
  367. stat = &efx_sw_stat_desc[i];
  368. switch (stat->source) {
  369. case EFX_ETHTOOL_STAT_SOURCE_nic:
  370. data[i] = stat->get_stat((void *)efx + stat->offset);
  371. break;
  372. case EFX_ETHTOOL_STAT_SOURCE_channel:
  373. data[i] = 0;
  374. efx_for_each_channel(channel, efx)
  375. data[i] += stat->get_stat((void *)channel +
  376. stat->offset);
  377. break;
  378. case EFX_ETHTOOL_STAT_SOURCE_tx_queue:
  379. data[i] = 0;
  380. efx_for_each_channel(channel, efx) {
  381. efx_for_each_channel_tx_queue(tx_queue, channel)
  382. data[i] +=
  383. stat->get_stat((void *)tx_queue
  384. + stat->offset);
  385. }
  386. break;
  387. }
  388. }
  389. data += EFX_ETHTOOL_SW_STAT_COUNT;
  390. spin_unlock_bh(&efx->stats_lock);
  391. efx_ptp_update_stats(efx, data);
  392. }
  393. static void efx_ethtool_self_test(struct net_device *net_dev,
  394. struct ethtool_test *test, u64 *data)
  395. {
  396. struct efx_nic *efx = netdev_priv(net_dev);
  397. struct efx_self_tests *efx_tests;
  398. bool already_up;
  399. int rc = -ENOMEM;
  400. efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL);
  401. if (!efx_tests)
  402. goto fail;
  403. if (efx->state != STATE_READY) {
  404. rc = -EBUSY;
  405. goto out;
  406. }
  407. netif_info(efx, drv, efx->net_dev, "starting %sline testing\n",
  408. (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
  409. /* We need rx buffers and interrupts. */
  410. already_up = (efx->net_dev->flags & IFF_UP);
  411. if (!already_up) {
  412. rc = dev_open(efx->net_dev);
  413. if (rc) {
  414. netif_err(efx, drv, efx->net_dev,
  415. "failed opening device.\n");
  416. goto out;
  417. }
  418. }
  419. rc = efx_selftest(efx, efx_tests, test->flags);
  420. if (!already_up)
  421. dev_close(efx->net_dev);
  422. netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n",
  423. rc == 0 ? "passed" : "failed",
  424. (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
  425. out:
  426. efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data);
  427. kfree(efx_tests);
  428. fail:
  429. if (rc)
  430. test->flags |= ETH_TEST_FL_FAILED;
  431. }
  432. /* Restart autonegotiation */
  433. static int efx_ethtool_nway_reset(struct net_device *net_dev)
  434. {
  435. struct efx_nic *efx = netdev_priv(net_dev);
  436. return mdio45_nway_restart(&efx->mdio);
  437. }
  438. /*
  439. * Each channel has a single IRQ and moderation timer, started by any
  440. * completion (or other event). Unless the module parameter
  441. * separate_tx_channels is set, IRQs and moderation are therefore
  442. * shared between RX and TX completions. In this case, when RX IRQ
  443. * moderation is explicitly changed then TX IRQ moderation is
  444. * automatically changed too, but otherwise we fail if the two values
  445. * are requested to be different.
  446. *
  447. * The hardware does not support a limit on the number of completions
  448. * before an IRQ, so we do not use the max_frames fields. We should
  449. * report and require that max_frames == (usecs != 0), but this would
  450. * invalidate existing user documentation.
  451. *
  452. * The hardware does not have distinct settings for interrupt
  453. * moderation while the previous IRQ is being handled, so we should
  454. * not use the 'irq' fields. However, an earlier developer
  455. * misunderstood the meaning of the 'irq' fields and the driver did
  456. * not support the standard fields. To avoid invalidating existing
  457. * user documentation, we report and accept changes through either the
  458. * standard or 'irq' fields. If both are changed at the same time, we
  459. * prefer the standard field.
  460. *
  461. * We implement adaptive IRQ moderation, but use a different algorithm
  462. * from that assumed in the definition of struct ethtool_coalesce.
  463. * Therefore we do not use any of the adaptive moderation parameters
  464. * in it.
  465. */
  466. static int efx_ethtool_get_coalesce(struct net_device *net_dev,
  467. struct ethtool_coalesce *coalesce)
  468. {
  469. struct efx_nic *efx = netdev_priv(net_dev);
  470. unsigned int tx_usecs, rx_usecs;
  471. bool rx_adaptive;
  472. efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive);
  473. coalesce->tx_coalesce_usecs = tx_usecs;
  474. coalesce->tx_coalesce_usecs_irq = tx_usecs;
  475. coalesce->rx_coalesce_usecs = rx_usecs;
  476. coalesce->rx_coalesce_usecs_irq = rx_usecs;
  477. coalesce->use_adaptive_rx_coalesce = rx_adaptive;
  478. return 0;
  479. }
  480. static int efx_ethtool_set_coalesce(struct net_device *net_dev,
  481. struct ethtool_coalesce *coalesce)
  482. {
  483. struct efx_nic *efx = netdev_priv(net_dev);
  484. struct efx_channel *channel;
  485. unsigned int tx_usecs, rx_usecs;
  486. bool adaptive, rx_may_override_tx;
  487. int rc;
  488. if (coalesce->use_adaptive_tx_coalesce)
  489. return -EINVAL;
  490. efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive);
  491. if (coalesce->rx_coalesce_usecs != rx_usecs)
  492. rx_usecs = coalesce->rx_coalesce_usecs;
  493. else
  494. rx_usecs = coalesce->rx_coalesce_usecs_irq;
  495. adaptive = coalesce->use_adaptive_rx_coalesce;
  496. /* If channels are shared, TX IRQ moderation can be quietly
  497. * overridden unless it is changed from its old value.
  498. */
  499. rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs &&
  500. coalesce->tx_coalesce_usecs_irq == tx_usecs);
  501. if (coalesce->tx_coalesce_usecs != tx_usecs)
  502. tx_usecs = coalesce->tx_coalesce_usecs;
  503. else
  504. tx_usecs = coalesce->tx_coalesce_usecs_irq;
  505. rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive,
  506. rx_may_override_tx);
  507. if (rc != 0)
  508. return rc;
  509. efx_for_each_channel(channel, efx)
  510. efx->type->push_irq_moderation(channel);
  511. return 0;
  512. }
  513. static void efx_ethtool_get_ringparam(struct net_device *net_dev,
  514. struct ethtool_ringparam *ring)
  515. {
  516. struct efx_nic *efx = netdev_priv(net_dev);
  517. ring->rx_max_pending = EFX_MAX_DMAQ_SIZE;
  518. ring->tx_max_pending = EFX_TXQ_MAX_ENT(efx);
  519. ring->rx_pending = efx->rxq_entries;
  520. ring->tx_pending = efx->txq_entries;
  521. }
  522. static int efx_ethtool_set_ringparam(struct net_device *net_dev,
  523. struct ethtool_ringparam *ring)
  524. {
  525. struct efx_nic *efx = netdev_priv(net_dev);
  526. u32 txq_entries;
  527. if (ring->rx_mini_pending || ring->rx_jumbo_pending ||
  528. ring->rx_pending > EFX_MAX_DMAQ_SIZE ||
  529. ring->tx_pending > EFX_TXQ_MAX_ENT(efx))
  530. return -EINVAL;
  531. if (ring->rx_pending < EFX_RXQ_MIN_ENT) {
  532. netif_err(efx, drv, efx->net_dev,
  533. "RX queues cannot be smaller than %u\n",
  534. EFX_RXQ_MIN_ENT);
  535. return -EINVAL;
  536. }
  537. txq_entries = max(ring->tx_pending, EFX_TXQ_MIN_ENT(efx));
  538. if (txq_entries != ring->tx_pending)
  539. netif_warn(efx, drv, efx->net_dev,
  540. "increasing TX queue size to minimum of %u\n",
  541. txq_entries);
  542. return efx_realloc_channels(efx, ring->rx_pending, txq_entries);
  543. }
  544. static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
  545. struct ethtool_pauseparam *pause)
  546. {
  547. struct efx_nic *efx = netdev_priv(net_dev);
  548. u8 wanted_fc, old_fc;
  549. u32 old_adv;
  550. int rc = 0;
  551. mutex_lock(&efx->mac_lock);
  552. wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) |
  553. (pause->tx_pause ? EFX_FC_TX : 0) |
  554. (pause->autoneg ? EFX_FC_AUTO : 0));
  555. if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) {
  556. netif_dbg(efx, drv, efx->net_dev,
  557. "Flow control unsupported: tx ON rx OFF\n");
  558. rc = -EINVAL;
  559. goto out;
  560. }
  561. if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) {
  562. netif_dbg(efx, drv, efx->net_dev,
  563. "Autonegotiation is disabled\n");
  564. rc = -EINVAL;
  565. goto out;
  566. }
  567. /* Hook for Falcon bug 11482 workaround */
  568. if (efx->type->prepare_enable_fc_tx &&
  569. (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX))
  570. efx->type->prepare_enable_fc_tx(efx);
  571. old_adv = efx->link_advertising;
  572. old_fc = efx->wanted_fc;
  573. efx_link_set_wanted_fc(efx, wanted_fc);
  574. if (efx->link_advertising != old_adv ||
  575. (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) {
  576. rc = efx->phy_op->reconfigure(efx);
  577. if (rc) {
  578. netif_err(efx, drv, efx->net_dev,
  579. "Unable to advertise requested flow "
  580. "control setting\n");
  581. goto out;
  582. }
  583. }
  584. /* Reconfigure the MAC. The PHY *may* generate a link state change event
  585. * if the user just changed the advertised capabilities, but there's no
  586. * harm doing this twice */
  587. efx->type->reconfigure_mac(efx);
  588. out:
  589. mutex_unlock(&efx->mac_lock);
  590. return rc;
  591. }
  592. static void efx_ethtool_get_pauseparam(struct net_device *net_dev,
  593. struct ethtool_pauseparam *pause)
  594. {
  595. struct efx_nic *efx = netdev_priv(net_dev);
  596. pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX);
  597. pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX);
  598. pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO);
  599. }
  600. static void efx_ethtool_get_wol(struct net_device *net_dev,
  601. struct ethtool_wolinfo *wol)
  602. {
  603. struct efx_nic *efx = netdev_priv(net_dev);
  604. return efx->type->get_wol(efx, wol);
  605. }
  606. static int efx_ethtool_set_wol(struct net_device *net_dev,
  607. struct ethtool_wolinfo *wol)
  608. {
  609. struct efx_nic *efx = netdev_priv(net_dev);
  610. return efx->type->set_wol(efx, wol->wolopts);
  611. }
  612. static int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)
  613. {
  614. struct efx_nic *efx = netdev_priv(net_dev);
  615. int rc;
  616. rc = efx->type->map_reset_flags(flags);
  617. if (rc < 0)
  618. return rc;
  619. return efx_reset(efx, rc);
  620. }
  621. /* MAC address mask including only I/G bit */
  622. static const u8 mac_addr_ig_mask[ETH_ALEN] __aligned(2) = {0x01, 0, 0, 0, 0, 0};
  623. #define IP4_ADDR_FULL_MASK ((__force __be32)~0)
  624. #define PORT_FULL_MASK ((__force __be16)~0)
  625. #define ETHER_TYPE_FULL_MASK ((__force __be16)~0)
  626. static int efx_ethtool_get_class_rule(struct efx_nic *efx,
  627. struct ethtool_rx_flow_spec *rule)
  628. {
  629. struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec;
  630. struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec;
  631. struct ethhdr *mac_entry = &rule->h_u.ether_spec;
  632. struct ethhdr *mac_mask = &rule->m_u.ether_spec;
  633. struct efx_filter_spec spec;
  634. int rc;
  635. rc = efx_filter_get_filter_safe(efx, EFX_FILTER_PRI_MANUAL,
  636. rule->location, &spec);
  637. if (rc)
  638. return rc;
  639. if (spec.dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP)
  640. rule->ring_cookie = RX_CLS_FLOW_DISC;
  641. else
  642. rule->ring_cookie = spec.dmaq_id;
  643. if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) &&
  644. spec.ether_type == htons(ETH_P_IP) &&
  645. (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) &&
  646. (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) &&
  647. !(spec.match_flags &
  648. ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID |
  649. EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST |
  650. EFX_FILTER_MATCH_IP_PROTO |
  651. EFX_FILTER_MATCH_LOC_PORT | EFX_FILTER_MATCH_REM_PORT))) {
  652. rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ?
  653. TCP_V4_FLOW : UDP_V4_FLOW);
  654. if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) {
  655. ip_entry->ip4dst = spec.loc_host[0];
  656. ip_mask->ip4dst = IP4_ADDR_FULL_MASK;
  657. }
  658. if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) {
  659. ip_entry->ip4src = spec.rem_host[0];
  660. ip_mask->ip4src = IP4_ADDR_FULL_MASK;
  661. }
  662. if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) {
  663. ip_entry->pdst = spec.loc_port;
  664. ip_mask->pdst = PORT_FULL_MASK;
  665. }
  666. if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) {
  667. ip_entry->psrc = spec.rem_port;
  668. ip_mask->psrc = PORT_FULL_MASK;
  669. }
  670. } else if (!(spec.match_flags &
  671. ~(EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG |
  672. EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_ETHER_TYPE |
  673. EFX_FILTER_MATCH_OUTER_VID))) {
  674. rule->flow_type = ETHER_FLOW;
  675. if (spec.match_flags &
  676. (EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG)) {
  677. ether_addr_copy(mac_entry->h_dest, spec.loc_mac);
  678. if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC)
  679. eth_broadcast_addr(mac_mask->h_dest);
  680. else
  681. ether_addr_copy(mac_mask->h_dest,
  682. mac_addr_ig_mask);
  683. }
  684. if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) {
  685. ether_addr_copy(mac_entry->h_source, spec.rem_mac);
  686. eth_broadcast_addr(mac_mask->h_source);
  687. }
  688. if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) {
  689. mac_entry->h_proto = spec.ether_type;
  690. mac_mask->h_proto = ETHER_TYPE_FULL_MASK;
  691. }
  692. } else {
  693. /* The above should handle all filters that we insert */
  694. WARN_ON(1);
  695. return -EINVAL;
  696. }
  697. if (spec.match_flags & EFX_FILTER_MATCH_OUTER_VID) {
  698. rule->flow_type |= FLOW_EXT;
  699. rule->h_ext.vlan_tci = spec.outer_vid;
  700. rule->m_ext.vlan_tci = htons(0xfff);
  701. }
  702. return rc;
  703. }
  704. static int
  705. efx_ethtool_get_rxnfc(struct net_device *net_dev,
  706. struct ethtool_rxnfc *info, u32 *rule_locs)
  707. {
  708. struct efx_nic *efx = netdev_priv(net_dev);
  709. switch (info->cmd) {
  710. case ETHTOOL_GRXRINGS:
  711. info->data = efx->n_rx_channels;
  712. return 0;
  713. case ETHTOOL_GRXFH: {
  714. unsigned min_revision = 0;
  715. info->data = 0;
  716. switch (info->flow_type) {
  717. case TCP_V4_FLOW:
  718. info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  719. /* fall through */
  720. case UDP_V4_FLOW:
  721. case SCTP_V4_FLOW:
  722. case AH_ESP_V4_FLOW:
  723. case IPV4_FLOW:
  724. info->data |= RXH_IP_SRC | RXH_IP_DST;
  725. min_revision = EFX_REV_FALCON_B0;
  726. break;
  727. case TCP_V6_FLOW:
  728. info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  729. /* fall through */
  730. case UDP_V6_FLOW:
  731. case SCTP_V6_FLOW:
  732. case AH_ESP_V6_FLOW:
  733. case IPV6_FLOW:
  734. info->data |= RXH_IP_SRC | RXH_IP_DST;
  735. min_revision = EFX_REV_SIENA_A0;
  736. break;
  737. default:
  738. break;
  739. }
  740. if (efx_nic_rev(efx) < min_revision)
  741. info->data = 0;
  742. return 0;
  743. }
  744. case ETHTOOL_GRXCLSRLCNT:
  745. info->data = efx_filter_get_rx_id_limit(efx);
  746. if (info->data == 0)
  747. return -EOPNOTSUPP;
  748. info->data |= RX_CLS_LOC_SPECIAL;
  749. info->rule_cnt =
  750. efx_filter_count_rx_used(efx, EFX_FILTER_PRI_MANUAL);
  751. return 0;
  752. case ETHTOOL_GRXCLSRULE:
  753. if (efx_filter_get_rx_id_limit(efx) == 0)
  754. return -EOPNOTSUPP;
  755. return efx_ethtool_get_class_rule(efx, &info->fs);
  756. case ETHTOOL_GRXCLSRLALL: {
  757. s32 rc;
  758. info->data = efx_filter_get_rx_id_limit(efx);
  759. if (info->data == 0)
  760. return -EOPNOTSUPP;
  761. rc = efx_filter_get_rx_ids(efx, EFX_FILTER_PRI_MANUAL,
  762. rule_locs, info->rule_cnt);
  763. if (rc < 0)
  764. return rc;
  765. info->rule_cnt = rc;
  766. return 0;
  767. }
  768. default:
  769. return -EOPNOTSUPP;
  770. }
  771. }
  772. static int efx_ethtool_set_class_rule(struct efx_nic *efx,
  773. struct ethtool_rx_flow_spec *rule)
  774. {
  775. struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec;
  776. struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec;
  777. struct ethhdr *mac_entry = &rule->h_u.ether_spec;
  778. struct ethhdr *mac_mask = &rule->m_u.ether_spec;
  779. struct efx_filter_spec spec;
  780. int rc;
  781. /* Check that user wants us to choose the location */
  782. if (rule->location != RX_CLS_LOC_ANY)
  783. return -EINVAL;
  784. /* Range-check ring_cookie */
  785. if (rule->ring_cookie >= efx->n_rx_channels &&
  786. rule->ring_cookie != RX_CLS_FLOW_DISC)
  787. return -EINVAL;
  788. /* Check for unsupported extensions */
  789. if ((rule->flow_type & FLOW_EXT) &&
  790. (rule->m_ext.vlan_etype || rule->m_ext.data[0] ||
  791. rule->m_ext.data[1]))
  792. return -EINVAL;
  793. efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL,
  794. efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0,
  795. (rule->ring_cookie == RX_CLS_FLOW_DISC) ?
  796. EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie);
  797. switch (rule->flow_type & ~FLOW_EXT) {
  798. case TCP_V4_FLOW:
  799. case UDP_V4_FLOW:
  800. spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE |
  801. EFX_FILTER_MATCH_IP_PROTO);
  802. spec.ether_type = htons(ETH_P_IP);
  803. spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V4_FLOW ?
  804. IPPROTO_TCP : IPPROTO_UDP);
  805. if (ip_mask->ip4dst) {
  806. if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK)
  807. return -EINVAL;
  808. spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST;
  809. spec.loc_host[0] = ip_entry->ip4dst;
  810. }
  811. if (ip_mask->ip4src) {
  812. if (ip_mask->ip4src != IP4_ADDR_FULL_MASK)
  813. return -EINVAL;
  814. spec.match_flags |= EFX_FILTER_MATCH_REM_HOST;
  815. spec.rem_host[0] = ip_entry->ip4src;
  816. }
  817. if (ip_mask->pdst) {
  818. if (ip_mask->pdst != PORT_FULL_MASK)
  819. return -EINVAL;
  820. spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT;
  821. spec.loc_port = ip_entry->pdst;
  822. }
  823. if (ip_mask->psrc) {
  824. if (ip_mask->psrc != PORT_FULL_MASK)
  825. return -EINVAL;
  826. spec.match_flags |= EFX_FILTER_MATCH_REM_PORT;
  827. spec.rem_port = ip_entry->psrc;
  828. }
  829. if (ip_mask->tos)
  830. return -EINVAL;
  831. break;
  832. case ETHER_FLOW:
  833. if (!is_zero_ether_addr(mac_mask->h_dest)) {
  834. if (ether_addr_equal(mac_mask->h_dest,
  835. mac_addr_ig_mask))
  836. spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG;
  837. else if (is_broadcast_ether_addr(mac_mask->h_dest))
  838. spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC;
  839. else
  840. return -EINVAL;
  841. ether_addr_copy(spec.loc_mac, mac_entry->h_dest);
  842. }
  843. if (!is_zero_ether_addr(mac_mask->h_source)) {
  844. if (!is_broadcast_ether_addr(mac_mask->h_source))
  845. return -EINVAL;
  846. spec.match_flags |= EFX_FILTER_MATCH_REM_MAC;
  847. ether_addr_copy(spec.rem_mac, mac_entry->h_source);
  848. }
  849. if (mac_mask->h_proto) {
  850. if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK)
  851. return -EINVAL;
  852. spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE;
  853. spec.ether_type = mac_entry->h_proto;
  854. }
  855. break;
  856. default:
  857. return -EINVAL;
  858. }
  859. if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) {
  860. if (rule->m_ext.vlan_tci != htons(0xfff))
  861. return -EINVAL;
  862. spec.match_flags |= EFX_FILTER_MATCH_OUTER_VID;
  863. spec.outer_vid = rule->h_ext.vlan_tci;
  864. }
  865. rc = efx_filter_insert_filter(efx, &spec, true);
  866. if (rc < 0)
  867. return rc;
  868. rule->location = rc;
  869. return 0;
  870. }
  871. static int efx_ethtool_set_rxnfc(struct net_device *net_dev,
  872. struct ethtool_rxnfc *info)
  873. {
  874. struct efx_nic *efx = netdev_priv(net_dev);
  875. if (efx_filter_get_rx_id_limit(efx) == 0)
  876. return -EOPNOTSUPP;
  877. switch (info->cmd) {
  878. case ETHTOOL_SRXCLSRLINS:
  879. return efx_ethtool_set_class_rule(efx, &info->fs);
  880. case ETHTOOL_SRXCLSRLDEL:
  881. return efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_MANUAL,
  882. info->fs.location);
  883. default:
  884. return -EOPNOTSUPP;
  885. }
  886. }
  887. static u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev)
  888. {
  889. struct efx_nic *efx = netdev_priv(net_dev);
  890. return ((efx_nic_rev(efx) < EFX_REV_FALCON_B0 ||
  891. efx->n_rx_channels == 1) ?
  892. 0 : ARRAY_SIZE(efx->rx_indir_table));
  893. }
  894. static int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key)
  895. {
  896. struct efx_nic *efx = netdev_priv(net_dev);
  897. memcpy(indir, efx->rx_indir_table, sizeof(efx->rx_indir_table));
  898. return 0;
  899. }
  900. static int efx_ethtool_set_rxfh(struct net_device *net_dev,
  901. const u32 *indir, const u8 *key)
  902. {
  903. struct efx_nic *efx = netdev_priv(net_dev);
  904. memcpy(efx->rx_indir_table, indir, sizeof(efx->rx_indir_table));
  905. efx->type->rx_push_rss_config(efx);
  906. return 0;
  907. }
  908. static int efx_ethtool_get_ts_info(struct net_device *net_dev,
  909. struct ethtool_ts_info *ts_info)
  910. {
  911. struct efx_nic *efx = netdev_priv(net_dev);
  912. /* Software capabilities */
  913. ts_info->so_timestamping = (SOF_TIMESTAMPING_RX_SOFTWARE |
  914. SOF_TIMESTAMPING_SOFTWARE);
  915. ts_info->phc_index = -1;
  916. efx_ptp_get_ts_info(efx, ts_info);
  917. return 0;
  918. }
  919. static int efx_ethtool_get_module_eeprom(struct net_device *net_dev,
  920. struct ethtool_eeprom *ee,
  921. u8 *data)
  922. {
  923. struct efx_nic *efx = netdev_priv(net_dev);
  924. int ret;
  925. if (!efx->phy_op || !efx->phy_op->get_module_eeprom)
  926. return -EOPNOTSUPP;
  927. mutex_lock(&efx->mac_lock);
  928. ret = efx->phy_op->get_module_eeprom(efx, ee, data);
  929. mutex_unlock(&efx->mac_lock);
  930. return ret;
  931. }
  932. static int efx_ethtool_get_module_info(struct net_device *net_dev,
  933. struct ethtool_modinfo *modinfo)
  934. {
  935. struct efx_nic *efx = netdev_priv(net_dev);
  936. int ret;
  937. if (!efx->phy_op || !efx->phy_op->get_module_info)
  938. return -EOPNOTSUPP;
  939. mutex_lock(&efx->mac_lock);
  940. ret = efx->phy_op->get_module_info(efx, modinfo);
  941. mutex_unlock(&efx->mac_lock);
  942. return ret;
  943. }
  944. const struct ethtool_ops efx_ethtool_ops = {
  945. .get_settings = efx_ethtool_get_settings,
  946. .set_settings = efx_ethtool_set_settings,
  947. .get_drvinfo = efx_ethtool_get_drvinfo,
  948. .get_regs_len = efx_ethtool_get_regs_len,
  949. .get_regs = efx_ethtool_get_regs,
  950. .get_msglevel = efx_ethtool_get_msglevel,
  951. .set_msglevel = efx_ethtool_set_msglevel,
  952. .nway_reset = efx_ethtool_nway_reset,
  953. .get_link = ethtool_op_get_link,
  954. .get_coalesce = efx_ethtool_get_coalesce,
  955. .set_coalesce = efx_ethtool_set_coalesce,
  956. .get_ringparam = efx_ethtool_get_ringparam,
  957. .set_ringparam = efx_ethtool_set_ringparam,
  958. .get_pauseparam = efx_ethtool_get_pauseparam,
  959. .set_pauseparam = efx_ethtool_set_pauseparam,
  960. .get_sset_count = efx_ethtool_get_sset_count,
  961. .self_test = efx_ethtool_self_test,
  962. .get_strings = efx_ethtool_get_strings,
  963. .set_phys_id = efx_ethtool_phys_id,
  964. .get_ethtool_stats = efx_ethtool_get_stats,
  965. .get_wol = efx_ethtool_get_wol,
  966. .set_wol = efx_ethtool_set_wol,
  967. .reset = efx_ethtool_reset,
  968. .get_rxnfc = efx_ethtool_get_rxnfc,
  969. .set_rxnfc = efx_ethtool_set_rxnfc,
  970. .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
  971. .get_rxfh = efx_ethtool_get_rxfh,
  972. .set_rxfh = efx_ethtool_set_rxfh,
  973. .get_ts_info = efx_ethtool_get_ts_info,
  974. .get_module_info = efx_ethtool_get_module_info,
  975. .get_module_eeprom = efx_ethtool_get_module_eeprom,
  976. };