On Thu, Aug 01, 2013 at 03:55:47PM -0700, Ethan Jackson wrote: > Once we have multiple threads running, having each execute flow mods > created by the learn action won't be tenable. It essentially will > require us to make the core ofproto module thread safe, which is not > the direction we want to go. This patch punts on the problem by > handing flow mods to ofproto-dpif to handle later. > > Signed-off-by: Ethan Jackson <et...@nicira.com>
run_fast() does this: list_init(&flow_mods); ovs_mutex_lock(&ofproto->flow_mod_mutex); while (ofproto->n_flow_mods) { list_push_back(&flow_mods, list_pop_front(&ofproto->flow_mods)); ofproto->n_flow_mods--; } ovs_mutex_unlock(&ofproto->flow_mod_mutex); I think that we can do this in O(1) instead of O(n): ovs_mutex_lock(&ofproto->flow_mod_mutex); if (ofproto->n_flow_mods) { flow_mods = ofproto->flow_mods; list_moved(&flow_mods); list_init(&ofproto->flow_mods); ofproto->n_flow_mods--; } else { list_init(&flow_mods); } ovs_mutex_unlock(&ofproto->flow_mod_mutex); Acked-by: Ben Pfaff <b...@nicira.com> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev