Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp781125ybg; Thu, 19 Mar 2020 08:38:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtVeEUD4DkSYi+Zsi6lGqZLJ4YtIzlHJ5+ON8sLdlJK+KqAHUpf/rL78ikyPEOh51w8x6jS X-Received: by 2002:a9d:364b:: with SMTP id w69mr2834442otb.332.1584632325584; Thu, 19 Mar 2020 08:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584632325; cv=none; d=google.com; s=arc-20160816; b=0sZRkbLbOo0cXx7Ke7KnkDgZBVlY8vpDNzTFfRFSTX6uLlyyZkIRr8/jHM2Ovl7ji+ Z8WnFY3Jblulx6RhJim2mImxBkzGxSSzlQ6b0QltG0AQuAKAHahFWDvpJq56WqNdSZhJ WItD4fuXPKLfntBNbmmYoEAYAW5t0OZIUaNqXk0eirr0/0DTn/5xmEntaXSmDrpF6Vqs GGXkl77MYCYYaqHHUQYYcNDKL6R/CwAULffPXbVqs4WO2wYNl4SJgM68K3ppGy4Xg4Jr eH4+IFnEoJE0VpPszX3Suf1TDH97fKswo2O+eM85UDq/mDhLhpCG0KeZaaaspJHI79o0 m09w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=seCAy6xYY0ujQIsNH75m2599DrTdig4Y4u9evBOvPIA=; b=vkIeFnMBO41Pg0REu4ghAtnfF65o6lBVrIgWGct6CFFAaK+XdzALamsYODBo51NXh3 sgSuRGXh75MO3ro1znJ42rDc7mg2sAdeG8VSNyx0okmNRGGuJnlP5nu2rYpSZtPJK4D3 tXip8mb+tO0c0krsihqHsgxUY2eB39y25tRx4y2dSO9o7G8ZXsP0A7E3ZWDjEc9fSmON mzaWBLLFpZgmNcwi/eXNiABkO9PjGI0cdpwKmnO9ADIwAKBw2x7AFc2XNE+n4zMQ1s1S 68+yxWJqW6HaPhPGVVkfZ91ft6Cycl47zFqMpkrPRkEn0veMUiiNGvJWA0sQD5dgCv8H /MUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=Xy4Hv9B1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u191si1263893oia.148.2020.03.19.08.38.32; Thu, 19 Mar 2020 08:38:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=Xy4Hv9B1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727733AbgCSPiO (ORCPT + 99 others); Thu, 19 Mar 2020 11:38:14 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:43341 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbgCSPiO (ORCPT ); Thu, 19 Mar 2020 11:38:14 -0400 Received: by mail-ot1-f65.google.com with SMTP id a6so2766444otb.10 for ; Thu, 19 Mar 2020 08:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=seCAy6xYY0ujQIsNH75m2599DrTdig4Y4u9evBOvPIA=; b=Xy4Hv9B1Q/8NsaVAgg5N3Z6vnoVUApM/gVfQN6OhHKjRA8QBEmOawruEKVCVz0LAkt CeJpe/zz4rUmz3J+2o4fdngDWigvxvl51Jn1Wq68BGK8s02vJJkjhxw/SrcJn/aVn83w DGUsdQ4R0giuJKSGh/IMUtDG7szQcVjT6SMV4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=seCAy6xYY0ujQIsNH75m2599DrTdig4Y4u9evBOvPIA=; b=npNL01n5Mf1DgwaxNA/lAyFNUG/B4v/1TS2yiKkH86m4hypMmBEk5id6FhGw/auemM US0i3PhopQV2wiGgUlnUJYkSL52KLc5JfW6IQeBTfihMdcCZ3LQtJVojofB0UfqW2HSw ELZQTMWKNqyYX7VlicU/lMSW4ivE6t8qAb5oUS6EgODCZmTSMTtF8Z85eo1xUL0sDGew TU/ZbvnV7K51yJyeH8AabjhwkhAqgokIIQMHcDEVhWzTMHnAvC6wrxrDrLUBjClqc4sD ui8ccMO56iDKbICm/O75eKnRVk5uaU/C8g/S7+hmqw2tsDLcJLdPQ24sPeanx5zlBgfT g1Vg== X-Gm-Message-State: ANhLgQ1miqeI1SJXHBLC1eP8Dy5QZFyOiqMY6luW72f1gyjMeCV0Nbqr RRYO1sqE2OBcfF8iTriFWJcVMUthrdrRcqMjSS0qPA== X-Received: by 2002:a9d:6310:: with SMTP id q16mr2598495otk.147.1584632293068; Thu, 19 Mar 2020 08:38:13 -0700 (PDT) MIME-Version: 1.0 References: <20200319124631.58432-1-yuehaibing@huawei.com> In-Reply-To: <20200319124631.58432-1-yuehaibing@huawei.com> From: Lorenz Bauer Date: Thu, 19 Mar 2020 15:38:00 +0000 Message-ID: Subject: Re: [PATCH bpf-next] bpf: tcp: Fix unused function warnings To: YueHaibing Cc: Daniel Borkmann , Jakub Sitnicki , John Fastabend , "David S . Miller" , Networking , bpf , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Mar 2020 at 12:47, YueHaibing wrote: > > If BPF_STREAM_PARSER is not set, gcc warns: > > net/ipv4/tcp_bpf.c:483:12: warning: 'tcp_bpf_sendpage' defined but not used [-Wunused-function] > net/ipv4/tcp_bpf.c:395:12: warning: 'tcp_bpf_sendmsg' defined but not used [-Wunused-function] > net/ipv4/tcp_bpf.c:13:13: warning: 'tcp_bpf_stream_read' defined but not used [-Wunused-function] > > Moves the unused functions into the #ifdef Thanks for fixing this. Reviewed-by: Lorenz Bauer > > Reported-by: Hulk Robot > Signed-off-by: YueHaibing > --- > net/ipv4/tcp_bpf.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c > index fe7b4fbc31c1..37c91f25cae3 100644 > --- a/net/ipv4/tcp_bpf.c > +++ b/net/ipv4/tcp_bpf.c > @@ -10,19 +10,6 @@ > #include > #include > > -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,20 @@ 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 +529,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.17.1 > > -- Lorenz Bauer | Systems Engineer 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK www.cloudflare.com