summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Mpls.h
diff options
context:
space:
mode:
authorSorin Vinturis <svinturis@cloudbasesolutions.com>2016-02-02 10:41:28 +0000
committerGurucharan Shetty <guru@ovn.org>2016-02-02 08:25:10 -0800
commita36c1701a6218a97080fda2d386cfc4db97c5bce (patch)
treeb56d29f3eb93794cdd5f880b9ce8be9282e2476d /datapath-windows/ovsext/Mpls.h
parent5874d571188500ec7aa6d98c778347c6774c3a24 (diff)
downloadopenvswitch-a36c1701a6218a97080fda2d386cfc4db97c5bce.tar.gz
datapath-windows: Accept MPLS feature probe.
Currently all feature probe messages sent from userspace are suppressed by the OVS extension. This patch changes the current behaviour to allow feature probe for MPLS. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Mpls.h')
-rw-r--r--datapath-windows/ovsext/Mpls.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Mpls.h b/datapath-windows/ovsext/Mpls.h
index 6e53e46db..084613f1a 100644
--- a/datapath-windows/ovsext/Mpls.h
+++ b/datapath-windows/ovsext/Mpls.h
@@ -53,4 +53,28 @@ OvsEthertypeIsMpls(ovs_be16 ethertype)
ethertype == htons(ETH_TYPE_MPLS_MCAST);
}
+/* Returns the number of MPLS LSEs present in 'a'
+ *
+ * Counts 'flow''s MPLS label stack entries (LESs) stopping at the first
+ * entry that has the bottom of stack (BOS) bit set. If no such entry exists,
+ * then zero is returned, meaning that the maximum number of supported
+ * MPLS LSEs exceeded.
+ */
+__inline UINT32
+OvsCountMplsLabels(PNL_ATTR a)
+{
+ const MPLSHdr *mpls = NlAttrGet(a);
+ UINT32 count = 0;
+ BOOLEAN bos = FALSE;
+
+ for (count = 0; count < FLOW_MAX_MPLS_LABELS; count++) {
+ if ((mpls + count)->lse & htonl(MPLS_BOS_MASK)) {
+ bos = TRUE;
+ break;
+ }
+ }
+
+ return bos ? ++count : 0;
+}
+
#endif /* __MPLS_H_ */