platform/ethtool,mii: retry ioctl when interface name was renamed for ehttool/mii

ethtool/mii API is based on the ifname. As an interface can be renamed,
this API is inherently racy. We would prefer to use the ifindex instead.
The ifindex of a device cannot change (altough it can repeat, which opens a
different race *sigh*).

Anyway, we were already trying to minimize the racy be resolving the
name from ifindex immediately before the call to ethtool/mii.

Do better than that. Now resolve the name before and after the call. If
the name changed in the meantime, we have an indication that a race
happend (but we cannot be sure).

Note that this can not catch every possible rename race. If you are very
unlucky a swapping of names cannot be detected.

For getters this is relatively straight forward. Just retry when we
have an indication to fall victim to a race (up to a few times). Yes, we
still cannot be 100% sure, but this should be very reliable in practice.

For setters (that modify the device) we also retry. We do so under the
assumption that setting the same options multiple times has no bad effect.
Note that for setters the race of swapping interface names is particularly
bad. If we hit a very unlucky race condition, we might set the setting on
the wrong interface and there is nothing we can do about it. The retry only
ensures that eventually we will set it on the right interface.

Note that this involves one more if_indextoname() call for each operation (in
the common case when there is no renaming race). In cases where we require
multiple ioctl calls we cache and reuse the information though. So, for such
calls the overhead is even smaller.
12 jobs for th/ethtool-retry in 32 minutes and 50 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Test
passed #283336
allowed to fail
checkpatch

00:01:24

passed #283343
t_debian:9

00:14:31

passed #283345
t_debian:sid

00:14:25

manual #283344
allowed to fail manual
t_debian:testing
passed #283337
t_fedora:28

00:24:23

passed #283338
t_fedora:29

00:32:50

passed #283339
t_fedora:30

00:25:14

manual #283340
allowed to fail manual
t_fedora:rawhide
passed #283341
t_ubuntu:16.04

00:14:30

passed #283342
t_ubuntu:18.04

00:16:19

 
  External
failed NetworkManager test verification

failed NetworkManager test verification

06:04:51