mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 05:55:11 +08:00
af0e036c09
When a list of filters at a given block is requested, tc first validates that the block exists before doing the filter query. Currently the validation routine checks ingress and egress blocks. But now that blocks can be bound to qevents as well, qevent blocks should be looked for as well. In order to support that, extend struct qdisc_util with a new callback, has_block. That should report whether, give the attributes in TCA_OPTIONS, a blocks with a given number is bound to a qevent. In tc_qdisc_block_exists_cb(), invoke that callback when set. Add a helper to the tc_qevent module that walks the list of qevents and looks for a given block. This is meant to be used by the individual qdiscs. Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@kernel.org>
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _TC_QEVENT_H_
|
|
#define _TC_QEVENT_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <linux/types.h>
|
|
#include <libnetlink.h>
|
|
|
|
struct qevent_base {
|
|
__u32 block_idx;
|
|
};
|
|
|
|
struct qevent_util {
|
|
const char *id;
|
|
int (*parse_qevent)(struct qevent_util *qu, int *argc, char ***argv);
|
|
int (*read_qevent)(struct qevent_util *qu, struct rtattr **tb);
|
|
void (*print_qevent)(struct qevent_util *qu, FILE *f);
|
|
int (*dump_qevent)(struct qevent_util *qu, struct nlmsghdr *n);
|
|
size_t data_size;
|
|
void *data;
|
|
int attr;
|
|
};
|
|
|
|
#define QEVENT(_name, _form, _data, _attr) \
|
|
{ \
|
|
.id = _name, \
|
|
.parse_qevent = qevent_parse_##_form, \
|
|
.read_qevent = qevent_read_##_form, \
|
|
.print_qevent = qevent_print_##_form, \
|
|
.dump_qevent = qevent_dump_##_form, \
|
|
.data_size = sizeof(struct qevent_##_form), \
|
|
.data = _data, \
|
|
.attr = _attr, \
|
|
}
|
|
|
|
void qevents_init(struct qevent_util *qevents);
|
|
int qevent_parse(struct qevent_util *qevents, int *p_argc, char ***p_argv);
|
|
int qevents_read(struct qevent_util *qevents, struct rtattr **tb);
|
|
int qevents_dump(struct qevent_util *qevents, struct nlmsghdr *n);
|
|
void qevents_print(struct qevent_util *qevents, FILE *f);
|
|
bool qevents_have_block(struct qevent_util *qevents, __u32 block_idx);
|
|
|
|
struct qevent_plain {
|
|
struct qevent_base base;
|
|
};
|
|
int qevent_parse_plain(struct qevent_util *qu, int *p_argc, char ***p_argv);
|
|
int qevent_read_plain(struct qevent_util *qu, struct rtattr **tb);
|
|
void qevent_print_plain(struct qevent_util *qu, FILE *f);
|
|
int qevent_dump_plain(struct qevent_util *qu, struct nlmsghdr *n);
|
|
|
|
#endif
|