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