From: Shan Wei Date: Fri, 16 Nov 2012 21:21:36 +0000 (-0800) Subject: datapath: use this_cpu_ptr per-cpu helper X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70dbc259b83796688dcef8593eff5f74f7e36aa1;p=openvswitch datapath: use this_cpu_ptr per-cpu helper just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id()); Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter Signed-off-by: Jesse Gross --- diff --git a/datapath/datapath.c b/datapath/datapath.c index e359ac03..ade9de53 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -309,7 +309,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) u64 *stats_counter; int error; - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); + stats = this_cpu_ptr(dp->stats_percpu); if (!OVS_CB(skb)->flow) { struct sw_flow_key key; @@ -391,7 +391,7 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb, return 0; err: - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); + stats = this_cpu_ptr(dp->stats_percpu); u64_stats_update_begin(&stats->sync); stats->n_lost++; diff --git a/datapath/vport.c b/datapath/vport.c index bb2bd27c..4934ac1f 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -453,8 +453,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) { struct vport_percpu_stats *stats; - stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id()); - + stats = this_cpu_ptr(vport->percpu_stats); u64_stats_update_begin(&stats->sync); stats->rx_packets++; stats->rx_bytes += skb->len; @@ -485,7 +484,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb) if (likely(sent)) { struct vport_percpu_stats *stats; - stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id()); + stats = this_cpu_ptr(vport->percpu_stats); u64_stats_update_begin(&stats->sync); stats->tx_packets++;