* [PATCH net-next] bpf: tcp: Fix unused-function warnings
@ 2020-03-30 7:49 Saeed Mahameed
2020-03-30 21:05 ` Daniel Borkmann
0 siblings, 1 reply; 2+ messages in thread
From: Saeed Mahameed @ 2020-03-30 7:49 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Saeed Mahameed, Daniel Borkmann, John Fastabend
tcp_bpf_sendpage, tcp_bpf_sendmsg, tcp_bpf_send_verdict and
tcp_bpf_stream_read are only used when CONFIG_BPF_STREAM_PARSER is ON,
make sure they are defined under this flag as well.
Fixed compiler warnings:
net/ipv4/tcp_bpf.c:483:12:
warning: ‘tcp_bpf_sendpage’ defined but not used [-Wunused-function]
static int tcp_bpf_sendpage(struct sock *sk, struct page *page, ...
^~~~~~~~~~~~~~~~
net/ipv4/tcp_bpf.c:395:12:
warning: ‘tcp_bpf_sendmsg’ defined but not used [-Wunused-function]
static int tcp_bpf_sendmsg(struct sock *sk, struct msghdr, ...
^~~~~~~~~~~~~~~
net/ipv4/tcp_bpf.c:13:13:
warning: ‘tcp_bpf_stream_read’ defined but not used [-Wunused-function]
static bool tcp_bpf_stream_read(const struct sock *sk)
Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
net/ipv4/tcp_bpf.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index fe7b4fbc31c1..2a7efc5dab96 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -10,19 +10,6 @@
#include <net/inet_common.h>
#include <net/tls.h>
-static bool tcp_bpf_stream_read(const struct sock *sk)
-{
- struct sk_psock *psock;
- bool empty = true;
-
- rcu_read_lock();
- psock = sk_psock(sk);
- if (likely(psock))
- empty = list_empty(&psock->ingress_msg);
- rcu_read_unlock();
- return !empty;
-}
-
static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock,
int flags, long timeo, int *err)
{
@@ -298,6 +285,21 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg,
}
EXPORT_SYMBOL_GPL(tcp_bpf_sendmsg_redir);
+#ifdef CONFIG_BPF_STREAM_PARSER
+
+static bool tcp_bpf_stream_read(const struct sock *sk)
+{
+ struct sk_psock *psock;
+ bool empty = true;
+
+ rcu_read_lock();
+ psock = sk_psock(sk);
+ if (likely(psock))
+ empty = list_empty(&psock->ingress_msg);
+ rcu_read_unlock();
+ return !empty;
+}
+
static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,
struct sk_msg *msg, int *copied, int flags)
{
@@ -528,7 +530,6 @@ static int tcp_bpf_sendpage(struct sock *sk, struct page *page, int offset,
return copied ? copied : err;
}
-#ifdef CONFIG_BPF_STREAM_PARSER
enum {
TCP_BPF_IPV4,
TCP_BPF_IPV6,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] bpf: tcp: Fix unused-function warnings
2020-03-30 7:49 [PATCH net-next] bpf: tcp: Fix unused-function warnings Saeed Mahameed
@ 2020-03-30 21:05 ` Daniel Borkmann
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2020-03-30 21:05 UTC (permalink / raw)
To: Saeed Mahameed, David S. Miller; +Cc: netdev, John Fastabend
On 3/30/20 9:49 AM, Saeed Mahameed wrote:
> tcp_bpf_sendpage, tcp_bpf_sendmsg, tcp_bpf_send_verdict and
> tcp_bpf_stream_read are only used when CONFIG_BPF_STREAM_PARSER is ON,
> make sure they are defined under this flag as well.
>
> Fixed compiler warnings:
>
> net/ipv4/tcp_bpf.c:483:12:
> warning: ‘tcp_bpf_sendpage’ defined but not used [-Wunused-function]
> static int tcp_bpf_sendpage(struct sock *sk, struct page *page, ...
> ^~~~~~~~~~~~~~~~
> net/ipv4/tcp_bpf.c:395:12:
> warning: ‘tcp_bpf_sendmsg’ defined but not used [-Wunused-function]
> static int tcp_bpf_sendmsg(struct sock *sk, struct msghdr, ...
> ^~~~~~~~~~~~~~~
> net/ipv4/tcp_bpf.c:13:13:
> warning: ‘tcp_bpf_stream_read’ defined but not used [-Wunused-function]
> static bool tcp_bpf_stream_read(const struct sock *sk)
>
> Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Already fixed here, PR for bpf-next will go out today:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=a26527981af2988ae0f17f6d633848c019929e38
Thanks,
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-30 21:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 7:49 [PATCH net-next] bpf: tcp: Fix unused-function warnings Saeed Mahameed
2020-03-30 21:05 ` Daniel Borkmann
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.