From patchwork Fri Oct 30 17:08:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas F Herbert X-Patchwork-Id: 538442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 164091412DF for ; Sat, 31 Oct 2015 04:08:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=eDSyVEA5; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 4E3F5106CF; Fri, 30 Oct 2015 10:08:55 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 6E4B6106CE for ; Fri, 30 Oct 2015 10:08:53 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id E48184202C2 for ; Fri, 30 Oct 2015 11:08:52 -0600 (MDT) X-ASG-Debug-ID: 1446224932-09eadd4c8f618440001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id AcQGmW5gRMHR7BeO (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 30 Oct 2015 11:08:52 -0600 (MDT) X-Barracuda-Envelope-From: thomasfherbert@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mail-yk0-f196.google.com) (209.85.160.196) by mx1-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 30 Oct 2015 17:08:52 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _netblocks.google.com designates 209.85.160.196 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.85.160.196 X-Barracuda-RBL-IP: 209.85.160.196 Received: by ykba4 with SMTP id a4so6797643ykb.3 for ; Fri, 30 Oct 2015 10:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CaTvbM/aQmj6ujVmq3caCVCHLS0QSvLqYHQVTvk7OQI=; b=eDSyVEA5SSUhGdlB/oaTV21D9rC7TxIlJHXgRI0LM+2fQNMnlMOjxCjuO/l/JRkNvF dWV/alPyvx3XXF2U44UzytQhXGfhcFB4rvQvFUrwunIRhVPX3HowTKXFc9kMkuWh8jVF a+70PGzi/+FLXzs5iSlqQXZuwYRzvFkbeGJlhDyIe/oa5zq4aBKEl3+n9xaLSgRxV7T8 RUbgLZNdaOF4n1Iw9U/R5V6h2SlK2Qjs+SfE+++XBohrEb5anAQKGlbGg7oAt7MYpO1C s1T0NVUgXa8eHsADLhizO8jBG+ecBoE0SZCWq4Rmr54acFw3bXSQOkAuiD/o/LWyqhyo 6tMw== X-Received: by 10.13.201.199 with SMTP id l190mr6838309ywd.39.1446224931098; Fri, 30 Oct 2015 10:08:51 -0700 (PDT) Received: from localhost.localdomain (pool-173-53-26-105.rcmdva.fios.verizon.net. [173.53.26.105]) by smtp.gmail.com with ESMTPSA id m127sm4575200ywe.8.2015.10.30.10.08.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Oct 2015 10:08:50 -0700 (PDT) X-CudaMail-Envelope-Sender: thomasfherbert@gmail.com From: Thomas F Herbert To: netdev@vger.kernel.org, pshelar@nicira.com X-CudaMail-MID: CM-E2-1029055970 X-CudaMail-DTE: 103015 X-CudaMail-Originating-IP: 209.85.160.196 Date: Fri, 30 Oct 2015 13:08:21 -0400 X-ASG-Orig-Subj: [##CM-E2-1029055970##][PATCH net-next V19 2/3] Check for vlan ethernet types for 8021.q or 802.1ad Message-Id: <1446224902-21246-3-git-send-email-thomasfherbert@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1446224902-21246-1-git-send-email-thomasfherbert@gmail.com> References: <1446224902-21246-1-git-send-email-thomasfherbert@gmail.com> X-GBUdb-Analysis: 0, 209.85.160.196, Ugly c=0.313739 p=-0.333333 Source Normal X-MessageSniffer-Rules: 0-0-0-4274-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1446224932 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, DKIM_SIGNED, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.23959 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: dev@openvswitch.org, therbert@redhat.com Subject: [ovs-dev] [PATCH net-next V19 2/3] Check for vlan ethernet types for 8021.q or 802.1ad X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This is to simplify using double tagged vlans. This function allows all valid vlan ethertypes to be checked in a single function call. Signed-off-by: Thomas F Herbert --- include/linux/if_vlan.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 67ce5bd..d2494b5 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -627,6 +627,22 @@ static inline netdev_features_t vlan_features_check(const struct sk_buff *skb, return features; } +/** + * eth_type_vlan - check for valid vlan ether type. + * @ethertype: ether type to check + * + * Returns true if the ether type is a vlan ether type. + */ +static inline bool eth_type_vlan(__be16 ethertype) +{ + switch (ethertype) { + case htons(ETH_P_8021Q): + case htons(ETH_P_8021AD): + return true; + default: + return false; + } +} /** * compare_vlan_header - Compare two vlan headers