lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16053.1681503190@famine>
Date:   Fri, 14 Apr 2023 13:13:10 -0700
From:   Jay Vosburgh <jay.vosburgh@...onical.com>
To:     Hangbin Liu <liuhangbin@...il.com>
cc:     netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jonathan Toppins <jtoppins@...hat.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Liang Li <liali@...hat.com>,
        Simon Horman <simon.horman@...igine.com>,
        Miroslav Lichvar <mlichvar@...hat.com>
Subject: Re: [PATCHv4 net-next] bonding: add software tx timestamping support

Hangbin Liu <liuhangbin@...il.com> wrote:

>Currently, bonding only obtain the timestamp (ts) information of
>the active slave, which is available only for modes 1, 5, and 6.
>For other modes, bonding only has software rx timestamping support.
>
>However, some users who use modes such as LACP also want tx timestamp
>support. To address this issue, let's check the ts information of each
>slave. If all slaves support tx timestamping, we can enable tx
>timestamping support for the bond.
>
>Suggested-by: Miroslav Lichvar <mlichvar@...hat.com>
>Signed-off-by: Hangbin Liu <liuhangbin@...il.com>

Acked-by: Jay Vosburgh <jay.vosburgh@...onical.com>

	-J

>---
>v4: add ASSERT_RTNL to make sure bond_ethtool_get_ts_info() called via
>    RTNL. Only check _TX_SOFTWARE for the slaves.
>v3: remove dev_hold/dev_put. remove the '\' for line continuation.
>v2: check each slave's ts info to make sure bond support sw tx
>    timestamping
>---
> drivers/net/bonding/bond_main.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 00646aa315c3..9cf49b61f4b3 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -5686,11 +5686,17 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> 				    struct ethtool_ts_info *info)
> {
> 	struct bonding *bond = netdev_priv(bond_dev);
>+	struct ethtool_ts_info ts_info;
> 	const struct ethtool_ops *ops;
> 	struct net_device *real_dev;
>+	bool sw_tx_support = false;
> 	struct phy_device *phydev;
>+	struct list_head *iter;
>+	struct slave *slave;
> 	int ret = 0;
> 
>+	ASSERT_RTNL();
>+
> 	rcu_read_lock();
> 	real_dev = bond_option_active_slave_get_rcu(bond);
> 	dev_hold(real_dev);
>@@ -5707,10 +5713,36 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> 			ret = ops->get_ts_info(real_dev, info);
> 			goto out;
> 		}
>+	} else {
>+		/* Check if all slaves support software tx timestamping */
>+		rcu_read_lock();
>+		bond_for_each_slave_rcu(bond, slave, iter) {
>+			ret = -1;
>+			ops = slave->dev->ethtool_ops;
>+			phydev = slave->dev->phydev;
>+
>+			if (phy_has_tsinfo(phydev))
>+				ret = phy_ts_info(phydev, &ts_info);
>+			else if (ops->get_ts_info)
>+				ret = ops->get_ts_info(slave->dev, &ts_info);
>+
>+			if (!ret && (ts_info.so_timestamping & SOF_TIMESTAMPING_TX_SOFTWARE)) {
>+				sw_tx_support = true;
>+				continue;
>+			}
>+
>+			sw_tx_support = false;
>+			break;
>+		}
>+		rcu_read_unlock();
> 	}
> 
>+	ret = 0;
> 	info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
> 				SOF_TIMESTAMPING_SOFTWARE;
>+	if (sw_tx_support)
>+		info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE;
>+
> 	info->phc_index = -1;
> 
> out:
>-- 
>2.38.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ