Hello,
I am experimenting with the group "select" feature, for which I have modified
"group_best_live_bucket()" function in "ofproto-dpif-xlate.c" to stochastically
choose a bucket based on bucket weights (changes shown below).
My understanding was that every time a packet arrives at the switch and matches
the flow entry it is fowarded to the corresponding group (type=select in my
case), which will result in a bucket being triggered. So, I was expecting
"xlate_select_group()" function to be called for every packet (which invokes
the "group_best_live_bucket()" function). However, I did not see the results I
was expecting. Instead, a single bucket was being choosen continuously (when
buckets should be choosen probabilitically, based on my changes).
Then, I started to a log a message whenever this function was invoked. To my
surprise, the logging revealed that this function is not being invoked for
every packet.
Is this the expected behavior? Am I missing something?
Help/directions in this regard will be highly appreciated.
Thank you!
Note: I have modified "group_best_live_bucket()" function as follows (without
logging):
// for stochastic switchingstatic const struct ofputil_bucket
*group_best_live_bucket(const struct xlate_ctx *ctx,
const struct group_dpif *group, uint32_t basis){ const
struct ofputil_bucket *best_bucket = NULL; uint32_t rand_num = 0, sum = 0;
const struct ofputil_bucket *bucket; const struct list *buckets;
// initialize random seed (once only) if (!is_srand_initialized) {
srand(time(NULL)); is_srand_initialized = true; } // generate a
number number in [1, 10] rand_num = (rand() % 10) + 1;
group_dpif_get_buckets(group, &buckets); LIST_FOR_EACH (bucket,
list_node, buckets) { sum += bucket->weight; if (rand_num <= sum)
{ return bucket; // return this bucket } }
return best_bucket; // return NULL}
FYI, my group table entry corresponds to the following ovs-ofctl command:
ovs-ofctl -O OpenFlow13 add-group tcp:127.0.0.1:6641
group_id=0,type=select,bucket=weight=8,mod_dl_src=0A:00:14:01:00:05,mod_dl_dst=0A:00:14:FE:00:02,output=5,bucket=weight=2,mod_dl_src=0A:00:13:01:00:04,mod_dl_dst=0A:00:13:FE:00:02,output=4
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev