aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorLorand Jakab <lojakab@cisco.com>2014-10-06 08:45:32 -0400
committerPravin B Shelar <pshelar@nicira.com>2014-11-06 02:52:35 -0500
commitd98612b8c1150cb73ecd45e94c62de053f89441c (patch)
tree2ed1870ee81bb17f5d6bbfaea04ea207f75836fc /net/openvswitch
parent1a4e96a0e989200f7180264e27b22e9a85f3fcc8 (diff)
openvswitch: Remove flow member from struct ovs_skb_cb
The 'flow' memeber was chosen for removal because it's only used in ovs_execute_actions() we can pass it as argument to this function. Signed-off-by: Lorand Jakab <lojakab@cisco.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/actions.c5
-rw-r--r--net/openvswitch/datapath.c12
-rw-r--r--net/openvswitch/datapath.h4
3 files changed, 9 insertions, 12 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 9fd33c0bf173..f7e589159e4a 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -865,14 +865,11 @@ static void process_deferred_actions(struct datapath *dp)
865 865
866/* Execute a list of actions against 'skb'. */ 866/* Execute a list of actions against 'skb'. */
867int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, 867int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
868 struct sw_flow_key *key) 868 struct sw_flow_actions *acts, struct sw_flow_key *key)
869{ 869{
870 int level = this_cpu_read(exec_actions_level); 870 int level = this_cpu_read(exec_actions_level);
871 struct sw_flow_actions *acts;
872 int err; 871 int err;
873 872
874 acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts);
875
876 this_cpu_inc(exec_actions_level); 873 this_cpu_inc(exec_actions_level);
877 OVS_CB(skb)->egress_tun_info = NULL; 874 OVS_CB(skb)->egress_tun_info = NULL;
878 err = do_execute_actions(dp, skb, key, 875 err = do_execute_actions(dp, skb, key,
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index cdbc44c18714..4fd8a45e5d56 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -257,6 +257,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
257 const struct vport *p = OVS_CB(skb)->input_vport; 257 const struct vport *p = OVS_CB(skb)->input_vport;
258 struct datapath *dp = p->dp; 258 struct datapath *dp = p->dp;
259 struct sw_flow *flow; 259 struct sw_flow *flow;
260 struct sw_flow_actions *sf_acts;
260 struct dp_stats_percpu *stats; 261 struct dp_stats_percpu *stats;
261 u64 *stats_counter; 262 u64 *stats_counter;
262 u32 n_mask_hit; 263 u32 n_mask_hit;
@@ -282,10 +283,10 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
282 goto out; 283 goto out;
283 } 284 }
284 285
285 OVS_CB(skb)->flow = flow; 286 ovs_flow_stats_update(flow, key->tp.flags, skb);
287 sf_acts = rcu_dereference(flow->sf_acts);
288 ovs_execute_actions(dp, skb, sf_acts, key);
286 289
287 ovs_flow_stats_update(OVS_CB(skb)->flow, key->tp.flags, skb);
288 ovs_execute_actions(dp, skb, key);
289 stats_counter = &stats->n_hit; 290 stats_counter = &stats->n_hit;
290 291
291out: 292out:
@@ -524,6 +525,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
524 struct sw_flow_actions *acts; 525 struct sw_flow_actions *acts;
525 struct sk_buff *packet; 526 struct sk_buff *packet;
526 struct sw_flow *flow; 527 struct sw_flow *flow;
528 struct sw_flow_actions *sf_acts;
527 struct datapath *dp; 529 struct datapath *dp;
528 struct ethhdr *eth; 530 struct ethhdr *eth;
529 struct vport *input_vport; 531 struct vport *input_vport;
@@ -579,7 +581,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
579 rcu_assign_pointer(flow->sf_acts, acts); 581 rcu_assign_pointer(flow->sf_acts, acts);
580 582
581 OVS_CB(packet)->egress_tun_info = NULL; 583 OVS_CB(packet)->egress_tun_info = NULL;
582 OVS_CB(packet)->flow = flow;
583 packet->priority = flow->key.phy.priority; 584 packet->priority = flow->key.phy.priority;
584 packet->mark = flow->key.phy.skb_mark; 585 packet->mark = flow->key.phy.skb_mark;
585 586
@@ -597,9 +598,10 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
597 goto err_unlock; 598 goto err_unlock;
598 599
599 OVS_CB(packet)->input_vport = input_vport; 600 OVS_CB(packet)->input_vport = input_vport;
601 sf_acts = rcu_dereference(flow->sf_acts);
600 602
601 local_bh_disable(); 603 local_bh_disable();
602 err = ovs_execute_actions(dp, packet, &flow->key); 604 err = ovs_execute_actions(dp, packet, sf_acts, &flow->key);
603 local_bh_enable(); 605 local_bh_enable();
604 rcu_read_unlock(); 606 rcu_read_unlock();
605 607
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h
index 974135439c5c..1c56a80d6677 100644
--- a/net/openvswitch/datapath.h
+++ b/net/openvswitch/datapath.h
@@ -94,14 +94,12 @@ struct datapath {
94 94
95/** 95/**
96 * struct ovs_skb_cb - OVS data in skb CB 96 * struct ovs_skb_cb - OVS data in skb CB
97 * @flow: The flow associated with this packet. May be %NULL if no flow.
98 * @egress_tun_key: Tunnel information about this packet on egress path. 97 * @egress_tun_key: Tunnel information about this packet on egress path.
99 * NULL if the packet is not being tunneled. 98 * NULL if the packet is not being tunneled.
100 * @input_vport: The original vport packet came in on. This value is cached 99 * @input_vport: The original vport packet came in on. This value is cached
101 * when a packet is received by OVS. 100 * when a packet is received by OVS.
102 */ 101 */
103struct ovs_skb_cb { 102struct ovs_skb_cb {
104 struct sw_flow *flow;
105 struct ovs_tunnel_info *egress_tun_info; 103 struct ovs_tunnel_info *egress_tun_info;
106 struct vport *input_vport; 104 struct vport *input_vport;
107}; 105};
@@ -194,7 +192,7 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 pid, u32 seq,
194 u8 cmd); 192 u8 cmd);
195 193
196int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, 194int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
197 struct sw_flow_key *); 195 struct sw_flow_actions *acts, struct sw_flow_key *);
198 196
199void ovs_dp_notify_wq(struct work_struct *work); 197void ovs_dp_notify_wq(struct work_struct *work);
200 198