datapath: use this_cpu_ptr per-cpu helper
authorShan Wei <davidshan@tencent.com>
Fri, 16 Nov 2012 21:21:36 +0000 (13:21 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 16 Nov 2012 21:25:33 +0000 (13:25 -0800)
just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());

Signed-off-by: Shan Wei <davidshan@tencent.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/datapath.c
datapath/vport.c

index e359ac034039b683985b3b80a1ec4e8fd5eadcaa..ade9de53b8e4381d86acef71f47a884cb94cae10 100644 (file)
@@ -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++;
index bb2bd27c7650136deedf2487d9df1d4734cc888a..4934ac1f57f3e663af0a789c26700d43d9940958 100644 (file)
@@ -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++;