Message ID | 20230108151258.96570-1-haiyue.wang@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1743915wrt; Sun, 8 Jan 2023 07:17:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvB9lzIwKDz0xJg4lnEc0KQMzHPbh+VITBcG89iKl3aeC4tfsYXSOEbK+bysT4gjizznBqK X-Received: by 2002:a17:907:8c8e:b0:7c0:e0d9:c1df with SMTP id td14-20020a1709078c8e00b007c0e0d9c1dfmr51083673ejc.10.1673191034605; Sun, 08 Jan 2023 07:17:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673191034; cv=none; d=google.com; s=arc-20160816; b=h7iUGPZaOCnOp8oTUIb+3JU/Kv50Sx7p15elOuFOlRouf2kvqMlrpksSv3t/YJnmcE Js64hGyiGtziwISV8aSYTKF3J3Bu6zJaoNmIdfcv2btLRGEyiRCc8AiZiwo33Ul4pk/N VWn3idwjcEE1Y8QjeAnxmh8CoYEzBVvLI8Iva3Cq9tG+N7OKsMGjtBQg5Pqv7kodi8MQ FK06pvFGdIWeHTc14JhFO4v1Q0rHBllCQg4jpq9hbwsYayY8mxVgvVYqpNYoq+gDXxfq kjqMm/VK100ZJHGgymJrkksxoXSiyxajJr4IN5wcVp7Zq2WdmgovROqdT1EjfFaDD7cc K9Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cXUARWNvFBraPR/TqGDbpmKZTuVrv1IucQXTOicOVDo=; b=d2+DCghUEDxdVZJGSq2GeWDNG77jJHhANgM8czwHOLolrchkqu5Jcrf6g81ilzzSbG pAzxqpLdGlMmZNuNHEGAQ9sq7ain+EVKsCDjBC72yN2dJeLC8wTWW0xbF5xrvqOlyZl9 pwWQcYCBytan83zrXayR1KMMLiPrjde3mtz7uH8Gko19M9rCNdsqiLpGYlw0LleogKfg OEckJ1lPB6bxrJQuVyUaobU9NnmVZRx9vjurvXf/gomkY30CrW4fprHAkDNb3UFGaNWL aF79oon1/5pyj/fTLyXONAFvCa8w4Gs9n6VeCtaN+JwHa75KaifO/wneRC69LGEc1LyZ lVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqIlfoQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr20-20020a170906d55400b007a8beb3aa4csi7505622ejc.872.2023.01.08.07.16.50; Sun, 08 Jan 2023 07:17:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqIlfoQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbjAHPLk (ORCPT <rfc822;dolce.eric@gmail.com> + 99 others); Sun, 8 Jan 2023 10:11:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjAHPLj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 8 Jan 2023 10:11:39 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A7E6265; Sun, 8 Jan 2023 07:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673190698; x=1704726698; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3aSyeGbeMNfHDYKc5OXsAMpLIkaVT1dnok7Bt0nCv9I=; b=FqIlfoQ0wMhk/JOx5a6VgPu+3qZX/eRX88Pm9rJZCSGcJ/p2vEvCyfRo IkqWchwOC/2gPynA3xt56ONgxpTORstYLuj2rSDCUqCDIzLboPr1L91XK S7gHTMdMTtfAi5xjHFriN6beO77fFLy2wilS3QykNW8RwAr5gqpcoz7ab ogKiwh5th7kk64ZupRo+sNBawxKgwBeNM6VddvZbFUZXlB3bM3gyYwPr9 3t0c2VyGerkYjlG7Jc6hi8VzKXWFVLTWf+779mEZs1E5q3WDGtuDqCfxj kWj7I5Q8SVIrANbc+wSeUQbZioIV9IX1lavD23pLhdKCxOSymvrMtV6e9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="349941525" X-IronPort-AV: E=Sophos;i="5.96,310,1665471600"; d="scan'208";a="349941525" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2023 07:11:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="658348255" X-IronPort-AV: E=Sophos;i="5.96,310,1665471600"; d="scan'208";a="658348255" Received: from sse-cse-haiyue-nuc.sh.intel.com ([10.239.241.114]) by fmsmga007.fm.intel.com with ESMTP; 08 Jan 2023 07:11:33 -0800 From: Haiyue Wang <haiyue.wang@intel.com> To: bpf@vger.kernel.org Cc: Haiyue Wang <haiyue.wang@intel.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org (open list:BPF [NETWORKING] (tc BPF, sock_addr)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison Date: Sun, 8 Jan 2023 23:12:57 +0800 Message-Id: <20230108151258.96570-1-haiyue.wang@intel.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754467962273748546?= X-GMAIL-MSGID: =?utf-8?q?1754467962273748546?= |
Series |
[bpf-next,v1] bpf: Remove the unnecessary insn buffer comparison
|
|
Commit Message
Haiyue Wang
Jan. 8, 2023, 3:12 p.m. UTC
The variable 'insn' is initialized to 'insn_buf' without being changed,
only some helper macros are defined, so the insn buffer comparison is
unnecessary, just remove it.
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
net/core/filter.c | 6 ------
1 file changed, 6 deletions(-)
Comments
On 01/08, Haiyue Wang wrote: > The variable 'insn' is initialized to 'insn_buf' without being changed, > only some helper macros are defined, so the insn buffer comparison is > unnecessary, just remove it. > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> Acked-by: Stanislav Fomichev <sdf@google.com> Looks like these should have been removed as part of commit 2377b81de527 ("bpf: split shared bpf_tcp_sock and bpf_sock_ops implementation"). > --- > net/core/filter.c | 6 ------ > 1 file changed, 6 deletions(-) > diff --git a/net/core/filter.c b/net/core/filter.c > index ab811293ae5d..d9befa6ba04e 100644 > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -6847,9 +6847,6 @@ u32 bpf_tcp_sock_convert_ctx_access(enum > bpf_access_type type, > FIELD)); \ > } while (0) > - if (insn > insn_buf) > - return insn - insn_buf; > - > switch (si->off) { > case offsetof(struct bpf_tcp_sock, rtt_min): > BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) != > @@ -10147,9 +10144,6 @@ static u32 sock_ops_convert_ctx_access(enum > bpf_access_type type, > SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ); \ > } while (0) > - if (insn > insn_buf) > - return insn - insn_buf; > - > switch (si->off) { > case offsetof(struct bpf_sock_ops, op): > *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_sock_ops_kern, > -- > 2.39.0
> -----Original Message----- > From: sdf@google.com <sdf@google.com> > Sent: Tuesday, January 10, 2023 01:39 > To: Wang, Haiyue <haiyue.wang@intel.com> > Cc: bpf@vger.kernel.org; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann <daniel@iogearbox.net>; > Andrii Nakryiko <andrii@kernel.org>; Martin KaFai Lau <martin.lau@linux.dev>; Song Liu > <song@kernel.org>; Yonghong Song <yhs@fb.com>; John Fastabend <john.fastabend@gmail.com>; KP Singh > <kpsingh@kernel.org>; Hao Luo <haoluo@google.com>; Jiri Olsa <jolsa@kernel.org>; David S. Miller > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; netdev@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison > > On 01/08, Haiyue Wang wrote: > > The variable 'insn' is initialized to 'insn_buf' without being changed, > > only some helper macros are defined, so the insn buffer comparison is > > unnecessary, just remove it. > > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > > Acked-by: Stanislav Fomichev <sdf@google.com> > > Looks like these should have been removed as part of commit 2377b81de527 > ("bpf: split shared bpf_tcp_sock and bpf_sock_ops implementation"). > Thanks for the information, yes, it was missed. ;-) > > --- > > net/core/filter.c | 6 ------ > > 1 file changed, 6 deletions(-) > > > -- > > 2.39.0
Hello: This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <daniel@iogearbox.net>: On Sun, 8 Jan 2023 23:12:57 +0800 you wrote: > The variable 'insn' is initialized to 'insn_buf' without being changed, > only some helper macros are defined, so the insn buffer comparison is > unnecessary, just remove it. > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > --- > net/core/filter.c | 6 ------ > 1 file changed, 6 deletions(-) Here is the summary with links: - [bpf-next,v1] bpf: Remove the unnecessary insn buffer comparison https://git.kernel.org/bpf/bpf-next/c/66cf99b55e58 You are awesome, thank you!
diff --git a/net/core/filter.c b/net/core/filter.c index ab811293ae5d..d9befa6ba04e 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6847,9 +6847,6 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, FIELD)); \ } while (0) - if (insn > insn_buf) - return insn - insn_buf; - switch (si->off) { case offsetof(struct bpf_tcp_sock, rtt_min): BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) != @@ -10147,9 +10144,6 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type, SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ); \ } while (0) - if (insn > insn_buf) - return insn - insn_buf; - switch (si->off) { case offsetof(struct bpf_sock_ops, op): *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_sock_ops_kern,