Signed-off-by: Johnson Li <johnson...@intel.com> diff --git a/lib/odp-util.c b/lib/odp-util.c index 056b0be..1a2d8a5 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -5822,6 +5822,37 @@ commit_vlan_action(ovs_be16 vlan_tci, struct flow *base, base->vlan_tci = vlan_tci; } +static void +commit_nsh_action(const struct flow *flow, + const struct flow *base, + struct ofpbuf *odp_actions) +{ + if (memcmp(&flow->nsh, &base->nsh, sizeof (struct flow_nsh))) { + if (flow->nsh.md_type) { + struct ovs_action_push_nsh push; + struct nsh_header *nsh_hdr = (struct nsh_header *)push.header; + + /* MD Type 1 only, Todo: Type 2 support */ + if (flow->nsh.md_type == NSH_MD_TYPE1 ) { + + nsh_hdr->base.length = NSH_TYPE1_LEN >> 2; + nsh_hdr->base.md_type = NSH_MD_TYPE1; + nsh_hdr->base.next_proto = flow->nsh.next_proto; + nsh_hdr->base.sfp = (flow->nsh.nsp >> 8) | (flow->nsh.nsi << 24); + nsh_hdr->ctx.nshc1 = flow->nsh.nshc1; + nsh_hdr->ctx.nshc2 = flow->nsh.nshc2; + nsh_hdr->ctx.nshc3 = flow->nsh.nshc3; + nsh_hdr->ctx.nshc4 = flow->nsh.nshc4; + + push.len = NSH_TYPE1_LEN; + } + + nl_msg_put_unspec(odp_actions, OVS_ACTION_ATTR_PUSH_NSH, + &push, sizeof push); + } + } +} + /* Wildcarding already done at action translation time. */ static void commit_mpls_action(const struct flow *flow, struct flow *base, @@ -6253,6 +6284,7 @@ commit_odp_actions(const struct flow *flow, struct flow *base, slow2 = commit_set_icmp_action(flow, base, odp_actions, wc); commit_mpls_action(flow, base, odp_actions); commit_vlan_action(flow->vlan_tci, base, odp_actions, wc); + commit_nsh_action(flow, base, odp_actions); commit_set_priority_action(flow, base, odp_actions, wc, use_masked); commit_set_pkt_mark_action(flow, base, odp_actions, wc, use_masked); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index e0d08eb..91ad3e5 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4957,7 +4957,16 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, /* Network Service Header */ case OFPACT_PUSH_NSH: + //flow->base_layer = LAYER_3; + memset(&wc->masks.nsh.md_type, 0xff, sizeof wc->masks.nsh.md_type); + break; + case OFPACT_POP_NSH: + //if(flow->nsh.next_proto == 0x3) + // flow->base_layer = LAYER_2; + memset(&wc->masks.nsh.md_type, 0xff, sizeof wc->masks.nsh.md_type); + memset(&flow->nsh, 0x0, sizeof flow->nsh); + nl_msg_put_flag(ctx->odp_actions, OVS_ACTION_ATTR_POP_NSH); break; } -- 1.8.4.2
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev