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: [PATCHv2 net-next 1/8] sctp: add basic structures and make chunk function for ifwdtsn
Date: Thu, 14 Dec 2017 16:25:36 -0200	[thread overview]
Message-ID: <20171214182536.GI3532@localhost.localdomain> (raw)
In-Reply-To: <3f8811d3daf19089f75ec75afbca8b397680b6e6.1513269224.git.lucien.xin@gmail.com>

On Fri, Dec 15, 2017 at 12:41:25AM +0800, Xin Long wrote:
> sctp_ifwdtsn_skip, sctp_ifwdtsn_hdr and sctp_ifwdtsn_chunk are used to
> define and parse I-FWD TSN chunk format, and sctp_make_ifwdtsn is a
> function to build the chunk.
> 
> The I-FORWARD-TSN Chunk Format is defined in section 2.3.1 of RFC8260.
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

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

> ---
>  include/linux/sctp.h       | 17 +++++++++++++++++
>  include/net/sctp/sm.h      |  3 +++
>  include/net/sctp/structs.h |  1 +
>  net/sctp/sm_make_chunk.c   | 24 ++++++++++++++++++++++++
>  4 files changed, 45 insertions(+)
> 
> diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> index 38e2cf6..b36c766 100644
> --- a/include/linux/sctp.h
> +++ b/include/linux/sctp.h
> @@ -110,6 +110,7 @@ enum sctp_cid {
>  
>  	/* Use hex, as defined in ADDIP sec. 3.1 */
>  	SCTP_CID_ASCONF			= 0xC1,
> +	SCTP_CID_I_FWD_TSN		= 0xC2,
>  	SCTP_CID_ASCONF_ACK		= 0x80,
>  	SCTP_CID_RECONF			= 0x82,
>  }; /* enum */
> @@ -616,6 +617,22 @@ struct sctp_fwdtsn_chunk {
>  	struct sctp_fwdtsn_hdr fwdtsn_hdr;
>  };
>  
> +struct sctp_ifwdtsn_skip {
> +	__be16 stream;
> +	__u8 reserved;
> +	__u8 flags;
> +	__be32 mid;
> +};
> +
> +struct sctp_ifwdtsn_hdr {
> +	__be32 new_cum_tsn;
> +	struct sctp_ifwdtsn_skip skip[0];
> +};
> +
> +struct sctp_ifwdtsn_chunk {
> +	struct sctp_chunkhdr chunk_hdr;
> +	struct sctp_ifwdtsn_hdr fwdtsn_hdr;
> +};
>  
>  /* ADDIP
>   * Section 3.1.1 Address Configuration Change Chunk (ASCONF)
> diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
> index 0993b49..2883c43 100644
> --- a/include/net/sctp/sm.h
> +++ b/include/net/sctp/sm.h
> @@ -199,6 +199,9 @@ struct sctp_chunk *sctp_make_cwr(const struct sctp_association *asoc,
>  				 const struct sctp_chunk *chunk);
>  struct sctp_chunk *sctp_make_idata(const struct sctp_association *asoc,
>  				   __u8 flags, int paylen, gfp_t gfp);
> +struct sctp_chunk *sctp_make_ifwdtsn(const struct sctp_association *asoc,
> +				     __u32 new_cum_tsn, size_t nstreams,
> +				     struct sctp_ifwdtsn_skip *skiplist);
>  struct sctp_chunk *sctp_make_datafrag_empty(const struct sctp_association *asoc,
>  					    const struct sctp_sndrcvinfo *sinfo,
>  					    int len, __u8 flags, gfp_t gfp);
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 8ef638d..a5c3cf4 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -599,6 +599,7 @@ struct sctp_chunk {
>  		struct sctp_fwdtsn_hdr *fwdtsn_hdr;
>  		struct sctp_authhdr *auth_hdr;
>  		struct sctp_idatahdr *idata_hdr;
> +		struct sctp_ifwdtsn_hdr *ifwdtsn_hdr;
>  	} subh;
>  
>  	__u8 *chunk_end;
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 23a7313..b9b269c 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -3536,6 +3536,30 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
>  	return retval;
>  }
>  
> +struct sctp_chunk *sctp_make_ifwdtsn(const struct sctp_association *asoc,
> +				     __u32 new_cum_tsn, size_t nstreams,
> +				     struct sctp_ifwdtsn_skip *skiplist)
> +{
> +	struct sctp_chunk *retval = NULL;
> +	struct sctp_ifwdtsn_hdr ftsn_hdr;
> +	size_t hint;
> +
> +	hint = (nstreams + 1) * sizeof(__u32);
> +
> +	retval = sctp_make_control(asoc, SCTP_CID_I_FWD_TSN, 0, hint,
> +				   GFP_ATOMIC);
> +	if (!retval)
> +		return NULL;
> +
> +	ftsn_hdr.new_cum_tsn = htonl(new_cum_tsn);
> +	retval->subh.ifwdtsn_hdr =
> +		sctp_addto_chunk(retval, sizeof(ftsn_hdr), &ftsn_hdr);
> +
> +	sctp_addto_chunk(retval, nstreams * sizeof(skiplist[0]), skiplist);
> +
> +	return retval;
> +}
> +
>  /* RE-CONFIG 3.1 (RE-CONFIG chunk)
>   *   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
> -- 
> 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-12-14 18:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 16:41 [PATCHv2 net-next 0/8] sctp: Implement Stream Interleave: Interaction with Other SCTP Extensions Xin Long
2017-12-14 16:41 ` [PATCHv2 net-next 1/8] sctp: add basic structures and make chunk function for ifwdtsn Xin Long
2017-12-14 18:25   ` Marcelo Ricardo Leitner [this message]
2017-12-14 16:41 ` [PATCHv2 net-next 2/8] sctp: implement generate_ftsn for sctp_stream_interleave Xin Long
2017-12-14 18:25   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 3/8] sctp: implement validate_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 4/8] sctp: implement report_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 5/8] sctp: implement handle_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 6/8] sctp: add stream interleave support in stream scheduler Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 7/8] sctp: update mid instead of ssn when doing stream and asoc reset Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 8/8] sctp: support sysctl to allow users to use stream interleave Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 19:58 ` [PATCHv2 net-next 0/8] sctp: Implement Stream Interleave: Interaction with Other SCTP Extensions Neil Horman
2017-12-15 18:53 ` 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=20171214182536.GI3532@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).