From ad50cb605b24495956b6a7664d379abd3912ed50 Mon Sep 17 00:00:00 2001 From: Lorand Jakab Date: Thu, 21 Aug 2014 20:25:47 +0300 Subject: [PATCH] datapath: Remove flow member from struct ovs_skb_cb 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 Acked-by: Pravin B Shelar --- datapath/actions.c | 4 ++-- datapath/datapath.c | 12 +++++++----- datapath/datapath.h | 7 +++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/datapath/actions.c b/datapath/actions.c index d70348ea71d..ad22467ef6d 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 3ca971626fb..b6eadef0439 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; + ovs_flow_stats_update(flow, pkt_key->tp.flags, skb); - ovs_flow_stats_update(OVS_CB(skb)->flow, pkt_key->tp.flags, skb); - ovs_execute_actions(dp, skb, recirc); + sf_acts = rcu_dereference(flow->sf_acts); + 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 651c1194acd..e4142256db3 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -96,7 +96,6 @@ struct datapath { /** * struct ovs_skb_cb - OVS data in skb CB - * @flow: The flow associated with this packet. May be %NULL if no flow. * @pkt_key: The flow information extracted from the packet. Must be nonnull. * @egress_tun_info: Tunnel information about this packet on egress path. * NULL if the packet is not being tunneled. @@ -104,10 +103,9 @@ 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; + struct vport *input_vport; }; #define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb) @@ -199,7 +197,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, ...) \