vmxnet3_ethtool.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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. {
  240. return netdev->features;
  241. }
  242. static int
  243. vmxnet3_set_flags(struct net_device *netdev, u32 data)
  244. {
  245. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  246. u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
  247. u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
  248. if (data & ~ETH_FLAG_LRO)
  249. return -EOPNOTSUPP;
  250. if (lro_requested ^ lro_present) {
  251. /* toggle the LRO feature*/
  252. netdev->features ^= NETIF_F_LRO;
  253. /* update harware LRO capability accordingly */
  254. if (lro_requested)
  255. adapter->shared->devRead.misc.uptFeatures &= UPT1_F_LRO;
  256. else
  257. adapter->shared->devRead.misc.uptFeatures &=
  258. ~UPT1_F_LRO;
  259. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
  260. VMXNET3_CMD_UPDATE_FEATURE);
  261. }
  262. return 0;
  263. }
  264. static void
  265. vmxnet3_get_ethtool_stats(struct net_device *netdev,
  266. struct ethtool_stats *stats, u64 *buf)
  267. {
  268. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  269. u8 *base;
  270. int i;
  271. VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
  272. /* this does assume each counter is 64-bit wide */
  273. base = (u8 *)&adapter->tqd_start->stats;
  274. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
  275. *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset);
  276. base = (u8 *)&adapter->tx_queue.stats;
  277. for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
  278. *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset);
  279. base = (u8 *)&adapter->rqd_start->stats;
  280. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
  281. *buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset);
  282. base = (u8 *)&adapter->rx_queue.stats;
  283. for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
  284. *buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset);
  285. base = (u8 *)adapter;
  286. for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++)
  287. *buf++ = *(u64 *)(base + vmxnet3_global_stats[i].offset);
  288. }
  289. static void
  290. vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
  291. {
  292. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  293. u32 *buf = p;
  294. memset(p, 0, vmxnet3_get_regs_len(netdev));
  295. regs->version = 1;
  296. /* Update vmxnet3_get_regs_len if we want to dump more registers */
  297. /* make each ring use multiple of 16 bytes */
  298. buf[0] = adapter->tx_queue.tx_ring.next2fill;
  299. buf[1] = adapter->tx_queue.tx_ring.next2comp;
  300. buf[2] = adapter->tx_queue.tx_ring.gen;
  301. buf[3] = 0;
  302. buf[4] = adapter->tx_queue.comp_ring.next2proc;
  303. buf[5] = adapter->tx_queue.comp_ring.gen;
  304. buf[6] = adapter->tx_queue.stopped;
  305. buf[7] = 0;
  306. buf[8] = adapter->rx_queue.rx_ring[0].next2fill;
  307. buf[9] = adapter->rx_queue.rx_ring[0].next2comp;
  308. buf[10] = adapter->rx_queue.rx_ring[0].gen;
  309. buf[11] = 0;
  310. buf[12] = adapter->rx_queue.rx_ring[1].next2fill;
  311. buf[13] = adapter->rx_queue.rx_ring[1].next2comp;
  312. buf[14] = adapter->rx_queue.rx_ring[1].gen;
  313. buf[15] = 0;
  314. buf[16] = adapter->rx_queue.comp_ring.next2proc;
  315. buf[17] = adapter->rx_queue.comp_ring.gen;
  316. buf[18] = 0;
  317. buf[19] = 0;
  318. }
  319. static void
  320. vmxnet3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  321. {
  322. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  323. wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC;
  324. wol->wolopts = adapter->wol;
  325. }
  326. static int
  327. vmxnet3_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  328. {
  329. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  330. if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST |
  331. WAKE_MAGICSECURE)) {
  332. return -EOPNOTSUPP;
  333. }
  334. adapter->wol = wol->wolopts;
  335. device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
  336. return 0;
  337. }
  338. static int
  339. vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
  340. {
  341. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  342. ecmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full |
  343. SUPPORTED_TP;
  344. ecmd->advertising = ADVERTISED_TP;
  345. ecmd->port = PORT_TP;
  346. ecmd->transceiver = XCVR_INTERNAL;
  347. if (adapter->link_speed) {
  348. ecmd->speed = adapter->link_speed;
  349. ecmd->duplex = DUPLEX_FULL;
  350. } else {
  351. ecmd->speed = -1;
  352. ecmd->duplex = -1;
  353. }
  354. return 0;
  355. }
  356. static void
  357. vmxnet3_get_ringparam(struct net_device *netdev,
  358. struct ethtool_ringparam *param)
  359. {
  360. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  361. param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE;
  362. param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE;
  363. param->rx_mini_max_pending = 0;
  364. param->rx_jumbo_max_pending = 0;
  365. param->rx_pending = adapter->rx_queue.rx_ring[0].size;
  366. param->tx_pending = adapter->tx_queue.tx_ring.size;
  367. param->rx_mini_pending = 0;
  368. param->rx_jumbo_pending = 0;
  369. }
  370. static int
  371. vmxnet3_set_ringparam(struct net_device *netdev,
  372. struct ethtool_ringparam *param)
  373. {
  374. struct vmxnet3_adapter *adapter = netdev_priv(netdev);
  375. u32 new_tx_ring_size, new_rx_ring_size;
  376. u32 sz;
  377. int err = 0;
  378. if (param->tx_pending == 0 || param->tx_pending >
  379. VMXNET3_TX_RING_MAX_SIZE)
  380. return -EINVAL;
  381. if (param->rx_pending == 0 || param->rx_pending >
  382. VMXNET3_RX_RING_MAX_SIZE)
  383. return -EINVAL;
  384. /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */
  385. new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) &
  386. ~VMXNET3_RING_SIZE_MASK;
  387. new_tx_ring_size = min_t(u32, new_tx_ring_size,
  388. VMXNET3_TX_RING_MAX_SIZE);
  389. if (new_tx_ring_size > VMXNET3_TX_RING_MAX_SIZE || (new_tx_ring_size %
  390. VMXNET3_RING_SIZE_ALIGN) != 0)
  391. return -EINVAL;
  392. /* ring0 has to be a multiple of
  393. * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN
  394. */
  395. sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
  396. new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz;
  397. new_rx_ring_size = min_t(u32, new_rx_ring_size,
  398. VMXNET3_RX_RING_MAX_SIZE / sz * sz);
  399. if (new_rx_ring_size > VMXNET3_RX_RING_MAX_SIZE || (new_rx_ring_size %
  400. sz) != 0)
  401. return -EINVAL;
  402. if (new_tx_ring_size == adapter->tx_queue.tx_ring.size &&
  403. new_rx_ring_size == adapter->rx_queue.rx_ring[0].size) {
  404. return 0;
  405. }
  406. /*
  407. * Reset_work may be in the middle of resetting the device, wait for its
  408. * completion.
  409. */
  410. while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
  411. msleep(1);
  412. if (netif_running(netdev)) {
  413. vmxnet3_quiesce_dev(adapter);
  414. vmxnet3_reset_dev(adapter);
  415. /* recreate the rx queue and the tx queue based on the
  416. * new sizes */
  417. vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
  418. vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
  419. err = vmxnet3_create_queues(adapter, new_tx_ring_size,
  420. new_rx_ring_size, VMXNET3_DEF_RX_RING_SIZE);
  421. if (err) {
  422. /* failed, most likely because of OOM, try default
  423. * size */
  424. printk(KERN_ERR "%s: failed to apply new sizes, try the"
  425. " default ones\n", netdev->name);
  426. err = vmxnet3_create_queues(adapter,
  427. VMXNET3_DEF_TX_RING_SIZE,
  428. VMXNET3_DEF_RX_RING_SIZE,
  429. VMXNET3_DEF_RX_RING_SIZE);
  430. if (err) {
  431. printk(KERN_ERR "%s: failed to create queues "
  432. "with default sizes. Closing it\n",
  433. netdev->name);
  434. goto out;
  435. }
  436. }
  437. err = vmxnet3_activate_dev(adapter);
  438. if (err)
  439. printk(KERN_ERR "%s: failed to re-activate, error %d."
  440. " Closing it\n", netdev->name, err);
  441. }
  442. out:
  443. clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
  444. if (err)
  445. vmxnet3_force_close(adapter);
  446. return err;
  447. }
  448. static struct ethtool_ops vmxnet3_ethtool_ops = {
  449. .get_settings = vmxnet3_get_settings,
  450. .get_drvinfo = vmxnet3_get_drvinfo,
  451. .get_regs_len = vmxnet3_get_regs_len,
  452. .get_regs = vmxnet3_get_regs,
  453. .get_wol = vmxnet3_get_wol,
  454. .set_wol = vmxnet3_set_wol,
  455. .get_link = ethtool_op_get_link,
  456. .get_rx_csum = vmxnet3_get_rx_csum,
  457. .set_rx_csum = vmxnet3_set_rx_csum,
  458. .get_tx_csum = ethtool_op_get_tx_csum,
  459. .set_tx_csum = ethtool_op_set_tx_hw_csum,
  460. .get_sg = ethtool_op_get_sg,
  461. .set_sg = ethtool_op_set_sg,
  462. .get_tso = ethtool_op_get_tso,
  463. .set_tso = ethtool_op_set_tso,
  464. .get_strings = vmxnet3_get_strings,
  465. .get_flags = vmxnet3_get_flags,
  466. .set_flags = vmxnet3_set_flags,
  467. .get_sset_count = vmxnet3_get_sset_count,
  468. .get_ethtool_stats = vmxnet3_get_ethtool_stats,
  469. .get_ringparam = vmxnet3_get_ringparam,
  470. .set_ringparam = vmxnet3_set_ringparam,
  471. };
  472. void vmxnet3_set_ethtool_ops(struct net_device *netdev)
  473. {
  474. SET_ETHTOOL_OPS(netdev, &vmxnet3_ethtool_ops);
  475. }