netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bonding: fix incorrect software timestamping report
@ 2024-06-20  8:56 Hangbin Liu
  2024-06-20  9:13 ` Kory Maincent
  2024-06-21 10:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Hangbin Liu @ 2024-06-20  8:56 UTC (permalink / raw)
  To: netdev
  Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Kory Maincent,
	Florian Fainelli, Hangbin Liu, Liang Li

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(+)

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) {
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] bonding: fix incorrect software timestamping report
  2024-06-20  8:56 [PATCH net] bonding: fix incorrect software timestamping report Hangbin Liu
@ 2024-06-20  9:13 ` Kory Maincent
  2024-06-21 10:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kory Maincent @ 2024-06-20  9:13 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, Jay Vosburgh, Andy Gospodarek, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran,
	Florian Fainelli, Liang Li

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] bonding: fix incorrect software timestamping report
  2024-06-20  8:56 [PATCH net] bonding: fix incorrect software timestamping report Hangbin Liu
  2024-06-20  9:13 ` Kory Maincent
@ 2024-06-21 10:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-21 10:30 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, j.vosburgh, andy, davem, edumazet, kuba, pabeni,
	richardcochran, kory.maincent, florian.fainelli, liali

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-21 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20  8:56 [PATCH net] bonding: fix incorrect software timestamping report Hangbin Liu
2024-06-20  9:13 ` Kory Maincent
2024-06-21 10:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).