aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-01-02 13:17:46 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-02 13:17:46 -0500
commit41584f67d243a87105536bfab6865b6c4e23f365 (patch)
tree62445e245b6944cf4b8b0559a3e4a35050589eee
parent75ce7191eac5972405d1752a991bc002c2957b65 (diff)
parent44edf2f89791d162f4dc5ec3718d21f3d6644403 (diff)
Merge branch 'net-sched-Fix-RED-qdisc-offload-flag'
Nogah Frankel says: ==================== net: sched: Fix RED qdisc offload flag Replacing the RED offload flag (TC_RED_OFFLOADED) with the generic one (TCQ_F_OFFLOADED) deleted some of the logic behind it. This patchset fixes this problem. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/sch_api.c5
-rw-r--r--net/sched/sch_red.c26
2 files changed, 16 insertions, 15 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 81ecf5bec26d..8a04c36e579f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -807,11 +807,10 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
807 tcm->tcm_info = refcount_read(&q->refcnt); 807 tcm->tcm_info = refcount_read(&q->refcnt);
808 if (nla_put_string(skb, TCA_KIND, q->ops->id)) 808 if (nla_put_string(skb, TCA_KIND, q->ops->id))
809 goto nla_put_failure; 809 goto nla_put_failure;
810 if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED)))
811 goto nla_put_failure;
812 if (q->ops->dump && q->ops->dump(q, skb) < 0) 810 if (q->ops->dump && q->ops->dump(q, skb) < 0)
813 goto nla_put_failure; 811 goto nla_put_failure;
814 812 if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED)))
813 goto nla_put_failure;
815 qlen = qdisc_qlen_sum(q); 814 qlen = qdisc_qlen_sum(q);
816 815
817 stab = rtnl_dereference(q->stab); 816 stab = rtnl_dereference(q->stab);
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index ec0bd36e09a9..a392eaa4a0b4 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -157,7 +157,6 @@ static int red_offload(struct Qdisc *sch, bool enable)
157 .handle = sch->handle, 157 .handle = sch->handle,
158 .parent = sch->parent, 158 .parent = sch->parent,
159 }; 159 };
160 int err;
161 160
162 if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) 161 if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
163 return -EOPNOTSUPP; 162 return -EOPNOTSUPP;
@@ -172,14 +171,7 @@ static int red_offload(struct Qdisc *sch, bool enable)
172 opt.command = TC_RED_DESTROY; 171 opt.command = TC_RED_DESTROY;
173 } 172 }
174 173
175 err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt); 174 return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
176
177 if (!err && enable)
178 sch->flags |= TCQ_F_OFFLOADED;
179 else
180 sch->flags &= ~TCQ_F_OFFLOADED;
181
182 return err;
183} 175}
184 176
185static void red_destroy(struct Qdisc *sch) 177static void red_destroy(struct Qdisc *sch)
@@ -297,12 +289,22 @@ static int red_dump_offload_stats(struct Qdisc *sch, struct tc_red_qopt *opt)
297 .stats.qstats = &sch->qstats, 289 .stats.qstats = &sch->qstats,
298 }, 290 },
299 }; 291 };
292 int err;
293
294 sch->flags &= ~TCQ_F_OFFLOADED;
300 295
301 if (!(sch->flags & TCQ_F_OFFLOADED)) 296 if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
297 return 0;
298
299 err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED,
300 &hw_stats);
301 if (err == -EOPNOTSUPP)
302 return 0; 302 return 0;
303 303
304 return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, 304 if (!err)
305 &hw_stats); 305 sch->flags |= TCQ_F_OFFLOADED;
306
307 return err;
306} 308}
307 309
308static int red_dump(struct Qdisc *sch, struct sk_buff *skb) 310static int red_dump(struct Qdisc *sch, struct sk_buff *skb)