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_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, -1);
  247. cmd->duplex = -1;
  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. /* Check if the flash read request is valid */
  898. if (eeprom->magic != (bnad->pcidev->vendor |
  899. (bnad->pcidev->device << 16)))
  900. return -EFAULT;
  901. /* Query the flash partition based on the offset */
  902. flash_part = bnad_get_flash_partition_by_offset(bnad,
  903. eeprom->offset, &base_offset);
  904. if (flash_part == 0)
  905. return -EFAULT;
  906. fcomp.bnad = bnad;
  907. fcomp.comp_status = 0;
  908. init_completion(&fcomp.comp);
  909. spin_lock_irqsave(&bnad->bna_lock, flags);
  910. ret = bfa_nw_flash_read_part(&bnad->bna.flash, flash_part,
  911. bnad->id, bytes, eeprom->len,
  912. eeprom->offset - base_offset,
  913. bnad_cb_completion, &fcomp);
  914. if (ret != BFA_STATUS_OK) {
  915. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  916. goto done;
  917. }
  918. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  919. wait_for_completion(&fcomp.comp);
  920. ret = fcomp.comp_status;
  921. done:
  922. return ret;
  923. }
  924. static int
  925. bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
  926. u8 *bytes)
  927. {
  928. struct bnad *bnad = netdev_priv(netdev);
  929. struct bnad_iocmd_comp fcomp;
  930. u32 flash_part = 0, base_offset = 0;
  931. unsigned long flags = 0;
  932. int ret = 0;
  933. /* Check if the flash update request is valid */
  934. if (eeprom->magic != (bnad->pcidev->vendor |
  935. (bnad->pcidev->device << 16)))
  936. return -EINVAL;
  937. /* Query the flash partition based on the offset */
  938. flash_part = bnad_get_flash_partition_by_offset(bnad,
  939. eeprom->offset, &base_offset);
  940. if (flash_part == 0)
  941. return -EFAULT;
  942. fcomp.bnad = bnad;
  943. fcomp.comp_status = 0;
  944. init_completion(&fcomp.comp);
  945. spin_lock_irqsave(&bnad->bna_lock, flags);
  946. ret = bfa_nw_flash_update_part(&bnad->bna.flash, flash_part,
  947. bnad->id, bytes, eeprom->len,
  948. eeprom->offset - base_offset,
  949. bnad_cb_completion, &fcomp);
  950. if (ret != BFA_STATUS_OK) {
  951. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  952. goto done;
  953. }
  954. spin_unlock_irqrestore(&bnad->bna_lock, flags);
  955. wait_for_completion(&fcomp.comp);
  956. ret = fcomp.comp_status;
  957. done:
  958. return ret;
  959. }
  960. static int
  961. bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
  962. {
  963. struct bnad *bnad = netdev_priv(netdev);
  964. struct bnad_iocmd_comp fcomp;
  965. const struct firmware *fw;
  966. int ret = 0;
  967. ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev);
  968. if (ret) {
  969. pr_err("BNA: Can't locate firmware %s\n", eflash->data);
  970. goto out;
  971. }
  972. fcomp.bnad = bnad;
  973. fcomp.comp_status = 0;
  974. init_completion(&fcomp.comp);
  975. spin_lock_irq(&bnad->bna_lock);
  976. ret = bfa_nw_flash_update_part(&bnad->bna.flash, BFA_FLASH_PART_FWIMG,
  977. bnad->id, (u8 *)fw->data, fw->size, 0,
  978. bnad_cb_completion, &fcomp);
  979. if (ret != BFA_STATUS_OK) {
  980. pr_warn("BNA: Flash update failed with err: %d\n", ret);
  981. ret = -EIO;
  982. spin_unlock_irq(&bnad->bna_lock);
  983. goto out;
  984. }
  985. spin_unlock_irq(&bnad->bna_lock);
  986. wait_for_completion(&fcomp.comp);
  987. if (fcomp.comp_status != BFA_STATUS_OK) {
  988. ret = -EIO;
  989. pr_warn("BNA: Firmware image update to flash failed with: %d\n",
  990. fcomp.comp_status);
  991. }
  992. out:
  993. release_firmware(fw);
  994. return ret;
  995. }
  996. static const struct ethtool_ops bnad_ethtool_ops = {
  997. .get_settings = bnad_get_settings,
  998. .set_settings = bnad_set_settings,
  999. .get_drvinfo = bnad_get_drvinfo,
  1000. .get_wol = bnad_get_wol,
  1001. .get_link = ethtool_op_get_link,
  1002. .get_coalesce = bnad_get_coalesce,
  1003. .set_coalesce = bnad_set_coalesce,
  1004. .get_ringparam = bnad_get_ringparam,
  1005. .set_ringparam = bnad_set_ringparam,
  1006. .get_pauseparam = bnad_get_pauseparam,
  1007. .set_pauseparam = bnad_set_pauseparam,
  1008. .get_strings = bnad_get_strings,
  1009. .get_ethtool_stats = bnad_get_ethtool_stats,
  1010. .get_sset_count = bnad_get_sset_count,
  1011. .get_eeprom_len = bnad_get_eeprom_len,
  1012. .get_eeprom = bnad_get_eeprom,
  1013. .set_eeprom = bnad_set_eeprom,
  1014. .flash_device = bnad_flash_device,
  1015. };
  1016. void
  1017. bnad_set_ethtool_ops(struct net_device *netdev)
  1018. {
  1019. SET_ETHTOOL_OPS(netdev, &bnad_ethtool_ops);
  1020. }