+/* Modifies 'match' so that the MPLS label 'idx' matches 'lse' exactly. */
+void
+match_set_mpls_lse(struct match *match, int idx, ovs_be32 lse)
+{
+ match->wc.masks.mpls_lse[idx] = OVS_BE32_MAX;
+ match->flow.mpls_lse[idx] = lse;
+}
+
+/* Modifies 'match' so that the MPLS label is wildcarded. */
+void
+match_set_any_mpls_label(struct match *match, int idx)
+{
+ match->wc.masks.mpls_lse[idx] &= ~htonl(MPLS_LABEL_MASK);
+ flow_set_mpls_label(&match->flow, idx, htonl(0));
+}
+
+/* Modifies 'match' so that it matches only packets with an MPLS header whose
+ * label equals the low 20 bits of 'mpls_label'. */
+void
+match_set_mpls_label(struct match *match, int idx, ovs_be32 mpls_label)
+{
+ match->wc.masks.mpls_lse[idx] |= htonl(MPLS_LABEL_MASK);
+ flow_set_mpls_label(&match->flow, idx, mpls_label);
+}
+
+/* Modifies 'match' so that the MPLS TC is wildcarded. */
+void
+match_set_any_mpls_tc(struct match *match, int idx)
+{
+ match->wc.masks.mpls_lse[idx] &= ~htonl(MPLS_TC_MASK);
+ flow_set_mpls_tc(&match->flow, idx, 0);
+}
+
+/* Modifies 'match' so that it matches only packets with an MPLS header whose
+ * Traffic Class equals the low 3 bits of 'mpls_tc'. */
+void
+match_set_mpls_tc(struct match *match, int idx, uint8_t mpls_tc)
+{
+ match->wc.masks.mpls_lse[idx] |= htonl(MPLS_TC_MASK);
+ flow_set_mpls_tc(&match->flow, idx, mpls_tc);
+}
+
+/* Modifies 'match' so that the MPLS stack flag is wildcarded. */
+void
+match_set_any_mpls_bos(struct match *match, int idx)
+{
+ match->wc.masks.mpls_lse[idx] &= ~htonl(MPLS_BOS_MASK);
+ flow_set_mpls_bos(&match->flow, idx, 0);
+}
+
+/* Modifies 'match' so that it matches only packets with an MPLS header whose
+ * Stack Flag equals the lower bit of 'mpls_bos' */
+void
+match_set_mpls_bos(struct match *match, int idx, uint8_t mpls_bos)
+{
+ match->wc.masks.mpls_lse[idx] |= htonl(MPLS_BOS_MASK);
+ flow_set_mpls_bos(&match->flow, idx, mpls_bos);
+}
+
+/* Modifies 'match' so that the MPLS LSE is wildcarded. */
+void
+match_set_any_mpls_lse(struct match *match, int idx)
+{
+ match->wc.masks.mpls_lse[idx] = htonl(0);
+ flow_set_mpls_lse(&match->flow, idx, htonl(0));
+}
+