aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_tbf.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-11-20 07:11:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 07:11:36 -0500
commitb94c8afcba3ae6584653b98e315446ea83be6ea5 (patch)
tree377fcfaf74e3aa38243c736a440e45b378355d8e /net/sched/sch_tbf.c
parentc19d0369d4c791d90fe0b84d6040a897fe25cc14 (diff)
pkt_sched: remove unnecessary xchg() in packet schedulers
The use of xchg() hasn't been necessary since 2.2.something when proper locking was added to packet schedulers. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r--net/sched/sch_tbf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index bb7783d584bb..a2f93c09f3cc 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -236,6 +236,7 @@ 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;
239 struct Qdisc *child = NULL; 240 struct Qdisc *child = NULL;
240 int max_size,n; 241 int max_size,n;
241 242
@@ -284,7 +285,8 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
284 sch_tree_lock(sch); 285 sch_tree_lock(sch);
285 if (child) { 286 if (child) {
286 qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); 287 qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen);
287 qdisc_destroy(xchg(&q->qdisc, child)); 288 qdisc_destroy(q->qdisc);
289 q->qdisc = child;
288 } 290 }
289 q->limit = qopt->limit; 291 q->limit = qopt->limit;
290 q->mtu = qopt->mtu; 292 q->mtu = qopt->mtu;
@@ -292,8 +294,14 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
292 q->buffer = qopt->buffer; 294 q->buffer = qopt->buffer;
293 q->tokens = q->buffer; 295 q->tokens = q->buffer;
294 q->ptokens = q->mtu; 296 q->ptokens = q->mtu;
295 rtab = xchg(&q->R_tab, rtab); 297
296 ptab = xchg(&q->P_tab, ptab); 298 tmp = q->R_tab;
299 q->R_tab = rtab;
300 rtab = tmp;
301
302 tmp = q->P_tab;
303 q->P_tab = ptab;
304 ptab = tmp;
297 sch_tree_unlock(sch); 305 sch_tree_unlock(sch);
298 err = 0; 306 err = 0;
299done: 307done:
@@ -383,7 +391,8 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
383 new = &noop_qdisc; 391 new = &noop_qdisc;
384 392
385 sch_tree_lock(sch); 393 sch_tree_lock(sch);
386 *old = xchg(&q->qdisc, new); 394 *old = q->qdisc;
395 q->qdisc = new;
387 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); 396 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
388 qdisc_reset(*old); 397 qdisc_reset(*old);
389 sch_tree_unlock(sch); 398 sch_tree_unlock(sch);