[Patch] tc: add co_groups for tc qdisc and filter

Cong Wang xiyou.wangcong at gmail.com
Fri Jul 11 17:19:03 PDT 2014


Otherwise these tc caches would not be able to be updated
asynchronously.

Cc: Thomas Haller <thaller at redhat.com>
Cc: Thomas Graf <tgraf at suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>

---
diff --git a/include/netlink-private/tc.h b/include/netlink-private/tc.h
index 182adaa..d0cb283 100644
--- a/include/netlink-private/tc.h
+++ b/include/netlink-private/tc.h
@@ -48,6 +48,8 @@ static inline void *tca_xstats(struct rtnl_tc *tca)
 	return tca->tc_xstats->d_data;
 }
 
+extern struct nl_af_group tc_groups[];
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/route/class.c b/lib/route/class.c
index 050f42a..56ad1d8 100644
--- a/lib/route/class.c
+++ b/lib/route/class.c
@@ -453,6 +453,7 @@ static struct nl_cache_ops rtnl_class_ops = {
 					END_OF_MSGTYPES_LIST,
 				  },
 	.co_protocol		= NETLINK_ROUTE,
+	.co_groups		= tc_groups,
 	.co_request_update	= &class_request_update,
 	.co_msg_parser		= &class_msg_parser,
 	.co_obj_ops		= &class_obj_ops,
diff --git a/lib/route/cls.c b/lib/route/cls.c
index b7860c3..649a7d0 100644
--- a/lib/route/cls.c
+++ b/lib/route/cls.c
@@ -411,6 +411,7 @@ static struct nl_cache_ops rtnl_cls_ops = {
 					END_OF_MSGTYPES_LIST,
 				  },
 	.co_protocol		= NETLINK_ROUTE,
+	.co_groups		= tc_groups,
 	.co_request_update	= cls_request_update,
 	.co_msg_parser		= cls_msg_parser,
 	.co_obj_ops		= &cls_obj_ops,
diff --git a/lib/route/qdisc.c b/lib/route/qdisc.c
index 250d191..b8b6fa5 100644
--- a/lib/route/qdisc.c
+++ b/lib/route/qdisc.c
@@ -541,6 +541,7 @@ static struct nl_cache_ops rtnl_qdisc_ops = {
 					END_OF_MSGTYPES_LIST,
 				  },
 	.co_protocol		= NETLINK_ROUTE,
+	.co_groups		= tc_groups,
 	.co_request_update	= qdisc_request_update,
 	.co_msg_parser		= qdisc_msg_parser,
 	.co_obj_ops		= &qdisc_obj_ops,
diff --git a/lib/route/tc.c b/lib/route/tc.c
index 0886e8e..0f150cc 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -1056,6 +1056,12 @@ void *rtnl_tc_data_check(struct rtnl_tc *tc, struct rtnl_tc_ops *ops)
 	return rtnl_tc_data(tc);
 }
 
+struct nl_af_group tc_groups[] = {
+	{ AF_UNSPEC,	RTNLGRP_TC },
+	{ END_OF_GROUP_LIST },
+};
+
+
 void rtnl_tc_type_register(struct rtnl_tc_type_ops *ops)
 {
 	if (ops->tt_type > RTNL_TC_TYPE_MAX)



More information about the libnl mailing list