From: Menglong Dong <imagedong@tencent.com>
mptcp_cancel_work() is simple enough and we can make it as inline and
move it to protocol.h. mptcp_cancel_work() will be used in subflow.c
in the next commit.
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Reviewed-by: Mengen Sun <mengensun@tencent.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
net/mptcp/protocol.c | 8 --------
net/mptcp/protocol.h | 8 ++++++++
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 1cfb4f1ff4e4..d6eb033e93b9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2656,14 +2656,6 @@ static void __mptcp_clear_xmit(struct sock *sk)
dfrag_clear(sk, dfrag);
}
-static void mptcp_cancel_work(struct sock *sk)
-{
- struct mptcp_sock *msk = mptcp_sk(sk);
-
- if (cancel_work_sync(&msk->work))
- __sock_put(sk);
-}
-
void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
{
lock_sock(ssk);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 8f123d450c76..9de891373959 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -378,6 +378,14 @@ static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
}
+static inline void mptcp_cancel_work(struct sock *sk)
+{
+ struct mptcp_sock *msk = mptcp_sk(sk);
+
+ if (cancel_work_sync(&msk->work))
+ __sock_put(sk);
+}
+
struct csum_pseudo_header {
__be64 data_seq;
__be32 subflow_seq;
--
2.37.2
On Fri, 2022-09-09 at 13:49 +0800, menglong8.dong@gmail.com wrote: > From: Menglong Dong <imagedong@tencent.com> > > mptcp_cancel_work() is simple enough and we can make it as inline and > move it to protocol.h. mptcp_cancel_work() will be used in subflow.c > in the next commit. > > Reviewed-by: Jiang Biao <benbjiang@tencent.com> > Reviewed-by: Mengen Sun <mengensun@tencent.com> > Signed-off-by: Menglong Dong <imagedong@tencent.com> > --- > net/mptcp/protocol.c | 8 -------- > net/mptcp/protocol.h | 8 ++++++++ > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index 1cfb4f1ff4e4..d6eb033e93b9 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c > @@ -2656,14 +2656,6 @@ static void __mptcp_clear_xmit(struct sock *sk) > dfrag_clear(sk, dfrag); > } > > -static void mptcp_cancel_work(struct sock *sk) I think it's better to just drop the 'static' scope and the function declaration to the header. This is not critical/fast path, so it's better to keep the generated code smaller vs. possibly avoiding a function call due to inlining. Thanks, Paolo
On Fri, Sep 9, 2022 at 3:33 PM Paolo Abeni <pabeni@redhat.com> wrote: > > On Fri, 2022-09-09 at 13:49 +0800, menglong8.dong@gmail.com wrote: > > From: Menglong Dong <imagedong@tencent.com> > > > > mptcp_cancel_work() is simple enough and we can make it as inline and > > move it to protocol.h. mptcp_cancel_work() will be used in subflow.c > > in the next commit. > > > > Reviewed-by: Jiang Biao <benbjiang@tencent.com> > > Reviewed-by: Mengen Sun <mengensun@tencent.com> > > Signed-off-by: Menglong Dong <imagedong@tencent.com> > > --- > > net/mptcp/protocol.c | 8 -------- > > net/mptcp/protocol.h | 8 ++++++++ > > 2 files changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > > index 1cfb4f1ff4e4..d6eb033e93b9 100644 > > --- a/net/mptcp/protocol.c > > +++ b/net/mptcp/protocol.c > > @@ -2656,14 +2656,6 @@ static void __mptcp_clear_xmit(struct sock *sk) > > dfrag_clear(sk, dfrag); > > } > > > > -static void mptcp_cancel_work(struct sock *sk) > > I think it's better to just drop the 'static' scope and the function > declaration to the header. > > This is not critical/fast path, so it's better to keep the generated > code smaller vs. possibly avoiding a function call due to inlining. > Okay! > Thanks, > > Paolo >
© 2016 - 2026 Red Hat, Inc.