aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDave Olson <dave.olson@qlogic.com>2007-07-20 17:23:37 -0400
committerRoland Dreier <rolandd@cisco.com>2007-07-30 16:16:46 -0400
commit3810f2a84e994e295e181eb9bd4b8007f611b5eb (patch)
tree22277befd8124b3386d2e35addb04f75ba06c23c /drivers/infiniband
parentcf5b60aa4098a1ba169a8f69eb576ac02194bea6 (diff)
IB/ipath: Fix some issues with buffer cancel and sendctrl register update
There was confused use of INFINIPATH_S_PIOBUFAVAILUPD (value) and IPATH_S_PIOBUFAVAILUPD (bit position). Also, some callers of ipath_cancel_sends() need kr_sendctrl restored, and some want to do it later. Signed-off-by: Dave Olson <dave.olson@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c11
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h2
4 files changed, 12 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 09c5fd84b1e3..6ccba365a24c 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -740,7 +740,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first,
740 * pioavail updates to memory to stop. 740 * pioavail updates to memory to stop.
741 */ 741 */
742 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 742 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
743 sendorig & ~IPATH_S_PIOBUFAVAILUPD); 743 sendorig & ~INFINIPATH_S_PIOBUFAVAILUPD);
744 sendorig = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); 744 sendorig = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
745 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 745 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
746 dd->ipath_sendctrl); 746 dd->ipath_sendctrl);
@@ -1614,7 +1614,7 @@ int ipath_waitfor_mdio_cmdready(struct ipath_devdata *dd)
1614 * it's safer to always do it. 1614 * it's safer to always do it.
1615 * PIOAvail bits are updated by the chip as if normal send had happened. 1615 * PIOAvail bits are updated by the chip as if normal send had happened.
1616 */ 1616 */
1617void ipath_cancel_sends(struct ipath_devdata *dd) 1617void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl)
1618{ 1618{
1619 ipath_dbg("Cancelling all in-progress send buffers\n"); 1619 ipath_dbg("Cancelling all in-progress send buffers\n");
1620 dd->ipath_lastcancel = jiffies+HZ/2; /* skip armlaunch errs a bit */ 1620 dd->ipath_lastcancel = jiffies+HZ/2; /* skip armlaunch errs a bit */
@@ -1627,6 +1627,9 @@ void ipath_cancel_sends(struct ipath_devdata *dd)
1627 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); 1627 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
1628 ipath_disarm_piobufs(dd, 0, 1628 ipath_disarm_piobufs(dd, 0,
1629 (unsigned)(dd->ipath_piobcnt2k + dd->ipath_piobcnt4k)); 1629 (unsigned)(dd->ipath_piobcnt2k + dd->ipath_piobcnt4k));
1630 if (restore_sendctrl) /* else done by caller later */
1631 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
1632 dd->ipath_sendctrl);
1630 1633
1631 /* and again, be sure all have hit the chip */ 1634 /* and again, be sure all have hit the chip */
1632 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); 1635 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
@@ -1655,7 +1658,7 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which)
1655 /* flush all queued sends when going to DOWN or INIT, to be sure that 1658 /* flush all queued sends when going to DOWN or INIT, to be sure that
1656 * they don't block MAD packets */ 1659 * they don't block MAD packets */
1657 if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) 1660 if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT)
1658 ipath_cancel_sends(dd); 1661 ipath_cancel_sends(dd, 1);
1659 1662
1660 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, 1663 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
1661 dd->ipath_ibcctrl | which); 1664 dd->ipath_ibcctrl | which);
@@ -2000,7 +2003,7 @@ void ipath_shutdown_device(struct ipath_devdata *dd)
2000 2003
2001 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_DISABLE << 2004 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_DISABLE <<
2002 INFINIPATH_IBCC_LINKINITCMD_SHIFT); 2005 INFINIPATH_IBCC_LINKINITCMD_SHIFT);
2003 ipath_cancel_sends(dd); 2006 ipath_cancel_sends(dd, 0);
2004 2007
2005 /* disable IBC */ 2008 /* disable IBC */
2006 dd->ipath_control &= ~INFINIPATH_C_LINKENABLE; 2009 dd->ipath_control &= ~INFINIPATH_C_LINKENABLE;
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 49951d583804..71e6c9d4a714 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -782,7 +782,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
782 * Follows early_init because some chips have to initialize 782 * Follows early_init because some chips have to initialize
783 * PIO buffers in early_init to avoid false parity errors. 783 * PIO buffers in early_init to avoid false parity errors.
784 */ 784 */
785 ipath_cancel_sends(dd); 785 ipath_cancel_sends(dd, 0);
786 786
787 /* early_init sets rcvhdrentsize and rcvhdrsize, so this must be 787 /* early_init sets rcvhdrentsize and rcvhdrsize, so this must be
788 * done after early_init */ 788 * done after early_init */
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index cba2041bb0b1..0c075cf8316b 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -303,7 +303,7 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
303 * Flush all queued sends when link went to DOWN or INIT, 303 * Flush all queued sends when link went to DOWN or INIT,
304 * to be sure that they don't block SMA and other MAD packets 304 * to be sure that they don't block SMA and other MAD packets
305 */ 305 */
306 ipath_cancel_sends(dd); 306 ipath_cancel_sends(dd, 1);
307 } 307 }
308 else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || 308 else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM ||
309 lstate == IPATH_IBSTATE_ACTIVE) { 309 lstate == IPATH_IBSTATE_ACTIVE) {
@@ -799,13 +799,13 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
799 * therefore would not be sent, and eventually 799 * therefore would not be sent, and eventually
800 * might cause the process to run out of bufs 800 * might cause the process to run out of bufs
801 */ 801 */
802 ipath_cancel_sends(dd); 802 ipath_cancel_sends(dd, 0);
803 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 803 ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
804 dd->ipath_control); 804 dd->ipath_control);
805 805
806 /* ensure pio avail updates continue */ 806 /* ensure pio avail updates continue */
807 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 807 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
808 dd->ipath_sendctrl & ~IPATH_S_PIOBUFAVAILUPD); 808 dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD);
809 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); 809 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
810 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 810 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
811 dd->ipath_sendctrl); 811 dd->ipath_sendctrl);
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index ace63ef78e6f..ef773298b805 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -683,7 +683,7 @@ int ipath_unordered_wc(void);
683 683
684void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first, 684void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first,
685 unsigned cnt); 685 unsigned cnt);
686void ipath_cancel_sends(struct ipath_devdata *); 686void ipath_cancel_sends(struct ipath_devdata *, int);
687 687
688int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *); 688int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *);
689void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *); 689void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *);