From patchwork Wed Apr 30 16:41:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 344213 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 4E63B14007F for ; Thu, 1 May 2014 02:41:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964947AbaD3Qlp (ORCPT ); Wed, 30 Apr 2014 12:41:45 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:63212 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964913AbaD3Qlo (ORCPT ); Wed, 30 Apr 2014 12:41:44 -0400 Received: by mail-ob0-f172.google.com with SMTP id wo20so2277071obc.17 for ; Wed, 30 Apr 2014 09:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=HnnZSivRWExjC5IriKAYGZgFdbikSdo6BV2wWxO6HFo=; b=UQzjNI2oKyyejlY2sAJ0bGVHzsifiHm2O/TUFvgC+6LBlVDtxPvHL7MKxqnPQ4Fhz/ ZNJ2qbjCTpdiucv1Rt/dE8huyB/K8m+rL5M5autliw/qqGTR9AdDAmtf7qPoEhOH05Qj egCv/mxeHQIJn9tKWtsmgEuCVgMkjM3aNMz/0HPpMeaCCgLz/Ux0WNFAB6TWQe0l0H0k c1OzsboqZbxgbZfYRwc7BC9OwxeVZDwfijT79KDYDTIhuoaack8p+lwbnmKFfBCbP7BP qZNfbP9PLYq9rZ32FecLt1f242WQ5N6pGfoJxAJFpgZ1zTNGuTV4Jrk43cbDTxwtGE4+ aJ4w== X-Received: by 10.182.225.163 with SMTP id rl3mr2268158obc.79.1398876103699; Wed, 30 Apr 2014 09:41:43 -0700 (PDT) Received: from nitbit.x32 ([72.168.129.162]) by mx.google.com with ESMTPSA id cq1sm103866557oeb.4.2014.04.30.09.41.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 30 Apr 2014 09:41:42 -0700 (PDT) X-Google-Original-From: John Fastabend Subject: [RFC PATCH 15/15] net: sched: drop ingress qdisc lock To: xiyou.wangcong@gmail.com, jhs@mojatatu.com From: John Fastabend Cc: netdev@vger.kernel.org, davem@davemloft.net, eric.dumazet@gmail.com Date: Wed, 30 Apr 2014 09:41:24 -0700 Message-ID: <20140430164123.9021.69351.stgit@nitbit.x32> In-Reply-To: <20140430163250.9021.21199.stgit@nitbit.x32> References: <20140430163250.9021.21199.stgit@nitbit.x32> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org After the previous patches to make the filters RCU safe and support per cpu counters we can drop the qdisc lock around the ingress qdisc hook. This is possible because the ingress qdisc is a very basic qdisc and only updates stats and runs tc_classify. Its the simplest qdiscs we have. In order for the per-cpu counters to get invoked the ingress qdisc must set the LLQDISC flag. Signed-off-by: John Fastabend --- net/core/dev.c | 2 -- net/sched/sch_ingress.c | 6 ++++++ 2 files changed, 6 insertions(+), 2 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 diff --git a/net/core/dev.c b/net/core/dev.c index 5d88a89..a7eb8aa 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3444,10 +3444,8 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq) q = rcu_dereference(rxq->qdisc); if (q != &noop_qdisc) { - spin_lock(qdisc_lock(q)); if (likely(!test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) result = qdisc_enqueue_root(skb, q); - spin_unlock(qdisc_lock(q)); } return result; diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 2423d7b..a81b333 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -88,6 +88,11 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch) } /* ------------------------------------------------------------- */ +static int ingress_init(struct Qdisc *sch, struct nlattr *opt) +{ + sch->flags |= TCQ_F_LLQDISC; + return 0; +} static void ingress_destroy(struct Qdisc *sch) { @@ -122,6 +127,7 @@ static const struct Qdisc_class_ops ingress_class_ops = { }; static struct Qdisc_ops ingress_qdisc_ops __read_mostly = { + .init = ingress_init, .cl_ops = &ingress_class_ops, .id = "ingress", .priv_size = sizeof(struct ingress_qdisc_data),