diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-06 05:16:56 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-09 12:37:49 +0200 |
commit | 21261ea231082d76caf2c21f70e9550061f15d6f (patch) | |
tree | 798ac6f553b8aae28d3f2ebc0e7b92fd861606e4 /src/network/tc | |
parent | core/cgroup: use bus locator (#24251) (diff) | |
download | systemd-21261ea231082d76caf2c21f70e9550061f15d6f.tar.xz systemd-21261ea231082d76caf2c21f70e9550061f15d6f.zip |
network/qdisc: introduce is_ready() in qdisc vtable
Preparation for next commit.
Diffstat (limited to 'src/network/tc')
-rw-r--r-- | src/network/tc/qdisc.c | 13 | ||||
-rw-r--r-- | src/network/tc/qdisc.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c index 6aef268d1f..8f8a7408a5 100644 --- a/src/network/tc/qdisc.c +++ b/src/network/tc/qdisc.c @@ -353,10 +353,17 @@ static bool qdisc_is_ready_to_configure(QDisc *qdisc, Link *link) { if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) return false; - if (IN_SET(qdisc->parent, TC_H_ROOT, TC_H_CLSACT)) /* TC_H_CLSACT == TC_H_INGRESS */ - return true; + /* TC_H_CLSACT == TC_H_INGRESS */ + if (!IN_SET(qdisc->parent, TC_H_ROOT, TC_H_CLSACT) && + link_find_tclass(link, qdisc->parent, NULL) < 0) + return false; + + if (QDISC_VTABLE(qdisc) && + QDISC_VTABLE(qdisc)->is_ready && + QDISC_VTABLE(qdisc)->is_ready(qdisc, link) <= 0) + return false; - return link_find_tclass(link, qdisc->parent, NULL) >= 0; + return true; } static int qdisc_process_request(Request *req, Link *link, QDisc *qdisc) { diff --git a/src/network/tc/qdisc.h b/src/network/tc/qdisc.h index adaaf260c4..155e2adf24 100644 --- a/src/network/tc/qdisc.h +++ b/src/network/tc/qdisc.h @@ -56,6 +56,7 @@ typedef struct QDiscVTable { int (*init)(QDisc *qdisc); int (*fill_message)(Link *link, QDisc *qdisc, sd_netlink_message *m); int (*verify)(QDisc *qdisc); + int (*is_ready)(QDisc *qdisc, Link *link); } QDiscVTable; extern const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX]; |