linux-sctp.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>,
	Vlad Yasevich <vyasevich@gmail.com>,
	davem@davemloft.net
Subject: Re: [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing stre
Date: Thu, 09 Feb 2017 11:23:49 +0000	[thread overview]
Message-ID: <20170209112349.GL3414@localhost.localdomain> (raw)
In-Reply-To: <2664f74a3821c493b1b8beea4bc5c4077e994243.1486573728.git.lucien.xin@gmail.com>

On Thu, Feb 09, 2017 at 01:18:19AM +0800, Xin Long wrote:
> This patch is to define Add Incoming/Outgoing Streams Request
> Parameter described in rfc6525 section 4.5 and 4.6. They can
> be in one same chunk trunk as rfc6525 section 3.1-7 describes,
> so make them in one function.
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

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

> ---
>  include/linux/sctp.h     |  7 +++++++
>  include/net/sctp/sm.h    |  3 +++
>  net/sctp/sm_make_chunk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 56 insertions(+)
> 
> diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> index 71c0d41..b055788 100644
> --- a/include/linux/sctp.h
> +++ b/include/linux/sctp.h
> @@ -742,4 +742,11 @@ struct sctp_strreset_tsnreq {
>  	__u32 request_seq;
>  };
>  
> +struct sctp_strreset_addstrm {
> +	sctp_paramhdr_t param_hdr;
> +	__u32 request_seq;
> +	__u16 number_of_streams;
> +	__u16 reserved;
> +};
> +
>  #endif /* __LINUX_SCTP_H__ */
> diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
> index ac37c17..3675fde 100644
> --- a/include/net/sctp/sm.h
> +++ b/include/net/sctp/sm.h
> @@ -267,6 +267,9 @@ struct sctp_chunk *sctp_make_strreset_req(
>  				bool out, bool in);
>  struct sctp_chunk *sctp_make_strreset_tsnreq(
>  				const struct sctp_association *asoc);
> +struct sctp_chunk *sctp_make_strreset_addstrm(
> +				const struct sctp_association *asoc,
> +				__u16 out, __u16 in);
>  void sctp_chunk_assign_tsn(struct sctp_chunk *);
>  void sctp_chunk_assign_ssn(struct sctp_chunk *);
>  
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 749842a..7f8dbf2 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -3687,3 +3687,49 @@ struct sctp_chunk *sctp_make_strreset_tsnreq(
>  
>  	return retval;
>  }
> +
> +/* RE-CONFIG 4.5/4.6 (ADD STREAM)
> + *   0                   1                   2                   3
> + *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
> + *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> + *  |     Parameter Type = 17       |      Parameter Length = 12    |
> + *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> + *  |          Re-configuration Request Sequence Number             |
> + *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> + *  |      Number of new streams    |         Reserved              |
> + *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> + */
> +struct sctp_chunk *sctp_make_strreset_addstrm(
> +				const struct sctp_association *asoc,
> +				__u16 out, __u16 in)
> +{
> +	struct sctp_strreset_addstrm addstrm;
> +	__u16 size = sizeof(addstrm);
> +	struct sctp_chunk *retval;
> +
> +	retval = sctp_make_reconf(asoc, (!!out + !!in) * size);
> +	if (!retval)
> +		return NULL;
> +
> +	if (out) {
> +		addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_OUT_STREAMS;
> +		addstrm.param_hdr.length = htons(size);
> +		addstrm.number_of_streams = htons(out);
> +		addstrm.request_seq = htonl(asoc->strreset_outseq);
> +		addstrm.reserved = 0;
> +
> +		sctp_addto_chunk(retval, size, &addstrm);
> +	}
> +
> +	if (in) {
> +		addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_IN_STREAMS;
> +		addstrm.param_hdr.length = htons(size);
> +		addstrm.number_of_streams = htons(in);
> +		addstrm.request_seq = htonl(asoc->strreset_outseq + !!out);
> +		addstrm.reserved = 0;
> +
> +		sctp_addto_chunk(retval, size, &addstrm);
> +	}
> +
> +	return retval;
> +}
> -- 
> 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-02-09 11:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 17:18 [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams Xin Long
2017-02-08 17:18 ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Xin Long
2017-02-08 17:18   ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Xin Long
2017-02-08 17:18     ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Xin Long
2017-02-08 17:18       ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Xin Long
2017-02-08 17:18         ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams Xin Long
2017-02-08 17:18           ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Requ Xin Long
2017-02-09 11:24             ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Marcelo Ricardo Leitner
2017-02-09 11:23           ` Marcelo Ricardo Leitner [this message]
2017-02-08 21:48         ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-08 21:50           ` Marcelo Ricardo Leitner
2017-02-09  7:58             ` Xin Long
2017-02-09 11:23         ` Marcelo Ricardo Leitner
2017-02-08 21:57       ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chun Marcelo Ricardo Leitner
2017-02-09  7:56         ` Xin Long
2017-02-08 21:56     ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Marcelo Ricardo Leitner
2017-02-08 21:56   ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Marcelo Ricardo Leitner
2017-02-09 12:30 ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add str Neil Horman
2017-02-09 21:58 ` 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=20170209112349.GL3414@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 \
    --cc=vyasevich@gmail.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).