[ovs-dev] [PATCH v5 7/9] datapath: Take actions directly in ovs_flow_cmd_alloc_info().

Jarno Rajahalme jrajahalme at nicira.com
Tue Mar 25 21:35:57 UTC 2014


ovs_flow_cmd_alloc_info() does not need the flow, but the actions.
Taking actions directly allows further optimization in a subsequent
patch.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
v5: Split to a separate patch.

 datapath/datapath.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 2901d69..0de00ad 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -762,22 +762,19 @@ error:
 	return err;
 }
 
-/* Must be called with rcu_read_lock or ovs_mutex if 'flow' is in the flow
- * table. */
-static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow *flow,
+/* Must be called with rcu_read_lock or ovs_mutex if 'acts' is in a flow
+ * that is in the flow table. */
+static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow_actions *acts,
 					       struct genl_info *info,
 					       bool always)
 {
 	struct sk_buff *skb;
-	size_t len;
 
 	if (!always && !ovs_must_notify(info, &ovs_dp_flow_multicast_group))
 		return NULL;
 
-	len = ovs_flow_cmd_msg_size(ovsl_dereference_flow_acts(flow));
-
-	skb = genlmsg_new_unicast(len, info, GFP_KERNEL);
-
+	skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info,
+				  GFP_KERNEL);
 	if (!skb)
 		return ERR_PTR(-ENOMEM);
 
@@ -794,7 +791,8 @@ static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow,
 	struct sk_buff *skb;
 	int retval;
 
-	skb = ovs_flow_cmd_alloc_info(flow, info, always);
+	skb = ovs_flow_cmd_alloc_info(ovsl_dereference_flow_acts(flow), info,
+				      always);
 	if (!skb || IS_ERR(skb))
 		return skb;
 
-- 
1.7.10.4




More information about the dev mailing list