net: sched: use skb_list_walk_safe helper for gso segments
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 13 Jan 2020 23:42:30 +0000 (18:42 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jan 2020 19:48:41 +0000 (11:48 -0800)
This is a straight-forward conversion case for the new function, keeping
the flow of the existing code as intact as possible.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_cake.c
net/sched/sch_tbf.c

index 90ef7cc79b6945d6a6ae4d8fda0ab0baf218b516..1496e87cd07bb4ec9f43389ddb8f29562bdef93f 100644 (file)
@@ -1682,8 +1682,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                if (IS_ERR_OR_NULL(segs))
                        return qdisc_drop(skb, sch, to_free);
 
-               while (segs) {
-                       nskb = segs->next;
+               skb_list_walk_safe(segs, segs, nskb) {
                        skb_mark_not_on_list(segs);
                        qdisc_skb_cb(segs)->pkt_len = segs->len;
                        cobalt_set_enqueue_time(segs, now);
@@ -1696,7 +1695,6 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                        slen += segs->len;
                        q->buffer_used += segs->truesize;
                        b->packets++;
-                       segs = nskb;
                }
 
                /* stats */
index 5f72f3f916a5a6c030eccc67332d6c86795dca4b..2cd94973795c93f66e84a16696865c452f4640e0 100644 (file)
@@ -155,8 +155,7 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch,
                return qdisc_drop(skb, sch, to_free);
 
        nb = 0;
-       while (segs) {
-               nskb = segs->next;
+       skb_list_walk_safe(segs, segs, nskb) {
                skb_mark_not_on_list(segs);
                qdisc_skb_cb(segs)->pkt_len = segs->len;
                len += segs->len;
@@ -167,7 +166,6 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch,
                } else {
                        nb++;
                }
-               segs = nskb;
        }
        sch->q.qlen += nb;
        if (nb > 1)