add xidmask patch for mlab k32 kernel
[linux-2.6.git] / linux-2.6-710-xidmask.patch
1 diff -Ndur linux-2.6.32-700/include/net/tcp.h linux-2.6.32-700-xidmask/include/net/tcp.h
2 --- linux-2.6.32-700/include/net/tcp.h  2013-01-10 14:18:49.880337393 -0500
3 +++ linux-2.6.32-700-xidmask/include/net/tcp.h  2013-01-10 14:21:16.366337329 -0500
4 @@ -251,6 +251,8 @@
5  #ifdef CONFIG_WEB100_STATS
6  extern int sysctl_web100_fperms;
7  extern int sysctl_web100_gid;
8 +extern int sysctl_web100_sidestream_xid;
9 +extern int sysctl_web100_mask_xid;
10  #endif
11  
12  extern atomic_t tcp_memory_allocated;
13 diff -Ndur linux-2.6.32-700/Makefile linux-2.6.32-700-xidmask/Makefile
14 --- linux-2.6.32-700/Makefile   2013-01-10 14:18:52.816337505 -0500
15 +++ linux-2.6.32-700-xidmask/Makefile   2013-01-10 14:38:46.659197193 -0500
16 @@ -1,7 +1,7 @@
17  VERSION = 2
18  PATCHLEVEL = 6
19  SUBLEVEL = 32
20 -EXTRAVERSION = -131.tg3.220.mlab.i686
21 +EXTRAVERSION = .133-vs2.3.0.36.29.6.mlab.mask1.planetlab
22  NAME = Man-Eating Seals of Antiquity
23  RHEL_MAJOR = 6
24  RHEL_MINOR = 1
25 diff -Ndur linux-2.6.32-700/net/ipv4/sysctl_net_ipv4.c linux-2.6.32-700-xidmask/net/ipv4/sysctl_net_ipv4.c
26 --- linux-2.6.32-700/net/ipv4/sysctl_net_ipv4.c 2013-01-10 14:18:50.233320698 -0500
27 +++ linux-2.6.32-700-xidmask/net/ipv4/sysctl_net_ipv4.c 2013-01-10 14:30:18.997403751 -0500
28 @@ -754,6 +754,22 @@
29                 .mode           = 0644,
30                 .proc_handler   = &web100_proc_dointvec_update,
31         },
32 +       {
33 +               .ctl_name       = CTL_UNNUMBERED,
34 +               .procname       = "web100_sidestream_xid",
35 +               .data           = &sysctl_web100_sidestream_xid,
36 +               .maxlen         = sizeof(int),
37 +               .mode           = 0644,
38 +               .proc_handler   = &web100_proc_dointvec_update,
39 +       },
40 +       {
41 +               .ctl_name       = CTL_UNNUMBERED,
42 +               .procname       = "web100_mask_xid",
43 +               .data           = &sysctl_web100_mask_xid,
44 +               .maxlen         = sizeof(int),
45 +               .mode           = 0644,
46 +               .proc_handler   = &web100_proc_dointvec_update,
47 +       },
48  #endif
49         {
50                 .ctl_name       = CTL_UNNUMBERED,
51 diff -Ndur linux-2.6.32-700/net/ipv4/tcp.c linux-2.6.32-700-xidmask/net/ipv4/tcp.c
52 --- linux-2.6.32-700/net/ipv4/tcp.c     2013-01-10 14:18:50.234322447 -0500
53 +++ linux-2.6.32-700-xidmask/net/ipv4/tcp.c     2013-01-10 14:21:16.368337586 -0500
54 @@ -297,6 +297,8 @@
55  #ifdef CONFIG_WEB100_STATS
56  int sysctl_web100_fperms = CONFIG_WEB100_FPERMS;
57  int sysctl_web100_gid = CONFIG_WEB100_GID;
58 +int sysctl_web100_sidestream_xid = 0;
59 +int sysctl_web100_mask_xid = -1;
60  #endif
61  
62  atomic_t tcp_memory_allocated; /* Current allocated memory. */
63 @@ -848,7 +850,7 @@
64                 if (copied) {
65                         tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
66  #ifdef CONFIG_WEB100_STATS
67 -                       web100_update_writeq(sk);
68 +                       WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_writeq(sk));
69  #endif
70                 }
71  
72 @@ -1101,7 +1103,7 @@
73                         if (copied) {
74                                 tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
75  #ifdef CONFIG_WEB100_STATS
76 -                               web100_update_writeq(sk);
77 +                               WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_writeq(sk));
78  #endif
79                         }
80  
81 @@ -1471,7 +1473,7 @@
82                                         tp->rcv_nxt, flags);
83                 }
84  #ifdef CONFIG_WEB100_STATS
85 -               web100_update_recvq(sk);
86 +               WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_recvq(sk));
87  #endif
88  
89                 /* Well, if we have backlog, try to process it now yet. */
90 diff -Ndur linux-2.6.32-700/net/ipv4/tcp_input.c linux-2.6.32-700-xidmask/net/ipv4/tcp_input.c
91 --- linux-2.6.32-700/net/ipv4/tcp_input.c       2013-01-10 14:18:50.232318345 -0500
92 +++ linux-2.6.32-700-xidmask/net/ipv4/tcp_input.c       2013-01-10 14:21:16.371337187 -0500
93 @@ -3177,7 +3177,7 @@
94         }
95         
96  #ifdef CONFIG_WEB100_NET100
97 -       if (vars->WAD_NoAI) {
98 +       if (stats != NULL && vars->WAD_NoAI) {
99                 tp->snd_cwnd += vars->WAD_CwndAdjust;
100                 vars->WAD_CwndAdjust = 0;
101                 tp->snd_cwnd_stamp = tcp_time_stamp;
102 @@ -4426,7 +4426,7 @@
103                 tcp_fast_path_check(sk);
104  
105  #ifdef CONFIG_WEB100_STATS
106 -               web100_update_recvq(sk);
107 +               WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_recvq(sk));
108  #endif
109  
110                 if (eaten > 0)
111 @@ -4484,7 +4484,7 @@
112                    tp->rcv_nxt, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
113  
114  #ifdef CONFIG_WEB100_STATS
115 -       web100_update_recvq(sk);
116 +       WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_recvq(sk));
117  #endif
118         skb_set_owner_r(skb, sk);
119  
120 @@ -5372,7 +5372,7 @@
121                         }
122  
123  #ifdef CONFIG_WEB100_STATS
124 -                       web100_update_recvq(sk);
125 +                       WEB100_UPDATE_FUNC(tcp_sk(sk), web100_update_recvq(sk));
126  #endif
127                         tcp_event_data_recv(sk, skb);
128  
129 diff -Ndur linux-2.6.32-700/net/ipv4/tcp_ipv4.c linux-2.6.32-700-xidmask/net/ipv4/tcp_ipv4.c
130 --- linux-2.6.32-700/net/ipv4/tcp_ipv4.c        2013-01-10 14:18:50.235319018 -0500
131 +++ linux-2.6.32-700-xidmask/net/ipv4/tcp_ipv4.c        2013-01-10 14:21:16.372284450 -0500
132 @@ -1383,7 +1383,9 @@
133                 sk_free(newsk);
134                 goto exit;
135         }
136 -       tcp_sk(newsk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV4;
137 +       if ( tcp_sk(newsk)->tcp_stats != NULL ) {
138 +               tcp_sk(newsk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV4;
139 +       }
140  #endif
141  
142         newsk->sk_gso_type = SKB_GSO_TCPV4;
143 @@ -1857,7 +1859,9 @@
144                 if ((err = web100_stats_create(sk))) {
145                         return err;
146                 }
147 -               tcp_sk(sk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV4;
148 +               if ( tcp_sk(sk)->tcp_stats != NULL ) {
149 +                       tcp_sk(sk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV4;
150 +               }
151         }
152  #endif
153  
154 diff -Ndur linux-2.6.32-700/net/ipv4/web100_stats.c linux-2.6.32-700-xidmask/net/ipv4/web100_stats.c
155 --- linux-2.6.32-700/net/ipv4/web100_stats.c    2013-01-10 14:18:50.231318735 -0500
156 +++ linux-2.6.32-700-xidmask/net/ipv4/web100_stats.c    2013-01-10 14:21:16.373337472 -0500
157 @@ -252,6 +252,16 @@
158         struct web100directs *vars;
159         struct tcp_sock *tp = tcp_sk(sk);
160         struct timeval tv;
161 +
162 +       printk("Web100: stats_create(): checking xid(%d) mask(%d)\n",
163 +                               sk->sk_xid, sysctl_web100_mask_xid);
164 +       if ( sk->sk_xid == sysctl_web100_mask_xid ) {
165 +               /* this xid is masked, so do not allocate or update tcp_stats */
166 +               printk("Web100: skipping stats_create() for xid(%d) mask(%d)\n",
167 +                               sk->sk_xid, sysctl_web100_mask_xid);
168 +               tp->tcp_stats = NULL;
169 +               return 0;
170 +       }
171         
172         if ((stats = kmalloc(sizeof (struct web100stats), gfp_any())) == NULL)
173                 return -ENOMEM;
174 @@ -294,6 +304,9 @@
175  
176  void web100_stats_destroy(struct web100stats *stats)
177  {
178 +    if ( stats == NULL ) {
179 +        return;
180 +    }
181         /* Attribute final sndlim time. */
182         web100_update_sndlim(tcp_sk(stats->wc_sk), stats->wc_limstate);
183         
184 diff -Ndur linux-2.6.32-700/net/ipv6/tcp_ipv6.c linux-2.6.32-700-xidmask/net/ipv6/tcp_ipv6.c
185 --- linux-2.6.32-700/net/ipv6/tcp_ipv6.c        2013-01-10 14:18:50.219284269 -0500
186 +++ linux-2.6.32-700-xidmask/net/ipv6/tcp_ipv6.c        2013-01-10 14:21:16.373337472 -0500
187 @@ -1380,7 +1380,9 @@
188                 sk_free(newsk);
189                 goto out;
190         }
191 -       tcp_sk(newsk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV6;
192 +       if ( tcp_sk(newsk)->tcp_stats != NULL ) {
193 +               tcp_sk(newsk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV6;
194 +       }
195  #endif
196  
197         /*
198 @@ -1901,7 +1903,9 @@
199                 if ((err = web100_stats_create(sk))) {
200                         return err;
201                 }
202 -               tcp_sk(sk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV6;
203 +               if ( tcp_sk(sk)->tcp_stats != NULL ) {
204 +                       tcp_sk(sk)->tcp_stats->wc_vars.LocalAddressType = WC_ADDRTYPE_IPV6;
205 +               }
206         }
207  #endif
208