[ovs-dev] [PATCH 1/3] dpif: Consistently help datapath to execute oversized actions.

Ben Pfaff blp at nicira.com
Wed Jun 25 18:02:26 UTC 2014


Only dpif_execute() was checking for oversized actions but dpif_operate()
should do so also.  This fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/dpif.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index 199f197..2e98de2 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1145,6 +1145,13 @@ dpif_execute_with_help(struct dpif *dpif, struct dpif_execute *execute)
     return aux.error;
 }
 
+/* Returns true if the datapath needs help executing 'execute'. */
+static bool
+dpif_execute_needs_help(const struct dpif_execute *execute)
+{
+    return execute->needs_help || nl_attr_oversized(execute->actions_len);
+}
+
 /* Causes 'dpif' to perform the 'execute->actions_len' bytes of actions in
  * 'execute->actions' on the Ethernet frame in 'execute->packet' and on packet
  * metadata in 'execute->md'.  The implementation is allowed to modify both the
@@ -1168,7 +1175,7 @@ dpif_execute(struct dpif *dpif, struct dpif_execute *execute)
 
     COVERAGE_INC(dpif_execute);
     if (execute->actions_len > 0) {
-        error = (execute->needs_help || nl_attr_oversized(execute->actions_len)
+        error = (dpif_execute_needs_help(execute)
                  ? dpif_execute_with_help(dpif, execute)
                  : dpif->dpif_class->execute(dpif, execute));
     } else {
@@ -1199,7 +1206,8 @@ dpif_operate(struct dpif *dpif, struct dpif_op **ops, size_t n_ops)
             for (chunk = 0; chunk < n_ops; chunk++) {
                 struct dpif_op *op = ops[chunk];
 
-                if (op->type == DPIF_OP_EXECUTE && op->u.execute.needs_help) {
+                if (op->type == DPIF_OP_EXECUTE
+                    && dpif_execute_needs_help(&op->u.execute)) {
                     break;
                 }
             }
-- 
1.7.10.4




More information about the dev mailing list