vmxnet3_ethtool.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. /*
  2. * Linux driver for VMware's vmxnet3 ethernet NIC.
  3. *
  4. * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; version 2 of the License and no later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  13. * NON INFRINGEMENT. See the GNU General Public License for more
  14. * details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * The full GNU General Public License is included in this distribution in
  21. * the file called "COPYING".
  22. *
  23. * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
  24. *
  25. */
  26. #include "vmxnet3_int.h"
  27. struct vmxnet3_stat_desc {
  28. char desc[ETH_GSTRING_LEN];
  29. int offset;
  30. };
  31. static u32
  32. vmxnet3_get_rx_csum(struct net_device *netdev)
  33. {
  34. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  35. return adapter->rxcsum;
  36. }
  37. static int
  38. vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
  39. {
  40. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  41. if (adapter->rxcsum != val) {
  42. adapter->rxcsum = val;
  43. if (netif_running(netdev)) {
  44. if (val)
  45. adapter->shared->devRead.misc.uptFeatures |=
  46. UPT1_F_RXCSUM;
  47. else
  48. adapter->shared->devRead.misc.uptFeatures &=
  49. ~UPT1_F_RXCSUM;
  50. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
  51. VMXNET3_CMD_UPDATE_FEATURE);
  52. }
  53. }
  54. return 0;
  55. }
  56. /* per tq stats maintained by the device */
  57. static const struct vmxnet3_stat_desc
  58. vmxnet3_tq_dev_stats[] = {
  59. /* description, offset */
  60. { "TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) },
  61. { "TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) },
  62. { "ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) },
  63. { "ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) },
  64. { "mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) },
  65. { "mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) },
  66. { "bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) },
  67. { "bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) },
  68. { "pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) },
  69. { "pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) },
  70. };
  71. /* per tq stats maintained by the driver */
  72. static const struct vmxnet3_stat_desc
  73. vmxnet3_tq_driver_stats[] = {
  74. /* description, offset */
  75. {"drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats,
  76. drop_total) },
  77. { " too many frags", offsetof(struct vmxnet3_tq_driver_stats,
  78. drop_too_many_frags) },
  79. { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
  80. drop_oversized_hdr) },
  81. { " hdr err", offsetof(struct vmxnet3_tq_driver_stats,
  82. drop_hdr_inspect_err) },
  83. { " tso", offsetof(struct vmxnet3_tq_driver_stats,
  84. drop_tso) },
  85. { "ring full", offsetof(struct vmxnet3_tq_driver_stats,
  86. tx_ring_full) },
  87. { "pkts linearized", offsetof(struct vmxnet3_tq_driver_stats,
  88. linearized) },
  89. { "hdr cloned", offsetof(struct vmxnet3_tq_driver_stats,
  90. copy_skb_header) },
  91. { "giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
  92. oversized_hdr) },
  93. };
  94. /* per rq stats maintained by the device */
  95. static const struct vmxnet3_stat_desc
  96. vmxnet3_rq_dev_stats[] = {
  97. { "LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) },
  98. { "LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) },
  99. { "ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) },
  100. { "ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) },
  101. { "mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) },
  102. { "mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) },
  103. { "bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) },
  104. { "bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) },
  105. { "pkts rx out of buf", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) },
  106. { "pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) },
  107. };
  108. /* per rq stats maintained by the driver */
  109. static const struct vmxnet3_stat_desc
  110. vmxnet3_rq_driver_stats[] = {
  111. /* description, offset */
  112. { "drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats,
  113. drop_total) },
  114. { " err", offsetof(struct vmxnet3_rq_driver_stats,
  115. drop_err) },
  116. { " fcs", offsetof(struct vmxnet3_rq_driver_stats,
  117. drop_fcs) },
  118. { "rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats,
  119. rx_buf_alloc_failure) },
  120. };
  121. /* gloabl stats maintained by the driver */
  122. static const struct vmxnet3_stat_desc
  123. vmxnet3_global_stats[] = {
  124. /* description, offset */
  125. { "tx timeout count", offsetof(struct vmxnet3_adapter,
  126. tx_timeout_count) }
  127. };
  128. struct net_device_stats *
  129. vmxnet3_get_stats(struct net_device *netdev)
  130. {
  131. struct vmxnet3_adapter *adapter;
  132. struct vmxnet3_tq_driver_stats *drvTxStats;
  133. struct vmxnet3_rq_driver_stats *drvRxStats;
  134. struct UPT1_TxStats *devTxStats;
  135. struct UPT1_RxStats *devRxStats;
  136. struct net_device_stats *net_stats = &netdev->stats;
  137. adapter = netdev_priv(netdev);
  138. /* Collect the dev stats into the shared area */
  139. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
  140. /* Assuming that we have a single queue device */
  141. devTxStats = &adapter->tqd_start->stats;
  142. devRxStats = &adapter->rqd_start->stats;
  143. /* Get access to the driver stats per queue */
  144. drvTxStats = &adapter->tx_queue.stats;
  145. drvRxStats = &adapter->rx_queue.stats;
  146. memset(net_stats, 0, sizeof(*net_stats));
  147. net_stats->rx_packets = devRxStats->ucastPktsRxOK +
  148. devRxStats->mcastPktsRxOK +
  149. devRxStats->bcastPktsRxOK;
  150. net_stats->tx_packets = devTxStats->ucastPktsTxOK +
  151. devTxStats->mcastPktsTxOK +
  152. devTxStats->bcastPktsTxOK;
  153. net_stats->rx_bytes = devRxStats->ucastBytesRxOK +
  154. devRxStats->mcastBytesRxOK +
  155. devRxStats->bcastBytesRxOK;
  156. net_stats->tx_bytes = devTxStats->ucastBytesTxOK +
  157. devTxStats->mcastBytesTxOK +
  158. devTxStats->bcastBytesTxOK;
  159. net_stats->rx_errors = devRxStats->pktsRxError;
  160. net_stats->tx_errors = devTxStats->pktsTxError;
  161. net_stats->rx_dropped = drvRxStats->drop_total;
  162. net_stats->tx_dropped = drvTxStats->drop_total;
  163. net_stats->multicast = devRxStats->mcastPktsRxOK;
  164. return net_stats;
  165. }
  166. static int
  167. vmxnet3_get_sset_count(struct net_device *netdev, int sset)
  168. {
  169. switch (sset) {
  170. case ETH_SS_STATS:
  171. return ARRAY_SIZE(vmxnet3_tq_dev_stats) +
  172. ARRAY_SIZE(vmxnet3_tq_driver_stats) +
  173. ARRAY_SIZE(vmxnet3_rq_dev_stats) +
  174. ARRAY_SIZE(vmxnet3_rq_driver_stats) +
  175. ARRAY_SIZE(vmxnet3_global_stats);
  176. default:
  177. return -EOPNOTSUPP;
  178. }
  179. }
  180. static int
  181. vmxnet3_get_regs_len(struct net_device *netdev)
  182. {
  183. return 20 * sizeof(u32);
  184. }
  185. static void
  186. vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
  187. {
  188. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  189. strlcpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver));
  190. drvinfo->driver[sizeof(drvinfo->driver) - 1] = '\0';
  191. strlcpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT,
  192. sizeof(drvinfo->version));
  193. drvinfo->driver[sizeof(drvinfo->version) - 1] = '\0';
  194. strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
  195. drvinfo->fw_version[sizeof(drvinfo->fw_version) - 1] = '\0';
  196. strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
  197. ETHTOOL_BUSINFO_LEN);
  198. drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS);
  199. drvinfo->testinfo_len = 0;
  200. drvinfo->eedump_len = 0;
  201. drvinfo->regdump_len = vmxnet3_get_regs_len(netdev);
  202. }
  203. static void
  204. vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
  205. {
  206. if (stringset == ETH_SS_STATS) {
  207. int i;
  208. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) {
  209. memcpy(buf, vmxnet3_tq_dev_stats[i].desc,
  210. ETH_GSTRING_LEN);
  211. buf += ETH_GSTRING_LEN;
  212. }
  213. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) {
  214. memcpy(buf, vmxnet3_tq_driver_stats[i].desc,
  215. ETH_GSTRING_LEN);
  216. buf += ETH_GSTRING_LEN;
  217. }
  218. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) {
  219. memcpy(buf, vmxnet3_rq_dev_stats[i].desc,
  220. ETH_GSTRING_LEN);
  221. buf += ETH_GSTRING_LEN;
  222. }
  223. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) {
  224. memcpy(buf, vmxnet3_rq_driver_stats[i].desc,
  225. ETH_GSTRING_LEN);
  226. buf += ETH_GSTRING_LEN;
  227. }
  228. for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) {
  229. memcpy(buf, vmxnet3_global_stats[i].desc,
  230. ETH_GSTRING_LEN);
  231. buf += ETH_GSTRING_LEN;
  232. }
  233. }
  234. }
  235. static u32
  236. vmxnet3_get_flags(struct net_device *netdev) {
  237. return netdev->features;
  238. }
  239. static int
  240. vmxnet3_set_flags(struct net_device *netdev, u32 data) {
  241. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  242. u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
  243. u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
  244. if (lro_requested ^ lro_present) {
  245. /* toggle the LRO feature*/
  246. netdev->features ^= NETIF_F_LRO;
  247. /* update harware LRO capability accordingly */
  248. if (lro_requested)
  249. adapter->shared->devRead.misc.uptFeatures &= UPT1_F_LRO;
  250. else
  251. adapter->shared->devRead.misc.uptFeatures &=
  252. ~UPT1_F_LRO;
  253. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
  254. VMXNET3_CMD_UPDATE_FEATURE);
  255. }
  256. return 0;
  257. }
  258. static void
  259. vmxnet3_get_ethtool_stats(struct net_device *netdev,
  260. struct ethtool_stats *stats, u64 *buf)
  261. {
  262. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  263. u8 *base;
  264. int i;
  265. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
  266. /* this does assume each counter is 64-bit wide */
  267. base = (u8 *)&adapter->tqd_start->stats;
  268. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
  269. *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset);
  270. base = (u8 *)&adapter->tx_queue.stats;
  271. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
  272. *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset);
  273. base = (u8 *)&adapter->rqd_start->stats;
  274. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
  275. *buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset);
  276. base = (u8 *)&adapter->rx_queue.stats;
  277. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
  278. *buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset);
  279. base = (u8 *)adapter;
  280. for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++)
  281. *buf++ = *(u64 *)(base + vmxnet3_global_stats[i].offset);
  282. }
  283. static void
  284. vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
  285. {
  286. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  287. u32 *buf = p;
  288. memset(p, 0, vmxnet3_get_regs_len(netdev));
  289. regs->version = 1;
  290. /* Update vmxnet3_get_regs_len if we want to dump more registers */
  291. /* make each ring use multiple of 16 bytes */
  292. buf[0] = adapter->tx_queue.tx_ring.next2fill;
  293. buf[1] = adapter->tx_queue.tx_ring.next2comp;
  294. buf[2] = adapter->tx_queue.tx_ring.gen;
  295. buf[3] = 0;
  296. buf[4] = adapter->tx_queue.comp_ring.next2proc;
  297. buf[5] = adapter->tx_queue.comp_ring.gen;
  298. buf[6] = adapter->tx_queue.stopped;
  299. buf[7] = 0;
  300. buf[8] = adapter->rx_queue.rx_ring[0].next2fill;
  301. buf[9] = adapter->rx_queue.rx_ring[0].next2comp;
  302. buf[10] = adapter->rx_queue.rx_ring[0].gen;
  303. buf[11] = 0;
  304. buf[12] = adapter->rx_queue.rx_ring[1].next2fill;
  305. buf[13] = adapter->rx_queue.rx_ring[1].next2comp;
  306. buf[14] = adapter->rx_queue.rx_ring[1].gen;
  307. buf[15] = 0;
  308. buf[16] = adapter->rx_queue.comp_ring.next2proc;
  309. buf[17] = adapter->rx_queue.comp_ring.gen;
  310. buf[18] = 0;
  311. buf[19] = 0;
  312. }
  313. static void
  314. vmxnet3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  315. {
  316. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  317. wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC;
  318. wol->wolopts = adapter->wol;
  319. }
  320. static int
  321. vmxnet3_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  322. {
  323. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  324. if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST |
  325. WAKE_MAGICSECURE)) {
  326. return -EOPNOTSUPP;
  327. }
  328. adapter->wol = wol->wolopts;
  329. device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
  330. return 0;
  331. }
  332. static int
  333. vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
  334. {
  335. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  336. ecmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full |
  337. SUPPORTED_TP;
  338. ecmd->advertising = ADVERTISED_TP;
  339. ecmd->port = PORT_TP;
  340. ecmd->transceiver = XCVR_INTERNAL;
  341. if (adapter->link_speed) {
  342. ecmd->speed = adapter->link_speed;
  343. ecmd->duplex = DUPLEX_FULL;
  344. } else {
  345. ecmd->speed = -1;
  346. ecmd->duplex = -1;
  347. }
  348. return 0;
  349. }
  350. static void
  351. vmxnet3_get_ringparam(struct net_device *netdev,
  352. struct ethtool_ringparam *param)
  353. {
  354. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  355. param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE;
  356. param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE;
  357. param->rx_mini_max_pending = 0;
  358. param->rx_jumbo_max_pending = 0;
  359. param->rx_pending = adapter->rx_queue.rx_ring[0].size;
  360. param->tx_pending = adapter->tx_queue.tx_ring.size;
  361. param->rx_mini_pending = 0;
  362. param->rx_jumbo_pending = 0;
  363. }
  364. static int
  365. vmxnet3_set_ringparam(struct net_device *netdev,
  366. struct ethtool_ringparam *param)
  367. {
  368. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  369. u32 new_tx_ring_size, new_rx_ring_size;
  370. u32 sz;
  371. int err = 0;
  372. if (param->tx_pending == 0 || param->tx_pending >
  373. VMXNET3_TX_RING_MAX_SIZE)
  374. return -EINVAL;
  375. if (param->rx_pending == 0 || param->rx_pending >
  376. VMXNET3_RX_RING_MAX_SIZE)
  377. return -EINVAL;
  378. /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */
  379. new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) &
  380. ~VMXNET3_RING_SIZE_MASK;
  381. new_tx_ring_size = min_t(u32, new_tx_ring_size,
  382. VMXNET3_TX_RING_MAX_SIZE);
  383. if (new_tx_ring_size > VMXNET3_TX_RING_MAX_SIZE || (new_tx_ring_size %
  384. VMXNET3_RING_SIZE_ALIGN) != 0)
  385. return -EINVAL;
  386. /* ring0 has to be a multiple of
  387. * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN
  388. */
  389. sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
  390. new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz;
  391. new_rx_ring_size = min_t(u32, new_rx_ring_size,
  392. VMXNET3_RX_RING_MAX_SIZE / sz * sz);
  393. if (new_rx_ring_size > VMXNET3_RX_RING_MAX_SIZE || (new_rx_ring_size %
  394. sz) != 0)
  395. return -EINVAL;
  396. if (new_tx_ring_size == adapter->tx_queue.tx_ring.size &&
  397. new_rx_ring_size == adapter->rx_queue.rx_ring[0].size) {
  398. return 0;
  399. }
  400. /*
  401. * Reset_work may be in the middle of resetting the device, wait for its
  402. * completion.
  403. */
  404. while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
  405. msleep(1);
  406. if (netif_running(netdev)) {
  407. vmxnet3_quiesce_dev(adapter);
  408. vmxnet3_reset_dev(adapter);
  409. /* recreate the rx queue and the tx queue based on the
  410. * new sizes */
  411. vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
  412. vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
  413. err = vmxnet3_create_queues(adapter, new_tx_ring_size,
  414. new_rx_ring_size, VMXNET3_DEF_RX_RING_SIZE);
  415. if (err) {
  416. /* failed, most likely because of OOM, try default
  417. * size */
  418. printk(KERN_ERR "%s: failed to apply new sizes, try the"
  419. " default ones\n", netdev->name);
  420. err = vmxnet3_create_queues(adapter,
  421. VMXNET3_DEF_TX_RING_SIZE,
  422. VMXNET3_DEF_RX_RING_SIZE,
  423. VMXNET3_DEF_RX_RING_SIZE);
  424. if (err) {
  425. printk(KERN_ERR "%s: failed to create queues "
  426. "with default sizes. Closing it\n",
  427. netdev->name);
  428. goto out;
  429. }
  430. }
  431. err = vmxnet3_activate_dev(adapter);
  432. if (err)
  433. printk(KERN_ERR "%s: failed to re-activate, error %d."
  434. " Closing it\n", netdev->name, err);
  435. }
  436. out:
  437. clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
  438. if (err)
  439. vmxnet3_force_close(adapter);
  440. return err;
  441. }
  442. static struct ethtool_ops vmxnet3_ethtool_ops = {
  443. .get_settings = vmxnet3_get_settings,
  444. .get_drvinfo = vmxnet3_get_drvinfo,
  445. .get_regs_len = vmxnet3_get_regs_len,
  446. .get_regs = vmxnet3_get_regs,
  447. .get_wol = vmxnet3_get_wol,
  448. .set_wol = vmxnet3_set_wol,
  449. .get_link = ethtool_op_get_link,
  450. .get_rx_csum = vmxnet3_get_rx_csum,
  451. .set_rx_csum = vmxnet3_set_rx_csum,
  452. .get_tx_csum = ethtool_op_get_tx_csum,
  453. .set_tx_csum = ethtool_op_set_tx_hw_csum,
  454. .get_sg = ethtool_op_get_sg,
  455. .set_sg = ethtool_op_set_sg,
  456. .get_tso = ethtool_op_get_tso,
  457. .set_tso = ethtool_op_set_tso,
  458. .get_strings = vmxnet3_get_strings,
  459. .get_flags = vmxnet3_get_flags,
  460. .set_flags = vmxnet3_set_flags,
  461. .get_sset_count = vmxnet3_get_sset_count,
  462. .get_ethtool_stats = vmxnet3_get_ethtool_stats,
  463. .get_ringparam = vmxnet3_get_ringparam,
  464. .set_ringparam = vmxnet3_set_ringparam,
  465. };
  466. void vmxnet3_set_ethtool_ops(struct net_device *netdev)
  467. {
  468. SET_ETHTOOL_OPS(netdev, &vmxnet3_ethtool_ops);
  469. }