From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Oleg Babin <obabin@virtuozzo.com>
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Vlad Yasevich <vyasevich@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>,
Xin Long <lucien.xin@gmail.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>
Subject: Re: [PATCH net-next 1/2] net/sctp: Make wrappers for accessing in/out streams
Date: Mon, 23 Apr 2018 18:33:31 -0300 [thread overview]
Message-ID: <20180423213331.GH3711@localhost.localdomain> (raw)
In-Reply-To: <1524508866-317485-2-git-send-email-obabin@virtuozzo.com>
On Mon, Apr 23, 2018 at 09:41:05PM +0300, Oleg Babin wrote:
> This patch introduces wrappers for accessing in/out streams indirectly.
> This will enable to replace physically contiguous memory arrays
> of streams with flexible arrays (or maybe any other appropriate
> mechanism) which do memory allocation on a per-page basis.
>
> Signed-off-by: Oleg Babin <obabin@virtuozzo.com>
> ---
> include/net/sctp/structs.h | 30 +++++++-----
> net/sctp/chunk.c | 6 ++-
> net/sctp/outqueue.c | 11 +++--
> net/sctp/socket.c | 4 +-
> net/sctp/stream.c | 107 +++++++++++++++++++++++++------------------
> net/sctp/stream_interleave.c | 2 +-
> net/sctp/stream_sched.c | 13 +++---
> net/sctp/stream_sched_prio.c | 22 ++++-----
> net/sctp/stream_sched_rr.c | 8 ++--
> 9 files changed, 116 insertions(+), 87 deletions(-)
>
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index a0ec462..578bb40 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -394,37 +394,37 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
>
> /* What is the current SSN number for this stream? */
> #define sctp_ssn_peek(stream, type, sid) \
> - ((stream)->type[sid].ssn)
> + (sctp_stream_##type##_ptr((stream), (sid))->ssn)
>
> /* Return the next SSN number for this stream. */
> #define sctp_ssn_next(stream, type, sid) \
> - ((stream)->type[sid].ssn++)
> + (sctp_stream_##type##_ptr((stream), (sid))->ssn++)
>
> /* Skip over this ssn and all below. */
> #define sctp_ssn_skip(stream, type, sid, ssn) \
> - ((stream)->type[sid].ssn = ssn + 1)
> + (sctp_stream_##type##_ptr((stream), (sid))->ssn = ssn + 1)
>
> /* What is the current MID number for this stream? */
> #define sctp_mid_peek(stream, type, sid) \
> - ((stream)->type[sid].mid)
> + (sctp_stream_##type##_ptr((stream), (sid))->mid)
>
> /* Return the next MID number for this stream. */
> #define sctp_mid_next(stream, type, sid) \
> - ((stream)->type[sid].mid++)
> + (sctp_stream_##type##_ptr((stream), (sid))->mid++)
>
> /* Skip over this mid and all below. */
> #define sctp_mid_skip(stream, type, sid, mid) \
> - ((stream)->type[sid].mid = mid + 1)
> + (sctp_stream_##type##_ptr((stream), (sid))->mid = mid + 1)
>
> -#define sctp_stream_in(asoc, sid) (&(asoc)->stream.in[sid])
> +#define sctp_stream_in(asoc, sid) sctp_stream_in_ptr(&(asoc)->stream, (sid))
This will get confusing:
- sctp_stream_in(asoc, sid)
- sctp_stream_in_ptr(stream, sid)
Considering all usages of sctp_stream_in(), seems you can just update
them to do the ->stream deref and keep only the later implementation.
Which then don't need the _ptr suffix.
Marcelo
next prev parent reply other threads:[~2018-04-23 21:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 18:41 [PATCH net-next 0/2] net/sctp: Avoid allocating high order memory with kmalloc() Oleg Babin
2018-04-23 18:41 ` [PATCH net-next 1/2] net/sctp: Make wrappers for accessing in/out streams Oleg Babin
2018-04-23 21:33 ` Marcelo Ricardo Leitner [this message]
2018-04-26 22:19 ` Oleg Babin
2018-04-23 18:41 ` [PATCH net-next 2/2] net/sctp: Replace in/out stream arrays with flex_array Oleg Babin
2018-04-23 21:33 ` [PATCH net-next 0/2] net/sctp: Avoid allocating high order memory with kmalloc() Marcelo Ricardo Leitner
2018-04-26 22:14 ` Oleg Babin
2018-04-26 22:28 ` Marcelo Ricardo Leitner
2018-04-26 22:45 ` Oleg Babin
2018-07-24 15:35 ` Konstantin Khorenko
2018-07-24 17:36 ` Marcelo Ricardo Leitner
2018-08-03 16:21 ` [PATCH v2 " Konstantin Khorenko
2018-08-03 16:21 ` [PATCH v2 1/2] net/sctp: Make wrappers for accessing in/out streams Konstantin Khorenko
2018-08-03 16:41 ` David Laight
2018-08-03 19:50 ` David Miller
2018-08-09 8:39 ` Konstantin Khorenko
2018-08-03 20:40 ` Marcelo Ricardo Leitner
2018-08-09 8:40 ` Konstantin Khorenko
2018-08-03 16:21 ` [PATCH v2 2/2] net/sctp: Replace in/out stream arrays with flex_array Konstantin Khorenko
2018-08-03 16:43 ` [PATCH v2 0/2] net/sctp: Avoid allocating high order memory with kmalloc() David Laight
2018-08-03 20:30 ` Marcelo Ricardo Leitner
2018-08-03 20:56 ` Michael Tuexen
2018-08-06 9:34 ` David Laight
2018-08-08 14:48 ` Marcelo Ricardo Leitner
2018-08-03 23:36 ` Marcelo Ricardo Leitner
2018-08-09 8:43 ` Konstantin Khorenko
2018-08-10 17:03 ` Konstantin Khorenko
2018-08-10 17:11 ` [PATCH v3 " Konstantin Khorenko
2018-08-10 17:11 ` [PATCH v3 1/2] net/sctp: Make wrappers for accessing in/out streams Konstantin Khorenko
2018-08-10 17:11 ` [PATCH v3 2/2] net/sctp: Replace in/out stream arrays with flex_array Konstantin Khorenko
2018-08-11 19:36 ` [PATCH v3 0/2] net/sctp: Avoid allocating high order memory with kmalloc() David Miller
2018-08-10 17:41 ` [PATCH v2 " Marcelo Ricardo Leitner
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=20180423213331.GH3711@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=aryabinin@virtuozzo.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=obabin@virtuozzo.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).