1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00

network/qdisc: introduce is_ready() in qdisc vtable

Preparation for next commit.
This commit is contained in:
Yu Watanabe 2022-08-06 12:16:56 +09:00
parent 78fa2f91d2
commit 21261ea231
2 changed files with 11 additions and 3 deletions

View File

@ -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;
return link_find_tclass(link, qdisc->parent, NULL) >= 0;
if (QDISC_VTABLE(qdisc) &&
QDISC_VTABLE(qdisc)->is_ready &&
QDISC_VTABLE(qdisc)->is_ready(qdisc, link) <= 0)
return false;
return true;
}
static int qdisc_process_request(Request *req, Link *link, QDisc *qdisc) {

View File

@ -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];