From patchwork Wed Dec 4 14:26:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamal Hadi Salim X-Patchwork-Id: 296521 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 E2BC52C00BA for ; Thu, 5 Dec 2013 01:27:53 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932340Ab3LDO1n (ORCPT ); Wed, 4 Dec 2013 09:27:43 -0500 Received: from mail-ie0-f176.google.com ([209.85.223.176]:43284 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932303Ab3LDO1j (ORCPT ); Wed, 4 Dec 2013 09:27:39 -0500 Received: by mail-ie0-f176.google.com with SMTP id at1so26954918iec.35 for ; Wed, 04 Dec 2013 06:27:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FhURE0bGULyUvAiq5u/xVHjlJihFzLMsfpHmki6qlPI=; b=b00RpEGef9I8smWcSwYZ2I/G0IaS/UUfFsEB5hnlj5KH4ZcxJ/S1KDJAt7FnFW7aBD GRKYABwmaOURJLrE3wszh8NJ5hVw2rvEvFw1X+KjzXoFnimB34dKIY0d2VfM5Arf9rd6 CGSd8OfVjG1GotQKIHlmN6XRaFSQrhxMKUgn37hEmBTuy0Pz0sH3cy3cGoymvr3kEtVY uLLzdWDkjp4LTuNi9wOtiO5TTZo3WnJHz1+mytjAG5/HNUNzuUatZTmd5LRPbR05W+ZE G0D2WN9eEchfTpsu9W9prSKSh0x5kQNoaKpCIztgeqBQqg4MKMUTwD9ZxvMwMPuQfjiy 1AuQ== X-Gm-Message-State: ALoCoQmPHmUF3N52Ki4CJvEzAgnSldnragryrJOWMt+KaSCacqkVSD9zY89sdE8k/9e93X92DgDy X-Received: by 10.42.214.202 with SMTP id hb10mr1519812icb.76.1386167258682; Wed, 04 Dec 2013 06:27:38 -0800 (PST) Received: from minipc.minipc (24-246-6-163.cable.teksavvy.com. [24.246.6.163]) by mx.google.com with ESMTPSA id y10sm4422221igl.4.2013.12.04.06.27.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Dec 2013 06:27:38 -0800 (PST) From: Jamal Hadi Salim To: davem@davemloft.net Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, alexander.h.duyck@intel.com, jhs@mojatatu.com, ebiederm@xmission.com Subject: [PATCH 2/5] net_sched: Default action lookup method for actions Date: Wed, 4 Dec 2013 09:26:53 -0500 Message-Id: <1386167216-30281-3-git-send-email-jhs@mojatatu.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386167216-30281-1-git-send-email-jhs@mojatatu.com> References: <1386167216-30281-1-git-send-email-jhs@mojatatu.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Jamal Hadi Salim --- net/sched/act_api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 618695e..d1a022e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -274,6 +274,9 @@ int tcf_register_action(struct tc_action_ops *act) if (!act->act || !act->dump || !act->cleanup || !act->init) return -EINVAL; + if (!act->lookup) + act->lookup = tcf_hash_search; + write_lock(&act_mod_lock); for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) { if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { @@ -727,8 +730,6 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 portid) a->ops = tc_lookup_action(tb[TCA_ACT_KIND]); if (a->ops == NULL) goto err_free; - if (a->ops->lookup == NULL) - goto err_mod; err = -ENOENT; if (a->ops->lookup(a, index) == 0) goto err_mod;