[ovs-dev,v12,7/8] dp-packet: Add 'do_not_steal' packet batch flag.

Message ID 1549853790-43330-8-git-send-email-dlu998@gmail.com
State Changes Requested
Headers show
Series
  • Userspace datapath: Add fragmentation support.
Related show

Commit Message

Darrell Ball Feb. 11, 2019, 2:56 a.m.
This is needed in a subsequent patch and may otherwise be useful.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
---
 lib/dp-packet.h   | 2 ++
 lib/dpif-netdev.c | 1 +
 2 files changed, 3 insertions(+)

Comments

Darrell Ball Feb. 11, 2019, 8:52 p.m. | #1
sorry, one line of this patch was placed in the wrong function.
The following incremental relocates it to the proper function.

dball@ubuntu:~/openvswitch/ovs$ git diff
diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index c4ecd2d..dae197e 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -750,6 +750,7 @@ dp_packet_batch_init(struct dp_packet_batch *batch)
 {
     batch->count = 0;
     batch->trunc = false;
+    batch->do_not_steal = false;
 }

 static inline void
@@ -796,7 +797,6 @@ dp_packet_batch_init_packet(struct dp_packet_batch
*batch, s
 {
     dp_packet_batch_init(batch);
     batch->count = 1;
-    batch->do_not_steal = false;
     batch->packets[0] = p;
 }


On Sun, Feb 10, 2019 at 6:56 PM Darrell Ball <dlu998@gmail.com> wrote:

> This is needed in a subsequent patch and may otherwise be useful.
>
> Signed-off-by: Darrell Ball <dlu998@gmail.com>
> ---
>  lib/dp-packet.h   | 2 ++
>  lib/dpif-netdev.c | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> index 034b81b..c4ecd2d 100644
> --- a/lib/dp-packet.h
> +++ b/lib/dp-packet.h
> @@ -741,6 +741,7 @@ enum { NETDEV_MAX_BURST = 32 }; /* Maximum number
> packets in a batch. */
>  struct dp_packet_batch {
>      size_t count;
>      bool trunc; /* true if the batch needs truncate. */
> +    bool do_not_steal; /* Indicate that the packets should not be stolen.
> */
>      struct dp_packet *packets[NETDEV_MAX_BURST];
>  };
>
> @@ -795,6 +796,7 @@ dp_packet_batch_init_packet(struct dp_packet_batch
> *batch, struct dp_packet *p)
>  {
>      dp_packet_batch_init(batch);
>      batch->count = 1;
> +    batch->do_not_steal = false;
>      batch->packets[0] = p;
>  }
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 0f57e3f..47e6c80 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -3716,6 +3716,7 @@ dpif_netdev_execute(struct dpif *dpif, struct
> dpif_execute *execute)
>      }
>
>      dp_packet_batch_init_packet(&pp, execute->packet);
> +    pp.do_not_steal = true;
>      dp_netdev_execute_actions(pmd, &pp, false, execute->flow,
>                                execute->actions, execute->actions_len);
>      dp_netdev_pmd_flush_output_packets(pmd, true);
> --
> 1.9.1
>
>

Patch

diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index 034b81b..c4ecd2d 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -741,6 +741,7 @@  enum { NETDEV_MAX_BURST = 32 }; /* Maximum number packets in a batch. */
 struct dp_packet_batch {
     size_t count;
     bool trunc; /* true if the batch needs truncate. */
+    bool do_not_steal; /* Indicate that the packets should not be stolen. */
     struct dp_packet *packets[NETDEV_MAX_BURST];
 };
 
@@ -795,6 +796,7 @@  dp_packet_batch_init_packet(struct dp_packet_batch *batch, struct dp_packet *p)
 {
     dp_packet_batch_init(batch);
     batch->count = 1;
+    batch->do_not_steal = false;
     batch->packets[0] = p;
 }
 
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0f57e3f..47e6c80 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3716,6 +3716,7 @@  dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute)
     }
 
     dp_packet_batch_init_packet(&pp, execute->packet);
+    pp.do_not_steal = true;
     dp_netdev_execute_actions(pmd, &pp, false, execute->flow,
                               execute->actions, execute->actions_len);
     dp_netdev_pmd_flush_output_packets(pmd, true);