netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [TCP] IPV6 : Change a divide into a right shift in tcp_v6_send_ack()
@ 2007-12-21  6:03 Eric Dumazet
  2007-12-21  6:50 ` YOSHIFUJI Hideaki / 吉藤英明
  2007-12-21  7:21 ` Ilpo Järvinen
  0 siblings, 2 replies; 12+ messages in thread
From: Eric Dumazet @ 2007-12-21  6:03 UTC (permalink / raw)
  To: David S. Miller,
	YOSHIFUJI Hideaki / 吉藤英明
  Cc: Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

Because tot_len is signed in tcp_v6_send_ack(), tot_len/4 forces compiler
to emit an integer divide, while we can help it to use a right shift,
less expensive.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

[-- Attachment #2: tcp_ipv6.patch --]
[-- Type: text/plain, Size: 415 bytes --]

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 0268e11..92f0fda 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1124,7 +1124,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
 	memset(t1, 0, sizeof(*t1));
 	t1->dest = th->source;
 	t1->source = th->dest;
-	t1->doff = tot_len/4;
+	t1->doff = tot_len >> 2;
 	t1->seq = htonl(seq);
 	t1->ack_seq = htonl(ack);
 	t1->ack = 1;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-12-21 12:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21  6:03 [TCP] IPV6 : Change a divide into a right shift in tcp_v6_send_ack() Eric Dumazet
2007-12-21  6:50 ` YOSHIFUJI Hideaki / 吉藤英明
2007-12-21  7:06   ` Eric Dumazet
     [not found]     ` <20071221.162833.82587283.yoshfuji@linux-ipv6.org>
2007-12-21  7:39       ` Eric Dumazet
2007-12-21  7:44         ` YOSHIFUJI Hideaki / 吉藤英明
2007-12-21  7:50           ` Eric Dumazet
2007-12-21  9:46         ` David Miller
2007-12-21  8:11       ` Eric Dumazet
2007-12-21 11:26   ` Jeff Garzik
2007-12-21 11:57     ` David Miller
2007-12-21 12:18       ` Jeff Garzik
2007-12-21  7:21 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).