Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-20 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Mon, 16 Apr 2007 19:19:02 +0300 (EEST)

 [PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

I decided to apply this to my net-2.6.22 tree, I'll deal with
the tcp-2.6 merge conflicts as best as I can.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-17 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, David Miller wrote:
 From: Ilpo_Järvinen [EMAIL PROTECTED]
 Date: Mon, 16 Apr 2007 19:19:02 +0300 (EEST)
 
  [PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)
 
 I was trying to spread out the net-2.6.22 tree from the tcp-2.6
 one so that we could do the experimental TCP stuff in the tcp-2.6
 tree and leave other networking changes for net-2.6.22
 
 Putting in TCP cleanups which touch a lot of code into net-2.6.22
 defeats that effort because now there will be all kinds of rejects and
 merge errors people will have to deal with if they clone a net-2.6.22
 tree then pull in tcp-2.6 to do some TCP hacking which is valid.
 
 I suppose we can live with that, and just tell people to just pull
 tcp-2.6 into a fresh linux-2.6 tree straight, but it's going to make
 rebasing difficult for me as well.

 net-2.6.22 is already approaching 350 patches, it's a monster and
 the merge conflicts and rebasing pain are really getting hard to
 deal with.

I fully understand your concerns (I had already though that you might 
rather want to put this kind of thing to tcp-2.6)... It will be almost 
trivial to base it to tcp-2.6 because it's, well, (mostly) automated.
I'll try to get that done today so you'll have less worries... :-)


-- 
 i.

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-17 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, David Miller wrote:

 From: Ilpo_Järvinen [EMAIL PROTECTED]
 Date: Mon, 16 Apr 2007 19:19:02 +0300 (EEST)
 
  [PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)
 
 I was trying to spread out the net-2.6.22 tree from the tcp-2.6
 one so that we could do the experimental TCP stuff in the tcp-2.6
 tree and leave other networking changes for net-2.6.22

 Putting in TCP cleanups which touch a lot of code into net-2.6.22
 defeats that effort because now there will be all kinds of rejects and
 merge errors people will have to deal with if they clone a net-2.6.22
 tree then pull in tcp-2.6 to do some TCP hacking which is valid.

...to tcp-2.6 this time.

[PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

This is (mostly) automated change using magic:

sed -e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e 's|struct sock \*sk,[\n\t ]*struct tcp_sock \*tp\([^{]*\n{\n\)|
  struct sock \*sk\1\tstruct tcp_sock *tp = tcp_sk(sk);\n|g'
-e 's|struct sock \*sk, struct tcp_sock \*tp|
  struct sock \*sk|g' -e 's|sk, tp\([^-]\)|sk\1|g'

Fixed four unused variable (tp) warnings that were introduced.

In addition, manually added newlines after local variables and
tweaked function arguments positioning.

$ gcc --version
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
...
$ codiff -fV built-in.o.old built-in.o.new
net/ipv4/tcp.c:
  tcp_setsockopt |   -5
  tcp_sendpage   |  -16
  tcp_sendmsg|  -12
 3 functions changed, 33 bytes removed

net/ipv4/tcp_input.c:
  tcp_try_undo_recovery |   +3
  tcp_try_undo_dsack|   +2
  tcp_send_dupack   |   +1
  tcp_ack   |  -10
  tcp_event_data_recv   |  -16
  tcp_rcv_state_process |  -10
  tcp_rcv_established   |  -19
 7 functions changed, 6 bytes added, 55 bytes removed, diff: -49

net/ipv4/tcp_output.c:
  update_send_head  |   -9
  tcp_cwnd_validate |   +1
  tcp_write_wakeup  |  -17
  __tcp_push_pending_frames |  -25
  tcp_push_one  |   -8
  tcp_send_fin  |   -4
 6 functions changed, 1 bytes added, 63 bytes removed, diff: -62

built-in.o.new:
 16 functions changed, 7 bytes added, 151 bytes removed, diff: -144

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 include/net/tcp.h |   25 +
 include/net/tcp_ecn.h |   11 +++-
 net/ipv4/tcp.c|   39 --
 net/ipv4/tcp_input.c  |  134 +
 net/ipv4/tcp_output.c |   54 +++-
 5 files changed, 152 insertions(+), 111 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 809e392..29e5740 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -420,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(str
 
 /* tcp_output.c */
 
-extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
- unsigned int cur_mss, int nonagle);
-extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
+extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
+ int nonagle);
+extern int tcp_may_send_now(struct sock *sk);
 extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_xmit_retransmit_queue(struct sock *);
 extern void tcp_simple_retransmit(struct sock *);
@@ -479,8 +479,10 @@ static inline void tcp_fast_path_on(stru
__tcp_fast_path_on(tp, tp-snd_wnd  tp-rx_opt.snd_wscale);
 }
 
-static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_fast_path_check(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
+
if (skb_queue_empty(tp-out_of_order_queue) 
tp-rcv_wnd 
atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
@@ -591,10 +593,10 @@ static inline void tcp_dec_pcount_approx
}
 }
 
-static inline void tcp_packets_out_inc(struct sock *sk, 
-  struct tcp_sock *tp,
+static inline void tcp_packets_out_inc(struct sock *sk,
   const struct sk_buff *skb)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
int orig = tp-packets_out;
 
tp-packets_out += tcp_skb_pcount(skb);
@@ -778,18 +780,21 @@ static inline void tcp_minshall_update(s
tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
 }
 
-static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_check_probe_timer(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
const struct inet_connection_sock *icsk = inet_csk(sk);
+
if (!tp-packets_out  !icsk-icsk_pending)
inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
  icsk-icsk_rto, TCP_RTO_MAX);
 }
 
-static inline void tcp_push_pending_frames(struct sock *sk,
-  struct tcp_sock *tp)
+static inline 

[PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Ilpo Järvinen
This is fully automated change using this magic:

sed -e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e 's|struct sock \*sk,[\n\t ]*struct tcp_sock \*tp\([^{]*\n{\n\)|
  struct sock \*sk\1\tstruct tcp_sock *tp = tcp_sk(sk);\n|g'
-e 's|struct sock \*sk, struct tcp_sock \*tp|
  struct sock \*sk|g' -e 's|sk, tp\([^-]\)|sk\1|g'

Introduces four warnings that are fixed manually by the
following patch.

$ gcc --version
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
...
$ codiff -fV built-in.o.old built-in.o.new
net/ipv4/route.c:
  rt_cache_flush |  +14
 1 function changed, 14 bytes added

net/ipv4/tcp.c:
  tcp_setsockopt |   -5
  tcp_sendpage   |  -25
  tcp_sendmsg|  -16
 3 functions changed, 46 bytes removed

net/ipv4/tcp_input.c:
  tcp_try_undo_recovery |   +3
  tcp_try_undo_dsack|   +2
  tcp_mark_head_lost|  -12
  tcp_ack   |  -15
  tcp_event_data_recv   |  -32
  tcp_rcv_state_process |  -10
  tcp_rcv_established   |   +1
 7 functions changed, 6 bytes added, 69 bytes removed, diff: -63

net/ipv4/tcp_output.c:
  update_send_head  |   -9
  tcp_transmit_skb  |  +19
  tcp_cwnd_validate |   +1
  tcp_write_wakeup  |  -17
  __tcp_push_pending_frames |  -25
  tcp_push_one  |   -8
  tcp_send_fin  |   -4
 7 functions changed, 20 bytes added, 63 bytes removed, diff: -43

built-in.o.new:
 18 functions changed, 40 bytes added, 178 bytes removed, diff: -138

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 include/net/tcp.h |   20 ---
 include/net/tcp_ecn.h |6 +-
 net/ipv4/tcp.c|   35 +++--
 net/ipv4/tcp_input.c  |  131 -
 net/ipv4/tcp_output.c |   48 ++
 5 files changed, 136 insertions(+), 104 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 07f724e..19cf5d5 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -420,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(str
 
 /* tcp_output.c */
 
-extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
+extern void __tcp_push_pending_frames(struct sock *sk,
  unsigned int cur_mss, int nonagle);
-extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
+extern int tcp_may_send_now(struct sock *sk);
 extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_xmit_retransmit_queue(struct sock *);
 extern void tcp_simple_retransmit(struct sock *);
@@ -479,8 +479,9 @@ static inline void tcp_fast_path_on(stru
__tcp_fast_path_on(tp, tp-snd_wnd  tp-rx_opt.snd_wscale);
 }
 
-static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_fast_path_check(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
if (skb_queue_empty(tp-out_of_order_queue) 
tp-rcv_wnd 
atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
@@ -591,10 +592,10 @@ static inline void tcp_dec_pcount_approx
}
 }
 
-static inline void tcp_packets_out_inc(struct sock *sk, 
-  struct tcp_sock *tp,
+static inline void tcp_packets_out_inc(struct sock *sk,
   const struct sk_buff *skb)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
int orig = tp-packets_out;
 
tp-packets_out += tcp_skb_pcount(skb);
@@ -778,18 +779,19 @@ static inline void tcp_minshall_update(s
tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
 }
 
-static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_check_probe_timer(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
const struct inet_connection_sock *icsk = inet_csk(sk);
if (!tp-packets_out  !icsk-icsk_pending)
inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
  icsk-icsk_rto, TCP_RTO_MAX);
 }
 
-static inline void tcp_push_pending_frames(struct sock *sk,
-  struct tcp_sock *tp)
+static inline void tcp_push_pending_frames(struct sock *sk)
 {
-   __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp-nonagle);
+   struct tcp_sock *tp = tcp_sk(sk);
+   __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp-nonagle);
 }
 
 static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index b5f7c6a..f3043d2 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(s
TCP_SKB_CB(skb)-flags = ~TCPCB_FLAG_ECE;
 }
 
-static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp,
+static inline void TCP_ECN_send_syn(struct sock *sk,
struct sk_buff *skb)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
  

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Christoph Hellwig
It would be easier if you sent all bits in a single patch, it's
one logical change after all, and a rather small one aswell.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, Christoph Hellwig wrote:

 It would be easier if you sent all bits in a single patch, it's
 one logical change after all, and a rather small one aswell.

Here it is the way you requested...

[PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

This is (mostly) automated change using this magic:

sed -e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e 's|struct sock \*sk,[\n\t ]*struct tcp_sock \*tp\([^{]*\n{\n\)|
  struct sock \*sk\1\tstruct tcp_sock *tp = tcp_sk(sk);\n|g'
-e 's|struct sock \*sk, struct tcp_sock \*tp|
  struct sock \*sk|g' -e 's|sk, tp\([^-]\)|sk\1|g'

Tweaked newlines manually  fixed four warnings that were
introduced.

$ gcc --version
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
...
$ codiff -f built-in.o.old built-in.o.new
net/ipv4/route.c:
  rt_cache_flush |  +14
 1 function changed, 14 bytes added

net/ipv4/tcp.c:
  tcp_setsockopt |   -5
  tcp_sendpage   |  -25
  tcp_sendmsg|  -16
 3 functions changed, 46 bytes removed

net/ipv4/tcp_input.c:
  tcp_try_undo_recovery |   +3
  tcp_try_undo_dsack|   +2
  tcp_mark_head_lost|  -12
  tcp_ack   |  -15
  tcp_event_data_recv   |  -32
  tcp_rcv_state_process |  -10
  tcp_rcv_established   |   +1
 7 functions changed, 6 bytes added, 69 bytes removed, diff: -63

net/ipv4/tcp_output.c:
  update_send_head  |   -9
  tcp_transmit_skb  |  +19
  tcp_cwnd_validate |   +1
  tcp_write_wakeup  |  -17
  __tcp_push_pending_frames |  -25
  tcp_push_one  |   -8
  tcp_send_fin  |   -4
 7 functions changed, 20 bytes added, 63 bytes removed, diff: -43

built-in.o.new:
 18 functions changed, 40 bytes added, 178 bytes removed, diff: -138

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 include/net/tcp.h |   20 ---
 include/net/tcp_ecn.h |6 +-
 net/ipv4/tcp.c|   35 +++-
 net/ipv4/tcp_input.c  |  140 +
 net/ipv4/tcp_output.c |   51 ++
 5 files changed, 146 insertions(+), 106 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 07f724e..19cf5d5 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -420,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(str
 
 /* tcp_output.c */
 
-extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
+extern void __tcp_push_pending_frames(struct sock *sk,
  unsigned int cur_mss, int nonagle);
-extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
+extern int tcp_may_send_now(struct sock *sk);
 extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_xmit_retransmit_queue(struct sock *);
 extern void tcp_simple_retransmit(struct sock *);
@@ -479,8 +479,9 @@ static inline void tcp_fast_path_on(stru
__tcp_fast_path_on(tp, tp-snd_wnd  tp-rx_opt.snd_wscale);
 }
 
-static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_fast_path_check(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
if (skb_queue_empty(tp-out_of_order_queue) 
tp-rcv_wnd 
atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
@@ -591,10 +592,10 @@ static inline void tcp_dec_pcount_approx
}
 }
 
-static inline void tcp_packets_out_inc(struct sock *sk, 
-  struct tcp_sock *tp,
+static inline void tcp_packets_out_inc(struct sock *sk,
   const struct sk_buff *skb)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
int orig = tp-packets_out;
 
tp-packets_out += tcp_skb_pcount(skb);
@@ -778,18 +779,19 @@ static inline void tcp_minshall_update(s
tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
 }
 
-static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_check_probe_timer(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
const struct inet_connection_sock *icsk = inet_csk(sk);
if (!tp-packets_out  !icsk-icsk_pending)
inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
  icsk-icsk_rto, TCP_RTO_MAX);
 }
 
-static inline void tcp_push_pending_frames(struct sock *sk,
-  struct tcp_sock *tp)
+static inline void tcp_push_pending_frames(struct sock *sk)
 {
-   __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp-nonagle);
+   struct tcp_sock *tp = tcp_sk(sk);
+   __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp-nonagle);
 }
 
 static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index b5f7c6a..f3043d2 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(s

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Patrick McHardy
Ilpo Järvinen wrote:
 Tweaked newlines manually  fixed four warnings that were
 introduced.

Not all of them it seems:

 -static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
 +static inline void tcp_fast_path_check(struct sock *sk)
  {
 + struct tcp_sock *tp = tcp_sk(sk);

^ missing newline

   if (skb_queue_empty(tp-out_of_order_queue) 
   tp-rcv_wnd 
   atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
 @@ -778,18 +779,19 @@ static inline void tcp_minshall_update(s
   tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
  }
  
 -static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock 
 *tp)
 +static inline void tcp_check_probe_timer(struct sock *sk)
  {
 + struct tcp_sock *tp = tcp_sk(sk);

^ same here .. quite a few follow

   const struct inet_connection_sock *icsk = inet_csk(sk);
   if (!tp-packets_out  !icsk-icsk_pending)
   inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
 icsk-icsk_rto, TCP_RTO_MAX);
  }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, Patrick McHardy wrote:

 Ilpo Järvinen wrote:
  Tweaked newlines manually  fixed four warnings that were
  introduced.
 
 Not all of them it seems:
 
  -static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock 
  *tp)
  +static inline void tcp_fast_path_check(struct sock *sk)
   {
  +   struct tcp_sock *tp = tcp_sk(sk);
 
 ^ missing newline

...in the other (original) patch description that is not copied fully here 
I had a sort of disclaimer for these missing ones but in case they should 
all be changed so that if the added tcp_sock is the only local variable I 
can do that of course... It's not clear to me what is really the preferred 
style considering all the variants... E.g., tcp_check_probe_timer (below) 
does not have the newline before this patch either?!? :-) ...tried to look 
from CodingStyle too but it didn't give any light to this thing...

  if (skb_queue_empty(tp-out_of_order_queue) 
  tp-rcv_wnd 
  atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
  @@ -778,18 +779,19 @@ static inline void tcp_minshall_update(s
  tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
   }
   
  -static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock 
  *tp)
  +static inline void tcp_check_probe_timer(struct sock *sk)
   {
  +   struct tcp_sock *tp = tcp_sk(sk);
 
 ^ same here .. quite a few follow
 
  const struct inet_connection_sock *icsk = inet_csk(sk);

...No newline should be place here, since it's being followed by 
another local variable defination.

  if (!tp-packets_out  !icsk-icsk_pending)
  inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
icsk-icsk_rto, TCP_RTO_MAX);
   }
 

-- 
 i.

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Patrick McHardy
Ilpo Järvinen wrote:
 On Mon, 16 Apr 2007, Patrick McHardy wrote:
 
[...]
 
 ...in the other (original) patch description that is not copied fully here 
 I had a sort of disclaimer for these missing ones but in case they should 
 all be changed so that if the added tcp_sock is the only local variable I 
 can do that of course... It's not clear to me what is really the preferred 
 style considering all the variants... E.g., tcp_check_probe_timer (below) 
 does not have the newline before this patch either?!? :-) ...tried to look 
 from CodingStyle too but it didn't give any light to this thing...


The preferred style is a newline after variable declarations. Some
(mostly old) code doesn't consistently do that, but in cases where
you add the first local variable you should really add them.

 const struct inet_connection_sock *icsk = inet_csk(sk);
 
 
 ...No newline should be place here, since it's being followed by 
 another local variable defination.


Yes, this one was a mistake. In this case I would probably leave it
as it was before to avoid bloating the patch, but I guess nobody
would mind if you'd add newlines here as well, the patch is not very
large or hard to understand anyway.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, Patrick McHardy wrote:

 Ilpo Järvinen wrote:
  On Mon, 16 Apr 2007, Patrick McHardy wrote:
  
  [...] It's not clear to me what is really the preferred 
  style considering all the variants... [...]
 
 The preferred style is a newline after variable declarations. Some
 (mostly old) code doesn't consistently do that, but in cases where
 you add the first local variable you should really add them.

Just to make sure... And this holds in all cases, e.g., in 2 lines 
functions too like tcp_push_pending_frames? Maybe I'm just being too
picky or something... :-)


-- 
 i.

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread Ilpo Järvinen
On Mon, 16 Apr 2007, Patrick McHardy wrote:

 The preferred style is a newline after variable declarations. Some
 (mostly old) code doesn't consistently do that, but in cases where
 you add the first local variable you should really add them.

  ...No newline should be place here, since it's being followed by 
  another local variable defination.
 
 Yes, this one was a mistake. In this case I would probably leave it
 as it was before to avoid bloating the patch, but I guess nobody
 would mind if you'd add newlines here as well, the patch is not very
 large or hard to understand anyway.

I made these changes then:
  - Added newlines after local variables in the functions that had *tp
  added (assuming that the first line after the local variables is
  visible in the context of the diff)
  - Refitted arguments to 80 chars

[PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

This is (mostly) automated change using magic:

sed -e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e 's|struct sock \*sk,[\n\t ]*struct tcp_sock \*tp\([^{]*\n{\n\)|
  struct sock \*sk\1\tstruct tcp_sock *tp = tcp_sk(sk);\n|g'
-e 's|struct sock \*sk, struct tcp_sock \*tp|
  struct sock \*sk|g' -e 's|sk, tp\([^-]\)|sk\1|g'

Fixed four unused variable (tp) warnings that were introduced.

In addition, manually added newlines after local variables and
tweaked function arguments positioning.

$ gcc --version
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
...
$ codiff -fV built-in.o.old built-in.o.new
net/ipv4/route.c:
  rt_cache_flush |  +14
 1 function changed, 14 bytes added

net/ipv4/tcp.c:
  tcp_setsockopt |   -5
  tcp_sendpage   |  -25
  tcp_sendmsg|  -16
 3 functions changed, 46 bytes removed

net/ipv4/tcp_input.c:
  tcp_try_undo_recovery |   +3
  tcp_try_undo_dsack|   +2
  tcp_mark_head_lost|  -12
  tcp_ack   |  -15
  tcp_event_data_recv   |  -32
  tcp_rcv_state_process |  -10
  tcp_rcv_established   |   +1
 7 functions changed, 6 bytes added, 69 bytes removed, diff: -63

net/ipv4/tcp_output.c:
  update_send_head  |   -9
  tcp_transmit_skb  |  +19
  tcp_cwnd_validate |   +1
  tcp_write_wakeup  |  -17
  __tcp_push_pending_frames |  -25
  tcp_push_one  |   -8
  tcp_send_fin  |   -4
 7 functions changed, 20 bytes added, 63 bytes removed, diff: -43

built-in.o.new:
 18 functions changed, 40 bytes added, 178 bytes removed, diff: -138

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 include/net/tcp.h |   25 +---
 include/net/tcp_ecn.h |   11 ++--
 net/ipv4/tcp.c|   39 +++--
 net/ipv4/tcp_input.c  |  145 +
 net/ipv4/tcp_output.c |   54 ++
 5 files changed, 158 insertions(+), 116 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 07f724e..fffd063 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -420,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(str
 
 /* tcp_output.c */
 
-extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
- unsigned int cur_mss, int nonagle);
-extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
+extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
+ int nonagle);
+extern int tcp_may_send_now(struct sock *sk);
 extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_xmit_retransmit_queue(struct sock *);
 extern void tcp_simple_retransmit(struct sock *);
@@ -479,8 +479,10 @@ static inline void tcp_fast_path_on(stru
__tcp_fast_path_on(tp, tp-snd_wnd  tp-rx_opt.snd_wscale);
 }
 
-static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_fast_path_check(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
+
if (skb_queue_empty(tp-out_of_order_queue) 
tp-rcv_wnd 
atomic_read(sk-sk_rmem_alloc)  sk-sk_rcvbuf 
@@ -591,10 +593,10 @@ static inline void tcp_dec_pcount_approx
}
 }
 
-static inline void tcp_packets_out_inc(struct sock *sk, 
-  struct tcp_sock *tp,
+static inline void tcp_packets_out_inc(struct sock *sk,
   const struct sk_buff *skb)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
int orig = tp-packets_out;
 
tp-packets_out += tcp_skb_pcount(skb);
@@ -778,18 +780,21 @@ static inline void tcp_minshall_update(s
tp-snd_sml = TCP_SKB_CB(skb)-end_seq;
 }
 
-static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_check_probe_timer(struct sock *sk)
 {
+   struct tcp_sock *tp = tcp_sk(sk);
const struct inet_connection_sock *icsk = inet_csk(sk);
+
if (!tp-packets_out  !icsk-icsk_pending)

Re: [PATCH net-2.6.22 1/3] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

2007-04-16 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Mon, 16 Apr 2007 19:19:02 +0300 (EEST)

 [PATCH] [TCP]: Sed magic converts func(sk, tp, ...) - func(sk, ...)

I was trying to spread out the net-2.6.22 tree from the tcp-2.6
one so that we could do the experimental TCP stuff in the tcp-2.6
tree and leave other networking changes for net-2.6.22

Putting in TCP cleanups which touch a lot of code into net-2.6.22
defeats that effort because now there will be all kinds of rejects and
merge errors people will have to deal with if they clone a net-2.6.22
tree then pull in tcp-2.6 to do some TCP hacking which is valid.

I suppose we can live with that, and just tell people to just pull
tcp-2.6 into a fresh linux-2.6 tree straight, but it's going to make
rebasing difficult for me as well.

net-2.6.22 is already approaching 350 patches, it's a monster and
the merge conflicts and rebasing pain are really getting hard to
deal with.

For example, John Linville probably now has some build failures
to deal with in his wireless-2.6 tree due to Patrick McHardy's
netlink_kernel_create() function signature change today.

Also, the VLAN skb-h.raw bug fix from the other day in mainline
vanilla 2.6 tree is going to cause a build failure I'll have to
fixup next time I rebase, and people will hit that now if they
try to use current linux-2.6.git to pull in the net-2.6.22 tree.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html