[ovs-dev] [PATCH 2/7] datapath: Eliminate memset() from flow_extract.

Thomas Graf tgraf at suug.ch
Wed Jun 11 09:03:15 UTC 2014


On 06/10/14 at 04:47pm, Jesse Gross wrote:
> As new protocols are added, the size of the flow key tends to
> increase although few protocols care about all of the fields. In
> order to optimize this for hashing and matching, OVS uses a varible
> length portion of the key. However, when fields are extracted from
> the packet we must still zero out the entire key.
> 
> This is no longer necessary now that OVS implements masking. Any
> fields (or holes in the structure) which are not part of a given
> protocol will be by definition not part of the mask and zeroed out
> during lookup. Furthermore, since masking already uses variable
> length keys this zeroing operation automatically benefits as well.
> 
> In principle, the only thing that needs to be done at this point
> is remove the memset() at the beginning of flow. However, some
> fields assume that they are initialized to zero, which now must be
> done explicitly. In addition, in the event of an error we must also
> zero out corresponding fields to signal that there is no valid data
> present. These increase the total amount of code but very little of
> it is executed in non-error situations.
> 
> Removing the memset() reduces the profile of ovs_flow_extract()
> from 0.64% to 0.56% when tested with large packets on a 10G link.
> 
> Suggested-by: Pravin Shelar <pshelar at nicira.com>
> Signed-off-by: Jesse Gross <jesse at nicira.com>

Nice!

Acked-by: Thomas Graf <tgraf at suug.ch>



More information about the dev mailing list