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>
This commit is contained in:
Родитель
d8274869d7
Коммит
755807a296
|
@ -1785,6 +1785,7 @@ static int find_shared_port(struct file *fp,
|
||||||
}
|
}
|
||||||
port_fp(fp) = pd;
|
port_fp(fp) = pd;
|
||||||
subport_fp(fp) = pd->port_cnt++;
|
subport_fp(fp) = pd->port_cnt++;
|
||||||
|
pd->port_subpid[subport_fp(fp)] = current->pid;
|
||||||
tidcursor_fp(fp) = 0;
|
tidcursor_fp(fp) = 0;
|
||||||
pd->active_slaves |= 1 << subport_fp(fp);
|
pd->active_slaves |= 1 << subport_fp(fp);
|
||||||
ipath_cdbg(PROC,
|
ipath_cdbg(PROC,
|
||||||
|
@ -1915,8 +1916,7 @@ static int ipath_do_user_init(struct file *fp,
|
||||||
*/
|
*/
|
||||||
head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port);
|
head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port);
|
||||||
ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port);
|
ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port);
|
||||||
dd->ipath_lastegrheads[pd->port_port] = -1;
|
pd->port_lastrcvhdrqtail = -1;
|
||||||
dd->ipath_lastrcvhdrqtails[pd->port_port] = -1;
|
|
||||||
ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n",
|
ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n",
|
||||||
pd->port_port, head32);
|
pd->port_port, head32);
|
||||||
pd->port_tidcursor = 0; /* start at beginning after open */
|
pd->port_tidcursor = 0; /* start at beginning after open */
|
||||||
|
@ -2019,6 +2019,7 @@ static int ipath_close(struct inode *in, struct file *fp)
|
||||||
* the slave(s) don't wait for receive data forever.
|
* the slave(s) don't wait for receive data forever.
|
||||||
*/
|
*/
|
||||||
pd->active_slaves &= ~(1 << fd->subport);
|
pd->active_slaves &= ~(1 << fd->subport);
|
||||||
|
pd->port_subpid[fd->subport] = 0;
|
||||||
mutex_unlock(&ipath_mutex);
|
mutex_unlock(&ipath_mutex);
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,22 +272,7 @@ static int init_chip_first(struct ipath_devdata *dd,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd->ipath_lastegrheads = kzalloc(sizeof(*dd->ipath_lastegrheads)
|
|
||||||
* dd->ipath_cfgports,
|
|
||||||
GFP_KERNEL);
|
|
||||||
dd->ipath_lastrcvhdrqtails =
|
|
||||||
kzalloc(sizeof(*dd->ipath_lastrcvhdrqtails)
|
|
||||||
* dd->ipath_cfgports, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (!dd->ipath_lastegrheads || !dd->ipath_lastrcvhdrqtails) {
|
|
||||||
ipath_dev_err(dd, "Unable to allocate head arrays, "
|
|
||||||
"failing\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
pd = create_portdata0(dd);
|
pd = create_portdata0(dd);
|
||||||
|
|
||||||
if (!pd) {
|
if (!pd) {
|
||||||
ipath_dev_err(dd, "Unable to allocate portdata for port "
|
ipath_dev_err(dd, "Unable to allocate portdata for port "
|
||||||
"0, failing\n");
|
"0, failing\n");
|
||||||
|
|
|
@ -693,7 +693,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
|
||||||
* except kernel
|
* except kernel
|
||||||
*/
|
*/
|
||||||
tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;
|
tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;
|
||||||
if (tl == dd->ipath_lastrcvhdrqtails[i])
|
if (tl == pd->port_lastrcvhdrqtail)
|
||||||
continue;
|
continue;
|
||||||
hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
|
hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
|
||||||
i);
|
i);
|
||||||
|
@ -703,7 +703,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
|
||||||
(!hd && tl == dd->ipath_hdrqlast)) {
|
(!hd && tl == dd->ipath_hdrqlast)) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
chkerrpkts = 1;
|
chkerrpkts = 1;
|
||||||
dd->ipath_lastrcvhdrqtails[i] = tl;
|
pd->port_lastrcvhdrqtail = tl;
|
||||||
pd->port_hdrqfull++;
|
pd->port_hdrqfull++;
|
||||||
/* flush hdrqfull so that poll() sees it */
|
/* flush hdrqfull so that poll() sees it */
|
||||||
wmb();
|
wmb();
|
||||||
|
|
|
@ -141,6 +141,11 @@ struct ipath_portdata {
|
||||||
u32 port_pionowait;
|
u32 port_pionowait;
|
||||||
/* total number of rcvhdrqfull errors */
|
/* total number of rcvhdrqfull errors */
|
||||||
u32 port_hdrqfull;
|
u32 port_hdrqfull;
|
||||||
|
/*
|
||||||
|
* Used to suppress multiple instances of same
|
||||||
|
* port staying stuck at same point.
|
||||||
|
*/
|
||||||
|
u32 port_lastrcvhdrqtail;
|
||||||
/* saved total number of rcvhdrqfull errors for poll edge trigger */
|
/* saved total number of rcvhdrqfull errors for poll edge trigger */
|
||||||
u32 port_hdrqfull_poll;
|
u32 port_hdrqfull_poll;
|
||||||
/* total number of polled urgent packets */
|
/* total number of polled urgent packets */
|
||||||
|
@ -149,6 +154,7 @@ struct ipath_portdata {
|
||||||
u32 port_urgent_poll;
|
u32 port_urgent_poll;
|
||||||
/* pid of process using this port */
|
/* pid of process using this port */
|
||||||
pid_t port_pid;
|
pid_t port_pid;
|
||||||
|
pid_t port_subpid[INFINIPATH_MAX_SUBPORT];
|
||||||
/* same size as task_struct .comm[] */
|
/* same size as task_struct .comm[] */
|
||||||
char port_comm[16];
|
char port_comm[16];
|
||||||
/* pkeys set by this use of this port */
|
/* pkeys set by this use of this port */
|
||||||
|
@ -319,16 +325,6 @@ struct ipath_devdata {
|
||||||
/* count of port 0 hdrqfull errors */
|
/* count of port 0 hdrqfull errors */
|
||||||
u32 ipath_p0_hdrqfull;
|
u32 ipath_p0_hdrqfull;
|
||||||
|
|
||||||
/*
|
|
||||||
* (*cfgports) used to suppress multiple instances of same
|
|
||||||
* port staying stuck at same point
|
|
||||||
*/
|
|
||||||
u32 *ipath_lastrcvhdrqtails;
|
|
||||||
/*
|
|
||||||
* (*cfgports) used to suppress multiple instances of same
|
|
||||||
* port staying stuck at same point
|
|
||||||
*/
|
|
||||||
u32 *ipath_lastegrheads;
|
|
||||||
/*
|
/*
|
||||||
* index of last piobuffer we used. Speeds up searching, by
|
* index of last piobuffer we used. Speeds up searching, by
|
||||||
* starting at this point. Doesn't matter if multiple cpu's use and
|
* starting at this point. Doesn't matter if multiple cpu's use and
|
||||||
|
|
|
@ -238,7 +238,7 @@ static void ipath_chk_errormask(struct ipath_devdata *dd)
|
||||||
void ipath_get_faststats(unsigned long opaque)
|
void ipath_get_faststats(unsigned long opaque)
|
||||||
{
|
{
|
||||||
struct ipath_devdata *dd = (struct ipath_devdata *) opaque;
|
struct ipath_devdata *dd = (struct ipath_devdata *) opaque;
|
||||||
u32 val;
|
int i;
|
||||||
static unsigned cnt;
|
static unsigned cnt;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u64 traffic_wds;
|
u64 traffic_wds;
|
||||||
|
@ -322,12 +322,11 @@ void ipath_get_faststats(unsigned long opaque)
|
||||||
|
|
||||||
/* limit qfull messages to ~one per minute per port */
|
/* limit qfull messages to ~one per minute per port */
|
||||||
if ((++cnt & 0x10)) {
|
if ((++cnt & 0x10)) {
|
||||||
for (val = dd->ipath_cfgports - 1; ((int)val) >= 0;
|
for (i = (int) dd->ipath_cfgports; --i >= 0; ) {
|
||||||
val--) {
|
struct ipath_portdata *pd = dd->ipath_pd[i];
|
||||||
if (dd->ipath_lastegrheads[val] != -1)
|
|
||||||
dd->ipath_lastegrheads[val] = -1;
|
if (pd && pd->port_lastrcvhdrqtail != -1)
|
||||||
if (dd->ipath_lastrcvhdrqtails[val] != -1)
|
pd->port_lastrcvhdrqtail = -1;
|
||||||
dd->ipath_lastrcvhdrqtails[val] = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче