From patchwork Sat Nov 5 02:32:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Soltys X-Patchwork-Id: 123809 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 05DADB70BB for ; Sat, 5 Nov 2011 13:33:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753455Ab1KECdI (ORCPT ); Fri, 4 Nov 2011 22:33:08 -0400 Received: from tha.ppgk.com.pl ([77.252.116.179]:13585 "EHLO tha.ppgk.com.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359Ab1KECdH (ORCPT ); Fri, 4 Nov 2011 22:33:07 -0400 Received: from localhost.ppgk.com.pl (localhost [127.0.0.1]) by tha.ppgk.com.pl (Postfix) with ESMTP id 842CE375FA; Sat, 5 Nov 2011 03:33:04 +0100 (CET) X-PPGK-Scanned: amavisd-new 2.6.4 (20090625) at ppgk.com.pl Received: from tha.ppgk.com.pl ([127.0.0.1]) by localhost.ppgk.com.pl (tha.ppgk.com.pl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6fOyBt2kG8op; Sat, 5 Nov 2011 03:33:03 +0100 (CET) Received: from localhost.localdomain (89-68-135-233.dynamic.chello.pl [89.68.135.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by tha.ppgk.com.pl (Postfix) with ESMTPSA id CA00F375E0; Sat, 5 Nov 2011 03:33:03 +0100 (CET) From: Michal Soltys To: kaber@trash.net Cc: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH 01/11] sch_hfsc.c: update_d() fixup Date: Sat, 5 Nov 2011 03:32:47 +0100 Message-Id: <1320460377-8682-2-git-send-email-soltys@ziu.info> X-Mailer: git-send-email 1.7.7.1 In-Reply-To: <1320460377-8682-1-git-send-email-soltys@ziu.info> References: <1320460377-8682-1-git-send-email-soltys@ziu.info> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The deadline time is generated from total rt work + size of the next packet. Now, when a packet gets dequeued by linkshare criterion, we have to update the deadline time to match the new situation (that's the job of update_d()) - but to do that properly, we have to subtract the size of the packet just dequeued, when calling rtsc_min(). This is actually stated in hfsc paper very clearly, but got (probably) missed during altq days (or due to some patch at some point). Signed-off-by: Michal Soltys --- net/sched/sch_hfsc.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 6488e64..261accc 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -650,9 +650,9 @@ update_ed(struct hfsc_class *cl, unsigned int next_len) } static inline void -update_d(struct hfsc_class *cl, unsigned int next_len) +update_d(struct hfsc_class *cl, unsigned int curr_len, unsigned int next_len) { - cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul + next_len); + cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul - curr_len + next_len); } static inline void @@ -1610,7 +1610,7 @@ hfsc_dequeue(struct Qdisc *sch) struct hfsc_class *cl; struct sk_buff *skb; u64 cur_time; - unsigned int next_len; + unsigned int curr_len, next_len; int realtime = 0; if (sch->q.qlen == 0) @@ -1640,14 +1640,16 @@ hfsc_dequeue(struct Qdisc *sch) } skb = qdisc_dequeue_peeked(cl->qdisc); + curr_len = qdisc_pkt_len(skb); + if (skb == NULL) { qdisc_warn_nonwc("HFSC", cl->qdisc); return NULL; } - update_vf(cl, qdisc_pkt_len(skb), cur_time); + update_vf(cl, curr_len, cur_time); if (realtime) - cl->cl_cumul += qdisc_pkt_len(skb); + cl->cl_cumul += curr_len; if (cl->qdisc->q.qlen != 0) { if (cl->cl_flags & HFSC_RSC) { @@ -1656,7 +1658,7 @@ hfsc_dequeue(struct Qdisc *sch) if (realtime) update_ed(cl, next_len); else - update_d(cl, next_len); + update_d(cl, curr_len, next_len); } } else { /* the class becomes passive */