patch-2.1.106 linux/include/net/tcp.h
Next file: linux/init/main.c
Previous file: linux/include/linux/zorro.h
Back to the patch index
Back to the overall index
- Lines: 48
- Date:
Sat Jun 13 13:51:26 1998
- Orig file:
v2.1.105/linux/include/net/tcp.h
- Orig date:
Thu May 7 22:51:55 1998
diff -u --recursive --new-file v2.1.105/linux/include/net/tcp.h linux/include/net/tcp.h
@@ -654,17 +654,24 @@
return mss_now;
}
-/* Compute the actual receive window we are currently advertising. */
+/* Compute the actual receive window we are currently advertising.
+ * Rcv_nxt can be after the window if our peer push more data
+ * than the offered window.
+ */
static __inline__ u32 tcp_receive_window(struct tcp_opt *tp)
{
- return tp->rcv_wup - (tp->rcv_nxt - tp->rcv_wnd);
+ s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt;
+
+ if (win < 0)
+ win = 0;
+ return (u32) win;
}
/* Choose a new window, without checks for shrinking, and without
* scaling applied to the result. The caller does these things
* if necessary. This is a "raw" window selection.
*/
-extern u32 __tcp_select_window(struct sock *sk);
+extern u32 __tcp_select_window(struct sock *sk, u32 cur_win);
/* Chose a new window to advertise, update state in tcp_opt for the
* socket, and return result with RFC1323 scaling applied. The return
@@ -674,8 +681,8 @@
extern __inline__ u16 tcp_select_window(struct sock *sk)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- u32 new_win = __tcp_select_window(sk);
u32 cur_win = tcp_receive_window(tp);
+ u32 new_win = __tcp_select_window(sk, cur_win);
/* Never shrink the offered window */
if(new_win < cur_win)
@@ -694,8 +701,8 @@
extern __inline__ int tcp_raise_window(struct sock *sk)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- u32 new_win = __tcp_select_window(sk);
u32 cur_win = tcp_receive_window(tp);
+ u32 new_win = __tcp_select_window(sk, cur_win);
return (new_win && (new_win > (cur_win << 1)));
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov