diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2017-09-13 12:18:21 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2017-09-13 12:18:21 +0200 |
commit | b4b0db043bc7e03982b24c9e330bf1bc2c727fc0 (patch) | |
tree | 9c46585911a622d80c54840be91157247f4a43b8 /dev.c | |
parent | 439af62bca4794d78d53fb4634f560d6a75f0adb (diff) |
dev: only calculate wireless bitrate if necessary
Only call wireless_bitrate (and thus the underlying ioctl) if strictly
necessary, i.e. ethtool_bitrate returned 0.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'dev.c')
-rw-r--r-- | dev.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -217,14 +217,13 @@ int device_up_and_running(const char *ifname) (IFF_UP | IFF_RUNNING); } -u32 device_bitrate(const char *ifname) +uint32_t device_bitrate(const char *ifname) { - u32 scopper, swireless; + uint32_t scopper; - scopper = ethtool_bitrate(ifname); - swireless = wireless_bitrate(ifname); + scopper = ethtool_bitrate(ifname); - return scopper ? : swireless; + return scopper ? : wireless_bitrate(ifname); } short device_enter_promiscuous_mode(const char *ifname) |