[patch 23/28] cpu alloc: Chelsio statistics conversion

Christoph Lameter
2007-11-06T19:57:31Z

[-- Attachment #1: cpu_alloc_chelsio --]
[-- Type: text/plain, Size: 2237 bytes --]

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
drivers/net/chelsio/sge.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux-2.6/drivers/net/chelsio/sge.c
===================================================================
--- linux-2.6.orig/drivers/net/chelsio/sge.c 2007-11-04 19:19:23.000000000 -0800
+++ linux-2.6/drivers/net/chelsio/sge.c 2007-11-04 19:21:01.000000000 -0800
@@ -805,7 +805,7 @@ void t1_sge_destroy(struct sge *sge)
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);
@@ -984,7 +984,7 @@ void t1_sge_get_port_stats(const struct

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_packets += st->rx_packets;
ss->rx_cso_good += st->rx_cso_good;
@@ -1380,7 +1380,7 @@ static void sge_rx(struct sge *sge, stru
__skb_pull(skb, sizeof(*p));

skb->dev->last_rx = jiffies;
- st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id());
+ st = THIS_CPU(sge->port_stats[p->iff]);
st->rx_packets++;

skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
@@ -1848,7 +1848,7 @@ int t1_start_xmit(struct sk_buff *skb, s
{
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;
@@ -2165,7 +2165,8 @@ struct sge * __devinit t1_sge_create(str
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;
}
@@ -2209,7 +2210,7 @@ struct sge * __devinit t1_sge_create(str
return sge;
nomem_port:
while (i >= 0) {
- free_percpu(sge->port_stats[i]);
+ CPU_FREE(sge->port_stats[i]);
--i;
}
kfree(sge);

--