mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	tcp: add tcp_wstamp_ns socket field
TCP will soon provide earliest departure time on TX skbs. It needs to track this in a new variable. tcp_mstamp_refresh() needs to update this variable, and became too big to stay an inline. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									142537e419
								
							
						
					
					
						commit
						9799ccb0e9
					
				
					 3 changed files with 19 additions and 11 deletions
				
			
		| 
						 | 
					@ -248,6 +248,8 @@ struct tcp_sock {
 | 
				
			||||||
		syn_smc:1;	/* SYN includes SMC */
 | 
							syn_smc:1;	/* SYN includes SMC */
 | 
				
			||||||
	u32	tlp_high_seq;	/* snd_nxt at the time of TLP retransmit. */
 | 
						u32	tlp_high_seq;	/* snd_nxt at the time of TLP retransmit. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						u64	tcp_wstamp_ns;	/* departure time for next sent data packet */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* RTT measurement */
 | 
					/* RTT measurement */
 | 
				
			||||||
	u64	tcp_mstamp;	/* most recent packet received/sent */
 | 
						u64	tcp_mstamp;	/* most recent packet received/sent */
 | 
				
			||||||
	u32	srtt_us;	/* smoothed round trip time << 3 in usecs */
 | 
						u32	srtt_us;	/* smoothed round trip time << 3 in usecs */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -752,17 +752,7 @@ static inline u32 tcp_time_stamp_raw(void)
 | 
				
			||||||
	return div_u64(tcp_clock_ns(), NSEC_PER_SEC / TCP_TS_HZ);
 | 
						return div_u64(tcp_clock_ns(), NSEC_PER_SEC / TCP_TS_HZ);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void tcp_mstamp_refresh(struct tcp_sock *tp);
 | 
				
			||||||
/* Refresh 1us clock of a TCP socket,
 | 
					 | 
				
			||||||
 * ensuring monotically increasing values.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static inline void tcp_mstamp_refresh(struct tcp_sock *tp)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	u64 val = tcp_clock_us();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (val > tp->tcp_mstamp)
 | 
					 | 
				
			||||||
		tp->tcp_mstamp = val;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline u32 tcp_stamp_us_delta(u64 t1, u64 t0)
 | 
					static inline u32 tcp_stamp_us_delta(u64 t1, u64 t0)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,22 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <trace/events/tcp.h>
 | 
					#include <trace/events/tcp.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Refresh clocks of a TCP socket,
 | 
				
			||||||
 | 
					 * ensuring monotically increasing values.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void tcp_mstamp_refresh(struct tcp_sock *tp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						u64 val = tcp_clock_ns();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* departure time for next data packet */
 | 
				
			||||||
 | 
						if (val > tp->tcp_wstamp_ns)
 | 
				
			||||||
 | 
							tp->tcp_wstamp_ns = val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						val = div_u64(val, NSEC_PER_USEC);
 | 
				
			||||||
 | 
						if (val > tp->tcp_mstamp)
 | 
				
			||||||
 | 
							tp->tcp_mstamp = val;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
 | 
					static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
 | 
				
			||||||
			   int push_one, gfp_t gfp);
 | 
								   int push_one, gfp_t gfp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue