datapath: Remove checks for preinitialized flow.
authorJesse Gross <jesse@nicira.com>
Mon, 18 Mar 2013 21:03:59 +0000 (14:03 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 19 Mar 2013 00:17:47 +0000 (17:17 -0700)
Header caching used to store a precomputed flow along with the skb
but no longer exists.  There were a few remaining checks for those
flows, which this removes.  It simplifies the code slightly and brings
us closer to upstream.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/datapath.c
datapath/vport-internal_dev.c
datapath/vport.c
datapath/vport.h

index a40ff47..b5eb232 100644 (file)
@@ -201,41 +201,37 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
        struct datapath *dp = p->dp;
        struct sw_flow *flow;
        struct dp_stats_percpu *stats;
+       struct sw_flow_key key;
        u64 *stats_counter;
        int error;
+       int key_len;
 
        stats = this_cpu_ptr(dp->stats_percpu);
 
-       if (!OVS_CB(skb)->flow) {
-               struct sw_flow_key key;
-               int key_len;
-
-               /* Extract flow from 'skb' into 'key'. */
-               error = ovs_flow_extract(skb, p->port_no, &key, &key_len);
-               if (unlikely(error)) {
-                       kfree_skb(skb);
-                       return;
-               }
-
-               /* Look up flow. */
-               flow = ovs_flow_tbl_lookup(rcu_dereference(dp->table),
-                                          &key, key_len);
-               if (unlikely(!flow)) {
-                       struct dp_upcall_info upcall;
-
-                       upcall.cmd = OVS_PACKET_CMD_MISS;
-                       upcall.key = &key;
-                       upcall.userdata = NULL;
-                       upcall.portid = p->upcall_portid;
-                       ovs_dp_upcall(dp, skb, &upcall);
-                       consume_skb(skb);
-                       stats_counter = &stats->n_missed;
-                       goto out;
-               }
+       /* Extract flow from 'skb' into 'key'. */
+       error = ovs_flow_extract(skb, p->port_no, &key, &key_len);
+       if (unlikely(error)) {
+               kfree_skb(skb);
+               return;
+       }
 
-               OVS_CB(skb)->flow = flow;
+       /* Look up flow. */
+       flow = ovs_flow_tbl_lookup(rcu_dereference(dp->table), &key, key_len);
+       if (unlikely(!flow)) {
+               struct dp_upcall_info upcall;
+
+               upcall.cmd = OVS_PACKET_CMD_MISS;
+               upcall.key = &key;
+               upcall.userdata = NULL;
+               upcall.portid = p->upcall_portid;
+               ovs_dp_upcall(dp, skb, &upcall);
+               consume_skb(skb);
+               stats_counter = &stats->n_missed;
+               goto out;
        }
 
+       OVS_CB(skb)->flow = flow;
+
        stats_counter = &stats->n_hit;
        ovs_flow_used(OVS_CB(skb)->flow, skb);
        ovs_execute_actions(dp, skb);
index 78f1a52..003e880 100644 (file)
@@ -92,7 +92,6 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
        }
 
        vlan_copy_skb_tci(skb);
-       OVS_CB(skb)->flow = NULL;
 
        rcu_read_lock();
        ovs_vport_receive(internal_dev_priv(netdev)->vport, skb);
@@ -289,7 +288,7 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
 
 const struct vport_ops ovs_internal_vport_ops = {
        .type           = OVS_VPORT_TYPE_INTERNAL,
-       .flags          = VPORT_F_REQUIRED | VPORT_F_FLOW,
+       .flags          = VPORT_F_REQUIRED,
        .create         = internal_dev_create,
        .destroy        = internal_dev_destroy,
        .get_name       = ovs_netdev_get_name,
index 012af59..d458a95 100644 (file)
@@ -415,9 +415,6 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
        stats->rx_bytes += skb->len;
        u64_stats_update_end(&stats->sync);
 
-       if (!(vport->ops->flags & VPORT_F_FLOW))
-               OVS_CB(skb)->flow = NULL;
-
        if (!(vport->ops->flags & VPORT_F_TUN_ID))
                OVS_CB(skb)->tun_key = NULL;
 
index d33f99e..074c6ee 100644 (file)
@@ -106,8 +106,7 @@ struct vport {
 };
 
 #define VPORT_F_REQUIRED       (1 << 0) /* If init fails, module loading fails. */
-#define VPORT_F_FLOW           (1 << 1) /* Sets OVS_CB(skb)->flow. */
-#define VPORT_F_TUN_ID         (1 << 2) /* Sets OVS_CB(skb)->tun_id. */
+#define VPORT_F_TUN_ID         (1 << 1) /* Sets OVS_CB(skb)->tun_id. */
 
 /**
  * struct vport_parms - parameters for creating a new vport