Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302627
b: refs/heads/master
c: 3e4d60a
h: refs/heads/master
i:
  302625: 14be583
  302623: c06b121
v: v3
  • Loading branch information
Sasha Levin authored and Roland Dreier committed May 8, 2012
1 parent b8028b8 commit ec0178c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 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: c592c42331f685b73f19ee54cfebfac0084f6e93
refs/heads/master: 3e4d60a82e7ab4cd6e212b6834c6a48c79731957
1 change: 1 addition & 0 deletions trunk/drivers/infiniband/hw/ocrdma/ocrdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ struct ocrdma_dev {
struct be_dev_info nic_info;

struct list_head entry;
struct rcu_head rcu;
int id;
};

Expand Down
38 changes: 22 additions & 16 deletions trunk/drivers/infiniband/hw/ocrdma/ocrdma_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MODULE_AUTHOR("Emulex Corporation");
MODULE_LICENSE("GPL");

static LIST_HEAD(ocrdma_dev_list);
static DEFINE_MUTEX(ocrdma_devlist_lock);
static DEFINE_SPINLOCK(ocrdma_devlist_lock);
static DEFINE_IDR(ocrdma_dev_id);

static union ib_gid ocrdma_zero_sgid;
Expand Down Expand Up @@ -221,14 +221,14 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier,
is_vlan = true;
vid = vlan_dev_vlan_id(event_netdev);
}
mutex_lock(&ocrdma_devlist_lock);
list_for_each_entry(dev, &ocrdma_dev_list, entry) {
rcu_read_lock();
list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) {
if (dev->nic_info.netdev == netdev) {
found = true;
break;
}
}
mutex_unlock(&ocrdma_devlist_lock);
rcu_read_unlock();

if (!found)
return NOTIFY_DONE;
Expand Down Expand Up @@ -431,9 +431,9 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
if (status)
goto alloc_err;

mutex_lock(&ocrdma_devlist_lock);
list_add_tail(&dev->entry, &ocrdma_dev_list);
mutex_unlock(&ocrdma_devlist_lock);
spin_lock(&ocrdma_devlist_lock);
list_add_tail_rcu(&dev->entry, &ocrdma_dev_list);
spin_unlock(&ocrdma_devlist_lock);
return dev;

alloc_err:
Expand All @@ -448,16 +448,9 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
return NULL;
}

static void ocrdma_remove(struct ocrdma_dev *dev)
static void ocrdma_remove_free(struct rcu_head *rcu)
{
/* first unregister with stack to stop all the active traffic
* of the registered clients.
*/
ib_unregister_device(&dev->ibdev);

mutex_lock(&ocrdma_devlist_lock);
list_del(&dev->entry);
mutex_unlock(&ocrdma_devlist_lock);
struct ocrdma_dev *dev = container_of(rcu, struct ocrdma_dev, rcu);

ocrdma_free_resources(dev);
ocrdma_cleanup_hw(dev);
Expand All @@ -467,6 +460,19 @@ static void ocrdma_remove(struct ocrdma_dev *dev)
ib_dealloc_device(&dev->ibdev);
}

static void ocrdma_remove(struct ocrdma_dev *dev)
{
/* first unregister with stack to stop all the active traffic
* of the registered clients.
*/
ib_unregister_device(&dev->ibdev);

spin_lock(&ocrdma_devlist_lock);
list_del_rcu(&dev->entry);
spin_unlock(&ocrdma_devlist_lock);
call_rcu(&dev->rcu, ocrdma_remove_free);
}

static int ocrdma_open(struct ocrdma_dev *dev)
{
struct ib_event port_event;
Expand Down

0 comments on commit ec0178c

Please sign in to comment.