Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6980033ybi; Mon, 8 Jul 2019 12:03:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO6ndUE7OkPX1JXwPV+D0bSbRg+hA+DTKmvMlnhSM3eXM1SaEAPHh927tses2IbCdIFavD X-Received: by 2002:a17:90a:d14b:: with SMTP id t11mr27744217pjw.79.1562612617532; Mon, 08 Jul 2019 12:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562612617; cv=none; d=google.com; s=arc-20160816; b=MNkC7apB6zG9zjjto6JwIr4J2PvkZ4EaiNCcNdf1wXlTAdrkxp+1iTVoWFcrH2Esbf qdlt3wiuVeSXd3ncL0nYPaCFltFcj/icPnlN3xreveMIJMcYuXqDYEEljWP+R2znuG0g 8lGC6xU2Vd1kr//lhFmhbXGTwDkjpY0MQD1nZ0sOuvMBzYl3SNNvZfRI3iybbCFGN5Tl jmO2P0ZmCS8NRgXXN540hn2rqVDf97mQRtVPjt49fQq0bs0hTyzMbO8kfqsbSr80TlVQ dLGd7gAVqHciUpSO7wUrVofKiR5NgulFjZWxxP91Ysh5Do+RCL7TGi89hdJL/YbMPegj VuEw== 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=9sp/tZgDFKZU93dnNpAW0b42FyVjdurtoOYWEUaBdt4=; b=mXiOIqw186lZT4EgONxQsTcFF62FJHwCkrsAEXEienhaNPBpePTILehKos/8YpEkqG pOl84y6dmYSmgycSX+d/osm/LwkipAsGuHmPeMWNbOldhM+cyIP51JH0EeVf7L3IcdAb prdXgtppVLg6wjcX8RvCLtQZECmXodoKQMNwBK7Dkatc3jENaGV98nY6OEInGaQjkixf vOT28m6HdAm7QFBHNpqasTX5NAqaukL7y8RmgaNTzxUsyvIGjkSlaYXMHkBGvIEZ20SD DYasG+1JEKOGGha3Pcjz/tCdZhHO0hJvDXGe6qgFlzXfBwhQaXI2dHRayeH2vCDnX3Up mLBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MNqwKhb5; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si20573483pfh.100.2019.07.08.12.03.22; Mon, 08 Jul 2019 12:03:37 -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=@google.com header.s=20161025 header.b=MNqwKhb5; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731387AbfGHNzw (ORCPT + 99 others); Mon, 8 Jul 2019 09:55:52 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38093 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727401AbfGHNzu (ORCPT ); Mon, 8 Jul 2019 09:55:50 -0400 Received: by mail-wm1-f66.google.com with SMTP id s15so16571932wmj.3 for ; Mon, 08 Jul 2019 06:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9sp/tZgDFKZU93dnNpAW0b42FyVjdurtoOYWEUaBdt4=; b=MNqwKhb54VaXXVvgOIOJY1T5x7WYZBPhD3LvMNi4dxS18G0fkn22x/kmi92jSG5P0R mlLrlJZjU3VGoquvDlACk8vmjE2c3NYlXMaYzWRlQr0k3sAy1PI7irBbB2OGRwyAKO5x 8GiOEucxVVhTVEZ42wAFrSJgQl1cm6CkIZW1SPxiuaa5GPpBswiU7/RgHhzT1//iU54I w1O1Ie6zZhst9ZqvSCysxAOvg4ELDX8gRm5SWzvvhkurPMCMOCzom+ybHb9BSeQr7U+0 4eAaZKLU0RYwTW+jXOBOJ+GqATqgegWOseaSCWLwNFKo4IBLJY04hBCYRuW7sUp2+uQS KngA== 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=9sp/tZgDFKZU93dnNpAW0b42FyVjdurtoOYWEUaBdt4=; b=VR6iJn86NvGojczJJxcyRWjTHugrSfXk/jQhf0vqmdBsyVqFp5zPL63XENw0aIGapc WuEF8c8uF80t7T79NYRgjCIgIVXLYLlUjQ9k/lq8oOZa/63+XU4NRjGtSN3DzVRFrvVj PbV6123HMB7IuQ1Jnji3FfA6KPtPqWHTHqWB7nkeUE+1io+lFEv56OsazjaYQgAT07iH F36mQTLgspeAtGAKM5eTajs5A69oonwFQw95sWFvEk5Zl3uXu8D3mEERYfqJ6YDG6lB9 48kGhN1XkCttXUI6lW/MDAQRjo/Q3veTOpBsG4mdr2QP1CQe76IyKU8Rt62EUZM7oP7G XE3A== X-Gm-Message-State: APjAAAUvhIZJiN6CkB+2OwZX7AdaaIw5G4mV8sdhhGjeyRIcSUajuv3e y9yqc3HB8NsBd9m2W+n09JNWP85BPccK8bO2Q+xzxw== X-Received: by 2002:a05:600c:1008:: with SMTP id c8mr17201666wmc.133.1562594147798; Mon, 08 Jul 2019 06:55:47 -0700 (PDT) MIME-Version: 1.0 References: <20190708125733.3944836-1-arnd@arndb.de> <20190708125733.3944836-2-arnd@arndb.de> In-Reply-To: <20190708125733.3944836-2-arnd@arndb.de> From: Soheil Hassas Yeganeh Date: Mon, 8 Jul 2019 09:55:11 -0400 Message-ID: Subject: Re: [PATCH net-next 2/2] bpf: avoid unused variable warning in tcp_bpf_rtt() To: Arnd Bergmann Cc: Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Priyaranjan Jha , Yuchung Cheng , Stanislav Fomichev , Martin KaFai Lau , Song Liu , Yonghong Song , Neal Cardwell , Jason Baron , Yafang Shao , Ard Biesheuvel , netdev , linux-kernel , bpf@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 Mon, Jul 8, 2019 at 8:57 AM Arnd Bergmann wrote: > > When CONFIG_BPF is disabled, we get a warning for an unused > variable: > > In file included from drivers/target/target_core_device.c:26: > include/net/tcp.h:2226:19: error: unused variable 'tp' [-Werror,-Wunused-variable] > struct tcp_sock *tp = tcp_sk(sk); > > The variable is only used in one place, so it can be > replaced with its value there to avoid the warning. > > Fixes: 23729ff23186 ("bpf: add BPF_CGROUP_SOCK_OPS callback that is executed on every RTT") > Signed-off-by: Arnd Bergmann Acked-by: Soheil Hassas Yeganeh > --- > include/net/tcp.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/include/net/tcp.h b/include/net/tcp.h > index e16d8a3fd3b4..cca3c59b98bf 100644 > --- a/include/net/tcp.h > +++ b/include/net/tcp.h > @@ -2223,9 +2223,7 @@ static inline bool tcp_bpf_ca_needs_ecn(struct sock *sk) > > static inline void tcp_bpf_rtt(struct sock *sk) > { > - struct tcp_sock *tp = tcp_sk(sk); > - > - if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTT_CB_FLAG)) > + if (BPF_SOCK_OPS_TEST_FLAG(tcp_sk(sk), BPF_SOCK_OPS_RTT_CB_FLAG)) > tcp_call_bpf(sk, BPF_SOCK_OPS_RTT_CB, 0, NULL); > } > > -- > 2.20.0 >