Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp192130ybb; Thu, 19 Mar 2020 19:39:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt+15pJOoNPxosIxifskheWHODbqZO9aVEHNzqEZtoYpRXOF0NkZ7m30d9dfsUWip5OMZmg X-Received: by 2002:a9d:4698:: with SMTP id z24mr4929201ote.271.1584671990330; Thu, 19 Mar 2020 19:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584671990; cv=none; d=google.com; s=arc-20160816; b=RQ4IrtZ/dQE5SRCQhEcY0KosL3WQsZx4P6sTS7QkVM7Uc5Ji/i5Iv1gz+x/b1sEFDy pVqvII+WIubzH9KI7cq0FnKr46+P6Lzqx1kpc600dpGTKWlhxOTeeXnfwVu9wj53Yyws i6//RZohs4RwiSS0UkLuU3UUQ/KpgfJ2wcXN2A+OOohUdA3kWpiyCkV23dhkdGW0sDZm yHgTzGIJuHyiaARP4bCxGtQBGHt2CLtC2wjlImBST4jOnwXeurs7HR1ICtK6aol+0tnk wes8HrhCF8JpTxck0QLBqW1hEAiaDVPEdf9wpKOJ7M3OvmNXyc/X3FzFhttWbSX+JD6E AN2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=xftlBxDlVlQDfvIH9wWhQy1SQS7YZprNaywTWFOAEU0=; b=RIJxVsWlIl+8pJYV437vOItQOW+WeIKmjx1dZHczqsBiHWl+HQUuKYrILddM7MVW+o unpsKkV7umlZCEIfngZLdH0g2myRf7vICqlN+3r/ivVm65bnBXzBlsuyupmvoxMOl4YQ HYiTTzUVTqE776bd0zGmTv6U6ZpeckIC1FeaG4ECH+3qGNjoy7ginwVUHXZpwP7Jd6CK HN6TkFkNfER0GAya7dzfEBRF+CqYr0P+c2/NzLNl1t+ouCZ3Lfy2J3TDFNKeHd3H8ziq JHKmCHHxBy4Xo31jG6pOICvI18HQ0o+SRQyUT3zt6dOwG7HtmqzSJmc39V4QNcc1bjKW 70aQ== 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 j185si1926484oif.36.2020.03.19.19.39.37; Thu, 19 Mar 2020 19:39:50 -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 S1727056AbgCTCir (ORCPT + 99 others); Thu, 19 Mar 2020 22:38:47 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:40522 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726867AbgCTCiq (ORCPT ); Thu, 19 Mar 2020 22:38:46 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0B8B4BE8674E10677D2D; Fri, 20 Mar 2020 10:38:39 +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; Fri, 20 Mar 2020 10:38:28 +0800 From: YueHaibing To: , , , CC: , , , , , YueHaibing Subject: [PATCH bpf-next 1/2] bpf: tcp: Fix unused function warnings Date: Fri, 20 Mar 2020 10:34:25 +0800 Message-ID: <20200320023426.60684-2-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20200320023426.60684-1-yuehaibing@huawei.com> References: <20200319124631.58432-1-yuehaibing@huawei.com> <20200320023426.60684-1-yuehaibing@huawei.com> 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 Fixes: f747632b608f ("bpf: sockmap: Move generic sockmap hooks from BPF TCP") Signed-off-by: YueHaibing Reviewed-by: Lorenz Bauer Reviewed-by: Jakub Sitnicki --- 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