[ovs-dev] [PATCHv2] dpif: Support flow_get in dpif_operate().

Joe Stringer joestringer at nicira.com
Wed Aug 13 21:43:27 UTC 2014


Thanks for the review, I plan to push with the following changes (I noticed
that the other dpif-linux operations - PUT,DEL have redundant memsets, so
deleting them too):

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index e767d9f..c4420f4 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -1402,10 +1402,6 @@ dpif_linux_operate__(struct dpif_linux *dpif,
                         dpif_linux_flow_get_stats(&reply, put->stats);
                     }
                 }
-
-                if (op->error) {
-                    memset(put->stats, 0, sizeof *put->stats);
-                }
             }
             break;

@@ -1421,10 +1417,6 @@ dpif_linux_operate__(struct dpif_linux *dpif,
                         dpif_linux_flow_get_stats(&reply, del->stats);
                     }
                 }
-
-                if (op->error) {
-                    memset(del->stats, 0, sizeof *del->stats);
-                }
             }
             break;

@@ -1441,10 +1433,6 @@ dpif_linux_operate__(struct dpif_linux *dpif,
                     dpif_linux_flow_to_dpif_flow(get->flow, &reply);
                 }
             }
-
-            if (op->error) {
-                memset(get->flow, 0, sizeof *get->flow);
-            }
             break;

         default:
diff --git a/lib/dpif.c b/lib/dpif.c
index 8ba889f..13a73e6 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1152,6 +1152,10 @@ dpif_operate(struct dpif *dpif, struct dpif_op
**ops, size_t n_ops)

                     COVERAGE_INC(dpif_flow_get);
                     log_flow_get_message(dpif, get, error);
+
+                    if (error) {
+                        memset(get->flow, 0, sizeof *get->flow);
+                    }
                     break;
                 }

diff --git a/lib/dpif.h b/lib/dpif.h
index 4a21a59..a310d7d 100644
--- a/lib/dpif.h
+++ b/lib/dpif.h
@@ -671,7 +671,7 @@ struct dpif_execute {
  *
  * The flow is specified by the Netlink attributes with types
OVS_KEY_ATTR_* in
  * the 'key_len' bytes starting at 'key'. 'buffer' must point to an
initialized
- * buffer of size DPIF_FLOW_BUFSIZE bytes.
+ * buffer, with a recommended size of DPIF_FLOW_BUFSIZE bytes.
  *
  * On success, 'flow' will be populated with the mask, actions and stats
for
  * the datapath flow corresponding to 'key'. The mask and actions may point



More information about the dev mailing list