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: 538443 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 B008D1412E0 for ; Sat, 31 Oct 2015 04:08:56 +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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759569AbbJ3RIw (ORCPT ); Fri, 30 Oct 2015 13:08:52 -0400 Received: from mail-yk0-f194.google.com ([209.85.160.194]:32866 "EHLO mail-yk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759037AbbJ3RIv (ORCPT ); Fri, 30 Oct 2015 13:08:51 -0400 Received: by ykdr3 with SMTP id r3so6784933ykd.0 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) From: Thomas F Herbert To: netdev@vger.kernel.org, pshelar@nicira.com Cc: therbert@redhat.com, dev@openvswitch.org, Thomas F Herbert Subject: [PATCH net-next V19 2/3] Check for vlan ethernet types for 8021.q or 802.1ad Date: Fri, 30 Oct 2015 13:08:21 -0400 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> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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