Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10441366ybi; Wed, 24 Jul 2019 23:16:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD7HPvv6Gza1bO2i52BcY5FZ7JQcOHOp/eIp5XK2VGP2BGqEmo0Znk+4Gsz844dibOYXCJ X-Received: by 2002:a62:7695:: with SMTP id r143mr15523350pfc.173.1564035410880; Wed, 24 Jul 2019 23:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564035410; cv=none; d=google.com; s=arc-20160816; b=WmrxhEYrVsjyGz8mkQE8y0yXEO6OvDihtDNr9a/XHF2GrpFb0CyVmXpIqjBcte/PfW 41odV4rPAkU9Iaezkpe6KdLXETh9QApTnN5pV/MTOuLF8tHw4nusPsD2yQLYhgV+U5mU ND+qtwNDBHKshELPDpol5/fJLKN9txdeuf9c/aRbxRNMye+AducxB317ZtxKSgNXapRt B+bPdmhI5eWCRRzTcZjIDydTiGqiGhxVtqnnFRtvC+7uVmIwHZhGY9jw3WeCESn4JTVu XisBgtbm1+dzAlqK1hwg7Aj1b/pUulKRyccm1dBODlSftJdHunYDXcY9PK1uDQJvah0C 9fiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wAyugbKdGAuC/XQJaDJ6kxQW+0Wy8uumrUUKWB6ofF8=; b=eweS/y/e2myYZgUOSm35l2CHBNzACJrt/06+F0MWM10CoB0h/1G9O1QnRRng+o/k38 xSZIlcCnCQtfUZkKRvHbRGrAXDihoz7GkEXUECZwBctM2WejlD3aa4CM6wVpimtBT0/R vCat7ywTv5xZr0UG8/auRlQm7ntQtplypvboHnQ5APyecCBnUvga+d3+JO9FEuQTy75c lSvuEFPrPMtZgKvT6DU8qVprjZ8ooHkwUi0r7x36XChZlU2MHZm1KeQtelZPs2Z37Mzi AUrwBrDUvCXCPOpkmsuZmdhPs4hnGCUrr0LtUOnDMUhkLJk8r/mlQObX7hBBAnUYwbPg urGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tgQmTqK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si14356115plb.234.2019.07.24.23.16.35; Wed, 24 Jul 2019 23:16:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tgQmTqK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbfGYFwb (ORCPT + 99 others); Thu, 25 Jul 2019 01:52:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:54726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404326AbfGYFkR (ORCPT ); Thu, 25 Jul 2019 01:40:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBE0C22BF5; Thu, 25 Jul 2019 05:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033216; bh=wIChXwfSuUATX9Yy4fHMCFd8MfJmYOYpXoEHSbpPktI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tgQmTqK6apC0Hzy4j+QPA2F9wBouNqeFUaox8agpYFjpLcPlQGFAHG0UQfVa/YMAN XTPhYNW/Aj+uRVN/pN5Xz92qIMK/BeRoZ05UFaFAtdziQD6w+whZDEPCm0E2b9rTN4 hRqAQoIBP6GFod5CZPnE43wRac/3ySj/t+dIvmAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vedang Patel , Aaron Brown , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 133/271] igb: clear out skb->tstamp after reading the txtime Date: Wed, 24 Jul 2019 21:20:02 +0200 Message-Id: <20190724191706.634361278@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 1e08511d5d01884a3c9070afd52a47799312074a ] If a packet which is utilizing the launchtime feature (via SO_TXTIME socket option) also requests the hardware transmit timestamp, the hardware timestamp is not delivered to the userspace. This is because the value in skb->tstamp is mistaken as the software timestamp. Applications, like ptp4l, request a hardware timestamp by setting the SOF_TIMESTAMPING_TX_HARDWARE socket option. Whenever a new timestamp is detected by the driver (this work is done in igb_ptp_tx_work() which calls igb_ptp_tx_hwtstamps() in igb_ptp.c[1]), it will queue the timestamp in the ERR_QUEUE for the userspace to read. When the userspace is ready, it will issue a recvmsg() call to collect this timestamp. The problem is in this recvmsg() call. If the skb->tstamp is not cleared out, it will be interpreted as a software timestamp and the hardware tx timestamp will not be successfully sent to the userspace. Look at skb_is_swtx_tstamp() and the callee function __sock_recv_timestamp() in net/socket.c for more details. Signed-off-by: Vedang Patel Tested-by: Aaron Brown Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 5aa083d9a6c9..ab76a5f77cd0 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -5703,6 +5703,7 @@ static void igb_tx_ctxtdesc(struct igb_ring *tx_ring, */ if (tx_ring->launchtime_enable) { ts = ns_to_timespec64(first->skb->tstamp); + first->skb->tstamp = 0; context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32); } else { context_desc->seqnum_seed = 0; -- 2.20.1