| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Linux::Ethtool - Interface to the Linux SIOCETHTOOL ioctl | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | use Linux::Ethtool qw(:all); | ||
| 8 | |||
| 9 | my $link = get_link("eth0") // die($!); | ||
| 10 | my $rx_csum = get_rx_csum("eth0") // die($!); | ||
| 11 | my $tx_csum = get_tx_csum("eth0") // die($!); | ||
| 12 | |||
| 13 | print "Link detected: ".($link ? "yes" : "no")."\n"; | ||
| 14 | print "RX checksum offloading: ".($rx_csum ? "yes" : "no")."\n"; | ||
| 15 | print "TX checksum offloading: ".($tx_csum ? "yes" : "no")."\n"; | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This module provides a procedural interface to the basic operations provided by | ||
| 20 | the Linux SIOCETHTOOL ioctl. The more complex operations that involve getting or | ||
| 21 | setting whole structures at a time are implemented in OO fashion by packages | ||
| 22 | under this namespace. | ||
| 23 | |||
| 24 | =head1 SUBROUTINES | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | package Linux::Ethtool; | ||
| 29 | |||
| 30 | use strict; | ||
| 31 | use warnings; | ||
| 32 | |||
| 33 | our $VERSION = "0.11"; | ||
| 34 | |||
| 35 | require XSLoader; | ||
| 36 | XSLoader::load("Linux::Ethtool"); | ||
| 37 | |||
| 38 | use Exporter qw(import); | ||
| 39 | |||
| 40 | our @EXPORT_OK = qw( | ||
| 41 | get_link | ||
| 42 | get_rx_csum | ||
| 43 | set_rx_csum | ||
| 44 | get_tx_csum | ||
| 45 | set_tx_csum | ||
| 46 | get_sg | ||
| 47 | set_sg | ||
| 48 | get_tso | ||
| 49 | set_tso | ||
| 50 | get_ufo | ||
| 51 | set_ufo | ||
| 52 | get_gso | ||
| 53 | set_gso | ||
| 54 | get_gro | ||
| 55 | set_gro | ||
| 56 | ); | ||
| 57 | |||
| 58 | our %EXPORT_TAGS = ( | ||
| 59 | all => [ @EXPORT_OK ] | ||
| 60 | ); | ||
| 61 | |||
| 62 | =pod | ||
| 63 | |||
| 64 | The following subroutines get or set boolean values on a network interface. | ||
| 65 | |||
| 66 | The get functions return defined true/false on success, undef on failure. | ||
| 67 | |||
| 68 | The set functions return true on success, false on failure. | ||
| 69 | |||
| 70 | get_link($dev) - Link detected | ||
| 71 | |||
| 72 | get_rx_csum($dev), set_rx_csum($dev, $enable) - RX checksum offloading enabled | ||
| 73 | get_tx_csum($dev), set_tx_csum($dev, $enable) - TX checksum offloading enabled | ||
| 74 | get_sg($dev), set_sg($dev, $enable) - Scatter gather enabled | ||
| 75 | get_tso($dev), set_tso($dev, $enable) - TCP Segmentation Offload enabled | ||
| 76 | get_ufo($dev), set_ufo($dev, $enable) - UDP Fragmentation Offload enabled | ||
| 77 | get_gso($dev), set_gso($dev, $enable) - Generic Segmentation Offload enabled | ||
| 78 | get_gro($dev), set_gro($dev, $enable) - Generic Receive Offload enabled | ||
| 79 | |||
| 80 | =head1 COPYRIGHT AND LICENSE | ||
| 81 | |||
| 82 | Copyright (C) 2013 Daniel Collins E<lt>solemnwarning@solemnwarning.netE<gt> | ||
| 83 | |||
| 84 | This library is free software; you may redistribute it and/or modify it under | ||
| 85 | the same terms as Perl itself. | ||
| 86 | |||
| 87 | =head1 SEE ALSO | ||
| 88 | |||
| 89 | L<Linux::Ethtool::Settings>, L<Linux::Ethtool::WOL> | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | 1; |