From patchwork Tue Feb 22 21:43:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Berggren X-Patchwork-Id: 84011 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 92D9AB7108 for ; Wed, 23 Feb 2011 08:43:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754294Ab1BVVny (ORCPT ); Tue, 22 Feb 2011 16:43:54 -0500 Received: from vsp.halon.se ([212.37.18.222]:54548 "EHLO vsp.halon.se" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751749Ab1BVVnx convert rfc822-to-8bit (ORCPT ); Tue, 22 Feb 2011 16:43:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=halon.se; s=spaceship; h=received:received:subject:content-transfer-encoding:from:content-type: message-id:date:cc:to:mime-version:x-mailer; bh=WnkDmNQTL+Xojfxo2V2vy9kXf3p8cbEhU68v2rWtFys=; b=AIBciZae1y3HTFD9lX/i+h0VGsBaS657zMq2SbecooiJBBIuOIbKcSmCx0emS1N7ngTZ5qBV8chWH dTCQfK7Apgrob/xTxRc5aBF2LfyoTiIgVBg46ZIYStTVpKGeNg5mY4Y18s6t2d2i22udJLT3euoMym 0hiMSdzkh5oZJqM8= Received: from zimbra.halon.se (unknown [213.80.29.55]) by vsp.halon.se (Halon Mail Gateway) with ESMTP; Tue, 22 Feb 2011 22:43:48 +0100 (CET) Received: from [192.168.12.220] (90-231-103-86-no94.tbcn.telia.com [90.231.103.86]) by zimbra.halon.se (Postfix) with ESMTPSA id B5DEA34637; Tue, 22 Feb 2011 22:43:48 +0100 (CET) Subject: [PATCH] net: TX timestamps for IPv6 UDP packets From: Anders Berggren Message-Id: <240353FF-7F9F-428C-84C3-3BD9B43213EE@halon.se> Date: Tue, 22 Feb 2011 22:43:47 +0100 Cc: netdev@vger.kernel.org To: John Ronciak Mime-Version: 1.0 (Apple Message framework v1082) X-Mailer: Apple Mail (2.1082) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enabling TX timestamps (SO_TIMESTAMPING) for IPv6 UDP packets, in the same fashion as for IPv4. Necessary in order for NICs such as Intel 82580 to timestamp IPv6 packets. Signed-off-by: Anders Berggren --- -- 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 --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 */