dpif-netdev: Use hmap for ports.
authorDaniele Di Proietto <diproiettod@vmware.com>
Mon, 4 Apr 2016 18:15:12 +0000 (11:15 -0700)
committerDaniele Di Proietto <diproiettod@vmware.com>
Mon, 23 May 2016 17:27:35 +0000 (10:27 -0700)
commite9985d6aa45f1081089dedc5aed829b79e149277
tree0d32a1b04f4b1b081246980bec1360a498c3f02f
parentbfbcebc27297cfaf97f338a51e3567824d483c8d
dpif-netdev: Use hmap for ports.

netdev objects are hard to use with RCU, because it's not possible to
split removal and reclamation.  Postponing the removal means that the
port is not removed and cannot be readded immediately.  Waiting for
reclamation means introducing a quiescent state, and that may introduce
subtle bugs, due to the RCU model we use in userspace.

This commit changes the port container from cmap to hmap.  'port_mutex'
must be held by readers and writers.  This shouldn't have performance
impact, as readers in the fast path use a thread local cache.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Tested-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
lib/dpif-netdev.c