From patchwork Fri Aug 6 19:35:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 61135 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 643B4B70A8 for ; Sat, 7 Aug 2010 05:38:29 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761968Ab0HFTiI (ORCPT ); Fri, 6 Aug 2010 15:38:08 -0400 Received: from suva.vyatta.com ([76.74.103.44]:35719 "EHLO suva.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940Ab0HFTiE (ORCPT ); Fri, 6 Aug 2010 15:38:04 -0400 Received: from suva.vyatta.com (suva [127.0.0.1]) by suva.vyatta.com (8.13.7/8.13.7) with ESMTP id o76JbwHk022325; Fri, 6 Aug 2010 12:37:58 -0700 Received: (from shemminger@localhost) by suva.vyatta.com (8.13.7/8.13.7/Submit) id o76Jbwbo022324; Fri, 6 Aug 2010 12:37:58 -0700 Message-Id: <20100806193558.667488554@vyatta.com> User-Agent: quilt/0.48-1 Date: Fri, 06 Aug 2010 12:35:50 -0700 From: Stephen Hemminger To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH 2/9] net classifier: deinline bind/unbind functions References: <20100806193548.007978639@vyatta.com> Content-Disposition: inline; filename=cls-deinline.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The filter bind/unbind functions are not worth inlining. Not performance critical in the least. Signed-off-by: Stephen Hemminger --- include/net/pkt_cls.h | 52 ++------------------------------------------------ net/sched/cls_api.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 49 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/include/net/pkt_cls.h 2010-08-06 12:21:18.000000000 -0700 +++ b/include/net/pkt_cls.h 2010-08-06 12:21:59.736709482 -0700 @@ -16,55 +16,9 @@ struct tcf_walker { extern int register_tcf_proto_ops(struct tcf_proto_ops *ops); extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); - -static inline unsigned long -__cls_set_class(unsigned long *clp, unsigned long cl) -{ - unsigned long old_cl; - - old_cl = *clp; - *clp = cl; - return old_cl; -} - -static inline unsigned long -cls_set_class(struct tcf_proto *tp, unsigned long *clp, - unsigned long cl) -{ - unsigned long old_cl; - - tcf_tree_lock(tp); - old_cl = __cls_set_class(clp, cl); - tcf_tree_unlock(tp); - - return old_cl; -} - -static inline int -tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base) -{ - const struct Qdisc_class_ops *cops = tp->q->ops->cl_ops; - unsigned long cl; - - if (!cops->bind_tcf) - return -EINVAL; - - cl = cops->bind_tcf(tp->q, base, r->classid); - cl = cls_set_class(tp, &r->class, cl); - if (cl) - cops->unbind_tcf(tp->q, cl); - - return 0; -} - -static inline void -tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) -{ - unsigned long cl; - - if ((cl = __cls_set_class(&r->class, 0)) != 0) - tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); -} +extern int tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, + unsigned long base); +extern void tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r); struct tcf_exts { #ifdef CONFIG_NET_CLS_ACT --- a/net/sched/cls_api.c 2010-08-06 12:20:02.000000000 -0700 +++ b/net/sched/cls_api.c 2010-08-06 12:21:21.623261373 -0700 @@ -99,6 +99,56 @@ out: } EXPORT_SYMBOL(unregister_tcf_proto_ops); +static unsigned long __cls_set_class(unsigned long *clp, unsigned long cl) +{ + unsigned long old_cl; + + old_cl = *clp; + *clp = cl; + return old_cl; +} + +static unsigned long cls_set_class(struct tcf_proto *tp, unsigned long *clp, + unsigned long cl) +{ + unsigned long old_cl; + + tcf_tree_lock(tp); + old_cl = __cls_set_class(clp, cl); + tcf_tree_unlock(tp); + + return old_cl; +} + +int tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, + unsigned long base) +{ + const struct Qdisc_class_ops *cops = tp->q->ops->cl_ops; + unsigned long cl; + + if (!cops->bind_tcf) + return -ENOENT; + + cl = cops->bind_tcf(tp->q, base, r->classid); + cl = cls_set_class(tp, &r->class, cl); + if (cl) + cops->unbind_tcf(tp->q, cl); + + return 0; +} +EXPORT_SYMBOL(tcf_bind_filter); + +void tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) +{ + unsigned long cl; + + cl = __cls_set_class(&r->class, 0); + if (cl) + tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); +} +EXPORT_SYMBOL(tcf_unbind_filter); + + static int tfilter_notify(struct net *net, struct sk_buff *oskb, struct nlmsghdr *n, struct tcf_proto *tp, unsigned long fh, int event);