From: Xin Long
> Sent: 06 January 2017 14:19
> sctp stream reconf, described in RFC 6525, needs a structure to
> save per stream information in assoc, like stream state.
>
> In the future, sctp stream scheduler also needs it to save some
> stream scheduler params and queues.
>
> This patchset is to prepare the stream array in assoc for stream
> reconf. It defines sctp_stream that includes stream arrays inside
> to replace ssnmap.
>
> Note that we use different structures for IN and OUT streams, as
> the members in per OUT stream will get more and more different
> from per IN stream.
...
> /* What is the current SSN number for this stream? */
> -static inline __u16 sctp_ssn_peek(struct sctp_stream *stream, __u16 id)
> -{
> - return stream->ssn[id];
> -}
> +#define sctp_ssn_peek(stream, type, sid) \
> + ((stream)->type[sid].ssn)
>
> /* Return the next SSN number for this stream. */
> -static inline __u16 sctp_ssn_next(struct sctp_stream *stream, __u16 id)
> -{
> - return stream->ssn[id]++;
> -}
> +#define sctp_ssn_next(stream, type, sid) \
> + ((stream)->type[sid].ssn++)
>
> /* Skip over this ssn and all below. */
> -static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id,
> - __u16 ssn)
> -{
> - stream->ssn[id] = ssn+1;
> -}
> -
> +#define sctp_ssn_skip(stream, type, sid, ssn) \
> + ((stream)->type[sid].ssn = ssn + 1)
...
Is there any reason to convert these from inline functions to #defines?
Inline functions give better type checking and are usually preferred.
David