diff mbox series

[mptcp-next] bpf: move bpf_mptcp_sock_ fn out of CONFIG_INET

Message ID 20201114081936.2617526-1-matthieu.baerts@tessares.net
State Accepted, archived
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-next] bpf: move bpf_mptcp_sock_ fn out of CONFIG_INET | expand

Commit Message

Matthieu Baerts Nov. 14, 2020, 8:19 a.m. UTC
If CONFIG_INET is not enabled, our bpf_mptcp_sock_*() functions were not
declared as reported by the 0-day bot.

We can simply move these bpf_mptcp_sock_*() functions out of

  #ifdef CONFIG_INET

Because these functions are surrounded with:

  #ifdef CONFIG_MPTCP

which depends on CONFIG_INET.

Fixes: 0da79c831507 ("bpf: add 'bpf_mptcp_sock' structure and helper")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lists.01.org/hyperkitty/list/mptcp@lists.01.org/thread/RT36VFHG56TKRUO6EJQOIIUPWDJZELIL/
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    to be squashed in "bpf: add 'bpf_mptcp_sock' structure and helper"

 include/linux/bpf.h | 56 ++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

Comments

Matthieu Baerts Nov. 14, 2020, 8:24 a.m. UTC | #1
Hello,

On 14/11/2020 09:19, Matthieu Baerts wrote:
> If CONFIG_INET is not enabled, our bpf_mptcp_sock_*() functions were not
> declared as reported by the 0-day bot.
> 
> We can simply move these bpf_mptcp_sock_*() functions out of
> 
>    #ifdef CONFIG_INET
> 
> Because these functions are surrounded with:
> 
>    #ifdef CONFIG_MPTCP
> 
> which depends on CONFIG_INET.

I guess I don't need an external review for this.

Applied in our git tree:

- 1800469e0a75: bpf: move bpf_mptcp_sock_ fn out of CONFIG_INET
- Results: 39f581445bc2..39fccf50eeb0

Tests + export are in progress!

Cheers,
Matt
diff mbox series

Patch

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 269033924cb7..10f2329ed654 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1895,34 +1895,6 @@  struct sk_reuseport_kern {
 	bool bind_inany;
 };
 
-#ifdef CONFIG_MPTCP
-bool bpf_mptcp_sock_is_valid_access(int off, int size,
-				    enum bpf_access_type type,
-				    struct bpf_insn_access_aux *info);
-
-u32 bpf_mptcp_sock_convert_ctx_access(enum bpf_access_type type,
-				      const struct bpf_insn *si,
-				      struct bpf_insn *insn_buf,
-				      struct bpf_prog *prog,
-				      u32 *target_size);
-#else /* CONFIG_MPTCP */
-static inline bool bpf_mptcp_sock_is_valid_access(int off, int size,
-						  enum bpf_access_type type,
-						  struct bpf_insn_access_aux *info)
-{
-	return false;
-}
-
-static inline u32 bpf_mptcp_sock_convert_ctx_access(enum bpf_access_type type,
-						    const struct bpf_insn *si,
-						    struct bpf_insn *insn_buf,
-						    struct bpf_prog *prog,
-						    u32 *target_size)
-{
-	return 0;
-}
-#endif /* CONFIG_MPTCP */
-
 bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type,
 				  struct bpf_insn_access_aux *info);
 
@@ -1973,6 +1945,34 @@  static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
 }
 #endif /* CONFIG_INET */
 
+#ifdef CONFIG_MPTCP
+bool bpf_mptcp_sock_is_valid_access(int off, int size,
+				    enum bpf_access_type type,
+				    struct bpf_insn_access_aux *info);
+
+u32 bpf_mptcp_sock_convert_ctx_access(enum bpf_access_type type,
+				      const struct bpf_insn *si,
+				      struct bpf_insn *insn_buf,
+				      struct bpf_prog *prog,
+				      u32 *target_size);
+#else /* CONFIG_MPTCP */
+static inline bool bpf_mptcp_sock_is_valid_access(int off, int size,
+						  enum bpf_access_type type,
+						  struct bpf_insn_access_aux *info)
+{
+	return false;
+}
+
+static inline u32 bpf_mptcp_sock_convert_ctx_access(enum bpf_access_type type,
+						    const struct bpf_insn *si,
+						    struct bpf_insn *insn_buf,
+						    struct bpf_prog *prog,
+						    u32 *target_size)
+{
+	return 0;
+}
+#endif /* CONFIG_MPTCP */
+
 enum bpf_text_poke_type {
 	BPF_MOD_CALL,
 	BPF_MOD_JUMP,