Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/rstp: More robust thread safety.
Current code expects there to be a single thread that is responsible for creating rstp and creating and deleting rstp_port objects. rstp objects are also deleted from other threads, as managed by reference counting. rstp port objects are not reference counted, which means that references to rstp ports may only be held while holding the rstp mutex, or by the thread that creates and deletes them. This patch adds reference counting to RSTP ports, which allows ports to be passed from ofproto-dpif to ofproto-dpif-xlate without using the RSTP port number. This simplifies RSTP port reconfiguration, as the port need not be resynchronized with xlate if just the port number changes. This also avoids lookups on the processing of RSTP BPDUs. This patch also: 1. Exposes the rstp mutex so that related thread safety annotations can be used also within rstp-state-machines.c. 2. Internal variants of most setter an getter functions are defined, suffixed with two underscores. These are annotated to be callable only when the mutex is held. 3. Port setters were only called in a specific pattern. The new external port setter combines them in a single rspt_port_set() function. Signed-off-by: Jarno Rajahalme <[email protected]> Acked-by: Daniele Venturino <[email protected]>
- Loading branch information