Re: [ovs-dev] [branch-2.7 2/4] nx-match: Use vl_mff_map to parse match field.
Looks good to me: Acked-by: Jarno Rajahalme > On Mar 15, 2017, at 4:01 PM, Joe Stringer wrote: > > From: Yi-Hung Wei > > vl_mff_map is introduced in commit 04f48a68c428 ("ofp-actions: Fix variable > length meta-flow OXMs") to account variable length mf_field, and it is used > to decode variable length mf_field in ofp_action. In this patch, vl_mff_map > is further used to decode the variable length match field as well. > > Signed-off-by: Yi-Hung Wei > Signed-off-by: Joe Stringer > --- > include/openvswitch/ofp-util.h | 6 ++-- > lib/learning-switch.c | 2 +- > lib/nx-match.c | 46 > lib/nx-match.h | 7 ++-- > lib/ofp-print.c| 4 +-- > lib/ofp-util.c | 80 +- > ofproto/ofproto.c | 11 +++--- > ovn/controller/pinctrl.c | 2 +- > tests/ofproto.at | 15 +--- > utilities/ovs-ofctl.c | 13 +++ > 10 files changed, 123 insertions(+), 63 deletions(-) > > diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h > index 0c3a10aa4264..e73a942a3e15 100644 > --- a/include/openvswitch/ofp-util.h > +++ b/include/openvswitch/ofp-util.h > @@ -222,7 +222,7 @@ void ofputil_match_to_ofp10_match(const struct match *, > struct ofp10_match *); > > /* Work with ofp11_match. */ > enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, const struct tun_table > *, > - struct match *, > + const struct vl_mff_map *, struct match > *, > uint16_t *padded_match_len); > enum ofperr ofputil_pull_ofp11_mask(struct ofpbuf *, struct match *, > struct mf_bitmap *bm); > @@ -352,7 +352,7 @@ struct ofputil_flow_stats_request { > > enum ofperr ofputil_decode_flow_stats_request( > struct ofputil_flow_stats_request *, const struct ofp_header *, > -const struct tun_table *); > +const struct tun_table *, const struct vl_mff_map *); > struct ofpbuf *ofputil_encode_flow_stats_request( > const struct ofputil_flow_stats_request *, enum ofputil_protocol); > > @@ -457,6 +457,7 @@ void ofputil_packet_in_destroy(struct ofputil_packet_in > *); > > enum ofperr ofputil_decode_packet_in(const struct ofp_header *, bool loose, > const struct tun_table *, > + const struct vl_mff_map *, > struct ofputil_packet_in *, > size_t *total_len, uint32_t *buffer_id, > struct ofpbuf *continuation); > @@ -509,6 +510,7 @@ struct ofpbuf *ofputil_encode_packet_in_private( > enum ofperr ofputil_decode_packet_in_private( > const struct ofp_header *, bool loose, > const struct tun_table *, > +const struct vl_mff_map *, > struct ofputil_packet_in_private *, > size_t *total_len, uint32_t *buffer_id); > > diff --git a/lib/learning-switch.c b/lib/learning-switch.c > index bc757f46dd7a..77155d04fcc0 100644 > --- a/lib/learning-switch.c > +++ b/lib/learning-switch.c > @@ -523,7 +523,7 @@ process_packet_in(struct lswitch *sw, const struct > ofp_header *oh) > struct dp_packet pkt; > struct flow flow; > > -error = ofputil_decode_packet_in(oh, true, NULL, &pi, NULL, > +error = ofputil_decode_packet_in(oh, true, NULL, NULL, &pi, NULL, > &buffer_id, NULL); > if (error) { > VLOG_WARN_RL(&rl, "failed to decode packet-in: %s", > diff --git a/lib/nx-match.c b/lib/nx-match.c > index c258869eec80..124cb71eb7c8 100644 > --- a/lib/nx-match.c > +++ b/lib/nx-match.c > @@ -480,13 +480,14 @@ nx_pull_header(struct ofpbuf *b, const struct > vl_mff_map *vl_mff_map, > > static enum ofperr > nx_pull_match_entry(struct ofpbuf *b, bool allow_cookie, > +const struct vl_mff_map *vl_mff_map, > const struct mf_field **field, > union mf_value *value, union mf_value *mask) > { > enum ofperr error; > uint64_t header; > > -error = nx_pull_entry__(b, allow_cookie, NULL, &header, field, value, > +error = nx_pull_entry__(b, allow_cookie, vl_mff_map, &header, field, > value, > mask); > if (error) { > return error; > @@ -507,7 +508,8 @@ nx_pull_match_entry(struct ofpbuf *b, bool allow_cookie, > static enum ofperr > nx_pull_raw(const uint8_t *p, unsigned int match_len, bool strict, > struct match *match, ovs_be64 *cookie, ovs_be64 *cookie_mask, > -const struct tun_table *tun_table) > +const struct tun_table *tun_table, > +const struct vl_mff_map *vl_mff_map) > { > ovs_assert((cookie != NULL) == (cookie_mask != NULL)); > > @@ -525,7 +527,8 @@ nx_pull_raw(const uint8_t *p, unsigned int match_len, > bool strict, >
[ovs-dev] [branch-2.7 2/4] nx-match: Use vl_mff_map to parse match field.
From: Yi-Hung Wei vl_mff_map is introduced in commit 04f48a68c428 ("ofp-actions: Fix variable length meta-flow OXMs") to account variable length mf_field, and it is used to decode variable length mf_field in ofp_action. In this patch, vl_mff_map is further used to decode the variable length match field as well. Signed-off-by: Yi-Hung Wei Signed-off-by: Joe Stringer --- include/openvswitch/ofp-util.h | 6 ++-- lib/learning-switch.c | 2 +- lib/nx-match.c | 46 lib/nx-match.h | 7 ++-- lib/ofp-print.c| 4 +-- lib/ofp-util.c | 80 +- ofproto/ofproto.c | 11 +++--- ovn/controller/pinctrl.c | 2 +- tests/ofproto.at | 15 +--- utilities/ovs-ofctl.c | 13 +++ 10 files changed, 123 insertions(+), 63 deletions(-) diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h index 0c3a10aa4264..e73a942a3e15 100644 --- a/include/openvswitch/ofp-util.h +++ b/include/openvswitch/ofp-util.h @@ -222,7 +222,7 @@ void ofputil_match_to_ofp10_match(const struct match *, struct ofp10_match *); /* Work with ofp11_match. */ enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, const struct tun_table *, - struct match *, + const struct vl_mff_map *, struct match *, uint16_t *padded_match_len); enum ofperr ofputil_pull_ofp11_mask(struct ofpbuf *, struct match *, struct mf_bitmap *bm); @@ -352,7 +352,7 @@ struct ofputil_flow_stats_request { enum ofperr ofputil_decode_flow_stats_request( struct ofputil_flow_stats_request *, const struct ofp_header *, -const struct tun_table *); +const struct tun_table *, const struct vl_mff_map *); struct ofpbuf *ofputil_encode_flow_stats_request( const struct ofputil_flow_stats_request *, enum ofputil_protocol); @@ -457,6 +457,7 @@ void ofputil_packet_in_destroy(struct ofputil_packet_in *); enum ofperr ofputil_decode_packet_in(const struct ofp_header *, bool loose, const struct tun_table *, + const struct vl_mff_map *, struct ofputil_packet_in *, size_t *total_len, uint32_t *buffer_id, struct ofpbuf *continuation); @@ -509,6 +510,7 @@ struct ofpbuf *ofputil_encode_packet_in_private( enum ofperr ofputil_decode_packet_in_private( const struct ofp_header *, bool loose, const struct tun_table *, +const struct vl_mff_map *, struct ofputil_packet_in_private *, size_t *total_len, uint32_t *buffer_id); diff --git a/lib/learning-switch.c b/lib/learning-switch.c index bc757f46dd7a..77155d04fcc0 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -523,7 +523,7 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh) struct dp_packet pkt; struct flow flow; -error = ofputil_decode_packet_in(oh, true, NULL, &pi, NULL, +error = ofputil_decode_packet_in(oh, true, NULL, NULL, &pi, NULL, &buffer_id, NULL); if (error) { VLOG_WARN_RL(&rl, "failed to decode packet-in: %s", diff --git a/lib/nx-match.c b/lib/nx-match.c index c258869eec80..124cb71eb7c8 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -480,13 +480,14 @@ nx_pull_header(struct ofpbuf *b, const struct vl_mff_map *vl_mff_map, static enum ofperr nx_pull_match_entry(struct ofpbuf *b, bool allow_cookie, +const struct vl_mff_map *vl_mff_map, const struct mf_field **field, union mf_value *value, union mf_value *mask) { enum ofperr error; uint64_t header; -error = nx_pull_entry__(b, allow_cookie, NULL, &header, field, value, +error = nx_pull_entry__(b, allow_cookie, vl_mff_map, &header, field, value, mask); if (error) { return error; @@ -507,7 +508,8 @@ nx_pull_match_entry(struct ofpbuf *b, bool allow_cookie, static enum ofperr nx_pull_raw(const uint8_t *p, unsigned int match_len, bool strict, struct match *match, ovs_be64 *cookie, ovs_be64 *cookie_mask, -const struct tun_table *tun_table) +const struct tun_table *tun_table, +const struct vl_mff_map *vl_mff_map) { ovs_assert((cookie != NULL) == (cookie_mask != NULL)); @@ -525,7 +527,8 @@ nx_pull_raw(const uint8_t *p, unsigned int match_len, bool strict, union mf_value mask; enum ofperr error; -error = nx_pull_match_entry(&b, cookie != NULL, &field, &value, &mask); +error = nx_pull_match_entry(&b, cookie != NULL, vl_mff_map, &field, +&value, &mask);