[ovs-dev] [PATCH] datapath: Initialize OVS_CB in ovs_vport_receive()

Pravin B Shelar pshelar at nicira.com
Fri Jun 27 00:07:54 UTC 2014


On packet recv OVS CB is initialized in multiple function.
Following patch moves all these initialization to
ovs_vport_receive().
This patch also save a check in execute actions.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 datapath/actions.c  | 3 ---
 datapath/datapath.c | 6 ++----
 datapath/datapath.h | 2 +-
 datapath/vport.c    | 5 ++++-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/datapath/actions.c b/datapath/actions.c
index cb26ad5..1f12f55 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -811,9 +811,6 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, bool recirc)
 		goto out_loop;
 	}
 
-	if (!recirc)
-		ovs_skb_init_inner_protocol(skb);
-
 	OVS_CB(skb)->tun_info = NULL;
 	error = do_execute_actions(dp, skb, acts->actions, acts->actions_len);
 
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 4ec908e..e504fee 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -285,15 +285,13 @@ out:
 }
 
 /* Must be called with rcu_read_lock. */
-void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
+void ovs_dp_process_received_packet(struct sk_buff *skb)
 {
 	int error;
 	struct sw_flow_key key;
 
-	OVS_CB(skb)->input_vport = p;
-
 	/* Extract flow from 'skb' into 'key'. */
-	error = ovs_flow_extract(skb, p->port_no, &key);
+	error = ovs_flow_extract(skb, OVS_CB(skb)->input_vport->port_no, &key);
 	if (unlikely(error)) {
 		kfree_skb(skb);
 		return;
diff --git a/datapath/datapath.h b/datapath/datapath.h
index fcd8e86..d6dee50 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -189,7 +189,7 @@ extern struct notifier_block ovs_dp_device_notifier;
 extern struct genl_family dp_vport_genl_family;
 extern struct genl_multicast_group ovs_dp_vport_multicast_group;
 
-void ovs_dp_process_received_packet(struct vport *, struct sk_buff *);
+void ovs_dp_process_received_packet(struct sk_buff *);
 void ovs_dp_process_packet_with_key(struct sk_buff *,
 				    struct sw_flow_key *pkt_key, bool recirc);
 void ovs_dp_detach_port(struct vport *);
diff --git a/datapath/vport.c b/datapath/vport.c
index 02ccc89..897f221 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -32,6 +32,7 @@
 #include <net/net_namespace.h>
 
 #include "datapath.h"
+#include "gso.h"
 #include "vport.h"
 #include "vport-internal_dev.h"
 
@@ -478,8 +479,10 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
 	stats->rx_bytes += skb->len;
 	u64_stats_update_end(&stats->syncp);
 
+	ovs_skb_init_inner_protocol(skb);
 	OVS_CB(skb)->tun_info = tun_info;
-	ovs_dp_process_received_packet(vport, skb);
+	OVS_CB(skb)->input_vport = vport;
+	ovs_dp_process_received_packet(skb);
 }
 
 /**
-- 
1.9.3




More information about the dev mailing list