Netdev List
 help / color / mirror / Atom feed
* Restricting payload size in do_tcp_sendpages.
@ 2012-03-01 15:16 Ashwin Rao
  2012-03-01 15:58 ` Eric Dumazet
  2012-03-01 21:02 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Ashwin Rao @ 2012-03-01 15:16 UTC (permalink / raw)
  To: netdev

Hi,

I would like to perform some experiments where I want TCP to send
packets of size less than the MSS even more than an MSS worth of data
is available in the TCP buffers.  I am performing these experiments to
submit a patch that can avoid synchronization of TCP flows. I have
modified the following code in the function do_tcp_sendpages in the
file net/ipv4/tcp.c.  For testing purposes I have currently set the
mss_now to half of the value that would have been typically used. I
have even updated the size_goal which controls the maximum size that
can be sent when offloading is enabled. To avoid coalescing smaller
skbs I have even set the can_coalesce to 0. Despite these changes the
frames sent over the Ethernet have the length of 1514 bytes. I would
like to know which function is responsible for coalescing these
packets despite forcing a small segment size.

*** linux-3.2.6/net/ipv4/tcp.c	
--- linux-3.2.6-modified/net/ipv4/tcp.c
*************** static ssize_t do_tcp_sendpages(struct s
*** 774,779 ****
--- 774,783 ----
  	clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);

  	mss_now = tcp_send_mss(sk, &size_goal, flags);
+     /* hack begin */
+     mss_now = mss_now >> 1;
+     size_goal = mss_now;
+     /* hack end */
  	copied = 0;

  	err = -EPIPE;
*************** new_segment:
*** 805,810 ****
--- 809,817 ----

  		i = skb_shinfo(skb)->nr_frags;
  		can_coalesce = skb_can_coalesce(skb, i, page, offset);
+             /* hack begin */
+             can_coalesce = 0;
+             /* hack end */
  		if (!can_coalesce && i >= MAX_SKB_FRAGS) {
  			tcp_mark_push(tp, skb);
  			goto new_segment;
*************** wait_for_memory:
*** 857,862 ****
--- 864,873 ----
  			goto do_error;

  		mss_now = tcp_send_mss(sk, &size_goal, flags);
+             /* hack begin */
+             mss_now = mss_now >> 1;
+             size_goal = mss_now;
+             /* hack end */
  	}


Regards,
Ashwin

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

end of thread, other threads:[~2012-03-01 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 15:16 Restricting payload size in do_tcp_sendpages Ashwin Rao
2012-03-01 15:58 ` Eric Dumazet
2012-03-01 17:30   ` Ashwin Rao
2012-03-01 21:02 ` David Miller
2012-03-01 22:00   ` Ashwin Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox