Next: Bind_tcf
Up: Classes
Previous: Walk
The tcf_chain function on a class is used to return the anchor to the list of
filters that are associated to a class. Each class is associated with a filter
list which contains the list of filters that are used to identify the packets
that belong to a particular class. As already mentioned, packets with
different properties may map to the same class. For example, packets from two
different sources may map to the same class. As a result, there may be
multiple filters associated to a class. Filters are discussed in more detail
in the next section. The cbq_find_tcf function in net/sched/sch_cbq.c is
shown below as an example:
static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_class *cl = (struct cbq_class *)arg;
if (cl == NULL)
cl = &q->link;
return &cl->filter_list;
}
The cbq_find_tcf function returns the pointer to the list of filters.
Filters are maintained in a structure named tcf_proto in
include/net/pkt_cls.h. The tcf_chain function is invoked in the
tc_ctl_tfilter function in net/sched/cls_api.c. This function is called
when an attempt is made to create/modify/delete/get a filter node.
Saravanan Radhakrishnan
1999-09-30