Skip to content

Commit 7a4fa29

Browse files
Yuval Mintzdavem330
Yuval Mintz
authored andcommitted
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 <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a06069 commit 7a4fa29

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

include/net/sch_generic.h

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct Qdisc {
7171
* qdisc_tree_decrease_qlen() should stop.
7272
*/
7373
#define TCQ_F_INVISIBLE 0x80 /* invisible by default in dump */
74+
#define TCQ_F_OFFLOADED 0x200 /* qdisc is offloaded to HW */
7475
u32 limit;
7576
const struct Qdisc_ops *ops;
7677
struct qdisc_size_table __rcu *stab;

include/uapi/linux/rtnetlink.h

+1
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ enum {
557557
TCA_PAD,
558558
TCA_DUMP_INVISIBLE,
559559
TCA_CHAIN,
560+
TCA_HW_OFFLOAD,
560561
__TCA_MAX
561562
};
562563

net/sched/sch_api.c

+2
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
795795
tcm->tcm_info = refcount_read(&q->refcnt);
796796
if (nla_put_string(skb, TCA_KIND, q->ops->id))
797797
goto nla_put_failure;
798+
if (nla_put_u8(skb, TCA_HW_OFFLOAD, !!(q->flags & TCQ_F_OFFLOADED)))
799+
goto nla_put_failure;
798800
if (q->ops->dump && q->ops->dump(q, skb) < 0)
799801
goto nla_put_failure;
800802
qlen = q->q.qlen;

0 commit comments

Comments
 (0)