netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] usbnet: add timestamping support
@ 2011-09-21 10:11 Michael Riesch
  2011-09-21 11:09 ` Michael Riesch
  2011-09-28  7:20 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Riesch @ 2011-09-21 10:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, Oliver Neukum

In order to make USB-to-Ethernet-adapters (depending on usbnet) support
time stamping, the "skb_defer_rx_timestamp" and "skb_tx_timestamp"
function calls are added.

I considered to put these calls between #ifdef's to make them dependent
on CONFIG_NETWORK_PHY_TIMESTAMPING. I decided not to do so because except
the check whether the current packet is a PTP packet (and this check
should be fast) no overhead occurs. But let me know your opinion about
that one.

Looking forward to your comments,
Michael

Signed-off-by: Michael Riesch <michael@riesch.at>
---
  drivers/net/usb/usbnet.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ce395fe..cdb9588 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -238,6 +238,10 @@ void usbnet_skb_return (struct usbnet *dev,  
struct sk_buff *skb)
          netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
                    skb->len + sizeof (struct ethhdr), skb->protocol);
          memset (skb->cb, 0, sizeof (struct skb_data));
+
+        if (skb_defer_rx_timestamp(skb))
+                return;
+
          status = netif_rx (skb);
          if (status != NET_RX_SUCCESS)
                  netif_dbg(dev, rx_err, dev->net,
@@ -1053,6 +1057,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
          unsigned long                flags;
          int retval;

+        skb_tx_timestamp(skb);
+
          // some devices want funky USB-level framing, for
          // win32 driver (usually) and/or hardware quirks
          if (info->tx_fixup) {
-- 
1.7.0.4

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

* Re: [patch] usbnet: add timestamping support
  2011-09-21 10:11 Michael Riesch
@ 2011-09-21 11:09 ` Michael Riesch
  2011-09-28  7:20 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Riesch @ 2011-09-21 11:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Oliver Neukum

Quoting Michael Riesch <michael@riesch.at>:
> I considered to put these calls between #ifdef's to make them dependent
> on CONFIG_NETWORK_PHY_TIMESTAMPING. I decided not to do so because except
> the check whether the current packet is a PTP packet (and this check
> should be fast) no overhead occurs. But let me know your opinion about
> that one.

Come to think of it the #ifdef's are definitely unnecessary because these
functions are no-ops with CONFIG_NETWORK_PHY_TIMESTAMPING not set.

Regards,
Michael

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

* Re: [patch] usbnet: add timestamping support
  2011-09-21 10:11 Michael Riesch
  2011-09-21 11:09 ` Michael Riesch
@ 2011-09-28  7:20 ` David Miller
  2011-09-29 14:08   ` Michael Riesch
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2011-09-28  7:20 UTC (permalink / raw)
  To: michael; +Cc: netdev, oneukum

From: Michael Riesch <michael@riesch.at>
Date: Wed, 21 Sep 2011 12:11:51 +0200

> @@ -238,6 +238,10 @@ void usbnet_skb_return (struct usbnet *dev,
> struct sk_buff *skb)

Patch is severly corrupted by your email client.

Correct this (see Documentation/email-clients.txt), send a test patch
to yourself, and only resubmit this change when you can successfully
apply a patch you send to youself.

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

* [patch] usbnet: add timestamping support
@ 2011-09-29 14:06 Michael Riesch
  2011-09-29 18:55 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Riesch @ 2011-09-29 14:06 UTC (permalink / raw)
  To: netdev; +Cc: oneukum, davem, Michael Riesch

In order to make USB-to-Ethernet-adapters (depending on usbnet) support
timestamping, the "skb_defer_rx_timestamp" and "skb_tx_timestamp" function
calls are added.

Signed-off-by: Michael Riesch <michael@riesch.at>
---
 drivers/net/usb/usbnet.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 2ab9b98..b57b57b 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -239,6 +239,10 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
 	netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
 		  skb->len + sizeof (struct ethhdr), skb->protocol);
 	memset (skb->cb, 0, sizeof (struct skb_data));
+
+	if (skb_defer_rx_timestamp(skb))
+		return;
+
 	status = netif_rx (skb);
 	if (status != NET_RX_SUCCESS)
 		netif_dbg(dev, rx_err, dev->net,
@@ -1071,6 +1075,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 	unsigned long		flags;
 	int retval;
 
+	skb_tx_timestamp(skb);
+
 	// some devices want funky USB-level framing, for
 	// win32 driver (usually) and/or hardware quirks
 	if (info->tx_fixup) {
-- 
1.6.3.3

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

* Re: [patch] usbnet: add timestamping support
  2011-09-28  7:20 ` David Miller
@ 2011-09-29 14:08   ` Michael Riesch
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Riesch @ 2011-09-29 14:08 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, oneukum

On Wed, 2011-09-28 at 03:20 -0400, David Miller wrote:
> Patch is severly corrupted by your email client.
> 
> Correct this (see Documentation/email-clients.txt), send a test patch
> to yourself, and only resubmit this change when you can successfully
> apply a patch you send to youself.

Sorry about that. I switched to git-send-email and tested it. I hope it
works now.

Regards, Michael

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

* Re: [patch] usbnet: add timestamping support
  2011-09-29 14:06 [patch] usbnet: add timestamping support Michael Riesch
@ 2011-09-29 18:55 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-09-29 18:55 UTC (permalink / raw)
  To: michael; +Cc: netdev, oneukum

From: Michael Riesch <michael@riesch.at>
Date: Thu, 29 Sep 2011 16:06:26 +0200

> In order to make USB-to-Ethernet-adapters (depending on usbnet) support
> timestamping, the "skb_defer_rx_timestamp" and "skb_tx_timestamp" function
> calls are added.
> 
> Signed-off-by: Michael Riesch <michael@riesch.at>

Applied.

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

end of thread, other threads:[~2011-09-29 18:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 14:06 [patch] usbnet: add timestamping support Michael Riesch
2011-09-29 18:55 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2011-09-21 10:11 Michael Riesch
2011-09-21 11:09 ` Michael Riesch
2011-09-28  7:20 ` David Miller
2011-09-29 14:08   ` Michael Riesch

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