Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp612334ybg; Thu, 19 Mar 2020 05:47:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vukF+mu3mSUlFxdR0twrE1Ez580VIRLBgZrXzjhLPkj1LaMDoiKYTQ9jocBvTpQ0YdgVY/r X-Received: by 2002:a9d:694a:: with SMTP id p10mr2226532oto.151.1584622069848; Thu, 19 Mar 2020 05:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584622069; cv=none; d=google.com; s=arc-20160816; b=lvayaw5DpnbgGlQ3vxjPnqYzctblzAGvmDSe/INO6zgUNJQZ4oDkvAILMliqfKuAxM OaQ68qHqcveZtRWcH2bwhEXJIVKxan55//0I1PunpYHl6BZ46F3hJly4iWsJWnPW4O3J xPVzmI9pD157zzNj3PlpvdvlZvJkXDYix8nZzQEspJxHQ70HKhwmdguGn7z9rfQEnF58 Oa2BFbz1MxpS6bxkToQ4g3q3HQ2tlEf5qdGKS32smt6JlbLb8w6Y+rRqp671BiQwMcQx I9bU+foPAEvD6XdhkIV6+ZNLtOpjuefuAsYkKRtoBpvGx4JG7MxP8X0vX7wBRvgKcga3 uPqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=jN0OBLRcLtmnRJHs9ZuTCuxT4//XMjGWjkaN2sUYrHA=; b=Cf1I2PxwNfmkIMd58IcPV8eKG2KYsJdy5XSAnbAdN1VQ2c3DdekPoD8PmCZats9rq+ YjRhqb+4G03LV8uWU92+wGBbvgAzq6Er0uUlB7ezn/NBUB2n3kwf6+fnNHR+YO2ovWzw 8/7xnPsmcnMTIsv1kji1Ju7Qh9EuoNHP1IGrHVIfffDjJ2h6M934C7EmzcAhK8pl8vKe xwEtk6U3hkyjPgE1Pn0FSgfMKHB0tHDb3+/ZJLBPwK6Xl1OAjpSIrsXIxMXw8OOs2KRf fZE6c3a4v5C4oHc5NP0WYEtFWyfYmcWRQgnN3lPONr/hzJLRd3DLchJToBOlmC0zPzsC 2x7g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1222728otq.62.2020.03.19.05.47.36; Thu, 19 Mar 2020 05:47:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbgCSMrF (ORCPT + 99 others); Thu, 19 Mar 2020 08:47:05 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12102 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726589AbgCSMrE (ORCPT ); Thu, 19 Mar 2020 08:47:04 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9810353EC2277E87DC44; Thu, 19 Mar 2020 20:46:57 +0800 (CST) Received: from localhost (10.173.223.234) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 19 Mar 2020 20:46:51 +0800 From: YueHaibing To: , , , CC: , , , , YueHaibing Subject: [PATCH bpf-next] bpf: tcp: Fix unused function warnings Date: Thu, 19 Mar 2020 20:46:31 +0800 Message-ID: <20200319124631.58432-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.173.223.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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