Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10723
b: refs/heads/master
c: c8e0ca6
h: refs/heads/master
i:
  10721: 1391055
  10719: 164e42b
v: v3
  • Loading branch information
Roland Dreier committed Oct 22, 2005
1 parent a881bac commit efea655
Show file tree
Hide file tree
Showing 33 changed files with 631 additions and 1,579 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bbf207860931b6a033d0fbcd170ae2332c0d8216
refs/heads/master: c8e0ca683dfea7242ff29814561dfe761945e5b3
41 changes: 13 additions & 28 deletions trunk/drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,9 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
cur_cm_id_priv = rb_entry(parent, struct cm_id_private,
service_node);
if ((cur_cm_id_priv->id.service_mask & service_id) ==
(service_mask & cur_cm_id_priv->id.service_id) &&
(cm_id_priv->id.device == cur_cm_id_priv->id.device))
return cur_cm_id_priv;

if (cm_id_priv->id.device < cur_cm_id_priv->id.device)
link = &(*link)->rb_left;
else if (cm_id_priv->id.device > cur_cm_id_priv->id.device)
link = &(*link)->rb_right;
else if (service_id < cur_cm_id_priv->id.service_id)
(service_mask & cur_cm_id_priv->id.service_id))
return cm_id_priv;
if (service_id < cur_cm_id_priv->id.service_id)
link = &(*link)->rb_left;
else
link = &(*link)->rb_right;
Expand All @@ -384,24 +378,17 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
return NULL;
}

static struct cm_id_private * cm_find_listen(struct ib_device *device,
__be64 service_id)
static struct cm_id_private * cm_find_listen(__be64 service_id)
{
struct rb_node *node = cm.listen_service_table.rb_node;
struct cm_id_private *cm_id_priv;

while (node) {
cm_id_priv = rb_entry(node, struct cm_id_private, service_node);
if ((cm_id_priv->id.service_mask & service_id) ==
cm_id_priv->id.service_id &&
(cm_id_priv->id.device == device))
(cm_id_priv->id.service_mask & cm_id_priv->id.service_id))
return cm_id_priv;

if (device < cm_id_priv->id.device)
node = node->rb_left;
else if (device > cm_id_priv->id.device)
node = node->rb_right;
else if (service_id < cm_id_priv->id.service_id)
if (service_id < cm_id_priv->id.service_id)
node = node->rb_left;
else
node = node->rb_right;
Expand Down Expand Up @@ -536,8 +523,7 @@ static void cm_reject_sidr_req(struct cm_id_private *cm_id_priv,
ib_send_cm_sidr_rep(&cm_id_priv->id, &param);
}

struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
ib_cm_handler cm_handler,
struct ib_cm_id *ib_create_cm_id(ib_cm_handler cm_handler,
void *context)
{
struct cm_id_private *cm_id_priv;
Expand All @@ -549,7 +535,6 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,

memset(cm_id_priv, 0, sizeof *cm_id_priv);
cm_id_priv->id.state = IB_CM_IDLE;
cm_id_priv->id.device = device;
cm_id_priv->id.cm_handler = cm_handler;
cm_id_priv->id.context = context;
cm_id_priv->id.remote_cm_qpn = 1;
Expand Down Expand Up @@ -1062,6 +1047,7 @@ static void cm_format_req_event(struct cm_work *work,
req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
param = &work->cm_event.param.req_rcvd;
param->listen_id = listen_id;
param->device = cm_id_priv->av.port->mad_agent->device;
param->port = cm_id_priv->av.port->port_num;
param->primary_path = &work->path[0];
if (req_msg->alt_local_lid)
Expand Down Expand Up @@ -1240,8 +1226,7 @@ static struct cm_id_private * cm_match_req(struct cm_work *work,
}

/* Find matching listen request. */
listen_cm_id_priv = cm_find_listen(cm_id_priv->id.device,
req_msg->service_id);
listen_cm_id_priv = cm_find_listen(req_msg->service_id);
if (!listen_cm_id_priv) {
spin_unlock_irqrestore(&cm.lock, flags);
cm_issue_rej(work->port, work->mad_recv_wc,
Expand Down Expand Up @@ -1269,7 +1254,7 @@ static int cm_req_handler(struct cm_work *work)

req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;

cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL);
cm_id = ib_create_cm_id(NULL, NULL);
if (IS_ERR(cm_id))
return PTR_ERR(cm_id);

Expand Down Expand Up @@ -2644,6 +2629,7 @@ static void cm_format_sidr_req_event(struct cm_work *work,
param = &work->cm_event.param.sidr_req_rcvd;
param->pkey = __be16_to_cpu(sidr_req_msg->pkey);
param->listen_id = listen_id;
param->device = work->port->mad_agent->device;
param->port = work->port->port_num;
work->cm_event.private_data = &sidr_req_msg->private_data;
}
Expand All @@ -2656,7 +2642,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
struct ib_wc *wc;
unsigned long flags;

cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL);
cm_id = ib_create_cm_id(NULL, NULL);
if (IS_ERR(cm_id))
return PTR_ERR(cm_id);
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
Expand All @@ -2680,8 +2666,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
spin_unlock_irqrestore(&cm.lock, flags);
goto out; /* Duplicate message. */
}
cur_cm_id_priv = cm_find_listen(cm_id->device,
sidr_req_msg->service_id);
cur_cm_id_priv = cm_find_listen(sidr_req_msg->service_id);
if (!cur_cm_id_priv) {
rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
spin_unlock_irqrestore(&cm.lock, flags);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/infiniband/core/cm_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ static inline void cm_req_set_qp_type(struct cm_req_msg *req_msg,
req_msg->offset40 = cpu_to_be32((be32_to_cpu(
req_msg->offset40) &
0xFFFFFFF9) | 0x2);
break;
default:
req_msg->offset40 = cpu_to_be32(be32_to_cpu(
req_msg->offset40) &
Expand Down
12 changes: 0 additions & 12 deletions trunk/drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,6 @@ int ib_query_port(struct ib_device *device,
u8 port_num,
struct ib_port_attr *port_attr)
{
if (device->node_type == IB_NODE_SWITCH) {
if (port_num)
return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt)
return -EINVAL;

return device->query_port(device, port_num, port_attr);
}
EXPORT_SYMBOL(ib_query_port);
Expand Down Expand Up @@ -589,12 +583,6 @@ int ib_modify_port(struct ib_device *device,
u8 port_num, int port_modify_mask,
struct ib_port_modify *port_modify)
{
if (device->node_type == IB_NODE_SWITCH) {
if (port_num)
return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt)
return -EINVAL;

return device->modify_port(device, port_num, port_modify_mask,
port_modify);
}
Expand Down
45 changes: 19 additions & 26 deletions trunk/drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -2683,47 +2683,40 @@ static int ib_mad_port_close(struct ib_device *device, int port_num)

static void ib_mad_init_device(struct ib_device *device)
{
int start, end, i;
int num_ports, cur_port, i;

if (device->node_type == IB_NODE_SWITCH) {
start = 0;
end = 0;
num_ports = 1;
cur_port = 0;
} else {
start = 1;
end = device->phys_port_cnt;
num_ports = device->phys_port_cnt;
cur_port = 1;
}

for (i = start; i <= end; i++) {
if (ib_mad_port_open(device, i)) {
for (i = 0; i < num_ports; i++, cur_port++) {
if (ib_mad_port_open(device, cur_port)) {
printk(KERN_ERR PFX "Couldn't open %s port %d\n",
device->name, i);
goto error;
device->name, cur_port);
goto error_device_open;
}
if (ib_agent_port_open(device, i)) {
if (ib_agent_port_open(device, cur_port)) {
printk(KERN_ERR PFX "Couldn't open %s port %d "
"for agents\n",
device->name, i);
goto error_agent;
device->name, cur_port);
goto error_device_open;
}
}
return;

error_agent:
if (ib_mad_port_close(device, i))
printk(KERN_ERR PFX "Couldn't close %s port %d\n",
device->name, i);

error:
i--;

while (i >= start) {
if (ib_agent_port_close(device, i))
error_device_open:
while (i > 0) {
cur_port--;
if (ib_agent_port_close(device, cur_port))
printk(KERN_ERR PFX "Couldn't close %s port %d "
"for agents\n",
device->name, i);
if (ib_mad_port_close(device, i))
device->name, cur_port);
if (ib_mad_port_close(device, cur_port))
printk(KERN_ERR PFX "Couldn't close %s port %d\n",
device->name, i);
device->name, cur_port);
i--;
}
}
Expand Down
30 changes: 6 additions & 24 deletions trunk/drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,16 +583,10 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
{
struct ib_sa_path_query *query;
struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
struct ib_sa_port *port;
struct ib_mad_agent *agent;
struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port];
struct ib_mad_agent *agent = port->agent;
int ret;

if (!sa_dev)
return -ENODEV;

port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent;

query = kmalloc(sizeof *query, gfp_mask);
if (!query)
return -ENOMEM;
Expand Down Expand Up @@ -691,16 +685,10 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method,
{
struct ib_sa_service_query *query;
struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
struct ib_sa_port *port;
struct ib_mad_agent *agent;
struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port];
struct ib_mad_agent *agent = port->agent;
int ret;

if (!sa_dev)
return -ENODEV;

port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent;

if (method != IB_MGMT_METHOD_GET &&
method != IB_MGMT_METHOD_SET &&
method != IB_SA_METHOD_DELETE)
Expand Down Expand Up @@ -780,16 +768,10 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
{
struct ib_sa_mcmember_query *query;
struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
struct ib_sa_port *port;
struct ib_mad_agent *agent;
struct ib_sa_port *port = &sa_dev->port[port_num - sa_dev->start_port];
struct ib_mad_agent *agent = port->agent;
int ret;

if (!sa_dev)
return -ENODEV;

port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent;

query = kmalloc(sizeof *query, gfp_mask);
if (!query)
return -ENOMEM;
Expand Down
16 changes: 0 additions & 16 deletions trunk/drivers/infiniband/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ struct port_table_attribute {
int index;
};

static inline int ibdev_is_alive(const struct ib_device *dev)
{
return dev->reg_state == IB_DEV_REGISTERED;
}

static ssize_t port_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
Expand All @@ -79,8 +74,6 @@ static ssize_t port_attr_show(struct kobject *kobj,

if (!port_attr->show)
return -EIO;
if (!ibdev_is_alive(p->ibdev))
return -ENODEV;

return port_attr->show(p, port_attr, buf);
}
Expand Down Expand Up @@ -588,9 +581,6 @@ static ssize_t show_node_type(struct class_device *cdev, char *buf)
{
struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);

if (!ibdev_is_alive(dev))
return -ENODEV;

switch (dev->node_type) {
case IB_NODE_CA: return sprintf(buf, "%d: CA\n", dev->node_type);
case IB_NODE_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type);
Expand All @@ -605,9 +595,6 @@ static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf)
struct ib_device_attr attr;
ssize_t ret;

if (!ibdev_is_alive(dev))
return -ENODEV;

ret = ib_query_device(dev, &attr);
if (ret)
return ret;
Expand All @@ -625,9 +612,6 @@ static ssize_t show_node_guid(struct class_device *cdev, char *buf)
struct ib_device_attr attr;
ssize_t ret;

if (!ibdev_is_alive(dev))
return -ENODEV;

ret = ib_query_device(dev, &attr);
if (ret)
return ret;
Expand Down
Loading

0 comments on commit efea655

Please sign in to comment.