- /* If mpls_depth_delta is negative then an MPLS POP action has been
- * composed and the resulting MPLS label stack is unknown. This means
- * an MPLS PUSH action can't be composed as it needs to know either the
- * top-most MPLS LSE to use as a template for the new MPLS LSE, or that
- * there is no MPLS label stack present. Thus, stop processing.
- *
- * If mpls_depth_delta is positive then an MPLS PUSH action has been
- * composed and no further MPLS PUSH action may be performed without
- * losing MPLS LSE and ether type information held in xtx->xin->flow.
- * Thus, stop processing.
- *
- * If the MPLS LSE of the flow and base_flow differ then the MPLS LSE
- * has been updated. Performing a MPLS PUSH action may be would result in
- * losing MPLS LSE and ether type information held in xtx->xin->flow.
- * Thus, stop processing.
- *
- * It is planned that in the future this case will be handled
- * by recirculation */
- if (ctx->mpls_depth_delta ||
- ctx->xin->flow.mpls_lse != ctx->base_flow.mpls_lse) {
- return true;
- }
-
- memset(&wc->masks.mpls_lse, 0xff, sizeof wc->masks.mpls_lse);
-
- ctx->pre_push_mpls_lse = ctx->xin->flow.mpls_lse;
-
- if (eth_type_mpls(ctx->xin->flow.dl_type)) {
- flow->mpls_lse &= ~htonl(MPLS_BOS_MASK);
- } else {
- ovs_be32 label;
- uint8_t tc, ttl;
-
- if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
- label = htonl(0x2); /* IPV6 Explicit Null. */
- } else {
- label = htonl(0x0); /* IPV4 Explicit Null. */
+ n = flow_count_mpls_labels(flow, wc);
+ if (!n) {
+ ctx->xout->slow |= commit_odp_actions(flow, &ctx->base_flow,
+ &ctx->xout->odp_actions,
+ &ctx->xout->wc);
+ } else if (n >= FLOW_MAX_MPLS_LABELS) {
+ if (ctx->xin->packet != NULL) {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+ VLOG_WARN_RL(&rl, "bridge %s: dropping packet on which an "
+ "MPLS push action can't be performed as it would "
+ "have more MPLS LSEs than the %d supported.",
+ ctx->xbridge->name, FLOW_MAX_MPLS_LABELS);