Hi,
I am investigating on OenFlow SELECT Group Selection (bucket selection)
behavior, to implement other algorithms.
I am using ubunut 16.04, and Openvswitch 2.5.5 version
Some basic queries on bucket selection or SELECT group.
------------------------------------------------------------------------------------
1. How frequently the bucket can be selected?
2. Whether bucket slection reflects only on creation of new data flow ? I
mean , can i update old data path flow if i select the new bucket?
I customized the code,
In the ofproto/ofproto-dpif-xlate.c file, group_best_live_bucket function
supplies the bucket.
I slightly customized this function to provide based on weight instead of
hash as below,
<<<<<< code starts here
static struct ofputil_bucket *
group_best_live_bucket(const struct xlate_ctx *ctx,
const struct group_dpif *group,
uint32_t basis)
{
struct ofputil_bucket *best_bucket = NULL;
uint32_t best_score = 0;
struct ofputil_bucket *bucket;
const struct ovs_list *buckets;
unsigned int seed = time(NULL);
uint32_t rand_num = 0, sum = 0;
// generate a random number in [1, 10]
rand_num = (rand_r(&seed) % 10) + 1;
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(bucket->bucket_id, basis) & 0xffff) *
bucket->weight;
if (score >= best_score) {
best_bucket = bucket;
best_score = score;
}
*/
sum += bucket->weight;
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30,
300);
VLOG_DBG_RL(&rl, "SURESH randnum %d bucket weight %d sum %d ",
rand_num, bucket->weight, sum);
if (rand_num <= sum) {
return bucket;
}
}
}
return best_bucket;
}
<<<<<<code ends
When i tested, i see the packet travels only on one bucket all the time.
But the code hits and see the debug prints as below, Looks like the very
first time when the bucket selects, the data flow gets created after that
its not creating a new flow.
LOGS below
==========
2018-12-14T00:02:44.592Z|00127|ofproto_dpif_xlate(handler36)|DBG|SURESH
randnum 1 bucket weight 4 sum 4
2018-12-14T00:02:44.593Z|00128|dpif(handler36)|DBG|system@ovs-system:
put[create] ufid:bd41a81e-b9e1-44a3-8ecf-9d5671622890
recirc_id(0),dp_hash(0/0),skb_priority(0/0),in_port(3),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0800),ipv4(src=192.168.1.1,dst=192.168.1.2,proto=17,tos=0/0,ttl=64/0,frag=no),udp(src=39895,dst=5001),
actions:2
2018-12-14T00:02:44.593Z|00129|dpif(handler36)|DBG|system@ovs-system:
execute 2 on packet
udp,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=192.168.1.1,nw_dst=192.168.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=39895,tp_dst=5001
udp_csum:1987
with metadata skb_priority(0),skb_mark(0),in_port(3) mtu 0
2018-12-14T00:02:44.593Z|00130|dpif(handler36)|DBG|system@ovs-system:
execute 2 on packet
udp,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=192.168.1.1,nw_dst=192.168.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=39895,tp_dst=5001
udp_csum:1437
2018-12-14T00:04:38.975Z|00365|ofproto_dpif_xlate(handler36)|DBG|SURESH
randnum 5 bucket weight 4 sum 4
2018-12-14T00:04:38.975Z|00366|ofproto_dpif_xlate(handler36)|DBG|SURESH
randnum 5 bucket weight 5 sum 9
2018-12-14T00:04:38.976Z|00367|poll_loop(handler36)|DBG|wakeup due to 0-ms
timeout at ofproto/ofproto-dpif-upcall.c:700 (0% CPU usage)
2018-12-14T00:04:38.976Z|00368|poll_loop(handler36)|DBG|wakeup due to 0-ms
timeout at ofproto/ofproto-dpif-upcall.c:700 (0% CPU usage)
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev