[ovs-dev] why the behavior for weigh=0 for group's dp_hash method is different with default selection method?

ychen ychen103103 at 163.com
Wed May 29 12:05:13 UTC 2019

   I noticed that we can set bucket's weight to 0 when add/mod group.
   1. when we use default select method, and when all the buckets with weight larger than 0 change to dead,
      we can still pick the bucket whose weight is 0. here is the code:
     LIST_FOR_EACH (bucket, list_node, &group->up.buckets) {
        if (bucket_is_alive(ctx, bucket, 0)) {       ///// so when only bucket with weight=0 is active
            uint32_t score =
                (hash_int(bucket->bucket_id, basis) & 0xffff) * bucket->weight;
            if (score >= best_score) {                 //// and bucket with weight=0 does match this clause
                best_bucket = bucket;
                best_score = score;

2. but for dp_hash selection method, we init the bucket when group_construct
    and bucket whose weight is 0 will be excluded. Here is the code:
      for (int hash = 0; hash < n_hash; hash++) {
        struct webster *winner = &webster[0];
        for (i = 1; i < n_buckets; i++) {
            if (webster[i].value > winner->value) {   //// bucket with weight=0 always be excluded
                winner = &webster[i];

so here is my question: why the behavior is different for dp_hash method and default selection method?


More information about the dev mailing list