From: Jesse Gross Date: Mon, 18 Mar 2013 21:03:59 +0000 (-0700) Subject: datapath: Remove checks for preinitialized flow. X-Git-Tag: sliver-openvswitch-1.10.90-1~10^2~49 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=52a23d929a8ac1381455df323aba3fd014276960 datapath: Remove checks for preinitialized flow. 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 Acked-by: Pravin B Shelar --- diff --git a/datapath/datapath.c b/datapath/datapath.c index a40ff4785..b5eb23291 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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); diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 78f1a5265..003e8800a 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -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, diff --git a/datapath/vport.c b/datapath/vport.c index 012af5937..d458a9517 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -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; diff --git a/datapath/vport.h b/datapath/vport.h index d33f99ef1..074c6eed4 100644 --- a/datapath/vport.h +++ b/datapath/vport.h @@ -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