linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: mark sctp_do_peeloff static
@ 2025-05-26  5:47 Christoph Hellwig
  2025-05-26 18:25 ` Xin Long
  2025-05-28  1:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-05-26  5:47 UTC (permalink / raw)
  To: marcelo.leitner, lucien.xin
  Cc: davem, edumazet, kuba, pabeni, horms, linux-sctp, netdev

sctp_do_peeloff is only used inside of net/sctp/socket.c,
so mark it static.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/net/sctp/sctp.h | 2 --
 net/sctp/socket.c       | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d8da764cf6de..e96d1bd087f6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -364,8 +364,6 @@ sctp_assoc_to_state(const struct sctp_association *asoc)
 /* Look up the association by its id.  */
 struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
 
-int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
-
 /* A macro to walk a list of skbs.  */
 #define sctp_skb_for_each(pos, head, tmp) \
 	skb_queue_walk_safe(head, pos, tmp)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 53725ee7ba06..da048e386476 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5627,7 +5627,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
 }
 
 /* Helper routine to branch off an association to a new socket.  */
-int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
+static int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id,
+		struct socket **sockp)
 {
 	struct sctp_association *asoc = sctp_id2assoc(sk, id);
 	struct sctp_sock *sp = sctp_sk(sk);
@@ -5675,7 +5676,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
 
 	return err;
 }
-EXPORT_SYMBOL(sctp_do_peeloff);
 
 static int sctp_getsockopt_peeloff_common(struct sock *sk, sctp_peeloff_arg_t *peeloff,
 					  struct file **newfile, unsigned flags)
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] sctp: mark sctp_do_peeloff static
  2025-05-26  5:47 [PATCH] sctp: mark sctp_do_peeloff static Christoph Hellwig
@ 2025-05-26 18:25 ` Xin Long
  2025-05-26 19:38   ` Benjamin Poirier
  2025-05-28  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 6+ messages in thread
From: Xin Long @ 2025-05-26 18:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: marcelo.leitner, davem, edumazet, kuba, pabeni, horms, linux-sctp,
	netdev

On Mon, May 26, 2025 at 1:47 AM Christoph Hellwig <hch@lst.de> wrote:
>
> sctp_do_peeloff is only used inside of net/sctp/socket.c,
> so mark it static.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/net/sctp/sctp.h | 2 --
>  net/sctp/socket.c       | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> index d8da764cf6de..e96d1bd087f6 100644
> --- a/include/net/sctp/sctp.h
> +++ b/include/net/sctp/sctp.h
> @@ -364,8 +364,6 @@ sctp_assoc_to_state(const struct sctp_association *asoc)
>  /* Look up the association by its id.  */
>  struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
>
> -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
> -
>  /* A macro to walk a list of skbs.  */
>  #define sctp_skb_for_each(pos, head, tmp) \
>         skb_queue_walk_safe(head, pos, tmp)
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 53725ee7ba06..da048e386476 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -5627,7 +5627,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
>  }
>
>  /* Helper routine to branch off an association to a new socket.  */
> -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
> +static int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id,
> +               struct socket **sockp)
>  {
>         struct sctp_association *asoc = sctp_id2assoc(sk, id);
>         struct sctp_sock *sp = sctp_sk(sk);
> @@ -5675,7 +5676,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
>
>         return err;
>  }
> -EXPORT_SYMBOL(sctp_do_peeloff);
>
I believe sctp_do_peeloff() was exported specifically to allow usage
outside of the core SCTP code. See:

commit 0343c5543b1d3ffa08e6716d82afb62648b80eba
Author: Benjamin Poirier <benjamin.poirier@gmail.com>
Date:   Thu Mar 8 05:55:58 2012 +0000

    sctp: Export sctp_do_peeloff

While there’s no known in-tree usage beyond SCTP itself, we can’t be
sure whether this function has been used by out-of-tree kernel modules.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sctp: mark sctp_do_peeloff static
  2025-05-26 18:25 ` Xin Long
@ 2025-05-26 19:38   ` Benjamin Poirier
  2025-05-27 14:23     ` Xin Long
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Poirier @ 2025-05-26 19:38 UTC (permalink / raw)
  To: Xin Long
  Cc: Christoph Hellwig, marcelo.leitner, davem, edumazet, kuba, pabeni,
	horms, linux-sctp, netdev

On 2025-05-26 14:25 -0400, Xin Long wrote:
> On Mon, May 26, 2025 at 1:47 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > sctp_do_peeloff is only used inside of net/sctp/socket.c,
> > so mark it static.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  include/net/sctp/sctp.h | 2 --
> >  net/sctp/socket.c       | 4 ++--
> >  2 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> > index d8da764cf6de..e96d1bd087f6 100644
> > --- a/include/net/sctp/sctp.h
> > +++ b/include/net/sctp/sctp.h
> > @@ -364,8 +364,6 @@ sctp_assoc_to_state(const struct sctp_association *asoc)
> >  /* Look up the association by its id.  */
> >  struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
> >
> > -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
> > -
> >  /* A macro to walk a list of skbs.  */
> >  #define sctp_skb_for_each(pos, head, tmp) \
> >         skb_queue_walk_safe(head, pos, tmp)
> > diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> > index 53725ee7ba06..da048e386476 100644
> > --- a/net/sctp/socket.c
> > +++ b/net/sctp/socket.c
> > @@ -5627,7 +5627,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
> >  }
> >
> >  /* Helper routine to branch off an association to a new socket.  */
> > -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
> > +static int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id,
> > +               struct socket **sockp)
> >  {
> >         struct sctp_association *asoc = sctp_id2assoc(sk, id);
> >         struct sctp_sock *sp = sctp_sk(sk);
> > @@ -5675,7 +5676,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
> >
> >         return err;
> >  }
> > -EXPORT_SYMBOL(sctp_do_peeloff);
> >
> I believe sctp_do_peeloff() was exported specifically to allow usage
> outside of the core SCTP code. See:
> 
> commit 0343c5543b1d3ffa08e6716d82afb62648b80eba
> Author: Benjamin Poirier <benjamin.poirier@gmail.com>
> Date:   Thu Mar 8 05:55:58 2012 +0000
> 
>     sctp: Export sctp_do_peeloff
> 

Thanks for digging that up. The purpose was of course for the commit
that followed:
2f2d76cc3e93 dlm: Do not allocate a fd for peeloff (v3.4-rc1)

Since that usage was removed in
ee44b4bc054a dlm: use sctp 1-to-1 API (v4.3-rc1)

I don't see a problem with marking sctp_do_peeloff() static again.

> While there’s no known in-tree usage beyond SCTP itself, we can’t be
> sure whether this function has been used by out-of-tree kernel modules.

The mainline kernel does not need to cater to out-of-tree users.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sctp: mark sctp_do_peeloff static
  2025-05-26 19:38   ` Benjamin Poirier
@ 2025-05-27 14:23     ` Xin Long
  2025-05-28 12:04       ` David Laight
  0 siblings, 1 reply; 6+ messages in thread
From: Xin Long @ 2025-05-27 14:23 UTC (permalink / raw)
  To: Benjamin Poirier
  Cc: Christoph Hellwig, marcelo.leitner, davem, edumazet, kuba, pabeni,
	horms, linux-sctp, netdev

On Mon, May 26, 2025 at 3:38 PM Benjamin Poirier
<benjamin.poirier@gmail.com> wrote:
>
> On 2025-05-26 14:25 -0400, Xin Long wrote:
> > On Mon, May 26, 2025 at 1:47 AM Christoph Hellwig <hch@lst.de> wrote:
> > >
> > > sctp_do_peeloff is only used inside of net/sctp/socket.c,
> > > so mark it static.
> > >
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > > ---
> > >  include/net/sctp/sctp.h | 2 --
> > >  net/sctp/socket.c       | 4 ++--
> > >  2 files changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> > > index d8da764cf6de..e96d1bd087f6 100644
> > > --- a/include/net/sctp/sctp.h
> > > +++ b/include/net/sctp/sctp.h
> > > @@ -364,8 +364,6 @@ sctp_assoc_to_state(const struct sctp_association *asoc)
> > >  /* Look up the association by its id.  */
> > >  struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
> > >
> > > -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
> > > -
> > >  /* A macro to walk a list of skbs.  */
> > >  #define sctp_skb_for_each(pos, head, tmp) \
> > >         skb_queue_walk_safe(head, pos, tmp)
> > > diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> > > index 53725ee7ba06..da048e386476 100644
> > > --- a/net/sctp/socket.c
> > > +++ b/net/sctp/socket.c
> > > @@ -5627,7 +5627,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
> > >  }
> > >
> > >  /* Helper routine to branch off an association to a new socket.  */
> > > -int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
> > > +static int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id,
> > > +               struct socket **sockp)
> > >  {
> > >         struct sctp_association *asoc = sctp_id2assoc(sk, id);
> > >         struct sctp_sock *sp = sctp_sk(sk);
> > > @@ -5675,7 +5676,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
> > >
> > >         return err;
> > >  }
> > > -EXPORT_SYMBOL(sctp_do_peeloff);
> > >
> > I believe sctp_do_peeloff() was exported specifically to allow usage
> > outside of the core SCTP code. See:
> >
> > commit 0343c5543b1d3ffa08e6716d82afb62648b80eba
> > Author: Benjamin Poirier <benjamin.poirier@gmail.com>
> > Date:   Thu Mar 8 05:55:58 2012 +0000
> >
> >     sctp: Export sctp_do_peeloff
> >
>
> Thanks for digging that up. The purpose was of course for the commit
> that followed:
> 2f2d76cc3e93 dlm: Do not allocate a fd for peeloff (v3.4-rc1)
>
> Since that usage was removed in
> ee44b4bc054a dlm: use sctp 1-to-1 API (v4.3-rc1)
>
> I don't see a problem with marking sctp_do_peeloff() static again.
>
> > While there’s no known in-tree usage beyond SCTP itself, we can’t be
> > sure whether this function has been used by out-of-tree kernel modules.
>
> The mainline kernel does not need to cater to out-of-tree users.
Thank you for chiming in.

I didn't know it was exported for the in-tree kernel dlm, and this
patch should be applied to net-next.

Acked-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sctp: mark sctp_do_peeloff static
  2025-05-26  5:47 [PATCH] sctp: mark sctp_do_peeloff static Christoph Hellwig
  2025-05-26 18:25 ` Xin Long
@ 2025-05-28  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-28  1:40 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: marcelo.leitner, lucien.xin, davem, edumazet, kuba, pabeni, horms,
	linux-sctp, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 26 May 2025 07:47:45 +0200 you wrote:
> sctp_do_peeloff is only used inside of net/sctp/socket.c,
> so mark it static.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/net/sctp/sctp.h | 2 --
>  net/sctp/socket.c       | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Here is the summary with links:
  - sctp: mark sctp_do_peeloff static
    https://git.kernel.org/netdev/net-next/c/33f1b3677a13

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sctp: mark sctp_do_peeloff static
  2025-05-27 14:23     ` Xin Long
@ 2025-05-28 12:04       ` David Laight
  0 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2025-05-28 12:04 UTC (permalink / raw)
  To: Xin Long
  Cc: Benjamin Poirier, Christoph Hellwig, marcelo.leitner, davem,
	edumazet, kuba, pabeni, horms, linux-sctp, netdev

On Tue, 27 May 2025 10:23:37 -0400
Xin Long <lucien.xin@gmail.com> wrote:

> On Mon, May 26, 2025 at 3:38 PM Benjamin Poirier
> <benjamin.poirier@gmail.com> wrote:
> >
> > On 2025-05-26 14:25 -0400, Xin Long wrote:  
> > > On Mon, May 26, 2025 at 1:47 AM Christoph Hellwig <hch@lst.de> wrote:  
> > > >
> > > > sctp_do_peeloff is only used inside of net/sctp/socket.c,
> > > > so mark it static.
...

> > I don't see a problem with marking sctp_do_peeloff() static again.
> >  
> > > While there’s no known in-tree usage beyond SCTP itself, we can’t be
> > > sure whether this function has been used by out-of-tree kernel modules.  
> >
> > The mainline kernel does not need to cater to out-of-tree users.  
> Thank you for chiming in.
> 
> I didn't know it was exported for the in-tree kernel dlm, and this
> patch should be applied to net-next.

The most likely module use would be bpf or io_uring.
But they'd probably end up using the sockopt interface (the same
as applications).

Mind you 'peeloff' is all a strange idea that seems (to me) solving
a problem that has nothing at all to do with sctp (as a protocol).
The entire 'many-to-one' seems to be there to avoid the overhead
of a lot of sockets when the data data is low.
I'm sure epoll() solves the actual problem.

	David



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-28 12:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26  5:47 [PATCH] sctp: mark sctp_do_peeloff static Christoph Hellwig
2025-05-26 18:25 ` Xin Long
2025-05-26 19:38   ` Benjamin Poirier
2025-05-27 14:23     ` Xin Long
2025-05-28 12:04       ` David Laight
2025-05-28  1:40 ` patchwork-bot+netdevbpf

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).