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: 197745 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 09FBD2C00D0 for ; Thu, 8 Nov 2012 12:31:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754701Ab2KHBbI (ORCPT ); Wed, 7 Nov 2012 20:31:08 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:32915 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752935Ab2KHBbH (ORCPT ); Wed, 7 Nov 2012 20:31:07 -0500 Received: by mail-ea0-f174.google.com with SMTP id c13so861810eaa.19 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 Cc: Mircea Gherzan , Arnd Bergmann , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,