From a46e717ef30db86745ed9eed5a8260aa68776fa0 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 6 Nov 2007 11:33:56 -0800 Subject: [PATCH] cpu alloc: Chelsio statistics conversion Signed-off-by: Christoph Lameter --- drivers/net/chelsio/sge.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/net/chelsio/sge.c =================================================================== --- linux-2.6.orig/drivers/net/chelsio/sge.c 2008-02-16 20:28:23.000000000 -0800 +++ linux-2.6/drivers/net/chelsio/sge.c 2008-05-21 21:50:48.000000000 -0700 @@ -809,7 +809,7 @@ int i; for_each_port(sge->adapter, i) - free_percpu(sge->port_stats[i]); + CPU_FREE(sge->port_stats[i]); kfree(sge->tx_sched); free_tx_resources(sge); @@ -988,7 +988,7 @@ memset(ss, 0, sizeof(*ss)); for_each_possible_cpu(cpu) { - struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); + struct sge_port_stats *st = CPU_PTR(sge->port_stats[port], cpu); ss->rx_cso_good += st->rx_cso_good; ss->tx_cso += st->tx_cso; @@ -1382,7 +1382,7 @@ } __skb_pull(skb, sizeof(*p)); - st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); + st = THIS_CPU(sge->port_stats[p->iff]); skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); skb->dev->last_rx = jiffies; @@ -1848,8 +1848,7 @@ { struct adapter *adapter = dev->priv; struct sge *sge = adapter->sge; - struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], - smp_processor_id()); + struct sge_port_stats *st = THIS_CPU(sge->port_stats[dev->if_port]); struct cpl_tx_pkt *cpl; struct sk_buff *orig_skb = skb; int ret; @@ -2159,7 +2158,8 @@ sge->jumbo_fl = t1_is_T1B(adapter) ? 1 : 0; for_each_port(adapter, i) { - sge->port_stats[i] = alloc_percpu(struct sge_port_stats); + sge->port_stats[i] = CPU_ALLOC(struct sge_port_stats, + GFP_KERNEL | __GFP_ZERO); if (!sge->port_stats[i]) goto nomem_port; } @@ -2203,7 +2203,7 @@ return sge; nomem_port: while (i >= 0) { - free_percpu(sge->port_stats[i]); + CPU_FREE(sge->port_stats[i]); --i; } kfree(sge);