Yu Watanabe
861de64e68
ethtool: make ethtool_get_driver() return -ENODATA if ioctl succeeds but driver name is empty
...
Inspired by #17532 .
2020-11-10 01:14:42 +09:00
Yu Watanabe
a93187ced5
ethtool: add several assertions
2020-11-10 01:04:39 +09:00
Yu Watanabe
db9ecf0501
license: LGPL-2.1+ -> LGPL-2.1-or-later
2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek
943142a97d
Merge pull request #17185 from yuwata/ethtool-update
...
ethtool: add several link modes
2020-10-23 08:22:09 +02:00
Yu Watanabe
fe2aeef816
ethtool: add several new link modes
2020-09-28 22:49:33 +09:00
Yu Watanabe
41f4269619
ethtool: convert underscore to hyphen
2020-09-28 22:44:05 +09:00
Yu Watanabe
cadc7ed2e2
ethtool: constify arguments for ethtool_set_xxx()
2020-09-15 11:06:25 +09:00
Yu Watanabe
4c382a8772
ethtool: downgrade log level when the error will be ignored
2020-09-10 13:59:04 +09:00
Lennart Poettering
d8ea7f838b
ethtool-util: don't pass error value that isn't used to log_syntax
2020-09-09 23:43:20 +02:00
Zbigniew Jędrzejewski-Szmek
9b107000ab
Merge pull request #15762 from keszybz/gcc-10-build
...
Fix build with -O3 with gcc 10
2020-05-11 19:43:40 +02:00
Zbigniew Jędrzejewski-Szmek
94c0c5b7ea
shared/ethtool-util: hush gcc warnings about array bounds
...
[127/1355] Compiling C object 'src/shared/5afaae1@@systemd-shared-245@sta/ethtool-util.c.o'
../src/shared/ethtool-util.c: In function ‘ethtool_get_permanent_macaddr’:
../src/shared/ethtool-util.c:260:60: warning: array subscript 5 is outside the bounds of an interior zero-length array ‘__u8[0]’ {aka ‘unsigned char[]’} [-Wzero-length-bounds]
260 | ret->ether_addr_octet[i] = epaddr.addr.data[i];
| ~~~~~~~~~~~~~~~~^~~
In file included from ../src/shared/ethtool-util.c:5:
../src/shared/linux/ethtool.h:704:7: note: while referencing ‘data’
704 | __u8 data[0];
| ^~~~
../src/shared/ethtool-util.c: In function ‘ethtool_set_features’:
../src/shared/ethtool-util.c:488:31: warning: array subscript 0 is outside the bounds of an interior zero-length array ‘__u32[0]’ {aka ‘unsigned int[]’} [-Wzero-length-bounds]
488 | len = buffer.info.data[0];
| ~~~~~~~~~~~~~~~~^~~
In file included from ../src/shared/ethtool-util.c:5:
../src/shared/linux/ethtool.h:631:8: note: while referencing ‘data’
631 | __u32 data[0];
| ^~~~
The kernel should not define the length of the array, but it does. We can't fix
that, so let's use a cast to avoid the warning.
For https://github.com/systemd/systemd/issues/6119#issuecomment-626073743 .
v2:
- use #pragma instead of a cast. It seems the cast only works in some cases, and
gcc is "smart" enough to see beyond the cast. Unfortunately clang does not support
this warning, so we need to do a config check whether to try to suppress.
2020-05-11 13:57:11 +02:00
наб
2f665f2437
networkctl: use uint64_t for link speed throughout
...
format-table used size_t/uint64_t interchangeably for TABLE_BPS,
and ethtool-util used SIZE_MAX to indicate SPEED_UNKNOWN,
which worked only on ABIs with 64-bit pointers.
For example, the tg3 driver returns SPEED_UNKNOWN with no link (cf.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/broadcom/tg3.c?id=3eb2efbea193789397c36f52b17d8692ac79bf68#n12190 )
which on x32 (and other 32-bit ABIs, presumably) caused
"networkctl status" to mark it with "Speed: 4Gbps":
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: 4Gbps
Whereas on 64-bit-pointer ABIs (here: amd64):
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
With this patch, networkctl returns, for x32:
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2.1~networkctl-4g-v2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
And for amd64:
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
2020-05-09 08:49:31 +02:00
nabijaczleweli
e81f5fc4e8
link: Allow configuring RX mini and jumbo ring sizes, too
...
This now covers all ethtool_ringparam configurables (as of v5.6;
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ethtool.h?h=v5.6#n488 )
2020-04-29 18:57:13 +02:00
nabijaczleweli
80af9bdabe
link: Add units and fix typo in (Rx|Tx)BufferSize= manpage. Clean up the implementation slightly
2020-04-29 18:55:42 +02:00
Yu Watanabe
a34811e4ef
udev: support to update flow control parameter
...
Closes #14770 .
2020-03-07 01:43:26 +09:00
Yu Watanabe
bf2334c054
udev: add {Receive,Transmit}ChecksumOffload= settings
...
Closes #14661 .
2020-02-03 12:31:31 +09:00
Yu Watanabe
5029912157
network,udev: use uint64_t for bit rate
...
Fixes #14620 .
2020-01-21 16:51:19 +01:00
Zbigniew Jędrzejewski-Szmek
0475919b56
network: use automatic stack allocation and structured init
2020-01-08 17:15:19 +01:00
Zbigniew Jędrzejewski-Szmek
6666c4faee
network: do not require ethtool_get_permanent_macaddr() to get an fd
2020-01-08 17:14:56 +01:00
Zbigniew Jędrzejewski-Szmek
64be35ab02
network: rename *fd to *ethtool_fd
2020-01-08 11:55:07 +01:00
Yu Watanabe
79b4428a7d
ethtool: introduce ethtool_get_permanent_macaddr()
...
Will be used in later commits.
2020-01-08 17:51:56 +09:00
Yu Watanabe
6eee88577d
udev: tiny update for log messages
2019-11-26 10:42:54 +01:00
Yu Watanabe
8e1e87a5de
tree-wide: drop double newline
2019-11-04 00:30:32 +09:00
Yu Watanabe
f5947a5e92
tree-wide: drop missing.h
2019-10-31 17:57:03 +09:00
Frantisek Sumsal
b80aca0fd9
shared: fix a copy-paste error in ethtool-util
...
CID#1405818
2019-09-27 16:11:16 +02:00
Susant Sahani
224ded670f
link: Add support to configure NIC ring buffer size
2019-09-24 16:33:35 +02:00
Lennart Poettering
2caa38e99f
tree-wide: some more [static] related fixes
...
let's add [static] where it was missing so far
Drop [static] on parameters that can be NULL.
Add an assert() around parameters that have [static] and can't be NULL
hence.
Add some "const" where it was forgotten.
2019-07-12 16:40:10 +02:00
Yu Watanabe
6d02888935
ethtool: reindent link mode table
2019-06-25 11:55:59 +09:00
Yu Watanabe
72dda93acb
ethtool: add missing link mode
2019-06-25 11:55:04 +09:00
Yu Watanabe
d16c272844
ethtool-util: fix returned value when ethtool_cmd_speed() is SPEED_UNKNOWN
2019-06-25 11:44:19 +09:00
Yu Watanabe
33a8695fdc
ethtool-util: introduce ethtool_get_link_info()
...
Will be used in later commits.
2019-06-19 23:15:19 +09:00
Yu Watanabe
7864b16b27
ethtool-util: make ethtool_connect() warn on failure
2019-06-19 23:15:19 +09:00
Yu Watanabe
b9bc7d42e3
ethtool-util: use structured initializers
2019-06-19 23:15:13 +09:00
Yu Watanabe
5c2316c605
ethtool-util: move from src/udev/net/ to src/shared/
2019-06-19 09:03:50 +09:00