Only the default existing behaviour is translated. All other methods are rejected for now.
NTR selection method Signed-off-by: Simon Horman <simon.hor...@netronome.com> --- v3 * No change v2 * Use array of TLVs rather than OF1.1 match for fields field of NTR selection method property --- ofproto/ofproto-dpif-xlate.c | 30 ++++++++++++++++++++++++++---- ofproto/ofproto-dpif.c | 6 ++++++ ofproto/ofproto-dpif.h | 1 + ofproto/ofproto-provider.h | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 5d6e1dd..1a3d34c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3064,7 +3064,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; @@ -3088,9 +3088,29 @@ xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group) } } -static void +static bool +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 { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); + + VLOG_ERR_RL(&rl, "unsupported select group method \"%s\"", + selection_method); + return true; + } + + return false; +} + +static bool xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group) { + bool error = false; + ctx->in_group = true; switch (group_dpif_get_type(group)) { @@ -3099,7 +3119,7 @@ xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group) xlate_all_group(ctx, group); break; case OFPGT11_SELECT: - xlate_select_group(ctx, group); + error = xlate_select_group(ctx, group); break; case OFPGT11_FF: xlate_ff_group(ctx, group); @@ -3110,6 +3130,8 @@ xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group) group_dpif_unref(group); ctx->in_group = false; + + return error; } static bool @@ -3145,7 +3167,7 @@ xlate_group_action(struct xlate_ctx *ctx, uint32_t group_id) got_group = group_dpif_lookup(ctx->xbridge->ofproto, group_id, &group); if (got_group) { - xlate_group_action__(ctx, group); + return xlate_group_action__(ctx, group); } else { return true; } diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 9b67518..4d2333f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4250,6 +4250,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.selection_method; +} /* Sends 'packet' out 'ofport'. * May modify 'packet'. diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index e2359cd..fd099a2 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -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 *, diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 05a2dfe..a5fa445 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -43,6 +43,7 @@ #include "ofp-errors.h" #include "ofp-util.h" #include "ofproto/ofproto.h" +#include "openflow/netronome-ext.h" #include "ovs-atomic.h" #include "ovs-rcu.h" #include "ovs-thread.h" -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev