diff mbox series

[net] bonding: fix incorrect software timestamping report

Message ID 20240620085626.1123399-1-liuhangbin@gmail.com (mailing list archive)
State Accepted
Commit a95b031c6796bf9972da2d4b4b524a57734f3a0a
Delegated to: Netdev Maintainers
Headers show
Series [net] bonding: fix incorrect software timestamping report | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 859 this patch: 859
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 863 this patch: 863
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 863 this patch: 863
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 13 this patch: 13
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-21--03-00 (tests: 659)

Commit Message

Hangbin Liu June 20, 2024, 8:56 a.m. UTC
The __ethtool_get_ts_info function returns directly if the device has a
get_ts_info() method. For bonding with an active slave, this works correctly
as we simply return the real device's timestamping information. However,
when there is no active slave, we only check the slave's TX software
timestamp information. We still need to set the phc index and RX timestamp
information manually. Otherwise, the result will be look like:

  Time stamping parameters for bond0:
  Capabilities:
          software-transmit
  PTP Hardware Clock: 0
  Hardware Transmit Timestamp Modes: none
  Hardware Receive Filter Modes: none

This issue does not affect VLAN or MACVLAN devices, as they only have one
downlink and can directly use the downlink's timestamping information.

Fixes: b8768dc40777 ("net: ethtool: Refactor identical get_ts_info implementations.")
Reported-by: Liang Li <liali@redhat.com>
Closes: https://issues.redhat.com/browse/RHEL-42409
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 drivers/net/bonding/bond_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kory Maincent June 20, 2024, 9:13 a.m. UTC | #1
On Thu, 20 Jun 2024 16:56:26 +0800
Hangbin Liu <liuhangbin@gmail.com> wrote:

> The __ethtool_get_ts_info function returns directly if the device has a
> get_ts_info() method. For bonding with an active slave, this works correctly
> as we simply return the real device's timestamping information. However,
> when there is no active slave, we only check the slave's TX software
> timestamp information. We still need to set the phc index and RX timestamp
> information manually. Otherwise, the result will be look like:
> 
>   Time stamping parameters for bond0:
>   Capabilities:
>           software-transmit
>   PTP Hardware Clock: 0
>   Hardware Transmit Timestamp Modes: none
>   Hardware Receive Filter Modes: none
> 
> This issue does not affect VLAN or MACVLAN devices, as they only have one
> downlink and can directly use the downlink's timestamping information.

Acked-by: Kory Maincent <kory.maincent@bootlin.com>

--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
patchwork-bot+netdevbpf@kernel.org June 21, 2024, 10:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 20 Jun 2024 16:56:26 +0800 you wrote:
> The __ethtool_get_ts_info function returns directly if the device has a
> get_ts_info() method. For bonding with an active slave, this works correctly
> as we simply return the real device's timestamping information. However,
> when there is no active slave, we only check the slave's TX software
> timestamp information. We still need to set the phc index and RX timestamp
> information manually. Otherwise, the result will be look like:
> 
> [...]

Here is the summary with links:
  - [net] bonding: fix incorrect software timestamping report
    https://git.kernel.org/netdev/net/c/a95b031c6796

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3c3fcce4acd4..d19aabf5d4fb 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5773,6 +5773,9 @@  static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
 	if (real_dev) {
 		ret = ethtool_get_ts_info_by_layer(real_dev, info);
 	} else {
+		info->phc_index = -1;
+		info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
+					SOF_TIMESTAMPING_SOFTWARE;
 		/* Check if all slaves support software tx timestamping */
 		rcu_read_lock();
 		bond_for_each_slave_rcu(bond, slave, iter) {