From patchwork Wed Oct 31 16:19:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leslie Monis X-Patchwork-Id: 991534 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rEuve2Eu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42lYTH6QFSz9s1x for ; Thu, 1 Nov 2018 03:20:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729815AbeKABSn (ORCPT ); Wed, 31 Oct 2018 21:18:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36402 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729287AbeKABSn (ORCPT ); Wed, 31 Oct 2018 21:18:43 -0400 Received: by mail-pg1-f196.google.com with SMTP id z17-v6so7616396pgv.3 for ; Wed, 31 Oct 2018 09:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TqAN3cFCW3Vc/fEYQsjI5YOcX1B5xnqaewBaVa9115k=; b=rEuve2EucXfb2m4yARoYBh0+G1Ue3Oo3bLfEh1FEaCFP0HLzWxO9tD91X9YLIz25Ua Nx1QcV54ugdhinVKAEaZ8MRRVWCZYOZunOO3ZE6vQbqA7m65+GTEimRRBQZVBZbtuDE+ 4BW2mrR4sdMaaaVvwOhraq6OvVZ0lAaAouQPPubYHL7CaTBZB9senI4A2hJWUYXlY+px sjHXq046RAV5M3AwCoGf3PQOOUwMnKLPglZCD2jpI2aluXOdtJzjlORpTO0Qbu9bbs94 8FL9zDFYuHGRkFZ8DMxa7XOKnmL1fFWe3G1oCDbBVUQ9BIIBvQ1faJeMkQRJJyydFjNG VuVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TqAN3cFCW3Vc/fEYQsjI5YOcX1B5xnqaewBaVa9115k=; b=U45ZEUumGGx+Zcdi5mVyecKF0Q9icsRWYP9hhPz0TIq+V6mqXYfutY5IIhyTvjk8IV 9loGmqcu+3zgeJRW3SejJV8Yv7Wrc5g3g/scKzMMpEjfwbneTiEbSQExVVOz+vedDAWu YewQWO8emhrhHlxRI0vrvx+uMxA+qFzNJ7QUeKoYLKQ025kVQo5USZJWOwnWPSl8ufPt s8nw2qBJU2lWINpRAiFz0MUR/yaUhhobz95v5/b9O73i7cme3qskYg5OhNaH8llv0NLb /x7BQxYVqDwjVQVWc/6DnMh+uuvAgmFJ1OdNS4XZVt9kYC/0XmOODMjOx+FGFbMMXmlN JWvw== X-Gm-Message-State: AGRZ1gLrIfMtAoaXc/VkqziaHTojbkpyaeTI9c2U4RQAeqIKAaMpD0Yy W1Jyaf5wJzYFIGLe5ZpJUT4= X-Google-Smtp-Source: AJdET5dX/8x/d+OFicoRSqmoAwRjENSCQznB2KDv3VE6DP+wP7eTlYO6z6dcd1n8VuAw/zcCJ8e7eQ== X-Received: by 2002:a63:584a:: with SMTP id i10-v6mr3832540pgm.178.1541002801749; Wed, 31 Oct 2018 09:20:01 -0700 (PDT) Received: from Inspiron.nitk.ac.in ([106.193.104.195]) by smtp.gmail.com with ESMTPSA id i21-v6sm33812969pgj.55.2018.10.31.09.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Oct 2018 09:20:01 -0700 (PDT) From: Leslie Monis To: jhs@mojatatu.com Cc: netdev@vger.kernel.org, tahiliani@nitk.edu.in, dhavaljkhandla26@gmail.com, hrishihiraskar@gmail.com, bmanish15597@gmail.com, sdp.sachin@gmail.com Subject: [PATCH net-next 6/8] net: sched: pie: add mechanism to set PIE active/inactive Date: Wed, 31 Oct 2018 21:49:30 +0530 Message-Id: <1541002772-28040-7-git-send-email-lesliemonis@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541002772-28040-1-git-send-email-lesliemonis@gmail.com> References: <1541002772-28040-1-git-send-email-lesliemonis@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: "Mohit P. Tahiliani" To overcome unnecessary packet drops due to a spurious uptick in queuing latency caused by fluctuations in a network, PIE can choose to be active only when the queue occupancy is over a certain threshold. RFC 8033 suggests the value of this threshold be 1/3 of the tail drop threshold. PIE becomes inactive when the congestion ends i.e., when the drop probability reaches 0, and the current and previous latency samples are all below half of the target queue delay. Signed-off-by: Mohit P. Tahiliani Signed-off-by: Dhaval Khandla Signed-off-by: Hrishikesh Hiraskar Signed-off-by: Manish Kumar B Signed-off-by: Sachin D. Patil Signed-off-by: Leslie Monis --- net/sched/sch_pie.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index c84e91e..b68b367 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c @@ -57,6 +57,7 @@ struct pie_vars { psched_time_t dq_tstamp; /* drain rate */ u32 avg_dq_rate; /* bytes per pschedtime tick,scaled */ u32 qlen_old; /* in bytes */ + bool active; /* inactive/active */ }; /* statistics gathering */ @@ -94,6 +95,7 @@ static void pie_vars_init(struct pie_vars *vars) vars->avg_dq_rate = 0; /* default of 150 ms in pschedtime */ vars->burst_time = PSCHED_NS2TICKS(150 * NSEC_PER_MSEC); + vars->active = true; } static bool drop_early(struct Qdisc *sch, u32 packet_size) @@ -141,12 +143,23 @@ static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct pie_sched_data *q = qdisc_priv(sch); bool enqueue = false; + if (!q->vars.active && qdisc_qlen(sch) >= sch->limit / 3) { + /* If the queue occupancy is over 1/3 of the tail drop + * threshold, turn on PIE. + */ + pie_vars_init(&q->vars); + q->vars.prob = 0; + q->vars.qdelay_old = 0; + q->vars.dq_count = 0; + q->vars.dq_tstamp = psched_get_time(); + } + if (unlikely(qdisc_qlen(sch) >= sch->limit)) { q->stats.overlimit++; goto out; } - if (!drop_early(sch, skb->len)) { + if (!q->vars.active || !drop_early(sch, skb->len)) { enqueue = true; } else if (q->params.ecn && (q->vars.prob <= MAX_PROB / 10) && INET_ECN_set_ce(skb)) { @@ -431,7 +444,7 @@ static void calculate_probability(struct Qdisc *sch) q->vars.qdelay = qdelay; q->vars.qlen_old = qlen; - /* We restart the measurement cycle if the following conditions are met + /* We turn off PIE if the following conditions are met * 1. If the delay has been low for 2 consecutive Tupdate periods * 2. Calculated drop probability is zero * 3. We have atleast one estimate for the avg_dq_rate ie., @@ -441,7 +454,7 @@ static void calculate_probability(struct Qdisc *sch) (q->vars.qdelay_old < q->params.target / 2) && q->vars.prob == 0 && q->vars.avg_dq_rate > 0) - pie_vars_init(&q->vars); + q->vars.active = false; } static void pie_timer(struct timer_list *t) @@ -451,7 +464,8 @@ static void pie_timer(struct timer_list *t) spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); spin_lock(root_lock); - calculate_probability(sch); + if (q->vars.active) + calculate_probability(sch); /* reset the timer to fire after 'tupdate'. tupdate is in jiffies. */ if (q->params.tupdate)