From patchwork Mon Nov 28 22:29:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 700177 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 3tSLvw1b3nz9vF7 for ; Tue, 29 Nov 2016 09:29:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755437AbcK1W3p convert rfc822-to-8bit (ORCPT ); Mon, 28 Nov 2016 17:29:45 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33890 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755318AbcK1W3m (ORCPT ); Mon, 28 Nov 2016 17:29:42 -0500 Received: by mail-pf0-f195.google.com with SMTP id y68so7037440pfb.1 for ; Mon, 28 Nov 2016 14:29:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yHeyIBSKjUj2NoYiF0yWIC3j1gFwHSq1bL3oZIY+BLQ=; b=NPHcwLGZ+bUBGZ0lUjC1t4pflmLCgiqwsK3y9Yxc5GYIxb4YiJ/rimgF4RKq0yElxM OJm57y6AS+mM1td0AWFslypByXlBDJC2qbYhnjLrhk/x3E3cZg2Pe8IRUJu+NJrgMnu8 Oud3zNKe8i1LdG5AcUZNbKiwEY0w7f6x1bPHCTNHbKSIfqHxFJHFmYK9TaenPKf71OKv LOzNTBRvaV6DhHbOrZVRx3OMRtmhkqCR31KdwYTyjuOoHfKPpgK12i5mIMOPuEWxIllI A7yZ+VJ410mBgwJMoM113/vxz7fghy8ZPHnbPOFmbHuCHJPdPN3VfRtY6EhfUtxmFm4s /wrQ== X-Gm-Message-State: AKaTC00nUhR6s9l570fw+5vIdJgxLkfqivOij6ll26WxYgeK6bnlrOWEt4BHVFjsx/e+bQ== X-Received: by 10.99.101.65 with SMTP id z62mr44630591pgb.74.1480372181702; Mon, 28 Nov 2016 14:29:41 -0800 (PST) Received: from htb-1n-eng-dhcp10.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id x123sm71735357pgb.3.2016.11.28.14.29.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 14:29:40 -0800 (PST) Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [PATCH net-next 2/2] openvswitch: Fix skb->protocol for vlan frames. From: Jarno Rajahalme In-Reply-To: <20161124171046.7eb0e287@griffin> Date: Mon, 28 Nov 2016 14:29:39 -0800 Cc: netdev@vger.kernel.org Message-Id: <76814927-D373-4C3A-BC85-5771304235A7@ovn.org> References: <1479874174-75329-1-git-send-email-jarno@ovn.org> <1479874174-75329-2-git-send-email-jarno@ovn.org> <20161124171046.7eb0e287@griffin> To: Jiri Benc X-Mailer: Apple Mail (2.3124) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > On Nov 24, 2016, at 8:10 AM, Jiri Benc wrote: > > On Tue, 22 Nov 2016 20:09:34 -0800, Jarno Rajahalme wrote: >> Do not set skb->protocol to be the ethertype of the L3 header, unless >> the packet only has the L3 header. For a non-hardware offloaded VLAN >> frame skb->protocol needs to be one of the VLAN ethertypes. >> >> Any VLAN offloading is undone on the OVS netlink interface. Due to >> this all VLAN packets sent to openvswitch module from userspace are >> non-offloaded. > > This is exactly why I wanted to always accelerate the vlan tag, the > same way it is done in other parts of the networking stack: to prevent > all those weird corner cases. > > Looks to me this is the only real way forward. > I’m not sure what you suggest here. Obviously the kernel ABI can not be changed as existing userspace code expects upcalled packets to be non-accelerated. Also, if userspace pushes vlan headers, the packet will actually have them. > This patch is wrong, it would leave skb->protocol as ETH_P_TEB for L2 > frames received via ARPHRD_NONE interface. > Would this incremental fix this: Jarno diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 9be9fda..37f1bb9 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -354,6 +354,8 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) res = parse_vlan_tag(skb, &key->eth.vlan); if (res <= 0) return res; + if (skb->protocol == htons(ETH_P_TEB)) + skb->protocol = key->eth.vlan.tpid; } /* Parse inner vlan tag. */