Skip to content

Commit 755807a

Browse files
Dave OlsonRoland Dreier
authored andcommitted
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>
1 parent d827486 commit 755807a

5 files changed

Lines changed: 17 additions & 36 deletions

File tree

‎drivers/infiniband/hw/ipath/ipath_file_ops.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,7 @@ static int find_shared_port(struct file *fp,
17851785
}
17861786
port_fp(fp) = pd;
17871787
subport_fp(fp) = pd->port_cnt++;
1788+
pd->port_subpid[subport_fp(fp)] = current->pid;
17881789
tidcursor_fp(fp) = 0;
17891790
pd->active_slaves |= 1 << subport_fp(fp);
17901791
ipath_cdbg(PROC,
@@ -1915,8 +1916,7 @@ static int ipath_do_user_init(struct file *fp,
19151916
*/
19161917
head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port);
19171918
ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port);
1918-
dd->ipath_lastegrheads[pd->port_port] = -1;
1919-
dd->ipath_lastrcvhdrqtails[pd->port_port] = -1;
1919+
pd->port_lastrcvhdrqtail = -1;
19201920
ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n",
19211921
pd->port_port, head32);
19221922
pd->port_tidcursor = 0; /* start at beginning after open */
@@ -2019,6 +2019,7 @@ static int ipath_close(struct inode *in, struct file *fp)
20192019
* the slave(s) don't wait for receive data forever.
20202020
*/
20212021
pd->active_slaves &= ~(1 << fd->subport);
2022+
pd->port_subpid[fd->subport] = 0;
20222023
mutex_unlock(&ipath_mutex);
20232024
goto bail;
20242025
}

‎drivers/infiniband/hw/ipath/ipath_init_chip.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -272,22 +272,7 @@ static int init_chip_first(struct ipath_devdata *dd,
272272
goto done;
273273
}
274274

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-
289275
pd = create_portdata0(dd);
290-
291276
if (!pd) {
292277
ipath_dev_err(dd, "Unable to allocate portdata for port "
293278
"0, failing\n");

‎drivers/infiniband/hw/ipath/ipath_intr.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
693693
* except kernel
694694
*/
695695
tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;
696-
if (tl == dd->ipath_lastrcvhdrqtails[i])
696+
if (tl == pd->port_lastrcvhdrqtail)
697697
continue;
698698
hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
699699
i);
@@ -703,7 +703,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
703703
(!hd && tl == dd->ipath_hdrqlast)) {
704704
if (i == 0)
705705
chkerrpkts = 1;
706-
dd->ipath_lastrcvhdrqtails[i] = tl;
706+
pd->port_lastrcvhdrqtail = tl;
707707
pd->port_hdrqfull++;
708708
/* flush hdrqfull so that poll() sees it */
709709
wmb();

‎drivers/infiniband/hw/ipath/ipath_kernel.h‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ struct ipath_portdata {
141141
u32 port_pionowait;
142142
/* total number of rcvhdrqfull errors */
143143
u32 port_hdrqfull;
144+
/*
145+
* Used to suppress multiple instances of same
146+
* port staying stuck at same point.
147+
*/
148+
u32 port_lastrcvhdrqtail;
144149
/* saved total number of rcvhdrqfull errors for poll edge trigger */
145150
u32 port_hdrqfull_poll;
146151
/* total number of polled urgent packets */
@@ -149,6 +154,7 @@ struct ipath_portdata {
149154
u32 port_urgent_poll;
150155
/* pid of process using this port */
151156
pid_t port_pid;
157+
pid_t port_subpid[INFINIPATH_MAX_SUBPORT];
152158
/* same size as task_struct .comm[] */
153159
char port_comm[16];
154160
/* pkeys set by this use of this port */
@@ -319,16 +325,6 @@ struct ipath_devdata {
319325
/* count of port 0 hdrqfull errors */
320326
u32 ipath_p0_hdrqfull;
321327

322-
/*
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;
332328
/*
333329
* index of last piobuffer we used. Speeds up searching, by
334330
* starting at this point. Doesn't matter if multiple cpu's use and

‎drivers/infiniband/hw/ipath/ipath_stats.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static void ipath_chk_errormask(struct ipath_devdata *dd)
238238
void ipath_get_faststats(unsigned long opaque)
239239
{
240240
struct ipath_devdata *dd = (struct ipath_devdata *) opaque;
241-
u32 val;
241+
int i;
242242
static unsigned cnt;
243243
unsigned long flags;
244244
u64 traffic_wds;
@@ -322,12 +322,11 @@ void ipath_get_faststats(unsigned long opaque)
322322

323323
/* limit qfull messages to ~one per minute per port */
324324
if ((++cnt & 0x10)) {
325-
for (val = dd->ipath_cfgports - 1; ((int)val) >= 0;
326-
val--) {
327-
if (dd->ipath_lastegrheads[val] != -1)
328-
dd->ipath_lastegrheads[val] = -1;
329-
if (dd->ipath_lastrcvhdrqtails[val] != -1)
330-
dd->ipath_lastrcvhdrqtails[val] = -1;
325+
for (i = (int) dd->ipath_cfgports; --i >= 0; ) {
326+
struct ipath_portdata *pd = dd->ipath_pd[i];
327+
328+
if (pd && pd->port_lastrcvhdrqtail != -1)
329+
pd->port_lastrcvhdrqtail = -1;
331330
}
332331
}
333332

0 commit comments

Comments
 (0)