Commit 05d018c2 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: Move rategrid off stack in HE driver.

parent 79824a43
...@@ -669,10 +669,10 @@ he_init_cs_block(struct he_dev *he_dev) ...@@ -669,10 +669,10 @@ he_init_cs_block(struct he_dev *he_dev)
} }
static void __init static int __init
he_init_cs_block_rcm(struct he_dev *he_dev) he_init_cs_block_rcm(struct he_dev *he_dev)
{ {
unsigned rategrid[16][16]; unsigned (*rategrid)[16][16];
unsigned rate, delta; unsigned rate, delta;
int i, j, reg; int i, j, reg;
...@@ -680,6 +680,10 @@ he_init_cs_block_rcm(struct he_dev *he_dev) ...@@ -680,6 +680,10 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
unsigned long long rate_cps; unsigned long long rate_cps;
int mult, buf, buf_limit = 4; int mult, buf, buf_limit = 4;
rategrid = kmalloc( sizeof(unsigned) * 16 * 16, GFP_KERNEL);
if (!rategrid)
return -ENOMEM;
/* initialize rate grid group table */ /* initialize rate grid group table */
for (reg = 0x0; reg < 0xff; ++reg) for (reg = 0x0; reg < 0xff; ++reg)
...@@ -709,16 +713,16 @@ he_init_cs_block_rcm(struct he_dev *he_dev) ...@@ -709,16 +713,16 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
*/ */
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
rategrid[0][j] = rate; (*rategrid)[0][j] = rate;
rate -= delta; rate -= delta;
} }
for (i = 1; i < 16; i++) for (i = 1; i < 16; i++)
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
if (i > 14) if (i > 14)
rategrid[i][j] = rategrid[i - 1][j] / 4; (*rategrid)[i][j] = (*rategrid)[i - 1][j] / 4;
else else
rategrid[i][j] = rategrid[i - 1][j] / 2; (*rategrid)[i][j] = (*rategrid)[i - 1][j] / 2;
/* /*
* 2.4 transmit internal function * 2.4 transmit internal function
...@@ -743,7 +747,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev) ...@@ -743,7 +747,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */
for (i = 255; i > 0; i--) for (i = 255; i > 0; i--)
if (rategrid[i/16][i%16] >= rate_cps) if ((*rategrid)[i/16][i%16] >= rate_cps)
break; /* pick nearest rate instead? */ break; /* pick nearest rate instead? */
/* /*
...@@ -780,6 +784,9 @@ he_init_cs_block_rcm(struct he_dev *he_dev) ...@@ -780,6 +784,9 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
++rate_atmf; ++rate_atmf;
} }
kfree(rategrid);
return 0;
} }
static int __init static int __init
...@@ -1477,7 +1484,8 @@ he_start(struct atm_dev *dev) ...@@ -1477,7 +1484,8 @@ he_start(struct atm_dev *dev)
/* 5.1.8 cs block connection memory initialization */ /* 5.1.8 cs block connection memory initialization */
he_init_cs_block_rcm(he_dev); if (he_init_cs_block_rcm(he_dev) < 0)
return -ENOMEM;
/* 5.1.10 initialize host structures */ /* 5.1.10 initialize host structures */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment