Skip to content

Commit

Permalink
lib/flow: Introduce miniflow_extract().
Browse files Browse the repository at this point in the history
miniflow_extract() extracts packet headers directly to a miniflow,
which is a compressed form of the struct flow.  This does not require
a large struct to be cleared to begin with, and accesses less memory.
These performance benefits should allow this to be used in the DPDK
datapath.

miniflow_extract() takes a miniflow as an input/output parameter.  On
input the buffer for values to be extracted must be properly
initialized.  On output the map contains ones for all the fields that
have been extracted.

Some struct flow fields are reordered to make miniflow_extract to
progress in the logical order.

Some explicit "inline" keywords are necessary for GCC to optimize this
properly.  Also, macros are used for same reason instead of inline
functions for pushing data to the miniflow.

Signed-off-by: Jarno Rajahalme <[email protected]>
Reviewed-by: YAMAMOTO Takashi <[email protected]>
  • Loading branch information
Jarno Rajahalme committed Apr 18, 2014
1 parent 5b23ff7 commit 419681d
Show file tree
Hide file tree
Showing 8 changed files with 500 additions and 315 deletions.
12 changes: 12 additions & 0 deletions lib/byte-order.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,16 @@ uint32_byteswap(uint32_t crc) {
((((ovs_be64) (VALUE)) & UINT64_C(0xff00000000000000)) >> 56))
#endif

#if WORDS_BIGENDIAN
#define BYTES_TO_BE32(B1, B2, B3, B4) \
(OVS_FORCE ovs_be32)((uint32_t)(B1) << 24 | (B2) << 16 | (B3) << 8 | (B4))
#define BE16S_TO_BE32(B1, B2) \
(OVS_FORCE ovs_be32)((uint32_t)(B1) << 16 | (B2))
#else
#define BYTES_TO_BE32(B1, B2, B3, B4) \
(OVS_FORCE ovs_be32)((uint32_t)(B1) | (B2) << 8 | (B3) << 16 | (B4) << 24)
#define BE16S_TO_BE32(B1, B2) \
(OVS_FORCE ovs_be32)((uint32_t)(B1) | (B2) << 16)
#endif

#endif /* byte-order.h */
Loading

0 comments on commit 419681d

Please sign in to comment.