aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-09-28 12:00:21 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-28 14:17:07 -0400
commitc97d27d8a992cf6cefee945489d5f93fca160aa2 (patch)
tree6d788ad830d2437c217a3000d681d9422a7dfc3d /drivers/infiniband
parent1a4e74a08788db913486cb9a3dc30984c55e9897 (diff)
IB/ipath: Set CPU affinity early
This change moves around port assignment so that it happens before any memory is allocated. This allows memory to be allocated on an appropriate CPU, which improves performance for users of /dev/ipath. Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_common.h6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c39
2 files changed, 35 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h
index a9b109a353bc..54139d398181 100644
--- a/drivers/infiniband/hw/ipath/ipath_common.h
+++ b/drivers/infiniband/hw/ipath/ipath_common.h
@@ -412,15 +412,17 @@ struct ipath_user_info {
412 412
413#define IPATH_CMD_MIN 16 413#define IPATH_CMD_MIN 16
414 414
415#define IPATH_CMD_USER_INIT 16 /* set up userspace */ 415#define __IPATH_CMD_USER_INIT 16 /* old set up userspace (for old user code) */
416#define IPATH_CMD_PORT_INFO 17 /* find out what resources we got */ 416#define IPATH_CMD_PORT_INFO 17 /* find out what resources we got */
417#define IPATH_CMD_RECV_CTRL 18 /* control receipt of packets */ 417#define IPATH_CMD_RECV_CTRL 18 /* control receipt of packets */
418#define IPATH_CMD_TID_UPDATE 19 /* update expected TID entries */ 418#define IPATH_CMD_TID_UPDATE 19 /* update expected TID entries */
419#define IPATH_CMD_TID_FREE 20 /* free expected TID entries */ 419#define IPATH_CMD_TID_FREE 20 /* free expected TID entries */
420#define IPATH_CMD_SET_PART_KEY 21 /* add partition key */ 420#define IPATH_CMD_SET_PART_KEY 21 /* add partition key */
421#define IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes */ 421#define IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes */
422#define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */
423#define IPATH_CMD_USER_INIT 24 /* set up userspace */
422 424
423#define IPATH_CMD_MAX 22 425#define IPATH_CMD_MAX 24
424 426
425struct ipath_port_info { 427struct ipath_port_info {
426 __u32 num_active; /* number of active units */ 428 __u32 num_active; /* number of active units */
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 64221b937762..a9ddc6911f66 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -1701,18 +1701,17 @@ done:
1701 1701
1702static int ipath_open(struct inode *in, struct file *fp) 1702static int ipath_open(struct inode *in, struct file *fp)
1703{ 1703{
1704 /* The real work is performed later in ipath_do_user_init() */ 1704 /* The real work is performed later in ipath_assign_port() */
1705 fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL); 1705 fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL);
1706 return fp->private_data ? 0 : -ENOMEM; 1706 return fp->private_data ? 0 : -ENOMEM;
1707} 1707}
1708 1708
1709static int ipath_do_user_init(struct file *fp, 1709
1710/* Get port early, so can set affinity prior to memory allocation */
1711static int ipath_assign_port(struct file *fp,
1710 const struct ipath_user_info *uinfo) 1712 const struct ipath_user_info *uinfo)
1711{ 1713{
1712 int ret; 1714 int ret;
1713 struct ipath_portdata *pd;
1714 struct ipath_devdata *dd;
1715 u32 head32;
1716 int i_minor; 1715 int i_minor;
1717 unsigned swminor; 1716 unsigned swminor;
1718 1717
@@ -1757,8 +1756,18 @@ static int ipath_do_user_init(struct file *fp,
1757 1756
1758 mutex_unlock(&ipath_mutex); 1757 mutex_unlock(&ipath_mutex);
1759 1758
1760 if (ret) 1759done:
1761 goto done; 1760 return ret;
1761}
1762
1763
1764static int ipath_do_user_init(struct file *fp,
1765 const struct ipath_user_info *uinfo)
1766{
1767 int ret;
1768 struct ipath_portdata *pd;
1769 struct ipath_devdata *dd;
1770 u32 head32;
1762 1771
1763 pd = port_fp(fp); 1772 pd = port_fp(fp);
1764 dd = pd->port_dd; 1773 dd = pd->port_dd;
@@ -2035,6 +2044,8 @@ static ssize_t ipath_write(struct file *fp, const char __user *data,
2035 consumed = sizeof(cmd.type); 2044 consumed = sizeof(cmd.type);
2036 2045
2037 switch (cmd.type) { 2046 switch (cmd.type) {
2047 case IPATH_CMD_ASSIGN_PORT:
2048 case __IPATH_CMD_USER_INIT:
2038 case IPATH_CMD_USER_INIT: 2049 case IPATH_CMD_USER_INIT:
2039 copy = sizeof(cmd.cmd.user_info); 2050 copy = sizeof(cmd.cmd.user_info);
2040 dest = &cmd.cmd.user_info; 2051 dest = &cmd.cmd.user_info;
@@ -2083,12 +2094,24 @@ static ssize_t ipath_write(struct file *fp, const char __user *data,
2083 2094
2084 consumed += copy; 2095 consumed += copy;
2085 pd = port_fp(fp); 2096 pd = port_fp(fp);
2086 if (!pd && cmd.type != IPATH_CMD_USER_INIT) { 2097 if (!pd && cmd.type != __IPATH_CMD_USER_INIT &&
2098 cmd.type != IPATH_CMD_ASSIGN_PORT) {
2087 ret = -EINVAL; 2099 ret = -EINVAL;
2088 goto bail; 2100 goto bail;
2089 } 2101 }
2090 2102
2091 switch (cmd.type) { 2103 switch (cmd.type) {
2104 case IPATH_CMD_ASSIGN_PORT:
2105 ret = ipath_assign_port(fp, &cmd.cmd.user_info);
2106 if (ret)
2107 goto bail;
2108 break;
2109 case __IPATH_CMD_USER_INIT:
2110 /* backwards compatibility, get port first */
2111 ret = ipath_assign_port(fp, &cmd.cmd.user_info);
2112 if (ret)
2113 goto bail;
2114 /* and fall through to current version. */
2092 case IPATH_CMD_USER_INIT: 2115 case IPATH_CMD_USER_INIT:
2093 ret = ipath_do_user_init(fp, &cmd.cmd.user_info); 2116 ret = ipath_do_user_init(fp, &cmd.cmd.user_info);
2094 if (ret) 2117 if (ret)