Skip to content

ethtool refactoring and misc changes

Ben Hutchings netdev 1 version In review

Get series with b4
b4 am 1320186901.2758.30.camel@bwh-desktop

Versions newest first

  1. v1 Latest21 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21Report pause frame autonegotiation resultethtool.c+40 -60 replies
2/21ethtool.8: Fix initial blank line/pageethtool.8.in+1 -10 replies
3/21Combine ethtool-{bitops,util}.h into internal.hMakefile.am amd8111e.c at76c50x-usb.c +21 more+46 -510 replies
4/21Fix type of bit-number parameter to set_bit() and clear_bit()internal.h+2 -20 replies
5/21ethtool.8: Change device name metavariable from 'ethX' to 'devname'ethtool.8.in+31 -310 replies
6/21ethtool.8: Allow line-break in description of parameters after -Nethtool.8.in+2 -20 replies
7/21Fix format of help text for -f optionethtool.c+2 -20 replies
8/21Use standard indentation for definition of struct option argsethtool.c+142 -1380 replies
9/21Encapsulate command context in a structureethtool.c internal.h rxclass.c+204 -2730 replies
10/21Add test cases for command-line parsingMakefile.am configure.ac ethtool.c +3 more+315 -00 replies
11/21Add more test cases for command-line parsingtest-cmdline.c+28 -00 replies
12/21Move argument parsing to sub-command functionsethtool.8.in ethtool.c internal.h +1 more+390 -6100 replies
13/21Support arbitrary numbers of option names for each modeethtool.c+58 -520 replies
14/21Fix reference to cmdline_ring in do_schannels()ethtool.c+1 -10 replies
15/21Convert cmdline_msglvl into array of named flags; convert back at run-timeethtool.c+44 -350 replies
16/21Replace global devname variable with a field in struct cmd_contextethtool.c internal.h+12 -130 replies
17/21Change most static global variables into automatic variablesethtool.c+293 -2600 replies
18/21rxclass: Replace global rmgr with automatic variable/parameterrxclass.c+34 -440 replies
19/21Declare static variables const as appropriateethtool.c rxclass.c+6 -60 replies
20/21Run tests in-processMakefile.am ethtool.c internal.h +2 more+66 -411 reply
21/21Rearrange definitions and remove unnecessary forward declarationsethtool.c+204 -2430 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH ethtool 00/21] ethtool refactoring and misc changes

As I looked into supporting features cleanly within the existing -k/-K options, it became clear that ethtool was overdue for refactoring. And in order to be confident about doing that, I needed to add some tests.

So I intend to push the following changes:

1. Reporting of pause frame autonegotiation. I don't believe this requires a new command in the kernel interface; it just needs drivers to fill out the AN flags.

2. Minor fixes to manual page and online help.

3. Cleanup of ethtool-bitops.h and ethtool-util.h.

4. Encapsulate shared command state into a structure passed into each sub-command function (and several others).

5. Test argument parsing. Currently this just checks that each command line is accepted or rejected as expected.

6. For each sub-command (option), move all argument parsing into the function that implements it. Move the associated static variables likewise. Declare static constants as const, so that there are no static variables left (outside of the test wrapper).

7. Run the main ethtool code in the same process as the test code. This will allow for test cases that cover the ioctl requests and responses.

Ben.

Ben Hutchings (21):
Report pause frame autonegotiation result
ethtool.8: Fix initial blank line/page
Combine ethtool-{bitops,util}.h into internal.h
Fix type of bit-number parameter to set_bit() and clear_bit() ethtool.8: Change device name metavariable from 'ethX' to 'devname' ethtool.8: Allow line-break in description of parameters after -N Fix format of help text for -f option
Use standard indentation for definition of struct option args Encapsulate command context in a structure
Add test cases for command-line parsing
Add more test cases for command-line parsing
Move argument parsing to sub-command functions
Support arbitrary numbers of option names for each mode Fix reference to cmdline_ring in do_schannels()
Convert cmdline_msglvl into array of named flags; convert back at
run-time
Replace global devname variable with a field in struct cmd_context Change most static global variables into automatic variables
rxclass: Replace global rmgr with automatic variable/parameter Declare static variables const as appropriate
Run tests in-process
Rearrange definitions and remove unnecessary forward declarations

 Makefile.am                  |    7 +-
 amd8111e.c                   |    2 +-
 at76c50x-usb.c               |    2 +-
 configure.ac                 |    1 +
 de2104x.c                    |    2 +-
 e100.c                       |    2 +-
 e1000.c                      |    2 +-
 ethtool-bitops.h             |   25 -
 ethtool.8.in                 |   70 +-
 ethtool.c                    | 2352 +++++++++++++++++++-----------------------
 fec_8xx.c                    |    2 +-
 ibm_emac.c                   |    2 +-
 igb.c                        |    2 +-
 ethtool-util.h => internal.h |   57 +-
 ixgb.c                       |    2 +-
 ixgbe.c                      |    2 +-
 marvell.c                    |    2 +-
 natsemi.c                    |    2 +-
 pcnet32.c                    |    2 +-
 realtek.c                    |    2 +-
 rxclass.c                    |  129 +--
 sfc.c                        |    2 +-
 smsc911x.c                   |    2 +-
 stmmac.c                     |    2 +-
 test-cmdline.c               |  240 +++++
 test-common.c                |  101 ++
 tg3.c                        |    2 +-
 vioc.c                       |    2 +-
 28 files changed, 1565 insertions(+), 1455 deletions(-)
 delete mode 100644 ethtool-bitops.h
 rename ethtool-util.h => internal.h (71%)
 create mode 100644 test-cmdline.c
 create mode 100644 test-common.c
Signature · 7 lines
1.7.4.4


-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.