public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: davem@davemloft•net, sangtae.ha@gmail•com, rhee@ncsu•edu
Cc: netdev@vger•kernel.org
Subject: [PATCH 2/6] tcp: timestamp code clarification
Date: Thu, 10 Mar 2011 08:51:24 -0800	[thread overview]
Message-ID: <20110310165328.905636243@vyatta.com> (raw)
In-Reply-To: 20110310165119.224046957@vyatta.com

[-- Attachment #1: tcp-input-tstamp-clean.patch --]
[-- Type: text/plain, Size: 1462 bytes --]

Use inline functions to make the checking of ack timestamp clearer.

Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>

--- a/net/ipv4/tcp_input.c	2011-03-10 07:58:37.715948842 -0800
+++ b/net/ipv4/tcp_input.c	2011-03-10 07:58:38.419937963 -0800
@@ -3263,7 +3263,7 @@ static int tcp_clean_rtx_queue(struct so
 				flag |= FLAG_NONHEAD_RETRANS_ACKED;
 		} else {
 			ca_seq_rtt = now - scb->when;
-			last_ackt = skb->tstamp;
+			last_ackt = skb_get_ktime(skb);
 			if (seq_rtt < 0) {
 				seq_rtt = ca_seq_rtt;
 			}
@@ -3345,9 +3345,8 @@ static int tcp_clean_rtx_queue(struct so
 			/* Is the ACK triggering packet unambiguous? */
 			if (!(flag & FLAG_RETRANS_DATA_ACKED)) {
 				/* High resolution needed and available? */
-				if (ca_ops->flags & TCP_CONG_RTT_STAMP &&
-				    !ktime_equal(last_ackt,
-						 net_invalid_timestamp()))
+				if ((ca_ops->flags & TCP_CONG_RTT_STAMP) &&
+				    net_timestamp_isvalid(last_ackt))
 					rtt_us = ktime_us_delta(ktime_get_real(),
 								last_ackt);
 				else if (ca_seq_rtt >= 0)
--- a/include/linux/skbuff.h	2011-03-10 07:55:27.181150325 -0800
+++ b/include/linux/skbuff.h	2011-03-10 07:58:38.419937963 -0800
@@ -1965,6 +1965,11 @@ static inline ktime_t net_invalid_timest
 	return ktime_set(0, 0);
 }
 
+static inline bool net_timestamp_isvalid(ktime_t t)
+{
+	return !ktime_equal(t, net_invalid_timestamp());
+}
+
 extern void skb_timestamping_init(void);
 
 #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING



  parent reply	other threads:[~2011-03-10 16:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 16:51 [PATCH 0/6] TCP CUBIC and Hystart Stephen Hemminger
2011-03-10 16:51 ` [PATCH 1/6] tcp: fix RTT for quick packets in congestion control Stephen Hemminger
2011-03-10 16:51 ` Stephen Hemminger [this message]
2011-03-10 16:51 ` [PATCH 3/6] tcp_cubic: fix comparison of jiffies Stephen Hemminger
2011-03-11  9:40   ` Lucas Nussbaum
2011-03-10 16:51 ` [PATCH 4/6] tcp_cubic: make ack train delta value a parameter Stephen Hemminger
2011-03-10 16:51 ` [PATCH 5/6] tcp_cubic: fix clock dependency Stephen Hemminger
2011-03-11 16:26   ` Sangtae Ha
2011-03-10 16:51 ` [PATCH 6/6] tcp_cubic: enable high resolution ack time if needed Stephen Hemminger
2011-03-11 10:28 ` [PATCH 0/6] TCP CUBIC and Hystart Lucas Nussbaum
2011-03-11 10:49   ` Injong Rhee
2011-03-11 15:58   ` Sangtae Ha
2011-03-11 16:08     ` Lucas Nussbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110310165328.905636243@vyatta.com \
    --to=shemminger@vyatta$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rhee@ncsu$(echo .)edu \
    --cc=sangtae.ha@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox