netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, davem@davemloft.net,
	Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH net 1/3] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune
Date: Mon, 27 Nov 2017 10:26:23 -0200	[thread overview]
Message-ID: <20171127122622.GA3473@localhost.localdomain> (raw)
In-Reply-To: <9c96424d052af79cfcefeec8bc53b6b541c1900f.1511615658.git.lucien.xin@gmail.com>

On Sat, Nov 25, 2017 at 09:18:34PM +0800, Xin Long wrote:
> 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 <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  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);
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2017-11-27 12:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 13:18 [PATCH net 0/3] a couple of fixes for chunks abandoned in prsctp Xin Long
2017-11-25 13:18 ` [PATCH net 1/3] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Xin Long
2017-11-25 13:18   ` [PATCH net 2/3] sctp: abandon the whole msg if one part of a fragmented message is abandoned Xin Long
2017-11-25 13:18     ` [PATCH net 3/3] sctp: do not abandon the other frags in unsent outq if one msg has outstanding frags Xin Long
2017-11-27 12:26       ` Marcelo Ricardo Leitner
2017-11-27 12:26     ` [PATCH net 2/3] sctp: abandon the whole msg if one part of a fragmented message is abandoned Marcelo Ricardo Leitner
2017-11-27 12:26   ` Marcelo Ricardo Leitner [this message]
2017-11-27 13:58 ` [PATCH net 0/3] a couple of fixes for chunks abandoned in prsctp Neil Horman
2017-11-27 19:52 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171127122622.GA3473@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).