summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
authord0u9 <d0u9.su@outlook.com>2018-01-15 08:35:50 (GMT)
committerThomas Haller <thaller@redhat.com>2018-01-18 06:51:23 (GMT)
commitca02edd1014234e1260d6d7ff4f51ddb9d6f54f2 (patch)
tree6bf3375b8a5a2d89aaa15403d933c8f82f2ef26b /lib/route
parent2b11ab02ce24476f96c22b18e27f3737559010a2 (diff)
downloadlibnl-ca02edd1014234e1260d6d7ff4f51ddb9d6f54f2.zip
libnl-ca02edd1014234e1260d6d7ff4f51ddb9d6f54f2.tar.gz
libnl-ca02edd1014234e1260d6d7ff4f51ddb9d6f54f2.tar.bz2
Add new function for setting ifindex and parent of a classifier cache.
It is not good to give classifier cache users only one chance to set interface index and parent handle when allocte new cache. Sometimes we want to reuse classifier cache to reduce the overhead of allocating new memory everytime a new cache is created.
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/cls.c18
1 files changed, 18 insertions, 0 deletions
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)