summaryrefslogtreecommitdiff
path: root/ethtool.c
AgeCommit message (Collapse)AuthorFilesLines
2011-11-01Combine ethtool-{bitops,util}.h into internal.hBen Hutchings1-1/+1
ethtool-util.h contains all kinds of declarations, not just utility functions or macros. ethtool-bitops.h contains just a few extra definitions, and its only user also includes ethtool-util.h. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-10-28Report pause frame autonegotiation resultBen Hutchings1-6/+40
If pause frame autonegotiation is enabled and the driver reports the link partner's advertising flags, report the result of autonegotiation. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-10-17ethtool: add ETHTOOL_{G,S}CHANNEL support.Sucheta Chakraborty1-0/+120
Used to configure number of tx/ rx/ other channels. Reqd. man page changes are included. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-10-04ethtool: add support for external loopback.Sucheta Chakraborty1-2/+12
External loopback will be performed in addition to other offline tests. User need to pass new parameter "external_lb" for the same. Reqd. man page changes included. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> [bwh: Report whether the external loopback test 'was', not 'is' executed. For compatibility, don't report this if not requested.] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-07-14Correct parameter types for ethtool -e and ethtool -EBen Hutchings1-16/+24
All parameters to the underlying ethtool commands are unsigned, not signed. In particular, the 'magic' parameter to ethtool -E often has the most significant bit set and users should not have to provide it as a negative number. For ethtool -E, the value to be written is 8-bit, not 32-bit. Reported-by: Jens Rottmann <JRottmann@LiPPERTEmbedded.de> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-06-06ethtool: Add support for 20G link speedYaniv Rosner1-1/+17
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
2011-06-02Fix type mismatch for field width argument to fprintf()Ben Hutchings1-1/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-06-02ethtool: Added FW dump supportAnirban Chakraborty1-1/+119
Added support to take FW dump via ethtool. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-06-01Combine code to display supported and advertised link capabilitiesBen Hutchings1-59/+21
Rename dump_advertised() to dump_link_caps(), and change dump_supported() to call it instead of repeating nearly identical code. Add a separate prefix parameter and adjust indentation so that the output is unchanged except for added lines. Deleted unused parameter and variables. As an immediate benefit, this adds the display of supported pause frame use. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-06-01ethtool: mask out FLOW_EXTSebastian Pöhn1-0/+3
The FLOW_EXT bit must be masked out. Otherwise if e.g. vlan is set a driver receiving the ntuple may not detect the flow_type correctly! Signed-off-by: Sebastian Poehn <sebastian.poehn@belden.com> [bwh: Fixed spacing] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-05-13ethtool: Treat positive return from ETHTOOL_SRXNTUPLE as successfulBen Hutchings1-3/+6
The sfc driver can currently return a positive value (the filter index) on success. This is a bug in the driver, but ethtool previously accepted it. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-05-13Add RX packet classification interfaceAlexander Duyck1-173/+227
This patch was originally introduced as: [PATCH 1/3] [ethtool] Add rx pkt classification interface Signed-off-by: Santwona Behera <santwona.behera@sun.com> http://patchwork.ozlabs.org/patch/23223/ I removed the local caching of rules. I dropped the use of regions as there were multiple issues found. A network flow classifier is defined using the exact same syntax as n-tuple, and the tool will correct for the fact that NFC uses the 1's compliment of the n-tuple mask. I also updated the ordering of new rules being added. All new rules will take the highest numbered open rule when no location is specified. I split out the addition of bitops and the updates to documentation into separate patches. This makes the total patch size a bit more manageable since the addition of NFC and the merging of it with n-tuple were combined into this patch. If we setup a rule and the device has the NTUPLE flag set we will first try to use set_rx_ntuple. If that fails with EOPNOTSUPP we then will attempt to use the network flow classifier rule insertion. Updated the output to make use of the updated network flow classifier extensions that have been accepted into the kernel. Merged the documentation update into this patch. In addition the documentation changes were made such that there is only one listing of the individual options and they are all listed as optional. Several fixes to address things such as the fact that we were maintaining the table logic even though we only need it for displaying all of the rules, or when adding a rule with no location specified. As such all of the logic for deleting or finding rules in the table has been removed. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> [bwh: Abbreviated the above commit message. Fixed a minor formatting error in the manual page additions.] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-05-13Cleanup defines and header includes to address several issuesAlexander Duyck1-16/+1
This change is meant to address several issues. First it moves the check for ethtool-config.h into ethtool-util.h the reason for this change is so that any references to ethtool-util.h outside of ethtool.c will use the correct defines for the endian types. In addition I have pulled several headers that will be common to both ethtool.c and rxclass.c into the ethtool-util.h header file. I am also centralizing several macros that will be needed across multiple files when I implement the network flow classifier rules. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-05-13ethtool: remove strings based approach for displaying n-tupleAlexander Duyck1-44/+0
This change is meant to remove the strings based approach for displaying n-tuple filters. A follow-on patch will replace that functionality with a network flow classification based approach that will get the number of filters, get their locations, and then request and display them individually. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-04-27Add support for ESP as a separate protocol from AHAlexander Duyck1-9/+12
This change is mostly cosmetic. NIU had supported AH and ESP seperately. As such it is possible that a return value of ESP or AH may be returned for a has request instead of the AH_ESP combined value. To resolve that the inputs are combined for AH and ESP into the AH_ESP value and return values for AH and ESP will display the combined string info. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
2011-03-18ethtool: Report driver features described in struct ethtool_drvinfoBen Hutchings1-2/+10
ETHTOOL_GDRVINFO fills out struct ethtool_drvinfo with the size of the data returned by various other operations. The size should be non-zero if and only if the driver implements that operation. Therefore, we can report whether the driver supports certain operations without actually trying them (which may be expensive and disruptive). Do this in dump_drvinfo() rather than adding a separation operation. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-21ethtool: Add --version optionBen Hutchings1-0/+6
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-21ethtool: Indent the no-options usage line consistently with the othersBen Hutchings1-1/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-21ethtool: Allow for long options with no short option and without a device nameBen Hutchings1-9/+14
Change loop conditions to check for a long option string. Generalise check for whether option requires a device name. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-21ethtool: Report an error if given an unrecognised optionBen Hutchings1-2/+3
Previously we would print full usage information and return 0. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-21ethtool: Split show_usage() into two functionsBen Hutchings1-71/+73
show_usage(0) and show_usage(1) now do unrelated things; split it into show_usage() and exit_bad_args(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-02-18ethtool: Don't silently ignore speed/duplex when autoneg is onBen Hutchings1-14/+31
When autonegotiation is enabled, drivers must determine link speed and duplex through the autonegotiation process and will generally ignore the speed and duplex specified in struct ethtool_cmd. Currently, if the user specifies autoneg on but does not specify the advertising mask then: - If the user specifies a recognised combination of speed and duplex, we set the advertising mask to the flag for that mode. (Currently only one mode is recognised per combination of speed and duplex.) - Otherwise, we advertise all recognised and supported modes. But we should also set the advertising mask if autoneg is *already* on. Also, we should be able to limit the advertised modes separately by speed and duplex. For now, we just warn if we fail to do that. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-01-10ethtool: Fix spelling and spacing in online helpBen Hutchings1-2/+2
Kelly Anderson <kelly@silka.with-linux.com> pointed out that the help for --show-nfc was missing a space between two words. I checked the rest of the help text with aspell and found one other error. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-12-15ethtool: Remove suggested change of no-args behaviour from the TODO listBen Hutchings1-1/+1
ethtool can show information about many more settings than mii-tool. It would be useful to have the option to show certain settings for all interfaces, but this should not be restricted to the basic settings. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-12-15ethtool: Remove manual page from TODO listBen Hutchings1-1/+0
The manual page provides a pretty good explanation of all options now. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-12-15ethtool: Remove MII ioctls from TODO listBen Hutchings1-2/+0
Ethernet drivers generally support the ethtool API now, and the mii, mdio and phy libraries make it easy to do so using generic MDIO registers. I see no point in adding a fallback here. Further, using SIOCDEVPRIVATE with arbitrary drivers is a really bad idea. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Add support for vlan accleration.Jesse Gross1-3/+18
The kernel now has support for enabling and disabling vlan acceleration, similar to other forms of offloading. This adds the complementary userspace support. Signed-off-by: Jesse Gross <jesse@nicira.com> [bwh: Fix references to 'off_flags_unwanted', renamed to 'off_flags_mask'] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: add get permanent address optionStephen Hemminger1-1/+37
Add command level support for showing permanent address. The ioctl has been around for a long time but there was no option to display it. Note: MAX_ADDR_LEN is defined in netdevice.h but including netdevice.h leads to multiple definition errors with if.h. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> [bwh: Fix use of '|' in place of '||', as noted by Joe Perches] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: add stmmac supportGiuseppe CAVALLARO1-0/+2
Add the stmmac support into the ethtool to dump both the Mac Core and Dma registers. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Add my authorship and Solarflare copyright noticeBen Hutchings1-0/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Add Ethernet-level RX n-tuple filtering and 'clear' actionBen Hutchings1-8/+60
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Add MAC parameter type based on the parse_sopass() functionBen Hutchings1-12/+14
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Fix RX n-tuple masks and documentationBen Hutchings1-25/+90
For fields with unspecified values, explicitly mask all bits. Do not allow specifying a mask without a value. Change usage information to clarify which parameters are optional or required. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-11-16ethtool: Generalise cmdline_info::unwanted_val to a "seen" flag or bitmaskBen Hutchings1-31/+37
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2010-08-10ethtool: Fix handling of zero weights for flow hash indirectionBen Hutchings1-1/+1
The loop to generate an indirection table from a list of weights never advances by more than one weight at a time. Thus, if there is a 0 in the list (except at the end) the corresponding RX ring will be assigned 1 hash bucket rather than 0. Change 'if' to 'while'. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-08-10ethtool: Use inet_aton() to parse IPv4 addresses for RX n-tuple controlBen Hutchings1-10/+15
Note that inet_aton() allows the address to be specified as a single 32-bit number in the same formats as strtoull(), so this is backward- compatible. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-07-02ethtool: Add support for control of RX flow hash indirectionBen Hutchings1-0/+162
Many NICs use an indirection table to map an RX flow hash value to one of an arbitrary number of queues (not necessarily a power of 2). It can be useful to remove some queues from this indirection table so that they are only used for flows that are specifically filtered there. It may also be useful to weight the mapping to account for user processes with the same CPU-affinity as the RX interrupts. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-25ethtool: Use named flag support to update extended offload flagsBen Hutchings1-58/+12
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-25ethtool: Implement named message type flagsBen Hutchings1-11/+93
Allow message type flags to be turned on and off by name. Print the names of the currently set flags below the numeric value. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-25ethtool: Add support for named flagsBen Hutchings1-1/+39
Define an argument type CMDL_FLAG, which can be used to set and clear flags. For each setting that can be modified in this way, the flags to be set and cleared are accumulated in two variables. Add support for CMDL_FLAGS parse_generic_cmdline(). Add utility function print_flags(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-25ethtool: Mark show_usage() as noreturnBen Hutchings1-0/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-25ethtool: Parse integers into variables of different sizes and byte ordersBen Hutchings1-91/+135
The arguments for RX n-tuple traffic direction are filled into structure fields of varying size, some of which are in big-endian rather than native byte order. Currently parse_generic_cmdline() only supports 32-bit integers in native byte order, so this does not work correctly. Replace CMDL_INT and CMDL_UINT with the more explicit CMDL_S32 and CMDL_U32. Add CMDL_U16 and CMDL_U64 for narrower and wider integers, and CMDL_BE16 and CMDL_BE32 for big-endian unsigned integers. Use them for RX n-tuple argument parsing. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-06-21ethtool: Add support for sfc register dumpsBen Hutchings1-0/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-04-06ethtool: RXHASH flag support (v2)Stephen Hemminger1-5/+34
Add support for RXHASH flag in ethtool offload. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-30ethtool: Correctly pull n-tuple string length for get_rx_ntuplePeter Waskiewicz1-3/+16
This patch fixes inconsistencies with the kernel header files, while correctly gets the variable length string counts for the get_rx_ntuple return value. It does this by using the new GSSET_INFO ioctl. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-02-24Support n-tuple filter programmingPeter Waskiewicz1-5/+151
Program underlying ethernet devices with n-tuple flow classification filters. This also adds a new flag to ethtool_flags, allowing n-tuple programming to be toggled using the set_flags call. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-24ethtool: Can't parse ints with stroul()PJ Waskiewicz1-2/+21
A recent change to how int's were being parsed from the command line had them being read in with an unsigned int string operator. This didn't allow signed numbers from being read in correctly. This patch adds a get_uint() routine, and fixes the get_int() routine to read in signed values. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-23ethtool: add support for at76c50x-usb driverJohn W. Linville1-0/+1
Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-20ethtool: Do not report link partner advertising flags if set to 0Ben Hutchings1-1/+3
Only some drivers (and none before kernel version 2.6.31) currently set these flags. When the flags are equal to 0 and so we don't know what the link partner advertised, don't report anything. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-01ethtool: Fix switch on port typeBen Hutchings1-6/+6
The new port type cases in commit 6e0512c 'ethtool: Add Direct Attach to the available connector ports' were somehow inserted into the switch on duplex type, not on port type. Move them to the correct place. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>