From patchwork Tue Aug 15 13:40:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 801603 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.b="EjYeuZwB"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xWv0r5PXHz9t32 for ; Tue, 15 Aug 2017 23:47:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751427AbdHONrG (ORCPT ); Tue, 15 Aug 2017 09:47:06 -0400 Received: from forwardcorp1g.cmail.yandex.net ([87.250.241.190]:38428 "EHLO forwardcorp1g.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750827AbdHONrF (ORCPT ); Tue, 15 Aug 2017 09:47:05 -0400 Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:10]) by forwardcorp1g.cmail.yandex.net (Yandex) with ESMTP id 5551520EC2; Tue, 15 Aug 2017 16:40:07 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtpcorp1p.mail.yandex.net (Yandex) with ESMTP id 53CD16E40DA9; Tue, 15 Aug 2017 16:40:07 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:40c:e089:6c68:90e2:42d5]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id W40BXkprm5-e6UGq2cR; Tue, 15 Aug 2017 16:40:06 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1502804407; bh=XNBiMyJqp5999j6gwtd9DNW0xB8Ocw5K+gwA3TkvJWc=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References; b=EjYeuZwBz9Hd2WhqOG4LiVtIilm6I6VgEgNTB8SCBiIeKySA4/xucbljJaejhATQK HhAcvMhV0Sj4iw/8BBTuk59DaizWve0BzWgLx/8FKF6a2jFtHYoPkTbo++PzmAU5G+ qRLPO2Thy7Im+J+bgveUyyIzVYo9BclAQZkQePUw= Authentication-Results: smtpcorp1p.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 2/2] net_sched/hfsc: opencode trivial set_active() and set_passive() From: Konstantin Khlebnikov To: netdev@vger.kernel.org, "David S. Miller" , Cong Wang Cc: Jiri Kosina , Eric Dumazet , Jamal Hadi Salim Date: Tue, 15 Aug 2017 16:40:03 +0300 Message-ID: <150280440342.717891.16424904669818880087.stgit@buzz> In-Reply-To: <150280439968.717891.6476652519937001709.stgit@buzz> References: <150280439968.717891.6476652519937001709.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Any move comment abount update_vf() into right place. Signed-off-by: Konstantin Khlebnikov --- net/sched/sch_hfsc.c | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 14c99870cdb6..15f09cb9f1ff 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -829,28 +829,6 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time) } } -static void -set_active(struct hfsc_class *cl, unsigned int len) -{ - if (cl->cl_flags & HFSC_RSC) - init_ed(cl, len); - if (cl->cl_flags & HFSC_FSC) - init_vf(cl, len); - -} - -static void -set_passive(struct hfsc_class *cl) -{ - if (cl->cl_flags & HFSC_RSC) - eltree_remove(cl); - - /* - * vttree is now handled in update_vf() so that update_vf(cl, 0, 0) - * needs to be called explicitly to remove a class from vttree. - */ -} - static unsigned int qdisc_peek_len(struct Qdisc *sch) { @@ -1221,8 +1199,12 @@ hfsc_qlen_notify(struct Qdisc *sch, unsigned long arg) { struct hfsc_class *cl = (struct hfsc_class *)arg; + /* vttree is now handled in update_vf() so that update_vf(cl, 0, 0) + * needs to be called explicitly to remove a class from vttree. + */ update_vf(cl, 0, 0); - set_passive(cl); + if (cl->cl_flags & HFSC_RSC) + eltree_remove(cl); } static unsigned long @@ -1583,7 +1565,12 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) } if (cl->qdisc->q.qlen == 1) { - set_active(cl, qdisc_pkt_len(skb)); + unsigned int len = qdisc_pkt_len(skb); + + if (cl->cl_flags & HFSC_RSC) + init_ed(cl, len); + if (cl->cl_flags & HFSC_FSC) + init_vf(cl, len); /* * If this is the first packet, isolate the head so an eventual * head drop before the first dequeue operation has no chance @@ -1647,18 +1634,18 @@ hfsc_dequeue(struct Qdisc *sch) if (realtime) cl->cl_cumul += qdisc_pkt_len(skb); - if (cl->qdisc->q.qlen != 0) { - if (cl->cl_flags & HFSC_RSC) { + if (cl->cl_flags & HFSC_RSC) { + if (cl->qdisc->q.qlen != 0) { /* update ed */ next_len = qdisc_peek_len(cl->qdisc); if (realtime) update_ed(cl, next_len); else update_d(cl, next_len); + } else { + /* the class becomes passive */ + eltree_remove(cl); } - } else { - /* the class becomes passive */ - set_passive(cl); } qdisc_bstats_update(sch, skb);