vmxnet3_ethtool.c 17 KB

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