Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a6df590d
Commit
a6df590d
authored
Jan 31, 2006
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
parents
2f4c5416
fd9cfdd1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
61 deletions
+58
-61
drivers/infiniband/hw/mthca/mthca_cmd.c
drivers/infiniband/hw/mthca/mthca_cmd.c
+5
-8
drivers/infiniband/hw/mthca/mthca_dev.h
drivers/infiniband/hw/mthca/mthca_dev.h
+5
-3
drivers/infiniband/hw/mthca/mthca_main.c
drivers/infiniband/hw/mthca/mthca_main.c
+8
-2
drivers/infiniband/hw/mthca/mthca_mcg.c
drivers/infiniband/hw/mthca/mthca_mcg.c
+7
-13
drivers/infiniband/hw/mthca/mthca_memfree.c
drivers/infiniband/hw/mthca/mthca_memfree.c
+18
-18
drivers/infiniband/hw/mthca/mthca_memfree.h
drivers/infiniband/hw/mthca/mthca_memfree.h
+3
-4
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/mthca/mthca_provider.c
+3
-3
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.c
+7
-7
drivers/infiniband/ulp/srp/ib_srp.h
drivers/infiniband/ulp/srp/ib_srp.h
+2
-3
No files found.
drivers/infiniband/hw/mthca/mthca_cmd.c
View file @
a6df590d
...
@@ -199,8 +199,7 @@ static int mthca_cmd_post(struct mthca_dev *dev,
...
@@ -199,8 +199,7 @@ static int mthca_cmd_post(struct mthca_dev *dev,
{
{
int
err
=
0
;
int
err
=
0
;
if
(
down_interruptible
(
&
dev
->
cmd
.
hcr_sem
))
mutex_lock
(
&
dev
->
cmd
.
hcr_mutex
);
return
-
EINTR
;
if
(
event
)
{
if
(
event
)
{
unsigned
long
end
=
jiffies
+
GO_BIT_TIMEOUT
;
unsigned
long
end
=
jiffies
+
GO_BIT_TIMEOUT
;
...
@@ -238,7 +237,7 @@ static int mthca_cmd_post(struct mthca_dev *dev,
...
@@ -238,7 +237,7 @@ static int mthca_cmd_post(struct mthca_dev *dev,
op
),
dev
->
hcr
+
6
*
4
);
op
),
dev
->
hcr
+
6
*
4
);
out:
out:
up
(
&
dev
->
cmd
.
hcr_sem
);
mutex_unlock
(
&
dev
->
cmd
.
hcr_mutex
);
return
err
;
return
err
;
}
}
...
@@ -255,8 +254,7 @@ static int mthca_cmd_poll(struct mthca_dev *dev,
...
@@ -255,8 +254,7 @@ static int mthca_cmd_poll(struct mthca_dev *dev,
int
err
=
0
;
int
err
=
0
;
unsigned
long
end
;
unsigned
long
end
;
if
(
down_interruptible
(
&
dev
->
cmd
.
poll_sem
))
down
(
&
dev
->
cmd
.
poll_sem
);
return
-
EINTR
;
err
=
mthca_cmd_post
(
dev
,
in_param
,
err
=
mthca_cmd_post
(
dev
,
in_param
,
out_param
?
*
out_param
:
0
,
out_param
?
*
out_param
:
0
,
...
@@ -333,8 +331,7 @@ static int mthca_cmd_wait(struct mthca_dev *dev,
...
@@ -333,8 +331,7 @@ static int mthca_cmd_wait(struct mthca_dev *dev,
int
err
=
0
;
int
err
=
0
;
struct
mthca_cmd_context
*
context
;
struct
mthca_cmd_context
*
context
;
if
(
down_interruptible
(
&
dev
->
cmd
.
event_sem
))
down
(
&
dev
->
cmd
.
event_sem
);
return
-
EINTR
;
spin_lock
(
&
dev
->
cmd
.
context_lock
);
spin_lock
(
&
dev
->
cmd
.
context_lock
);
BUG_ON
(
dev
->
cmd
.
free_head
<
0
);
BUG_ON
(
dev
->
cmd
.
free_head
<
0
);
...
@@ -438,7 +435,7 @@ static int mthca_cmd_imm(struct mthca_dev *dev,
...
@@ -438,7 +435,7 @@ static int mthca_cmd_imm(struct mthca_dev *dev,
int
mthca_cmd_init
(
struct
mthca_dev
*
dev
)
int
mthca_cmd_init
(
struct
mthca_dev
*
dev
)
{
{
sema_init
(
&
dev
->
cmd
.
hcr_sem
,
1
);
mutex_init
(
&
dev
->
cmd
.
hcr_mutex
);
sema_init
(
&
dev
->
cmd
.
poll_sem
,
1
);
sema_init
(
&
dev
->
cmd
.
poll_sem
,
1
);
dev
->
cmd
.
use_events
=
0
;
dev
->
cmd
.
use_events
=
0
;
...
...
drivers/infiniband/hw/mthca/mthca_dev.h
View file @
a6df590d
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/timer.h>
#include <linux/timer.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#include <asm/semaphore.h>
#include "mthca_provider.h"
#include "mthca_provider.h"
...
@@ -111,7 +113,7 @@ enum {
...
@@ -111,7 +113,7 @@ enum {
struct
mthca_cmd
{
struct
mthca_cmd
{
struct
pci_pool
*
pool
;
struct
pci_pool
*
pool
;
int
use_events
;
int
use_events
;
struct
semaphore
hcr_sem
;
struct
mutex
hcr_mutex
;
struct
semaphore
poll_sem
;
struct
semaphore
poll_sem
;
struct
semaphore
event_sem
;
struct
semaphore
event_sem
;
int
max_cmds
;
int
max_cmds
;
...
@@ -256,7 +258,7 @@ struct mthca_av_table {
...
@@ -256,7 +258,7 @@ struct mthca_av_table {
};
};
struct
mthca_mcg_table
{
struct
mthca_mcg_table
{
struct
semaphore
sem
;
struct
mutex
mutex
;
struct
mthca_alloc
alloc
;
struct
mthca_alloc
alloc
;
struct
mthca_icm_table
*
table
;
struct
mthca_icm_table
*
table
;
};
};
...
@@ -301,7 +303,7 @@ struct mthca_dev {
...
@@ -301,7 +303,7 @@ struct mthca_dev {
u64
ddr_end
;
u64
ddr_end
;
MTHCA_DECLARE_DOORBELL_LOCK
(
doorbell_lock
)
MTHCA_DECLARE_DOORBELL_LOCK
(
doorbell_lock
)
struct
semaphore
cap_mask_mutex
;
struct
mutex
cap_mask_mutex
;
void
__iomem
*
hcr
;
void
__iomem
*
hcr
;
void
__iomem
*
kar
;
void
__iomem
*
kar
;
...
...
drivers/infiniband/hw/mthca/mthca_main.c
View file @
a6df590d
...
@@ -155,6 +155,13 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
...
@@ -155,6 +155,13 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
return
-
ENODEV
;
return
-
ENODEV
;
}
}
if
(
dev_lim
->
uar_size
>
pci_resource_len
(
mdev
->
pdev
,
2
))
{
mthca_err
(
mdev
,
"HCA reported UAR size of 0x%x bigger than "
"PCI resource 2 size of 0x%lx, aborting.
\n
"
,
dev_lim
->
uar_size
,
pci_resource_len
(
mdev
->
pdev
,
2
));
return
-
ENODEV
;
}
mdev
->
limits
.
num_ports
=
dev_lim
->
num_ports
;
mdev
->
limits
.
num_ports
=
dev_lim
->
num_ports
;
mdev
->
limits
.
vl_cap
=
dev_lim
->
max_vl
;
mdev
->
limits
.
vl_cap
=
dev_lim
->
max_vl
;
mdev
->
limits
.
mtu_cap
=
dev_lim
->
max_mtu
;
mdev
->
limits
.
mtu_cap
=
dev_lim
->
max_mtu
;
...
@@ -976,8 +983,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
...
@@ -976,8 +983,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
err
=
-
ENODEV
;
err
=
-
ENODEV
;
goto
err_disable_pdev
;
goto
err_disable_pdev
;
}
}
if
(
!
(
pci_resource_flags
(
pdev
,
2
)
&
IORESOURCE_MEM
)
||
if
(
!
(
pci_resource_flags
(
pdev
,
2
)
&
IORESOURCE_MEM
))
{
pci_resource_len
(
pdev
,
2
)
!=
1
<<
23
)
{
dev_err
(
&
pdev
->
dev
,
"Missing UAR, aborting.
\n
"
);
dev_err
(
&
pdev
->
dev
,
"Missing UAR, aborting.
\n
"
);
err
=
-
ENODEV
;
err
=
-
ENODEV
;
goto
err_disable_pdev
;
goto
err_disable_pdev
;
...
...
drivers/infiniband/hw/mthca/mthca_mcg.c
View file @
a6df590d
...
@@ -154,10 +154,7 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
...
@@ -154,10 +154,7 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
return
PTR_ERR
(
mailbox
);
return
PTR_ERR
(
mailbox
);
mgm
=
mailbox
->
buf
;
mgm
=
mailbox
->
buf
;
if
(
down_interruptible
(
&
dev
->
mcg_table
.
sem
))
{
mutex_lock
(
&
dev
->
mcg_table
.
mutex
);
err
=
-
EINTR
;
goto
err_sem
;
}
err
=
find_mgm
(
dev
,
gid
->
raw
,
mailbox
,
&
hash
,
&
prev
,
&
index
);
err
=
find_mgm
(
dev
,
gid
->
raw
,
mailbox
,
&
hash
,
&
prev
,
&
index
);
if
(
err
)
if
(
err
)
...
@@ -241,8 +238,8 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
...
@@ -241,8 +238,8 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
BUG_ON
(
index
<
dev
->
limits
.
num_mgms
);
BUG_ON
(
index
<
dev
->
limits
.
num_mgms
);
mthca_free
(
&
dev
->
mcg_table
.
alloc
,
index
);
mthca_free
(
&
dev
->
mcg_table
.
alloc
,
index
);
}
}
up
(
&
dev
->
mcg_table
.
sem
);
mutex_unlock
(
&
dev
->
mcg_table
.
mutex
);
err_sem:
mthca_free_mailbox
(
dev
,
mailbox
);
mthca_free_mailbox
(
dev
,
mailbox
);
return
err
;
return
err
;
}
}
...
@@ -263,10 +260,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
...
@@ -263,10 +260,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
return
PTR_ERR
(
mailbox
);
return
PTR_ERR
(
mailbox
);
mgm
=
mailbox
->
buf
;
mgm
=
mailbox
->
buf
;
if
(
down_interruptible
(
&
dev
->
mcg_table
.
sem
))
{
mutex_lock
(
&
dev
->
mcg_table
.
mutex
);
err
=
-
EINTR
;
goto
err_sem
;
}
err
=
find_mgm
(
dev
,
gid
->
raw
,
mailbox
,
&
hash
,
&
prev
,
&
index
);
err
=
find_mgm
(
dev
,
gid
->
raw
,
mailbox
,
&
hash
,
&
prev
,
&
index
);
if
(
err
)
if
(
err
)
...
@@ -371,8 +365,8 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
...
@@ -371,8 +365,8 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
}
}
out:
out:
up
(
&
dev
->
mcg_table
.
sem
);
mutex_unlock
(
&
dev
->
mcg_table
.
mutex
);
err_sem:
mthca_free_mailbox
(
dev
,
mailbox
);
mthca_free_mailbox
(
dev
,
mailbox
);
return
err
;
return
err
;
}
}
...
@@ -389,7 +383,7 @@ int __devinit mthca_init_mcg_table(struct mthca_dev *dev)
...
@@ -389,7 +383,7 @@ int __devinit mthca_init_mcg_table(struct mthca_dev *dev)
if
(
err
)
if
(
err
)
return
err
;
return
err
;
init_MUTEX
(
&
dev
->
mcg_table
.
sem
);
mutex_init
(
&
dev
->
mcg_table
.
mutex
);
return
0
;
return
0
;
}
}
...
...
drivers/infiniband/hw/mthca/mthca_memfree.c
View file @
a6df590d
...
@@ -50,7 +50,7 @@ enum {
...
@@ -50,7 +50,7 @@ enum {
};
};
struct
mthca_user_db_table
{
struct
mthca_user_db_table
{
struct
semaphore
mutex
;
struct
mutex
mutex
;
struct
{
struct
{
u64
uvirt
;
u64
uvirt
;
struct
scatterlist
mem
;
struct
scatterlist
mem
;
...
@@ -158,7 +158,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
...
@@ -158,7 +158,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
int
ret
=
0
;
int
ret
=
0
;
u8
status
;
u8
status
;
down
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
if
(
table
->
icm
[
i
])
{
if
(
table
->
icm
[
i
])
{
++
table
->
icm
[
i
]
->
refcount
;
++
table
->
icm
[
i
]
->
refcount
;
...
@@ -184,7 +184,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
...
@@ -184,7 +184,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
++
table
->
icm
[
i
]
->
refcount
;
++
table
->
icm
[
i
]
->
refcount
;
out:
out:
up
(
&
table
->
mutex
);
mutex_unlock
(
&
table
->
mutex
);
return
ret
;
return
ret
;
}
}
...
@@ -198,7 +198,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o
...
@@ -198,7 +198,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o
i
=
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
/
MTHCA_TABLE_CHUNK_SIZE
;
i
=
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
/
MTHCA_TABLE_CHUNK_SIZE
;
down
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
if
(
--
table
->
icm
[
i
]
->
refcount
==
0
)
{
if
(
--
table
->
icm
[
i
]
->
refcount
==
0
)
{
mthca_UNMAP_ICM
(
dev
,
table
->
virt
+
i
*
MTHCA_TABLE_CHUNK_SIZE
,
mthca_UNMAP_ICM
(
dev
,
table
->
virt
+
i
*
MTHCA_TABLE_CHUNK_SIZE
,
...
@@ -207,7 +207,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o
...
@@ -207,7 +207,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o
table
->
icm
[
i
]
=
NULL
;
table
->
icm
[
i
]
=
NULL
;
}
}
up
(
&
table
->
mutex
);
mutex_unlock
(
&
table
->
mutex
);
}
}
void
*
mthca_table_find
(
struct
mthca_icm_table
*
table
,
int
obj
)
void
*
mthca_table_find
(
struct
mthca_icm_table
*
table
,
int
obj
)
...
@@ -220,7 +220,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
...
@@ -220,7 +220,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
if
(
!
table
->
lowmem
)
if
(
!
table
->
lowmem
)
return
NULL
;
return
NULL
;
down
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
idx
=
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
;
idx
=
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
;
icm
=
table
->
icm
[
idx
/
MTHCA_TABLE_CHUNK_SIZE
];
icm
=
table
->
icm
[
idx
/
MTHCA_TABLE_CHUNK_SIZE
];
...
@@ -240,7 +240,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
...
@@ -240,7 +240,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
}
}
out:
out:
up
(
&
table
->
mutex
);
mutex_unlock
(
&
table
->
mutex
);
return
page
?
lowmem_page_address
(
page
)
+
offset
:
NULL
;
return
page
?
lowmem_page_address
(
page
)
+
offset
:
NULL
;
}
}
...
@@ -301,7 +301,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
...
@@ -301,7 +301,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
table
->
num_obj
=
nobj
;
table
->
num_obj
=
nobj
;
table
->
obj_size
=
obj_size
;
table
->
obj_size
=
obj_size
;
table
->
lowmem
=
use_lowmem
;
table
->
lowmem
=
use_lowmem
;
init_MUTEX
(
&
table
->
mutex
);
mutex_init
(
&
table
->
mutex
);
for
(
i
=
0
;
i
<
num_icm
;
++
i
)
for
(
i
=
0
;
i
<
num_icm
;
++
i
)
table
->
icm
[
i
]
=
NULL
;
table
->
icm
[
i
]
=
NULL
;
...
@@ -380,7 +380,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
...
@@ -380,7 +380,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
if
(
index
<
0
||
index
>
dev
->
uar_table
.
uarc_size
/
8
)
if
(
index
<
0
||
index
>
dev
->
uar_table
.
uarc_size
/
8
)
return
-
EINVAL
;
return
-
EINVAL
;
down
(
&
db_tab
->
mutex
);
mutex_lock
(
&
db_tab
->
mutex
);
i
=
index
/
MTHCA_DB_REC_PER_PAGE
;
i
=
index
/
MTHCA_DB_REC_PER_PAGE
;
...
@@ -424,7 +424,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
...
@@ -424,7 +424,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
db_tab
->
page
[
i
].
refcount
=
1
;
db_tab
->
page
[
i
].
refcount
=
1
;
out:
out:
up
(
&
db_tab
->
mutex
);
mutex_unlock
(
&
db_tab
->
mutex
);
return
ret
;
return
ret
;
}
}
...
@@ -439,11 +439,11 @@ void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
...
@@ -439,11 +439,11 @@ void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
* pages until we clean up the whole db table.
* pages until we clean up the whole db table.
*/
*/
down
(
&
db_tab
->
mutex
);
mutex_lock
(
&
db_tab
->
mutex
);
--
db_tab
->
page
[
index
/
MTHCA_DB_REC_PER_PAGE
].
refcount
;
--
db_tab
->
page
[
index
/
MTHCA_DB_REC_PER_PAGE
].
refcount
;
up
(
&
db_tab
->
mutex
);
mutex_unlock
(
&
db_tab
->
mutex
);
}
}
struct
mthca_user_db_table
*
mthca_init_user_db_tab
(
struct
mthca_dev
*
dev
)
struct
mthca_user_db_table
*
mthca_init_user_db_tab
(
struct
mthca_dev
*
dev
)
...
@@ -460,7 +460,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev)
...
@@ -460,7 +460,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev)
if
(
!
db_tab
)
if
(
!
db_tab
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
init_MUTEX
(
&
db_tab
->
mutex
);
mutex_init
(
&
db_tab
->
mutex
);
for
(
i
=
0
;
i
<
npages
;
++
i
)
{
for
(
i
=
0
;
i
<
npages
;
++
i
)
{
db_tab
->
page
[
i
].
refcount
=
0
;
db_tab
->
page
[
i
].
refcount
=
0
;
db_tab
->
page
[
i
].
uvirt
=
0
;
db_tab
->
page
[
i
].
uvirt
=
0
;
...
@@ -499,7 +499,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
...
@@ -499,7 +499,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
int
ret
=
0
;
int
ret
=
0
;
u8
status
;
u8
status
;
down
(
&
dev
->
db_tab
->
mutex
);
mutex_lock
(
&
dev
->
db_tab
->
mutex
);
switch
(
type
)
{
switch
(
type
)
{
case
MTHCA_DB_TYPE_CQ_ARM
:
case
MTHCA_DB_TYPE_CQ_ARM
:
...
@@ -585,7 +585,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
...
@@ -585,7 +585,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
*
db
=
(
__be32
*
)
&
page
->
db_rec
[
j
];
*
db
=
(
__be32
*
)
&
page
->
db_rec
[
j
];
out:
out:
up
(
&
dev
->
db_tab
->
mutex
);
mutex_unlock
(
&
dev
->
db_tab
->
mutex
);
return
ret
;
return
ret
;
}
}
...
@@ -601,7 +601,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
...
@@ -601,7 +601,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
page
=
dev
->
db_tab
->
page
+
i
;
page
=
dev
->
db_tab
->
page
+
i
;
down
(
&
dev
->
db_tab
->
mutex
);
mutex_lock
(
&
dev
->
db_tab
->
mutex
);
page
->
db_rec
[
j
]
=
0
;
page
->
db_rec
[
j
]
=
0
;
if
(
i
>=
dev
->
db_tab
->
min_group2
)
if
(
i
>=
dev
->
db_tab
->
min_group2
)
...
@@ -624,7 +624,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
...
@@ -624,7 +624,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
++
dev
->
db_tab
->
min_group2
;
++
dev
->
db_tab
->
min_group2
;
}
}
up
(
&
dev
->
db_tab
->
mutex
);
mutex_unlock
(
&
dev
->
db_tab
->
mutex
);
}
}
int
mthca_init_db_tab
(
struct
mthca_dev
*
dev
)
int
mthca_init_db_tab
(
struct
mthca_dev
*
dev
)
...
@@ -638,7 +638,7 @@ int mthca_init_db_tab(struct mthca_dev *dev)
...
@@ -638,7 +638,7 @@ int mthca_init_db_tab(struct mthca_dev *dev)
if
(
!
dev
->
db_tab
)
if
(
!
dev
->
db_tab
)
return
-
ENOMEM
;
return
-
ENOMEM
;
init_MUTEX
(
&
dev
->
db_tab
->
mutex
);
mutex_init
(
&
dev
->
db_tab
->
mutex
);
dev
->
db_tab
->
npages
=
dev
->
uar_table
.
uarc_size
/
4096
;
dev
->
db_tab
->
npages
=
dev
->
uar_table
.
uarc_size
/
4096
;
dev
->
db_tab
->
max_group1
=
0
;
dev
->
db_tab
->
max_group1
=
0
;
...
...
drivers/infiniband/hw/mthca/mthca_memfree.h
View file @
a6df590d
...
@@ -39,8 +39,7 @@
...
@@ -39,8 +39,7 @@
#include <linux/list.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#define MTHCA_ICM_CHUNK_LEN \
#define MTHCA_ICM_CHUNK_LEN \
((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \
((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \
...
@@ -64,7 +63,7 @@ struct mthca_icm_table {
...
@@ -64,7 +63,7 @@ struct mthca_icm_table {
int
num_obj
;
int
num_obj
;
int
obj_size
;
int
obj_size
;
int
lowmem
;
int
lowmem
;
struct
semaphore
mutex
;
struct
mutex
mutex
;
struct
mthca_icm
*
icm
[
0
];
struct
mthca_icm
*
icm
[
0
];
};
};
...
@@ -147,7 +146,7 @@ struct mthca_db_table {
...
@@ -147,7 +146,7 @@ struct mthca_db_table {
int
max_group1
;
int
max_group1
;
int
min_group2
;
int
min_group2
;
struct
mthca_db_page
*
page
;
struct
mthca_db_page
*
page
;
struct
semaphore
mutex
;
struct
mutex
mutex
;
};
};
enum
mthca_db_type
{
enum
mthca_db_type
{
...
...
drivers/infiniband/hw/mthca/mthca_provider.c
View file @
a6df590d
...
@@ -185,7 +185,7 @@ static int mthca_modify_port(struct ib_device *ibdev,
...
@@ -185,7 +185,7 @@ static int mthca_modify_port(struct ib_device *ibdev,
int
err
;
int
err
;
u8
status
;
u8
status
;
if
(
down
_interruptible
(
&
to_mdev
(
ibdev
)
->
cap_mask_mutex
))
if
(
mutex_lock
_interruptible
(
&
to_mdev
(
ibdev
)
->
cap_mask_mutex
))
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
err
=
mthca_query_port
(
ibdev
,
port
,
&
attr
);
err
=
mthca_query_port
(
ibdev
,
port
,
&
attr
);
...
@@ -207,7 +207,7 @@ static int mthca_modify_port(struct ib_device *ibdev,
...
@@ -207,7 +207,7 @@ static int mthca_modify_port(struct ib_device *ibdev,
}
}
out:
out:
up
(
&
to_mdev
(
ibdev
)
->
cap_mask_mutex
);
mutex_unlock
(
&
to_mdev
(
ibdev
)
->
cap_mask_mutex
);
return
err
;
return
err
;
}
}
...
@@ -1185,7 +1185,7 @@ int mthca_register_device(struct mthca_dev *dev)
...
@@ -1185,7 +1185,7 @@ int mthca_register_device(struct mthca_dev *dev)
dev
->
ib_dev
.
post_recv
=
mthca_tavor_post_receive
;
dev
->
ib_dev
.
post_recv
=
mthca_tavor_post_receive
;
}
}
init_MUTEX
(
&
dev
->
cap_mask_mutex
);
mutex_init
(
&
dev
->
cap_mask_mutex
);
ret
=
ib_register_device
(
&
dev
->
ib_dev
);
ret
=
ib_register_device
(
&
dev
->
ib_dev
);
if
(
ret
)
if
(
ret
)
...
...
drivers/infiniband/ulp/srp/ib_srp.c
View file @
a6df590d
...
@@ -357,9 +357,9 @@ static void srp_remove_work(void *target_ptr)
...
@@ -357,9 +357,9 @@ static void srp_remove_work(void *target_ptr)
target
->
state
=
SRP_TARGET_REMOVED
;
target
->
state
=
SRP_TARGET_REMOVED
;
spin_unlock_irq
(
target
->
scsi_host
->
host_lock
);
spin_unlock_irq
(
target
->
scsi_host
->
host_lock
);
down
(
&
target
->
srp_host
->
target_mutex
);
mutex_lock
(
&
target
->
srp_host
->
target_mutex
);
list_del
(
&
target
->
list
);
list_del
(
&
target
->
list
);
up
(
&
target
->
srp_host
->
target_mutex
);
mutex_unlock
(
&
target
->
srp_host
->
target_mutex
);
scsi_remove_host
(
target
->
scsi_host
);
scsi_remove_host
(
target
->
scsi_host
);
ib_destroy_cm_id
(
target
->
cm_id
);
ib_destroy_cm_id
(
target
->
cm_id
);
...
@@ -1254,9 +1254,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
...
@@ -1254,9 +1254,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
if
(
scsi_add_host
(
target
->
scsi_host
,
host
->
dev
->
dma_device
))
if
(
scsi_add_host
(
target
->
scsi_host
,
host
->
dev
->
dma_device
))
return
-
ENODEV
;
return
-
ENODEV
;
down
(
&
host
->
target_mutex
);
mutex_lock
(
&
host
->
target_mutex
);
list_add_tail
(
&
target
->
list
,
&
host
->
target_list
);
list_add_tail
(
&
target
->
list
,
&
host
->
target_list
);
up
(
&
host
->
target_mutex
);
mutex_unlock
(
&
host
->
target_mutex
);
target
->
state
=
SRP_TARGET_LIVE
;
target
->
state
=
SRP_TARGET_LIVE
;
...
@@ -1525,7 +1525,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
...
@@ -1525,7 +1525,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
return
NULL
;
return
NULL
;
INIT_LIST_HEAD
(
&
host
->
target_list
);
INIT_LIST_HEAD
(
&
host
->
target_list
);
init_MUTEX
(
&
host
->
target_mutex
);
mutex_init
(
&
host
->
target_mutex
);
init_completion
(
&
host
->
released
);
init_completion
(
&
host
->
released
);
host
->
dev
=
device
;
host
->
dev
=
device
;
host
->
port
=
port
;
host
->
port
=
port
;
...
@@ -1626,7 +1626,7 @@ static void srp_remove_one(struct ib_device *device)
...
@@ -1626,7 +1626,7 @@ static void srp_remove_one(struct ib_device *device)
* Mark all target ports as removed, so we stop queueing
* Mark all target ports as removed, so we stop queueing
* commands and don't try to reconnect.
* commands and don't try to reconnect.
*/
*/
down
(
&
host
->
target_mutex
);
mutex_lock
(
&
host
->
target_mutex
);
list_for_each_entry_safe
(
target
,
tmp_target
,
list_for_each_entry_safe
(
target
,
tmp_target
,
&
host
->
target_list
,
list
)
{
&
host
->
target_list
,
list
)
{
spin_lock_irqsave
(
target
->
scsi_host
->
host_lock
,
flags
);
spin_lock_irqsave
(
target
->
scsi_host
->
host_lock
,
flags
);
...
@@ -1634,7 +1634,7 @@ static void srp_remove_one(struct ib_device *device)
...
@@ -1634,7 +1634,7 @@ static void srp_remove_one(struct ib_device *device)
target
->
state
=
SRP_TARGET_REMOVED
;
target
->
state
=
SRP_TARGET_REMOVED
;
spin_unlock_irqrestore
(
target
->
scsi_host
->
host_lock
,
flags
);
spin_unlock_irqrestore
(
target
->
scsi_host
->
host_lock
,
flags
);
}
}
up
(
&
host
->
target_mutex
);
mutex_unlock
(
&
host
->
target_mutex
);
/*
/*
* Wait for any reconnection tasks that may have
* Wait for any reconnection tasks that may have
...
...
drivers/infiniband/ulp/srp/ib_srp.h
View file @
a6df590d
...
@@ -37,8 +37,7 @@
...
@@ -37,8 +37,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_cmnd.h>
...
@@ -85,7 +84,7 @@ struct srp_host {
...
@@ -85,7 +84,7 @@ struct srp_host {
struct
ib_mr
*
mr
;
struct
ib_mr
*
mr
;
struct
class_device
class_dev
;
struct
class_device
class_dev
;
struct
list_head
target_list
;
struct
list_head
target_list
;
struct
semaphore
target_mutex
;
struct
mutex
target_mutex
;
struct
completion
released
;
struct
completion
released
;
struct
list_head
list
;
struct
list_head
list
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment