diff mbox

usbnet: add timestamping support

Message ID 20110921121151.Horde.2_LlPML8999Oebhn0-QlTpA@webmail.df.eu
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Riesch Sept. 21, 2011, 10:11 a.m. UTC
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(-)

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

Comments

Michael Riesch Sept. 21, 2011, 11:09 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 28, 2011, 7:20 a.m. UTC | #2
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Riesch Sept. 29, 2011, 2:08 p.m. UTC | #3
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)