~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/core/ethtool.c

Version: ~ [ linux-5.8 ] ~ [ linux-5.7.14 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.57 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.138 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.193 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.232 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.232 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp