datapath: Remove flow member from struct ovs_skb_cb
authorLorand Jakab <lojakab@cisco.com>
Thu, 21 Aug 2014 17:25:47 +0000 (20:25 +0300)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 26 Aug 2014 00:55:32 +0000 (17:55 -0700)
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@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/actions.c
datapath/datapath.c
datapath/datapath.h

index d70348e..ad22467 100644 (file)
@@ -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;
index 3ca9716..b6eadef 100644 (file)
@@ -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();
 
index 651c119..e414225 100644 (file)
@@ -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, ...)                                    \