diff options
author | Bryan O'Sullivan <bos@pathscale.com> | 2006-07-01 07:36:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-01 12:56:00 -0400 |
commit | f37bda92461313ad3bbfbf5660adc849c69718bf (patch) | |
tree | a5fe4737ca6b8fcbe2cf9b58466d6340ee12fe56 /drivers/infiniband/hw/ipath/ipath_init_chip.c | |
parent | 06993ca6bc46419027b45198a58447f4f05c14f6 (diff) |
[PATCH] IB/ipath: memory management cleanups
Made in-memory rcvhdrq tail update be in dma_alloc'ed memory, not random user
or special kernel (needed for ppc, also "just the right thing to do").
Some cleanups to make unexpected link transitions less likely to produce
complaints about packet errors, and also to not leave SMA packets stuck and
unable to go out.
A few other random debug and comment cleanups.
Always init rcvhdrq head/tail registers to 0, to avoid race conditions (should
have been that way some time ago).
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_init_chip.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_init_chip.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 37cd96e96e3e..385605f63f0f 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -411,17 +411,8 @@ static int init_pioavailregs(struct ipath_devdata *dd) | |||
411 | /* and its length */ | 411 | /* and its length */ |
412 | dd->ipath_freezelen = L1_CACHE_BYTES - sizeof(dd->ipath_statusp[0]); | 412 | dd->ipath_freezelen = L1_CACHE_BYTES - sizeof(dd->ipath_statusp[0]); |
413 | 413 | ||
414 | if (dd->ipath_unit * 64 > (IPATH_PORT0_RCVHDRTAIL_SIZE - 64)) { | 414 | ret = 0; |
415 | ipath_dev_err(dd, "unit %u too large for port 0 " | ||
416 | "rcvhdrtail buffer size\n", dd->ipath_unit); | ||
417 | ret = -ENODEV; | ||
418 | } | ||
419 | else | ||
420 | ret = 0; | ||
421 | 415 | ||
422 | /* so we can get current tail in ipath_kreceive(), per chip */ | ||
423 | dd->ipath_hdrqtailptr = &ipath_port0_rcvhdrtail[ | ||
424 | dd->ipath_unit * (64 / sizeof(*ipath_port0_rcvhdrtail))]; | ||
425 | done: | 416 | done: |
426 | return ret; | 417 | return ret; |
427 | } | 418 | } |
@@ -654,7 +645,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
654 | { | 645 | { |
655 | int ret = 0, i; | 646 | int ret = 0, i; |
656 | u32 val32, kpiobufs; | 647 | u32 val32, kpiobufs; |
657 | u64 val, atmp; | 648 | u64 val; |
658 | struct ipath_portdata *pd = NULL; /* keep gcc4 happy */ | 649 | struct ipath_portdata *pd = NULL; /* keep gcc4 happy */ |
659 | 650 | ||
660 | ret = init_housekeeping(dd, &pd, reinit); | 651 | ret = init_housekeeping(dd, &pd, reinit); |
@@ -777,24 +768,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
777 | goto done; | 768 | goto done; |
778 | } | 769 | } |
779 | 770 | ||
780 | val = ipath_port0_rcvhdrtail_dma + dd->ipath_unit * 64; | ||
781 | |||
782 | /* verify that the alignment requirement was met */ | ||
783 | ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr, | ||
784 | 0, val); | ||
785 | atmp = ipath_read_kreg64_port( | ||
786 | dd, dd->ipath_kregs->kr_rcvhdrtailaddr, 0); | ||
787 | if (val != atmp) { | ||
788 | ipath_dev_err(dd, "Catastrophic software error, " | ||
789 | "RcvHdrTailAddr0 written as %llx, " | ||
790 | "read back as %llx from %x\n", | ||
791 | (unsigned long long) val, | ||
792 | (unsigned long long) atmp, | ||
793 | dd->ipath_kregs->kr_rcvhdrtailaddr); | ||
794 | ret = -EINVAL; | ||
795 | goto done; | ||
796 | } | ||
797 | |||
798 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvbthqp, IPATH_KD_QP); | 771 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvbthqp, IPATH_KD_QP); |
799 | 772 | ||
800 | /* | 773 | /* |
@@ -845,12 +818,18 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
845 | * re-init, the simplest way to handle this is to free | 818 | * re-init, the simplest way to handle this is to free |
846 | * existing, and re-allocate. | 819 | * existing, and re-allocate. |
847 | */ | 820 | */ |
848 | if (reinit) | 821 | if (reinit) { |
849 | ipath_free_pddata(dd, 0, 0); | 822 | struct ipath_portdata *pd = dd->ipath_pd[0]; |
823 | dd->ipath_pd[0] = NULL; | ||
824 | ipath_free_pddata(dd, pd); | ||
825 | } | ||
850 | dd->ipath_f_tidtemplate(dd); | 826 | dd->ipath_f_tidtemplate(dd); |
851 | ret = ipath_create_rcvhdrq(dd, pd); | 827 | ret = ipath_create_rcvhdrq(dd, pd); |
852 | if (!ret) | 828 | if (!ret) { |
829 | dd->ipath_hdrqtailptr = | ||
830 | (volatile __le64 *)pd->port_rcvhdrtail_kvaddr; | ||
853 | ret = create_port0_egr(dd); | 831 | ret = create_port0_egr(dd); |
832 | } | ||
854 | if (ret) | 833 | if (ret) |
855 | ipath_dev_err(dd, "failed to allocate port 0 (kernel) " | 834 | ipath_dev_err(dd, "failed to allocate port 0 (kernel) " |
856 | "rcvhdrq and/or egr bufs\n"); | 835 | "rcvhdrq and/or egr bufs\n"); |