bnad_ethtool.c 29 KB

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