public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Gal Pressman <gal@nvidia•com>
To: "David S. Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>
Cc: netdev@vger•kernel.org, "Jay Vosburgh" <jv@jvosburgh•net>,
	"Andy Gospodarek" <andy@greyhouse•net>,
	"Marc Kleine-Budde" <mkl@pengutronix•de>,
	"Vincent Mailhol" <mailhol.vincent@wanadoo•fr>,
	"Shyam Sundar S K" <Shyam-sundar.S-k@amd•com>,
	"Sudarsana Kalluru" <skalluru@marvell•com>,
	"Manish Chopra" <manishc@marvell•com>,
	"Michael Chan" <michael.chan@broadcom•com>,
	"Pavan Chebbi" <pavan.chebbi@broadcom•com>,
	"Nicolas Ferre" <nicolas.ferre@microchip•com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon•dev>,
	"Sunil Goutham" <sgoutham@marvell•com>,
	"Potnuri Bharat Teja" <bharat@chelsio•com>,
	"Christian Benvenuti" <benve@cisco•com>,
	"Satish Kharat" <satishkh@cisco•com>,
	"Claudiu Manoil" <claudiu.manoil@nxp•com>,
	"Vladimir Oltean" <vladimir.oltean@nxp•com>,
	"Wei Fang" <wei.fang@nxp•com>,
	"Shenwei Wang" <shenwei.wang@nxp•com>,
	"Clark Wang" <xiaoning.wang@nxp•com>,
	"Dimitris Michailidis" <dmichail@fungible•com>,
	"Yisen Zhuang" <yisen.zhuang@huawei•com>,
	"Salil Mehta" <salil.mehta@huawei•com>,
	"Jijie Shao" <shaojijie@huawei•com>,
	"Tony Nguyen" <anthony.l.nguyen@intel•com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel•com>,
	"Marcin Wojtas" <marcin.s.wojtas@gmail•com>,
	"Russell King" <linux@armlinux•org.uk>,
	"Geetha sowjanya" <gakula@marvell•com>,
	"Subbaraya Sundeep" <sbhatta@marvell•com>,
	hariprasad <hkelam@marvell•com>,
	"Ido Schimmel" <idosch@nvidia•com>,
	"Petr Machata" <petrm@nvidia•com>,
	"Bryan Whitehead" <bryan.whitehead@microchip•com>,
	UNGLinuxDriver@microchip•com,
	"Horatiu Vultur" <horatiu.vultur@microchip•com>,
	"Lars Povlsen" <lars.povlsen@microchip•com>,
	"Steen Hegelund" <Steen.Hegelund@microchip•com>,
	"Daniel Machon" <daniel.machon@microchip•com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin•com>,
	"Shannon Nelson" <shannon.nelson@amd•com>,
	"Brett Creeley" <brett.creeley@amd•com>,
	"Sergey Shtylyov" <s.shtylyov@omp•ru>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas•com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech•se>,
	"Edward Cree" <ecree.xilinx@gmail•com>,
	"Martin Habets" <habetsm.xilinx@gmail•com>,
	"Alexandre Torgue" <alexandre.torgue@foss•st.com>,
	"Jose Abreu" <joabreu@synopsys•com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail•com>,
	"Siddharth Vadapalli" <s-vadapalli@ti•com>,
	"Roger Quadros" <rogerq@kernel•org>,
	"MD Danish Anwar" <danishanwar@ti•com>,
	"Linus Walleij" <linusw@kernel•org>,
	"Imre Kaloz" <kaloz@openwrt•org>,
	"Richard Cochran" <richardcochran@gmail•com>,
	"Willem de Bruijn" <willemdebruijn.kernel@gmail•com>,
	"Gal Pressman" <gal@nvidia•com>,
	"Rahul Rameshbabu" <rrameshbabu@nvidia•com>
Subject: [PATCH net-next 1/2] ethtool: RX software timestamp for all
Date: Thu, 29 Aug 2024 17:42:52 +0300	[thread overview]
Message-ID: <20240829144253.122215-2-gal@nvidia.com> (raw)
In-Reply-To: <20240829144253.122215-1-gal@nvidia.com>

All devices support SOF_TIMESTAMPING_RX_SOFTWARE by virtue of
net_timestamp_check() being called in the device independent code.

Move the responsibility of reporting SOF_TIMESTAMPING_RX_SOFTWARE and
SOF_TIMESTAMPING_SOFTWARE, and setting PHC index to -1 to the core.
Device drivers no longer need to use them.

Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail•com>
Link: https://lore.kernel.org/netdev/661550e348224_23a2b2294f7@willemb.c.googlers.com.notmuch/
Co-developed-by: Rahul Rameshbabu <rrameshbabu@nvidia•com>
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia•com>
Signed-off-by: Gal Pressman <gal@nvidia•com>
---
 net/ethtool/common.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 7257ae272296..aa7010f97152 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -695,20 +695,21 @@ int __ethtool_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info
 {
 	const struct ethtool_ops *ops = dev->ethtool_ops;
 	struct phy_device *phydev = dev->phydev;
+	int err = 0;
 
 	memset(info, 0, sizeof(*info));
 	info->cmd = ETHTOOL_GET_TS_INFO;
-
-	if (phy_is_default_hwtstamp(phydev) && phy_has_tsinfo(phydev))
-		return phy_ts_info(phydev, info);
-	if (ops->get_ts_info)
-		return ops->get_ts_info(dev, info);
-
-	info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
-				SOF_TIMESTAMPING_SOFTWARE;
 	info->phc_index = -1;
 
-	return 0;
+	if (phy_is_default_hwtstamp(phydev) && phy_has_tsinfo(phydev))
+		err = phy_ts_info(phydev, info);
+	else if (ops->get_ts_info)
+		err = ops->get_ts_info(dev, info);
+
+	info->so_timestamping |= SOF_TIMESTAMPING_RX_SOFTWARE |
+				 SOF_TIMESTAMPING_SOFTWARE;
+
+	return err;
 }
 
 int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index)
-- 
2.40.1


  reply	other threads:[~2024-08-29 14:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 14:42 [PATCH net-next 0/2] RX software timestamp for all Gal Pressman
2024-08-29 14:42 ` Gal Pressman [this message]
2024-08-29 16:49   ` [PATCH net-next 1/2] ethtool: " Marc Kleine-Budde
2024-08-30 14:46   ` Willem de Bruijn
2024-08-29 14:42 ` [PATCH net-next 2/2] net: Remove setting of RX software timestamp from drivers Gal Pressman
2024-08-29 16:49   ` Marc Kleine-Budde
2024-08-29 19:20   ` Gerhard Engleder
2024-08-29 20:23   ` Nelson, Shannon
2024-08-29 20:44   ` Niklas Söderlund
2024-08-30 17:07     ` Gal Pressman
2024-08-30  1:28   ` Jijie Shao
2024-08-30  1:49   ` Wei Fang
2024-08-30  6:00   ` Subbaraya Sundeep
2024-08-30  6:10   ` Raju.Lakkaraju
2024-08-30  9:58   ` Petr Machata
2024-08-30 11:49   ` Roger Quadros
2024-08-30 20:39   ` Tony Nguyen
2024-08-30 21:16   ` Richard Cochran
2024-08-31 17:19     ` Gal Pressman
2024-08-31 20:13       ` Richard Cochran
2024-08-31 10:33   ` Potnuri Bharat Teja
2024-09-02  8:25   ` Martin Habets
2024-09-02  8:38   ` Shyam Sundar S K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240829144253.122215-2-gal@nvidia.com \
    --to=gal@nvidia$(echo .)com \
    --cc=Shyam-sundar.S-k@amd$(echo .)com \
    --cc=Steen.Hegelund@microchip$(echo .)com \
    --cc=UNGLinuxDriver@microchip$(echo .)com \
    --cc=alexandre.belloni@bootlin$(echo .)com \
    --cc=alexandre.torgue@foss$(echo .)st.com \
    --cc=andy@greyhouse$(echo .)net \
    --cc=anthony.l.nguyen@intel$(echo .)com \
    --cc=benve@cisco$(echo .)com \
    --cc=bharat@chelsio$(echo .)com \
    --cc=brett.creeley@amd$(echo .)com \
    --cc=bryan.whitehead@microchip$(echo .)com \
    --cc=claudiu.beznea@tuxon$(echo .)dev \
    --cc=claudiu.manoil@nxp$(echo .)com \
    --cc=daniel.machon@microchip$(echo .)com \
    --cc=danishanwar@ti$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dmichail@fungible$(echo .)com \
    --cc=ecree.xilinx@gmail$(echo .)com \
    --cc=gakula@marvell$(echo .)com \
    --cc=habetsm.xilinx@gmail$(echo .)com \
    --cc=hkelam@marvell$(echo .)com \
    --cc=horatiu.vultur@microchip$(echo .)com \
    --cc=idosch@nvidia$(echo .)com \
    --cc=joabreu@synopsys$(echo .)com \
    --cc=jv@jvosburgh$(echo .)net \
    --cc=kaloz@openwrt$(echo .)org \
    --cc=kuba@kernel$(echo .)org \
    --cc=lars.povlsen@microchip$(echo .)com \
    --cc=linusw@kernel$(echo .)org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=mailhol.vincent@wanadoo$(echo .)fr \
    --cc=manishc@marvell$(echo .)com \
    --cc=marcin.s.wojtas@gmail$(echo .)com \
    --cc=mcoquelin.stm32@gmail$(echo .)com \
    --cc=michael.chan@broadcom$(echo .)com \
    --cc=mkl@pengutronix$(echo .)de \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nicolas.ferre@microchip$(echo .)com \
    --cc=niklas.soderlund@ragnatech$(echo .)se \
    --cc=pavan.chebbi@broadcom$(echo .)com \
    --cc=petrm@nvidia$(echo .)com \
    --cc=przemyslaw.kitszel@intel$(echo .)com \
    --cc=richardcochran@gmail$(echo .)com \
    --cc=rogerq@kernel$(echo .)org \
    --cc=rrameshbabu@nvidia$(echo .)com \
    --cc=s-vadapalli@ti$(echo .)com \
    --cc=s.shtylyov@omp$(echo .)ru \
    --cc=salil.mehta@huawei$(echo .)com \
    --cc=satishkh@cisco$(echo .)com \
    --cc=sbhatta@marvell$(echo .)com \
    --cc=sgoutham@marvell$(echo .)com \
    --cc=shannon.nelson@amd$(echo .)com \
    --cc=shaojijie@huawei$(echo .)com \
    --cc=shenwei.wang@nxp$(echo .)com \
    --cc=skalluru@marvell$(echo .)com \
    --cc=vladimir.oltean@nxp$(echo .)com \
    --cc=wei.fang@nxp$(echo .)com \
    --cc=willemdebruijn.kernel@gmail$(echo .)com \
    --cc=xiaoning.wang@nxp$(echo .)com \
    --cc=yisen.zhuang@huawei$(echo .)com \
    --cc=yoshihiro.shimoda.uh@renesas$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox