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, Neil Horman <nhorman@tuxdriver.com>,
	davem@davemloft.net
Subject: Re: [PATCH net-next] sctp: uncork the old asoc before changing to the new one
Date: Tue, 20 Jun 2017 12:43:03 -0300	[thread overview]
Message-ID: <20170620154303.GB18138@localhost.localdomain> (raw)
In-Reply-To: <99205651b831cf7fd7b847f9b5c904fbf57ce416.1497945715.git.lucien.xin@gmail.com>

On Tue, Jun 20, 2017 at 04:01:55PM +0800, Xin Long wrote:
> local_cork is used to decide if it should uncork asoc outq after processing
> some cmds, and it is set when replying or sending msgs. local_cork should
> always have the same value with current asoc q->cork in some way.
> 
> The thing is when changing to a new asoc by cmd SET_ASOC, local_cork may
> not be consistent with the current asoc any more. The cmd seqs can be:
> 
>   SCTP_CMD_UPDATE_ASSOC (asoc)
>   SCTP_CMD_REPLY (asoc)
>   SCTP_CMD_SET_ASOC (new_asoc)
>   SCTP_CMD_DELETE_TCB (new_asoc)
>   SCTP_CMD_SET_ASOC (asoc)
>   SCTP_CMD_REPLY (asoc)
> 
> The 1st REPLY makes OLD asoc q->cork and local_cork both are 1, and the cmd
> DELETE_TCB clears NEW asoc q->cork and local_cork. After asoc goes back to
> OLD asoc, q->cork is still 1 while local_cork is 0. The 2nd REPLY will not
> set local_cork because q->cork is already set and it can't be uncorked and
> sent out because of this.
> 
> To keep local_cork consistent with the current asoc q->cork, this patch is
> to uncork the old asoc if local_cork is set before changing to the new one.
> 
> Note that the above cmd seqs will be used in the next patch when updating
> asoc and handling errors in it.
> 
> Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

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

> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/sm_sideeffect.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
> index 25384fa..7623566 100644
> --- a/net/sctp/sm_sideeffect.c
> +++ b/net/sctp/sm_sideeffect.c
> @@ -1748,6 +1748,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
>  			break;
>  
>  		case SCTP_CMD_SET_ASOC:
> +			if (asoc && local_cork) {
> +				sctp_outq_uncork(&asoc->outqueue, gfp);
> +				local_cork = 0;
> +			}
>  			asoc = cmd->obj.asoc;
>  			break;
>  
> -- 
> 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
> 

  reply	other threads:[~2017-06-20 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  8:01 [PATCH net-next] sctp: uncork the old asoc before changing to the new one Xin Long
2017-06-20 15:43 ` Marcelo Ricardo Leitner [this message]
2017-06-20 19:01 ` Neil Horman
2017-06-20 19:33 ` 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=20170620154303.GB18138@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).