aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2007-12-20 05:43:23 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:35 -0500
commitc59a80aca0bfc491d90534ed5606d5493eca24a3 (patch)
tree181af3a515feb82e1c77b1d8bc5ec460485d44df /drivers/infiniband/hw
parentd65708f3a766116662ff9bac81088d52a49901f4 (diff)
IB/ipath: kreceive uses portdata rather than devdata
kreceive is now portdata * instead of devdata * and other kreceive related cleanups.... Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c18
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c11
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c7
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h17
-rw-r--r--drivers/infiniband/hw/ipath/ipath_stats.c11
6 files changed, 46 insertions, 26 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 5a5fbdf66ac2..7c69090f6bd6 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1104,13 +1104,14 @@ static void ipath_rcv_hdrerr(struct ipath_devdata *dd,
1104 1104
1105/* 1105/*
1106 * ipath_kreceive - receive a packet 1106 * ipath_kreceive - receive a packet
1107 * @dd: the infinipath device 1107 * @pd: the infinipath port
1108 * 1108 *
1109 * called from interrupt handler for errors or receive interrupt 1109 * called from interrupt handler for errors or receive interrupt
1110 */ 1110 */
1111void ipath_kreceive(struct ipath_devdata *dd) 1111void ipath_kreceive(struct ipath_portdata *pd)
1112{ 1112{
1113 u64 *rc; 1113 u64 *rc;
1114 struct ipath_devdata *dd = pd->port_dd;
1114 void *ebuf; 1115 void *ebuf;
1115 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */ 1116 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */
1116 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */ 1117 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */
@@ -1125,8 +1126,8 @@ void ipath_kreceive(struct ipath_devdata *dd)
1125 goto bail; 1126 goto bail;
1126 } 1127 }
1127 1128
1128 l = dd->ipath_port0head; 1129 l = pd->port_head;
1129 hdrqtail = (u32) le64_to_cpu(*dd->ipath_hdrqtailptr); 1130 hdrqtail = ipath_get_rcvhdrtail(pd);
1130 if (l == hdrqtail) 1131 if (l == hdrqtail)
1131 goto bail; 1132 goto bail;
1132 1133
@@ -1135,7 +1136,7 @@ reloop:
1135 u32 qp; 1136 u32 qp;
1136 u8 *bthbytes; 1137 u8 *bthbytes;
1137 1138
1138 rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2)); 1139 rc = (u64 *) (pd->port_rcvhdrq + (l << 2));
1139 hdr = (struct ipath_message_header *)&rc[1]; 1140 hdr = (struct ipath_message_header *)&rc[1];
1140 /* 1141 /*
1141 * could make a network order version of IPATH_KD_QP, and 1142 * could make a network order version of IPATH_KD_QP, and
@@ -1245,7 +1246,7 @@ reloop:
1245 * earlier packets, we "almost" guarantee we have covered 1246 * earlier packets, we "almost" guarantee we have covered
1246 * that case. 1247 * that case.
1247 */ 1248 */
1248 u32 hqtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr); 1249 u32 hqtail = ipath_get_rcvhdrtail(pd);
1249 if (hqtail != hdrqtail) { 1250 if (hqtail != hdrqtail) {
1250 hdrqtail = hqtail; 1251 hdrqtail = hqtail;
1251 reloop = 1; /* loop 1 extra time at most */ 1252 reloop = 1; /* loop 1 extra time at most */
@@ -1255,7 +1256,7 @@ reloop:
1255 1256
1256 pkttot += i; 1257 pkttot += i;
1257 1258
1258 dd->ipath_port0head = l; 1259 pd->port_head = l;
1259 1260
1260 if (pkttot > ipath_stats.sps_maxpkts_call) 1261 if (pkttot > ipath_stats.sps_maxpkts_call)
1261 ipath_stats.sps_maxpkts_call = pkttot; 1262 ipath_stats.sps_maxpkts_call = pkttot;
@@ -1605,7 +1606,8 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd,
1605 1606
1606 /* clear for security and sanity on each use */ 1607 /* clear for security and sanity on each use */
1607 memset(pd->port_rcvhdrq, 0, pd->port_rcvhdrq_size); 1608 memset(pd->port_rcvhdrq, 0, pd->port_rcvhdrq_size);
1608 memset(pd->port_rcvhdrtail_kvaddr, 0, PAGE_SIZE); 1609 if (pd->port_rcvhdrtail_kvaddr)
1610 memset(pd->port_rcvhdrtail_kvaddr, 0, PAGE_SIZE);
1609 1611
1610 /* 1612 /*
1611 * tell chip each time we init it, even if we are re-using previous 1613 * tell chip each time we init it, even if we are re-using previous
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index e7fbb31a48a0..4277014d6f8e 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -742,7 +742,8 @@ static int ipath_manage_rcvq(struct ipath_portdata *pd, unsigned subport,
742 * updated and correct itself, even in the face of software 742 * updated and correct itself, even in the face of software
743 * bugs. 743 * bugs.
744 */ 744 */
745 *(volatile u64 *)pd->port_rcvhdrtail_kvaddr = 0; 745 if (pd->port_rcvhdrtail_kvaddr)
746 ipath_clear_rcvhdrtail(pd);
746 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, 747 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port,
747 &dd->ipath_rcvctrl); 748 &dd->ipath_rcvctrl);
748 } else 749 } else
@@ -1391,7 +1392,10 @@ static unsigned int ipath_poll_next(struct ipath_portdata *pd,
1391 pollflag = ipath_poll_hdrqfull(pd); 1392 pollflag = ipath_poll_hdrqfull(pd);
1392 1393
1393 head = ipath_read_ureg32(dd, ur_rcvhdrhead, pd->port_port); 1394 head = ipath_read_ureg32(dd, ur_rcvhdrhead, pd->port_port);
1394 tail = *(volatile u64 *)pd->port_rcvhdrtail_kvaddr; 1395 if (pd->port_rcvhdrtail_kvaddr)
1396 tail = ipath_get_rcvhdrtail(pd);
1397 else
1398 tail = ipath_read_ureg32(dd, ur_rcvhdrtail, pd->port_port);
1395 1399
1396 if (head != tail) 1400 if (head != tail)
1397 pollflag |= POLLIN | POLLRDNORM; 1401 pollflag |= POLLIN | POLLRDNORM;
@@ -1932,7 +1936,8 @@ static int ipath_do_user_init(struct file *fp,
1932 * We explictly set the in-memory copy to 0 beforehand, so we don't 1936 * We explictly set the in-memory copy to 0 beforehand, so we don't
1933 * have to wait to be sure the DMA update has happened. 1937 * have to wait to be sure the DMA update has happened.
1934 */ 1938 */
1935 *(volatile u64 *)pd->port_rcvhdrtail_kvaddr = 0ULL; 1939 if (pd->port_rcvhdrtail_kvaddr)
1940 ipath_clear_rcvhdrtail(pd);
1936 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, 1941 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port,
1937 &dd->ipath_rcvctrl); 1942 &dd->ipath_rcvctrl);
1938 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, 1943 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 1c65ab907a33..e161cad21a19 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -526,12 +526,11 @@ static void enable_chip(struct ipath_devdata *dd,
526 */ 526 */
527 val = ipath_read_ureg32(dd, ur_rcvegrindextail, 0); 527 val = ipath_read_ureg32(dd, ur_rcvegrindextail, 0);
528 (void)ipath_write_ureg(dd, ur_rcvegrindexhead, val, 0); 528 (void)ipath_write_ureg(dd, ur_rcvegrindexhead, val, 0);
529 dd->ipath_port0head = ipath_read_ureg32(dd, ur_rcvhdrtail, 0);
530 529
531 /* Initialize so we interrupt on next packet received */ 530 /* Initialize so we interrupt on next packet received */
532 (void)ipath_write_ureg(dd, ur_rcvhdrhead, 531 (void)ipath_write_ureg(dd, ur_rcvhdrhead,
533 dd->ipath_rhdrhead_intr_off | 532 dd->ipath_rhdrhead_intr_off |
534 dd->ipath_port0head, 0); 533 dd->ipath_pd[0]->port_head, 0);
535 534
536 /* 535 /*
537 * by now pioavail updates to memory should have occurred, so 536 * by now pioavail updates to memory should have occurred, so
@@ -693,7 +692,7 @@ done:
693 */ 692 */
694int ipath_init_chip(struct ipath_devdata *dd, int reinit) 693int ipath_init_chip(struct ipath_devdata *dd, int reinit)
695{ 694{
696 int ret = 0, i; 695 int ret = 0;
697 u32 val32, kpiobufs; 696 u32 val32, kpiobufs;
698 u32 piobufs, uports; 697 u32 piobufs, uports;
699 u64 val; 698 u64 val;
@@ -750,7 +749,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
750 kpiobufs = ipath_kpiobufs; 749 kpiobufs = ipath_kpiobufs;
751 750
752 if (kpiobufs + (uports * IPATH_MIN_USER_PORT_BUFCNT) > piobufs) { 751 if (kpiobufs + (uports * IPATH_MIN_USER_PORT_BUFCNT) > piobufs) {
753 i = (int) piobufs - 752 int i = (int) piobufs -
754 (int) (uports * IPATH_MIN_USER_PORT_BUFCNT); 753 (int) (uports * IPATH_MIN_USER_PORT_BUFCNT);
755 if (i < 0) 754 if (i < 0)
756 i = 0; 755 i = 0;
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 4795cb895f85..ec18b9b1bb08 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -683,7 +683,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
683 for (i = 0; i < dd->ipath_cfgports; i++) { 683 for (i = 0; i < dd->ipath_cfgports; i++) {
684 struct ipath_portdata *pd = dd->ipath_pd[i]; 684 struct ipath_portdata *pd = dd->ipath_pd[i];
685 if (i == 0) { 685 if (i == 0) {
686 hd = dd->ipath_port0head; 686 hd = pd->port_head;
687 tl = (u32) le64_to_cpu( 687 tl = (u32) le64_to_cpu(
688 *dd->ipath_hdrqtailptr); 688 *dd->ipath_hdrqtailptr);
689 } else if (pd && pd->port_cnt && 689 } else if (pd && pd->port_cnt &&
@@ -712,6 +712,8 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
712 } 712 }
713 } 713 }
714 if (errs & INFINIPATH_E_RRCVEGRFULL) { 714 if (errs & INFINIPATH_E_RRCVEGRFULL) {
715 struct ipath_portdata *pd = dd->ipath_pd[0];
716
715 /* 717 /*
716 * since this is of less importance and not likely to 718 * since this is of less importance and not likely to
717 * happen without also getting hdrfull, only count 719 * happen without also getting hdrfull, only count
@@ -719,7 +721,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
719 * vs user) 721 * vs user)
720 */ 722 */
721 ipath_stats.sps_etidfull++; 723 ipath_stats.sps_etidfull++;
722 if (dd->ipath_port0head != 724 if (pd->port_head !=
723 (u32) le64_to_cpu(*dd->ipath_hdrqtailptr)) 725 (u32) le64_to_cpu(*dd->ipath_hdrqtailptr))
724 chkerrpkts = 1; 726 chkerrpkts = 1;
725 } 727 }
@@ -1173,7 +1175,7 @@ irqreturn_t ipath_intr(int irq, void *data)
1173 * for receive are at the bottom. 1175 * for receive are at the bottom.
1174 */ 1176 */
1175 if (chk0rcv) { 1177 if (chk0rcv) {
1176 ipath_kreceive(dd); 1178 ipath_kreceive(dd->ipath_pd[0]);
1177 istat &= ~port0rbits; 1179 istat &= ~port0rbits;
1178 } 1180 }
1179 1181
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 81759c2031f9..72252349eaa9 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -167,6 +167,8 @@ struct ipath_portdata {
167 u32 active_slaves; 167 u32 active_slaves;
168 /* Type of packets or conditions we want to poll for */ 168 /* Type of packets or conditions we want to poll for */
169 u16 poll_type; 169 u16 poll_type;
170 /* port rcvhdrq head offset */
171 u32 port_head;
170}; 172};
171 173
172struct sk_buff; 174struct sk_buff;
@@ -314,8 +316,6 @@ struct ipath_devdata {
314 * supports, less gives more pio bufs/port, etc. 316 * supports, less gives more pio bufs/port, etc.
315 */ 317 */
316 u32 ipath_cfgports; 318 u32 ipath_cfgports;
317 /* port0 rcvhdrq head offset */
318 u32 ipath_port0head;
319 /* count of port 0 hdrqfull errors */ 319 /* count of port 0 hdrqfull errors */
320 u32 ipath_p0_hdrqfull; 320 u32 ipath_p0_hdrqfull;
321 321
@@ -690,7 +690,7 @@ void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *);
690 690
691int ipath_parse_ushort(const char *str, unsigned short *valp); 691int ipath_parse_ushort(const char *str, unsigned short *valp);
692 692
693void ipath_kreceive(struct ipath_devdata *); 693void ipath_kreceive(struct ipath_portdata *);
694int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); 694int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned);
695int ipath_reset_device(int); 695int ipath_reset_device(int);
696void ipath_get_faststats(unsigned long); 696void ipath_get_faststats(unsigned long);
@@ -928,6 +928,17 @@ static inline u32 ipath_read_creg32(const struct ipath_devdata *dd,
928 (char __iomem *)dd->ipath_kregbase)); 928 (char __iomem *)dd->ipath_kregbase));
929} 929}
930 930
931static inline void ipath_clear_rcvhdrtail(const struct ipath_portdata *pd)
932{
933 *((u64 *) pd->port_rcvhdrtail_kvaddr) = 0ULL;
934}
935
936static inline u32 ipath_get_rcvhdrtail(const struct ipath_portdata *pd)
937{
938 return (u32) le64_to_cpu(*((volatile __le64 *)
939 pd->port_rcvhdrtail_kvaddr));
940}
941
931/* 942/*
932 * sysfs interface. 943 * sysfs interface.
933 */ 944 */
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c
index f0271415cd5b..fd897652da6a 100644
--- a/drivers/infiniband/hw/ipath/ipath_stats.c
+++ b/drivers/infiniband/hw/ipath/ipath_stats.c
@@ -133,15 +133,16 @@ bail:
133static void ipath_qcheck(struct ipath_devdata *dd) 133static void ipath_qcheck(struct ipath_devdata *dd)
134{ 134{
135 static u64 last_tot_hdrqfull; 135 static u64 last_tot_hdrqfull;
136 struct ipath_portdata *pd = dd->ipath_pd[0];
136 size_t blen = 0; 137 size_t blen = 0;
137 char buf[128]; 138 char buf[128];
138 139
139 *buf = 0; 140 *buf = 0;
140 if (dd->ipath_pd[0]->port_hdrqfull != dd->ipath_p0_hdrqfull) { 141 if (pd->port_hdrqfull != dd->ipath_p0_hdrqfull) {
141 blen = snprintf(buf, sizeof buf, "port 0 hdrqfull %u", 142 blen = snprintf(buf, sizeof buf, "port 0 hdrqfull %u",
142 dd->ipath_pd[0]->port_hdrqfull - 143 pd->port_hdrqfull -
143 dd->ipath_p0_hdrqfull); 144 dd->ipath_p0_hdrqfull);
144 dd->ipath_p0_hdrqfull = dd->ipath_pd[0]->port_hdrqfull; 145 dd->ipath_p0_hdrqfull = pd->port_hdrqfull;
145 } 146 }
146 if (ipath_stats.sps_etidfull != dd->ipath_last_tidfull) { 147 if (ipath_stats.sps_etidfull != dd->ipath_last_tidfull) {
147 blen += snprintf(buf + blen, sizeof buf - blen, 148 blen += snprintf(buf + blen, sizeof buf - blen,
@@ -173,7 +174,7 @@ static void ipath_qcheck(struct ipath_devdata *dd)
173 if (blen) 174 if (blen)
174 ipath_dbg("%s\n", buf); 175 ipath_dbg("%s\n", buf);
175 176
176 if (dd->ipath_port0head != (u32) 177 if (pd->port_head != (u32)
177 le64_to_cpu(*dd->ipath_hdrqtailptr)) { 178 le64_to_cpu(*dd->ipath_hdrqtailptr)) {
178 if (dd->ipath_lastport0rcv_cnt == 179 if (dd->ipath_lastport0rcv_cnt ==
179 ipath_stats.sps_port0pkts) { 180 ipath_stats.sps_port0pkts) {
@@ -181,7 +182,7 @@ static void ipath_qcheck(struct ipath_devdata *dd)
181 "port0 hd=%llx tl=%x; port0pkts %llx\n", 182 "port0 hd=%llx tl=%x; port0pkts %llx\n",
182 (unsigned long long) 183 (unsigned long long)
183 le64_to_cpu(*dd->ipath_hdrqtailptr), 184 le64_to_cpu(*dd->ipath_hdrqtailptr),
184 dd->ipath_port0head, 185 pd->port_head,
185 (unsigned long long) 186 (unsigned long long)
186 ipath_stats.sps_port0pkts); 187 ipath_stats.sps_port0pkts);
187 } 188 }