From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AEF6C31E5B for ; Mon, 17 Jun 2019 19:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD9D720863 for ; Mon, 17 Jun 2019 19:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=appneta.com header.i=@appneta.com header.b="A4X/KhXA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbfFQTF1 (ORCPT ); Mon, 17 Jun 2019 15:05:27 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42657 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726623AbfFQTF0 (ORCPT ); Mon, 17 Jun 2019 15:05:26 -0400 Received: by mail-pf1-f194.google.com with SMTP id q10so6175064pff.9 for ; Mon, 17 Jun 2019 12:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appneta.com; s=google; h=from:to:cc:subject:date:message-id; bh=YnCb3pKFcjJQDWfuu4zZ4IPAqdP8bDj70tQarrqJA4E=; b=A4X/KhXA7O5XTHuY6NfApDEsClzY9VLycFoj+ighBJrb+Bt694nnq+36B/8JuZa4NF Kom2/gAYRcGqoiOyePIQcIgNPOLRMzlzsFb4hOPHoDsAGJR9rSJOdvpsR1bwSCgsq8mL oDqOpKOvGsTrxnmb8gabRYqod4AIDAhsdJ7jg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YnCb3pKFcjJQDWfuu4zZ4IPAqdP8bDj70tQarrqJA4E=; b=MV2YwSR2xwnZFEdImli3bxFdKoxl/l7dAstng0/uWLIMAlTgdMcTqu9KOtQoDfkUC4 vwOACyXrgSZrVhEv5utYZ+XBIprOCPcaR+CObHKvPfXX3GtfBhOcPLQANopkefAvikVH Al+S1rw8GsbITRuF8Smg+71ImYO1pEvcGkZOqsrlcoZ6APY3ayTmNvLHfEpm4+JBYTRa 4fPl7q7bnCu46dwdW4JgiotQHTP8jJti3KxI0DjvVIzkJ1kkeOvkZ9/I1CVgOTTV/DRX 3SiQRSGWWfzJD/cyleH4bec1wlQFeMnp2x1YQUMog7PN1TJVx5W+Ku+hD+zKbAr4/8dp W4Iw== X-Gm-Message-State: APjAAAUPCrb1Yjd3tlGRaWfLgLVF16TssyDGFPTMnwSgAL+IyCk+SKkM aUas4v3fbalJdF5VurNAU5HFjg== X-Google-Smtp-Source: APXvYqyfGNVM3XuLS06e9v7G9O4NGlFdS+43bjHE9rkWn//VId1KvzFuE1PdRbwS03I5cQfwI7Y3EQ== X-Received: by 2002:a62:e515:: with SMTP id n21mr48498381pff.186.1560798325712; Mon, 17 Jun 2019 12:05:25 -0700 (PDT) Received: from linux-net-fred.jaalam.net ([2001:4958:15a0:24:5054:ff:fecb:7a95]) by smtp.googlemail.com with ESMTPSA id l63sm13042616pfl.181.2019.06.17.12.05.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 12:05:24 -0700 (PDT) From: Fred Klassen To: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Willem de Bruijn Cc: Fred Klassen Subject: [PATCH net v4] net/udp_gso: Allow TX timestamp with UDP GSO Date: Mon, 17 Jun 2019 12:05:07 -0700 Message-Id: <20190617190507.12730-1-fklassen@appneta.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes an issue where TX Timestamps are not arriving on the error queue when UDP_SEGMENT CMSG type is combined with CMSG type SO_TIMESTAMPING. This can be illustrated with an updated updgso_bench_tx program which includes the '-T' option to test for this condition. It also introduces the '-P' option which will call poll() before reading the error queue. ./udpgso_bench_tx -4ucTPv -S 1472 -l2 -D 172.16.120.18 poll timeout udp tx: 0 MB/s 1 calls/s 1 msg/s The "poll timeout" message above indicates that TX timestamp never arrived. This patch preserves tx_flags for the first UDP GSO segment. Only the first segment is timestamped, even though in some cases there may be benefital in timestamping both the first and last segment. Factors in deciding on first segment timestamp only: - Timestamping both first and last segmented is not feasible. Hardware can only have one outstanding TS request at a time. - Timestamping last segment may under report network latency of the previous segments. Even though the doorbell is suppressed, the ring producer counter has been incremented. - Timestamping the first segment has the upside in that it reports timestamps from the application's view, e.g. RTT. - Timestamping the first segment has the downside that it may underreport tx host network latency. It appears that we have to pick one or the other. And possibly follow-up with a config flag to choose behavior. v2: Remove tests as noted by Willem de Bruijn Moving tests from net to net-next v3: Update only relevant tx_flag bits as per Willem de Bruijn v4: Update comments and commit message as per Willem de Bruijn Fixes: ee80d1ebe5ba ("udp: add udp gso") Signed-off-by: Fred Klassen --- net/ipv4/udp_offload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 06b3e2c1fcdc..9763464a75d7 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -224,6 +224,11 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh = udp_hdr(seg); + /* preserve TX timestamp flags and TS key for first segment */ + skb_shinfo(seg)->tskey = skb_shinfo(gso_skb)->tskey; + skb_shinfo(seg)->tx_flags |= + (skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP); + /* compute checksum adjustment based on old length versus new */ newlen = htons(sizeof(*uh) + mss); check = csum16_add(csum16_sub(uh->check, uh->len), newlen); -- 2.11.0