Only the default existing behaviour is translated. All other methods are rejected for now.
NMX selection method Signed-off-by: Simon Horman <simon.hor...@netronome.com> --- ofproto/ofproto-dpif-xlate.c | 30 ++++++++++++++++++++++++++---- ofproto/ofproto-dpif.c | 6 ++++++ ofproto/ofproto-dpif.h | 1 + ofproto/ofproto-provider.h | 9 +++++++++ ofproto/ofproto.c | 2 ++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 8f0a3aa..a794840 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2987,7 +2987,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; @@ -3011,9 +3011,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)) { @@ -3022,7 +3042,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); @@ -3033,6 +3053,8 @@ xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group) group_dpif_unref(group); ctx->in_group = false; + + return error; } static bool @@ -3068,7 +3090,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 0dc1f85..e56bd61 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4086,6 +4086,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 48e1b30..0893d29 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -123,6 +123,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 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 0911333..a59f047 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" @@ -499,6 +500,14 @@ struct ofgroup { struct list buckets; /* Contains "struct ofputil_bucket"s. */ const uint32_t n_buckets; + + /* NMX selection method */ + const char selection_method[NMX_MAX_SELECTION_METHOD_LEN]; + const uint64_t selection_method_param; + struct { + struct miniflow flow; + struct mf_bitmap bm; + } fields; }; bool ofproto_group_lookup(const struct ofproto *ofproto, uint32_t group_id, diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 1485fb4..00e668a 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -5753,6 +5753,8 @@ init_group(struct ofproto *ofproto, struct ofputil_group_mod *gm, *CONST_CAST(uint32_t *, &(*ofgroup)->n_buckets) = list_size(&(*ofgroup)->buckets); + CONST_CAST(char *, (*ofgroup)->selection_method)[0] = '\0'; + /* Construct called BEFORE any locks are held. */ error = ofproto->ofproto_class->group_construct(*ofgroup); if (error) { -- 2.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev