Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41584f67 authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 75ce7191 44edf2f8
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);
	if (nla_put_string(skb, TCA_KIND, q->ops->id))
		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)
		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);

	stab = rtnl_dereference(q->stab);
+14 −12
Original line number Diff line number Diff line
@@ -157,7 +157,6 @@ static int red_offload(struct Qdisc *sch, bool enable)
		.handle = sch->handle,
		.parent = sch->parent,
	};
	int err;

	if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
		return -EOPNOTSUPP;
@@ -172,14 +171,7 @@ static int red_offload(struct Qdisc *sch, bool enable)
		opt.command = TC_RED_DESTROY;
	}

	err = 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;
	return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
}

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,
		},
	};
	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 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);
	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)