Support translation of NTR selection method
authorSimon Horman <simon.horman@netronome.com>
Fri, 20 Mar 2015 04:50:32 +0000 (13:50 +0900)
committerBen Pfaff <blp@nicira.com>
Tue, 24 Mar 2015 16:22:18 +0000 (09:22 -0700)
Only the default existing behaviour is translated.
All other methods are rejected for now.

NTR selection method
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
ofproto/ofproto-dpif.h

index 0e28c77..75d3eed 100644 (file)
@@ -3092,7 +3092,7 @@ xlate_ff_group(struct xlate_ctx *ctx, struct group_dpif *group)
 }
 
 static void
-xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group)
+xlate_default_select_group(struct xlate_ctx *ctx, struct group_dpif *group)
 {
     struct flow_wildcards *wc = &ctx->xout->wc;
     struct ofputil_bucket *bucket;
@@ -3116,6 +3116,19 @@ xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group)
     }
 }
 
+static void
+xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group)
+{
+    const char *selection_method = group_dpif_get_selection_method(group);
+
+    if (selection_method[0] == '\0') {
+        xlate_default_select_group(ctx, group);
+    } else {
+        /* Parsing of groups should ensure this never happens */
+        OVS_NOT_REACHED();
+    }
+}
+
 static void
 xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group)
 {
index 38ad6e2..43a21c2 100644 (file)
@@ -4241,6 +4241,12 @@ group_dpif_get_type(const struct group_dpif *group)
 {
     return group->up.type;
 }
+
+const char *
+group_dpif_get_selection_method(const struct group_dpif *group)
+{
+    return group->up.props.selection_method;
+}
 \f
 /* Sends 'packet' out 'ofport'.
  * May modify 'packet'.
index e2359cd..fd099a2 100644 (file)
@@ -137,6 +137,7 @@ bool group_dpif_lookup(struct ofproto_dpif *ofproto, uint32_t group_id,
 void group_dpif_get_buckets(const struct group_dpif *group,
                             const struct ovs_list **buckets);
 enum ofp11_group_type group_dpif_get_type(const struct group_dpif *group);
+const char *group_dpif_get_selection_method(const struct group_dpif *group);
 
 bool ofproto_has_vlan_splinters(const struct ofproto_dpif *);
 ofp_port_t vsp_realdev_to_vlandev(const struct ofproto_dpif *,