diff mbox

[ovs-dev,patch_v2] flow.c: Refactor ct_orig_tuple check in miniflow_extract.

Message ID 1496669673-101694-1-git-send-email-dlu998@gmail.com
State Accepted
Headers show

Commit Message

Darrell Ball June 5, 2017, 1:34 p.m. UTC
The checks to populate ct_orig_tuple in miniflow_extract
include recirc_id being non-zero.  Now, ct_orig_tuple
is only populated if the packet has passed through the
connection tracker, which is a prerequisite for having
valid ct_orig_tuple information.  This is recognized by
having a non-zero ct_state.  This has an added benefit
of saving some processing time.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
---

 v1->v2: Clarify commit message.

 lib/flow.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ben Pfaff June 7, 2017, 4:41 p.m. UTC | #1
On Mon, Jun 05, 2017 at 06:34:33AM -0700, Darrell Ball wrote:
> The checks to populate ct_orig_tuple in miniflow_extract
> include recirc_id being non-zero.  Now, ct_orig_tuple
> is only populated if the packet has passed through the
> connection tracker, which is a prerequisite for having
> valid ct_orig_tuple information.  This is recognized by
> having a non-zero ct_state.  This has an added benefit
> of saving some processing time.
> 
> Signed-off-by: Darrell Ball <dlu998@gmail.com>
> ---
> 
>  v1->v2: Clarify commit message.

Applied, thanks!
diff mbox

Patch

diff --git a/lib/flow.c b/lib/flow.c
index b30ecbf..1f51b66 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -615,12 +615,15 @@  miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
     }
     miniflow_push_uint32(mf, dp_hash, md->dp_hash);
     miniflow_push_uint32(mf, in_port, odp_to_u32(md->in_port.odp_port));
-    if (md->recirc_id || md->ct_state) {
+    if (md->ct_state) {
         miniflow_push_uint32(mf, recirc_id, md->recirc_id);
         miniflow_push_uint8(mf, ct_state, md->ct_state);
         ct_nw_proto_p = miniflow_pointer(mf, ct_nw_proto);
         miniflow_push_uint8(mf, ct_nw_proto, 0);
         miniflow_push_uint16(mf, ct_zone, md->ct_zone);
+    } else if (md->recirc_id) {
+        miniflow_push_uint32(mf, recirc_id, md->recirc_id);
+        miniflow_pad_to_64(mf, recirc_id);
     }
 
     if (md->ct_state) {