diff mbox series

net: Fix build when CONFIG_INET is not enabled

Message ID 20220211164026.409225-1-ribalda@chromium.org (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series net: Fix build when CONFIG_INET is not enabled | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 11 this patch: 11
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 40 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Ricardo Ribalda Feb. 11, 2022, 4:40 p.m. UTC
If the kernel is configured with CONFIG_NET, but without CONFIG_INET we
get the following error when building:

sock.c:(.text+0x4c17): undefined reference to `__sk_defer_free_flush'

Lets move __sk_defer_free_flush to sock.c

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 net/core/sock.c | 14 ++++++++++++++
 net/ipv4/tcp.c  | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

Comments

Eric Dumazet Feb. 11, 2022, 5:24 p.m. UTC | #1
On Fri, Feb 11, 2022 at 8:40 AM Ricardo Ribalda <ribalda@chromium.org> wrote:
>
> If the kernel is configured with CONFIG_NET, but without CONFIG_INET we
> get the following error when building:
>
> sock.c:(.text+0x4c17): undefined reference to `__sk_defer_free_flush'
>
> Lets move __sk_defer_free_flush to sock.c
>

deja vu ?

commit 48cec899e357cfb92d022a9c0df6bbe72a7f6951
Author: Gal Pressman <gal@nvidia.com>
Date:   Thu Jan 20 14:34:40 2022 +0200

    tcp: Add a stub for sk_defer_free_flush()

    When compiling the kernel with CONFIG_INET disabled, the
    sk_defer_free_flush() should be defined as a nop.

    This resolves the following compilation error:
      ld: net/core/sock.o: in function `sk_defer_free_flush':
      ./include/net/tcp.h:1378: undefined reference to `__sk_defer_free_flush'

    Fixes: 79074a72d335 ("net: Flush deferred skb free on socket destroy")
    Reported-by: kernel test robot <lkp@intel.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Gal Pressman <gal@nvidia.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20220120123440.9088-1-gal@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
kernel test robot Feb. 11, 2022, 7:42 p.m. UTC | #2
Hi Ricardo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on net/master horms-ipvs/master linus/master v5.17-rc3 next-20220211]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ricardo-Ribalda/net-Fix-build-when-CONFIG_INET-is-not-enabled/20220212-004127
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 5b91c5cc0e7be4e41567cb2a6e21a8bb682c7cc5
config: arc-randconfig-r043-20220211 (https://download.01.org/0day-ci/archive/20220212/202202120329.TB5XJjoH-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f9b7fbd36ce386e1b9fb64f316878a4e011c1a09
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ricardo-Ribalda/net-Fix-build-when-CONFIG_INET-is-not-enabled/20220212-004127
        git checkout f9b7fbd36ce386e1b9fb64f316878a4e011c1a09
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/core/sock.c:2061:6: warning: no previous prototype for '__sk_defer_free_flush' [-Wmissing-prototypes]
    2061 | void __sk_defer_free_flush(struct sock *sk)
         |      ^~~~~~~~~~~~~~~~~~~~~


vim +/__sk_defer_free_flush +2061 net/core/sock.c

  2060	
> 2061	void __sk_defer_free_flush(struct sock *sk)
  2062	{
  2063		struct llist_node *head;
  2064		struct sk_buff *skb, *n;
  2065	
  2066		head = llist_del_all(&sk->defer_list);
  2067		llist_for_each_entry_safe(skb, n, head, ll_node) {
  2068			prefetch(n);
  2069			skb_mark_not_on_list(skb);
  2070			__kfree_skb(skb);
  2071		}
  2072	}
  2073	EXPORT_SYMBOL(__sk_defer_free_flush);
  2074	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Ricardo Ribalda Feb. 11, 2022, 7:43 p.m. UTC | #3
Hi Eric

I failed to find that patch. I only searched in linus/master. Please
ignore mine.

Thanks.

On Fri, 11 Feb 2022 at 18:24, Eric Dumazet <edumazet@google.com> wrote:
>
> On Fri, Feb 11, 2022 at 8:40 AM Ricardo Ribalda <ribalda@chromium.org> wrote:
> >
> > If the kernel is configured with CONFIG_NET, but without CONFIG_INET we
> > get the following error when building:
> >
> > sock.c:(.text+0x4c17): undefined reference to `__sk_defer_free_flush'
> >
> > Lets move __sk_defer_free_flush to sock.c
> >
>
> deja vu ?
>
> commit 48cec899e357cfb92d022a9c0df6bbe72a7f6951
> Author: Gal Pressman <gal@nvidia.com>
> Date:   Thu Jan 20 14:34:40 2022 +0200
>
>     tcp: Add a stub for sk_defer_free_flush()
>
>     When compiling the kernel with CONFIG_INET disabled, the
>     sk_defer_free_flush() should be defined as a nop.
>
>     This resolves the following compilation error:
>       ld: net/core/sock.o: in function `sk_defer_free_flush':
>       ./include/net/tcp.h:1378: undefined reference to `__sk_defer_free_flush'
>
>     Fixes: 79074a72d335 ("net: Flush deferred skb free on socket destroy")
>     Reported-by: kernel test robot <lkp@intel.com>
>     Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>     Signed-off-by: Gal Pressman <gal@nvidia.com>
>     Reviewed-by: Eric Dumazet <edumazet@google.com>
>     Link: https://lore.kernel.org/r/20220120123440.9088-1-gal@nvidia.com
>     Signed-off-by: Jakub Kicinski <kuba@kernel.org>
diff mbox series

Patch

diff --git a/net/core/sock.c b/net/core/sock.c
index 4ff806d71921..b93b93497e7e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2045,6 +2045,20 @@  static void __sk_destruct(struct rcu_head *head)
 	sk_prot_free(sk->sk_prot_creator, sk);
 }
 
+void __sk_defer_free_flush(struct sock *sk)
+{
+	struct llist_node *head;
+	struct sk_buff *skb, *n;
+
+	head = llist_del_all(&sk->defer_list);
+	llist_for_each_entry_safe(skb, n, head, ll_node) {
+		prefetch(n);
+		skb_mark_not_on_list(skb);
+		__kfree_skb(skb);
+	}
+}
+EXPORT_SYMBOL(__sk_defer_free_flush);
+
 void sk_destruct(struct sock *sk)
 {
 	bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 02cb275e5487..bc5b5c29d5c4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1589,20 +1589,6 @@  void tcp_cleanup_rbuf(struct sock *sk, int copied)
 		tcp_send_ack(sk);
 }
 
-void __sk_defer_free_flush(struct sock *sk)
-{
-	struct llist_node *head;
-	struct sk_buff *skb, *n;
-
-	head = llist_del_all(&sk->defer_list);
-	llist_for_each_entry_safe(skb, n, head, ll_node) {
-		prefetch(n);
-		skb_mark_not_on_list(skb);
-		__kfree_skb(skb);
-	}
-}
-EXPORT_SYMBOL(__sk_defer_free_flush);
-
 static void tcp_eat_recv_skb(struct sock *sk, struct sk_buff *skb)
 {
 	__skb_unlink(skb, &sk->sk_receive_queue);