From patchwork Thu Sep 24 14:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 1370700 X-Patchwork-Delegate: fw@strlen.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=strlen.de Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BxyJG1dQRz9sTg for ; Fri, 25 Sep 2020 00:35:26 +1000 (AEST) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0CD44152ADCB6; Thu, 24 Sep 2020 07:35:24 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a0a:51c0:0:12e:520::1; helo=chamillionaire.breakpoint.cc; envelope-from=fw@breakpoint.cc; receiver= Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C8F9F152ADCB0 for ; Thu, 24 Sep 2020 07:35:21 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1kLSLA-0007Es-Bj; Thu, 24 Sep 2020 16:35:20 +0200 From: Florian Westphal To: Cc: Florian Westphal Date: Thu, 24 Sep 2020 16:35:03 +0200 Message-Id: <20200924143505.27641-3-fw@strlen.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924143505.27641-1-fw@strlen.de> References: <20200924143505.27641-1-fw@strlen.de> MIME-Version: 1.0 Message-ID-Hash: XJYLIOLXA54SINNRTE6P3MMXVAQLV6ZU X-Message-ID-Hash: XJYLIOLXA54SINNRTE6P3MMXVAQLV6ZU X-MailFrom: fw@breakpoint.cc X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [RFC PATCH 2/4] tcp: move selected mptcp helpers to tcp.h/mptcp.h List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Will be needed to fill in the MPTCP reset option from tcp_ipv4/ipv6.c. It would make more sense to place mptcp_option() in mptcp.h, but TCPOPT_MPTCP is defined in tcp.h, and mptcp.h is included from tcp.h, not the other way around. Placing the helper in mptcp.h thus results in a build failure because TCPOPT_MPTCP is not defined. Signed-off-by: Florian Westphal --- 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 6e706d838e4e..5f5062580e0e 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -68,6 +68,11 @@ static inline bool sk_is_mptcp(const struct sock *sk) return tcp_sk(sk)->is_mptcp; } +static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb) +{ + return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); +} + static inline bool rsk_is_mptcp(const struct request_sock *req) { return tcp_rsk(req)->is_mptcp; @@ -153,6 +158,11 @@ static inline void mptcp_init(void) { } +static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb) +{ + return NULL; +} + static inline bool sk_is_mptcp(const struct sock *sk) { return false; diff --git a/include/net/tcp.h b/include/net/tcp.h index 852f0d71dd40..ea8c134802e8 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -2406,4 +2406,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); +} #endif /* _TCP_H */ diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 7cfe52aeb2b8..e8c873c66182 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -130,12 +130,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; @@ -486,11 +480,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); -} - static inline bool before64(__u64 seq1, __u64 seq2) { return (__s64)(seq1 - seq2) < 0;