From patchwork Wed Oct 31 11:22:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: solomon X-Patchwork-Id: 195848 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D82302C00B0 for ; Wed, 31 Oct 2012 22:24:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422768Ab2JaLWy (ORCPT ); Wed, 31 Oct 2012 07:22:54 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:63014 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935416Ab2JaLWv (ORCPT ); Wed, 31 Oct 2012 07:22:51 -0400 Received: by mail-da0-f46.google.com with SMTP id n41so597618dak.19 for ; Wed, 31 Oct 2012 04:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=pzO+sSYNVuPCYfBeXh6f1+oucNnJ2NNMnkzEtyUsTbY=; b=Mq5tBFjGbyO35C2/+v3PiAFjXA1SimZGInpOhJmB1hDJy/0bp/Sct+CnJ8xRqnGZWD FX2DFqwOk5mMd0Kx8LTtVTZti1755f72h3L2NT/JS5n9rgxDs3Z15ZbQiJAW9IMIJZDu OWnpREJ4D7R67ZVPjTjGrzSnjMn5zk65uGN7iH1CDYrZkxSdWhyqe1JwlqVO6IEBoQDu /IwIJjoE6DDDYbZ88t01NceKL/hapROS7YSJzYpH4tQUOuni3HtSw+BGbRmrV7C8xd0D IIeePAXh5lg+43Tjck11fJBNFtiGlG+xfYPuhcQbbW6c8D7JJQzPrkBMSjEOSmvB+UIs hdJQ== Received: by 10.66.77.168 with SMTP id t8mr101157615paw.28.1351682570961; Wed, 31 Oct 2012 04:22:50 -0700 (PDT) Received: from [172.30.10.98] ([121.14.96.125]) by mx.google.com with ESMTPS id j9sm2052320pav.15.2012.10.31.04.22.46 (version=SSLv3 cipher=OTHER); Wed, 31 Oct 2012 04:22:50 -0700 (PDT) Message-ID: <50910A04.5000003@gmail.com> Date: Wed, 31 Oct 2012 19:22:44 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: jesse@nicira.com, dev@openvswitch.org, NetDev , Kernel-Maillist , David Miller , cl@linux-foundation.org Subject: [PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shan Wei Signed-off-by: Shan Wei --- net/openvswitch/datapath.c | 4 ++-- net/openvswitch/vport.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 4c4b62c..77d16a5 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -208,7 +208,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) int error; int key_len; - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); + stats = this_cpu_ptr(dp->stats_percpu); /* Extract flow from 'skb' into 'key'. */ error = ovs_flow_extract(skb, p->port_no, &key, &key_len); @@ -282,7 +282,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/net/openvswitch/vport.c b/net/openvswitch/vport.c index 03779e8..70af0be 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -333,8 +333,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; @@ -359,7 +358,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++;