[ovs-dev] [PATCH] datapath: remove flow member from struct ovs_skb_cb

Lorand Jakab lojakab at cisco.com
Thu Aug 21 17:25:47 UTC 2014


struct ovs_skb_cb is full on kernels < 3.11 due to compatibility code.
This patch removes the 'flow' member in order to make room for data
needed by layer 3 flow/port support that will be added in an upcoming
patch.  The 'flow' memeber was chosen for removal because it's only used
in ovs_execute_actions().

Signed-off-by: Lorand Jakab <lojakab at cisco.com>
---
 datapath/actions.c  |  4 ++--
 datapath/datapath.c | 12 +++++++-----
 datapath/datapath.h |  4 ++--
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/datapath/actions.c b/datapath/actions.c
index d70348e..ad22467 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -950,9 +950,9 @@ static int loop_suppress(struct datapath *dp, struct sw_flow_actions *actions)
 }
 
 /* Execute a list of actions against 'skb'. */
-int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, bool recirc)
+int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
+			struct sw_flow_actions *acts, bool recirc)
 {
-	struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts);
 	const u8 stack_cost = recirc ? RECIRC_STACK_COST : DEFAULT_STACK_COST;
 	struct loop_counter *loop;
 	int error;
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 3ca9716..4d34415 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -257,6 +257,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, bool recirc)
 	struct sw_flow_key *pkt_key = OVS_CB(skb)->pkt_key;
 	struct datapath *dp = p->dp;
 	struct sw_flow *flow;
+	struct sw_flow_actions *sf_acts;
 	struct dp_stats_percpu *stats;
 	u64 *stats_counter;
 	u32 n_mask_hit;
@@ -279,10 +280,10 @@ void ovs_dp_process_packet(struct sk_buff *skb, bool recirc)
 		goto out;
 	}
 
-	OVS_CB(skb)->flow = flow;
+	sf_acts = rcu_dereference(flow->sf_acts);
 
-	ovs_flow_stats_update(OVS_CB(skb)->flow, pkt_key->tp.flags, skb);
-	ovs_execute_actions(dp, skb, recirc);
+	ovs_flow_stats_update(flow, pkt_key->tp.flags, skb);
+	ovs_execute_actions(dp, skb, sf_acts, recirc);
 	stats_counter = &stats->n_hit;
 
 out:
@@ -509,6 +510,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
 	struct sw_flow_actions *acts;
 	struct sk_buff *packet;
 	struct sw_flow *flow;
+	struct sw_flow_actions *sf_acts;
 	struct datapath *dp;
 	struct ethhdr *eth;
 	struct vport *input_vport;
@@ -557,7 +559,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
 		goto err_flow_free;
 
 	rcu_assign_pointer(flow->sf_acts, acts);
-	OVS_CB(packet)->flow = flow;
 	OVS_CB(packet)->pkt_key = &flow->key;
 	OVS_CB(skb)->egress_tun_info = NULL;
 	packet->priority = flow->key.phy.priority;
@@ -577,9 +578,10 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
 		goto err_unlock;
 
 	OVS_CB(packet)->input_vport = input_vport;
+	sf_acts = rcu_dereference(flow->sf_acts);
 
 	local_bh_disable();
-	err = ovs_execute_actions(dp, packet, false);
+	err = ovs_execute_actions(dp, packet, sf_acts, false);
 	local_bh_enable();
 	rcu_read_unlock();
 
diff --git a/datapath/datapath.h b/datapath/datapath.h
index 651c119..baad3d5 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -104,7 +104,6 @@ struct datapath {
  * when a packet is received by OVS.
  */
 struct ovs_skb_cb {
-	struct sw_flow		*flow;
 	struct sw_flow_key	*pkt_key;
 	struct ovs_tunnel_info  *egress_tun_info;
 	struct vport	*input_vport;
@@ -199,7 +198,8 @@ const char *ovs_dp_name(const struct datapath *dp);
 struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 portid, u32 seq,
 					 u8 cmd);
 
-int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, bool recirc);
+int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
+                        struct sw_flow_actions *acts, bool recirc);
 void ovs_dp_notify_wq(struct work_struct *work);
 
 #define OVS_NLERR(fmt, ...)					\
-- 
1.8.5.5




More information about the dev mailing list