bnad_ethtool.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. /*
  2. * Linux network driver for Brocade Converged Network Adapter.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License (GPL) Version 2 as
  6. * published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. */
  13. /*
  14. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  15. * All rights reserved
  16. * www.brocade.com
  17. */
  18. #include "cna.h"
  19. #include <linux/netdevice.h>
  20. #include <linux/skbuff.h>
  21. #include <linux/ethtool.h>
  22. #include <linux/rtnetlink.h>
  23. #include "bna.h"
  24. #include "bnad.h"
  25. #define BNAD_NUM_TXF_COUNTERS 12
  26. #define BNAD_NUM_RXF_COUNTERS 10
  27. #define BNAD_NUM_CQ_COUNTERS (3 + 5)
  28. #define BNAD_NUM_RXQ_COUNTERS 6
  29. #define BNAD_NUM_TXQ_COUNTERS 5
  30. #define BNAD_ETHTOOL_STATS_NUM \
  31. (sizeof(struct rtnl_link_stats64) / sizeof(u64) + \
  32. sizeof(struct bnad_drv_stats) / sizeof(u64) + \
  33. offsetof(struct bfi_enet_stats, rxf_stats[0]) / sizeof(u64))
  34. static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
  35. "rx_packets",
  36. "tx_packets",
  37. "rx_bytes",
  38. "tx_bytes",
  39. "rx_errors",
  40. "tx_errors",
  41. "rx_dropped",
  42. "tx_dropped",
  43. "multicast",
  44. "collisions",
  45. "rx_length_errors",
  46. "rx_over_errors",
  47. "rx_crc_errors",
  48. "rx_frame_errors",
  49. "rx_fifo_errors",
  50. "rx_missed_errors",
  51. "tx_aborted_errors",
  52. "tx_carrier_errors",
  53. "tx_fifo_errors",
  54. "tx_heartbeat_errors",
  55. "tx_window_errors",
  56. "rx_compressed",
  57. "tx_compressed",
  58. "netif_queue_stop",
  59. "netif_queue_wakeup",
  60. "netif_queue_stopped",
  61. "tso4",
  62. "tso6",
  63. "tso_err",
  64. "tcpcsum_offload",
  65. "udpcsum_offload",
  66. "csum_help",
  67. "tx_skb_too_short",
  68. "tx_skb_stopping",
  69. "tx_skb_max_vectors",
  70. "tx_skb_mss_too_long",
  71. "tx_skb_tso_too_short",
  72. "tx_skb_tso_prepare",
  73. "tx_skb_non_tso_too_long",
  74. "tx_skb_tcp_hdr",
  75. "tx_skb_udp_hdr",
  76. "tx_skb_csum_err",
  77. "tx_skb_headlen_too_long",
  78. "tx_skb_headlen_zero",
  79. "tx_skb_frag_zero",
  80. "tx_skb_len_mismatch",
  81. "hw_stats_updates",
  82. "netif_rx_dropped",
  83. "link_toggle",
  84. "cee_toggle",
  85. "rxp_info_alloc_failed",
  86. "mbox_intr_disabled",
  87. "mbox_intr_enabled",
  88. "tx_unmap_q_alloc_failed",
  89. "rx_unmap_q_alloc_failed",
  90. "rxbuf_alloc_failed",
  91. "mac_stats_clr_cnt",
  92. "mac_frame_64",
  93. "mac_frame_65_127",
  94. "mac_frame_128_255",
  95. "mac_frame_256_511",
  96. "mac_frame_512_1023",
  97. "mac_frame_1024_1518",
  98. "mac_frame_1518_1522",
  99. "mac_rx_bytes",
  100. "mac_rx_packets",
  101. "mac_rx_fcs_error",
  102. "mac_rx_multicast",
  103. "mac_rx_broadcast",
  104. "mac_rx_control_frames",
  105. "mac_rx_pause",
  106. "mac_rx_unknown_opcode",
  107. "mac_rx_alignment_error",
  108. "mac_rx_frame_length_error",
  109. "mac_rx_code_error",
  110. "mac_rx_carrier_sense_error",
  111. "mac_rx_undersize",
  112. "mac_rx_oversize",
  113. "mac_rx_fragments",
  114. "mac_rx_jabber",
  115. "mac_rx_drop",
  116. "mac_tx_bytes",
  117. "mac_tx_packets",
  118. "mac_tx_multicast",
  119. "mac_tx_broadcast",
  120. "mac_tx_pause",
  121. "mac_tx_deferral",
  122. "mac_tx_excessive_deferral",
  123. "mac_tx_single_collision",
  124. "mac_tx_muliple_collision",
  125. "mac_tx_late_collision",
  126. "mac_tx_excessive_collision",
  127. "mac_tx_total_collision",
  128. "mac_tx_pause_honored",
  129. "mac_tx_drop",
  130. "mac_tx_jabber",
  131. "mac_tx_fcs_error",
  132. "mac_tx_control_frame",
  133. "mac_tx_oversize",
  134. "mac_tx_undersize",
  135. "mac_tx_fragments",
  136. "bpc_tx_pause_0",
  137. "bpc_tx_pause_1",
  138. "bpc_tx_pause_2",
  139. "bpc_tx_pause_3",
  140. "bpc_tx_pause_4",
  141. "bpc_tx_pause_5",
  142. "bpc_tx_pause_6",
  143. "bpc_tx_pause_7",
  144. "bpc_tx_zero_pause_0",
  145. "bpc_tx_zero_pause_1",
  146. "bpc_tx_zero_pause_2",
  147. "bpc_tx_zero_pause_3",
  148. "bpc_tx_zero_pause_4",
  149. "bpc_tx_zero_pause_5",
  150. "bpc_tx_zero_pause_6",
  151. "bpc_tx_zero_pause_7",
  152. "bpc_tx_first_pause_0",
  153. "bpc_tx_first_pause_1",
  154. "bpc_tx_first_pause_2",
  155. "bpc_tx_first_pause_3",
  156. "bpc_tx_first_pause_4",
  157. "bpc_tx_first_pause_5",
  158. "bpc_tx_first_pause_6",
  159. "bpc_tx_first_pause_7",
  160. "bpc_rx_pause_0",
  161. "bpc_rx_pause_1",
  162. "bpc_rx_pause_2",
  163. "bpc_rx_pause_3",
  164. "bpc_rx_pause_4",
  165. "bpc_rx_pause_5",
  166. "bpc_rx_pause_6",
  167. "bpc_rx_pause_7",
  168. "bpc_rx_zero_pause_0",
  169. "bpc_rx_zero_pause_1",
  170. "bpc_rx_zero_pause_2",
  171. "bpc_rx_zero_pause_3",
  172. "bpc_rx_zero_pause_4",
  173. "bpc_rx_zero_pause_5",
  174. "bpc_rx_zero_pause_6",
  175. "bpc_rx_zero_pause_7",
  176. "bpc_rx_first_pause_0",
  177. "bpc_rx_first_pause_1",
  178. "bpc_rx_first_pause_2",
  179. "bpc_rx_first_pause_3",
  180. "bpc_rx_first_pause_4",
  181. "bpc_rx_first_pause_5",
  182. "bpc_rx_first_pause_6",
  183. "bpc_rx_first_pause_7",
  184. "rad_rx_frames",
  185. "rad_rx_octets",
  186. "rad_rx_vlan_frames",
  187. "rad_rx_ucast",
  188. "rad_rx_ucast_octets",
  189. "rad_rx_ucast_vlan",
  190. "rad_rx_mcast",
  191. "rad_rx_mcast_octets",
  192. "rad_rx_mcast_vlan",
  193. "rad_rx_bcast",
  194. "rad_rx_bcast_octets",
  195. "rad_rx_bcast_vlan",
  196. "rad_rx_drops",
  197. "rlb_rad_rx_frames",
  198. "rlb_rad_rx_octets",
  199. "rlb_rad_rx_vlan_frames",
  200. "rlb_rad_rx_ucast",
  201. "rlb_rad_rx_ucast_octets",
  202. "rlb_rad_rx_ucast_vlan",
  203. "rlb_rad_rx_mcast",
  204. "rlb_rad_rx_mcast_octets",
  205. "rlb_rad_rx_mcast_vlan",
  206. "rlb_rad_rx_bcast",
  207. "rlb_rad_rx_bcast_octets",
  208. "rlb_rad_rx_bcast_vlan",
  209. "rlb_rad_rx_drops",
  210. "fc_rx_ucast_octets",
  211. "fc_rx_ucast",
  212. "fc_rx_ucast_vlan",
  213. "fc_rx_mcast_octets",
  214. "fc_rx_mcast",
  215. "fc_rx_mcast_vlan",
  216. "fc_rx_bcast_octets",
  217. "fc_rx_bcast",
  218. "fc_rx_bcast_vlan",
  219. "fc_tx_ucast_octets",
  220. "fc_tx_ucast",
  221. "fc_tx_ucast_vlan",
  222. "fc_tx_mcast_octets",
  223. "fc_tx_mcast",
  224. "fc_tx_mcast_vlan",
  225. "fc_tx_bcast_octets",
  226. "fc_tx_bcast",
  227. "fc_tx_bcast_vlan",
  228. "fc_tx_parity_errors",
  229. "fc_tx_timeout",
  230. "fc_tx_fid_parity_errors",
  231. };
  232. static int
  233. bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
  234. {
  235. cmd->supported = SUPPORTED_10000baseT_Full;
  236. cmd->advertising = ADVERTISED_10000baseT_Full;
  237. cmd->autoneg = AUTONEG_DISABLE;
  238. cmd->supported |= SUPPORTED_FIBRE;
  239. cmd->advertising |= ADVERTISED_FIBRE;
  240. cmd->port = PORT_FIBRE;
  241. cmd->phy_address = 0;
  242. if (netif_carrier_ok(netdev)) {
  243. ethtool_cmd_speed_set(cmd, SPEED_10000);
  244. cmd->duplex = DUPLEX_FULL;
  245. } else {
  246. ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
  247. cmd->duplex = DUPLEX_UNKNOWN;
  248. }
  249. cmd->transceiver = XCVR_EXTERNAL;
  250. cmd->maxtxpkt = 0;
  251. cmd->maxrxpkt = 0;
  252. return 0;
  253. }
  254. static int
  255. bnad_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
  256. {
  257. /* 10G full duplex setting supported only */
  258. if (cmd->autoneg == AUTONEG_ENABLE)
  259. return -EOPNOTSUPP; else {
  260. if ((ethtool_cmd_speed(cmd) == SPEED_10000)
  261. && (cmd->duplex == DUPLEX_FULL))
  262. return 0;
  263. }
  264. return -EOPNOTSUPP;
  265. }
  266. static void
  267. bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
  268. {
  269. struct bnad *bnad = netdev_priv(netdev);
  270. struct bfa_ioc_attr *ioc_attr;
  271. unsigned long flags;
  272. strlcpy(drvinfo->driver, BNAD_NAME, sizeof(drvinfo->driver));
  273. strlcpy(drvinfo->version, BNAD_VERSION, sizeof(drvinfo->version));
  274. ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL);
  275. if (ioc_attr) {
  276. spin_lock_irqsave(&bnad->bna_lock, flags);
  277. bfa_nw_ioc_get_attr(&bnad->bna.ioceth.ioc, ioc_attr);
  278. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  279. strlcpy(drvinfo->fw_version, ioc_attr->adapter_attr.fw_ver,
  280. sizeof(drvinfo->fw_version));
  281. kfree(ioc_attr);
  282. }
  283. strlcpy(drvinfo->bus_info, pci_name(bnad->pcidev),
  284. sizeof(drvinfo->bus_info));
  285. }
  286. static void
  287. bnad_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wolinfo)
  288. {
  289. wolinfo->supported = 0;
  290. wolinfo->wolopts = 0;
  291. }
  292. static int
  293. bnad_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
  294. {
  295. struct bnad *bnad = netdev_priv(netdev);
  296. unsigned long flags;
  297. /* Lock rqd. to access bnad->bna_lock */
  298. spin_lock_irqsave(&bnad->bna_lock, flags);
  299. coalesce->use_adaptive_rx_coalesce =
  300. (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) ? true : false;
  301. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  302. coalesce->rx_coalesce_usecs = bnad->rx_coalescing_timeo *
  303. BFI_COALESCING_TIMER_UNIT;
  304. coalesce->tx_coalesce_usecs = bnad->tx_coalescing_timeo *
  305. BFI_COALESCING_TIMER_UNIT;
  306. coalesce->tx_max_coalesced_frames = BFI_TX_INTERPKT_COUNT;
  307. return 0;
  308. }
  309. static int
  310. bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
  311. {
  312. struct bnad *bnad = netdev_priv(netdev);
  313. unsigned long flags;
  314. int to_del = 0;
  315. if (coalesce->rx_coalesce_usecs == 0 ||
  316. coalesce->rx_coalesce_usecs >
  317. BFI_MAX_COALESCING_TIMEO * BFI_COALESCING_TIMER_UNIT)
  318. return -EINVAL;
  319. if (coalesce->tx_coalesce_usecs == 0 ||
  320. coalesce->tx_coalesce_usecs >
  321. BFI_MAX_COALESCING_TIMEO * BFI_COALESCING_TIMER_UNIT)
  322. return -EINVAL;
  323. mutex_lock(&bnad->conf_mutex);
  324. /*
  325. * Do not need to store rx_coalesce_usecs here
  326. * Every time DIM is disabled, we can get it from the
  327. * stack.
  328. */
  329. spin_lock_irqsave(&bnad->bna_lock, flags);
  330. if (coalesce->use_adaptive_rx_coalesce) {
  331. if (!(bnad->cfg_flags & BNAD_CF_DIM_ENABLED)) {
  332. bnad->cfg_flags |= BNAD_CF_DIM_ENABLED;
  333. bnad_dim_timer_start(bnad);
  334. }
  335. } else {
  336. if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) {
  337. bnad->cfg_flags &= ~BNAD_CF_DIM_ENABLED;
  338. if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&
  339. test_bit(BNAD_RF_DIM_TIMER_RUNNING,
  340. &bnad->run_flags)) {
  341. clear_bit(BNAD_RF_DIM_TIMER_RUNNING,
  342. &bnad->run_flags);
  343. to_del = 1;
  344. }
  345. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  346. if (to_del)
  347. del_timer_sync(&bnad->dim_timer);
  348. spin_lock_irqsave(&bnad->bna_lock, flags);
  349. bnad_rx_coalescing_timeo_set(bnad);
  350. }
  351. }
  352. if (bnad->tx_coalescing_timeo != coalesce->tx_coalesce_usecs /
  353. BFI_COALESCING_TIMER_UNIT) {
  354. bnad->tx_coalescing_timeo = coalesce->tx_coalesce_usecs /
  355. BFI_COALESCING_TIMER_UNIT;
  356. bnad_tx_coalescing_timeo_set(bnad);
  357. }
  358. if (bnad->rx_coalescing_timeo != coalesce->rx_coalesce_usecs /
  359. BFI_COALESCING_TIMER_UNIT) {
  360. bnad->rx_coalescing_timeo = coalesce->rx_coalesce_usecs /
  361. BFI_COALESCING_TIMER_UNIT;
  362. if (!(bnad->cfg_flags & BNAD_CF_DIM_ENABLED))
  363. bnad_rx_coalescing_timeo_set(bnad);
  364. }
  365. /* Add Tx Inter-pkt DMA count? */
  366. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  367. mutex_unlock(&bnad->conf_mutex);
  368. return 0;
  369. }
  370. static void
  371. bnad_get_ringparam(struct net_device *netdev,
  372. struct ethtool_ringparam *ringparam)
  373. {
  374. struct bnad *bnad = netdev_priv(netdev);
  375. ringparam->rx_max_pending = BNAD_MAX_RXQ_DEPTH;
  376. ringparam->tx_max_pending = BNAD_MAX_TXQ_DEPTH;
  377. ringparam->rx_pending = bnad->rxq_depth;
  378. ringparam->tx_pending = bnad->txq_depth;
  379. }
  380. static int
  381. bnad_set_ringparam(struct net_device *netdev,
  382. struct ethtool_ringparam *ringparam)
  383. {
  384. int i, current_err, err = 0;
  385. struct bnad *bnad = netdev_priv(netdev);
  386. unsigned long flags;
  387. mutex_lock(&bnad->conf_mutex);
  388. if (ringparam->rx_pending == bnad->rxq_depth &&
  389. ringparam->tx_pending == bnad->txq_depth) {
  390. mutex_unlock(&bnad->conf_mutex);
  391. return 0;
  392. }
  393. if (ringparam->rx_pending < BNAD_MIN_Q_DEPTH ||
  394. ringparam->rx_pending > BNAD_MAX_RXQ_DEPTH ||
  395. !BNA_POWER_OF_2(ringparam->rx_pending)) {
  396. mutex_unlock(&bnad->conf_mutex);
  397. return -EINVAL;
  398. }
  399. if (ringparam->tx_pending < BNAD_MIN_Q_DEPTH ||
  400. ringparam->tx_pending > BNAD_MAX_TXQ_DEPTH ||
  401. !BNA_POWER_OF_2(ringparam->tx_pending)) {
  402. mutex_unlock(&bnad->conf_mutex);
  403. return -EINVAL;
  404. }
  405. if (ringparam->rx_pending != bnad->rxq_depth) {
  406. bnad->rxq_depth = ringparam->rx_pending;
  407. if (!netif_running(netdev)) {
  408. mutex_unlock(&bnad->conf_mutex);
  409. return 0;
  410. }
  411. for (i = 0; i < bnad->num_rx; i++) {
  412. if (!bnad->rx_info[i].rx)
  413. continue;
  414. bnad_destroy_rx(bnad, i);
  415. current_err = bnad_setup_rx(bnad, i);
  416. if (current_err && !err)
  417. err = current_err;
  418. }
  419. if (!err && bnad->rx_info[0].rx) {
  420. /* restore rx configuration */
  421. bnad_restore_vlans(bnad, 0);
  422. bnad_enable_default_bcast(bnad);
  423. spin_lock_irqsave(&bnad->bna_lock, flags);
  424. bnad_mac_addr_set_locked(bnad, netdev->dev_addr);
  425. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  426. bnad->cfg_flags &= ~(BNAD_CF_ALLMULTI |
  427. BNAD_CF_PROMISC);
  428. bnad_set_rx_mode(netdev);
  429. }
  430. }
  431. if (ringparam->tx_pending != bnad->txq_depth) {
  432. bnad->txq_depth = ringparam->tx_pending;
  433. if (!netif_running(netdev)) {
  434. mutex_unlock(&bnad->conf_mutex);
  435. return 0;
  436. }
  437. for (i = 0; i < bnad->num_tx; i++) {
  438. if (!bnad->tx_info[i].tx)
  439. continue;
  440. bnad_destroy_tx(bnad, i);
  441. current_err = bnad_setup_tx(bnad, i);
  442. if (current_err && !err)
  443. err = current_err;
  444. }
  445. }
  446. mutex_unlock(&bnad->conf_mutex);
  447. return err;
  448. }
  449. static void
  450. bnad_get_pauseparam(struct net_device *netdev,
  451. struct ethtool_pauseparam *pauseparam)
  452. {
  453. struct bnad *bnad = netdev_priv(netdev);
  454. pauseparam->autoneg = 0;
  455. pauseparam->rx_pause = bnad->bna.enet.pause_config.rx_pause;
  456. pauseparam->tx_pause = bnad->bna.enet.pause_config.tx_pause;
  457. }
  458. static int
  459. bnad_set_pauseparam(struct net_device *netdev,
  460. struct ethtool_pauseparam *pauseparam)
  461. {
  462. struct bnad *bnad = netdev_priv(netdev);
  463. struct bna_pause_config pause_config;
  464. unsigned long flags;
  465. if (pauseparam->autoneg == AUTONEG_ENABLE)
  466. return -EINVAL;
  467. mutex_lock(&bnad->conf_mutex);
  468. if (pauseparam->rx_pause != bnad->bna.enet.pause_config.rx_pause ||
  469. pauseparam->tx_pause != bnad->bna.enet.pause_config.tx_pause) {
  470. pause_config.rx_pause = pauseparam->rx_pause;
  471. pause_config.tx_pause = pauseparam->tx_pause;
  472. spin_lock_irqsave(&bnad->bna_lock, flags);
  473. bna_enet_pause_config(&bnad->bna.enet, &pause_config, NULL);
  474. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  475. }
  476. mutex_unlock(&bnad->conf_mutex);
  477. return 0;
  478. }
  479. static void
  480. bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string)
  481. {
  482. struct bnad *bnad = netdev_priv(netdev);
  483. int i, j, q_num;
  484. u32 bmap;
  485. mutex_lock(&bnad->conf_mutex);
  486. switch (stringset) {
  487. case ETH_SS_STATS:
  488. for (i = 0; i < BNAD_ETHTOOL_STATS_NUM; i++) {
  489. BUG_ON(!(strlen(bnad_net_stats_strings[i]) <
  490. ETH_GSTRING_LEN));
  491. memcpy(string, bnad_net_stats_strings[i],
  492. ETH_GSTRING_LEN);
  493. string += ETH_GSTRING_LEN;
  494. }
  495. bmap = bna_tx_rid_mask(&bnad->bna);
  496. for (i = 0; bmap; i++) {
  497. if (bmap & 1) {
  498. sprintf(string, "txf%d_ucast_octets", i);
  499. string += ETH_GSTRING_LEN;
  500. sprintf(string, "txf%d_ucast", i);
  501. string += ETH_GSTRING_LEN;
  502. sprintf(string, "txf%d_ucast_vlan", i);
  503. string += ETH_GSTRING_LEN;
  504. sprintf(string, "txf%d_mcast_octets", i);
  505. string += ETH_GSTRING_LEN;
  506. sprintf(string, "txf%d_mcast", i);
  507. string += ETH_GSTRING_LEN;
  508. sprintf(string, "txf%d_mcast_vlan", i);
  509. string += ETH_GSTRING_LEN;
  510. sprintf(string, "txf%d_bcast_octets", i);
  511. string += ETH_GSTRING_LEN;
  512. sprintf(string, "txf%d_bcast", i);
  513. string += ETH_GSTRING_LEN;
  514. sprintf(string, "txf%d_bcast_vlan", i);
  515. string += ETH_GSTRING_LEN;
  516. sprintf(string, "txf%d_errors", i);
  517. string += ETH_GSTRING_LEN;
  518. sprintf(string, "txf%d_filter_vlan", i);
  519. string += ETH_GSTRING_LEN;
  520. sprintf(string, "txf%d_filter_mac_sa", i);
  521. string += ETH_GSTRING_LEN;
  522. }
  523. bmap >>= 1;
  524. }
  525. bmap = bna_rx_rid_mask(&bnad->bna);
  526. for (i = 0; bmap; i++) {
  527. if (bmap & 1) {
  528. sprintf(string, "rxf%d_ucast_octets", i);
  529. string += ETH_GSTRING_LEN;
  530. sprintf(string, "rxf%d_ucast", i);
  531. string += ETH_GSTRING_LEN;
  532. sprintf(string, "rxf%d_ucast_vlan", i);
  533. string += ETH_GSTRING_LEN;
  534. sprintf(string, "rxf%d_mcast_octets", i);
  535. string += ETH_GSTRING_LEN;
  536. sprintf(string, "rxf%d_mcast", i);
  537. string += ETH_GSTRING_LEN;
  538. sprintf(string, "rxf%d_mcast_vlan", i);
  539. string += ETH_GSTRING_LEN;
  540. sprintf(string, "rxf%d_bcast_octets", i);
  541. string += ETH_GSTRING_LEN;
  542. sprintf(string, "rxf%d_bcast", i);
  543. string += ETH_GSTRING_LEN;
  544. sprintf(string, "rxf%d_bcast_vlan", i);
  545. string += ETH_GSTRING_LEN;
  546. sprintf(string, "rxf%d_frame_drops", i);
  547. string += ETH_GSTRING_LEN;
  548. }
  549. bmap >>= 1;
  550. }
  551. q_num = 0;
  552. for (i = 0; i < bnad->num_rx; i++) {
  553. if (!bnad->rx_info[i].rx)
  554. continue;
  555. for (j = 0; j < bnad->num_rxp_per_rx; j++) {
  556. sprintf(string, "cq%d_producer_index", q_num);
  557. string += ETH_GSTRING_LEN;
  558. sprintf(string, "cq%d_consumer_index", q_num);
  559. string += ETH_GSTRING_LEN;
  560. sprintf(string, "cq%d_hw_producer_index",
  561. q_num);
  562. string += ETH_GSTRING_LEN;
  563. sprintf(string, "cq%d_intr", q_num);
  564. string += ETH_GSTRING_LEN;
  565. sprintf(string, "cq%d_poll", q_num);
  566. string += ETH_GSTRING_LEN;
  567. sprintf(string, "cq%d_schedule", q_num);
  568. string += ETH_GSTRING_LEN;
  569. sprintf(string, "cq%d_keep_poll", q_num);
  570. string += ETH_GSTRING_LEN;
  571. sprintf(string, "cq%d_complete", q_num);
  572. string += ETH_GSTRING_LEN;
  573. q_num++;
  574. }
  575. }
  576. q_num = 0;
  577. for (i = 0; i < bnad->num_rx; i++) {
  578. if (!bnad->rx_info[i].rx)
  579. continue;
  580. for (j = 0; j < bnad->num_rxp_per_rx; j++) {
  581. sprintf(string, "rxq%d_packets", q_num);
  582. string += ETH_GSTRING_LEN;
  583. sprintf(string, "rxq%d_bytes", q_num);
  584. string += ETH_GSTRING_LEN;
  585. sprintf(string, "rxq%d_packets_with_error",
  586. q_num);
  587. string += ETH_GSTRING_LEN;
  588. sprintf(string, "rxq%d_allocbuf_failed", q_num);
  589. string += ETH_GSTRING_LEN;
  590. sprintf(string, "rxq%d_producer_index", q_num);
  591. string += ETH_GSTRING_LEN;
  592. sprintf(string, "rxq%d_consumer_index", q_num);
  593. string += ETH_GSTRING_LEN;
  594. q_num++;
  595. if (bnad->rx_info[i].rx_ctrl[j].ccb &&
  596. bnad->rx_info[i].rx_ctrl[j].ccb->
  597. rcb[1] &&
  598. bnad->rx_info[i].rx_ctrl[j].ccb->
  599. rcb[1]->rxq) {
  600. sprintf(string, "rxq%d_packets", q_num);
  601. string += ETH_GSTRING_LEN;
  602. sprintf(string, "rxq%d_bytes", q_num);
  603. string += ETH_GSTRING_LEN;
  604. sprintf(string,
  605. "rxq%d_packets_with_error", q_num);
  606. string += ETH_GSTRING_LEN;
  607. sprintf(string, "rxq%d_allocbuf_failed",
  608. q_num);
  609. string += ETH_GSTRING_LEN;
  610. sprintf(string, "rxq%d_producer_index",
  611. q_num);
  612. string += ETH_GSTRING_LEN;
  613. sprintf(string, "rxq%d_consumer_index",
  614. q_num);
  615. string += ETH_GSTRING_LEN;
  616. q_num++;
  617. }
  618. }
  619. }
  620. q_num = 0;
  621. for (i = 0; i < bnad->num_tx; i++) {
  622. if (!bnad->tx_info[i].tx)
  623. continue;
  624. for (j = 0; j < bnad->num_txq_per_tx; j++) {
  625. sprintf(string, "txq%d_packets", q_num);
  626. string += ETH_GSTRING_LEN;
  627. sprintf(string, "txq%d_bytes", q_num);
  628. string += ETH_GSTRING_LEN;
  629. sprintf(string, "txq%d_producer_index", q_num);
  630. string += ETH_GSTRING_LEN;
  631. sprintf(string, "txq%d_consumer_index", q_num);
  632. string += ETH_GSTRING_LEN;
  633. sprintf(string, "txq%d_hw_consumer_index",
  634. q_num);
  635. string += ETH_GSTRING_LEN;
  636. q_num++;
  637. }
  638. }
  639. break;
  640. default:
  641. break;
  642. }
  643. mutex_unlock(&bnad->conf_mutex);
  644. }
  645. static int
  646. bnad_get_stats_count_locked(struct net_device *netdev)
  647. {
  648. struct bnad *bnad = netdev_priv(netdev);
  649. int i, j, count = 0, rxf_active_num = 0, txf_active_num = 0;
  650. u32 bmap;
  651. bmap = bna_tx_rid_mask(&bnad->bna);
  652. for (i = 0; bmap; i++) {
  653. if (bmap & 1)
  654. txf_active_num++;
  655. bmap >>= 1;
  656. }
  657. bmap = bna_rx_rid_mask(&bnad->bna);
  658. for (i = 0; bmap; i++) {
  659. if (bmap & 1)
  660. rxf_active_num++;
  661. bmap >>= 1;
  662. }
  663. count = BNAD_ETHTOOL_STATS_NUM +
  664. txf_active_num * BNAD_NUM_TXF_COUNTERS +
  665. rxf_active_num * BNAD_NUM_RXF_COUNTERS;
  666. for (i = 0; i < bnad->num_rx; i++) {
  667. if (!bnad->rx_info[i].rx)
  668. continue;
  669. count += bnad->num_rxp_per_rx * BNAD_NUM_CQ_COUNTERS;
  670. count += bnad->num_rxp_per_rx * BNAD_NUM_RXQ_COUNTERS;
  671. for (j = 0; j < bnad->num_rxp_per_rx; j++)
  672. if (bnad->rx_info[i].rx_ctrl[j].ccb &&
  673. bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1] &&
  674. bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1]->rxq)
  675. count += BNAD_NUM_RXQ_COUNTERS;
  676. }
  677. for (i = 0; i < bnad->num_tx; i++) {
  678. if (!bnad->tx_info[i].tx)
  679. continue;
  680. count += bnad->num_txq_per_tx * BNAD_NUM_TXQ_COUNTERS;
  681. }
  682. return count;
  683. }
  684. static int
  685. bnad_per_q_stats_fill(struct bnad *bnad, u64 *buf, int bi)
  686. {
  687. int i, j;
  688. struct bna_rcb *rcb = NULL;
  689. struct bna_tcb *tcb = NULL;
  690. for (i = 0; i < bnad->num_rx; i++) {
  691. if (!bnad->rx_info[i].rx)
  692. continue;
  693. for (j = 0; j < bnad->num_rxp_per_rx; j++)
  694. if (bnad->rx_info[i].rx_ctrl[j].ccb &&
  695. bnad->rx_info[i].rx_ctrl[j].ccb->rcb[0] &&
  696. bnad->rx_info[i].rx_ctrl[j].ccb->rcb[0]->rxq) {
  697. buf[bi++] = bnad->rx_info[i].rx_ctrl[j].
  698. ccb->producer_index;
  699. buf[bi++] = 0; /* ccb->consumer_index */
  700. buf[bi++] = *(bnad->rx_info[i].rx_ctrl[j].
  701. ccb->hw_producer_index);
  702. buf[bi++] = bnad->rx_info[i].
  703. rx_ctrl[j].rx_intr_ctr;
  704. buf[bi++] = bnad->rx_info[i].
  705. rx_ctrl[j].rx_poll_ctr;
  706. buf[bi++] = bnad->rx_info[i].
  707. rx_ctrl[j].rx_schedule;
  708. buf[bi++] = bnad->rx_info[i].
  709. rx_ctrl[j].rx_keep_poll;
  710. buf[bi++] = bnad->rx_info[i].
  711. rx_ctrl[j].rx_complete;
  712. }
  713. }
  714. for (i = 0; i < bnad->num_rx; i++) {
  715. if (!bnad->rx_info[i].rx)
  716. continue;
  717. for (j = 0; j < bnad->num_rxp_per_rx; j++)
  718. if (bnad->rx_info[i].rx_ctrl[j].ccb) {
  719. if (bnad->rx_info[i].rx_ctrl[j].ccb->rcb[0] &&
  720. bnad->rx_info[i].rx_ctrl[j].ccb->
  721. rcb[0]->rxq) {
  722. rcb = bnad->rx_info[i].rx_ctrl[j].
  723. ccb->rcb[0];
  724. buf[bi++] = rcb->rxq->rx_packets;
  725. buf[bi++] = rcb->rxq->rx_bytes;
  726. buf[bi++] = rcb->rxq->
  727. rx_packets_with_error;
  728. buf[bi++] = rcb->rxq->
  729. rxbuf_alloc_failed;
  730. buf[bi++] = rcb->producer_index;
  731. buf[bi++] = rcb->consumer_index;
  732. }
  733. if (bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1] &&
  734. bnad->rx_info[i].rx_ctrl[j].ccb->
  735. rcb[1]->rxq) {
  736. rcb = bnad->rx_info[i].rx_ctrl[j].
  737. ccb->rcb[1];
  738. buf[bi++] = rcb->rxq->rx_packets;
  739. buf[bi++] = rcb->rxq->rx_bytes;
  740. buf[bi++] = rcb->rxq->
  741. rx_packets_with_error;
  742. buf[bi++] = rcb->rxq->
  743. rxbuf_alloc_failed;
  744. buf[bi++] = rcb->producer_index;
  745. buf[bi++] = rcb->consumer_index;
  746. }
  747. }
  748. }
  749. for (i = 0; i < bnad->num_tx; i++) {
  750. if (!bnad->tx_info[i].tx)
  751. continue;
  752. for (j = 0; j < bnad->num_txq_per_tx; j++)
  753. if (bnad->tx_info[i].tcb[j] &&
  754. bnad->tx_info[i].tcb[j]->txq) {
  755. tcb = bnad->tx_info[i].tcb[j];
  756. buf[bi++] = tcb->txq->tx_packets;
  757. buf[bi++] = tcb->txq->tx_bytes;
  758. buf[bi++] = tcb->producer_index;
  759. buf[bi++] = tcb->consumer_index;
  760. buf[bi++] = *(tcb->hw_consumer_index);
  761. }
  762. }
  763. return bi;
  764. }
  765. static void
  766. bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats,
  767. u64 *buf)
  768. {
  769. struct bnad *bnad = netdev_priv(netdev);
  770. int i, j, bi;
  771. unsigned long flags;
  772. struct rtnl_link_stats64 *net_stats64;
  773. u64 *stats64;
  774. u32 bmap;
  775. mutex_lock(&bnad->conf_mutex);
  776. if (bnad_get_stats_count_locked(netdev) != stats->n_stats) {
  777. mutex_unlock(&bnad->conf_mutex);
  778. return;
  779. }
  780. /*
  781. * Used bna_lock to sync reads from bna_stats, which is written
  782. * under the same lock
  783. */
  784. spin_lock_irqsave(&bnad->bna_lock, flags);
  785. bi = 0;
  786. memset(buf, 0, stats->n_stats * sizeof(u64));
  787. net_stats64 = (struct rtnl_link_stats64 *)buf;
  788. bnad_netdev_qstats_fill(bnad, net_stats64);
  789. bnad_netdev_hwstats_fill(bnad, net_stats64);
  790. bi = sizeof(*net_stats64) / sizeof(u64);
  791. /* Get netif_queue_stopped from stack */
  792. bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev);
  793. /* Fill driver stats into ethtool buffers */
  794. stats64 = (u64 *)&bnad->stats.drv_stats;
  795. for (i = 0; i < sizeof(struct bnad_drv_stats) / sizeof(u64); i++)
  796. buf[bi++] = stats64[i];
  797. /* Fill hardware stats excluding the rxf/txf into ethtool bufs */
  798. stats64 = (u64 *) &bnad->stats.bna_stats->hw_stats;
  799. for (i = 0;
  800. i < offsetof(struct bfi_enet_stats, rxf_stats[0]) /
  801. sizeof(u64);
  802. i++)
  803. buf[bi++] = stats64[i];
  804. /* Fill txf stats into ethtool buffers */
  805. bmap = bna_tx_rid_mask(&bnad->bna);
  806. for (i = 0; bmap; i++) {
  807. if (bmap & 1) {
  808. stats64 = (u64 *)&bnad->stats.bna_stats->
  809. hw_stats.txf_stats[i];
  810. for (j = 0; j < sizeof(struct bfi_enet_stats_txf) /
  811. sizeof(u64); j++)
  812. buf[bi++] = stats64[j];
  813. }
  814. bmap >>= 1;
  815. }
  816. /* Fill rxf stats into ethtool buffers */
  817. bmap = bna_rx_rid_mask(&bnad->bna);
  818. for (i = 0; bmap; i++) {
  819. if (bmap & 1) {
  820. stats64 = (u64 *)&bnad->stats.bna_stats->
  821. hw_stats.rxf_stats[i];
  822. for (j = 0; j < sizeof(struct bfi_enet_stats_rxf) /
  823. sizeof(u64); j++)
  824. buf[bi++] = stats64[j];
  825. }
  826. bmap >>= 1;
  827. }
  828. /* Fill per Q stats into ethtool buffers */
  829. bi = bnad_per_q_stats_fill(bnad, buf, bi);
  830. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  831. mutex_unlock(&bnad->conf_mutex);
  832. }
  833. static int
  834. bnad_get_sset_count(struct net_device *netdev, int sset)
  835. {
  836. switch (sset) {
  837. case ETH_SS_STATS:
  838. return bnad_get_stats_count_locked(netdev);
  839. default:
  840. return -EOPNOTSUPP;
  841. }
  842. }
  843. static u32
  844. bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
  845. u32 *base_offset)
  846. {
  847. struct bfa_flash_attr *flash_attr;
  848. struct bnad_iocmd_comp fcomp;
  849. u32 i, flash_part = 0, ret;
  850. unsigned long flags = 0;
  851. flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL);
  852. if (!flash_attr)
  853. return 0;
  854. fcomp.bnad = bnad;
  855. fcomp.comp_status = 0;
  856. init_completion(&fcomp.comp);
  857. spin_lock_irqsave(&bnad->bna_lock, flags);
  858. ret = bfa_nw_flash_get_attr(&bnad->bna.flash, flash_attr,
  859. bnad_cb_completion, &fcomp);
  860. if (ret != BFA_STATUS_OK) {
  861. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  862. kfree(flash_attr);
  863. return 0;
  864. }
  865. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  866. wait_for_completion(&fcomp.comp);
  867. ret = fcomp.comp_status;
  868. /* Check for the flash type & base offset value */
  869. if (ret == BFA_STATUS_OK) {
  870. for (i = 0; i < flash_attr->npart; i++) {
  871. if (offset >= flash_attr->part[i].part_off &&
  872. offset < (flash_attr->part[i].part_off +
  873. flash_attr->part[i].part_size)) {
  874. flash_part = flash_attr->part[i].part_type;
  875. *base_offset = flash_attr->part[i].part_off;
  876. break;
  877. }
  878. }
  879. }
  880. kfree(flash_attr);
  881. return flash_part;
  882. }
  883. static int
  884. bnad_get_eeprom_len(struct net_device *netdev)
  885. {
  886. return BFA_TOTAL_FLASH_SIZE;
  887. }
  888. static int
  889. bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
  890. u8 *bytes)
  891. {
  892. struct bnad *bnad = netdev_priv(netdev);
  893. struct bnad_iocmd_comp fcomp;
  894. u32 flash_part = 0, base_offset = 0;
  895. unsigned long flags = 0;
  896. int ret = 0;
  897. /* Fill the magic value */
  898. eeprom->magic = bnad->pcidev->vendor | (bnad->pcidev->device << 16);
  899. /* Query the flash partition based on the offset */
  900. flash_part = bnad_get_flash_partition_by_offset(bnad,
  901. eeprom->offset, &base_offset);
  902. if (flash_part == 0)
  903. return -EFAULT;
  904. fcomp.bnad = bnad;
  905. fcomp.comp_status = 0;
  906. init_completion(&fcomp.comp);
  907. spin_lock_irqsave(&bnad->bna_lock, flags);
  908. ret = bfa_nw_flash_read_part(&bnad->bna.flash, flash_part,
  909. bnad->id, bytes, eeprom->len,
  910. eeprom->offset - base_offset,
  911. bnad_cb_completion, &fcomp);
  912. if (ret != BFA_STATUS_OK) {
  913. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  914. goto done;
  915. }
  916. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  917. wait_for_completion(&fcomp.comp);
  918. ret = fcomp.comp_status;
  919. done:
  920. return ret;
  921. }
  922. static int
  923. bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
  924. u8 *bytes)
  925. {
  926. struct bnad *bnad = netdev_priv(netdev);
  927. struct bnad_iocmd_comp fcomp;
  928. u32 flash_part = 0, base_offset = 0;
  929. unsigned long flags = 0;
  930. int ret = 0;
  931. /* Check if the flash update request is valid */
  932. if (eeprom->magic != (bnad->pcidev->vendor |
  933. (bnad->pcidev->device << 16)))
  934. return -EINVAL;
  935. /* Query the flash partition based on the offset */
  936. flash_part = bnad_get_flash_partition_by_offset(bnad,
  937. eeprom->offset, &base_offset);
  938. if (flash_part == 0)
  939. return -EFAULT;
  940. fcomp.bnad = bnad;
  941. fcomp.comp_status = 0;
  942. init_completion(&fcomp.comp);
  943. spin_lock_irqsave(&bnad->bna_lock, flags);
  944. ret = bfa_nw_flash_update_part(&bnad->bna.flash, flash_part,
  945. bnad->id, bytes, eeprom->len,
  946. eeprom->offset - base_offset,
  947. bnad_cb_completion, &fcomp);
  948. if (ret != BFA_STATUS_OK) {
  949. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  950. goto done;
  951. }
  952. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  953. wait_for_completion(&fcomp.comp);
  954. ret = fcomp.comp_status;
  955. done:
  956. return ret;
  957. }
  958. static int
  959. bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
  960. {
  961. struct bnad *bnad = netdev_priv(netdev);
  962. struct bnad_iocmd_comp fcomp;
  963. const struct firmware *fw;
  964. int ret = 0;
  965. ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev);
  966. if (ret) {
  967. pr_err("BNA: Can't locate firmware %s\n", eflash->data);
  968. goto out;
  969. }
  970. fcomp.bnad = bnad;
  971. fcomp.comp_status = 0;
  972. init_completion(&fcomp.comp);
  973. spin_lock_irq(&bnad->bna_lock);
  974. ret = bfa_nw_flash_update_part(&bnad->bna.flash, BFA_FLASH_PART_FWIMG,
  975. bnad->id, (u8 *)fw->data, fw->size, 0,
  976. bnad_cb_completion, &fcomp);
  977. if (ret != BFA_STATUS_OK) {
  978. pr_warn("BNA: Flash update failed with err: %d\n", ret);
  979. ret = -EIO;
  980. spin_unlock_irq(&bnad->bna_lock);
  981. goto out;
  982. }
  983. spin_unlock_irq(&bnad->bna_lock);
  984. wait_for_completion(&fcomp.comp);
  985. if (fcomp.comp_status != BFA_STATUS_OK) {
  986. ret = -EIO;
  987. pr_warn("BNA: Firmware image update to flash failed with: %d\n",
  988. fcomp.comp_status);
  989. }
  990. out:
  991. release_firmware(fw);
  992. return ret;
  993. }
  994. static const struct ethtool_ops bnad_ethtool_ops = {
  995. .get_settings = bnad_get_settings,
  996. .set_settings = bnad_set_settings,
  997. .get_drvinfo = bnad_get_drvinfo,
  998. .get_wol = bnad_get_wol,
  999. .get_link = ethtool_op_get_link,
  1000. .get_coalesce = bnad_get_coalesce,
  1001. .set_coalesce = bnad_set_coalesce,
  1002. .get_ringparam = bnad_get_ringparam,
  1003. .set_ringparam = bnad_set_ringparam,
  1004. .get_pauseparam = bnad_get_pauseparam,
  1005. .set_pauseparam = bnad_set_pauseparam,
  1006. .get_strings = bnad_get_strings,
  1007. .get_ethtool_stats = bnad_get_ethtool_stats,
  1008. .get_sset_count = bnad_get_sset_count,
  1009. .get_eeprom_len = bnad_get_eeprom_len,
  1010. .get_eeprom = bnad_get_eeprom,
  1011. .set_eeprom = bnad_set_eeprom,
  1012. .flash_device = bnad_flash_device,
  1013. .get_ts_info = ethtool_op_get_ts_info,
  1014. };
  1015. void
  1016. bnad_set_ethtool_ops(struct net_device *netdev)
  1017. {
  1018. netdev->ethtool_ops = &bnad_ethtool_ops;
  1019. }