Re: Question about tcp keep-alive timer

2014-08-11 Thread John Baldwin
On Sunday, August 10, 2014 4:09:55 pm David Bar wrote:
 Hi
 
 
 (Forgive me if this topic has been discussed before. I didn't find it in
 the archives)
 
 In tcp_input(), when a packet is received on an established socket the code
 re-arms the keep-alive timer, for each packet.
 Here:
 
https://svnweb.freebsd.org/base/release/10.0.0/sys/netinet/tcp_input.c?revision=260789view=markup#l1518
 
 Isn't this a waste to do this for each packet?
 
 The setting of the timer when the connection becomes established should
 suffice if there was a small change in tcp_timer_keep().
 If tcp_timer_keep() would first checks if tp-t_rcvtime is recent (newer
 than the TT_KEEPIDLE time), and would just re-arm the timer to go off
 later, then we would keep the same functionality.
 
 I can't think of any downsides to this idea. Any good reason why this
 hasn't been done before?

I think it is just a tradeoff between having the timer run at all.  However, I 
suspect that with high packet rates it probably is cheaper to have the timer 
run periodically and reschedule itself if it notices it isn't needed as you 
suggested.  Do you want to write up a patch and test it?

-- 
John Baldwin
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Question about tcp keep-alive timer

2014-08-10 Thread David Bar
Hi


(Forgive me if this topic has been discussed before. I didn't find it in
the archives)

In tcp_input(), when a packet is received on an established socket the code
re-arms the keep-alive timer, for each packet.
Here:
https://svnweb.freebsd.org/base/release/10.0.0/sys/netinet/tcp_input.c?revision=260789view=markup#l1518

Isn't this a waste to do this for each packet?

The setting of the timer when the connection becomes established should
suffice if there was a small change in tcp_timer_keep().
If tcp_timer_keep() would first checks if tp-t_rcvtime is recent (newer
than the TT_KEEPIDLE time), and would just re-arm the timer to go off
later, then we would keep the same functionality.

I can't think of any downsides to this idea. Any good reason why this
hasn't been done before?


Thanks,
David Bar
dbar at gmail dot com
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org