diff mbox series

[ovs-dev,v2,10/12] odp-execute: Use const qualifer for batch size.

Message ID 1505913181-82547-11-git-send-email-bhanuprakash.bodireddy@intel.com
State Accepted
Headers show
Series Use packet batch macro and APIs. | expand

Commit Message

Bodireddy, Bhanuprakash Sept. 20, 2017, 1:12 p.m. UTC
It is recommended to use const qualifer for 'num' that tracks the
packet batch count. This way 'num' can't be modified by iterator.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 lib/odp-execute.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 3, 2017, 8:27 p.m. UTC | #1
On Wed, Sep 20, 2017 at 02:12:59PM +0100, Bhanuprakash Bodireddy wrote:
> It is recommended to use const qualifer for 'num' that tracks the
> packet batch count. This way 'num' can't be modified by iterator.
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

Applied to master, thanks!
diff mbox series

Patch

diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 5f4d23a..3109f39 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -826,7 +826,8 @@  odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
             break;
         }
         case OVS_ACTION_ATTR_DECAP_NSH: {
-            size_t i, num = batch->count;
+            size_t i;
+            const size_t num = dp_packet_batch_size(batch);
 
             DP_PACKET_BATCH_REFILL_FOR_EACH (i, num, packet, batch) {
                 if (decap_nsh(packet)) {