Commit a0bffffc authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

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: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3ac80a1
...@@ -380,7 +380,6 @@ static int dn_return_short(struct sk_buff *skb) ...@@ -380,7 +380,6 @@ static int dn_return_short(struct sk_buff *skb)
unsigned char *ptr; unsigned char *ptr;
__le16 *src; __le16 *src;
__le16 *dst; __le16 *dst;
__le16 tmp;
/* Add back headers */ /* Add back headers */
skb_push(skb, skb->data - skb_network_header(skb)); skb_push(skb, skb->data - skb_network_header(skb));
...@@ -399,10 +398,7 @@ static int dn_return_short(struct sk_buff *skb) ...@@ -399,10 +398,7 @@ static int dn_return_short(struct sk_buff *skb)
ptr += 2; ptr += 2;
*ptr = 0; /* Zero hop count */ *ptr = 0; /* Zero hop count */
/* Swap source and destination */ swap(*src, *dst);
tmp = *src;
*src = *dst;
*dst = tmp;
skb->pkt_type = PACKET_OUTGOING; skb->pkt_type = PACKET_OUTGOING;
dn_rt_finish_output(skb, NULL, NULL); dn_rt_finish_output(skb, NULL, NULL);
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/kernel.h>
#include <net/dst.h> #include <net/dst.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <net/inet_common.h> #include <net/inet_common.h>
...@@ -1802,11 +1803,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, ...@@ -1802,11 +1803,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
for (i = used_sacks - 1; i > 0; i--) { for (i = used_sacks - 1; i > 0; i--) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (after(sp[j].start_seq, sp[j + 1].start_seq)) { if (after(sp[j].start_seq, sp[j + 1].start_seq)) {
struct tcp_sack_block tmp; swap(sp[j], sp[j + 1]);
tmp = sp[j];
sp[j] = sp[j + 1];
sp[j + 1] = tmp;
/* Track where the first SACK block goes to */ /* Track where the first SACK block goes to */
if (j == first_sack_index) if (j == first_sack_index)
...@@ -4156,20 +4153,6 @@ static void tcp_sack_maybe_coalesce(struct tcp_sock *tp) ...@@ -4156,20 +4153,6 @@ static void tcp_sack_maybe_coalesce(struct tcp_sock *tp)
} }
} }
static inline void tcp_sack_swap(struct tcp_sack_block *sack1,
struct tcp_sack_block *sack2)
{
__u32 tmp;
tmp = sack1->start_seq;
sack1->start_seq = sack2->start_seq;
sack2->start_seq = tmp;
tmp = sack1->end_seq;
sack1->end_seq = sack2->end_seq;
sack2->end_seq = tmp;
}
static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq) static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq)
{ {
struct tcp_sock *tp = tcp_sk(sk); 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,7 +4167,7 @@ static void tcp_sack_new_ofo_skb(struct sock *sk, u32 seq, u32 end_seq)
if (tcp_sack_extend(sp, seq, end_seq)) { if (tcp_sack_extend(sp, seq, end_seq)) {
/* Rotate this_sack to the first one. */ /* Rotate this_sack to the first one. */
for (; this_sack > 0; this_sack--, sp--) for (; this_sack > 0; this_sack--, sp--)
tcp_sack_swap(sp, sp - 1); swap(*sp, *(sp - 1));
if (cur_sacks > 1) if (cur_sacks > 1)
tcp_sack_maybe_coalesce(tp); tcp_sack_maybe_coalesce(tp);
return; return;
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <linux/net.h> #include <linux/net.h>
...@@ -1215,16 +1216,12 @@ int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev, ...@@ -1215,16 +1216,12 @@ int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
} }
break; break;
} else if (minihiscore < miniscore) { } else if (minihiscore < miniscore) {
struct ipv6_saddr_score *tmp;
if (hiscore->ifa) if (hiscore->ifa)
in6_ifa_put(hiscore->ifa); in6_ifa_put(hiscore->ifa);
in6_ifa_hold(score->ifa); in6_ifa_hold(score->ifa);
tmp = hiscore; swap(hiscore, score);
hiscore = score;
score = tmp;
/* restore our iterator */ /* restore our iterator */
score->ifa = hiscore->ifa; score->ifa = hiscore->ifa;
......
...@@ -236,7 +236,6 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) ...@@ -236,7 +236,6 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
struct tc_tbf_qopt *qopt; struct tc_tbf_qopt *qopt;
struct qdisc_rate_table *rtab = NULL; struct qdisc_rate_table *rtab = NULL;
struct qdisc_rate_table *ptab = NULL; struct qdisc_rate_table *ptab = NULL;
struct qdisc_rate_table *tmp;
struct Qdisc *child = NULL; struct Qdisc *child = NULL;
int max_size,n; int max_size,n;
...@@ -295,13 +294,9 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) ...@@ -295,13 +294,9 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
q->tokens = q->buffer; q->tokens = q->buffer;
q->ptokens = q->mtu; q->ptokens = q->mtu;
tmp = q->R_tab; swap(q->R_tab, rtab);
q->R_tab = rtab; swap(q->P_tab, ptab);
rtab = tmp;
tmp = q->P_tab;
q->P_tab = ptab;
ptab = tmp;
sch_tree_unlock(sch); sch_tree_unlock(sch);
err = 0; err = 0;
done: done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment