OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [core/] [ethtool.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1278 phoenix
/*
2
 * net/core/ethtool.c - Ethtool ioctl handler
3
 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
4
 *
5
 * This file is where we call all the ethtool_ops commands to get
6
 * the information ethtool needs.  We fall back to calling do_ioctl()
7
 * for drivers which haven't been converted to ethtool_ops yet.
8
 *
9
 * It's GPL, stupid.
10
 */
11
 
12
#include <linux/types.h>
13
#include <linux/errno.h>
14
#include <linux/ethtool.h>
15
#include <linux/netdevice.h>
16
#include <asm/uaccess.h>
17
 
18
/*
19
 * Some useful ethtool_ops methods that're device independent.
20
 * If we find that all drivers want to do the same thing here,
21
 * we can turn these into dev_() function calls.
22
 */
23
 
24
u32 ethtool_op_get_link(struct net_device *dev)
25
{
26
        return netif_carrier_ok(dev) ? 1 : 0;
27
}
28
 
29
u32 ethtool_op_get_tx_csum(struct net_device *dev)
30
{
31
        return (dev->features & NETIF_F_IP_CSUM) != 0;
32
}
33
 
34
int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
35
{
36
        if (data)
37
                dev->features |= NETIF_F_IP_CSUM;
38
        else
39
                dev->features &= ~NETIF_F_IP_CSUM;
40
 
41
        return 0;
42
}
43
 
44
u32 ethtool_op_get_sg(struct net_device *dev)
45
{
46
        return (dev->features & NETIF_F_SG) != 0;
47
}
48
 
49
int ethtool_op_set_sg(struct net_device *dev, u32 data)
50
{
51
        if (data)
52
                dev->features |= NETIF_F_SG;
53
        else
54
                dev->features &= ~NETIF_F_SG;
55
 
56
        return 0;
57
}
58
 
59
/* Handlers for each ethtool command */
60
 
61
static int ethtool_get_settings(struct net_device *dev, void *useraddr)
62
{
63
        struct ethtool_cmd cmd = { ETHTOOL_GSET };
64
        int err;
65
 
66
        if (!dev->ethtool_ops->get_settings)
67
                return -EOPNOTSUPP;
68
 
69
        err = dev->ethtool_ops->get_settings(dev, &cmd);
70
        if (err < 0)
71
                return err;
72
 
73
        if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
74
                return -EFAULT;
75
        return 0;
76
}
77
 
78
static int ethtool_set_settings(struct net_device *dev, void *useraddr)
79
{
80
        struct ethtool_cmd cmd;
81
 
82
        if (!dev->ethtool_ops->set_settings)
83
                return -EOPNOTSUPP;
84
 
85
        if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
86
                return -EFAULT;
87
 
88
        return dev->ethtool_ops->set_settings(dev, &cmd);
89
}
90
 
91
static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
92
{
93
        struct ethtool_drvinfo info;
94
        struct ethtool_ops *ops = dev->ethtool_ops;
95
 
96
        if (!ops->get_drvinfo)
97
                return -EOPNOTSUPP;
98
 
99
        memset(&info, 0, sizeof(info));
100
        info.cmd = ETHTOOL_GDRVINFO;
101
        ops->get_drvinfo(dev, &info);
102
 
103
        if (ops->self_test_count)
104
                info.testinfo_len = ops->self_test_count(dev);
105
        if (ops->get_stats_count)
106
                info.n_stats = ops->get_stats_count(dev);
107
        if (ops->get_regs_len)
108
                info.regdump_len = ops->get_regs_len(dev);
109
        if (ops->get_eeprom_len)
110
                info.eedump_len = ops->get_eeprom_len(dev);
111
 
112
        if (copy_to_user(useraddr, &info, sizeof(info)))
113
                return -EFAULT;
114
        return 0;
115
}
116
 
117
static int ethtool_get_regs(struct net_device *dev, char *useraddr)
118
{
119
        struct ethtool_regs regs;
120
        struct ethtool_ops *ops = dev->ethtool_ops;
121
        void *regbuf;
122
        int reglen, ret;
123
 
124
        if (!ops->get_regs || !ops->get_regs_len)
125
                return -EOPNOTSUPP;
126
 
127
        if (copy_from_user(&regs, useraddr, sizeof(regs)))
128
                return -EFAULT;
129
 
130
        reglen = ops->get_regs_len(dev);
131
        if (regs.len > reglen)
132
                regs.len = reglen;
133
 
134
        regbuf = kmalloc(reglen, GFP_USER);
135
        if (!regbuf)
136
                return -ENOMEM;
137
 
138
        ops->get_regs(dev, &regs, regbuf);
139
 
140
        ret = -EFAULT;
141
        if (copy_to_user(useraddr, &regs, sizeof(regs)))
142
                goto out;
143
        useraddr += offsetof(struct ethtool_regs, data);
144
        if (copy_to_user(useraddr, regbuf, reglen))
145
                goto out;
146
        ret = 0;
147
 
148
 out:
149
        kfree(regbuf);
150
        return ret;
151
}
152
 
153
static int ethtool_get_wol(struct net_device *dev, char *useraddr)
154
{
155
        struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
156
 
157
        if (!dev->ethtool_ops->get_wol)
158
                return -EOPNOTSUPP;
159
 
160
        dev->ethtool_ops->get_wol(dev, &wol);
161
 
162
        if (copy_to_user(useraddr, &wol, sizeof(wol)))
163
                return -EFAULT;
164
        return 0;
165
}
166
 
167
static int ethtool_set_wol(struct net_device *dev, char *useraddr)
168
{
169
        struct ethtool_wolinfo wol;
170
 
171
        if (!dev->ethtool_ops->set_wol)
172
                return -EOPNOTSUPP;
173
 
174
        if (copy_from_user(&wol, useraddr, sizeof(wol)))
175
                return -EFAULT;
176
 
177
        return dev->ethtool_ops->set_wol(dev, &wol);
178
}
179
 
180
static int ethtool_get_msglevel(struct net_device *dev, char *useraddr)
181
{
182
        struct ethtool_value edata = { ETHTOOL_GMSGLVL };
183
 
184
        if (!dev->ethtool_ops->get_msglevel)
185
                return -EOPNOTSUPP;
186
 
187
        edata.data = dev->ethtool_ops->get_msglevel(dev);
188
 
189
        if (copy_to_user(useraddr, &edata, sizeof(edata)))
190
                return -EFAULT;
191
        return 0;
192
}
193
 
194
static int ethtool_set_msglevel(struct net_device *dev, char *useraddr)
195
{
196
        struct ethtool_value edata;
197
 
198
        if (!dev->ethtool_ops->set_msglevel)
199
                return -EOPNOTSUPP;
200
 
201
        if (copy_from_user(&edata, useraddr, sizeof(edata)))
202
                return -EFAULT;
203
 
204
        dev->ethtool_ops->set_msglevel(dev, edata.data);
205
        return 0;
206
}
207
 
208
static int ethtool_nway_reset(struct net_device *dev)
209
{
210
        if (!dev->ethtool_ops->nway_reset)
211
                return -EOPNOTSUPP;
212
 
213
        return dev->ethtool_ops->nway_reset(dev);
214
}
215
 
216
static int ethtool_get_link(struct net_device *dev, void *useraddr)
217
{
218
        struct ethtool_value edata = { ETHTOOL_GLINK };
219
 
220
        if (!dev->ethtool_ops->get_link)
221
                return -EOPNOTSUPP;
222
 
223
        edata.data = dev->ethtool_ops->get_link(dev);
224
 
225
        if (copy_to_user(useraddr, &edata, sizeof(edata)))
226
                return -EFAULT;
227
        return 0;
228
}
229
 
230
static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
231
{
232
        struct ethtool_eeprom eeprom;
233
        struct ethtool_ops *ops = dev->ethtool_ops;
234
        u8 *data;
235
        int ret;
236
 
237
        if (!ops->get_eeprom || !ops->get_eeprom_len)
238
                return -EOPNOTSUPP;
239
 
240
        if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
241
                return -EFAULT;
242
 
243
        /* Check for wrap and zero */
244
        if (eeprom.offset + eeprom.len <= eeprom.offset)
245
                return -EINVAL;
246
 
247
        /* Check for exceeding total eeprom len */
248
        if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
249
                return -EINVAL;
250
 
251
        data = kmalloc(eeprom.len, GFP_USER);
252
        if (!data)
253
                return -ENOMEM;
254
 
255
        ret = -EFAULT;
256
        if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
257
                goto out;
258
 
259
        ret = ops->get_eeprom(dev, &eeprom, data);
260
        if (ret)
261
                goto out;
262
 
263
        ret = -EFAULT;
264
        if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
265
                goto out;
266
        if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
267
                goto out;
268
        ret = 0;
269
 
270
 out:
271
        kfree(data);
272
        return ret;
273
}
274
 
275
static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
276
{
277
        struct ethtool_eeprom eeprom;
278
        struct ethtool_ops *ops = dev->ethtool_ops;
279
        u8 *data;
280
        int ret;
281
 
282
        if (!ops->set_eeprom || !ops->get_eeprom_len)
283
                return -EOPNOTSUPP;
284
 
285
        if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
286
                return -EFAULT;
287
 
288
        /* Check for wrap and zero */
289
        if (eeprom.offset + eeprom.len <= eeprom.offset)
290
                return -EINVAL;
291
 
292
        /* Check for exceeding total eeprom len */
293
        if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
294
                return -EINVAL;
295
 
296
        data = kmalloc(eeprom.len, GFP_USER);
297
        if (!data)
298
                return -ENOMEM;
299
 
300
        ret = -EFAULT;
301
        if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
302
                goto out;
303
 
304
        ret = ops->set_eeprom(dev, &eeprom, data);
305
        if (ret)
306
                goto out;
307
 
308
        if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
309
                ret = -EFAULT;
310
 
311
 out:
312
        kfree(data);
313
        return ret;
314
}
315
 
316
static int ethtool_get_coalesce(struct net_device *dev, void *useraddr)
317
{
318
        struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE };
319
 
320
        if (!dev->ethtool_ops->get_coalesce)
321
                return -EOPNOTSUPP;
322
 
323
        dev->ethtool_ops->get_coalesce(dev, &coalesce);
324
 
325
        if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
326
                return -EFAULT;
327
        return 0;
328
}
329
 
330
static int ethtool_set_coalesce(struct net_device *dev, void *useraddr)
331
{
332
        struct ethtool_coalesce coalesce;
333
 
334
        if (!dev->ethtool_ops->get_coalesce)
335
                return -EOPNOTSUPP;
336
 
337
        if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
338
                return -EFAULT;
339
 
340
        return dev->ethtool_ops->set_coalesce(dev, &coalesce);
341
}
342
 
343
static int ethtool_get_ringparam(struct net_device *dev, void *useraddr)
344
{
345
        struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM };
346
 
347
        if (!dev->ethtool_ops->get_ringparam)
348
                return -EOPNOTSUPP;
349
 
350
        dev->ethtool_ops->get_ringparam(dev, &ringparam);
351
 
352
        if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
353
                return -EFAULT;
354
        return 0;
355
}
356
 
357
static int ethtool_set_ringparam(struct net_device *dev, void *useraddr)
358
{
359
        struct ethtool_ringparam ringparam;
360
 
361
        if (!dev->ethtool_ops->set_ringparam)
362
                return -EOPNOTSUPP;
363
 
364
        if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
365
                return -EFAULT;
366
 
367
        return dev->ethtool_ops->set_ringparam(dev, &ringparam);
368
}
369
 
370
static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr)
371
{
372
        struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
373
 
374
        if (!dev->ethtool_ops->get_pauseparam)
375
                return -EOPNOTSUPP;
376
 
377
        dev->ethtool_ops->get_pauseparam(dev, &pauseparam);
378
 
379
        if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam)))
380
                return -EFAULT;
381
        return 0;
382
}
383
 
384
static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr)
385
{
386
        struct ethtool_pauseparam pauseparam;
387
 
388
        if (!dev->ethtool_ops->get_pauseparam)
389
                return -EOPNOTSUPP;
390
 
391
        if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam)))
392
                return -EFAULT;
393
 
394
        return dev->ethtool_ops->set_pauseparam(dev, &pauseparam);
395
}
396
 
397
static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr)
398
{
399
        struct ethtool_value edata = { ETHTOOL_GRXCSUM };
400
 
401
        if (!dev->ethtool_ops->get_rx_csum)
402
                return -EOPNOTSUPP;
403
 
404
        edata.data = dev->ethtool_ops->get_rx_csum(dev);
405
 
406
        if (copy_to_user(useraddr, &edata, sizeof(edata)))
407
                return -EFAULT;
408
        return 0;
409
}
410
 
411
static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr)
412
{
413
        struct ethtool_value edata;
414
 
415
        if (!dev->ethtool_ops->set_rx_csum)
416
                return -EOPNOTSUPP;
417
 
418
        if (copy_from_user(&edata, useraddr, sizeof(edata)))
419
                return -EFAULT;
420
 
421
        dev->ethtool_ops->set_rx_csum(dev, edata.data);
422
        return 0;
423
}
424
 
425
static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr)
426
{
427
        struct ethtool_value edata = { ETHTOOL_GTXCSUM };
428
 
429
        if (!dev->ethtool_ops->get_tx_csum)
430
                return -EOPNOTSUPP;
431
 
432
        edata.data = dev->ethtool_ops->get_tx_csum(dev);
433
 
434
        if (copy_to_user(useraddr, &edata, sizeof(edata)))
435
                return -EFAULT;
436
        return 0;
437
}
438
 
439
static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr)
440
{
441
        struct ethtool_value edata;
442
 
443
        if (!dev->ethtool_ops->set_tx_csum)
444
                return -EOPNOTSUPP;
445
 
446
        if (copy_from_user(&edata, useraddr, sizeof(edata)))
447
                return -EFAULT;
448
 
449
        return dev->ethtool_ops->set_tx_csum(dev, edata.data);
450
}
451
 
452
static int ethtool_get_sg(struct net_device *dev, char *useraddr)
453
{
454
        struct ethtool_value edata = { ETHTOOL_GSG };
455
 
456
        if (!dev->ethtool_ops->get_sg)
457
                return -EOPNOTSUPP;
458
 
459
        edata.data = dev->ethtool_ops->get_sg(dev);
460
 
461
        if (copy_to_user(useraddr, &edata, sizeof(edata)))
462
                return -EFAULT;
463
        return 0;
464
}
465
 
466
static int ethtool_set_sg(struct net_device *dev, char *useraddr)
467
{
468
        struct ethtool_value edata;
469
 
470
        if (!dev->ethtool_ops->set_sg)
471
                return -EOPNOTSUPP;
472
 
473
        if (copy_from_user(&edata, useraddr, sizeof(edata)))
474
                return -EFAULT;
475
 
476
        return dev->ethtool_ops->set_sg(dev, edata.data);
477
}
478
 
479
static int ethtool_self_test(struct net_device *dev, char *useraddr)
480
{
481
        struct ethtool_test test;
482
        struct ethtool_ops *ops = dev->ethtool_ops;
483
        u64 *data;
484
        int ret;
485
 
486
        if (!ops->self_test || !ops->self_test_count)
487
                return -EOPNOTSUPP;
488
 
489
        if (copy_from_user(&test, useraddr, sizeof(test)))
490
                return -EFAULT;
491
 
492
        test.len = ops->self_test_count(dev);
493
        data = kmalloc(test.len * sizeof(u64), GFP_USER);
494
        if (!data)
495
                return -ENOMEM;
496
 
497
        ops->self_test(dev, &test, data);
498
 
499
        ret = -EFAULT;
500
        if (copy_to_user(useraddr, &test, sizeof(test)))
501
                goto out;
502
        useraddr += sizeof(test);
503
        if (copy_to_user(useraddr, data, test.len * sizeof(u64)))
504
                goto out;
505
        ret = 0;
506
 
507
 out:
508
        kfree(data);
509
        return ret;
510
}
511
 
512
static int ethtool_get_strings(struct net_device *dev, void *useraddr)
513
{
514
        struct ethtool_gstrings gstrings;
515
        struct ethtool_ops *ops = dev->ethtool_ops;
516
        u8 *data;
517
        int ret;
518
 
519
        if (!ops->get_strings)
520
                return -EOPNOTSUPP;
521
 
522
        if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
523
                return -EFAULT;
524
 
525
        switch (gstrings.string_set) {
526
        case ETH_SS_TEST:
527
                if (!ops->self_test_count)
528
                        return -EOPNOTSUPP;
529
                gstrings.len = ops->self_test_count(dev);
530
                break;
531
        case ETH_SS_STATS:
532
                if (!ops->get_stats_count)
533
                        return -EOPNOTSUPP;
534
                gstrings.len = ops->get_stats_count(dev);
535
                break;
536
        default:
537
                return -EINVAL;
538
        }
539
 
540
        data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
541
        if (!data)
542
                return -ENOMEM;
543
 
544
        ops->get_strings(dev, gstrings.string_set, data);
545
 
546
        ret = -EFAULT;
547
        if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
548
                goto out;
549
        useraddr += sizeof(gstrings);
550
        if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
551
                goto out;
552
        ret = 0;
553
 
554
 out:
555
        kfree(data);
556
        return ret;
557
}
558
 
559
static int ethtool_phys_id(struct net_device *dev, void *useraddr)
560
{
561
        struct ethtool_value id;
562
 
563
        if (!dev->ethtool_ops->phys_id)
564
                return -EOPNOTSUPP;
565
 
566
        if (copy_from_user(&id, useraddr, sizeof(id)))
567
                return -EFAULT;
568
 
569
        return dev->ethtool_ops->phys_id(dev, id.data);
570
}
571
 
572
static int ethtool_get_stats(struct net_device *dev, void *useraddr)
573
{
574
        struct ethtool_stats stats;
575
        struct ethtool_ops *ops = dev->ethtool_ops;
576
        u64 *data;
577
        int ret;
578
 
579
        if (!ops->get_ethtool_stats || !ops->get_stats_count)
580
                return -EOPNOTSUPP;
581
 
582
        if (copy_from_user(&stats, useraddr, sizeof(stats)))
583
                return -EFAULT;
584
 
585
        stats.n_stats = ops->get_stats_count(dev);
586
        data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER);
587
        if (!data)
588
                return -ENOMEM;
589
 
590
        ops->get_ethtool_stats(dev, &stats, data);
591
 
592
        ret = -EFAULT;
593
        if (copy_to_user(useraddr, &stats, sizeof(stats)))
594
                goto out;
595
        useraddr += sizeof(stats);
596
        if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
597
                goto out;
598
        ret = 0;
599
 
600
 out:
601
        kfree(data);
602
        return ret;
603
}
604
 
605
/* The main entry point in this file.  Called from net/core/dev.c */
606
 
607
int dev_ethtool(struct ifreq *ifr)
608
{
609
        struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
610
        void *useraddr = (void *) ifr->ifr_data;
611
        u32 ethcmd;
612
 
613
        /*
614
         * XXX: This can be pushed down into the ethtool_* handlers that
615
         * need it.  Keep existing behaviour for the moment.
616
         */
617
        if (!capable(CAP_NET_ADMIN))
618
                return -EPERM;
619
 
620
        if (!dev || !netif_device_present(dev))
621
                return -ENODEV;
622
 
623
        if (!dev->ethtool_ops)
624
                goto ioctl;
625
 
626
        if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
627
                return -EFAULT;
628
 
629
        switch (ethcmd) {
630
        case ETHTOOL_GSET:
631
                return ethtool_get_settings(dev, useraddr);
632
        case ETHTOOL_SSET:
633
                return ethtool_set_settings(dev, useraddr);
634
        case ETHTOOL_GDRVINFO:
635
                return ethtool_get_drvinfo(dev, useraddr);
636
        case ETHTOOL_GREGS:
637
                return ethtool_get_regs(dev, useraddr);
638
        case ETHTOOL_GWOL:
639
                return ethtool_get_wol(dev, useraddr);
640
        case ETHTOOL_SWOL:
641
                return ethtool_set_wol(dev, useraddr);
642
        case ETHTOOL_GMSGLVL:
643
                return ethtool_get_msglevel(dev, useraddr);
644
        case ETHTOOL_SMSGLVL:
645
                return ethtool_set_msglevel(dev, useraddr);
646
        case ETHTOOL_NWAY_RST:
647
                return ethtool_nway_reset(dev);
648
        case ETHTOOL_GLINK:
649
                return ethtool_get_link(dev, useraddr);
650
        case ETHTOOL_GEEPROM:
651
                return ethtool_get_eeprom(dev, useraddr);
652
        case ETHTOOL_SEEPROM:
653
                return ethtool_set_eeprom(dev, useraddr);
654
        case ETHTOOL_GCOALESCE:
655
                return ethtool_get_coalesce(dev, useraddr);
656
        case ETHTOOL_SCOALESCE:
657
                return ethtool_set_coalesce(dev, useraddr);
658
        case ETHTOOL_GRINGPARAM:
659
                return ethtool_get_ringparam(dev, useraddr);
660
        case ETHTOOL_SRINGPARAM:
661
                return ethtool_set_ringparam(dev, useraddr);
662
        case ETHTOOL_GPAUSEPARAM:
663
                return ethtool_get_pauseparam(dev, useraddr);
664
        case ETHTOOL_SPAUSEPARAM:
665
                return ethtool_set_pauseparam(dev, useraddr);
666
        case ETHTOOL_GRXCSUM:
667
                return ethtool_get_rx_csum(dev, useraddr);
668
        case ETHTOOL_SRXCSUM:
669
                return ethtool_set_rx_csum(dev, useraddr);
670
        case ETHTOOL_GTXCSUM:
671
                return ethtool_get_tx_csum(dev, useraddr);
672
        case ETHTOOL_STXCSUM:
673
                return ethtool_set_tx_csum(dev, useraddr);
674
        case ETHTOOL_GSG:
675
                return ethtool_get_sg(dev, useraddr);
676
        case ETHTOOL_SSG:
677
                return ethtool_set_sg(dev, useraddr);
678
        case ETHTOOL_TEST:
679
                return ethtool_self_test(dev, useraddr);
680
        case ETHTOOL_GSTRINGS:
681
                return ethtool_get_strings(dev, useraddr);
682
        case ETHTOOL_PHYS_ID:
683
                return ethtool_phys_id(dev, useraddr);
684
        case ETHTOOL_GSTATS:
685
                return ethtool_get_stats(dev, useraddr);
686
        default:
687
                return -EOPNOTSUPP;
688
        }
689
 
690
 ioctl:
691
        if (dev->do_ioctl)
692
                return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
693
        return -EOPNOTSUPP;
694
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.