1573 struct ipath_portdata *pd;
1574 int ret;
1575
1576 if (!(pd = dd->ipath_pd[port])) {
1577 void *ptmp;
1578
1579 pd = kzalloc(sizeof(struct ipath_portdata), GFP_KERNEL);
1580
1581
1582
1583
1584
1585
1586 ptmp = kmalloc(dd->ipath_rcvtidcnt * sizeof(u16) +
1587 dd->ipath_rcvtidcnt * sizeof(struct page **),
1588 GFP_KERNEL);
1589 if (!pd || !ptmp) {
1590 ipath_dev_err(dd, "Unable to allocate portdata "
1591 "memory, failing open\n");
1592 ret = -ENOMEM;
1593 kfree(pd);
1594 kfree(ptmp);
1595 goto bail;
1596 }
1597 dd->ipath_pd[port] = pd;
1598 dd->ipath_pd[port]->port_port = port;
1599 dd->ipath_pd[port]->port_dd = dd;
1600 dd->ipath_pd[port]->port_tid_pg_list = ptmp;
1601 init_waitqueue_head(&dd->ipath_pd[port]->port_wait);
1602 }
1603 if (!pd->port_cnt) {
1604 pd->userversion = uinfo->spu_userversion;
1605 init_user_egr_sizes(pd);
1606 if ((ret = init_subports(dd, pd, uinfo)) != 0)
1607 goto bail;
1608 ipath_cdbg(PROC, "%s[%u] opened unit:port %u:%u\n",
1609 current->comm, current->pid, dd->ipath_unit,
1610 port);
1611 pd->port_cnt = 1;
1612 port_fp(fp) = pd;
1613 pd->port_pid = get_pid(task_pid(current));