ofproto-dpif-xlate: Do initial rule lookup for callers.
authorEthan Jackson <ethan@nicira.com>
Wed, 9 Oct 2013 20:23:31 +0000 (13:23 -0700)
committerEthan Jackson <ethan@nicira.com>
Wed, 9 Oct 2013 23:55:37 +0000 (16:55 -0700)
commit550701c773b7d3c9a4711d2f9824ad32c5d9ff3f
tree9b7bf88823b22c5c9f512e867b8ac4f7ae4e966f
parent76fb0c1282b916ef157324f53ec00d738864d806
ofproto-dpif-xlate: Do initial rule lookup for callers.

None of the functions available in ofproto-dpif.h are thread safe
unless holding the xlate_rwlock because one can't know that an ofproto
or ofport used as argument will survive during the function call.  For
this reason, ofproto-dpif-upcall's invocation of rule_dpif_lookup()
is unsafe because the ofproto could be destroyed during the call.

This patch fixes the problem by optionally doing the initial rule
lookup in xlate_actions() so that it can be done while holding the
xlate_rwlock.  This has the nice side benefit of removing a bunch of
boilerplate.

Note that this only partially solves the problem, there's still
vsp_realdev_to_vlandev() and ofproto_dpif_send_packet_in() which
aren't thread safe for the same reason.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
manpages.mk
ofproto/ofproto-dpif-upcall.c
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif-xlate.h
ofproto/ofproto-dpif.c