From patchwork Thu Nov 8 01:31:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Borkmann X-Patchwork-Id: 1713491 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 892163FCAE for ; Thu, 8 Nov 2012 01:33:45 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TWGxk-0001s1-Mq; Thu, 08 Nov 2012 01:31:21 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TWGxY-0001ks-Ui for linux-arm-kernel@lists.infradead.org; Thu, 08 Nov 2012 01:31:10 +0000 Received: by mail-ee0-f49.google.com with SMTP id c1so1271919eek.36 for ; Wed, 07 Nov 2012 17:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=KCsDLkZ+gyt5CCqv1CGmLwGw/LuqczyxzRSTREpu0w4=; b=RSdhdtVnprOwMAc+XngSZmIG/Gr2XNbjP3ARd7lK4ypMfCEf7MH5oHV2yKDDJetETN IvYagY1Ht3A2tUeXPeBHkhw2iwKGsrtPwY6CzGSYTsQxYS54zAC/evc6o9NPQx6xris+ TSpPK+BAHSXZC6gUOMKl0ryB9hU6J32vhRot++n4VF5O3QFoky1pf8IXwyfq7dgoiCtl yZWP+NZxplx5ihc2H3Co8FjJfVzzuEdt5LXqYxvDAckZR00INlfmW26R35mW9zPyBY5S CmMV5qFthlRx/aLDjh67+15pjlFhploAQc/ehBFc4xPxi+5z+UxraOMTLwxD3+Iz65Ku twNg== Received: by 10.14.179.6 with SMTP id g6mr21453562eem.46.1352338265982; Wed, 07 Nov 2012 17:31:05 -0800 (PST) Received: from thinkbox (74-25.196-178.cust.bluewin.ch. [178.196.25.74]) by mx.google.com with ESMTPS id g47sm67272133eeo.6.2012.11.07.17.31.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 17:31:05 -0800 (PST) Date: Thu, 8 Nov 2012 02:31:02 +0100 From: Daniel Borkmann To: davem@davemloft.net Subject: [PATCH net-next 2/2] ARM: net: bpf_jit_32: add VLAN instructions for BPF JIT Message-ID: <20121108013101.GB23143@thinkbox> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121107_203109_627062_62A15E6A X-CRM114-Status: GOOD ( 14.51 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dxchgb[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Mircea Gherzan , linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch is a follow-up for patch "net: filter: add vlan tag access" to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT. Signed-off-by: Daniel Borkmann Cc: Mircea Gherzan Cc: Arnd Bergmann Acked-by: Mircea Gherzan --- arch/arm/net/bpf_jit_32.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 8be702d..9af9a69 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -168,6 +169,8 @@ static inline bool is_load_to_a(u16 inst) case BPF_S_ANC_MARK: case BPF_S_ANC_PROTOCOL: case BPF_S_ANC_RXHASH: + case BPF_S_ANC_VLAN_TAG: + case BPF_S_ANC_VLAN_TAG_PRESENT: case BPF_S_ANC_QUEUE: return true; default: @@ -815,6 +818,17 @@ b_epilogue: off = offsetof(struct sk_buff, rxhash); emit(ARM_LDR_I(r_A, r_skb, off), ctx); break; + case BPF_S_ANC_VLAN_TAG: + case BPF_S_ANC_VLAN_TAG_PRESENT: + ctx->seen |= SEEN_SKB; + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); + off = offsetof(struct sk_buff, vlan_tci); + emit(ARM_LDRH_I(r_A, r_skb, off), ctx); + if (inst->code == BPF_S_ANC_VLAN_TAG) + OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx); + else + OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx); + break; case BPF_S_ANC_QUEUE: ctx->seen |= SEEN_SKB; BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,