Преглед изворни кода

net: sched: Add TCA_HW_OFFLOAD

Qdiscs can be offloaded to HW, but current implementation isn't uniform.
Instead, qdiscs either pass information about offload status via their
TCA_OPTIONS or omit it altogether.

Introduce a new attribute - TCA_HW_OFFLOAD that would form a uniform
uAPI for the offloading status of qdiscs.

Signed-off-by: Yuval Mintz <yuvalm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Yuval Mintz пре 7 година
родитељ
комит
7a4fa29106
3 измењених фајлова са 4 додато и 0 уклоњено
  1. 1 0
      include/net/sch_generic.h
  2. 1 0
      include/uapi/linux/rtnetlink.h
  3. 2 0
      net/sched/sch_api.c

+ 1 - 0
include/net/sch_generic.h

@@ -71,6 +71,7 @@ struct Qdisc {
 				      * qdisc_tree_decrease_qlen() should stop.
 				      * qdisc_tree_decrease_qlen() should stop.
 				      */
 				      */
 #define TCQ_F_INVISIBLE		0x80 /* invisible by default in dump */
 #define TCQ_F_INVISIBLE		0x80 /* invisible by default in dump */
+#define TCQ_F_OFFLOADED		0x200 /* qdisc is offloaded to HW */
 	u32			limit;
 	u32			limit;
 	const struct Qdisc_ops	*ops;
 	const struct Qdisc_ops	*ops;
 	struct qdisc_size_table	__rcu *stab;
 	struct qdisc_size_table	__rcu *stab;

+ 1 - 0
include/uapi/linux/rtnetlink.h

@@ -557,6 +557,7 @@ enum {
 	TCA_PAD,
 	TCA_PAD,
 	TCA_DUMP_INVISIBLE,
 	TCA_DUMP_INVISIBLE,
 	TCA_CHAIN,
 	TCA_CHAIN,
+	TCA_HW_OFFLOAD,
 	__TCA_MAX
 	__TCA_MAX
 };
 };
 
 

+ 2 - 0
net/sched/sch_api.c

@@ -795,6 +795,8 @@ 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;
 	qlen = q->q.qlen;
 	qlen = q->q.qlen;