aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorZhang Wei <wei.zhang@freescale.com>2008-04-18 16:33:42 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-29 05:40:28 -0400
commite042323607f5c14844b1c59aebbca8d1251c7d89 (patch)
tree10c9eac3d5146f3611af9220740e4ec27bf2ade0 /drivers/net
parentcc2bb6968a2c842149d285d77cb35200d2d37b15 (diff)
[RAPIDIO] Auto-probe the RapidIO system size
The RapidIO system size will auto probe in RIO setup. The route table and rionet_active in rionet.c are changed to be allocated dynamically according to the size of the system. Signed-off-by: Zhang Wei <wei.zhang@freescale.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/rionet.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index e7fd08adbbac..2b8fd68bc516 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -77,7 +77,7 @@ static int rionet_capable = 1;
77 * could be made into a hash table to save memory depending 77 * could be made into a hash table to save memory depending
78 * on system trade-offs. 78 * on system trade-offs.
79 */ 79 */
80static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES]; 80static struct rio_dev **rionet_active;
81 81
82#define is_rionet_capable(pef, src_ops, dst_ops) \ 82#define is_rionet_capable(pef, src_ops, dst_ops) \
83 ((pef & RIO_PEF_INB_MBOX) && \ 83 ((pef & RIO_PEF_INB_MBOX) && \
@@ -195,7 +195,8 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
195 } 195 }
196 196
197 if (eth->h_dest[0] & 0x01) { 197 if (eth->h_dest[0] & 0x01) {
198 for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) 198 for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rnet->mport->sys_size);
199 i++)
199 if (rionet_active[i]) 200 if (rionet_active[i])
200 rionet_queue_tx_msg(skb, ndev, 201 rionet_queue_tx_msg(skb, ndev,
201 rionet_active[i]); 202 rionet_active[i]);
@@ -385,6 +386,8 @@ static void rionet_remove(struct rio_dev *rdev)
385 struct net_device *ndev = NULL; 386 struct net_device *ndev = NULL;
386 struct rionet_peer *peer, *tmp; 387 struct rionet_peer *peer, *tmp;
387 388
389 free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ?
390 __ilog2(sizeof(void *)) + 4 : 0);
388 unregister_netdev(ndev); 391 unregister_netdev(ndev);
389 kfree(ndev); 392 kfree(ndev);
390 393
@@ -443,6 +446,15 @@ static int rionet_setup_netdev(struct rio_mport *mport)
443 goto out; 446 goto out;
444 } 447 }
445 448
449 rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL,
450 mport->sys_size ? __ilog2(sizeof(void *)) + 4 : 0);
451 if (!rionet_active) {
452 rc = -ENOMEM;
453 goto out;
454 }
455 memset((void *)rionet_active, 0, sizeof(void *) *
456 RIO_MAX_ROUTE_ENTRIES(mport->sys_size));
457
446 /* Set up private area */ 458 /* Set up private area */
447 rnet = (struct rionet_private *)ndev->priv; 459 rnet = (struct rionet_private *)ndev->priv;
448 rnet->mport = mport; 460 rnet->mport = mport;