From patchwork Tue Aug 23 22:22:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soheil Hassas Yeganeh X-Patchwork-Id: 662087 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 3sJlMs522qz9sf6 for ; Wed, 24 Aug 2016 08:23:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=zHgJ0tOB; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755515AbcHWWXu (ORCPT ); Tue, 23 Aug 2016 18:23:50 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34294 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754335AbcHWWXr (ORCPT ); Tue, 23 Aug 2016 18:23:47 -0400 Received: by mail-qt0-f194.google.com with SMTP id c52so4304807qte.1 for ; Tue, 23 Aug 2016 15:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=95tudOquiiraZz+ucxEWRJKZrPCUucaZAZ2U1/k5Uys=; b=zHgJ0tOBLJZjpB7SXfqYpv6NO8rZCZOc/zCL4D8cbymoIXsNSqTrgj8iDIxl6tm8+G um474sqR6bi3enLxJ9z4V3lWSjKAk8M4lLXciX2yKqK3qonHrxprASwLVjX1HUS+3cJQ uqzv5iX9U1NTwGgDP7c9qjSgsHhhl1tMC0IfBVQWhvcVeARHdSLNBzuJ9mhoVSBRAp8D HK2hlScsc391VDa+4jaSCBu6cCTmCi35niEhfQUbC2ZK9KJERHX2N2e1Kjfe0YjTOabJ jZKcwSwqtbFUhTuI98wv1EJLdTu5kwaFqmjJLY+pk4GNHzDdlHcacMxXoe6H+2yL4WVI PfAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=95tudOquiiraZz+ucxEWRJKZrPCUucaZAZ2U1/k5Uys=; b=QLoIxdNFkuAXXhQrRVfrpVtZHMa3RcBuAPT9eB0ho79+LFPNbBD8TyEH7NNgGbbXei pFTWGaJpiAVXBYKEF4YWBkLTM1DwyYbZKihYGqYtTqJRCBlazD4+SYezUTPuOq8TdGkU BgIP0o0bX99U0RmYRwHs9EmB9P/1gx8zVryUK8jHSSszUj+iYo+7HRF9tpFn0//jhhaF iLvi/VL43+c2G5lM4vfBFCIgM7iJkA+qnAq4YeBao7piD+Du4R3EYnddqtW979xHjWWt ZkDDO824amtzkGJ0ceoMCu22YWZK7usL8/XZkKIRTGhjVKSbxMkRKjYD8NaEhdZD3LX2 kMPg== X-Gm-Message-State: AEkoouusvKGRiRtHD2TcM5Hq1gS9MS0Rd4V2Klc5kw9lUBykOE9dlYpwXelIxD6zB7Hllw== X-Received: by 10.200.46.122 with SMTP id s55mr33133025qta.80.1471990970474; Tue, 23 Aug 2016 15:22:50 -0700 (PDT) Received: from soheil.nyc.corp.google.com ([100.101.230.57]) by smtp.gmail.com with ESMTPSA id c78sm2981055qke.17.2016.08.23.15.22.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Aug 2016 15:22:50 -0700 (PDT) From: Soheil Hassas Yeganeh To: davem@davemloft.net, netdev@vger.kernel.org Cc: Soheil Hassas Yeganeh Subject: [PATCH net] tun: fix transmit timestamp support Date: Tue, 23 Aug 2016 18:22:33 -0400 Message-Id: <1471990953-6793-1-git-send-email-soheil.kdev@gmail.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Soheil Hassas Yeganeh Instead of using sock_tx_timestamp, use skb_tx_timestamp to record software transmit timestamp of a packet. sock_tx_timestamp resets and overrides the tx_flags of the skb. The function is intended to be called from within the protocol layer when creating the skb, not from a device driver. This is inconsistent with other drivers and will cause issues for TCP. In TCP, we intend to sample the timestamps for the last byte for each sendmsg/sendpage. For that reason, tcp_sendmsg calls tcp_tx_timestamp only with the last skb that it generates. For example, if a 128KB message is split into two 64KB packets we want to sample the SND timestamp of the last packet. The current code in the tun driver, however, will result in sampling the SND timestamp for both packets. Also, when the last packet is split into smaller packets for retranmission (see tcp_fragment), the tun driver will record timestamps for all of the retransmitted packets and not only the last packet. Fixes: eda297729171 (tun: Support software transmit time stamping.) Signed-off-by: Soheil Hassas Yeganeh Signed-off-by: Francis Yan Acked-by: Eric Dumazet --- drivers/net/tun.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index e249428..8093e39 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -888,11 +888,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) goto drop; - if (skb->sk && sk_fullsock(skb->sk)) { - sock_tx_timestamp(skb->sk, skb->sk->sk_tsflags, - &skb_shinfo(skb)->tx_flags); - sw_tx_timestamp(skb); - } + skb_tx_timestamp(skb); /* Orphan the skb - required as we might hang on to it * for indefinite time.