public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Thomas F Herbert <thomasfherbert-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org>
To: netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	pshelar-l0M0P4e3n4LQT0dZR+AlfA@public•gmane.org
Cc: dev-yBygre7rU0TnMu66kgdUjQ@public•gmane.org,
	therbert-H+wXaHxf7aLQT0dZR+AlfA@public•gmane.org
Subject: [PATCH net-next V20 2/3] Check for vlan ethernet types for 8021.q or 802.1ad
Date: Thu,  5 Nov 2015 14:34:04 -0500	[thread overview]
Message-ID: <1446752045-5227-3-git-send-email-thomasfherbert@gmail.com> (raw)
In-Reply-To: <1446752045-5227-1-git-send-email-thomasfherbert-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 <thomasfherbert@gmail•com>
---
 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
-- 
2.4.3

_______________________________________________
dev mailing list
dev@openvswitch•org
http://openvswitch.org/mailman/listinfo/dev

  parent reply	other threads:[~2015-11-05 19:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 19:34 [PATCH net-next V20 0/3] openvswitch: Add support for 802.1ad Thomas F Herbert
2015-11-05 19:34 ` [PATCH net-dev V20 1/3] openvswitch: 802.1ad uapi changes Thomas F Herbert
     [not found] ` <1446752045-5227-1-git-send-email-thomasfherbert-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-11-05 19:34   ` Thomas F Herbert [this message]
2015-11-05 19:34 ` [PATCH net-next V20 3/3] openvswitch: 802.1AD: Flow handling, actions, vlan parsing and netlink attributes Thomas F Herbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446752045-5227-3-git-send-email-thomasfherbert@gmail.com \
    --to=thomasfherbert-re5jqeeqqe8avxtiumwx3w@public$(echo .)gmane.org \
    --cc=dev-yBygre7rU0TnMu66kgdUjQ@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=pshelar-l0M0P4e3n4LQT0dZR+AlfA@public$(echo .)gmane.org \
    --cc=therbert-H+wXaHxf7aLQT0dZR+AlfA@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox