From patchwork Wed Apr 27 10:59:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 615553 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 3qvxkC4Fgdz9t6X for ; Wed, 27 Apr 2016 20:57:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=tieto.com header.i=@tieto.com header.b=3uEnwXBf; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753852AbcD0K5V (ORCPT ); Wed, 27 Apr 2016 06:57:21 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34952 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117AbcD0K5T (ORCPT ); Wed, 27 Apr 2016 06:57:19 -0400 Received: by mail-lf0-f47.google.com with SMTP id c126so51764531lfb.2 for ; Wed, 27 Apr 2016 03:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=JHy3CTe7bT+d8kzvDTbDLL0aBQ2CH4EKOYT0/W6L8So=; b=3uEnwXBfakuMFhrw+7YUjn4Tczi18wGVCwexzABOBlkNGWtRJ3lBcyIx+XRbJmBPxL 1Sx5OO56w/GC2C0A9/7tCPzof7cVTI2BxZp7RKcPFBaruxI6MNO6tj8Gyi93bmfDkKBF aiCxi8zRw3JKATMyR5B6f1S7MyO7yHxKgNDyM= 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; bh=JHy3CTe7bT+d8kzvDTbDLL0aBQ2CH4EKOYT0/W6L8So=; b=ZIZ4LK1TLnFv6CifqesAe2NltLRwR0X2/ftAX3uCgAsROZ1TznaYYL5oj6Gq2v5qTC AANQkYMzKuKs0JHQkQzR5Fku+y04hm0bQEe0UkBOqVoCPWGrr9c8RucO2ZORu+/cCtMu +CTJBp+GZYkKk0YRcQrm6hhV0kRf9zC5qf8VCdVOifJWmVh+gCG1ZMlKXgLDMsZqGhbM 64TMZ6I4R5O4VmHA84swSasShlRcLqXlfn52apn4ZmGFIHZibIvU8I+sieh0rK4h4OSe 158/qzBQVn/oA+SxxtvCzQTJr6vPuSbeh7RjBrJMGI+C4GVYIS2PQ+FieSeJpKjEJHp4 HaZw== X-Gm-Message-State: AOPr4FXwIh4Oq7FiRWnrdjdhHUz9t8faQz2vVV4XxvbOw0I0CiMSJ3chnmWCQLQ72oHbtKNJ2EgyrXfyRHyEMWoGvipTY7P7dEo5Cub0gJ69ARnp87ZyDvaxB+NR4HjrcJFGlm/dtjjy4Vrbvl349btwHEx2FnWrq6c0spoeaQTynG2YE8DUwiO82D8c X-Received: by 10.25.16.73 with SMTP id f70mr3419031lfi.34.1461754638092; Wed, 27 Apr 2016 03:57:18 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id b4sm670277lfe.35.2016.04.27.03.57.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Apr 2016 03:57:17 -0700 (PDT) From: Michal Kazior To: netdev@vger.kernel.org Cc: davem@davemloft.net, johannes@sipsolutions.net, Michal Kazior Subject: [PATCH] fq: split out backlog update logic Date: Wed, 27 Apr 2016 12:59:13 +0200 Message-Id: <1461754753-18051-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org mac80211 (which will be the first user of the fq.h) recently started to support software A-MSDU aggregation. It glues skbuffs together into a single one so the backlog accounting needs to be more fine-grained. To avoid backlog sorting logic duplication split it up for re-use. Signed-off-by: Michal Kazior --- While preparing a re-spin of fq_codel for mac80211-next/master I've noticed that it's current head has the new software A-MSDU aggregation. I'm aware I just recently submitted fq.h. Sorry for the noise! include/net/fq_impl.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 02eab7c51adb..163f3ed0f05a 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h @@ -120,6 +120,24 @@ static struct fq_flow *fq_flow_classify(struct fq *fq, return flow; } +static void fq_recalc_backlog(struct fq *fq, + struct fq_tin *tin, + struct fq_flow *flow) +{ + struct fq_flow *i; + + if (list_empty(&flow->backlogchain)) + list_add_tail(&flow->backlogchain, &fq->backlogs); + + i = flow; + list_for_each_entry_continue_reverse(i, &fq->backlogs, + backlogchain) + if (i->backlog > flow->backlog) + break; + + list_move(&flow->backlogchain, &i->backlogchain); +} + static void fq_tin_enqueue(struct fq *fq, struct fq_tin *tin, struct sk_buff *skb, @@ -127,7 +145,6 @@ static void fq_tin_enqueue(struct fq *fq, fq_flow_get_default_t get_default_func) { struct fq_flow *flow; - struct fq_flow *i; lockdep_assert_held(&fq->lock); @@ -139,16 +156,7 @@ static void fq_tin_enqueue(struct fq *fq, tin->backlog_packets++; fq->backlog++; - if (list_empty(&flow->backlogchain)) - list_add_tail(&flow->backlogchain, &fq->backlogs); - - i = flow; - list_for_each_entry_continue_reverse(i, &fq->backlogs, - backlogchain) - if (i->backlog > flow->backlog) - break; - - list_move(&flow->backlogchain, &i->backlogchain); + fq_recalc_backlog(fq, tin, flow); if (list_empty(&flow->flowchain)) { flow->deficit = fq->quantum;