aboutsummaryrefslogtreecommitdiff
path: root/lib/packets.h
diff options
context:
space:
mode:
authorAndy Zhou <azhou@nicira.com>2013-06-19 07:15:10 +0000
committerBen Pfaff <blp@nicira.com>2013-06-20 10:33:51 -0700
commite6cc0babc25de1800aeffad66d2804e64e5bd602 (patch)
tree72cc541897276ff2d6a656c65156caf82a55677d /lib/packets.h
parenta1c564be1e2ffc31f8da09ab654c8ed987907fe5 (diff)
ovs-dpctl: Add mega flow support
Added support to allow mega flow specified and displayed. ovs-dpctl tool is mainly used as debugging tool. This patch also implements the low level user space routines to send and receive mega flow netlink messages. Those netlink suppor routines are required for forthcoming user space mega flow patches. Added a unit test to test parsing and display of mega flows. Ethan contributed the ovs-dpctl mega flow output function. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/packets.h')
-rw-r--r--lib/packets.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/packets.h b/lib/packets.h
index b73ff63f..cc9ab3df 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -259,6 +259,7 @@ BUILD_ASSERT_DECL(LLC_SNAP_HEADER_LEN == sizeof(struct llc_snap_header));
#define VLAN_PCP_SHIFT 13
#define VLAN_CFI 0x1000
+#define VLAN_CFI_SHIFT 12
/* Given the vlan_tci field from an 802.1Q header, in network byte order,
* returns the VLAN ID in host byte order. */
@@ -276,6 +277,14 @@ vlan_tci_to_pcp(ovs_be16 vlan_tci)
return (ntohs(vlan_tci) & VLAN_PCP_MASK) >> VLAN_PCP_SHIFT;
}
+/* Given the vlan_tci field from an 802.1Q header, in network byte order,
+ * returns the Canonical Format Indicator (CFI). */
+static inline int
+vlan_tci_to_cfi(ovs_be16 vlan_tci)
+{
+ return (vlan_tci & htons(VLAN_CFI)) != 0;
+}
+
#define VLAN_HEADER_LEN 4
struct vlan_header {
ovs_be16 vlan_tci; /* Lowest 12 bits are VLAN ID. */