diff options
author | Yi Yang <yi.y.yang@intel.com> | 2018-01-11 13:24:01 +0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-01-11 11:46:11 -0800 |
commit | 17553f27baa1d1883bed0d099f20e979cecd4a4c (patch) | |
tree | aaf7b7135045ab177d672435ce01990175609560 /lib/nx-match.c | |
parent | 74868f2c38f931cc355787152ebf9d9e9f1c8b37 (diff) | |
download | openvswitch-17553f27baa1d1883bed0d099f20e979cecd4a4c.tar.gz |
nsh: add new flow key 'ttl'
IETF NSH draft added a new filed ttl in NSH header, this patch
is to add new nsh key 'ttl' for it.
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/nx-match.c')
-rw-r--r-- | lib/nx-match.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/nx-match.c b/lib/nx-match.c index 8f2a442e9..aa7691ae9 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -1022,6 +1022,7 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, const struct flow *flow = &match->flow; const size_t start_len = b->size; ovs_be16 dl_type = get_dl_type(flow); + ovs_be32 spi_mask; int match_len; int i; @@ -1157,13 +1158,22 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, /* Network Service Header */ nxm_put_8m(&ctx, MFF_NSH_FLAGS, oxm, flow->nsh.flags, match->wc.masks.nsh.flags); + nxm_put_8m(&ctx, MFF_NSH_TTL, oxm, flow->nsh.ttl, + match->wc.masks.nsh.ttl); nxm_put_8m(&ctx, MFF_NSH_MDTYPE, oxm, flow->nsh.mdtype, match->wc.masks.nsh.mdtype); nxm_put_8m(&ctx, MFF_NSH_NP, oxm, flow->nsh.np, match->wc.masks.nsh.np); - nxm_put_32m(&ctx, MFF_NSH_SPI, oxm, flow->nsh.spi, - match->wc.masks.nsh.spi); - nxm_put_8m(&ctx, MFF_NSH_SI, oxm, flow->nsh.si, match->wc.masks.nsh.si); + spi_mask = nsh_path_hdr_to_spi(match->wc.masks.nsh.path_hdr); + if (spi_mask == htonl(NSH_SPI_MASK >> NSH_SPI_SHIFT)) { + spi_mask = OVS_BE32_MAX; + } + nxm_put_32m(&ctx, MFF_NSH_SPI, oxm, + nsh_path_hdr_to_spi(flow->nsh.path_hdr), + spi_mask); + nxm_put_8m(&ctx, MFF_NSH_SI, oxm, + nsh_path_hdr_to_si(flow->nsh.path_hdr), + nsh_path_hdr_to_si(match->wc.masks.nsh.path_hdr)); for (int i = 0; i < 4; i++) { nxm_put_32m(&ctx, MFF_NSH_C1 + i, oxm, flow->nsh.context[i], match->wc.masks.nsh.context[i]); |