Signed-off-by: Johnson Li <johnson...@intel.com> diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h index e5f9962..344e5b7 100644 --- a/include/openvswitch/meta-flow.h +++ b/include/openvswitch/meta-flow.h @@ -1720,6 +1720,132 @@ enum OVS_PACKED_ENUM mf_field_id { */ MFF_ND_TLL, + /* "nsh_mdtype". + * + * For a packet received, it includes a (8-bit) + * nsh md-type field (md-type). + * + * Type: u8. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_MDTYPE(115) since v2.5. + * OXM: none. + */ + MFF_NSH_MDTYPE, + + /* "nsh_np". + * + * For a packet received, it includes a (8-bit) + * nsh next protocol field (np). + * + * Type: u8. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_NP(116) since v2.5. + * OXM: none. + */ + MFF_NSH_NP, + + /* "nsi". + * + * For a packet received, it includes a (8-bit) + * network service header service index (nsi). + * + * Type: u8. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSI(117) since v2.5. + * OXM: none. + */ + MFF_NSI, + + /* "nsp". + * + * For a packet received including a (32-bit) + * network service header service path (nsp), the nsp is stored + * in the low 24-bits and the high bits are zeroed. For + * other packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSP(118) since v2.5. + * OXM: none. + */ + MFF_NSP, + + /* "nshc1". + * + * For a packet received including a (32-bit) + * Network Platform Context (nshc1), the nshc1 is stored + * in the 32-bits. For other packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_C1(119) since v2.5. + * OXM: none. + */ + MFF_NSH_C1, + + /* "nshc2". + * + * For a packet received including a (32-bit) + * Network Shared Context (nshc2), the nshc2 is stored + * in the 32-bits. For other packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_C2(120) since v2.5. + * OXM: none. + */ + MFF_NSH_C2, + + /* "nshc3". + * + * For a packet received via including a (32-bit) + * Service Platform Context (nshc3), the nshc3 is stored + * in the 32-bits. For other packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_C3(121) since v2.5. + * OXM: none. + */ + MFF_NSH_C3, + + /* "nshc4". + * + * For a packet received including a (32-bit) + * Service Shared Context (nshc4), the nshc4 is stored + * in the 32-bits. For other packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_NSH_C4(122) since v2.5. + * OXM: none. + */ + MFF_NSH_C4, + MFF_N_IDS }; diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 136295d..aa18ad4 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -325,6 +325,23 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc) case MFF_TCP_FLAGS: return !wc->masks.tcp_flags; + case MFF_NSH_MDTYPE: + return !wc->masks.nsh.md_type; + case MFF_NSH_NP: + return !wc->masks.nsh.next_proto; + case MFF_NSI: + return !wc->masks.nsh.nsi; + case MFF_NSP: + return !wc->masks.nsh.nsp; + case MFF_NSH_C1: + return !wc->masks.nsh.nshc1; + case MFF_NSH_C2: + return !wc->masks.nsh.nshc2; + case MFF_NSH_C3: + return !wc->masks.nsh.nshc3; + case MFF_NSH_C4: + return !wc->masks.nsh.nshc4; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -610,6 +627,16 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value) case MFF_CT_STATE: return !(value->be32 & ~htonl(CS_SUPPORTED_MASK)); + case MFF_NSH_MDTYPE: + case MFF_NSH_NP: + case MFF_NSI: + case MFF_NSP: + case MFF_NSH_C1: + case MFF_NSH_C2: + case MFF_NSH_C3: + case MFF_NSH_C4: + return true; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -852,6 +879,31 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow, value->ipv6 = flow->nd_target; break; + case MFF_NSH_MDTYPE: + value->u8 = flow->nsh.md_type; + break; + case MFF_NSH_NP: + value->u8 = flow->nsh.next_proto; + break; + case MFF_NSI: + value->u8 = flow->nsh.nsi; + break; + case MFF_NSP: + value->be32 = flow->nsh.nsp; + break; + case MFF_NSH_C1: + value->be32 = flow->nsh.nshc1; + break; + case MFF_NSH_C2: + value->be32 = flow->nsh.nshc2; + break; + case MFF_NSH_C3: + value->be32 = flow->nsh.nshc3; + break; + case MFF_NSH_C4: + value->be32 = flow->nsh.nshc4; + break; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -1110,6 +1162,31 @@ mf_set_value(const struct mf_field *mf, match_set_nd_target(match, &value->ipv6); break; + case MFF_NSH_MDTYPE: + match_set_nsh_md_type(match, value->u8); + break; + case MFF_NSH_NP: + match_set_nsh_next_proto(match, value->u8); + break; + case MFF_NSI: + match_set_nsi(match, value->u8); + break; + case MFF_NSP: + match_set_nsp(match, value->be32); + break; + case MFF_NSH_C1: + match_set_nshc1(match, value->be32); + break; + case MFF_NSH_C2: + match_set_nshc2(match, value->be32); + break; + case MFF_NSH_C3: + match_set_nshc3(match, value->be32); + break; + case MFF_NSH_C4: + match_set_nshc4(match, value->be32); + break; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -1423,6 +1500,31 @@ mf_set_flow_value(const struct mf_field *mf, flow->nd_target = value->ipv6; break; + case MFF_NSH_MDTYPE: + flow->nsh.md_type = value->u8; + break; + case MFF_NSH_NP: + flow->nsh.next_proto = value->u8; + break; + case MFF_NSI: + flow->nsh.nsi = value->u8; + break; + case MFF_NSP: + flow->nsh.nsp = value->be32; + break; + case MFF_NSH_C1: + flow->nsh.nshc1 = value->be32; + break; + case MFF_NSH_C2: + flow->nsh.nshc2 = value->be32; + break; + case MFF_NSH_C3: + flow->nsh.nshc3 = value->be32; + break; + case MFF_NSH_C4: + flow->nsh.nshc4 = value->be32; + break; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -1747,6 +1849,31 @@ mf_set_wild(const struct mf_field *mf, struct match *match, char **err_str) memset(&match->flow.nd_target, 0, sizeof match->flow.nd_target); break; + case MFF_NSH_MDTYPE: + match_set_nsh_md_type_masked(match, 0, 0); + break; + case MFF_NSH_NP: + match_set_nsh_next_proto_masked(match, 0, 0); + break; + case MFF_NSI: + match_set_nsi_masked(match, 0, 0); + break; + case MFF_NSP: + match_set_nsp_masked(match, htonl(0), htonl(0)); + break; + case MFF_NSH_C1: + match_set_nshc1_masked(match, htonl(0), htonl(0)); + break; + case MFF_NSH_C2: + match_set_nshc2_masked(match, htonl(0), htonl(0)); + break; + case MFF_NSH_C3: + match_set_nshc3_masked(match, htonl(0), htonl(0)); + break; + case MFF_NSH_C4: + match_set_nshc4_masked(match, htonl(0), htonl(0)); + break; + case MFF_N_IDS: default: OVS_NOT_REACHED(); @@ -1970,6 +2097,31 @@ mf_set(const struct mf_field *mf, match_set_tcp_flags_masked(match, value->be16, mask->be16); break; + case MFF_NSH_MDTYPE: + match_set_nsh_md_type_masked(match, value->u8, mask->u8); + break; + case MFF_NSH_NP: + match_set_nsh_next_proto_masked(match, value->u8, mask->u8); + break; + case MFF_NSI: + match_set_nsi_masked(match, value->u8, mask->u8); + break; + case MFF_NSP: + match_set_nsp_masked(match, value->be32, mask->be32); + break; + case MFF_NSH_C1: + match_set_nshc1_masked(match, value->be32, mask->be32); + break; + case MFF_NSH_C2: + match_set_nshc2_masked(match, value->be32, mask->be32); + break; + case MFF_NSH_C3: + match_set_nshc3_masked(match, value->be32, mask->be32); + break; + case MFF_NSH_C4: + match_set_nshc4_masked(match, value->be32, mask->be32); + break; + case MFF_N_IDS: default: OVS_NOT_REACHED(); diff --git a/lib/nx-match.c b/lib/nx-match.c index aad6e02..0c6ab2c 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -1039,6 +1039,22 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, flow->tunnel.gbp_flags, match->wc.masks.tunnel.gbp_flags); tun_metadata_to_nx_match(b, oxm, match); + /* Network Service Header */ + nxm_put_8m(b, MFF_NSH_MDTYPE, oxm, flow->nsh.md_type, + match->wc.masks.nsh.md_type); + nxm_put_8m(b, MFF_NSH_NP, oxm, flow->nsh.next_proto, + match->wc.masks.nsh.next_proto); + nxm_put_8m(b, MFF_NSI, oxm, flow->nsh.nsi, match->wc.masks.nsh.nsi); + nxm_put_32m(b, MFF_NSP, oxm, flow->nsh.nsp, match->wc.masks.nsh.nsp); + nxm_put_32m(b, MFF_NSH_C1, oxm, flow->nsh.nshc1, + match->wc.masks.nsh.nshc1); + nxm_put_32m(b, MFF_NSH_C2, oxm, flow->nsh.nshc2, + match->wc.masks.nsh.nshc2); + nxm_put_32m(b, MFF_NSH_C3, oxm, flow->nsh.nshc3, + match->wc.masks.nsh.nshc3); + nxm_put_32m(b, MFF_NSH_C4, oxm, flow->nsh.nshc4, + match->wc.masks.nsh.nshc4); + /* Registers. */ if (oxm < OFP15_VERSION) { for (i = 0; i < FLOW_N_REGS; i++) { -- 1.8.4.2
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev