summaryrefslogtreecommitdiff
path: root/lib/meta-flow.c
diff options
context:
space:
mode:
authorSimon Horman <simon.horman@netronome.com>2015-03-20 13:50:34 +0900
committerBen Pfaff <blp@nicira.com>2015-03-24 09:28:30 -0700
commit0c4b9393b6a5792b888d4b580e04cc3fa64ebc12 (patch)
tree21f9a423dc7a307967607491cee675c469d2ba21 /lib/meta-flow.c
parentb879391e0f2fed8e52ae20ad21ad8ae52cea8363 (diff)
downloadopenvswitch-0c4b9393b6a5792b888d4b580e04cc3fa64ebc12.tar.gz
Implement hash fields select group
This is intended as a usable demonstration of how the NTR selection method extension might may be used. NTR selection method Signed-off-by: Simon Horman <simon.horman@netronome.com> [blp@nicira.com added a NEWS entry] Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/meta-flow.c')
-rw-r--r--lib/meta-flow.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 54e7f5806..124b5256c 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -352,6 +352,41 @@ mf_mask_field_and_prereqs(const struct mf_field *mf, struct flow *mask)
}
}
+/* Set bits of 'bm' corresponding to the field 'mf' and it's prerequisities. */
+void
+mf_bitmap_set_field_and_prereqs(const struct mf_field *mf, struct mf_bitmap *bm)
+{
+ bitmap_set1(bm->bm, mf->id);
+
+ switch (mf->prereqs) {
+ case MFP_ND:
+ case MFP_ND_SOLICIT:
+ case MFP_ND_ADVERT:
+ bitmap_set1(bm->bm, MFF_TCP_SRC);
+ bitmap_set1(bm->bm, MFF_TCP_DST);
+ /* Fall through. */
+ case MFP_TCP:
+ case MFP_UDP:
+ case MFP_SCTP:
+ case MFP_ICMPV4:
+ case MFP_ICMPV6:
+ /* nw_frag always unwildcarded. */
+ bitmap_set1(bm->bm, MFF_IP_PROTO);
+ /* Fall through. */
+ case MFP_ARP:
+ case MFP_IPV4:
+ case MFP_IPV6:
+ case MFP_MPLS:
+ case MFP_IP_ANY:
+ bitmap_set1(bm->bm, MFF_ETH_TYPE);
+ break;
+ case MFP_VLAN_VID:
+ bitmap_set1(bm->bm, MFF_VLAN_TCI);
+ break;
+ case MFP_NONE:
+ break;
+ }
+}
/* Returns true if 'value' may be a valid value *as part of a masked match*,
* false otherwise.