diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-10-26 10:54:33 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-26 10:54:33 (GMT) |
commit | 4c6d1c5dfb4f7e4a9392895f3da709b55c970e02 (patch) | |
tree | 9303851dcc87e2e3f9c25805ccf24f4a543fe23d /lib/route/cls_obj.c | |
parent | b9d965b01b42103389b2a2c0cc3133293447a64d (diff) | |
download | libnl-4c6d1c5dfb4f7e4a9392895f3da709b55c970e02.zip libnl-4c6d1c5dfb4f7e4a9392895f3da709b55c970e02.tar.gz libnl-4c6d1c5dfb4f7e4a9392895f3da709b55c970e02.tar.bz2 |
Unified TC attributes interface
So far all common tc atttributes were accessed via specific functions, i.e.
rtnl_class_set_parent(), rtnl_qdisc_set_parent(), rtnl_cls_set_parent()
which implied a lot of code duplication. Since all tc objects are derived
from struct rtnl_tc and these common attributes are already stored in there
this patch removes all type specific functions and makes rtnl_tc_* attribute
functions public.
rtnl_qdisc_set_parent(qdisc, 10);
becomes:
rtnl_tc_set_parent((struct rtnl_tc *) qdisc, 10);
This patch also adds the following new attributes to tc objects therefore
removing them as tc specific attributes:
- mtu
- mpu
- overhead
This allows for the rate table calculations to be unified as well taking into
account the new kernel behavior to take care of overhead automatically.
Diffstat (limited to 'lib/route/cls_obj.c')
-rw-r--r-- | lib/route/cls_obj.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/lib/route/cls_obj.c b/lib/route/cls_obj.c index c8218c0..dcf97ed 100644 --- a/lib/route/cls_obj.c +++ b/lib/route/cls_obj.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch> */ /** @@ -34,7 +34,7 @@ static void cls_free_data(struct nl_object *obj) struct rtnl_cls *cls = (struct rtnl_cls *) obj; struct rtnl_cls_ops *cops; - tca_free_data((struct rtnl_tca *) cls); + tca_free_data((struct rtnl_tc *) cls); cops = rtnl_cls_lookup_ops(cls); if (cops && cops->co_free_data) @@ -50,7 +50,7 @@ static int cls_clone(struct nl_object *_dst, struct nl_object *_src) struct rtnl_cls_ops *cops; int err; - err = tca_clone((struct rtnl_tca *) dst, (struct rtnl_tca *) src); + err = tca_clone((struct rtnl_tc *) dst, (struct rtnl_tc *) src); if (err < 0) goto errout; @@ -74,7 +74,7 @@ static void cls_dump_line(struct nl_object *obj, struct nl_dump_params *p) struct rtnl_cls *cls = (struct rtnl_cls *) obj; struct rtnl_cls_ops *cops; - tca_dump_line((struct rtnl_tca *) cls, "cls", p); + tca_dump_line((struct rtnl_tc *) cls, "cls", p); nl_dump(p, " prio %u protocol %s", cls->c_prio, nl_ether_proto2str(cls->c_protocol, buf, sizeof(buf))); @@ -91,7 +91,7 @@ static void cls_dump_details(struct nl_object *obj, struct nl_dump_params *p) struct rtnl_cls_ops *cops; cls_dump_line(obj, p); - tca_dump_details((struct rtnl_tca *) cls, p); + tca_dump_details((struct rtnl_tc *) cls, p); cops = rtnl_cls_lookup_ops(cls); if (cops && cops->co_dump[NL_DUMP_DETAILS]) @@ -106,7 +106,7 @@ static void cls_dump_stats(struct nl_object *obj, struct nl_dump_params *p) struct rtnl_cls_ops *cops; cls_dump_details(obj, p); - tca_dump_stats((struct rtnl_tca *) cls, p); + tca_dump_stats((struct rtnl_tc *) cls, p); nl_dump(p, "\n"); cops = rtnl_cls_lookup_ops(cls); @@ -137,37 +137,12 @@ void rtnl_cls_put(struct rtnl_cls *cls) * @{ */ -void rtnl_cls_set_ifindex(struct rtnl_cls *f, int ifindex) -{ - tca_set_ifindex((struct rtnl_tca *) f, ifindex); -} - -int rtnl_cls_get_ifindex(struct rtnl_cls *cls) -{ - return cls->c_ifindex; -} - -void rtnl_cls_set_handle(struct rtnl_cls *f, uint32_t handle) -{ - tca_set_handle((struct rtnl_tca *) f, handle); -} - -void rtnl_cls_set_parent(struct rtnl_cls *f, uint32_t parent) -{ - tca_set_parent((struct rtnl_tca *) f, parent); -} - -uint32_t rtnl_cls_get_parent(struct rtnl_cls *cls) -{ - return cls->c_parent; -} - int rtnl_cls_set_kind(struct rtnl_cls *cls, const char *kind) { if (cls->ce_mask & TCA_ATTR_KIND) return -NLE_EXIST; - tca_set_kind((struct rtnl_tca *) cls, kind); + tca_set_kind((struct rtnl_tc *) cls, kind); /* Force allocation of data */ rtnl_cls_data(cls); |