Re: [ovs-dev] [PATCH 01/10] userspace: Add OXM field MFF_PACKET_TYPE
On Fri, Apr 21, 2017 at 07:05:41PM -0700, Ben Pfaff wrote: > On Tue, Apr 18, 2017 at 11:19:44AM +, Zoltán Balogh wrote: > > From: Jan Scheurich> > > > Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite > > for matching L3 protocols (MPLS, IP, IPv6, ARP etc). > > > > Scan packet_type in odp_flow string. > > > > Added dummy entry for MFF_PACKET_TYPE to lib/meta-flow.xml > > > > Added packet_type to the matching properties in tests/ofproto.at. Should be > > removed later, when packet_type_aware bridge attribute will be introduced. > > > > Signed-off-by: Jan Scheurich > > Zoltán, thanks a lot for working on this feature. But I'm seeing a lot > of patch rejects even on the first patch, so I'd appreciate very much a > rebase. Oh, it's because there's another series dependency, never mind. ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH 01/10] userspace: Add OXM field MFF_PACKET_TYPE
On Tue, Apr 18, 2017 at 11:19:44AM +, Zoltán Balogh wrote: > From: Jan Scheurich> > Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite > for matching L3 protocols (MPLS, IP, IPv6, ARP etc). > > Scan packet_type in odp_flow string. > > Added dummy entry for MFF_PACKET_TYPE to lib/meta-flow.xml > > Added packet_type to the matching properties in tests/ofproto.at. Should be > removed later, when packet_type_aware bridge attribute will be introduced. > > Signed-off-by: Jan Scheurich Zoltán, thanks a lot for working on this feature. But I'm seeing a lot of patch rejects even on the first patch, so I'd appreciate very much a rebase. Thanks, Ben. ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH 01/10] userspace: Add OXM field MFF_PACKET_TYPE
> > > > -/* "in_port". > > + /* "in_port". > > Why the formatting change in the middle of the patch? And even in that > case it looks off a bit. > > - Greg Thank you for the review! I guess, this was included mistakenly. We will exclude it from next version of the patch set. /Zoltan ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH 01/10] userspace: Add OXM field MFF_PACKET_TYPE
On Tue, 2017-04-18 at 11:19 +, Zoltán Balogh wrote: > From: Jan Scheurich> > Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite > for matching L3 protocols (MPLS, IP, IPv6, ARP etc). > > Scan packet_type in odp_flow string. > > Added dummy entry for MFF_PACKET_TYPE to lib/meta-flow.xml > > Added packet_type to the matching properties in tests/ofproto.at. Should be > removed later, when packet_type_aware bridge attribute will be introduced. > > Signed-off-by: Jan Scheurich > --- > include/openvswitch/meta-flow.h | 16 +- > lib/flow.h | 26 -- > lib/meta-flow.c | 30 -- > lib/meta-flow.xml | 4 > lib/nx-match.c | 16 ++ > lib/odp-util.c | 48 > ++--- > lib/ofp-parse.c | 6 ++ > lib/ofp-util.c | 42 +--- > tests/dpif-netdev.at| 14 ++-- > tests/odp.at| 1 + > tests/ofproto-dpif.at | 20 - > tests/ofproto.at| 1 + > tests/pmd.at| 2 +- > tests/tunnel-push-pop-ipv6.at | 2 +- > tests/tunnel-push-pop.at| 2 +- > 15 files changed, 177 insertions(+), 53 deletions(-) > > diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h > index c284ec6..172cc3b 100644 > --- a/include/openvswitch/meta-flow.h > +++ b/include/openvswitch/meta-flow.h > @@ -247,6 +247,20 @@ enum OVS_PACKED_ENUM mf_field_id { > */ > MFF_RECIRC_ID, > > +/* "packet_type". > + * > + * Define the packet type in OpenFlow 1.3+. > + * > + * Type: be32. > + * Maskable: no. > + * Formatting: hexadecimal. > + * Prerequisites: none. > + * Access: read-only. > + * NXM: none. > + * OXM: OXM_OF_PACKET_TYPE(44) since OF1.3 and v2.7. > + */ > +MFF_PACKET_TYPE, > + > /* "conj_id". > * > * ID for "conjunction" actions. Please refer to ovs-ofctl(8) > @@ -589,7 +603,7 @@ enum OVS_PACKED_ENUM mf_field_id { > */ > MFF_METADATA, > > -/* "in_port". > + /* "in_port". Why the formatting change in the middle of the patch? And even in that case it looks off a bit. - Greg > * > * 16-bit (OpenFlow 1.0) view of the physical or virtual port on which > the > * packet was received. > diff --git a/lib/flow.h b/lib/flow.h > index a8772c5..fcc7d13 100644 > --- a/lib/flow.h > +++ b/lib/flow.h > @@ -959,9 +959,23 @@ static inline bool is_ethernet(const struct flow *flow, > return flow->packet_type == htonl(PT_ETH); > } > > +static inline ovs_be16 get_dl_type(const struct flow *flow) > +{ > +if (flow->packet_type == htonl(PT_ETH)) { > +return flow->dl_type; > +} else if (pt_ns(flow->packet_type) == OFPHTN_ETHERTYPE) { > +return pt_ns_type_be(flow->packet_type); > +} else { > +return FLOW_DL_TYPE_NONE; > +} > +} > + > static inline bool is_vlan(const struct flow *flow, > struct flow_wildcards *wc) > { > +if (!is_ethernet(flow, wc)) { > +return false; > +} > if (wc) { > WC_MASK_FIELD_MASK(wc, vlans[0].tci, htons(VLAN_CFI)); > } > @@ -970,7 +984,7 @@ static inline bool is_vlan(const struct flow *flow, > > static inline bool is_ip_any(const struct flow *flow) > { > -return dl_type_is_ip_any(flow->dl_type); > +return dl_type_is_ip_any(get_dl_type(flow)); > } > > static inline bool is_ip_proto(const struct flow *flow, uint8_t ip_proto, > @@ -1006,7 +1020,7 @@ static inline bool is_sctp(const struct flow *flow, > static inline bool is_icmpv4(const struct flow *flow, > struct flow_wildcards *wc) > { > -if (flow->dl_type == htons(ETH_TYPE_IP)) { > +if (get_dl_type(flow) == htons(ETH_TYPE_IP)) { > if (wc) { > memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); > } > @@ -1018,7 +1032,7 @@ static inline bool is_icmpv4(const struct flow *flow, > static inline bool is_icmpv6(const struct flow *flow, > struct flow_wildcards *wc) > { > -if (flow->dl_type == htons(ETH_TYPE_IPV6)) { > +if (get_dl_type(flow) == htons(ETH_TYPE_IPV6)) { > if (wc) { > memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); > } > @@ -1049,7 +1063,7 @@ static inline bool is_nd(const struct flow *flow, > > static inline bool is_igmp(const struct flow *flow, struct flow_wildcards > *wc) > { > -if (flow->dl_type == htons(ETH_TYPE_IP)) { > +if (get_dl_type(flow) == htons(ETH_TYPE_IP)) { > if (wc) { > memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); > } > @@ -1093,8 +1107,8 @@ static inline
[ovs-dev] [PATCH 01/10] userspace: Add OXM field MFF_PACKET_TYPE
From: Jan ScheurichAllow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite for matching L3 protocols (MPLS, IP, IPv6, ARP etc). Scan packet_type in odp_flow string. Added dummy entry for MFF_PACKET_TYPE to lib/meta-flow.xml Added packet_type to the matching properties in tests/ofproto.at. Should be removed later, when packet_type_aware bridge attribute will be introduced. Signed-off-by: Jan Scheurich --- include/openvswitch/meta-flow.h | 16 +- lib/flow.h | 26 -- lib/meta-flow.c | 30 -- lib/meta-flow.xml | 4 lib/nx-match.c | 16 ++ lib/odp-util.c | 48 ++--- lib/ofp-parse.c | 6 ++ lib/ofp-util.c | 42 +--- tests/dpif-netdev.at| 14 ++-- tests/odp.at| 1 + tests/ofproto-dpif.at | 20 - tests/ofproto.at| 1 + tests/pmd.at| 2 +- tests/tunnel-push-pop-ipv6.at | 2 +- tests/tunnel-push-pop.at| 2 +- 15 files changed, 177 insertions(+), 53 deletions(-) diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h index c284ec6..172cc3b 100644 --- a/include/openvswitch/meta-flow.h +++ b/include/openvswitch/meta-flow.h @@ -247,6 +247,20 @@ enum OVS_PACKED_ENUM mf_field_id { */ MFF_RECIRC_ID, +/* "packet_type". + * + * Define the packet type in OpenFlow 1.3+. + * + * Type: be32. + * Maskable: no. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read-only. + * NXM: none. + * OXM: OXM_OF_PACKET_TYPE(44) since OF1.3 and v2.7. + */ +MFF_PACKET_TYPE, + /* "conj_id". * * ID for "conjunction" actions. Please refer to ovs-ofctl(8) @@ -589,7 +603,7 @@ enum OVS_PACKED_ENUM mf_field_id { */ MFF_METADATA, -/* "in_port". + /* "in_port". * * 16-bit (OpenFlow 1.0) view of the physical or virtual port on which the * packet was received. diff --git a/lib/flow.h b/lib/flow.h index a8772c5..fcc7d13 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -959,9 +959,23 @@ static inline bool is_ethernet(const struct flow *flow, return flow->packet_type == htonl(PT_ETH); } +static inline ovs_be16 get_dl_type(const struct flow *flow) +{ +if (flow->packet_type == htonl(PT_ETH)) { +return flow->dl_type; +} else if (pt_ns(flow->packet_type) == OFPHTN_ETHERTYPE) { +return pt_ns_type_be(flow->packet_type); +} else { +return FLOW_DL_TYPE_NONE; +} +} + static inline bool is_vlan(const struct flow *flow, struct flow_wildcards *wc) { +if (!is_ethernet(flow, wc)) { +return false; +} if (wc) { WC_MASK_FIELD_MASK(wc, vlans[0].tci, htons(VLAN_CFI)); } @@ -970,7 +984,7 @@ static inline bool is_vlan(const struct flow *flow, static inline bool is_ip_any(const struct flow *flow) { -return dl_type_is_ip_any(flow->dl_type); +return dl_type_is_ip_any(get_dl_type(flow)); } static inline bool is_ip_proto(const struct flow *flow, uint8_t ip_proto, @@ -1006,7 +1020,7 @@ static inline bool is_sctp(const struct flow *flow, static inline bool is_icmpv4(const struct flow *flow, struct flow_wildcards *wc) { -if (flow->dl_type == htons(ETH_TYPE_IP)) { +if (get_dl_type(flow) == htons(ETH_TYPE_IP)) { if (wc) { memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); } @@ -1018,7 +1032,7 @@ static inline bool is_icmpv4(const struct flow *flow, static inline bool is_icmpv6(const struct flow *flow, struct flow_wildcards *wc) { -if (flow->dl_type == htons(ETH_TYPE_IPV6)) { +if (get_dl_type(flow) == htons(ETH_TYPE_IPV6)) { if (wc) { memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); } @@ -1049,7 +1063,7 @@ static inline bool is_nd(const struct flow *flow, static inline bool is_igmp(const struct flow *flow, struct flow_wildcards *wc) { -if (flow->dl_type == htons(ETH_TYPE_IP)) { +if (get_dl_type(flow) == htons(ETH_TYPE_IP)) { if (wc) { memset(>masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); } @@ -1093,8 +1107,8 @@ static inline bool is_mld_report(const struct flow *flow, static inline bool is_stp(const struct flow *flow) { -return (eth_addr_equals(flow->dl_dst, eth_addr_stp) -&& flow->dl_type == htons(FLOW_DL_TYPE_NONE)); +return (flow->dl_type == htons(FLOW_DL_TYPE_NONE) +&& eth_addr_equals(flow->dl_dst, eth_addr_stp)); } #endif /* flow.h */ diff --git a/lib/meta-flow.c b/lib/meta-flow.c index a963cce..eac7fbc