From: Ethan Jackson Date: Fri, 4 Apr 2014 00:31:03 +0000 (-0700) Subject: flow: Rearrange struct flow for better megaflows. X-Git-Tag: sliver-openvswitch-2.2.90-1~5^2~42 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=1c1764f971d470f5291a86c0f715867ce26bf321 flow: Rearrange struct flow for better megaflows. Since the dp_hash will often be a hash of the 5 tuple, it makes sense to put it with the L4 header so it hits in the last classifier lookup stage. Signed-off-by: Ethan Jackson Acked-by: Ben Pfaff Acked-by: Andy Zhou --- diff --git a/lib/flow.h b/lib/flow.h index a6f45c91e..d6dc30837 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -97,17 +97,13 @@ union flow_in_port { * be looked at. This enables better wildcarding for datapath flows. */ struct flow { - /* Recirculation */ - uint32_t dp_hash; /* Datapath computed hash value. The exact - computation is opaque to the user space.*/ - uint32_t recirc_id; /* Must be exact match. */ - /* L1 */ struct flow_tnl tunnel; /* Encapsulating tunnel parameters. */ ovs_be64 metadata; /* OpenFlow Metadata. */ uint32_t regs[FLOW_N_REGS]; /* Registers. */ uint32_t skb_priority; /* Packet priority for QoS. */ uint32_t pkt_mark; /* Packet mark. */ + uint32_t recirc_id; /* Must be exact match. */ union flow_in_port in_port; /* Input port.*/ /* L2 */ @@ -134,6 +130,8 @@ struct flow { ovs_be16 pad; /* Padding. */ /* L4 */ + uint32_t dp_hash; /* Datapath computed hash value. The exact + computation is opaque to the user space.*/ ovs_be16 tp_src; /* TCP/UDP/SCTP source port. */ ovs_be16 tp_dst; /* TCP/UDP/SCTP destination port. * Keep last for the BUILD_ASSERT_DECL below */ @@ -156,7 +154,7 @@ BUILD_ASSERT_DECL(offsetof(struct flow, tp_dst) + 2 enum { FLOW_SEGMENT_1_ENDS_AT = offsetof(struct flow, dl_src), FLOW_SEGMENT_2_ENDS_AT = offsetof(struct flow, ipv6_src), - FLOW_SEGMENT_3_ENDS_AT = offsetof(struct flow, tp_src), + FLOW_SEGMENT_3_ENDS_AT = offsetof(struct flow, dp_hash), }; BUILD_ASSERT_DECL(FLOW_SEGMENT_1_ENDS_AT % 4 == 0); BUILD_ASSERT_DECL(FLOW_SEGMENT_2_ENDS_AT % 4 == 0);