dpif: Allow adding ukeys for same flow by different pmds.
authorIlya Maximets <i.maximets@samsung.com>
Wed, 3 Feb 2016 11:31:43 +0000 (14:31 +0300)
committerJoe Stringer <joe@ovn.org>
Wed, 3 Feb 2016 23:49:52 +0000 (15:49 -0800)
commit5f2ccb1c0d3b01b775ba03c89a486cae7b720275
tree62b050f3bb60e86d7e4c198dd520ac70d0a5a8f4
parent45863ce567c8edf53b5e41e359295f694bb9d3b4
dpif: Allow adding ukeys for same flow by different pmds.

In multiqueue mode several pmd threads may process one port, but
different queues. Flow may not depend on queue. It's true at least for
vhost-user ports.

When multiple pmd threads attempt to process upcalls for a particular
flow key, only the first will succeed. Any subsequent threads will
receive error = ENOSPC when attempting to insert a new udpif_key into
the umaps. This causes the latter threads to never insert a flow into
the datapath to handle the traffic, and as a result they will
consistently execute those flows through the slow path.

Fix that by mixing pmd_id with the bits from the ufid for ukey->hash
calculation. So, for a given flow key/UFID, each pmd thread will create
an independent udpif_key.

This also opens the possibility to reassign queues among pmd threads
without restarting them and deleting the megaflow cache.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
ofproto/ofproto-dpif-upcall.c