be_ethtool.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176
  1. /*
  2. * Copyright (C) 2005 - 2013 Emulex
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation. The full GNU General
  8. * Public License is included in this distribution in the file called COPYING.
  9. *
  10. * Contact Information:
  11. * linux-drivers@emulex.com
  12. *
  13. * Emulex
  14. * 3333 Susan Street
  15. * Costa Mesa, CA 92626
  16. */
  17. #include "be.h"
  18. #include "be_cmds.h"
  19. #include <linux/ethtool.h>
  20. struct be_ethtool_stat {
  21. char desc[ETH_GSTRING_LEN];
  22. int type;
  23. int size;
  24. int offset;
  25. };
  26. enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT};
  27. #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
  28. offsetof(_struct, field)
  29. #define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\
  30. FIELDINFO(struct be_tx_stats, field)
  31. #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\
  32. FIELDINFO(struct be_rx_stats, field)
  33. #define DRVSTAT_INFO(field) #field, DRVSTAT,\
  34. FIELDINFO(struct be_drv_stats, field)
  35. static const struct be_ethtool_stat et_stats[] = {
  36. {DRVSTAT_INFO(rx_crc_errors)},
  37. {DRVSTAT_INFO(rx_alignment_symbol_errors)},
  38. {DRVSTAT_INFO(rx_pause_frames)},
  39. {DRVSTAT_INFO(rx_control_frames)},
  40. /* Received packets dropped when the Ethernet length field
  41. * is not equal to the actual Ethernet data length.
  42. */
  43. {DRVSTAT_INFO(rx_in_range_errors)},
  44. /* Received packets dropped when their length field is >= 1501 bytes
  45. * and <= 1535 bytes.
  46. */
  47. {DRVSTAT_INFO(rx_out_range_errors)},
  48. /* Received packets dropped when they are longer than 9216 bytes */
  49. {DRVSTAT_INFO(rx_frame_too_long)},
  50. /* Received packets dropped when they don't pass the unicast or
  51. * multicast address filtering.
  52. */
  53. {DRVSTAT_INFO(rx_address_filtered)},
  54. /* Received packets dropped when IP packet length field is less than
  55. * the IP header length field.
  56. */
  57. {DRVSTAT_INFO(rx_dropped_too_small)},
  58. /* Received packets dropped when IP length field is greater than
  59. * the actual packet length.
  60. */
  61. {DRVSTAT_INFO(rx_dropped_too_short)},
  62. /* Received packets dropped when the IP header length field is less
  63. * than 5.
  64. */
  65. {DRVSTAT_INFO(rx_dropped_header_too_small)},
  66. /* Received packets dropped when the TCP header length field is less
  67. * than 5 or the TCP header length + IP header length is more
  68. * than IP packet length.
  69. */
  70. {DRVSTAT_INFO(rx_dropped_tcp_length)},
  71. {DRVSTAT_INFO(rx_dropped_runt)},
  72. /* Number of received packets dropped when a fifo for descriptors going
  73. * into the packet demux block overflows. In normal operation, this
  74. * fifo must never overflow.
  75. */
  76. {DRVSTAT_INFO(rxpp_fifo_overflow_drop)},
  77. {DRVSTAT_INFO(rx_input_fifo_overflow_drop)},
  78. {DRVSTAT_INFO(rx_ip_checksum_errs)},
  79. {DRVSTAT_INFO(rx_tcp_checksum_errs)},
  80. {DRVSTAT_INFO(rx_udp_checksum_errs)},
  81. {DRVSTAT_INFO(tx_pauseframes)},
  82. {DRVSTAT_INFO(tx_controlframes)},
  83. {DRVSTAT_INFO(rx_priority_pause_frames)},
  84. {DRVSTAT_INFO(tx_priority_pauseframes)},
  85. /* Received packets dropped when an internal fifo going into
  86. * main packet buffer tank (PMEM) overflows.
  87. */
  88. {DRVSTAT_INFO(pmem_fifo_overflow_drop)},
  89. {DRVSTAT_INFO(jabber_events)},
  90. /* Received packets dropped due to lack of available HW packet buffers
  91. * used to temporarily hold the received packets.
  92. */
  93. {DRVSTAT_INFO(rx_drops_no_pbuf)},
  94. /* Received packets dropped due to input receive buffer
  95. * descriptor fifo overflowing.
  96. */
  97. {DRVSTAT_INFO(rx_drops_no_erx_descr)},
  98. /* Packets dropped because the internal FIFO to the offloaded TCP
  99. * receive processing block is full. This could happen only for
  100. * offloaded iSCSI or FCoE trarffic.
  101. */
  102. {DRVSTAT_INFO(rx_drops_no_tpre_descr)},
  103. /* Received packets dropped when they need more than 8
  104. * receive buffers. This cannot happen as the driver configures
  105. * 2048 byte receive buffers.
  106. */
  107. {DRVSTAT_INFO(rx_drops_too_many_frags)},
  108. {DRVSTAT_INFO(forwarded_packets)},
  109. /* Received packets dropped when the frame length
  110. * is more than 9018 bytes
  111. */
  112. {DRVSTAT_INFO(rx_drops_mtu)},
  113. /* Number of packets dropped due to random early drop function */
  114. {DRVSTAT_INFO(eth_red_drops)},
  115. {DRVSTAT_INFO(be_on_die_temperature)}
  116. };
  117. #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
  118. /* Stats related to multi RX queues: get_stats routine assumes bytes, pkts
  119. * are first and second members respectively.
  120. */
  121. static const struct be_ethtool_stat et_rx_stats[] = {
  122. {DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */
  123. {DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */
  124. {DRVSTAT_RX_INFO(rx_compl)},
  125. {DRVSTAT_RX_INFO(rx_mcast_pkts)},
  126. /* Number of page allocation failures while posting receive buffers
  127. * to HW.
  128. */
  129. {DRVSTAT_RX_INFO(rx_post_fail)},
  130. /* Recevied packets dropped due to skb allocation failure */
  131. {DRVSTAT_RX_INFO(rx_drops_no_skbs)},
  132. /* Received packets dropped due to lack of available fetched buffers
  133. * posted by the driver.
  134. */
  135. {DRVSTAT_RX_INFO(rx_drops_no_frags)}
  136. };
  137. #define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
  138. /* Stats related to multi TX queues: get_stats routine assumes compl is the
  139. * first member
  140. */
  141. static const struct be_ethtool_stat et_tx_stats[] = {
  142. {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */
  143. {DRVSTAT_TX_INFO(tx_bytes)},
  144. {DRVSTAT_TX_INFO(tx_pkts)},
  145. /* Number of skbs queued for trasmission by the driver */
  146. {DRVSTAT_TX_INFO(tx_reqs)},
  147. /* Number of TX work request blocks DMAed to HW */
  148. {DRVSTAT_TX_INFO(tx_wrbs)},
  149. /* Number of times the TX queue was stopped due to lack
  150. * of spaces in the TXQ.
  151. */
  152. {DRVSTAT_TX_INFO(tx_stops)}
  153. };
  154. #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats))
  155. static const char et_self_tests[][ETH_GSTRING_LEN] = {
  156. "MAC Loopback test",
  157. "PHY Loopback test",
  158. "External Loopback test",
  159. "DDR DMA test",
  160. "Link test"
  161. };
  162. #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
  163. #define BE_MAC_LOOPBACK 0x0
  164. #define BE_PHY_LOOPBACK 0x1
  165. #define BE_ONE_PORT_EXT_LOOPBACK 0x2
  166. #define BE_NO_LOOPBACK 0xff
  167. static void be_get_drvinfo(struct net_device *netdev,
  168. struct ethtool_drvinfo *drvinfo)
  169. {
  170. struct be_adapter *adapter = netdev_priv(netdev);
  171. strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
  172. strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
  173. if (!memcmp(adapter->fw_ver, adapter->fw_on_flash, FW_VER_LEN))
  174. strlcpy(drvinfo->fw_version, adapter->fw_ver,
  175. sizeof(drvinfo->fw_version));
  176. else
  177. snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
  178. "%s [%s]", adapter->fw_ver, adapter->fw_on_flash);
  179. strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
  180. sizeof(drvinfo->bus_info));
  181. drvinfo->testinfo_len = 0;
  182. drvinfo->regdump_len = 0;
  183. drvinfo->eedump_len = 0;
  184. }
  185. static u32
  186. lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
  187. {
  188. u32 data_read = 0, eof;
  189. u8 addn_status;
  190. struct be_dma_mem data_len_cmd;
  191. int status;
  192. memset(&data_len_cmd, 0, sizeof(data_len_cmd));
  193. /* data_offset and data_size should be 0 to get reg len */
  194. status = lancer_cmd_read_object(adapter, &data_len_cmd, 0, 0,
  195. file_name, &data_read, &eof, &addn_status);
  196. return data_read;
  197. }
  198. static int
  199. lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
  200. u32 buf_len, void *buf)
  201. {
  202. struct be_dma_mem read_cmd;
  203. u32 read_len = 0, total_read_len = 0, chunk_size;
  204. u32 eof = 0;
  205. u8 addn_status;
  206. int status = 0;
  207. read_cmd.size = LANCER_READ_FILE_CHUNK;
  208. read_cmd.va = pci_alloc_consistent(adapter->pdev, read_cmd.size,
  209. &read_cmd.dma);
  210. if (!read_cmd.va) {
  211. dev_err(&adapter->pdev->dev,
  212. "Memory allocation failure while reading dump\n");
  213. return -ENOMEM;
  214. }
  215. while ((total_read_len < buf_len) && !eof) {
  216. chunk_size = min_t(u32, (buf_len - total_read_len),
  217. LANCER_READ_FILE_CHUNK);
  218. chunk_size = ALIGN(chunk_size, 4);
  219. status = lancer_cmd_read_object(adapter, &read_cmd, chunk_size,
  220. total_read_len, file_name, &read_len,
  221. &eof, &addn_status);
  222. if (!status) {
  223. memcpy(buf + total_read_len, read_cmd.va, read_len);
  224. total_read_len += read_len;
  225. eof &= LANCER_READ_FILE_EOF_MASK;
  226. } else {
  227. status = -EIO;
  228. break;
  229. }
  230. }
  231. pci_free_consistent(adapter->pdev, read_cmd.size, read_cmd.va,
  232. read_cmd.dma);
  233. return status;
  234. }
  235. static int
  236. be_get_reg_len(struct net_device *netdev)
  237. {
  238. struct be_adapter *adapter = netdev_priv(netdev);
  239. u32 log_size = 0;
  240. if (!check_privilege(adapter, MAX_PRIVILEGES))
  241. return 0;
  242. if (be_physfn(adapter)) {
  243. if (lancer_chip(adapter))
  244. log_size = lancer_cmd_get_file_len(adapter,
  245. LANCER_FW_DUMP_FILE);
  246. else
  247. be_cmd_get_reg_len(adapter, &log_size);
  248. }
  249. return log_size;
  250. }
  251. static void
  252. be_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *buf)
  253. {
  254. struct be_adapter *adapter = netdev_priv(netdev);
  255. if (be_physfn(adapter)) {
  256. memset(buf, 0, regs->len);
  257. if (lancer_chip(adapter))
  258. lancer_cmd_read_file(adapter, LANCER_FW_DUMP_FILE,
  259. regs->len, buf);
  260. else
  261. be_cmd_get_regs(adapter, regs->len, buf);
  262. }
  263. }
  264. static int be_get_coalesce(struct net_device *netdev,
  265. struct ethtool_coalesce *et)
  266. {
  267. struct be_adapter *adapter = netdev_priv(netdev);
  268. struct be_aic_obj *aic = &adapter->aic_obj[0];
  269. et->rx_coalesce_usecs = aic->prev_eqd;
  270. et->rx_coalesce_usecs_high = aic->max_eqd;
  271. et->rx_coalesce_usecs_low = aic->min_eqd;
  272. et->tx_coalesce_usecs = aic->prev_eqd;
  273. et->tx_coalesce_usecs_high = aic->max_eqd;
  274. et->tx_coalesce_usecs_low = aic->min_eqd;
  275. et->use_adaptive_rx_coalesce = aic->enable;
  276. et->use_adaptive_tx_coalesce = aic->enable;
  277. return 0;
  278. }
  279. /* TX attributes are ignored. Only RX attributes are considered
  280. * eqd cmd is issued in the worker thread.
  281. */
  282. static int be_set_coalesce(struct net_device *netdev,
  283. struct ethtool_coalesce *et)
  284. {
  285. struct be_adapter *adapter = netdev_priv(netdev);
  286. struct be_aic_obj *aic = &adapter->aic_obj[0];
  287. struct be_eq_obj *eqo;
  288. int i;
  289. for_all_evt_queues(adapter, eqo, i) {
  290. aic->enable = et->use_adaptive_rx_coalesce;
  291. aic->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD);
  292. aic->min_eqd = min(et->rx_coalesce_usecs_low, aic->max_eqd);
  293. aic->et_eqd = min(et->rx_coalesce_usecs, aic->max_eqd);
  294. aic->et_eqd = max(aic->et_eqd, aic->min_eqd);
  295. aic++;
  296. }
  297. return 0;
  298. }
  299. static void
  300. be_get_ethtool_stats(struct net_device *netdev,
  301. struct ethtool_stats *stats, uint64_t *data)
  302. {
  303. struct be_adapter *adapter = netdev_priv(netdev);
  304. struct be_rx_obj *rxo;
  305. struct be_tx_obj *txo;
  306. void *p;
  307. unsigned int i, j, base = 0, start;
  308. for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
  309. p = (u8 *)&adapter->drv_stats + et_stats[i].offset;
  310. data[i] = *(u32 *)p;
  311. }
  312. base += ETHTOOL_STATS_NUM;
  313. for_all_rx_queues(adapter, rxo, j) {
  314. struct be_rx_stats *stats = rx_stats(rxo);
  315. do {
  316. start = u64_stats_fetch_begin_bh(&stats->sync);
  317. data[base] = stats->rx_bytes;
  318. data[base + 1] = stats->rx_pkts;
  319. } while (u64_stats_fetch_retry_bh(&stats->sync, start));
  320. for (i = 2; i < ETHTOOL_RXSTATS_NUM; i++) {
  321. p = (u8 *)stats + et_rx_stats[i].offset;
  322. data[base + i] = *(u32 *)p;
  323. }
  324. base += ETHTOOL_RXSTATS_NUM;
  325. }
  326. for_all_tx_queues(adapter, txo, j) {
  327. struct be_tx_stats *stats = tx_stats(txo);
  328. do {
  329. start = u64_stats_fetch_begin_bh(&stats->sync_compl);
  330. data[base] = stats->tx_compl;
  331. } while (u64_stats_fetch_retry_bh(&stats->sync_compl, start));
  332. do {
  333. start = u64_stats_fetch_begin_bh(&stats->sync);
  334. for (i = 1; i < ETHTOOL_TXSTATS_NUM; i++) {
  335. p = (u8 *)stats + et_tx_stats[i].offset;
  336. data[base + i] =
  337. (et_tx_stats[i].size == sizeof(u64)) ?
  338. *(u64 *)p : *(u32 *)p;
  339. }
  340. } while (u64_stats_fetch_retry_bh(&stats->sync, start));
  341. base += ETHTOOL_TXSTATS_NUM;
  342. }
  343. }
  344. static void
  345. be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
  346. uint8_t *data)
  347. {
  348. struct be_adapter *adapter = netdev_priv(netdev);
  349. int i, j;
  350. switch (stringset) {
  351. case ETH_SS_STATS:
  352. for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
  353. memcpy(data, et_stats[i].desc, ETH_GSTRING_LEN);
  354. data += ETH_GSTRING_LEN;
  355. }
  356. for (i = 0; i < adapter->num_rx_qs; i++) {
  357. for (j = 0; j < ETHTOOL_RXSTATS_NUM; j++) {
  358. sprintf(data, "rxq%d: %s", i,
  359. et_rx_stats[j].desc);
  360. data += ETH_GSTRING_LEN;
  361. }
  362. }
  363. for (i = 0; i < adapter->num_tx_qs; i++) {
  364. for (j = 0; j < ETHTOOL_TXSTATS_NUM; j++) {
  365. sprintf(data, "txq%d: %s", i,
  366. et_tx_stats[j].desc);
  367. data += ETH_GSTRING_LEN;
  368. }
  369. }
  370. break;
  371. case ETH_SS_TEST:
  372. for (i = 0; i < ETHTOOL_TESTS_NUM; i++) {
  373. memcpy(data, et_self_tests[i], ETH_GSTRING_LEN);
  374. data += ETH_GSTRING_LEN;
  375. }
  376. break;
  377. }
  378. }
  379. static int be_get_sset_count(struct net_device *netdev, int stringset)
  380. {
  381. struct be_adapter *adapter = netdev_priv(netdev);
  382. switch (stringset) {
  383. case ETH_SS_TEST:
  384. return ETHTOOL_TESTS_NUM;
  385. case ETH_SS_STATS:
  386. return ETHTOOL_STATS_NUM +
  387. adapter->num_rx_qs * ETHTOOL_RXSTATS_NUM +
  388. adapter->num_tx_qs * ETHTOOL_TXSTATS_NUM;
  389. default:
  390. return -EINVAL;
  391. }
  392. }
  393. static u32 be_get_port_type(u32 phy_type, u32 dac_cable_len)
  394. {
  395. u32 port;
  396. switch (phy_type) {
  397. case PHY_TYPE_BASET_1GB:
  398. case PHY_TYPE_BASEX_1GB:
  399. case PHY_TYPE_SGMII:
  400. port = PORT_TP;
  401. break;
  402. case PHY_TYPE_SFP_PLUS_10GB:
  403. port = dac_cable_len ? PORT_DA : PORT_FIBRE;
  404. break;
  405. case PHY_TYPE_XFP_10GB:
  406. case PHY_TYPE_SFP_1GB:
  407. port = PORT_FIBRE;
  408. break;
  409. case PHY_TYPE_BASET_10GB:
  410. port = PORT_TP;
  411. break;
  412. default:
  413. port = PORT_OTHER;
  414. }
  415. return port;
  416. }
  417. static u32 convert_to_et_setting(u32 if_type, u32 if_speeds)
  418. {
  419. u32 val = 0;
  420. switch (if_type) {
  421. case PHY_TYPE_BASET_1GB:
  422. case PHY_TYPE_BASEX_1GB:
  423. case PHY_TYPE_SGMII:
  424. val |= SUPPORTED_TP;
  425. if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
  426. val |= SUPPORTED_1000baseT_Full;
  427. if (if_speeds & BE_SUPPORTED_SPEED_100MBPS)
  428. val |= SUPPORTED_100baseT_Full;
  429. if (if_speeds & BE_SUPPORTED_SPEED_10MBPS)
  430. val |= SUPPORTED_10baseT_Full;
  431. break;
  432. case PHY_TYPE_KX4_10GB:
  433. val |= SUPPORTED_Backplane;
  434. if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
  435. val |= SUPPORTED_1000baseKX_Full;
  436. if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
  437. val |= SUPPORTED_10000baseKX4_Full;
  438. break;
  439. case PHY_TYPE_KR_10GB:
  440. val |= SUPPORTED_Backplane |
  441. SUPPORTED_10000baseKR_Full;
  442. break;
  443. case PHY_TYPE_SFP_PLUS_10GB:
  444. case PHY_TYPE_XFP_10GB:
  445. case PHY_TYPE_SFP_1GB:
  446. val |= SUPPORTED_FIBRE;
  447. if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
  448. val |= SUPPORTED_10000baseT_Full;
  449. if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
  450. val |= SUPPORTED_1000baseT_Full;
  451. break;
  452. case PHY_TYPE_BASET_10GB:
  453. val |= SUPPORTED_TP;
  454. if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
  455. val |= SUPPORTED_10000baseT_Full;
  456. if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
  457. val |= SUPPORTED_1000baseT_Full;
  458. if (if_speeds & BE_SUPPORTED_SPEED_100MBPS)
  459. val |= SUPPORTED_100baseT_Full;
  460. break;
  461. default:
  462. val |= SUPPORTED_TP;
  463. }
  464. return val;
  465. }
  466. bool be_pause_supported(struct be_adapter *adapter)
  467. {
  468. return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB ||
  469. adapter->phy.interface_type == PHY_TYPE_XFP_10GB) ?
  470. false : true;
  471. }
  472. static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
  473. {
  474. struct be_adapter *adapter = netdev_priv(netdev);
  475. u8 link_status;
  476. u16 link_speed = 0;
  477. int status;
  478. u32 auto_speeds;
  479. u32 fixed_speeds;
  480. u32 dac_cable_len;
  481. u16 interface_type;
  482. if (adapter->phy.link_speed < 0) {
  483. status = be_cmd_link_status_query(adapter, &link_speed,
  484. &link_status, 0);
  485. if (!status)
  486. be_link_status_update(adapter, link_status);
  487. ethtool_cmd_speed_set(ecmd, link_speed);
  488. status = be_cmd_get_phy_info(adapter);
  489. if (!status) {
  490. interface_type = adapter->phy.interface_type;
  491. auto_speeds = adapter->phy.auto_speeds_supported;
  492. fixed_speeds = adapter->phy.fixed_speeds_supported;
  493. dac_cable_len = adapter->phy.dac_cable_len;
  494. ecmd->supported =
  495. convert_to_et_setting(interface_type,
  496. auto_speeds |
  497. fixed_speeds);
  498. ecmd->advertising =
  499. convert_to_et_setting(interface_type,
  500. auto_speeds);
  501. ecmd->port = be_get_port_type(interface_type,
  502. dac_cable_len);
  503. if (adapter->phy.auto_speeds_supported) {
  504. ecmd->supported |= SUPPORTED_Autoneg;
  505. ecmd->autoneg = AUTONEG_ENABLE;
  506. ecmd->advertising |= ADVERTISED_Autoneg;
  507. }
  508. ecmd->supported |= SUPPORTED_Pause;
  509. if (be_pause_supported(adapter))
  510. ecmd->advertising |= ADVERTISED_Pause;
  511. switch (adapter->phy.interface_type) {
  512. case PHY_TYPE_KR_10GB:
  513. case PHY_TYPE_KX4_10GB:
  514. ecmd->transceiver = XCVR_INTERNAL;
  515. break;
  516. default:
  517. ecmd->transceiver = XCVR_EXTERNAL;
  518. break;
  519. }
  520. } else {
  521. ecmd->port = PORT_OTHER;
  522. ecmd->autoneg = AUTONEG_DISABLE;
  523. ecmd->transceiver = XCVR_DUMMY1;
  524. }
  525. /* Save for future use */
  526. adapter->phy.link_speed = ethtool_cmd_speed(ecmd);
  527. adapter->phy.port_type = ecmd->port;
  528. adapter->phy.transceiver = ecmd->transceiver;
  529. adapter->phy.autoneg = ecmd->autoneg;
  530. adapter->phy.advertising = ecmd->advertising;
  531. adapter->phy.supported = ecmd->supported;
  532. } else {
  533. ethtool_cmd_speed_set(ecmd, adapter->phy.link_speed);
  534. ecmd->port = adapter->phy.port_type;
  535. ecmd->transceiver = adapter->phy.transceiver;
  536. ecmd->autoneg = adapter->phy.autoneg;
  537. ecmd->advertising = adapter->phy.advertising;
  538. ecmd->supported = adapter->phy.supported;
  539. }
  540. ecmd->duplex = netif_carrier_ok(netdev) ? DUPLEX_FULL : DUPLEX_UNKNOWN;
  541. ecmd->phy_address = adapter->port_num;
  542. return 0;
  543. }
  544. static void be_get_ringparam(struct net_device *netdev,
  545. struct ethtool_ringparam *ring)
  546. {
  547. struct be_adapter *adapter = netdev_priv(netdev);
  548. ring->rx_max_pending = ring->rx_pending = adapter->rx_obj[0].q.len;
  549. ring->tx_max_pending = ring->tx_pending = adapter->tx_obj[0].q.len;
  550. }
  551. static void
  552. be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
  553. {
  554. struct be_adapter *adapter = netdev_priv(netdev);
  555. be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause);
  556. ecmd->autoneg = adapter->phy.fc_autoneg;
  557. }
  558. static int
  559. be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
  560. {
  561. struct be_adapter *adapter = netdev_priv(netdev);
  562. int status;
  563. if (ecmd->autoneg != adapter->phy.fc_autoneg)
  564. return -EINVAL;
  565. adapter->tx_fc = ecmd->tx_pause;
  566. adapter->rx_fc = ecmd->rx_pause;
  567. status = be_cmd_set_flow_control(adapter,
  568. adapter->tx_fc, adapter->rx_fc);
  569. if (status)
  570. dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
  571. return status;
  572. }
  573. static int
  574. be_set_phys_id(struct net_device *netdev,
  575. enum ethtool_phys_id_state state)
  576. {
  577. struct be_adapter *adapter = netdev_priv(netdev);
  578. switch (state) {
  579. case ETHTOOL_ID_ACTIVE:
  580. be_cmd_get_beacon_state(adapter, adapter->hba_port_num,
  581. &adapter->beacon_state);
  582. return 1; /* cycle on/off once per second */
  583. case ETHTOOL_ID_ON:
  584. be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
  585. BEACON_STATE_ENABLED);
  586. break;
  587. case ETHTOOL_ID_OFF:
  588. be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
  589. BEACON_STATE_DISABLED);
  590. break;
  591. case ETHTOOL_ID_INACTIVE:
  592. be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
  593. adapter->beacon_state);
  594. }
  595. return 0;
  596. }
  597. static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
  598. {
  599. struct be_adapter *adapter = netdev_priv(netdev);
  600. struct device *dev = &adapter->pdev->dev;
  601. int status;
  602. if (!lancer_chip(adapter)) {
  603. dev_err(dev, "FW dump not supported\n");
  604. return -EOPNOTSUPP;
  605. }
  606. if (dump_present(adapter)) {
  607. dev_err(dev, "Previous dump not cleared, not forcing dump\n");
  608. return 0;
  609. }
  610. switch (dump->flag) {
  611. case LANCER_INITIATE_FW_DUMP:
  612. status = lancer_initiate_dump(adapter);
  613. if (!status)
  614. dev_info(dev, "F/w dump initiated successfully\n");
  615. break;
  616. default:
  617. dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag);
  618. return -EINVAL;
  619. }
  620. return status;
  621. }
  622. static void
  623. be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  624. {
  625. struct be_adapter *adapter = netdev_priv(netdev);
  626. if (be_is_wol_supported(adapter)) {
  627. wol->supported |= WAKE_MAGIC;
  628. if (adapter->wol)
  629. wol->wolopts |= WAKE_MAGIC;
  630. } else
  631. wol->wolopts = 0;
  632. memset(&wol->sopass, 0, sizeof(wol->sopass));
  633. }
  634. static int
  635. be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  636. {
  637. struct be_adapter *adapter = netdev_priv(netdev);
  638. if (wol->wolopts & ~WAKE_MAGIC)
  639. return -EOPNOTSUPP;
  640. if (!be_is_wol_supported(adapter)) {
  641. dev_warn(&adapter->pdev->dev, "WOL not supported\n");
  642. return -EOPNOTSUPP;
  643. }
  644. if (wol->wolopts & WAKE_MAGIC)
  645. adapter->wol = true;
  646. else
  647. adapter->wol = false;
  648. return 0;
  649. }
  650. static int
  651. be_test_ddr_dma(struct be_adapter *adapter)
  652. {
  653. int ret, i;
  654. struct be_dma_mem ddrdma_cmd;
  655. static const u64 pattern[2] = {
  656. 0x5a5a5a5a5a5a5a5aULL, 0xa5a5a5a5a5a5a5a5ULL
  657. };
  658. ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
  659. ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, ddrdma_cmd.size,
  660. &ddrdma_cmd.dma, GFP_KERNEL);
  661. if (!ddrdma_cmd.va)
  662. return -ENOMEM;
  663. for (i = 0; i < 2; i++) {
  664. ret = be_cmd_ddr_dma_test(adapter, pattern[i],
  665. 4096, &ddrdma_cmd);
  666. if (ret != 0)
  667. goto err;
  668. }
  669. err:
  670. dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
  671. ddrdma_cmd.dma);
  672. return ret;
  673. }
  674. static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
  675. u64 *status)
  676. {
  677. be_cmd_set_loopback(adapter, adapter->hba_port_num,
  678. loopback_type, 1);
  679. *status = be_cmd_loopback_test(adapter, adapter->hba_port_num,
  680. loopback_type, 1500,
  681. 2, 0xabc);
  682. be_cmd_set_loopback(adapter, adapter->hba_port_num,
  683. BE_NO_LOOPBACK, 1);
  684. return *status;
  685. }
  686. static void
  687. be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
  688. {
  689. struct be_adapter *adapter = netdev_priv(netdev);
  690. int status;
  691. u8 link_status = 0;
  692. if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) {
  693. dev_err(&adapter->pdev->dev, "Self test not supported\n");
  694. test->flags |= ETH_TEST_FL_FAILED;
  695. return;
  696. }
  697. memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
  698. if (test->flags & ETH_TEST_FL_OFFLINE) {
  699. if (be_loopback_test(adapter, BE_MAC_LOOPBACK,
  700. &data[0]) != 0) {
  701. test->flags |= ETH_TEST_FL_FAILED;
  702. }
  703. if (be_loopback_test(adapter, BE_PHY_LOOPBACK,
  704. &data[1]) != 0) {
  705. test->flags |= ETH_TEST_FL_FAILED;
  706. }
  707. if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
  708. &data[2]) != 0) {
  709. test->flags |= ETH_TEST_FL_FAILED;
  710. }
  711. }
  712. if (!lancer_chip(adapter) && be_test_ddr_dma(adapter) != 0) {
  713. data[3] = 1;
  714. test->flags |= ETH_TEST_FL_FAILED;
  715. }
  716. status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
  717. if (status) {
  718. test->flags |= ETH_TEST_FL_FAILED;
  719. data[4] = -1;
  720. } else if (!link_status) {
  721. test->flags |= ETH_TEST_FL_FAILED;
  722. data[4] = 1;
  723. }
  724. }
  725. static int
  726. be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
  727. {
  728. struct be_adapter *adapter = netdev_priv(netdev);
  729. return be_load_fw(adapter, efl->data);
  730. }
  731. static int
  732. be_get_eeprom_len(struct net_device *netdev)
  733. {
  734. struct be_adapter *adapter = netdev_priv(netdev);
  735. if (!check_privilege(adapter, MAX_PRIVILEGES))
  736. return 0;
  737. if (lancer_chip(adapter)) {
  738. if (be_physfn(adapter))
  739. return lancer_cmd_get_file_len(adapter,
  740. LANCER_VPD_PF_FILE);
  741. else
  742. return lancer_cmd_get_file_len(adapter,
  743. LANCER_VPD_VF_FILE);
  744. } else {
  745. return BE_READ_SEEPROM_LEN;
  746. }
  747. }
  748. static int
  749. be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
  750. uint8_t *data)
  751. {
  752. struct be_adapter *adapter = netdev_priv(netdev);
  753. struct be_dma_mem eeprom_cmd;
  754. struct be_cmd_resp_seeprom_read *resp;
  755. int status;
  756. if (!eeprom->len)
  757. return -EINVAL;
  758. if (lancer_chip(adapter)) {
  759. if (be_physfn(adapter))
  760. return lancer_cmd_read_file(adapter, LANCER_VPD_PF_FILE,
  761. eeprom->len, data);
  762. else
  763. return lancer_cmd_read_file(adapter, LANCER_VPD_VF_FILE,
  764. eeprom->len, data);
  765. }
  766. eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16);
  767. memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem));
  768. eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read);
  769. eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, eeprom_cmd.size,
  770. &eeprom_cmd.dma, GFP_KERNEL);
  771. if (!eeprom_cmd.va)
  772. return -ENOMEM;
  773. status = be_cmd_get_seeprom_data(adapter, &eeprom_cmd);
  774. if (!status) {
  775. resp = eeprom_cmd.va;
  776. memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len);
  777. }
  778. dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
  779. eeprom_cmd.dma);
  780. return status;
  781. }
  782. static u32 be_get_msg_level(struct net_device *netdev)
  783. {
  784. struct be_adapter *adapter = netdev_priv(netdev);
  785. if (lancer_chip(adapter)) {
  786. dev_err(&adapter->pdev->dev, "Operation not supported\n");
  787. return -EOPNOTSUPP;
  788. }
  789. return adapter->msg_enable;
  790. }
  791. static void be_set_fw_log_level(struct be_adapter *adapter, u32 level)
  792. {
  793. struct be_dma_mem extfat_cmd;
  794. struct be_fat_conf_params *cfgs;
  795. int status;
  796. int i, j;
  797. memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
  798. extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
  799. extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size,
  800. &extfat_cmd.dma);
  801. if (!extfat_cmd.va) {
  802. dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n",
  803. __func__);
  804. goto err;
  805. }
  806. status = be_cmd_get_ext_fat_capabilites(adapter, &extfat_cmd);
  807. if (!status) {
  808. cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
  809. sizeof(struct be_cmd_resp_hdr));
  810. for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) {
  811. u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes);
  812. for (j = 0; j < num_modes; j++) {
  813. if (cfgs->module[i].trace_lvl[j].mode ==
  814. MODE_UART)
  815. cfgs->module[i].trace_lvl[j].dbg_lvl =
  816. cpu_to_le32(level);
  817. }
  818. }
  819. status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd,
  820. cfgs);
  821. if (status)
  822. dev_err(&adapter->pdev->dev,
  823. "Message level set failed\n");
  824. } else {
  825. dev_err(&adapter->pdev->dev, "Message level get failed\n");
  826. }
  827. pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va,
  828. extfat_cmd.dma);
  829. err:
  830. return;
  831. }
  832. static void be_set_msg_level(struct net_device *netdev, u32 level)
  833. {
  834. struct be_adapter *adapter = netdev_priv(netdev);
  835. if (lancer_chip(adapter)) {
  836. dev_err(&adapter->pdev->dev, "Operation not supported\n");
  837. return;
  838. }
  839. if (adapter->msg_enable == level)
  840. return;
  841. if ((level & NETIF_MSG_HW) != (adapter->msg_enable & NETIF_MSG_HW))
  842. be_set_fw_log_level(adapter, level & NETIF_MSG_HW ?
  843. FW_LOG_LEVEL_DEFAULT : FW_LOG_LEVEL_FATAL);
  844. adapter->msg_enable = level;
  845. return;
  846. }
  847. static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type)
  848. {
  849. u64 data = 0;
  850. switch (flow_type) {
  851. case TCP_V4_FLOW:
  852. if (adapter->rss_flags & RSS_ENABLE_IPV4)
  853. data |= RXH_IP_DST | RXH_IP_SRC;
  854. if (adapter->rss_flags & RSS_ENABLE_TCP_IPV4)
  855. data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  856. break;
  857. case UDP_V4_FLOW:
  858. if (adapter->rss_flags & RSS_ENABLE_IPV4)
  859. data |= RXH_IP_DST | RXH_IP_SRC;
  860. if (adapter->rss_flags & RSS_ENABLE_UDP_IPV4)
  861. data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  862. break;
  863. case TCP_V6_FLOW:
  864. if (adapter->rss_flags & RSS_ENABLE_IPV6)
  865. data |= RXH_IP_DST | RXH_IP_SRC;
  866. if (adapter->rss_flags & RSS_ENABLE_TCP_IPV6)
  867. data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  868. break;
  869. case UDP_V6_FLOW:
  870. if (adapter->rss_flags & RSS_ENABLE_IPV6)
  871. data |= RXH_IP_DST | RXH_IP_SRC;
  872. if (adapter->rss_flags & RSS_ENABLE_UDP_IPV6)
  873. data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
  874. break;
  875. }
  876. return data;
  877. }
  878. static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
  879. u32 *rule_locs)
  880. {
  881. struct be_adapter *adapter = netdev_priv(netdev);
  882. if (!be_multi_rxq(adapter)) {
  883. dev_info(&adapter->pdev->dev,
  884. "ethtool::get_rxnfc: RX flow hashing is disabled\n");
  885. return -EINVAL;
  886. }
  887. switch (cmd->cmd) {
  888. case ETHTOOL_GRXFH:
  889. cmd->data = be_get_rss_hash_opts(adapter, cmd->flow_type);
  890. break;
  891. case ETHTOOL_GRXRINGS:
  892. cmd->data = adapter->num_rx_qs - 1;
  893. break;
  894. default:
  895. return -EINVAL;
  896. }
  897. return 0;
  898. }
  899. static int be_set_rss_hash_opts(struct be_adapter *adapter,
  900. struct ethtool_rxnfc *cmd)
  901. {
  902. struct be_rx_obj *rxo;
  903. int status = 0, i, j;
  904. u8 rsstable[128];
  905. u32 rss_flags = adapter->rss_flags;
  906. if (cmd->data != L3_RSS_FLAGS &&
  907. cmd->data != (L3_RSS_FLAGS | L4_RSS_FLAGS))
  908. return -EINVAL;
  909. switch (cmd->flow_type) {
  910. case TCP_V4_FLOW:
  911. if (cmd->data == L3_RSS_FLAGS)
  912. rss_flags &= ~RSS_ENABLE_TCP_IPV4;
  913. else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
  914. rss_flags |= RSS_ENABLE_IPV4 |
  915. RSS_ENABLE_TCP_IPV4;
  916. break;
  917. case TCP_V6_FLOW:
  918. if (cmd->data == L3_RSS_FLAGS)
  919. rss_flags &= ~RSS_ENABLE_TCP_IPV6;
  920. else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
  921. rss_flags |= RSS_ENABLE_IPV6 |
  922. RSS_ENABLE_TCP_IPV6;
  923. break;
  924. case UDP_V4_FLOW:
  925. if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) &&
  926. BEx_chip(adapter))
  927. return -EINVAL;
  928. if (cmd->data == L3_RSS_FLAGS)
  929. rss_flags &= ~RSS_ENABLE_UDP_IPV4;
  930. else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
  931. rss_flags |= RSS_ENABLE_IPV4 |
  932. RSS_ENABLE_UDP_IPV4;
  933. break;
  934. case UDP_V6_FLOW:
  935. if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) &&
  936. BEx_chip(adapter))
  937. return -EINVAL;
  938. if (cmd->data == L3_RSS_FLAGS)
  939. rss_flags &= ~RSS_ENABLE_UDP_IPV6;
  940. else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
  941. rss_flags |= RSS_ENABLE_IPV6 |
  942. RSS_ENABLE_UDP_IPV6;
  943. break;
  944. default:
  945. return -EINVAL;
  946. }
  947. if (rss_flags == adapter->rss_flags)
  948. return status;
  949. if (be_multi_rxq(adapter)) {
  950. for (j = 0; j < 128; j += adapter->num_rx_qs - 1) {
  951. for_all_rss_queues(adapter, rxo, i) {
  952. if ((j + i) >= 128)
  953. break;
  954. rsstable[j + i] = rxo->rss_id;
  955. }
  956. }
  957. }
  958. status = be_cmd_rss_config(adapter, rsstable, rss_flags, 128);
  959. if (!status)
  960. adapter->rss_flags = rss_flags;
  961. return status;
  962. }
  963. static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
  964. {
  965. struct be_adapter *adapter = netdev_priv(netdev);
  966. int status = 0;
  967. if (!be_multi_rxq(adapter)) {
  968. dev_err(&adapter->pdev->dev,
  969. "ethtool::set_rxnfc: RX flow hashing is disabled\n");
  970. return -EINVAL;
  971. }
  972. switch (cmd->cmd) {
  973. case ETHTOOL_SRXFH:
  974. status = be_set_rss_hash_opts(adapter, cmd);
  975. break;
  976. default:
  977. return -EINVAL;
  978. }
  979. return status;
  980. }
  981. static void be_get_channels(struct net_device *netdev,
  982. struct ethtool_channels *ch)
  983. {
  984. struct be_adapter *adapter = netdev_priv(netdev);
  985. ch->combined_count = adapter->num_evt_qs;
  986. ch->max_combined = be_max_qs(adapter);
  987. }
  988. static int be_set_channels(struct net_device *netdev,
  989. struct ethtool_channels *ch)
  990. {
  991. struct be_adapter *adapter = netdev_priv(netdev);
  992. if (ch->rx_count || ch->tx_count || ch->other_count ||
  993. !ch->combined_count || ch->combined_count > be_max_qs(adapter))
  994. return -EINVAL;
  995. adapter->cfg_num_qs = ch->combined_count;
  996. return be_update_queues(adapter);
  997. }
  998. const struct ethtool_ops be_ethtool_ops = {
  999. .get_settings = be_get_settings,
  1000. .get_drvinfo = be_get_drvinfo,
  1001. .get_wol = be_get_wol,
  1002. .set_wol = be_set_wol,
  1003. .get_link = ethtool_op_get_link,
  1004. .get_eeprom_len = be_get_eeprom_len,
  1005. .get_eeprom = be_read_eeprom,
  1006. .get_coalesce = be_get_coalesce,
  1007. .set_coalesce = be_set_coalesce,
  1008. .get_ringparam = be_get_ringparam,
  1009. .get_pauseparam = be_get_pauseparam,
  1010. .set_pauseparam = be_set_pauseparam,
  1011. .get_strings = be_get_stat_strings,
  1012. .set_phys_id = be_set_phys_id,
  1013. .set_dump = be_set_dump,
  1014. .get_msglevel = be_get_msg_level,
  1015. .set_msglevel = be_set_msg_level,
  1016. .get_sset_count = be_get_sset_count,
  1017. .get_ethtool_stats = be_get_ethtool_stats,
  1018. .get_regs_len = be_get_reg_len,
  1019. .get_regs = be_get_regs,
  1020. .flash_device = be_do_flash,
  1021. .self_test = be_self_test,
  1022. .get_rxnfc = be_get_rxnfc,
  1023. .set_rxnfc = be_set_rxnfc,
  1024. .get_channels = be_get_channels,
  1025. .set_channels = be_set_channels
  1026. };