dpif-netdev: Allow direct destroy of 'struct dp_netdev_port'.
authorAlex Wang <alexw@nicira.com>
Fri, 7 Nov 2014 21:27:05 +0000 (13:27 -0800)
committerAlex Wang <alexw@nicira.com>
Wed, 12 Nov 2014 23:59:12 +0000 (15:59 -0800)
commitaccf86266abbde21d5a8145bf14125db0f4e0e2d
treeb6734148d8d50d908ca15eaa93b38afbb5065a34
parent40a9c4c26be9b59c3494dd5900c21015ea7d27d4
dpif-netdev: Allow direct destroy of 'struct dp_netdev_port'.

Before this commit, when 'struct dp_netdev_port' is deleted from
'dpif-netdev' datapath, if there is pmd thread, the pmd thread
will release the last reference to the port and ovs-rcu postpone
the destroy.  However, the delayed close of object like 'struct
netdev' could cause failure in immediate re-add or reconfigure of
the same device.

To fix the above issue, this commit uses condition variable and
makes the main thread wait for pmd thread to release the reference
when deleting port.  Then, the main thread can directly destroy the
port.

Reported-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/dpif-netdev.c