Skip to contentSkip to conversation

net: adress some sparse warnings

PATCH In review Eric Dumazet 2 participants 7 messages Jun 23, 2020 – Jun 24, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover net: adress some sparse warnings

This series adds missing declarations and move others to address W=1 C=1 warnings in tcp and udp.

Eric Dumazet (5):
tcp: add declarations to avoid warnings
tcp: move ipv6_specific declaration to remove a warning
tcp: move ipv4_specific to tcp include file
net: move tcp gro declarations to net/tcp.h
udp: move gro declarations to net/udp.h

 include/net/tcp.h       | 10 ++++++++++
 include/net/transp_v6.h |  3 ---
 include/net/udp.h       |  7 +++++++
 net/ipv4/af_inet.c      |  6 ------
 net/ipv6/ip6_offload.c  |  8 ++------
 net/mptcp/protocol.h    |  5 -----
 6 files changed, 19 insertions(+), 20 deletions(-)
Signature · 1 line
2.27.0.111.gc72c7da667-goog
#1 lore raw

PATCH 1/5 tcp: add declarations to avoid warnings

Remove these errors:

net/ipv6/tcp_ipv6.c:1550:29: warning: symbol 'tcp_v6_rcv' was not declared. Should it be static? net/ipv6/tcp_ipv6.c:1770:30: warning: symbol 'tcp_v6_early_demux' was not declared. Should it be static?

net/ipv6/tcp_ipv6.c:1550:29: warning: no previous prototype for 'tcp_v6_rcv' [-Wmissing-prototypes]
1550 | INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)

      |                             ^~~~~~~~~~
net/ipv6/tcp_ipv6.c:1770:30: warning: no previous prototype for 'tcp_v6_early_demux' [-Wmissing-prototypes]
 1770 | INDIRECT_CALLABLE_SCOPE void tcp_v6_early_demux(struct sk_buff *skb)
      |                              ^~~~~~~~~~~~~~~~~~
---
 include/net/tcp.h | 2 ++
 1 file changed, 2 insertions(+)
include/net/tcp.h +2 -0
index cd9cc348dbf9c62efa30d909f23a0ed1b39e4492..a8c36fa886a48bb3a242d0360a581b2aba49756b 100644
@@ -934,6 +934,8 @@ static inline int tcp_v6_sdif(const struct sk_buff *skb)
 }
 
 INDIRECT_CALLABLE_DECLARE(void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb));
+INDIRECT_CALLABLE_DECLARE(int tcp_v6_rcv(struct sk_buff *skb));
+INDIRECT_CALLABLE_DECLARE(void tcp_v6_early_demux(struct sk_buff *skb));
 
 #endif
 
Signature · 1 line
2.27.0.111.gc72c7da667-goog
#2 lore raw

PATCH 2/5 tcp: move ipv6_specific declaration to remove a warning

In reply to Eric Dumazet

ipv6_specific should be declared in tcp include files, not mptcp.

This removes the following warning :
CHECK net/ipv6/tcp_ipv6.c
net/ipv6/tcp_ipv6.c:78:42: warning: symbol 'ipv6_specific' was not declared. Should it be static?

---
 include/net/tcp.h    | 2 ++
 net/mptcp/protocol.h | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/net/tcp.h +2 -0
index a8c36fa886a48bb3a242d0360a581b2aba49756b..e6920ae0765cc54570059d0a1aa43dba4e74c511 100644
@@ -933,6 +933,8 @@ static inline int tcp_v6_sdif(const struct sk_buff *skb)
 	return 0;
 }
 
+extern const struct inet_connection_sock_af_ops ipv6_specific;
+
 INDIRECT_CALLABLE_DECLARE(void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb));
 INDIRECT_CALLABLE_DECLARE(int tcp_v6_rcv(struct sk_buff *skb));
 INDIRECT_CALLABLE_DECLARE(void tcp_v6_early_demux(struct sk_buff *skb));
net/mptcp/protocol.h +0 -3
index db56535dfc29c7011d94ac5c2cede985b8fc063c..d4294b6d23e4de3ac5551f8b9ec781cf07c8081d 100644
@@ -355,9 +355,6 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
 }
 
 extern const struct inet_connection_sock_af_ops ipv4_specific;
-#if IS_ENABLED(CONFIG_MPTCP_IPV6)
-extern const struct inet_connection_sock_af_ops ipv6_specific;
-#endif
 
 void mptcp_proto_init(void);
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
Signature · 1 line
2.27.0.111.gc72c7da667-goog
#3 lore raw

PATCH 3/5 tcp: move ipv4_specific to tcp include file

In reply to Eric Dumazet

Declare ipv4_specific once, in tcp.h were it belongs.

---
 include/net/tcp.h       | 2 ++
 include/net/transp_v6.h | 3 ---
 net/mptcp/protocol.h    | 2 --
 3 files changed, 2 insertions(+), 5 deletions(-)
include/net/tcp.h +2 -0
index e6920ae0765cc54570059d0a1aa43dba4e74c511..b0f0f93c681c1744560fd229569b59edb1eb20ee 100644
@@ -907,6 +907,8 @@ static inline void tcp_skb_bpf_redirect_clear(struct sk_buff *skb)
 	TCP_SKB_CB(skb)->bpf.sk_redir = NULL;
 }
 
+extern const struct inet_connection_sock_af_ops ipv4_specific;
+
 #if IS_ENABLED(CONFIG_IPV6)
 /* This is the variant of inet6_iif() that must be used by TCP,
  * as TCP moves IP6CB into a different location in skb->cb[]
include/net/transp_v6.h +0 -3
index a8f6020f1196edc9940cbb6c605a06279db4fd36..da06613c9603a215902a3057ff327b878c1fe953 100644
@@ -56,9 +56,6 @@ ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
 
 #define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
 
-/* address family specific functions */
-extern const struct inet_connection_sock_af_ops ipv4_specific;
-
 void inet6_destroy_sock(struct sock *sk);
 
 #define IPV6_SEQ_DGRAM_HEADER					       \
net/mptcp/protocol.h +0 -2
index d4294b6d23e4de3ac5551f8b9ec781cf07c8081d..06661781c9afbecce7a19f08afeb8bed8e4ff453 100644
@@ -354,8 +354,6 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
 	inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops;
 }
 
-extern const struct inet_connection_sock_af_ops ipv4_specific;
-
 void mptcp_proto_init(void);
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 int mptcp_proto_v6_init(void);
Signature · 1 line
2.27.0.111.gc72c7da667-goog
#4 lore raw

PATCH 4/5 net: move tcp gro declarations to net/tcp.h

In reply to Eric Dumazet

This patch removes following (C=1 W=1) warnings for CONFIG_RETPOLINE=y :

net/ipv4/tcp_offload.c:306:16: warning: symbol 'tcp4_gro_receive' was not declared. Should it be static? net/ipv4/tcp_offload.c:306:17: warning: no previous prototype for 'tcp4_gro_receive' [-Wmissing-prototypes] net/ipv4/tcp_offload.c:319:29: warning: symbol 'tcp4_gro_complete' was not declared. Should it be static? net/ipv4/tcp_offload.c:319:29: warning: no previous prototype for 'tcp4_gro_complete' [-Wmissing-prototypes]
CHECK net/ipv6/tcpv6_offload.c
net/ipv6/tcpv6_offload.c:16:16: warning: symbol 'tcp6_gro_receive' was not declared. Should it be static? net/ipv6/tcpv6_offload.c:29:29: warning: symbol 'tcp6_gro_complete' was not declared. Should it be static?
CC net/ipv6/tcpv6_offload.o
net/ipv6/tcpv6_offload.c:16:17: warning: no previous prototype for 'tcp6_gro_receive' [-Wmissing-prototypes]
16 | struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb)

      |                 ^~~~~~~~~~~~~~~~
net/ipv6/tcpv6_offload.c:29:29: warning: no previous prototype for 'tcp6_gro_complete' [-Wmissing-prototypes]
   29 | INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff)
      |                             ^~~~~~~~~~~~~~~~~
---
 include/net/tcp.h      | 4 ++++
 net/ipv4/af_inet.c     | 3 ---
 net/ipv6/ip6_offload.c | 4 +---
 3 files changed, 5 insertions(+), 6 deletions(-)
include/net/tcp.h +4 -0
index b0f0f93c681c1744560fd229569b59edb1eb20ee..27f848ab39951c9ee5b5d81d7f96d09a4c03e3d6 100644
@@ -1957,6 +1957,10 @@ void tcp_v4_destroy_sock(struct sock *sk);
 struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
 				netdev_features_t features);
 struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb);
+INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *skb, int thoff));
+INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *head, struct sk_buff *skb));
+INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *skb, int thoff));
+INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb));
 int tcp_gro_complete(struct sk_buff *skb);
 
 void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
net/ipv4/af_inet.c +0 -3
index 02aa5cb3a4fd15fa219831283dea2992b053c6a8..d8dbff1dd1fa155171b45a2dbf3034563db22db5 100644
@@ -1432,8 +1432,6 @@ static struct sk_buff *ipip_gso_segment(struct sk_buff *skb,
 	return inet_gso_segment(skb, features);
 }
 
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *,
-							   struct sk_buff *));
 INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
 							   struct sk_buff *));
 struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb)
@@ -1608,7 +1606,6 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 	return -EINVAL;
 }
 
-INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *, int));
 INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int));
 int inet_gro_complete(struct sk_buff *skb, int nhoff)
 {
net/ipv6/ip6_offload.c +1 -3
index 7fbb44736a34b143baf147d8c5b0331799647738..78eec5b423856c853b6a59adab425dbe29a2c4fc 100644
@@ -13,6 +13,7 @@
 #include <net/protocol.h>
 #include <net/ipv6.h>
 #include <net/inet_common.h>
+#include <net/tcp.h>
 
 #include "ip6_offload.h"
 
@@ -177,8 +178,6 @@ static int ipv6_exthdrs_len(struct ipv6hdr *iph,
 	return len;
 }
 
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp6_gro_receive(struct list_head *,
-							   struct sk_buff *));
 INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp6_gro_receive(struct list_head *,
 							   struct sk_buff *));
 INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,
@@ -319,7 +318,6 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head,
 	return inet_gro_receive(head, skb);
 }
 
-INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *, int));
 INDIRECT_CALLABLE_DECLARE(int udp6_gro_complete(struct sk_buff *, int));
 INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
 {
Signature · 1 line
2.27.0.111.gc72c7da667-goog
#5 lore raw

PATCH 5/5 udp: move gro declarations to net/udp.h

In reply to Eric Dumazet

This removes following warnings :
CC net/ipv4/udp_offload.o
net/ipv4/udp_offload.c:504:17: warning: no previous prototype for 'udp4_gro_receive' [-Wmissing-prototypes]
504 | struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb)

      |                 ^~~~~~~~~~~~~~~~
net/ipv4/udp_offload.c:584:29: warning: no previous prototype for 'udp4_gro_complete' [-Wmissing-prototypes]
  584 | INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff)
      |                             ^~~~~~~~~~~~~~~~~

CHECK net/ipv6/udp_offload.c
net/ipv6/udp_offload.c:115:16: warning: symbol 'udp6_gro_receive' was not declared. Should it be static? net/ipv6/udp_offload.c:148:29: warning: symbol 'udp6_gro_complete' was not declared. Should it be static?
CC net/ipv6/udp_offload.o
net/ipv6/udp_offload.c:115:17: warning: no previous prototype for 'udp6_gro_receive' [-Wmissing-prototypes]
115 | struct sk_buff *udp6_gro_receive(struct list_head *head, struct sk_buff *skb)

      |                 ^~~~~~~~~~~~~~~~
net/ipv6/udp_offload.c:148:29: warning: no previous prototype for 'udp6_gro_complete' [-Wmissing-prototypes]
  148 | INDIRECT_CALLABLE_SCOPE int udp6_gro_complete(struct sk_buff *skb, int nhoff)
      |                             ^~~~~~~~~~~~~~~~~
---
 include/net/udp.h      | 7 +++++++
 net/ipv4/af_inet.c     | 3 ---
 net/ipv6/ip6_offload.c | 4 +---
 3 files changed, 8 insertions(+), 6 deletions(-)
include/net/udp.h +7 -0
index a8fa6c0c6dede2f56629165f5a85218f061c6ead..5a2d677432f0fcf7b5731860c21e0f50fb19fb8f 100644
@@ -27,6 +27,7 @@
 #include <linux/ipv6.h>
 #include <linux/seq_file.h>
 #include <linux/poll.h>
+#include <linux/indirect_call_wrapper.h>
 
 /**
  *	struct udp_skb_cb  -  UDP(-Lite) private variables
@@ -166,6 +167,12 @@ static inline void udp_csum_pull_header(struct sk_buff *skb)
 typedef struct sock *(*udp_lookup_t)(struct sk_buff *skb, __be16 sport,
 				     __be16 dport);
 
+INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
+							   struct sk_buff *));
+INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int));
+INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp6_gro_receive(struct list_head *,
+							   struct sk_buff *));
+INDIRECT_CALLABLE_DECLARE(int udp6_gro_complete(struct sk_buff *, int));
 struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
 				struct udphdr *uh, struct sock *sk);
 int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup);
net/ipv4/af_inet.c +0 -3
index d8dbff1dd1fa155171b45a2dbf3034563db22db5..ea6ed6d487ed390d99049864540519108a0647bb 100644
@@ -1432,8 +1432,6 @@ static struct sk_buff *ipip_gso_segment(struct sk_buff *skb,
 	return inet_gso_segment(skb, features);
 }
 
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
-							   struct sk_buff *));
 struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb)
 {
 	const struct net_offload *ops;
@@ -1606,7 +1604,6 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 	return -EINVAL;
 }
 
-INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int));
 int inet_gro_complete(struct sk_buff *skb, int nhoff)
 {
 	__be16 newlen = htons(skb->len - nhoff);
net/ipv6/ip6_offload.c +1 -3
index 78eec5b423856c853b6a59adab425dbe29a2c4fc..a80f90bf3ae7dc1aec904fd93b3d8e8c87a926e4 100644
@@ -14,6 +14,7 @@
 #include <net/ipv6.h>
 #include <net/inet_common.h>
 #include <net/tcp.h>
+#include <net/udp.h>
 
 #include "ip6_offload.h"
 
@@ -178,8 +179,6 @@ static int ipv6_exthdrs_len(struct ipv6hdr *iph,
 	return len;
 }
 
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp6_gro_receive(struct list_head *,
-							   struct sk_buff *));
 INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,
 							 struct sk_buff *skb)
 {
@@ -318,7 +317,6 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head,
 	return inet_gro_receive(head, skb);
 }
 
-INDIRECT_CALLABLE_DECLARE(int udp6_gro_complete(struct sk_buff *, int));
 INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
 {
 	const struct net_offload *ops;
Signature · 1 line
2.27.0.111.gc72c7da667-goog
maintainer
#6 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Tue, 23 Jun 2020 15:31:10 -0700

Quoted 2 lines

This series adds missing declarations and move others to address W=1 C=1 warnings in tcp and udp.

I fixed up 's/adress/address/' for you.

Applied and queued up for -stable.