sctp: mark sctp_do_peeloff static
Subsystems (3)
PATCH 1/1 sctp: mark sctp_do_peeloff static
sctp_do_peeloff is only used inside of net/sctp/socket.c, so mark it static.
--- include/net/sctp/sctp.h | 2 -- net/sctp/socket.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
include/net/sctp/sctp.h +0 -2
@@ -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)
net/sctp/socket.c +2 -2
@@ -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)
Signature · 1 line
2.47.2
Xin Long
maintainerQuoted 38 lines · Christoph Hellwig
sctp_do_peeloffis only used inside ofnet/sctp/socket.c, so mark it static.Signed-off-by Christoph Hellwig <[email protected]>--- include/net/sctp/sctp.h | 2 -- net/sctp/socket.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)include/net/sctp/sctp.h +0
-2@@ -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)net/sctp/socket.c +2
-1@@ -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);
net/sctp/socket.c int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) · line 5679
Quoted 5 lines
net/sctp/socket.c +0
-1@@ -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 <[email protected]> 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.
Quoted 47 lines · Xin Long
Quoted 38 lines · Christoph Hellwig
sctp_do_peeloffis only used inside ofnet/sctp/socket.c, so mark it static.Signed-off-by Christoph Hellwig <[email protected]>--- include/net/sctp/sctp.h | 2 -- net/sctp/socket.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)include/net/sctp/sctp.h +0
-2@@ -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)net/sctp/socket.c +2
-1@@ -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);net/sctp/socket.c int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) · line 5679
Quoted 5 lines
net/sctp/socket.c +0
-1@@ -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:
Quoted 6 lines
commit
0343c5543b1d3ffa08e6716d82afb62648b80ebaAuthor: Benjamin Poirier <[email protected]> Date: Thu Mar 8 05:55:58 2012 +0000sctp: 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 inee44b4bc054a dlm: use sctp 1-to-1 API (v4.3-rc1)
I don't see a problem with marking sctp_do_peeloff() static again.
Quoted 2 lines
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.
Quoted 63 lines · Benjamin Poirier
Quoted 47 lines · Xin Long
Quoted 38 lines · Christoph Hellwig
sctp_do_peeloffis only used inside ofnet/sctp/socket.c, so mark it static.Signed-off-by Christoph Hellwig <[email protected]>--- include/net/sctp/sctp.h | 2 -- net/sctp/socket.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)include/net/sctp/sctp.h +0
-2@@ -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)net/sctp/socket.c +2
-1@@ -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);net/sctp/socket.c int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) · line 5679
Quoted 5 lines
net/sctp/socket.c +0
-1@@ -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:Quoted 6 lines
commit
0343c5543b1d3ffa08e6716d82afb62648b80ebaAuthor: Benjamin Poirier <[email protected]> Date: Thu Mar 8 05:55:58 2012 +0000sctp: Export
sctp_do_peeloffThanks for digging that up. The purpose was of course for the commit that followed:
2f2d76cc3e93dlm: Do not allocate a fd for peeloff (v3.4-rc1)Since that usage was removed in
ee44b4bc054adlm: use sctp 1-to-1 API (v4.3-rc1)
Quoted 6 lines
I don't see a problem with marking
sctp_do_peeloff()static again.Quoted 2 lines
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.
Quoted 8 lines · On Tue, 27 May 2025 10:23:37 -0400 Xin Long <[email protected]> wrote:
Quoted 6 lines · Benjamin Poirier
Quoted 4 lines · Xin Long
Quoted 3 lines · Christoph Hellwig
sctp_do_peeloffis only used inside ofnet/sctp/socket.c, so mark it static.
...
Quoted 10 lines
Quoted 6 lines
I don't see a problem with marking
sctp_do_peeloff()static again.Quoted 2 lines
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
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 26 May 2025 07:47:45 +0200 you wrote:
sctp_do_peeloffis only used inside ofnet/sctp/socket.c, so mark it static.Signed-off-by Christoph Hellwig <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html