diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/rionet.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/rionet.c')
-rw-r--r-- | drivers/net/rionet.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index 44150f2f7bfd..5d3436d47edd 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -162,8 +162,8 @@ static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev, | |||
162 | rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1); | 162 | rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1); |
163 | 163 | ||
164 | if (netif_msg_tx_queued(rnet)) | 164 | if (netif_msg_tx_queued(rnet)) |
165 | printk(KERN_INFO "%s: queued skb %8.8x len %8.8x\n", DRV_NAME, | 165 | printk(KERN_INFO "%s: queued skb len %8.8x\n", DRV_NAME, |
166 | (u32) skb, skb->len); | 166 | skb->len); |
167 | 167 | ||
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
@@ -378,11 +378,11 @@ static int rionet_close(struct net_device *ndev) | |||
378 | 378 | ||
379 | static void rionet_remove(struct rio_dev *rdev) | 379 | static void rionet_remove(struct rio_dev *rdev) |
380 | { | 380 | { |
381 | struct net_device *ndev = NULL; | 381 | struct net_device *ndev = rio_get_drvdata(rdev); |
382 | struct rionet_peer *peer, *tmp; | 382 | struct rionet_peer *peer, *tmp; |
383 | 383 | ||
384 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | 384 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? |
385 | __ilog2(sizeof(void *)) + 4 : 0); | 385 | __fls(sizeof(void *)) + 4 : 0); |
386 | unregister_netdev(ndev); | 386 | unregister_netdev(ndev); |
387 | free_netdev(ndev); | 387 | free_netdev(ndev); |
388 | 388 | ||
@@ -433,24 +433,14 @@ static const struct net_device_ops rionet_netdev_ops = { | |||
433 | .ndo_set_mac_address = eth_mac_addr, | 433 | .ndo_set_mac_address = eth_mac_addr, |
434 | }; | 434 | }; |
435 | 435 | ||
436 | static int rionet_setup_netdev(struct rio_mport *mport) | 436 | static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) |
437 | { | 437 | { |
438 | int rc = 0; | 438 | int rc = 0; |
439 | struct net_device *ndev = NULL; | ||
440 | struct rionet_private *rnet; | 439 | struct rionet_private *rnet; |
441 | u16 device_id; | 440 | u16 device_id; |
442 | 441 | ||
443 | /* Allocate our net_device structure */ | ||
444 | ndev = alloc_etherdev(sizeof(struct rionet_private)); | ||
445 | if (ndev == NULL) { | ||
446 | printk(KERN_INFO "%s: could not allocate ethernet device.\n", | ||
447 | DRV_NAME); | ||
448 | rc = -ENOMEM; | ||
449 | goto out; | ||
450 | } | ||
451 | |||
452 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, | 442 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, |
453 | mport->sys_size ? __ilog2(sizeof(void *)) + 4 : 0); | 443 | mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); |
454 | if (!rionet_active) { | 444 | if (!rionet_active) { |
455 | rc = -ENOMEM; | 445 | rc = -ENOMEM; |
456 | goto out; | 446 | goto out; |
@@ -504,11 +494,21 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | |||
504 | int rc = -ENODEV; | 494 | int rc = -ENODEV; |
505 | u32 lpef, lsrc_ops, ldst_ops; | 495 | u32 lpef, lsrc_ops, ldst_ops; |
506 | struct rionet_peer *peer; | 496 | struct rionet_peer *peer; |
497 | struct net_device *ndev = NULL; | ||
507 | 498 | ||
508 | /* If local device is not rionet capable, give up quickly */ | 499 | /* If local device is not rionet capable, give up quickly */ |
509 | if (!rionet_capable) | 500 | if (!rionet_capable) |
510 | goto out; | 501 | goto out; |
511 | 502 | ||
503 | /* Allocate our net_device structure */ | ||
504 | ndev = alloc_etherdev(sizeof(struct rionet_private)); | ||
505 | if (ndev == NULL) { | ||
506 | printk(KERN_INFO "%s: could not allocate ethernet device.\n", | ||
507 | DRV_NAME); | ||
508 | rc = -ENOMEM; | ||
509 | goto out; | ||
510 | } | ||
511 | |||
512 | /* | 512 | /* |
513 | * First time through, make sure local device is rionet | 513 | * First time through, make sure local device is rionet |
514 | * capable, setup netdev, and set flags so this is skipped | 514 | * capable, setup netdev, and set flags so this is skipped |
@@ -529,7 +529,7 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | |||
529 | goto out; | 529 | goto out; |
530 | } | 530 | } |
531 | 531 | ||
532 | rc = rionet_setup_netdev(rdev->net->hport); | 532 | rc = rionet_setup_netdev(rdev->net->hport, ndev); |
533 | rionet_check = 1; | 533 | rionet_check = 1; |
534 | } | 534 | } |
535 | 535 | ||
@@ -546,6 +546,8 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | |||
546 | list_add_tail(&peer->node, &rionet_peers); | 546 | list_add_tail(&peer->node, &rionet_peers); |
547 | } | 547 | } |
548 | 548 | ||
549 | rio_set_drvdata(rdev, ndev); | ||
550 | |||
549 | out: | 551 | out: |
550 | return rc; | 552 | return rc; |
551 | } | 553 | } |
@@ -571,5 +573,5 @@ static void __exit rionet_exit(void) | |||
571 | rio_unregister_driver(&rionet_driver); | 573 | rio_unregister_driver(&rionet_driver); |
572 | } | 574 | } |
573 | 575 | ||
574 | module_init(rionet_init); | 576 | late_initcall(rionet_init); |
575 | module_exit(rionet_exit); | 577 | module_exit(rionet_exit); |