From patchwork Wed Jun 25 17:34:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 364097 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 9DCB41400B9 for ; Thu, 26 Jun 2014 03:59:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757948AbaFYR7u (ORCPT ); Wed, 25 Jun 2014 13:59:50 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:45109 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757672AbaFYR7t (ORCPT ); Wed, 25 Jun 2014 13:59:49 -0400 Received: by mail-lb0-f171.google.com with SMTP id s7so2134747lbd.30 for ; Wed, 25 Jun 2014 10:59:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pN6A9VL9lYHnsSMyOlDoBynhpvFnrowUJGzt8YfaUtc=; b=P28CTP0/rzIzcQgLpG8/HkQiB0LmIWksmtIcefulbBRFggvvdcVFhb7p0qapgBMgQK BLpUdykQQYNwaceOkU9aRXh4eoGCf8xyZrJvv94LdMhIUfEqzZVPhIDNiawuR/DqnZiX mPoaw3nHsYjIizy9epkgdYJgGz73QRAD6FryQ0rQbQI3vKdDwFylxumJheMZhUi3jDU9 kAkytcuJVDh6B4AXLZxi7Bbg/sA8pj9+OYqd7mwxVR4zQC7cQTkmfGjamVWa6gQM0/Su eC8JvIMuI1lzNP8lbOOOLqCyOokV/TL7PXoCbl9CZIv9zJuK6bQ3UZrymv3z0IYJOLqh teZw== X-Gm-Message-State: ALoCoQnmEoIDcS514347tWP/TYxKyxYHv2hyRAR9URBifeSmJKhwq1kJIvkQzktuH084a+v1XwFX X-Received: by 10.112.136.73 with SMTP id py9mr1878313lbb.100.1403719188070; Wed, 25 Jun 2014 10:59:48 -0700 (PDT) Received: from localhost.localdomain ([5.35.52.78]) by mx.google.com with ESMTPSA id r4sm4329264lbd.44.2014.06.25.10.59.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jun 2014 10:59:47 -0700 (PDT) From: Denis Kirjanov To: netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Denis Kirjanov Subject: [PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag Date: Wed, 25 Jun 2014 21:34:56 +0400 Message-Id: <1403717697-3911-1-git-send-email-kda@linux-powerpc.org> X-Mailer: git-send-email 2.0.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org To get a full tag (and not just a VID) we should access the TCI except the VLAN_TAG_PRESENT field (which means that 802.1q header is present). Also ensure that the VLAN_TAG_PRESENT stay on its place Signed-off-by: Denis Kirjanov --- arch/powerpc/net/bpf_jit_comp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 6dcdade..892167b 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -390,10 +390,12 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, case BPF_ANC | SKF_AD_VLAN_TAG: case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); + BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); + PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, vlan_tci)); if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) - PPC_ANDI(r_A, r_A, VLAN_VID_MASK); + PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT); else PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); break;