netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TX timestamp IPv6 support
@ 2011-02-15 13:56 Anders Berggren
  2011-02-22 17:36 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Anders Berggren @ 2011-02-15 13:56 UTC (permalink / raw)
  To: netdev; +Cc: John Ronciak

This patch enables UDP IPv6 TX timestamping (using SO_TIMESTAMPING, enabled by CONFIG_NETWORK_PHY_TIMESTAMPING) as Marcus D. Leech suggested in http://kerneltrap.org/mailarchive/linux-netdev/2009/11/10/6260604 and http://kerneltrap.org/mailarchive/linux-netdev/2009/11/11/6260643 

It's mostly copied from net/ipv4/udp.c. I guess it would be better to run sock_tx_timestamp in ipv6/udp.c and pass it to ipv6/ip6_output.c's ip6_append_data somehow, but I didn't find a suitable struct to extend for this purpose. 

Anders Berggren
Halon Security

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 94b5bf1..74d9343 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1115,6 +1115,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
        int err;
        int offset = 0;
        int csummode = CHECKSUM_NONE;
+       __u8 tx_flags = 0;
 
        if (flags&MSG_PROBE)
                return 0;
@@ -1199,6 +1200,13 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
                }
        }
 
+       /* For UDP, check if TX timestamp is enabled */ 
+       if (sk->sk_type == SOCK_DGRAM) {
+               err = sock_tx_timestamp(sk, &tx_flags);
+               if (err)
+                       goto error;
+       }
+
        /*
         * Let's try using as much space as possible.
         * Use MTU if total length of the message fits into the MTU.
@@ -1303,6 +1311,10 @@ alloc_new_skb:
                                                           sk->sk_allocation);
                                if (unlikely(skb == NULL))
                                        err = -ENOBUFS;
+                               else
+                                       /* only the initial fragment is
+                                          time stamped */
+                                       tx_flags = 0;
                        }
                        if (skb == NULL)
                                goto error;
@@ -1314,6 +1326,9 @@ alloc_new_skb:
                        /* reserve for fragmentation */
                        skb_reserve(skb, hh_len+sizeof(struct frag_hdr));
 
+                       if (sk->sk_type == SOCK_DGRAM) 
+                               skb_shinfo(skb)->tx_flags = tx_flags;
+
                        /*
                         *      Find where to start putting bytes
                         */


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

* Re: [PATCH] TX timestamp IPv6 support
  2011-02-15 13:56 [PATCH] TX timestamp IPv6 support Anders Berggren
@ 2011-02-22 17:36 ` David Miller
  2011-02-22 21:50   ` Anders Berggren
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-02-22 17:36 UTC (permalink / raw)
  To: anders; +Cc: netdev, john.ronciak

From: Anders Berggren <anders@halon.se>
Date: Tue, 15 Feb 2011 14:56:21 +0100

> This patch enables UDP IPv6 TX timestamping (using SO_TIMESTAMPING,
> enabled by CONFIG_NETWORK_PHY_TIMESTAMPING) as Marcus D. Leech
> suggested in
> http://kerneltrap.org/mailarchive/linux-netdev/2009/11/10/6260604
> and
> http://kerneltrap.org/mailarchive/linux-netdev/2009/11/11/6260643
> 
> It's mostly copied from net/ipv4/udp.c. I guess it would be better
> to run sock_tx_timestamp in ipv6/udp.c and pass it to
> ipv6/ip6_output.c's ip6_append_data somehow, but I didn't find a
> suitable struct to extend for this purpose.

Please submit your change properly, as per Documentation/SubmittingPatches,
in particular you need to provide a proper Signed-off-by: tag for your
change.


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

* Re: [PATCH] TX timestamp IPv6 support
  2011-02-22 17:36 ` David Miller
@ 2011-02-22 21:50   ` Anders Berggren
  0 siblings, 0 replies; 3+ messages in thread
From: Anders Berggren @ 2011-02-22 21:50 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

> Please submit your change properly, as per Documentation/SubmittingPatches,
> in particular you need to provide a proper Signed-off-by: tag for your
> change.

Thank you. I made a second try:

http://marc.info/?l=linux-netdev&m=129841103607145&w=2

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

end of thread, other threads:[~2011-02-22 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15 13:56 [PATCH] TX timestamp IPv6 support Anders Berggren
2011-02-22 17:36 ` David Miller
2011-02-22 21:50   ` Anders Berggren

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