dpif-netdev: Store batch pointer in dp_netdev_flow.
authorDaniele Di Proietto <diproiettod@vmware.com>
Mon, 18 May 2015 17:47:50 +0000 (10:47 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Mon, 18 May 2015 22:14:02 +0000 (15:14 -0700)
commit11e5cf1f9043637613502f4477c8fd5ce6d65f12
tree600e7f505f841611b2d2245d2e9f44fd409a0ac4
parentefa2bcbb358b0cb71524d5ad329edb495c123d11
dpif-netdev: Store batch pointer in dp_netdev_flow.

The userspace datapath

1. receives a batch of packets.
2. finds a 'netdev_flow' (megaflow) for each packet.
3. groups the packets in output batches based on the 'netdev_flow'.

Until now the grouping (2) was done using a simple algorithm with a
O(N^2) runtime, where N is the number of distinct megaflows of the packets
in the incoming batch.  This could quickly become a bottleneck, even with
a small number of megaflows.

With this commit the datapath simply stores in the 'netdev_flow' (the
megaflow) a pointer to the output batch, if one has been created for the
current input batch.  The pointer will be cleared when the output batch
is sent.

In a simple phy2phy test with 128 megaflows the throughput is more than
doubled.

The reason that stopped us from doing this change was that the
'netdev_flow' memory was shared between multiple threads: this is no
longer the case with the per-thread classifier.

Also, this commit reorders struct dp_netdev_flow to group toghether the
members used in the fastpath.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/dpif-netdev.c