Author: blblack
Date: Tue Mar 25 07:20:22 2008
New Revision: 2145

URL: http://svn.slimdevices.com?rev=2145&root=Jive&view=rev
Log:
These are the tcp patches as well as the
"ramfs corruption under memory pressure"
patch that I tested on branches/7.0 on
my hardware jive.  They are backported
from the mainline 2.6.22.x series.

These commit lines may help locating the
individual patches in the 2.6.22.x changelogs
and/or git repo and/or mailing list if you want
to dig into them individually:

  commit 2c92c72b750cb92566b7e6031f84bc9a35699e73
    [TCP]: Verify the presence of RETRANS bit when leaving FRTO

  commit c1bb818242296c121ff574cb1fec2bc0127d6b31
    [NET_SCHED]: Revert "avoid transmit softirq on watchdog wakeup" optimization

  commit e061467dc5b4c78d4fe61ea6d7a0c848e22882d7
    TCP: Do not autobind ports for TCP sockets
    [TCP]: Invoke tcp_sendmsg() directly, do not use inet_sendmsg().

  commit 783366ad4b212cde069c50903494eb6a6b83958c
    TCP: Fix TCP rate-halving on bidirectional flows.
    
  commit 8385cffd22359ad561a173accefeb354bd606ce4
    TCP: Fix TCP handling of SACK in bidirectional flows.
    
  commit b13778e09272469203cb8d100defd8047a2117df
    NET: Fix missing rcu unlock in __sock_create()
    [NET]: Fix unbalanced rcu_read_unlock in __sock_create
    
  commit eb7bdad82e8af48e1ed1b650268dc85ca7e9ff39
    Handle snd_una in tcp_cwnd_down()
    commit 6ee8009e38006da81d2a53da1aaa27365552553e in mainline
    [TCP]: Also handle snd_una changes in tcp_cwnd_down
    
  commit 6d742fb6e2b8913457e1282e1be77d6f4e45af00
    Fix TCP DSACK cwnd handling
    commit 49ff4bb4cd4c04acf8f9e3d3ec2148305a1db445 in mainline.
    [TCP]: DSACK signals data receival, be conservative
    
  commit bbaded590e3293abbbca4d58a8fb7ad8447b2640
    Fix datagram recvmsg NULL iov handling regression.
    commit ef8aef55ce61fd0e2af798695f7386ac756ae1e7 in mainline
    [NET]: Do not dereference iov if length is zero
    
  commit 1902ababc2188dea47d5677869fdd43c88490923
    Fix ieee80211 handling of bogus hdrlength field
    changeset 04045f98e0457aba7d4e6736f37eed189c48a5f7 from mainline
    
  commit 791333baf11dbf37dd8f566909f8c1d5b939bf04
    Fix zero length socket write() semantics.
    changeset e79ad711a0108475c1b3a03815527e7237020b08 from mainline.
    This fixes kernel bugzilla #5731
    
  commit 692767dfebce10bc997073eb707a934348cdfe08
    Fix TCP's ->fastpath_cnt_hit handling.
    changeset 48611c47d09023d9356e78550d1cadb8d61da9c8 in mainline.
    
  commit dec0da2c0b439daf394957660e62824987f9b021
    Fix TCP initial sequence number selection.
    changeset 162f6690a65075b49f242d3c8cdb5caaa959a060 in mainline.
    [ This bug was introduced by f85958151900f9d30fa5ff941b0ce71eaa45a7de ]
    
  commit 1ca9e250e9f8675dc1db7fcd1cee8c0bf0bfc071
    TCP: Make sure write_queue_from does not begin with NULL ptr (CVE-2007-5501)
    patch 96a2d41a3e495734b63bff4e5dd0112741b93b38 in mainline.

  commit d6eb5c86ed40fe57e411c4ee72b38d0a83642302
    [NETLINK]: Fix unicast timeouts
    [ Upstream commit: c3d8d1e30cace31fed6186a4b8c6b1401836d89c ]
    
  commit 50bdf15981f7c1e515e8cf35dd0b5492a0f73962
    Future of Linux 2.6.22.y series
    commit 5d0360ee96a5ef953dbea45873c2a8c87e77d59b upstream.
    [blblack - this wierdly-named commit has to do with ramfs
     pages getting zero'd out under memory pressure]

  commit 8f5fb1bc5b1f50388ab0c4ec3c636faec0a9fe7e
    [TCP] MTUprobe: fix potential sk_send_head corruption
    [ Upstream commit: 6e42141009ff18297fe19d19296738b742f861db ]
    
  commit e8597d874b0141dbfd9aeea4dd84c5a8a614c322
    [NET]: Corrects a bug in ip_rt_acct_read()
    [ Upstream commit: 483b23ffa3a5f44767038b0a676d757e0668437e ]



Modified:
    trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/block/rd.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/random.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/include/linux/netlink.h
    trunk/squeezeos/src/s3c2412/linux-2.6.22/include/net/tcp.h
    trunk/squeezeos/src/s3c2412/linux-2.6.22/ipc/mqueue.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/core/datagram.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ieee80211/ieee80211_rx.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/af_inet.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/route.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_input.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_ipv4.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_output.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/af_inet6.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/tcp_ipv6.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/netlink/af_netlink.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/sched/sch_api.c
    trunk/squeezeos/src/s3c2412/linux-2.6.22/net/socket.c

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/block/rd.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/block/rd.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/block/rd.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/block/rd.c Tue Mar 25 
07:20:22 2008
@@ -189,6 +189,18 @@
        return 0;
 }
 
+/*
+ * releasepage is called by pagevec_strip/try_to_release_page if
+ * buffers_heads_over_limit is true. Without a releasepage function
+ * try_to_free_buffers is called instead. That can unset the dirty
+ * bit of our ram disk pages, which will be eventually freed, even
+ * if the page is still in use.
+ */
+static int ramdisk_releasepage(struct page *page, gfp_t dummy)
+{
+       return 0;
+}
+
 static const struct address_space_operations ramdisk_aops = {
        .readpage       = ramdisk_readpage,
        .prepare_write  = ramdisk_prepare_write,
@@ -196,6 +208,7 @@
        .writepage      = ramdisk_writepage,
        .set_page_dirty = ramdisk_set_page_dirty,
        .writepages     = ramdisk_writepages,
+       .releasepage    = ramdisk_releasepage,
 };
 
 static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/random.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/random.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/random.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/char/random.c Tue Mar 25 
07:20:22 2008
@@ -1545,11 +1545,13 @@
         *      As close as possible to RFC 793, which
         *      suggests using a 250 kHz clock.
         *      Further reading shows this assumes 2 Mb/s networks.
-        *      For 10 Gb/s Ethernet, a 1 GHz clock is appropriate.
-        *      That's funny, Linux has one built in!  Use it!
-        *      (Networks are faster now - should this be increased?)
+        *      For 10 Mb/s Ethernet, a 1 MHz clock is appropriate.
+        *      For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but
+        *      we also need to limit the resolution so that the u32 seq
+        *      overlaps less than one time per MSL (2 minutes).
+        *      Choosing a clock of 64 ns period is OK. (period of 274 s)
         */
-       seq += ktime_get_real().tv64;
+       seq += ktime_get_real().tv64 >> 6;
 #if 0
        printk("init_seq(%lx, %lx, %d, %d) = %d\n",
               saddr, daddr, sport, dport, seq);

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/include/linux/netlink.h
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/include/linux/netlink.h?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/include/linux/netlink.h (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/include/linux/netlink.h Tue Mar 25 
07:20:22 2008
@@ -173,7 +173,7 @@
 /* finegrained unicast helpers: */
 struct sock *netlink_getsockbyfilp(struct file *filp);
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-               long timeo, struct sock *ssk);
+                     long *timeo, struct sock *ssk);
 void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
 int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
 

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/include/net/tcp.h
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/include/net/tcp.h?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/include/net/tcp.h (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/include/net/tcp.h Tue Mar 25 
07:20:22 2008
@@ -281,7 +281,7 @@
 
 extern int                     tcp_v4_tw_remember_stamp(struct 
inet_timewait_sock *tw);
 
-extern int                     tcp_sendmsg(struct kiocb *iocb, struct sock *sk,
+extern int                     tcp_sendmsg(struct kiocb *iocb, struct socket 
*sock,
                                            struct msghdr *msg, size_t size);
 extern ssize_t                 tcp_sendpage(struct socket *sock, struct page 
*page, int offset, size_t size, int flags);
 
@@ -1260,6 +1260,9 @@
                                                  struct sock *sk)
 {
        __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
+
+       if (sk->sk_send_head == skb)
+               sk->sk_send_head = new;
 }
 
 static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/ipc/mqueue.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/ipc/mqueue.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/ipc/mqueue.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/ipc/mqueue.c Tue Mar 25 07:20:22 
2008
@@ -1014,6 +1014,8 @@
                        return -EINVAL;
                }
                if (notification.sigev_notify == SIGEV_THREAD) {
+                       long timeo;
+
                        /* create the notify skb */
                        nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);
                        ret = -ENOMEM;
@@ -1042,8 +1044,8 @@
                                goto out;
                        }
 
-                       ret = netlink_attachskb(sock, nc, 0,
-                                       MAX_SCHEDULE_TIMEOUT, NULL);
+                       timeo = MAX_SCHEDULE_TIMEOUT;
+                       ret = netlink_attachskb(sock, nc, 0, &timeo, NULL);
                        if (ret == 1)
                                goto retry;
                        if (ret) {

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/core/datagram.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/core/datagram.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/core/datagram.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/core/datagram.c Tue Mar 25 
07:20:22 2008
@@ -450,6 +450,9 @@
        __wsum csum;
        int chunk = skb->len - hlen;
 
+       if (!chunk)
+               return 0;
+
        /* Skip filled elements.
         * Pretty silly, look at memcpy_toiovec, though 8)
         */

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ieee80211/ieee80211_rx.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ieee80211/ieee80211_rx.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ieee80211/ieee80211_rx.c 
(original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ieee80211/ieee80211_rx.c Tue 
Mar 25 07:20:22 2008
@@ -365,6 +365,12 @@
        sc = le16_to_cpu(hdr->seq_ctl);
        frag = WLAN_GET_SEQ_FRAG(sc);
        hdrlen = ieee80211_get_hdrlen(fc);
+
+       if (skb->len < hdrlen) {
+               printk(KERN_INFO "%s: invalid SKB length %d\n",
+                       dev->name, skb->len);
+               goto rx_dropped;
+       }
 
        /* Put this code here so that we avoid duplicating it in all
         * Rx paths. - Jean II */

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/af_inet.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/af_inet.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/af_inet.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/af_inet.c Tue Mar 25 
07:20:22 2008
@@ -831,7 +831,7 @@
        .shutdown          = inet_shutdown,
        .setsockopt        = sock_common_setsockopt,
        .getsockopt        = sock_common_getsockopt,
-       .sendmsg           = inet_sendmsg,
+       .sendmsg           = tcp_sendmsg,
        .recvmsg           = sock_common_recvmsg,
        .mmap              = sock_no_mmap,
        .sendpage          = tcp_sendpage,

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/route.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/route.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/route.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/route.c Tue Mar 25 
07:20:22 2008
@@ -3150,18 +3150,14 @@
        offset /= sizeof(u32);
 
        if (length > 0) {
-               u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset;
                u32 *dst = (u32 *) buffer;
 
-               /* Copy first cpu. */
                *start = buffer;
-               memcpy(dst, src, length);
-
-               /* Add the other cpus in, one int at a time */
+               memset(dst, 0, length);
+
                for_each_possible_cpu(i) {
                        unsigned int j;
-
-                       src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
+                       u32 *src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
 
                        for (j = 0; j < length/4; j++)
                                dst[j] += src[j];

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp.c Tue Mar 25 07:20:22 
2008
@@ -658,9 +658,10 @@
        return tmp;
 }
 
-int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
+int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
                size_t size)
 {
+       struct sock *sk = sock->sk;
        struct iovec *iov;
        struct tcp_sock *tp = tcp_sk(sk);
        struct sk_buff *skb;

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_input.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_input.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_input.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_input.c Tue Mar 25 
07:20:22 2008
@@ -102,11 +102,14 @@
 #define FLAG_DATA_LOST         0x80 /* SACK detected data lossage.             
*/
 #define FLAG_SLOWPATH          0x100 /* Do not skip RFC checks for window 
update.*/
 #define FLAG_ONLY_ORIG_SACKED  0x200 /* SACKs only non-rexmit sent before RTO 
*/
+#define FLAG_SND_UNA_ADVANCED  0x400 /* Snd_una was changed (!= 
FLAG_DATA_ACKED) */
+#define FLAG_DSACKING_ACK      0x800 /* SACK blocks contained DSACK info */
 
 #define FLAG_ACKED             (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
 #define FLAG_NOT_DUP           (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
 #define FLAG_CA_ALERT          (FLAG_DATA_SACKED|FLAG_ECE)
 #define FLAG_FORWARD_PROGRESS  (FLAG_ACKED|FLAG_DATA_SACKED)
+#define FLAG_ANY_PROGRESS      (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED)
 
 #define IsReno(tp) ((tp)->rx_opt.sack_ok == 0)
 #define IsFack(tp) ((tp)->rx_opt.sack_ok & 2)
@@ -964,12 +967,14 @@
 
        /* Check for D-SACK. */
        if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
+               flag |= FLAG_DSACKING_ACK;
                found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
        } else if (num_sacks > 1 &&
                        !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
                        !before(ntohl(sp[0].start_seq), 
ntohl(sp[1].start_seq))) {
+               flag |= FLAG_DSACKING_ACK;
                found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
@@ -988,6 +993,9 @@
         */
        if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - 
tp->max_window))
                return 0;
+
+       if (!tp->packets_out)
+               goto out;
 
        /* SACK fastpath:
         * if the only SACK change is the increase of the end_seq of
@@ -1256,6 +1264,8 @@
        if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss &&
            (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark)))
                tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0);
+
+out:
 
 #if FASTRETRANS_DEBUG > 0
        BUG_TRAP((int)tp->sacked_out >= 0);
@@ -1398,7 +1408,9 @@
                 * waiting for the first ACK and did not get it)...
                 */
                if ((tp->frto_counter == 1) && !(flag&FLAG_DATA_ACKED)) {
-                       tp->retrans_out += tcp_skb_pcount(skb);
+                       /* For some reason this R-bit might get cleared? */
+                       if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS)
+                               tp->retrans_out += tcp_skb_pcount(skb);
                        /* ...enter this if branch just for the first segment */
                        flag |= FLAG_DATA_ACKED;
                } else {
@@ -1849,19 +1861,22 @@
 }
 
 /* Decrease cwnd each second ack. */
-static void tcp_cwnd_down(struct sock *sk)
+static void tcp_cwnd_down(struct sock *sk, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        int decr = tp->snd_cwnd_cnt + 1;
 
-       tp->snd_cwnd_cnt = decr&1;
-       decr >>= 1;
-
-       if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
-               tp->snd_cwnd -= decr;
-
-       tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
-       tp->snd_cwnd_stamp = tcp_time_stamp;
+       if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) ||
+           (IsReno(tp) && !(flag&FLAG_NOT_DUP))) {
+               tp->snd_cwnd_cnt = decr&1;
+               decr >>= 1;
+
+               if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
+                       tp->snd_cwnd -= decr;
+
+               tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
+               tp->snd_cwnd_stamp = tcp_time_stamp;
+       }
 }
 
 /* Nothing was retransmitted or returned timestamp is less
@@ -2058,7 +2073,7 @@
                }
                tcp_moderate_cwnd(tp);
        } else {
-               tcp_cwnd_down(sk);
+               tcp_cwnd_down(sk, flag);
        }
 }
 
@@ -2102,12 +2117,13 @@
  * tcp_xmit_retransmit_queue().
  */
 static void
-tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
-                     int prior_packets, int flag)
+tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag)
 {
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
-       int is_dupack = (tp->snd_una == prior_snd_una && !(flag&FLAG_NOT_DUP));
+       int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP));
+       int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) &&
+                                   (tp->fackets_out > tp->reordering));
 
        /* Some technical things:
         * 1. Reno does not count dupacks (sacked_out) automatically. */
@@ -2184,14 +2200,14 @@
        /* F. Process state. */
        switch (icsk->icsk_ca_state) {
        case TCP_CA_Recovery:
-               if (prior_snd_una == tp->snd_una) {
+               if (!(flag & FLAG_SND_UNA_ADVANCED)) {
                        if (IsReno(tp) && is_dupack)
                                tcp_add_reno_sack(sk);
                } else {
                        int acked = prior_packets - tp->packets_out;
                        if (IsReno(tp))
                                tcp_remove_reno_sacks(sk, acked);
-                       is_dupack = tcp_try_undo_partial(sk, acked);
+                       do_lost = tcp_try_undo_partial(sk, acked);
                }
                break;
        case TCP_CA_Loss:
@@ -2207,7 +2223,7 @@
                /* Loss is undone; fall through to processing in Open state. */
        default:
                if (IsReno(tp)) {
-                       if (tp->snd_una != prior_snd_una)
+                       if (flag & FLAG_SND_UNA_ADVANCED)
                                tcp_reset_reno_sack(tp);
                        if (is_dupack)
                                tcp_add_reno_sack(sk);
@@ -2256,9 +2272,9 @@
                tcp_set_ca_state(sk, TCP_CA_Recovery);
        }
 
-       if (is_dupack || tcp_head_timedout(sk))
+       if (do_lost || tcp_head_timedout(sk))
                tcp_update_scoreboard(sk);
-       tcp_cwnd_down(sk);
+       tcp_cwnd_down(sk, flag);
        tcp_xmit_retransmit_queue(sk);
 }
 
@@ -2391,6 +2407,9 @@
                        __u32 dval = min(tp->fackets_out, packets_acked);
                        tp->fackets_out -= dval;
                }
+               /* hint's skb might be NULL but we don't need to care */
+               tp->fastpath_cnt_hint -= min_t(u32, packets_acked,
+                                              tp->fastpath_cnt_hint);
                tp->packets_out -= packets_acked;
 
                BUG_ON(tcp_skb_pcount(skb) == 0);
@@ -2665,7 +2684,7 @@
  *     to prove that the RTO is indeed spurious. It transfers the control
  *     from F-RTO to the conventional RTO recovery
  */
-static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag)
+static int tcp_process_frto(struct sock *sk, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
 
@@ -2685,8 +2704,7 @@
                 * ACK isn't duplicate nor advances window, e.g., opposite dir
                 * data, winupdate
                 */
-               if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) &&
-                   !(flag&FLAG_FORWARD_PROGRESS))
+               if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP))
                        return 1;
 
                if (!(flag&FLAG_DATA_ACKED)) {
@@ -2766,6 +2784,9 @@
        if (before(ack, prior_snd_una))
                goto old_ack;
 
+       if (after(ack, prior_snd_una))
+               flag |= FLAG_SND_UNA_ADVANCED;
+
        if (sysctl_tcp_abc) {
                if (icsk->icsk_ca_state < TCP_CA_CWR)
                        tp->bytes_acked += ack - prior_snd_una;
@@ -2818,14 +2839,14 @@
        flag |= tcp_clean_rtx_queue(sk, &seq_rtt);
 
        if (tp->frto_counter)
-               frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag);
+               frto_cwnd = tcp_process_frto(sk, flag);
 
        if (tcp_ack_is_dubious(sk, flag)) {
                /* Advance CWND, if state allows this. */
                if ((flag & FLAG_DATA_ACKED) && !frto_cwnd &&
                    tcp_may_raise_cwnd(sk, flag))
                        tcp_cong_avoid(sk, ack,  seq_rtt, prior_in_flight, 0);
-               tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag);
+               tcp_fastretrans_alert(sk, prior_packets, flag);
        } else {
                if ((flag & FLAG_DATA_ACKED) && !frto_cwnd)
                        tcp_cong_avoid(sk, ack, seq_rtt, prior_in_flight, 1);

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_ipv4.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_ipv4.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_ipv4.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_ipv4.c Tue Mar 25 
07:20:22 2008
@@ -2434,7 +2434,6 @@
        .shutdown               = tcp_shutdown,
        .setsockopt             = tcp_setsockopt,
        .getsockopt             = tcp_getsockopt,
-       .sendmsg                = tcp_sendmsg,
        .recvmsg                = tcp_recvmsg,
        .backlog_rcv            = tcp_v4_do_rcv,
        .hash                   = tcp_v4_hash,

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_output.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_output.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_output.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv4/tcp_output.c Tue Mar 25 
07:20:22 2008
@@ -1279,7 +1279,6 @@
 
        skb = tcp_send_head(sk);
        tcp_insert_write_queue_before(nskb, skb, sk);
-       tcp_advance_send_head(sk, skb);
 
        TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
        TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/af_inet6.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/af_inet6.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/af_inet6.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/af_inet6.c Tue Mar 25 
07:20:22 2008
@@ -487,7 +487,7 @@
        .shutdown          = inet_shutdown,             /* ok           */
        .setsockopt        = sock_common_setsockopt,    /* ok           */
        .getsockopt        = sock_common_getsockopt,    /* ok           */
-       .sendmsg           = inet_sendmsg,              /* ok           */
+       .sendmsg           = tcp_sendmsg,               /* ok           */
        .recvmsg           = sock_common_recvmsg,       /* ok           */
        .mmap              = sock_no_mmap,
        .sendpage          = tcp_sendpage,

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/tcp_ipv6.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/tcp_ipv6.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/tcp_ipv6.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/ipv6/tcp_ipv6.c Tue Mar 25 
07:20:22 2008
@@ -2134,7 +2134,6 @@
        .shutdown               = tcp_shutdown,
        .setsockopt             = tcp_setsockopt,
        .getsockopt             = tcp_getsockopt,
-       .sendmsg                = tcp_sendmsg,
        .recvmsg                = tcp_recvmsg,
        .backlog_rcv            = tcp_v6_do_rcv,
        .hash                   = tcp_v6_hash,

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/netlink/af_netlink.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/netlink/af_netlink.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/netlink/af_netlink.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/netlink/af_netlink.c Tue Mar 
25 07:20:22 2008
@@ -732,7 +732,7 @@
  * 1: repeat lookup - reference dropped while waiting for socket memory.
  */
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-               long timeo, struct sock *ssk)
+                     long *timeo, struct sock *ssk)
 {
        struct netlink_sock *nlk;
 
@@ -741,7 +741,7 @@
        if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
            test_bit(0, &nlk->state)) {
                DECLARE_WAITQUEUE(wait, current);
-               if (!timeo) {
+               if (!*timeo) {
                        if (!ssk || nlk_sk(ssk)->pid == 0)
                                netlink_overrun(sk);
                        sock_put(sk);
@@ -755,7 +755,7 @@
                if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
                     test_bit(0, &nlk->state)) &&
                    !sock_flag(sk, SOCK_DEAD))
-                       timeo = schedule_timeout(timeo);
+                       *timeo = schedule_timeout(*timeo);
 
                __set_current_state(TASK_RUNNING);
                remove_wait_queue(&nlk->wait, &wait);
@@ -763,7 +763,7 @@
 
                if (signal_pending(current)) {
                        kfree_skb(skb);
-                       return sock_intr_errno(timeo);
+                       return sock_intr_errno(*timeo);
                }
                return 1;
        }
@@ -827,7 +827,7 @@
                kfree_skb(skb);
                return PTR_ERR(sk);
        }
-       err = netlink_attachskb(sk, skb, nonblock, timeo, ssk);
+       err = netlink_attachskb(sk, skb, nonblock, &timeo, ssk);
        if (err == 1)
                goto retry;
        if (err)

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/sched/sch_api.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/sched/sch_api.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/sched/sch_api.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/sched/sch_api.c Tue Mar 25 
07:20:22 2008
@@ -290,11 +290,7 @@
 
        wd->qdisc->flags &= ~TCQ_F_THROTTLED;
        smp_wmb();
-       if (spin_trylock(&dev->queue_lock)) {
-               qdisc_run(dev);
-               spin_unlock(&dev->queue_lock);
-       } else
-               netif_schedule(dev);
+       netif_schedule(dev);
 
        return HRTIMER_NORESTART;
 }

Modified: trunk/squeezeos/src/s3c2412/linux-2.6.22/net/socket.c
URL: 
http://svn.slimdevices.com/trunk/squeezeos/src/s3c2412/linux-2.6.22/net/socket.c?rev=2145&root=Jive&r1=2144&r2=2145&view=diff
==============================================================================
--- trunk/squeezeos/src/s3c2412/linux-2.6.22/net/socket.c (original)
+++ trunk/squeezeos/src/s3c2412/linux-2.6.22/net/socket.c Tue Mar 25 07:20:22 
2008
@@ -778,9 +778,6 @@
        if (pos != 0)
                return -ESPIPE;
 
-       if (iocb->ki_left == 0) /* Match SYS5 behaviour */
-               return 0;
-
        x = alloc_sock_iocb(iocb, &siocb);
        if (!x)
                return -ENOMEM;
@@ -1169,7 +1166,7 @@
        module_put(pf->owner);
        err = security_socket_post_create(sock, family, type, protocol, kern);
        if (err)
-               goto out_release;
+               goto out_sock_release;
        *res = sock;
 
        return 0;

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to