Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FengXiao2002
Linux Imx
提交
f5772150
L
Linux Imx
项目概览
FengXiao2002
/
Linux Imx
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Linux Imx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f5772150
编写于
3月 01, 2010
作者:
R
Roland Dreier
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'srp' into for-next
上级
3bbddbad
da9d2f07
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
32 deletion
+65
-32
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.c
+63
-28
drivers/infiniband/ulp/srp/ib_srp.h
drivers/infiniband/ulp/srp/ib_srp.h
+2
-4
未找到文件。
drivers/infiniband/ulp/srp/ib_srp.c
浏览文件 @
f5772150
...
...
@@ -80,7 +80,8 @@ MODULE_PARM_DESC(mellanox_workarounds,
static
void
srp_add_one
(
struct
ib_device
*
device
);
static
void
srp_remove_one
(
struct
ib_device
*
device
);
static
void
srp_completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
);
static
void
srp_recv_completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
);
static
void
srp_send_completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
);
static
int
srp_cm_handler
(
struct
ib_cm_id
*
cm_id
,
struct
ib_cm_event
*
event
);
static
struct
scsi_transport_template
*
ib_srp_transport_template
;
...
...
@@ -227,14 +228,21 @@ static int srp_create_target_ib(struct srp_target_port *target)
if
(
!
init_attr
)
return
-
ENOMEM
;
target
->
cq
=
ib_create_cq
(
target
->
srp_host
->
srp_dev
->
dev
,
srp_completion
,
NULL
,
target
,
SRP_C
Q_SIZE
,
0
);
if
(
IS_ERR
(
target
->
cq
))
{
ret
=
PTR_ERR
(
target
->
cq
);
goto
out
;
target
->
recv_
cq
=
ib_create_cq
(
target
->
srp_host
->
srp_dev
->
dev
,
srp_recv_completion
,
NULL
,
target
,
SRP_R
Q_SIZE
,
0
);
if
(
IS_ERR
(
target
->
recv_
cq
))
{
ret
=
PTR_ERR
(
target
->
recv_
cq
);
goto
err
;
}
ib_req_notify_cq
(
target
->
cq
,
IB_CQ_NEXT_COMP
);
target
->
send_cq
=
ib_create_cq
(
target
->
srp_host
->
srp_dev
->
dev
,
srp_send_completion
,
NULL
,
target
,
SRP_SQ_SIZE
,
0
);
if
(
IS_ERR
(
target
->
send_cq
))
{
ret
=
PTR_ERR
(
target
->
send_cq
);
goto
err_recv_cq
;
}
ib_req_notify_cq
(
target
->
recv_cq
,
IB_CQ_NEXT_COMP
);
init_attr
->
event_handler
=
srp_qp_event
;
init_attr
->
cap
.
max_send_wr
=
SRP_SQ_SIZE
;
...
...
@@ -243,24 +251,32 @@ static int srp_create_target_ib(struct srp_target_port *target)
init_attr
->
cap
.
max_send_sge
=
1
;
init_attr
->
sq_sig_type
=
IB_SIGNAL_ALL_WR
;
init_attr
->
qp_type
=
IB_QPT_RC
;
init_attr
->
send_cq
=
target
->
cq
;
init_attr
->
recv_cq
=
target
->
cq
;
init_attr
->
send_cq
=
target
->
send_
cq
;
init_attr
->
recv_cq
=
target
->
recv_
cq
;
target
->
qp
=
ib_create_qp
(
target
->
srp_host
->
srp_dev
->
pd
,
init_attr
);
if
(
IS_ERR
(
target
->
qp
))
{
ret
=
PTR_ERR
(
target
->
qp
);
ib_destroy_cq
(
target
->
cq
);
goto
out
;
goto
err_send_cq
;
}
ret
=
srp_init_qp
(
target
,
target
->
qp
);
if
(
ret
)
{
ib_destroy_qp
(
target
->
qp
);
ib_destroy_cq
(
target
->
cq
);
goto
out
;
}
if
(
ret
)
goto
err_qp
;
out:
kfree
(
init_attr
);
return
0
;
err_qp:
ib_destroy_qp
(
target
->
qp
);
err_send_cq:
ib_destroy_cq
(
target
->
send_cq
);
err_recv_cq:
ib_destroy_cq
(
target
->
recv_cq
);
err:
kfree
(
init_attr
);
return
ret
;
}
...
...
@@ -270,7 +286,8 @@ static void srp_free_target_ib(struct srp_target_port *target)
int
i
;
ib_destroy_qp
(
target
->
qp
);
ib_destroy_cq
(
target
->
cq
);
ib_destroy_cq
(
target
->
send_cq
);
ib_destroy_cq
(
target
->
recv_cq
);
for
(
i
=
0
;
i
<
SRP_RQ_SIZE
;
++
i
)
srp_free_iu
(
target
->
srp_host
,
target
->
rx_ring
[
i
]);
...
...
@@ -568,7 +585,9 @@ static int srp_reconnect_target(struct srp_target_port *target)
if
(
ret
)
goto
err
;
while
(
ib_poll_cq
(
target
->
cq
,
1
,
&
wc
)
>
0
)
while
(
ib_poll_cq
(
target
->
recv_cq
,
1
,
&
wc
)
>
0
)
;
/* nothing */
while
(
ib_poll_cq
(
target
->
send_cq
,
1
,
&
wc
)
>
0
)
;
/* nothing */
spin_lock_irq
(
target
->
scsi_host
->
host_lock
);
...
...
@@ -851,7 +870,7 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
struct
srp_iu
*
iu
;
u8
opcode
;
iu
=
target
->
rx_ring
[
wc
->
wr_id
&
~
SRP_OP_RECV
];
iu
=
target
->
rx_ring
[
wc
->
wr_id
];
dev
=
target
->
srp_host
->
srp_dev
->
dev
;
ib_dma_sync_single_for_cpu
(
dev
,
iu
->
dma
,
target
->
max_ti_iu_len
,
...
...
@@ -898,7 +917,7 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
DMA_FROM_DEVICE
);
}
static
void
srp_completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
)
static
void
srp_
recv_
completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
)
{
struct
srp_target_port
*
target
=
target_ptr
;
struct
ib_wc
wc
;
...
...
@@ -907,17 +926,31 @@ static void srp_completion(struct ib_cq *cq, void *target_ptr)
while
(
ib_poll_cq
(
cq
,
1
,
&
wc
)
>
0
)
{
if
(
wc
.
status
)
{
shost_printk
(
KERN_ERR
,
target
->
scsi_host
,
PFX
"failed %s status %d
\n
"
,
wc
.
wr_id
&
SRP_OP_RECV
?
"receive"
:
"send"
,
PFX
"failed receive status %d
\n
"
,
wc
.
status
);
target
->
qp_in_error
=
1
;
break
;
}
if
(
wc
.
wr_id
&
SRP_OP_RECV
)
srp_handle_recv
(
target
,
&
wc
);
else
++
target
->
tx_tail
;
srp_handle_recv
(
target
,
&
wc
);
}
}
static
void
srp_send_completion
(
struct
ib_cq
*
cq
,
void
*
target_ptr
)
{
struct
srp_target_port
*
target
=
target_ptr
;
struct
ib_wc
wc
;
while
(
ib_poll_cq
(
cq
,
1
,
&
wc
)
>
0
)
{
if
(
wc
.
status
)
{
shost_printk
(
KERN_ERR
,
target
->
scsi_host
,
PFX
"failed send status %d
\n
"
,
wc
.
status
);
target
->
qp_in_error
=
1
;
break
;
}
++
target
->
tx_tail
;
}
}
...
...
@@ -930,7 +963,7 @@ static int __srp_post_recv(struct srp_target_port *target)
int
ret
;
next
=
target
->
rx_head
&
(
SRP_RQ_SIZE
-
1
);
wr
.
wr_id
=
next
|
SRP_OP_RECV
;
wr
.
wr_id
=
next
;
iu
=
target
->
rx_ring
[
next
];
list
.
addr
=
iu
->
dma
;
...
...
@@ -970,6 +1003,8 @@ static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target,
{
s32
min
=
(
req_type
==
SRP_REQ_TASK_MGMT
)
?
1
:
2
;
srp_send_completion
(
target
->
send_cq
,
target
);
if
(
target
->
tx_head
-
target
->
tx_tail
>=
SRP_SQ_SIZE
)
return
NULL
;
...
...
drivers/infiniband/ulp/srp/ib_srp.h
浏览文件 @
f5772150
...
...
@@ -60,7 +60,6 @@ enum {
SRP_RQ_SHIFT
=
6
,
SRP_RQ_SIZE
=
1
<<
SRP_RQ_SHIFT
,
SRP_SQ_SIZE
=
SRP_RQ_SIZE
-
1
,
SRP_CQ_SIZE
=
SRP_SQ_SIZE
+
SRP_RQ_SIZE
,
SRP_TAG_TSK_MGMT
=
1
<<
(
SRP_RQ_SHIFT
+
1
),
...
...
@@ -69,8 +68,6 @@ enum {
SRP_FMR_DIRTY_SIZE
=
SRP_FMR_POOL_SIZE
/
4
};
#define SRP_OP_RECV (1 << 31)
enum
srp_target_state
{
SRP_TARGET_LIVE
,
SRP_TARGET_CONNECTING
,
...
...
@@ -133,7 +130,8 @@ struct srp_target_port {
int
path_query_id
;
struct
ib_cm_id
*
cm_id
;
struct
ib_cq
*
cq
;
struct
ib_cq
*
recv_cq
;
struct
ib_cq
*
send_cq
;
struct
ib_qp
*
qp
;
int
max_ti_iu_len
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录