> On Sep 13, 2016, at 12:38 PM, Ben Pfaff <b...@ovn.org> wrote: > > On Mon, Sep 12, 2016 at 01:52:35PM -0700, Jarno Rajahalme wrote: >> Make connmgr_wants_packet_in_on_miss() use an atomic int instead of a >> list traversal taking the 'ofproto_mutex'. This allows >> connmgr_wants_packet_in_on_miss() to be called also when >> 'ofproto_mutex' is already held, and makes it faster, too. >> >> Remove unused ofproto_dpif_wants_packet_in_on_miss(). >> >> Signed-off-by: Jarno Rajahalme <ja...@ovn.org> >> --- >> v3: Fix the totally broken behavior with a help of a per-ofconn boolean. > > I think that update_want_packet_in_on_miss() can be a little more > straightforward. How about this? I have not tested it. > > static void > update_want_packet_in_on_miss(struct ofconn *ofconn) > { > /* We want a packet-in on miss when controller_id is zero and OpenFlow is > * lower than version 1.3. */ > enum ofputil_protocol p = ofconn->protocol; > int new_want = (ofconn->controller_id == 0 && > (p == OFPUTIL_P_NONE || > ofputil_protocol_to_ofp_version(p) < OFP13_VERSION)); > > /* Update the setting and the count if ncessary. */ > int old_want = ofconn->want_packet_in_on_miss; > if (old_want != new_want) { > atomic_int *dst = &ofconn->connmgr->want_packet_in_on_miss; > int count; > atomic_read_relaxed(dst, &count); > atomic_store_relaxed(dst, count - old_want + new_want); > > ofconn->want_packet_in_on_miss = new_want; > } > } >
Thanks for the review, I adopted this improvement. Jarno > Acked-by: Ben Pfaff <b...@ovn.org> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev