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>
This commit is contained in:
commit
41584f67d2
@ -807,11 +807,10 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
|
|||||||
tcm->tcm_info = refcount_read(&q->refcnt);
|
tcm->tcm_info = refcount_read(&q->refcnt);
|
||||||
if (nla_put_string(skb, TCA_KIND, q->ops->id))
|
if (nla_put_string(skb, TCA_KIND, q->ops->id))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED)))
|
|
||||||
goto nla_put_failure;
|
|
||||||
if (q->ops->dump && q->ops->dump(q, skb) < 0)
|
if (q->ops->dump && q->ops->dump(q, skb) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED)))
|
||||||
|
goto nla_put_failure;
|
||||||
qlen = qdisc_qlen_sum(q);
|
qlen = qdisc_qlen_sum(q);
|
||||||
|
|
||||||
stab = rtnl_dereference(q->stab);
|
stab = rtnl_dereference(q->stab);
|
||||||
|
@ -157,7 +157,6 @@ static int red_offload(struct Qdisc *sch, bool enable)
|
|||||||
.handle = sch->handle,
|
.handle = sch->handle,
|
||||||
.parent = sch->parent,
|
.parent = sch->parent,
|
||||||
};
|
};
|
||||||
int err;
|
|
||||||
|
|
||||||
if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
|
if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
@ -172,14 +171,7 @@ static int red_offload(struct Qdisc *sch, bool enable)
|
|||||||
opt.command = TC_RED_DESTROY;
|
opt.command = TC_RED_DESTROY;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
|
return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
|
||||||
|
|
||||||
if (!err && enable)
|
|
||||||
sch->flags |= TCQ_F_OFFLOADED;
|
|
||||||
else
|
|
||||||
sch->flags &= ~TCQ_F_OFFLOADED;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void red_destroy(struct Qdisc *sch)
|
static void red_destroy(struct Qdisc *sch)
|
||||||
@ -297,12 +289,22 @@ static int red_dump_offload_stats(struct Qdisc *sch, struct tc_red_qopt *opt)
|
|||||||
.stats.qstats = &sch->qstats,
|
.stats.qstats = &sch->qstats,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
int err;
|
||||||
|
|
||||||
if (!(sch->flags & TCQ_F_OFFLOADED))
|
sch->flags &= ~TCQ_F_OFFLOADED;
|
||||||
|
|
||||||
|
if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED,
|
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED,
|
||||||
&hw_stats);
|
&hw_stats);
|
||||||
|
if (err == -EOPNOTSUPP)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
sch->flags |= TCQ_F_OFFLOADED;
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
|
static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||||
|
Loading…
Reference in New Issue
Block a user