summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/netlink/route/classifier.h2
-rw-r--r--lib/route/cls.c18
-rw-r--r--libnl-route-3.sym1
3 files changed, 21 insertions, 0 deletions
diff --git a/include/netlink/route/classifier.h b/include/netlink/route/classifier.h
index a8c1179..82a691f 100644
--- a/include/netlink/route/classifier.h
+++ b/include/netlink/route/classifier.h
@@ -27,6 +27,8 @@ extern void rtnl_cls_put(struct rtnl_cls *);
extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t,
struct nl_cache **);
+extern void rtnl_cls_cache_set_tcm_params(struct nl_cache *, int, uint32_t);
+
extern int rtnl_cls_build_add_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int);
diff --git a/lib/route/cls.c b/lib/route/cls.c
index a423b10..2aaabfc 100644
--- a/lib/route/cls.c
+++ b/lib/route/cls.c
@@ -345,6 +345,24 @@ int rtnl_cls_alloc_cache(struct nl_sock *sk, int ifindex, uint32_t parent,
return 0;
}
+/**
+ * Set interface index and parent handle for classifier cache.
+ * @arg cache Pointer to cache
+ * @arg parent Parent qdisc/traffic class class
+ *
+ * Set the interface index and parent handle of a classifier cache.
+ * This is useful for reusing some existed classifier cache to reduce
+ * the overhead introduced by memory allocation.
+ *
+ * @return void.
+ */
+void rtnl_cls_cache_set_tcm_params(struct nl_cache *cache,
+ int ifindex, uint32_t parent)
+{
+ cache->c_iarg1 = ifindex;
+ cache->c_iarg2 = parent;
+}
+
/** @} */
static void cls_dump_line(struct rtnl_tc *tc, struct nl_dump_params *p)
diff --git a/libnl-route-3.sym b/libnl-route-3.sym
index 3cee113..04ff11b 100644
--- a/libnl-route-3.sym
+++ b/libnl-route-3.sym
@@ -151,6 +151,7 @@ global:
rtnl_cls_add;
rtnl_cls_alloc;
rtnl_cls_alloc_cache;
+ rtnl_cls_cache_set_tcm_params;
rtnl_cls_build_add_request;
rtnl_cls_build_change_request;
rtnl_cls_build_delete_request;