Re: [ovs-dev] [RFC PATCH] xlate: Use dp_hash for select groups.

2016-09-12 Thread Jarno Rajahalme
I added a NEWS flash as well,

  Jarno

> On Sep 12, 2016, at 3:53 PM, Ben Pfaff  wrote:
> 
> Apparently ;-)
> 
> On Mon, Sep 12, 2016 at 02:59:16PM -0700, Jarno Rajahalme wrote:
>> I’m rebasing this now. Adding ovs-ofctl documentation should be sufficient, 
>> right?
>> 
>>  Jarno
>> 
>>> On Apr 22, 2016, at 8:27 AM, Ben Pfaff  wrote:
>>> 
>>> On Mon, Apr 18, 2016 at 05:42:53PM -0700, Jarno Rajahalme wrote:
 Add a new select group selection method "dp_hash", which uses minimal
 number of bits from the datapath calculated packet hash to inform the
 select group bucket selection.  This makes the datapath flows more
 generic resulting in less upcalls to userspace, but adds recirculation
 prior to group selection.
 
 Signed-off-by: Jarno Rajahalme 
>>> 
>>> How can we explain this to users?  I don't think it tries, yet--I don't
>>> see any documentation updates.
>>> 
>>> Thanks,
>>> 
>>> Ben.
>> 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [RFC PATCH] xlate: Use dp_hash for select groups.

2016-09-12 Thread Ben Pfaff
Apparently ;-)

On Mon, Sep 12, 2016 at 02:59:16PM -0700, Jarno Rajahalme wrote:
> I’m rebasing this now. Adding ovs-ofctl documentation should be sufficient, 
> right?
> 
>   Jarno
> 
> > On Apr 22, 2016, at 8:27 AM, Ben Pfaff  wrote:
> > 
> > On Mon, Apr 18, 2016 at 05:42:53PM -0700, Jarno Rajahalme wrote:
> >> Add a new select group selection method "dp_hash", which uses minimal
> >> number of bits from the datapath calculated packet hash to inform the
> >> select group bucket selection.  This makes the datapath flows more
> >> generic resulting in less upcalls to userspace, but adds recirculation
> >> prior to group selection.
> >> 
> >> Signed-off-by: Jarno Rajahalme 
> > 
> > How can we explain this to users?  I don't think it tries, yet--I don't
> > see any documentation updates.
> > 
> > Thanks,
> > 
> > Ben.
> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [RFC PATCH] xlate: Use dp_hash for select groups.

2016-09-12 Thread Jarno Rajahalme
I’m rebasing this now. Adding ovs-ofctl documentation should be sufficient, 
right?

  Jarno

> On Apr 22, 2016, at 8:27 AM, Ben Pfaff  wrote:
> 
> On Mon, Apr 18, 2016 at 05:42:53PM -0700, Jarno Rajahalme wrote:
>> Add a new select group selection method "dp_hash", which uses minimal
>> number of bits from the datapath calculated packet hash to inform the
>> select group bucket selection.  This makes the datapath flows more
>> generic resulting in less upcalls to userspace, but adds recirculation
>> prior to group selection.
>> 
>> Signed-off-by: Jarno Rajahalme 
> 
> How can we explain this to users?  I don't think it tries, yet--I don't
> see any documentation updates.
> 
> Thanks,
> 
> Ben.

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [RFC PATCH] xlate: Use dp_hash for select groups.

2016-04-22 Thread Ben Pfaff
On Mon, Apr 18, 2016 at 05:42:53PM -0700, Jarno Rajahalme wrote:
> Add a new select group selection method "dp_hash", which uses minimal
> number of bits from the datapath calculated packet hash to inform the
> select group bucket selection.  This makes the datapath flows more
> generic resulting in less upcalls to userspace, but adds recirculation
> prior to group selection.
> 
> Signed-off-by: Jarno Rajahalme 

How can we explain this to users?  I don't think it tries, yet--I don't
see any documentation updates.

Thanks,

Ben.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [RFC PATCH] xlate: Use dp_hash for select groups.

2016-04-18 Thread Jarno Rajahalme
Add a new select group selection method "dp_hash", which uses minimal
number of bits from the datapath calculated packet hash to inform the
select group bucket selection.  This makes the datapath flows more
generic resulting in less upcalls to userspace, but adds recirculation
prior to group selection.

Signed-off-by: Jarno Rajahalme 
---
 lib/ofp-parse.c  |  2 ++
 lib/ofp-util.c   | 16 --
 ofproto/ofproto-dpif-xlate.c | 74 ++--
 ofproto/ofproto-dpif.c   | 13 +---
 ofproto/ofproto-dpif.h   |  3 +-
 tests/ofproto-dpif.at| 38 +++
 tests/ofproto.at |  3 ++
 7 files changed, 131 insertions(+), 18 deletions(-)

diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 71c5cdf..ce3a9e4 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -1536,6 +1536,8 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, 
uint16_t command,
 goto out;
 }
 
+/* XXX Exclude fields for non "hash" selection method. */
+
 if (fields & F_COMMAND_BUCKET_ID) {
 if (!(fields & F_COMMAND_BUCKET_ID_ALL || had_command_bucket_id)) {
 error = xstrdup("must specify a command bucket id");
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index bb1535d..68feabb 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -8697,28 +8697,24 @@ parse_group_prop_ntr_selection_method(struct ofpbuf 
*payload,
 return OFPERR_OFPBPC_BAD_VALUE;
 }
 
-if (strcmp("hash", prop->selection_method)) {
+if (strcmp("hash", prop->selection_method)
+&& strcmp("dp_hash", prop->selection_method)) {
 OFPPROP_LOG(_ofmsg_rl, false,
 "ntr selection method '%s' is not supported",
 prop->selection_method);
 return OFPERR_OFPBPC_BAD_VALUE;
 }
+/* 'method_len' is now non-zero. */
 
 strcpy(gp->selection_method, prop->selection_method);
 gp->selection_method_param = ntohll(prop->selection_method_param);
 
-if (!method_len && gp->selection_method_param) {
-OFPPROP_LOG(_ofmsg_rl, false, "ntr selection method parameter is "
-"non-zero but selection method is empty");
-return OFPERR_OFPBPC_BAD_VALUE;
-}
-
 ofpbuf_pull(payload, sizeof *prop);
 
 fields_len = ntohs(prop->length) - sizeof *prop;
-if (!method_len && fields_len) {
-OFPPROP_LOG(_ofmsg_rl, false, "ntr selection method parameter is "
-"zero but fields are provided");
+if (fields_len && strcmp("hash", gp->selection_method)) {
+OFPPROP_LOG(_ofmsg_rl, false, "ntr selection method %s "
+"does not support fields", gp->selection_method);
 return OFPERR_OFPBPC_BAD_VALUE;
 }
 
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 5937913..4231e5f 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -317,6 +317,11 @@ struct xlate_ctx {
 * case at that point.
 */
 bool freezing;
+bool recirc_update_dp_hash;/* Generated recirculation will be preceded
+* by datapath HASH action to get an updated
+* dp_hash after recirculation. */
+uint32_t dp_hash_alg;
+uint32_t dp_hash_basis;
 struct ofpbuf frozen_actions;
 const struct ofpact_controller *pause;
 
@@ -373,6 +378,17 @@ ctx_trigger_freeze(struct xlate_ctx *ctx)
 ctx->freezing = true;
 }
 
+static void
+ctx_trigger_recirculate_with_hash(struct xlate_ctx *ctx, uint32_t type,
+  uint32_t basis)
+{
+ctx->exit = true;
+ctx->freezing = true;
+ctx->recirc_update_dp_hash = true;
+ctx->dp_hash_alg = type;
+ctx->dp_hash_basis = basis;
+}
+
 static bool
 ctx_first_frozen_action(const struct xlate_ctx *ctx)
 {
@@ -384,6 +400,7 @@ ctx_cancel_freeze(struct xlate_ctx *ctx)
 {
 if (ctx->freezing) {
 ctx->freezing = false;
+ctx->recirc_update_dp_hash = false;
 ofpbuf_clear(>frozen_actions);
 ctx->frozen_actions.header = NULL;
 }
@@ -1504,8 +1521,9 @@ group_first_live_bucket(const struct xlate_ctx *ctx,
 {
 struct ofputil_bucket *bucket;
 const struct ovs_list *buckets;
+uint32_t n_buckets;
 
-group_dpif_get_buckets(group, );
+group_dpif_get_buckets(group, , _buckets);
 LIST_FOR_EACH (bucket, list_node, buckets) {
 if (bucket_is_alive(ctx, bucket, depth)) {
 return bucket;
@@ -1526,8 +1544,9 @@ group_best_live_bucket(const struct xlate_ctx *ctx,
 
 struct ofputil_bucket *bucket;
 const struct ovs_list *buckets;
+uint32_t n_buckets;
 
-group_dpif_get_buckets(group, );
+group_dpif_get_buckets(group, , _buckets);
 LIST_FOR_EACH (bucket, list_node, buckets) {
 if (bucket_is_alive(ctx, bucket, 0)) {
 uint32_t score = (hash_int(i, basis) & 0x) * bucket->weight;
@@ -3362,8