Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18342
b: refs/heads/master
c: 87530db
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jan 14, 2006
1 parent fa72503 commit fba3275
Show file tree
Hide file tree
Showing 255 changed files with 23,630 additions and 4,575 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: d5f079000b20887bfbc84d772a27709c5665e652
refs/heads/master: 87530db5ec7d519c7ba334e414307c5130ae2da8
13 changes: 13 additions & 0 deletions trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,19 @@ P: Romain Lievin
M: roms@lpg.ticalc.org
S: Maintained

TIPC NETWORK LAYER
P: Per Liden
M: per.liden@nospam.ericsson.com
P: Jon Maloy
M: jon.maloy@nospam.ericsson.com
P: Allan Stephens
M: allan.stephens@nospam.windriver.com
L: tipc-discussion@lists.sourceforge.net
W: http://tipc.sourceforge.net/
W: http://tipc.cslab.ericsson.net/
T: git tipc.cslab.ericsson.net:/pub/git/tipc.git
S: Maintained

TLAN NETWORK DRIVER
P: Samuel Chessman
M: chessman@tux.org
Expand Down
29 changes: 5 additions & 24 deletions trunk/drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3163,22 +3163,6 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
}
EXPORT_SYMBOL(ib_cm_init_qp_attr);

static __be64 cm_get_ca_guid(struct ib_device *device)
{
struct ib_device_attr *device_attr;
__be64 guid;
int ret;

device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
if (!device_attr)
return 0;

ret = ib_query_device(device, device_attr);
guid = ret ? 0 : device_attr->node_guid;
kfree(device_attr);
return guid;
}

static void cm_add_one(struct ib_device *device)
{
struct cm_device *cm_dev;
Expand All @@ -3200,9 +3184,7 @@ static void cm_add_one(struct ib_device *device)
return;

cm_dev->device = device;
cm_dev->ca_guid = cm_get_ca_guid(device);
if (!cm_dev->ca_guid)
goto error1;
cm_dev->ca_guid = device->node_guid;

set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask);
for (i = 1; i <= device->phys_port_cnt; i++) {
Expand All @@ -3217,11 +3199,11 @@ static void cm_add_one(struct ib_device *device)
cm_recv_handler,
port);
if (IS_ERR(port->mad_agent))
goto error2;
goto error1;

ret = ib_modify_port(device, i, 0, &port_modify);
if (ret)
goto error3;
goto error2;
}
ib_set_client_data(device, &cm_client, cm_dev);

Expand All @@ -3230,17 +3212,16 @@ static void cm_add_one(struct ib_device *device)
write_unlock_irqrestore(&cm.device_lock, flags);
return;

error3:
ib_unregister_mad_agent(port->mad_agent);
error2:
ib_unregister_mad_agent(port->mad_agent);
error1:
port_modify.set_port_cap_mask = 0;
port_modify.clr_port_cap_mask = IB_PORT_CM_SUP;
while (--i) {
port = &cm_dev->port[i-1];
ib_modify_port(device, port->port_num, 0, &port_modify);
ib_unregister_mad_agent(port->mad_agent);
}
error1:
kfree(cm_dev);
}

Expand Down
23 changes: 11 additions & 12 deletions trunk/drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>

#include <asm/semaphore.h>
#include <linux/mutex.h>

#include "core_priv.h"

Expand All @@ -57,13 +56,13 @@ static LIST_HEAD(device_list);
static LIST_HEAD(client_list);

/*
* device_sem protects access to both device_list and client_list.
* device_mutex protects access to both device_list and client_list.
* There's no real point to using multiple locks or something fancier
* like an rwsem: we always access both lists, and we're always
* modifying one list or the other list. In any case this is not a
* hot path so there's no point in trying to optimize.
*/
static DECLARE_MUTEX(device_sem);
static DEFINE_MUTEX(device_mutex);

static int ib_device_check_mandatory(struct ib_device *device)
{
Expand Down Expand Up @@ -221,7 +220,7 @@ int ib_register_device(struct ib_device *device)
{
int ret;

down(&device_sem);
mutex_lock(&device_mutex);

if (strchr(device->name, '%')) {
ret = alloc_name(device->name);
Expand Down Expand Up @@ -259,7 +258,7 @@ int ib_register_device(struct ib_device *device)
}

out:
up(&device_sem);
mutex_unlock(&device_mutex);
return ret;
}
EXPORT_SYMBOL(ib_register_device);
Expand All @@ -276,15 +275,15 @@ void ib_unregister_device(struct ib_device *device)
struct ib_client_data *context, *tmp;
unsigned long flags;

down(&device_sem);
mutex_lock(&device_mutex);

list_for_each_entry_reverse(client, &client_list, list)
if (client->remove)
client->remove(device);

list_del(&device->core_list);

up(&device_sem);
mutex_unlock(&device_mutex);

spin_lock_irqsave(&device->client_data_lock, flags);
list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
Expand Down Expand Up @@ -312,14 +311,14 @@ int ib_register_client(struct ib_client *client)
{
struct ib_device *device;

down(&device_sem);
mutex_lock(&device_mutex);

list_add_tail(&client->list, &client_list);
list_for_each_entry(device, &device_list, core_list)
if (client->add && !add_client_context(device, client))
client->add(device);

up(&device_sem);
mutex_unlock(&device_mutex);

return 0;
}
Expand All @@ -339,7 +338,7 @@ void ib_unregister_client(struct ib_client *client)
struct ib_device *device;
unsigned long flags;

down(&device_sem);
mutex_lock(&device_mutex);

list_for_each_entry(device, &device_list, core_list) {
if (client->remove)
Expand All @@ -355,7 +354,7 @@ void ib_unregister_client(struct ib_client *client)
}
list_del(&client->list);

up(&device_sem);
mutex_unlock(&device_mutex);
}
EXPORT_SYMBOL(ib_unregister_client);

Expand Down
22 changes: 5 additions & 17 deletions trunk/drivers/infiniband/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,7 @@ static int ib_device_uevent(struct class_device *cdev, char **envp,
return -ENOMEM;

/*
* It might be nice to pass the node GUID with the event, but
* right now the only way to get it is to query the device
* provider, and this can crash during device removal because
* we are will be running after driver removal has started.
* We could add a node_guid field to struct ib_device, or we
* could just let userspace read the node GUID from sysfs when
* devices are added.
* It would be nice to pass the node GUID with the event...
*/

envp[i] = NULL;
Expand Down Expand Up @@ -623,21 +617,15 @@ static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf)
static ssize_t show_node_guid(struct class_device *cdev, char *buf)
{
struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
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;

return sprintf(buf, "%04x:%04x:%04x:%04x\n",
be16_to_cpu(((__be16 *) &attr.node_guid)[0]),
be16_to_cpu(((__be16 *) &attr.node_guid)[1]),
be16_to_cpu(((__be16 *) &attr.node_guid)[2]),
be16_to_cpu(((__be16 *) &attr.node_guid)[3]));
be16_to_cpu(((__be16 *) &dev->node_guid)[0]),
be16_to_cpu(((__be16 *) &dev->node_guid)[1]),
be16_to_cpu(((__be16 *) &dev->node_guid)[2]),
be16_to_cpu(((__be16 *) &dev->node_guid)[3]));
}

static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);
Expand Down
23 changes: 12 additions & 11 deletions trunk/drivers/infiniband/core/ucm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/mount.h>
#include <linux/cdev.h>
#include <linux/idr.h>
#include <linux/mutex.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -113,23 +114,23 @@ static struct ib_client ucm_client = {
.remove = ib_ucm_remove_one
};

static DECLARE_MUTEX(ctx_id_mutex);
static DEFINE_MUTEX(ctx_id_mutex);
static DEFINE_IDR(ctx_id_table);
static DECLARE_BITMAP(dev_map, IB_UCM_MAX_DEVICES);

static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id)
{
struct ib_ucm_context *ctx;

down(&ctx_id_mutex);
mutex_lock(&ctx_id_mutex);
ctx = idr_find(&ctx_id_table, id);
if (!ctx)
ctx = ERR_PTR(-ENOENT);
else if (ctx->file != file)
ctx = ERR_PTR(-EINVAL);
else
atomic_inc(&ctx->ref);
up(&ctx_id_mutex);
mutex_unlock(&ctx_id_mutex);

return ctx;
}
Expand Down Expand Up @@ -186,9 +187,9 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
if (!result)
goto error;

down(&ctx_id_mutex);
mutex_lock(&ctx_id_mutex);
result = idr_get_new(&ctx_id_table, ctx, &ctx->id);
up(&ctx_id_mutex);
mutex_unlock(&ctx_id_mutex);
} while (result == -EAGAIN);

if (result)
Expand Down Expand Up @@ -550,9 +551,9 @@ static ssize_t ib_ucm_create_id(struct ib_ucm_file *file,
err2:
ib_destroy_cm_id(ctx->cm_id);
err1:
down(&ctx_id_mutex);
mutex_lock(&ctx_id_mutex);
idr_remove(&ctx_id_table, ctx->id);
up(&ctx_id_mutex);
mutex_unlock(&ctx_id_mutex);
kfree(ctx);
return result;
}
Expand All @@ -572,15 +573,15 @@ static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file,
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
return -EFAULT;

down(&ctx_id_mutex);
mutex_lock(&ctx_id_mutex);
ctx = idr_find(&ctx_id_table, cmd.id);
if (!ctx)
ctx = ERR_PTR(-ENOENT);
else if (ctx->file != file)
ctx = ERR_PTR(-EINVAL);
else
idr_remove(&ctx_id_table, ctx->id);
up(&ctx_id_mutex);
mutex_unlock(&ctx_id_mutex);

if (IS_ERR(ctx))
return PTR_ERR(ctx);
Expand Down Expand Up @@ -1280,9 +1281,9 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
struct ib_ucm_context, file_list);
up(&file->mutex);

down(&ctx_id_mutex);
mutex_lock(&ctx_id_mutex);
idr_remove(&ctx_id_table, ctx->id);
up(&ctx_id_mutex);
mutex_unlock(&ctx_id_mutex);

ib_destroy_cm_id(ctx->cm_id);
ib_ucm_cleanup_events(ctx);
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/infiniband/core/uverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <linux/kref.h>
#include <linux/idr.h>
#include <linux/mutex.h>

#include <rdma/ib_verbs.h>
#include <rdma/ib_user_verbs.h>
Expand Down Expand Up @@ -88,7 +89,7 @@ struct ib_uverbs_event_file {

struct ib_uverbs_file {
struct kref ref;
struct semaphore mutex;
struct mutex mutex;
struct ib_uverbs_device *device;
struct ib_ucontext *ucontext;
struct ib_event_handler event_handler;
Expand Down Expand Up @@ -131,7 +132,7 @@ struct ib_ucq_object {
u32 async_events_reported;
};

extern struct semaphore ib_uverbs_idr_mutex;
extern struct mutex ib_uverbs_idr_mutex;
extern struct idr ib_uverbs_pd_idr;
extern struct idr ib_uverbs_mr_idr;
extern struct idr ib_uverbs_mw_idr;
Expand Down
Loading

0 comments on commit fba3275

Please sign in to comment.