FS#31838 - [ethtool] systemd service support

Attached to Project: Arch Linux
Opened by Ivan Lyapunov (dront78) - Monday, 08 October 2012, 04:44 GMT
Last edited by Gerardo Exequiel Pozzi (djgera) - Tuesday, 29 March 2016, 02:00 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Ionut Biru (wonder)
Anatol Pomozov (anatolik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
It's good to enable systemd service support for ethtool to run after network startup since there is a lot of cases for this situation. So a little bit automatization with a config file would be good for all of them ;)
This task depends upon

Closed by  Gerardo Exequiel Pozzi (djgera)
Tuesday, 29 March 2016, 02:00 GMT
Reason for closing:  Upstream
Additional comments about closing:  See https://bugs.archlinux.org/task/31838#co mment130824
Comment by Greg (dolby) - Saturday, 17 November 2012, 04:36 GMT
It would help if you attached a systemd service file yourself.
Comment by Ivan Lyapunov (dront78) - Saturday, 17 November 2012, 07:25 GMT
main systemd file /usr/lib/systemd/system/ethtool@.service
[Unit]
Description=Ethtool configuration for %i

[Service]
EnvironmentFile=/etc/conf.d/ethtool.conf
Requires=network.target
After=network.target
ExecStart=/usr/sbin/ethtool -s %i $ETHTOOL_ARGS
Type=oneshot

[Install]
WantedBy=multi-user.target


ethtool config file /etc/conf.d/ethtool.conf
ETHTOOL_ARGS=""

usage sample
systemctl enable ethtool@eth0
Comment by Peter Klotz (p.klotz) - Saturday, 17 November 2012, 07:58 GMT
Using the suggested service file would not solve my ethtool requirements.

Due to a network hardware bug I need to call ethtool like this:

/usr/sbin/ethtool --features eth0 tso off
Comment by Ivan Lyapunov (dront78) - Saturday, 17 November 2012, 08:06 GMT
You can easily add you want in /etc/conf.d/ethtool.conf since this service file handle any additional args here
Comment by Peter Klotz (p.klotz) - Saturday, 17 November 2012, 12:38 GMT
The culprit is the "-s %i" argument in the service file.

The command "/usr/sbin/ethtool -s eth0 --features tso off" does not work, it has to be "/usr/sbin/ethtool --features eth0 tso off".

However it is not a big deal. I currently use a service file that invokes ethtool the way my network adapter requires it.
Comment by Ivan Lyapunov (dront78) - Saturday, 17 November 2012, 14:10 GMT
it's possible to remove all options and make EnvironmentFile=/etc/conf.d/ethtool@%i.conf
I checked and it works correctly

EnvironmentFile=/etc/conf.d/ethtool@%i.conf
ExecStart=/usr/sbin/ethtool $ETHTOOL_ARGS
Comment by Peter Klotz (p.klotz) - Saturday, 17 November 2012, 14:27 GMT
That sounds great!

So all people who require an arbitrary single call to ethtool will be able to use this solution.

I assume, interfaces which require more than one call to ethtool are rare.
Comment by Ivan Lyapunov (dront78) - Saturday, 17 November 2012, 14:43 GMT
> I assume, interfaces which require more than one call to ethtool are rare.

you can make systemctl enable ethtool@abc, systemctl enable ethtool@cde etc every with own config file
because of /etc/conf.d/ethtool@%i.conf, so multiple calls on single iface is possible in this case
Comment by Peter Klotz (p.klotz) - Saturday, 17 November 2012, 14:55 GMT
Ah, I see.

Maybe I should have looked up the meaning of %i earlier:

http://www.freedesktop.org/software/systemd/man/systemd.unit.html

So hopefully your service file will soon be added to package ethtool.

Regards, Peter.
Comment by Daniel Micay (thestinger) - Tuesday, 16 December 2014, 01:46 GMT
systemd now provides link units (systemd.link(5)) for this, so I don't think this makes sense anymore.
Comment by Peter Klotz (p.klotz) - Tuesday, 16 December 2014, 20:46 GMT
@Daniel: How would you call ethtool using systemd link files?

As far as I can see a [Link] section does not offer an option to disable TCP segmentation offload.
Comment by Daniel Micay (thestinger) - Tuesday, 16 December 2014, 21:09 GMT
It doesn't support those tunables yet, so you're still stuck with a oneshot service calling ethtool or a udev rule. I think you'll have more success filing feature requests against systemd for those missing features.

The proposed ethtool service isn't an appropriate way of doing it. For one thing, it applies the settings from a single configuration file to every interface it has been enabled for. Using the /etc/conf.d like this at all is deprecated in favour of overriding or extending units in /etc/systemd/system. It also lacks a dependency on the device that it's modifying - depending on network.target isn't enough.

You would be better off just using a udev rule if what you're doing isn't yet supported by link files. It will be one line and won't be racing with the device if it isn't used for network.target. There are ways to do it correctly with a unit file, but I don't see a way that would be sensible to ship in the package.

Loading...