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 <davem@davemloft.net>
Subject: Re: [PATCHv3 net-next 2/7] sctp: add support for generating stream reconf ssn reset request chunk
Date: Tue, 17 Jan 2017 13:20:26 +0000	[thread overview]
Message-ID: <20170117132026.GI3781@localhost.localdomain> (raw)
In-Reply-To: <CADvbK_dE6h1JQAKytA332jLKiW2UA9+A3QQKdO-e-hExgJ=NQw@mail.gmail.com>

On Tue, Jan 17, 2017 at 12:27:48PM +0800, Xin Long wrote:
> On Mon, Jan 16, 2017 at 11:56 AM, Xin Long <lucien.xin@gmail.com> wrote:
> > On Sun, Jan 15, 2017 at 11:51 PM, Marcelo Ricardo Leitner
> > <marcelo.leitner@gmail.com> wrote:
> >> On Sat, Jan 14, 2017 at 03:15:36AM +0800, Xin Long wrote:
> >>> This patch is to add asoc strreset_outseq and strreset_inseq for
> >>> saving the reconf request sequence, initialize them when create
> >>> assoc and process init, and also to define Incoming and Outgoing
> >>> SSN Reset Request Parameter described in rfc6525 section 4.1 and
> >>> 4.2, As they can be in one same chunk as section rfc6525 3.1-3
> >>> describes, it makes them in one function.
> >>>
> >>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> >>> ---
> >>>  include/linux/sctp.h       | 26 ++++++++++++++
> >>>  include/net/sctp/sm.h      |  5 ++-
> >>>  include/net/sctp/structs.h |  3 ++
> >>>  net/sctp/associola.c       |  1 +
> >>>  net/sctp/sm_make_chunk.c   | 88 ++++++++++++++++++++++++++++++++++++++++++++++
> >>>  5 files changed, 122 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> >>> index cdc3b05..d5da19c 100644
> >>> --- a/include/linux/sctp.h
> >>> +++ b/include/linux/sctp.h
> >>> @@ -200,6 +200,13 @@ typedef enum {
> >>>       SCTP_PARAM_SUCCESS_REPORT       = cpu_to_be16(0xc005),
> >>>       SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
> >>>
> >>> +     /* RE-CONFIG. Section 4 */
> >>> +     SCTP_PARAM_RESET_OUT_REQUEST            = cpu_to_be16(0x000d),
> >>> +     SCTP_PARAM_RESET_IN_REQUEST             = cpu_to_be16(0x000e),
> >>> +     SCTP_PARAM_RESET_TSN_REQUEST            = cpu_to_be16(0x000f),
> >>> +     SCTP_PARAM_RESET_RESPONSE               = cpu_to_be16(0x0010),
> >>> +     SCTP_PARAM_RESET_ADD_OUT_STREAMS        = cpu_to_be16(0x0011),
> >>> +     SCTP_PARAM_RESET_ADD_IN_STREAMS         = cpu_to_be16(0x0012),
> >>>  } sctp_param_t; /* enum */
> >>>
> >>>
> >>> @@ -716,4 +723,23 @@ struct sctp_reconf_chunk {
> >>>       __u8 params[0];
> >>>  } __packed;
> >>>
> >>> +struct sctp_strreset_req {
> >>> +     sctp_paramhdr_t param_hdr;
> >>> +     __u32 request_seq;
> >>> +} __packed;
> >>> +
> >>> +struct sctp_strreset_outreq {
> >>> +     sctp_paramhdr_t param_hdr;
> >>> +     __u32 request_seq;
> >>
> >> This should be:
> >> +       struct sctp_strreset_req strreset_req;
> >> Use the definition you created above for the encapsulation and make the
> >> embedding evident.
> >> Like it's done for sctp_chunkhdr_t.
> > I'm not sure if it's good to do it like sctp_chunkhdr_t.
> >
> > As sctp_chunkhdr is a very common data:
> > Chunk Type  | Chunk  Flags  |  Chunk Length
> > and the next must be "Chunk Value"
> >
> > But here sctp_strreset_req is more used to access
> > the request_seq of the params in asoc->strreset_chunk
> > without knowing params' type. like in sctp_chunk_lookup_strreset_param()

Exactly.

> > and sctp_process_strreset_resp() [see it from the big patchset].
> >
> > struct sctp_strreset_outreq {
> >         sctp_paramhdr_t param_hdr;
> >         __u32 request_seq;
> >         ------------------------------------[1]
> >         __u32 response_seq;
> >         __u32 send_reset_at_tsn;
> >         __u16 list_of_streams[0];
> > } __packed;
> >
> > it seems not good to split it by [1].
> >         __u32 request_seq;
> >         __u32 response_seq;
> >         __u32 send_reset_at_tsn;
> >         __u16 list_of_streams[0];
> > these should to together and equal.
> >
> > what do you think ?
> >
> Hi, Marcelo, I'm planning to drop "struct sctp_strreset_req" so
> that it will not be confusing here, and only introduce it when
> it's used somewhere. agreed ?

Works for me. Then we will check about this part:

from sctp_process_strreset_resp:
+       if (req->param_hdr.type = SCTP_PARAM_RESET_OUT_REQUEST) {
+               struct sctp_strreset_outreq *outreq;
+               __u16 *str_p = NULL;
+
+               outreq = (struct sctp_strreset_outreq *)req;

If the structs could be embedded, such cast would be clearer to be safe.

  Marcelo


  reply	other threads:[~2017-01-17 13:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 19:15 [PATCHv3 net-next 0/7] sctp: add sender-side procedures for stream reconf ssn reset request chunk Xin Long
2017-01-13 19:15 ` [PATCHv3 net-next 1/7] sctp: add a common helper function to generate stream reconf chunk Xin Long
2017-01-13 19:15   ` [PATCHv3 net-next 2/7] sctp: add support for generating stream reconf ssn reset request chunk Xin Long
2017-01-13 19:15     ` [PATCHv3 net-next 3/7] sctp: add stream reconf timer Xin Long
2017-01-13 19:15       ` [PATCHv3 net-next 4/7] sctp: add stream reconf primitive Xin Long
2017-01-13 19:15         ` [PATCHv3 net-next 5/7] sctp: add reconf_enable in asoc ep and netns Xin Long
2017-01-13 19:15           ` [PATCHv3 net-next 6/7] sctp: add sockopt SCTP_ENABLE_STREAM_RESET Xin Long
2017-01-13 19:15             ` [PATCHv3 net-next 7/7] sctp: implement sender-side procedures for SSN Reset Request Parameter Xin Long
2017-01-15 15:51     ` [PATCHv3 net-next 2/7] sctp: add support for generating stream reconf ssn reset request chunk Marcelo Ricardo Leitner
2017-01-16  3:56       ` Xin Long
2017-01-17  4:27         ` Xin Long
2017-01-17 13:20           ` Marcelo Ricardo Leitner [this message]
2017-01-16 18:50   ` [PATCHv3 net-next 1/7] sctp: add a common helper function to generate stream reconf chunk David Miller
2017-01-17  3:41     ` Xin Long

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=20170117132026.GI3781@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).