bnad_ethtool.c 29 KB

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