aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2009-03-21 16:36:17 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-21 16:36:17 -0400
commita0bffffc148cd8e75a48a89ad2ddb74e4081a20a (patch)
tree3a4d350d65d88bb1df8906b4822af2350ceb1cfc /net
parenta3ac80a130300573de351083cf4a5b46d233e8bf (diff)
net/*: use linux/kernel.h swap()
tcp_sack_swap seems unnecessary so I pushed swap to the caller. Also removed comment that seemed then pointless, and added include when not already there. Compile tested. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/decnet/dn_route.c6
-rw-r--r--net/ipv4/tcp_input.c23
-rw-r--r--net/ipv6/addrconf.c7
-rw-r--r--net/sched/sch_tbf.c9
4 files changed, 8 insertions, 37 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 5130dee0b384..0cc4394117df 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -380,7 +380,6 @@ static int dn_return_short(struct sk_buff *skb)
380 unsigned char *ptr; 380 unsigned char *ptr;
381 __le16 *src; 381 __le16 *src;
382 __le16 *dst; 382 __le16 *dst;
383 __le16 tmp;
384 383
385 /* Add back headers */ 384 /* Add back headers */
386 skb_push(skb, skb->data - skb_network_header(skb)); 385 skb_push(skb, skb->data - skb_network_header(skb));
@@ -399,10 +398,7 @@ static int dn_return_short(struct sk_buff *skb)
399 ptr += 2; 398 ptr += 2;
400 *ptr = 0; /* Zero hop count */ 399 *ptr = 0; /* Zero hop count */
401 400
402 /* Swap source and destination */ 401 swap(*src, *dst);
403 tmp = *src;
404 *src = *dst;
405 *dst = tmp;
406 402
407 skb->pkt_type = PACKET_OUTGOING; 403 skb->pkt_type = PACKET_OUTGOING;
408 dn_rt_finish_output(skb, NULL, NULL); 404 dn_rt_finish_output(skb, NULL, NULL);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fae78e3eccc4..8ac82b3703ab 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -64,6 +64,7 @@
64#include <linux/mm.h> 64#include <linux/mm.h>
65#include <linux/module.h> 65#include <linux/module.h>
66#include <linux/sysctl.h> 66#include <linux/sysctl.h>
67#include <linux/kernel.h>
67#include <net/dst.h> 68#include <net/dst.h>
68#include <net/tcp.h> 69#include <net/tcp.h>
69#include <net/inet_common.h> 70#include <net/inet_common.h>
@@ -1802,11 +1803,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
1802 for (i = used_sacks - 1; i > 0; i--) { 1803 for (i = used_sacks - 1; i > 0; i--) {
1803 for (j = 0; j < i; j++) { 1804 for (j = 0; j < i; j++) {
1804 if (after(sp[j].start_seq, sp[j + 1].start_seq)) { 1805 if (after(sp[j].start_seq, sp[j + 1].start_seq)) {
1805 struct tcp_sack_block tmp; 1806 swap(sp[j], sp[j + 1]);
1806
1807 tmp = sp[j];
1808 sp[j] = sp[j + 1];
1809 sp[j + 1] = tmp;
1810 1807
1811 /* Track where the first SACK block goes to */ 1808 /* Track where the first SACK block goes to */
1812 if (j == first_sack_index) 1809 if (j == first_sack_index)
@@ -4156,20 +4153,6 @@ static void tcp_sack_maybe_coalesce(struct tcp_sock *tp)
4156 } 4153 }
4157} 4154}
4158 4155
4159static inline void tcp_sack_swap(struct tcp_sack_block *sack1,
4160 struct tcp_sack_block *sack2)
4161{
4162 __u32 tmp;
4163
4164 tmp = sack1->start_seq;
4165 sack1->start_seq = sack2->start_seq;
4166 sack2->start_seq = tmp;
4167
4168 tmp = sack1->end_seq;
4169 sack1->end_seq = sack2->end_seq;
4170 sack2->end_seq = tmp;
4171}
4172
4173static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq) 4156static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq)
4174{ 4157{
4175 struct tcp_sock *tp = tcp_sk(sk); 4158 struct tcp_sock *tp = tcp_sk(sk);
@@ -4184,7 +4167,7 @@ static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq)
4184 if (tcp_sack_extend(sp, seq, end_seq)) { 4167 if (tcp_sack_extend(sp, seq, end_seq)) {
4185 /* Rotate this_sack to the first one. */ 4168 /* Rotate this_sack to the first one. */
4186 for (; this_sack > 0; this_sack--, sp--) 4169 for (; this_sack > 0; this_sack--, sp--)
4187 tcp_sack_swap(sp, sp - 1); 4170 swap(*sp, *(sp - 1));
4188 if (cur_sacks > 1) 4171 if (cur_sacks > 1)
4189 tcp_sack_maybe_coalesce(tp); 4172 tcp_sack_maybe_coalesce(tp);
4190 return; 4173 return;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 717584bad02e..8499da9e76a2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -40,6 +40,7 @@
40 40
41#include <linux/errno.h> 41#include <linux/errno.h>
42#include <linux/types.h> 42#include <linux/types.h>
43#include <linux/kernel.h>
43#include <linux/socket.h> 44#include <linux/socket.h>
44#include <linux/sockios.h> 45#include <linux/sockios.h>
45#include <linux/net.h> 46#include <linux/net.h>
@@ -1215,16 +1216,12 @@ int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
1215 } 1216 }
1216 break; 1217 break;
1217 } else if (minihiscore < miniscore) { 1218 } else if (minihiscore < miniscore) {
1218 struct ipv6_saddr_score *tmp;
1219
1220 if (hiscore->ifa) 1219 if (hiscore->ifa)
1221 in6_ifa_put(hiscore->ifa); 1220 in6_ifa_put(hiscore->ifa);
1222 1221
1223 in6_ifa_hold(score->ifa); 1222 in6_ifa_hold(score->ifa);
1224 1223
1225 tmp = hiscore; 1224 swap(hiscore, score);
1226 hiscore = score;
1227 score = tmp;
1228 1225
1229 /* restore our iterator */ 1226 /* restore our iterator */
1230 score->ifa = hiscore->ifa; 1227 score->ifa = hiscore->ifa;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index a2f93c09f3cc..e22dfe85e43e 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -236,7 +236,6 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
236 struct tc_tbf_qopt *qopt; 236 struct tc_tbf_qopt *qopt;
237 struct qdisc_rate_table *rtab = NULL; 237 struct qdisc_rate_table *rtab = NULL;
238 struct qdisc_rate_table *ptab = NULL; 238 struct qdisc_rate_table *ptab = NULL;
239 struct qdisc_rate_table *tmp;
240 struct Qdisc *child = NULL; 239 struct Qdisc *child = NULL;
241 int max_size,n; 240 int max_size,n;
242 241
@@ -295,13 +294,9 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
295 q->tokens = q->buffer; 294 q->tokens = q->buffer;
296 q->ptokens = q->mtu; 295 q->ptokens = q->mtu;
297 296
298 tmp = q->R_tab; 297 swap(q->R_tab, rtab);
299 q->R_tab = rtab; 298 swap(q->P_tab, ptab);
300 rtab = tmp;
301 299
302 tmp = q->P_tab;
303 q->P_tab = ptab;
304 ptab = tmp;
305 sch_tree_unlock(sch); 300 sch_tree_unlock(sch);
306 err = 0; 301 err = 0;
307done: 302done: