aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDave Olson <dave.olson@qlogic.com>2007-12-06 03:28:02 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:36 -0500
commit755807a296f77ca7c31dc000afdfe1e5172bbf72 (patch)
tree0df244c6d024ec0b7085b2d405b3836f2809b4d6 /drivers/infiniband
parentd8274869d742c3d8082e1428de47e54d12104928 (diff)
IB/ipath: Changes for fields moving from devdata to portdata
This patch moves some arrays that were defined per-device to be variables defined in the per context data structure, thus avoiding extra kzalloc() calls. 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_file_ops.c5
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c15
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h16
-rw-r--r--drivers/infiniband/hw/ipath/ipath_stats.c13
5 files changed, 17 insertions, 36 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 65da7a9808ec..2a75faf1d108 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -1785,6 +1785,7 @@ static int find_shared_port(struct file *fp,
1785 } 1785 }
1786 port_fp(fp) = pd; 1786 port_fp(fp) = pd;
1787 subport_fp(fp) = pd->port_cnt++; 1787 subport_fp(fp) = pd->port_cnt++;
1788 pd->port_subpid[subport_fp(fp)] = current->pid;
1788 tidcursor_fp(fp) = 0; 1789 tidcursor_fp(fp) = 0;
1789 pd->active_slaves |= 1 << subport_fp(fp); 1790 pd->active_slaves |= 1 << subport_fp(fp);
1790 ipath_cdbg(PROC, 1791 ipath_cdbg(PROC,
@@ -1915,8 +1916,7 @@ static int ipath_do_user_init(struct file *fp,
1915 */ 1916 */
1916 head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port); 1917 head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port);
1917 ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port); 1918 ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port);
1918 dd->ipath_lastegrheads[pd->port_port] = -1; 1919 pd->port_lastrcvhdrqtail = -1;
1919 dd->ipath_lastrcvhdrqtails[pd->port_port] = -1;
1920 ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n", 1920 ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n",
1921 pd->port_port, head32); 1921 pd->port_port, head32);
1922 pd->port_tidcursor = 0; /* start at beginning after open */ 1922 pd->port_tidcursor = 0; /* start at beginning after open */
@@ -2019,6 +2019,7 @@ static int ipath_close(struct inode *in, struct file *fp)
2019 * the slave(s) don't wait for receive data forever. 2019 * the slave(s) don't wait for receive data forever.
2020 */ 2020 */
2021 pd->active_slaves &= ~(1 << fd->subport); 2021 pd->active_slaves &= ~(1 << fd->subport);
2022 pd->port_subpid[fd->subport] = 0;
2022 mutex_unlock(&ipath_mutex); 2023 mutex_unlock(&ipath_mutex);
2023 goto bail; 2024 goto bail;
2024 } 2025 }
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index cf64d3855ff5..98b51465b58d 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -272,22 +272,7 @@ static int init_chip_first(struct ipath_devdata *dd,
272 goto done; 272 goto done;
273 } 273 }
274 274
275 dd->ipath_lastegrheads = kzalloc(sizeof(*dd->ipath_lastegrheads)
276 * dd->ipath_cfgports,
277 GFP_KERNEL);
278 dd->ipath_lastrcvhdrqtails =
279 kzalloc(sizeof(*dd->ipath_lastrcvhdrqtails)
280 * dd->ipath_cfgports, GFP_KERNEL);
281
282 if (!dd->ipath_lastegrheads || !dd->ipath_lastrcvhdrqtails) {
283 ipath_dev_err(dd, "Unable to allocate head arrays, "
284 "failing\n");
285 ret = -ENOMEM;
286 goto done;
287 }
288
289 pd = create_portdata0(dd); 275 pd = create_portdata0(dd);
290
291 if (!pd) { 276 if (!pd) {
292 ipath_dev_err(dd, "Unable to allocate portdata for port " 277 ipath_dev_err(dd, "Unable to allocate portdata for port "
293 "0, failing\n"); 278 "0, failing\n");
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index d9f8342e954f..e2ce5314504d 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -693,7 +693,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
693 * except kernel 693 * except kernel
694 */ 694 */
695 tl = *(u64 *) pd->port_rcvhdrtail_kvaddr; 695 tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;
696 if (tl == dd->ipath_lastrcvhdrqtails[i]) 696 if (tl == pd->port_lastrcvhdrqtail)
697 continue; 697 continue;
698 hd = ipath_read_ureg32(dd, ur_rcvhdrhead, 698 hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
699 i); 699 i);
@@ -703,7 +703,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
703 (!hd && tl == dd->ipath_hdrqlast)) { 703 (!hd && tl == dd->ipath_hdrqlast)) {
704 if (i == 0) 704 if (i == 0)
705 chkerrpkts = 1; 705 chkerrpkts = 1;
706 dd->ipath_lastrcvhdrqtails[i] = tl; 706 pd->port_lastrcvhdrqtail = tl;
707 pd->port_hdrqfull++; 707 pd->port_hdrqfull++;
708 /* flush hdrqfull so that poll() sees it */ 708 /* flush hdrqfull so that poll() sees it */
709 wmb(); 709 wmb();
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 57e21bbd9ffa..7bb0d08820d8 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -141,6 +141,11 @@ struct ipath_portdata {
141 u32 port_pionowait; 141 u32 port_pionowait;
142 /* total number of rcvhdrqfull errors */ 142 /* total number of rcvhdrqfull errors */
143 u32 port_hdrqfull; 143 u32 port_hdrqfull;
144 /*
145 * Used to suppress multiple instances of same
146 * port staying stuck at same point.
147 */
148 u32 port_lastrcvhdrqtail;
144 /* saved total number of rcvhdrqfull errors for poll edge trigger */ 149 /* saved total number of rcvhdrqfull errors for poll edge trigger */
145 u32 port_hdrqfull_poll; 150 u32 port_hdrqfull_poll;
146 /* total number of polled urgent packets */ 151 /* total number of polled urgent packets */
@@ -149,6 +154,7 @@ struct ipath_portdata {
149 u32 port_urgent_poll; 154 u32 port_urgent_poll;
150 /* pid of process using this port */ 155 /* pid of process using this port */
151 pid_t port_pid; 156 pid_t port_pid;
157 pid_t port_subpid[INFINIPATH_MAX_SUBPORT];
152 /* same size as task_struct .comm[] */ 158 /* same size as task_struct .comm[] */
153 char port_comm[16]; 159 char port_comm[16];
154 /* pkeys set by this use of this port */ 160 /* pkeys set by this use of this port */
@@ -320,16 +326,6 @@ struct ipath_devdata {
320 u32 ipath_p0_hdrqfull; 326 u32 ipath_p0_hdrqfull;
321 327
322 /* 328 /*
323 * (*cfgports) used to suppress multiple instances of same
324 * port staying stuck at same point
325 */
326 u32 *ipath_lastrcvhdrqtails;
327 /*
328 * (*cfgports) used to suppress multiple instances of same
329 * port staying stuck at same point
330 */
331 u32 *ipath_lastegrheads;
332 /*
333 * index of last piobuffer we used. Speeds up searching, by 329 * index of last piobuffer we used. Speeds up searching, by
334 * starting at this point. Doesn't matter if multiple cpu's use and 330 * starting at this point. Doesn't matter if multiple cpu's use and
335 * update, last updater is only write that matters. Whenever it 331 * update, last updater is only write that matters. Whenever it
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c
index fd897652da6a..d2725cd11bdc 100644
--- a/drivers/infiniband/hw/ipath/ipath_stats.c
+++ b/drivers/infiniband/hw/ipath/ipath_stats.c
@@ -238,7 +238,7 @@ static void ipath_chk_errormask(struct ipath_devdata *dd)
238void ipath_get_faststats(unsigned long opaque) 238void ipath_get_faststats(unsigned long opaque)
239{ 239{
240 struct ipath_devdata *dd = (struct ipath_devdata *) opaque; 240 struct ipath_devdata *dd = (struct ipath_devdata *) opaque;
241 u32 val; 241 int i;
242 static unsigned cnt; 242 static unsigned cnt;
243 unsigned long flags; 243 unsigned long flags;
244 u64 traffic_wds; 244 u64 traffic_wds;
@@ -322,12 +322,11 @@ void ipath_get_faststats(unsigned long opaque)
322 322
323 /* limit qfull messages to ~one per minute per port */ 323 /* limit qfull messages to ~one per minute per port */
324 if ((++cnt & 0x10)) { 324 if ((++cnt & 0x10)) {
325 for (val = dd->ipath_cfgports - 1; ((int)val) >= 0; 325 for (i = (int) dd->ipath_cfgports; --i >= 0; ) {
326 val--) { 326 struct ipath_portdata *pd = dd->ipath_pd[i];
327 if (dd->ipath_lastegrheads[val] != -1) 327
328 dd->ipath_lastegrheads[val] = -1; 328 if (pd && pd->port_lastrcvhdrqtail != -1)
329 if (dd->ipath_lastrcvhdrqtails[val] != -1) 329 pd->port_lastrcvhdrqtail = -1;
330 dd->ipath_lastrcvhdrqtails[val] = -1;
331 } 330 }
332 } 331 }
333 332