* [MPTCP] Re: [PATCH MPTCP 1/5] tcp: make two mptcp helpers available to tcp stack
@ 2020-11-09 4:54 Geliang Tang
0 siblings, 0 replies; 2+ messages in thread
From: Geliang Tang @ 2020-11-09 4:54 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 3682 bytes --]
Hi Florian,
Thanks for your patches.
Florian Westphal <fw(a)strlen.de> 于2020年11月6日周五 上午1:01写道:
>
> needed by followup patches to add mptcp reset (and fastclose)
> options to tcp reset packets.
>
> Signed-off-by: Florian Westphal <fw(a)strlen.de>
> ---
> include/net/mptcp.h | 10 ++++++++++
> include/net/tcp.h | 5 +++++
> net/mptcp/protocol.h | 11 -----------
> 3 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index b6cf07143a8a..3d57607982fa 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -78,6 +78,11 @@ static inline bool rsk_drop_req(const struct request_sock *req)
> return tcp_rsk(req)->is_mptcp && tcp_rsk(req)->drop_req;
> }
>
> +static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
> +{
> + return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP);
> +}
> +
> void mptcp_space(const struct sock *ssk, int *space, int *full_space);
> bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
> unsigned int *size, struct mptcp_out_options *opts);
> @@ -169,6 +174,11 @@ static inline bool rsk_drop_req(const struct request_sock *req)
> return false;
> }
>
> +static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
> +{
> + return NULL;
> +}
> +
> static inline void mptcp_parse_option(const struct sk_buff *skb,
> const unsigned char *ptr, int opsize,
> struct tcp_options_received *opt_rx)
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index f3d42cb626fc..8115164e0df6 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -2377,4 +2377,9 @@ static inline u64 tcp_transmit_time(const struct sock *sk)
> return 0;
> }
>
> +static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
> +{
> + return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
> + ((nib & 0xF) << 8) | field);
> +}
I think we should avoid adding code in tcp.h, should it be better to define a
wrapper function of mptcp_option(MPTCPOPT_RST, TCPOLEN_MPTCP_RST, ..., ...)
in net/mptcp/options.c and export it in include/net/mptcp.h? ... ...
> #endif /* _TCP_H */
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index d29c6a4749eb..66bd4d096753 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -139,12 +139,6 @@ struct mptcp_options_received {
> u16 port;
> };
>
> -static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
> -{
> - return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
> - ((nib & 0xF) << 8) | field);
> -}
> -
> struct mptcp_addr_info {
> sa_family_t family;
> __be16 port;
> @@ -568,11 +562,6 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk);
> void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id);
> int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
>
> -static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
> -{
> - return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP);
> -}
> -
> void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops);
>
> static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk)
> --
> 2.26.2
> _______________________________________________
> mptcp mailing list -- mptcp(a)lists.01.org
> To unsubscribe send an email to mptcp-leave(a)lists.01.org
^ permalink raw reply [flat|nested] 2+ messages in thread
* [MPTCP] Re: [PATCH MPTCP 1/5] tcp: make two mptcp helpers available to tcp stack
@ 2020-11-09 14:51 Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2020-11-09 14:51 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
Geliang Tang <geliangtang(a)gmail.com> wrote:
> > +static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
> > +{
> > + return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
> > + ((nib & 0xF) << 8) | field);
> > +}
>
> I think we should avoid adding code in tcp.h, should it be better to define a
> wrapper function of mptcp_option(MPTCPOPT_RST, TCPOLEN_MPTCP_RST, ..., ...)
> in net/mptcp/options.c and export it in include/net/mptcp.h? ... ...
Can be done but it adds a function call to create a 32 bit number.
Sending RST isn't performance critical so it could be done that way too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-09 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 14:51 [MPTCP] Re: [PATCH MPTCP 1/5] tcp: make two mptcp helpers available to tcp stack Florian Westphal
-- strict thread matches above, loose matches on Subject: below --
2020-11-09 4:54 Geliang Tang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.