From patchwork Sat Nov 25 13:18:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 841242 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 (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YTYCH0r7"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ykYYS35z6z9s83 for ; Sun, 26 Nov 2017 00:19:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751635AbdKYNSy (ORCPT ); Sat, 25 Nov 2017 08:18:54 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:36942 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbdKYNSx (ORCPT ); Sat, 25 Nov 2017 08:18:53 -0500 Received: by mail-pl0-f68.google.com with SMTP id 61so5869686plf.4; Sat, 25 Nov 2017 05:18:53 -0800 (PST) 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 :in-reply-to:references; bh=I1cYS1o7nZSk47SVGSNtcWFZlMj0wq0TUBU7XqMEA5k=; b=YTYCH0r7P9/9JRcWVmXqUFwslLU++qsWYzptTlYLEW5FqTx28V3O8v7iTQcpF1Xq1o 0U+xiRIxFeZUHjIOsW770NDCFILDwtI4rgTG1LQe0qzIXjzK1nGgb9nn5cnovD4mD7Rq OVaPChTsgsjEqNUX8cU6atwF4YhLptH2DZ+cv+i6Q0UZ0g/BjIUcv59PIa9Fol5QGsR5 zebfKtL7IEGa4mR8yBPyf09fkNa/4w14AHTWTL+jBON+GOAtPMhf8hv900Eh8WLRnjHw CeHwPU+fd3Z5MyotrcEKL6UEga6ORA/YhluFshCLaoPGSBDgZFwrZopDmeyq/A8TVEe+ yqMQ== 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:in-reply-to:references; bh=I1cYS1o7nZSk47SVGSNtcWFZlMj0wq0TUBU7XqMEA5k=; b=QYK4yutIQ/hGsdHj8p0gpJHmt7G31C8QUsbns7XRHAUz+bpV+2BCZYluuourHZ5eBY hZHF7IgJSVPr/PsI+53oEGoosgX9ofk1AOBXYb2GlhqlZF65p0h8KwsVn847q+DW5dLo Fvkz5h0BTPspeDihjrc0PlbIqciXGPGjLazzjbmDuIK31suj8uwQZPkDh0j5ifIL2ih4 P33eElH9xVUUOYnrB7PyXMPxWp4gCvWToWWsdMOL5PXqpGVvCSTBjtiAc7oy2iS6ymb/ RG22D7sypvD01FESShXNWJ6U1Z1GlIhM6a3X4/xr2MBv1BcNZ6/9gdW4ukCKI/U5APNd /x8Q== X-Gm-Message-State: AJaThX4Odr6JIa8nbOPIMGj3+JMSBQd1jixurB54qaV3oBVokeC+fZfX PDqMRrz4ZJqkG+bLN/HqbL2owrcx X-Google-Smtp-Source: AGs4zMY5ckfdQYRkfFbyscH7N27JGj7pdP73ej2ta51HF7DMlasBxDR8kbpkkeADJiQkt7froVtUFw== X-Received: by 10.84.235.136 with SMTP id p8mr31897919plk.263.1511615932720; Sat, 25 Nov 2017 05:18:52 -0800 (PST) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id p72sm7025589pfa.84.2017.11.25.05.18.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Nov 2017 05:18:52 -0800 (PST) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: davem@davemloft.net, Marcelo Ricardo Leitner , Neil Horman Subject: [PATCH net 1/3] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Date: Sat, 25 Nov 2017 21:18:34 +0800 Message-Id: <9c96424d052af79cfcefeec8bc53b6b541c1900f.1511615658.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now outstanding_bytes is only increased when appending chunks into one packet and sending it at 1st time, while decreased when it is about to move into retransmit queue. It means outstanding_bytes value is already decreased for all chunks in retransmit queue. However sctp_prsctp_prune_sent is a common function to check the chunks in both transmitted and retransmit queue, it decrease outstanding_bytes when moving a chunk into abandoned queue from either of them. It could cause outstanding_bytes underflow, as it also decreases it's value for the chunks in retransmit queue. This patch fixes it by only updating outstanding_bytes for transmitted queue when pruning queues for prsctp prio policy, the same fix is also needed in sctp_check_transmitted. Fixes: 8dbdf1f5b09c ("sctp: implement prsctp PRIO policy") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner --- net/sctp/outqueue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 4db012a..7029f8b 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c @@ -377,7 +377,8 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, asoc->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; streamout->ext->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; - if (!chk->tsn_gap_acked) { + if (queue != &asoc->outqueue.retransmit && + !chk->tsn_gap_acked) { if (chk->transport) chk->transport->flight_size -= sctp_data_size(chk); @@ -1434,7 +1435,8 @@ static void sctp_check_transmitted(struct sctp_outq *q, /* If this chunk has not been acked, stop * considering it as 'outstanding'. */ - if (!tchunk->tsn_gap_acked) { + if (transmitted_queue != &q->retransmit && + !tchunk->tsn_gap_acked) { if (tchunk->transport) tchunk->transport->flight_size -= sctp_data_size(tchunk);