linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH net-next 1/4] gianfar: Added stub support for SIOCSHWTSTAMP
@ 2010-04-07  9:46 Manfred Rudigier
  2010-04-07 10:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Manfred Rudigier @ 2010-04-07  9:46 UTC (permalink / raw)
  To: 'sandeep.kumar@freescale.com'
  Cc: 'netdev@vger.kernel.org',
	'linuxppc-dev@lists.ozlabs.org'

This ioctl command is required for enabling hardware time stamping support
for network packets, see Documentation/networking/timestamping.txt. At the
moment nothing will be done for all requests that enable time stamping and
thus ERANGE will be returned.

Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
---
 drivers/net/gianfar.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 080d1ce..309bab0 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -82,6 +82,7 @@
 #include <linux/tcp.h>
 #include <linux/udp.h>
 #include <linux/in.h>
+#include <linux/net_tstamp.h>
=20
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -772,6 +773,38 @@ err_grp_init:
 	return err;
 }
=20
+static int gfar_hwtstamp_ioctl(struct net_device *netdev,
+			struct ifreq *ifr, int cmd)
+{
+	struct hwtstamp_config config;
+
+	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+		return -EFAULT;
+
+	/* reserved for future extensions */
+	if (config.flags)
+		return -EINVAL;
+
+	switch (config.tx_type) {
+	case HWTSTAMP_TX_OFF:
+		break;
+	case HWTSTAMP_TX_ON:
+		return -ERANGE;
+	default:
+		return -ERANGE;
+	}
+
+	switch (config.rx_filter) {
+	case HWTSTAMP_FILTER_NONE:
+		break;
+	default:
+		return -ERANGE;
+	}
+
+	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+		-EFAULT : 0;
+}
+
 /* Ioctl MII Interface */
 static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
@@ -780,6 +813,9 @@ static int gfar_ioctl(struct net_device *dev, struct if=
req *rq, int cmd)
 	if (!netif_running(dev))
 		return -EINVAL;
=20
+	if (cmd =3D=3D SIOCSHWTSTAMP)
+		return gfar_hwtstamp_ioctl(dev, rq, cmd);
+
 	if (!priv->phydev)
 		return -ENODEV;
=20
--=20
1.6.3.3

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

* Re: [RFC PATCH net-next 1/4] gianfar: Added stub support for SIOCSHWTSTAMP
  2010-04-07  9:46 [RFC PATCH net-next 1/4] gianfar: Added stub support for SIOCSHWTSTAMP Manfred Rudigier
@ 2010-04-07 10:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-04-07 10:26 UTC (permalink / raw)
  To: Manfred.Rudigier; +Cc: netdev, sandeep.kumar, linuxppc-dev

From: Manfred Rudigier <Manfred.Rudigier@omicron.at>
Date: Wed, 7 Apr 2010 11:46:08 +0200

> This ioctl command is required for enabling hardware time stamping support
> for network packets, see Documentation/networking/timestamping.txt. At the
> moment nothing will be done for all requests that enable time stamping and
> thus ERANGE will be returned.
> 
> Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>

This is completely pointless.

Something sane should happen so that every driver doesn't
need to add this stub code just to return -ERANGE.

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

end of thread, other threads:[~2010-04-07 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-07  9:46 [RFC PATCH net-next 1/4] gianfar: Added stub support for SIOCSHWTSTAMP Manfred Rudigier
2010-04-07 10:26 ` David Miller

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).