diff mbox

[ovs-dev,v2,05/12] dpif-netdev: Add comments to dp_netdev_input__().

Message ID 1476352715-110467-6-git-send-email-bhanuprakash.bodireddy@intel.com
State Superseded
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Bodireddy, Bhanuprakash Oct. 13, 2016, 9:58 a.m. UTC
Add comments in dp_netdev_input__() to explain the reason behind
clearing the flow batches before packet_batch_execute().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Co-authored-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/dpif-netdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Daniele Di Proietto Oct. 14, 2016, 2:13 a.m. UTC | #1
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>

2016-10-13 2:58 GMT-07:00 Bhanuprakash Bodireddy <
bhanuprakash.bodireddy@intel.com>:

> Add comments in dp_netdev_input__() to explain the reason behind
> clearing the flow batches before packet_batch_execute().
>
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> Co-authored-by: Antonio Fischetti <antonio.fischetti@intel.com>
> ---
>  lib/dpif-netdev.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 3b3556a..84aa570 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -4182,6 +4182,15 @@ dp_netdev_input__(struct dp_netdev_pmd_thread *pmd,
>          fast_path_processing(pmd, packets, keys, batches, &n_batches,
> in_port, now);
>      }
>
> +    /* All the flow batches need to be reset before any call to
> +     * packet_batch_per_flow_execute() as it could potentially trigger
> +     * recirculation. When a packet matching flow ‘j’ happens to be
> +     * recirculated, the nested call to dp_netdev_input__() could
> potentially
> +     * classify the packet as matching another flow - say 'k'. It could
> happen
> +     * that in the previous call to dp_netdev_input__() that same flow
> 'k' had
> +     * already its own batches[k] still waiting to be served.  So if its
> +     * ‘batch’ member is not reset, the recirculated packet would be
> wrongly
> +     * appended to batches[k] of the 1st call to dp_netdev_input__(). */
>      for (i = 0; i < n_batches; i++) {
>          batches[i].flow->batch = NULL;
>      }
> --
> 2.4.11
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 3b3556a..84aa570 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4182,6 +4182,15 @@  dp_netdev_input__(struct dp_netdev_pmd_thread *pmd,
         fast_path_processing(pmd, packets, keys, batches, &n_batches, in_port, now);
     }
 
+    /* All the flow batches need to be reset before any call to
+     * packet_batch_per_flow_execute() as it could potentially trigger
+     * recirculation. When a packet matching flow ‘j’ happens to be
+     * recirculated, the nested call to dp_netdev_input__() could potentially
+     * classify the packet as matching another flow - say 'k'. It could happen
+     * that in the previous call to dp_netdev_input__() that same flow 'k' had
+     * already its own batches[k] still waiting to be served.  So if its
+     * ‘batch’ member is not reset, the recirculated packet would be wrongly
+     * appended to batches[k] of the 1st call to dp_netdev_input__(). */
     for (i = 0; i < n_batches; i++) {
         batches[i].flow->batch = NULL;
     }