Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
2116fe4e
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2116fe4e
编写于
9月 14, 2012
作者:
R
Roland Dreier
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'cxgb4', 'ipoib', 'mlx4', 'ocrdma' and 'qib' into for-next
上级
92dd6c3d
b5120a6e
dd03e734
ae3bca90
4c355005
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
77 addition
and
74 deletion
+77
-74
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+4
-4
drivers/infiniband/hw/qib/qib_mad.c
drivers/infiniband/hw/qib/qib_mad.c
+2
-1
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib.h
+4
-1
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
+44
-49
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+0
-2
drivers/net/ethernet/mellanox/mlx4/icm.c
drivers/net/ethernet/mellanox/mlx4/icm.c
+18
-12
drivers/net/ethernet/mellanox/mlx4/icm.h
drivers/net/ethernet/mellanox/mlx4/icm.h
+5
-5
未找到文件。
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
浏览文件 @
2116fe4e
...
@@ -2219,7 +2219,6 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp,
...
@@ -2219,7 +2219,6 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp,
u32
wqe_idx
;
u32
wqe_idx
;
if
(
!
qp
->
wqe_wr_id_tbl
[
tail
].
signaled
)
{
if
(
!
qp
->
wqe_wr_id_tbl
[
tail
].
signaled
)
{
expand
=
true
;
/* CQE cannot be consumed yet */
*
polled
=
false
;
/* WC cannot be consumed yet */
*
polled
=
false
;
/* WC cannot be consumed yet */
}
else
{
}
else
{
ibwc
->
status
=
IB_WC_SUCCESS
;
ibwc
->
status
=
IB_WC_SUCCESS
;
...
@@ -2227,10 +2226,11 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp,
...
@@ -2227,10 +2226,11 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp,
ibwc
->
qp
=
&
qp
->
ibqp
;
ibwc
->
qp
=
&
qp
->
ibqp
;
ocrdma_update_wc
(
qp
,
ibwc
,
tail
);
ocrdma_update_wc
(
qp
,
ibwc
,
tail
);
*
polled
=
true
;
*
polled
=
true
;
wqe_idx
=
le32_to_cpu
(
cqe
->
wq
.
wqeidx
)
&
OCRDMA_CQE_WQEIDX_MASK
;
if
(
tail
!=
wqe_idx
)
expand
=
true
;
/* Coalesced CQE can't be consumed yet */
}
}
wqe_idx
=
le32_to_cpu
(
cqe
->
wq
.
wqeidx
)
&
OCRDMA_CQE_WQEIDX_MASK
;
if
(
tail
!=
wqe_idx
)
expand
=
true
;
/* Coalesced CQE can't be consumed yet */
ocrdma_hwq_inc_tail
(
&
qp
->
sq
);
ocrdma_hwq_inc_tail
(
&
qp
->
sq
);
return
expand
;
return
expand
;
}
}
...
...
drivers/infiniband/hw/qib/qib_mad.c
浏览文件 @
2116fe4e
...
@@ -471,9 +471,10 @@ static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
...
@@ -471,9 +471,10 @@ static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
if
(
port_num
!=
port
)
{
if
(
port_num
!=
port
)
{
ibp
=
to_iport
(
ibdev
,
port_num
);
ibp
=
to_iport
(
ibdev
,
port_num
);
ret
=
check_mkey
(
ibp
,
smp
,
0
);
ret
=
check_mkey
(
ibp
,
smp
,
0
);
if
(
ret
)
if
(
ret
)
{
ret
=
IB_MAD_RESULT_FAILURE
;
ret
=
IB_MAD_RESULT_FAILURE
;
goto
bail
;
goto
bail
;
}
}
}
}
}
...
...
drivers/infiniband/ulp/ipoib/ipoib.h
浏览文件 @
2116fe4e
...
@@ -262,7 +262,10 @@ struct ipoib_ethtool_st {
...
@@ -262,7 +262,10 @@ struct ipoib_ethtool_st {
u16
max_coalesced_frames
;
u16
max_coalesced_frames
;
};
};
struct
ipoib_neigh_table
;
struct
ipoib_neigh_hash
{
struct
ipoib_neigh_hash
{
struct
ipoib_neigh_table
*
ntbl
;
struct
ipoib_neigh
__rcu
**
buckets
;
struct
ipoib_neigh
__rcu
**
buckets
;
struct
rcu_head
rcu
;
struct
rcu_head
rcu
;
u32
mask
;
u32
mask
;
...
@@ -271,9 +274,9 @@ struct ipoib_neigh_hash {
...
@@ -271,9 +274,9 @@ struct ipoib_neigh_hash {
struct
ipoib_neigh_table
{
struct
ipoib_neigh_table
{
struct
ipoib_neigh_hash
__rcu
*
htbl
;
struct
ipoib_neigh_hash
__rcu
*
htbl
;
rwlock_t
rwlock
;
atomic_t
entries
;
atomic_t
entries
;
struct
completion
flushed
;
struct
completion
flushed
;
struct
completion
deleted
;
};
};
/*
/*
...
...
drivers/infiniband/ulp/ipoib/ipoib_main.c
浏览文件 @
2116fe4e
...
@@ -546,15 +546,15 @@ static void neigh_add_path(struct sk_buff *skb, u8 *daddr,
...
@@ -546,15 +546,15 @@ static void neigh_add_path(struct sk_buff *skb, u8 *daddr,
struct
ipoib_neigh
*
neigh
;
struct
ipoib_neigh
*
neigh
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
neigh
=
ipoib_neigh_alloc
(
daddr
,
dev
);
neigh
=
ipoib_neigh_alloc
(
daddr
,
dev
);
if
(
!
neigh
)
{
if
(
!
neigh
)
{
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
++
dev
->
stats
.
tx_dropped
;
++
dev
->
stats
.
tx_dropped
;
dev_kfree_skb_any
(
skb
);
dev_kfree_skb_any
(
skb
);
return
;
return
;
}
}
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
path
=
__path_find
(
dev
,
daddr
+
4
);
path
=
__path_find
(
dev
,
daddr
+
4
);
if
(
!
path
)
{
if
(
!
path
)
{
path
=
path_rec_create
(
dev
,
daddr
+
4
);
path
=
path_rec_create
(
dev
,
daddr
+
4
);
...
@@ -863,10 +863,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
...
@@ -863,10 +863,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
if
(
test_bit
(
IPOIB_STOP_NEIGH_GC
,
&
priv
->
flags
))
if
(
test_bit
(
IPOIB_STOP_NEIGH_GC
,
&
priv
->
flags
))
return
;
return
;
write_lock_bh
(
&
ntbl
->
rwlock
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
if
(
!
htbl
)
if
(
!
htbl
)
goto
out_unlock
;
goto
out_unlock
;
...
@@ -883,16 +883,14 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
...
@@ -883,16 +883,14 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)))
!=
NULL
)
{
lockdep_is_held
(
&
priv
->
lock
)))
!=
NULL
)
{
/* was the neigh idle for two GC periods */
/* was the neigh idle for two GC periods */
if
(
time_after
(
neigh_obsolete
,
neigh
->
alive
))
{
if
(
time_after
(
neigh_obsolete
,
neigh
->
alive
))
{
rcu_assign_pointer
(
*
np
,
rcu_assign_pointer
(
*
np
,
rcu_dereference_protected
(
neigh
->
hnext
,
rcu_dereference_protected
(
neigh
->
hnext
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)));
lockdep_is_held
(
&
priv
->
lock
)));
/* remove from path/mc list */
/* remove from path/mc list */
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
list_del
(
&
neigh
->
list
);
list_del
(
&
neigh
->
list
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
}
else
{
}
else
{
np
=
&
neigh
->
hnext
;
np
=
&
neigh
->
hnext
;
...
@@ -902,7 +900,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
...
@@ -902,7 +900,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
}
}
out_unlock:
out_unlock:
write_unlock_bh
(
&
ntbl
->
rwlock
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
}
}
static
void
ipoib_reap_neigh
(
struct
work_struct
*
work
)
static
void
ipoib_reap_neigh
(
struct
work_struct
*
work
)
...
@@ -947,10 +945,8 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
...
@@ -947,10 +945,8 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
struct
ipoib_neigh
*
neigh
;
struct
ipoib_neigh
*
neigh
;
u32
hash_val
;
u32
hash_val
;
write_lock_bh
(
&
ntbl
->
rwlock
);
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
if
(
!
htbl
)
{
if
(
!
htbl
)
{
neigh
=
NULL
;
neigh
=
NULL
;
goto
out_unlock
;
goto
out_unlock
;
...
@@ -961,10 +957,10 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
...
@@ -961,10 +957,10 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
*/
*/
hash_val
=
ipoib_addr_hash
(
htbl
,
daddr
);
hash_val
=
ipoib_addr_hash
(
htbl
,
daddr
);
for
(
neigh
=
rcu_dereference_protected
(
htbl
->
buckets
[
hash_val
],
for
(
neigh
=
rcu_dereference_protected
(
htbl
->
buckets
[
hash_val
],
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
neigh
!=
NULL
;
neigh
!=
NULL
;
neigh
=
rcu_dereference_protected
(
neigh
->
hnext
,
neigh
=
rcu_dereference_protected
(
neigh
->
hnext
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)))
{
lockdep_is_held
(
&
priv
->
lock
)))
{
if
(
memcmp
(
daddr
,
neigh
->
daddr
,
INFINIBAND_ALEN
)
==
0
)
{
if
(
memcmp
(
daddr
,
neigh
->
daddr
,
INFINIBAND_ALEN
)
==
0
)
{
/* found, take one ref on behalf of the caller */
/* found, take one ref on behalf of the caller */
if
(
!
atomic_inc_not_zero
(
&
neigh
->
refcnt
))
{
if
(
!
atomic_inc_not_zero
(
&
neigh
->
refcnt
))
{
...
@@ -987,12 +983,11 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
...
@@ -987,12 +983,11 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
/* put in hash */
/* put in hash */
rcu_assign_pointer
(
neigh
->
hnext
,
rcu_assign_pointer
(
neigh
->
hnext
,
rcu_dereference_protected
(
htbl
->
buckets
[
hash_val
],
rcu_dereference_protected
(
htbl
->
buckets
[
hash_val
],
lockdep_is_held
(
&
ntbl
->
rw
lock
)));
lockdep_is_held
(
&
priv
->
lock
)));
rcu_assign_pointer
(
htbl
->
buckets
[
hash_val
],
neigh
);
rcu_assign_pointer
(
htbl
->
buckets
[
hash_val
],
neigh
);
atomic_inc
(
&
ntbl
->
entries
);
atomic_inc
(
&
ntbl
->
entries
);
out_unlock:
out_unlock:
write_unlock_bh
(
&
ntbl
->
rwlock
);
return
neigh
;
return
neigh
;
}
}
...
@@ -1040,35 +1035,29 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh)
...
@@ -1040,35 +1035,29 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh)
struct
ipoib_neigh
*
n
;
struct
ipoib_neigh
*
n
;
u32
hash_val
;
u32
hash_val
;
write_lock_bh
(
&
ntbl
->
rwlock
);
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
if
(
!
htbl
)
if
(
!
htbl
)
goto
out_unlock
;
return
;
hash_val
=
ipoib_addr_hash
(
htbl
,
neigh
->
daddr
);
hash_val
=
ipoib_addr_hash
(
htbl
,
neigh
->
daddr
);
np
=
&
htbl
->
buckets
[
hash_val
];
np
=
&
htbl
->
buckets
[
hash_val
];
for
(
n
=
rcu_dereference_protected
(
*
np
,
for
(
n
=
rcu_dereference_protected
(
*
np
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
n
!=
NULL
;
n
!=
NULL
;
n
=
rcu_dereference_protected
(
*
np
,
n
=
rcu_dereference_protected
(
*
np
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)))
{
lockdep_is_held
(
&
priv
->
lock
)))
{
if
(
n
==
neigh
)
{
if
(
n
==
neigh
)
{
/* found */
/* found */
rcu_assign_pointer
(
*
np
,
rcu_assign_pointer
(
*
np
,
rcu_dereference_protected
(
neigh
->
hnext
,
rcu_dereference_protected
(
neigh
->
hnext
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)));
lockdep_is_held
(
&
priv
->
lock
)));
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
goto
out_unlock
;
return
;
}
else
{
}
else
{
np
=
&
n
->
hnext
;
np
=
&
n
->
hnext
;
}
}
}
}
out_unlock:
write_unlock_bh
(
&
ntbl
->
rwlock
);
}
}
static
int
ipoib_neigh_hash_init
(
struct
ipoib_dev_priv
*
priv
)
static
int
ipoib_neigh_hash_init
(
struct
ipoib_dev_priv
*
priv
)
...
@@ -1080,7 +1069,6 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
...
@@ -1080,7 +1069,6 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
clear_bit
(
IPOIB_NEIGH_TBL_FLUSH
,
&
priv
->
flags
);
clear_bit
(
IPOIB_NEIGH_TBL_FLUSH
,
&
priv
->
flags
);
ntbl
->
htbl
=
NULL
;
ntbl
->
htbl
=
NULL
;
rwlock_init
(
&
ntbl
->
rwlock
);
htbl
=
kzalloc
(
sizeof
(
*
htbl
),
GFP_KERNEL
);
htbl
=
kzalloc
(
sizeof
(
*
htbl
),
GFP_KERNEL
);
if
(
!
htbl
)
if
(
!
htbl
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -1095,6 +1083,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
...
@@ -1095,6 +1083,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
htbl
->
mask
=
(
size
-
1
);
htbl
->
mask
=
(
size
-
1
);
htbl
->
buckets
=
buckets
;
htbl
->
buckets
=
buckets
;
ntbl
->
htbl
=
htbl
;
ntbl
->
htbl
=
htbl
;
htbl
->
ntbl
=
ntbl
;
atomic_set
(
&
ntbl
->
entries
,
0
);
atomic_set
(
&
ntbl
->
entries
,
0
);
/* start garbage collection */
/* start garbage collection */
...
@@ -1111,9 +1100,11 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
...
@@ -1111,9 +1100,11 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
struct
ipoib_neigh_hash
,
struct
ipoib_neigh_hash
,
rcu
);
rcu
);
struct
ipoib_neigh
__rcu
**
buckets
=
htbl
->
buckets
;
struct
ipoib_neigh
__rcu
**
buckets
=
htbl
->
buckets
;
struct
ipoib_neigh_table
*
ntbl
=
htbl
->
ntbl
;
kfree
(
buckets
);
kfree
(
buckets
);
kfree
(
htbl
);
kfree
(
htbl
);
complete
(
&
ntbl
->
deleted
);
}
}
void
ipoib_del_neighs_by_gid
(
struct
net_device
*
dev
,
u8
*
gid
)
void
ipoib_del_neighs_by_gid
(
struct
net_device
*
dev
,
u8
*
gid
)
...
@@ -1125,10 +1116,10 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
...
@@ -1125,10 +1116,10 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
int
i
;
int
i
;
/* remove all neigh connected to a given path or mcast */
/* remove all neigh connected to a given path or mcast */
write_lock_bh
(
&
ntbl
->
rwlock
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
if
(
!
htbl
)
if
(
!
htbl
)
goto
out_unlock
;
goto
out_unlock
;
...
@@ -1138,16 +1129,14 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
...
@@ -1138,16 +1129,14 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)))
!=
NULL
)
{
lockdep_is_held
(
&
priv
->
lock
)))
!=
NULL
)
{
/* delete neighs belong to this parent */
/* delete neighs belong to this parent */
if
(
!
memcmp
(
gid
,
neigh
->
daddr
+
4
,
sizeof
(
union
ib_gid
)))
{
if
(
!
memcmp
(
gid
,
neigh
->
daddr
+
4
,
sizeof
(
union
ib_gid
)))
{
rcu_assign_pointer
(
*
np
,
rcu_assign_pointer
(
*
np
,
rcu_dereference_protected
(
neigh
->
hnext
,
rcu_dereference_protected
(
neigh
->
hnext
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)));
lockdep_is_held
(
&
priv
->
lock
)));
/* remove from parent list */
/* remove from parent list */
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
list_del
(
&
neigh
->
list
);
list_del
(
&
neigh
->
list
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
}
else
{
}
else
{
np
=
&
neigh
->
hnext
;
np
=
&
neigh
->
hnext
;
...
@@ -1156,7 +1145,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
...
@@ -1156,7 +1145,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
}
}
}
}
out_unlock:
out_unlock:
write_unlock_bh
(
&
ntbl
->
rwlock
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
}
}
static
void
ipoib_flush_neighs
(
struct
ipoib_dev_priv
*
priv
)
static
void
ipoib_flush_neighs
(
struct
ipoib_dev_priv
*
priv
)
...
@@ -1164,37 +1153,44 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv)
...
@@ -1164,37 +1153,44 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv)
struct
ipoib_neigh_table
*
ntbl
=
&
priv
->
ntbl
;
struct
ipoib_neigh_table
*
ntbl
=
&
priv
->
ntbl
;
struct
ipoib_neigh_hash
*
htbl
;
struct
ipoib_neigh_hash
*
htbl
;
unsigned
long
flags
;
unsigned
long
flags
;
int
i
;
int
i
,
wait_flushed
=
0
;
write_lock_bh
(
&
ntbl
->
rwlock
);
init_completion
(
&
priv
->
ntbl
.
flushed
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
htbl
=
rcu_dereference_protected
(
ntbl
->
htbl
,
lockdep_is_held
(
&
ntbl
->
rw
lock
));
lockdep_is_held
(
&
priv
->
lock
));
if
(
!
htbl
)
if
(
!
htbl
)
goto
out_unlock
;
goto
out_unlock
;
wait_flushed
=
atomic_read
(
&
priv
->
ntbl
.
entries
);
if
(
!
wait_flushed
)
goto
free_htbl
;
for
(
i
=
0
;
i
<
htbl
->
size
;
i
++
)
{
for
(
i
=
0
;
i
<
htbl
->
size
;
i
++
)
{
struct
ipoib_neigh
*
neigh
;
struct
ipoib_neigh
*
neigh
;
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
struct
ipoib_neigh
__rcu
**
np
=
&
htbl
->
buckets
[
i
];
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
while
((
neigh
=
rcu_dereference_protected
(
*
np
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)))
!=
NULL
)
{
lockdep_is_held
(
&
priv
->
lock
)))
!=
NULL
)
{
rcu_assign_pointer
(
*
np
,
rcu_assign_pointer
(
*
np
,
rcu_dereference_protected
(
neigh
->
hnext
,
rcu_dereference_protected
(
neigh
->
hnext
,
lockdep_is_held
(
&
ntbl
->
rw
lock
)));
lockdep_is_held
(
&
priv
->
lock
)));
/* remove from path/mc list */
/* remove from path/mc list */
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
list_del
(
&
neigh
->
list
);
list_del
(
&
neigh
->
list
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
call_rcu
(
&
neigh
->
rcu
,
ipoib_neigh_reclaim
);
}
}
}
}
free_htbl:
rcu_assign_pointer
(
ntbl
->
htbl
,
NULL
);
rcu_assign_pointer
(
ntbl
->
htbl
,
NULL
);
call_rcu
(
&
htbl
->
rcu
,
neigh_hash_free_rcu
);
call_rcu
(
&
htbl
->
rcu
,
neigh_hash_free_rcu
);
out_unlock:
out_unlock:
write_unlock_bh
(
&
ntbl
->
rwlock
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
if
(
wait_flushed
)
wait_for_completion
(
&
priv
->
ntbl
.
flushed
);
}
}
static
void
ipoib_neigh_hash_uninit
(
struct
net_device
*
dev
)
static
void
ipoib_neigh_hash_uninit
(
struct
net_device
*
dev
)
...
@@ -1203,7 +1199,7 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev)
...
@@ -1203,7 +1199,7 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev)
int
stopped
;
int
stopped
;
ipoib_dbg
(
priv
,
"ipoib_neigh_hash_uninit
\n
"
);
ipoib_dbg
(
priv
,
"ipoib_neigh_hash_uninit
\n
"
);
init_completion
(
&
priv
->
ntbl
.
flush
ed
);
init_completion
(
&
priv
->
ntbl
.
delet
ed
);
set_bit
(
IPOIB_NEIGH_TBL_FLUSH
,
&
priv
->
flags
);
set_bit
(
IPOIB_NEIGH_TBL_FLUSH
,
&
priv
->
flags
);
/* Stop GC if called at init fail need to cancel work */
/* Stop GC if called at init fail need to cancel work */
...
@@ -1211,10 +1207,9 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev)
...
@@ -1211,10 +1207,9 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev)
if
(
!
stopped
)
if
(
!
stopped
)
cancel_delayed_work
(
&
priv
->
neigh_reap_task
);
cancel_delayed_work
(
&
priv
->
neigh_reap_task
);
if
(
atomic_read
(
&
priv
->
ntbl
.
entries
))
{
ipoib_flush_neighs
(
priv
);
ipoib_flush_neighs
(
priv
);
wait_for_completion
(
&
priv
->
ntbl
.
flushed
);
wait_for_completion
(
&
priv
->
ntbl
.
deleted
);
}
}
}
...
...
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
浏览文件 @
2116fe4e
...
@@ -707,9 +707,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb)
...
@@ -707,9 +707,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb)
neigh
=
ipoib_neigh_get
(
dev
,
daddr
);
neigh
=
ipoib_neigh_get
(
dev
,
daddr
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
if
(
!
neigh
)
{
if
(
!
neigh
)
{
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
neigh
=
ipoib_neigh_alloc
(
daddr
,
dev
);
neigh
=
ipoib_neigh_alloc
(
daddr
,
dev
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
if
(
neigh
)
{
if
(
neigh
)
{
kref_get
(
&
mcast
->
ah
->
ref
);
kref_get
(
&
mcast
->
ah
->
ref
);
neigh
->
ah
=
mcast
->
ah
;
neigh
->
ah
=
mcast
->
ah
;
...
...
drivers/net/ethernet/mellanox/mlx4/icm.c
浏览文件 @
2116fe4e
...
@@ -227,9 +227,10 @@ int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev)
...
@@ -227,9 +227,10 @@ int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev)
MLX4_CMD_TIME_CLASS_B
,
MLX4_CMD_NATIVE
);
MLX4_CMD_TIME_CLASS_B
,
MLX4_CMD_NATIVE
);
}
}
int
mlx4_table_get
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
obj
)
int
mlx4_table_get
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
u32
obj
)
{
{
int
i
=
(
obj
&
(
table
->
num_obj
-
1
))
/
(
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
);
u32
i
=
(
obj
&
(
table
->
num_obj
-
1
))
/
(
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
);
int
ret
=
0
;
int
ret
=
0
;
mutex_lock
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
...
@@ -262,16 +263,18 @@ int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj)
...
@@ -262,16 +263,18 @@ int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj)
return
ret
;
return
ret
;
}
}
void
mlx4_table_put
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
obj
)
void
mlx4_table_put
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
u32
obj
)
{
{
int
i
;
u32
i
;
u64
offset
;
i
=
(
obj
&
(
table
->
num_obj
-
1
))
/
(
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
);
i
=
(
obj
&
(
table
->
num_obj
-
1
))
/
(
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
);
mutex_lock
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
if
(
--
table
->
icm
[
i
]
->
refcount
==
0
)
{
if
(
--
table
->
icm
[
i
]
->
refcount
==
0
)
{
mlx4_UNMAP_ICM
(
dev
,
table
->
virt
+
i
*
MLX4_TABLE_CHUNK_SIZE
,
offset
=
(
u64
)
i
*
MLX4_TABLE_CHUNK_SIZE
;
mlx4_UNMAP_ICM
(
dev
,
table
->
virt
+
offset
,
MLX4_TABLE_CHUNK_SIZE
/
MLX4_ICM_PAGE_SIZE
);
MLX4_TABLE_CHUNK_SIZE
/
MLX4_ICM_PAGE_SIZE
);
mlx4_free_icm
(
dev
,
table
->
icm
[
i
],
table
->
coherent
);
mlx4_free_icm
(
dev
,
table
->
icm
[
i
],
table
->
coherent
);
table
->
icm
[
i
]
=
NULL
;
table
->
icm
[
i
]
=
NULL
;
...
@@ -280,9 +283,11 @@ void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj)
...
@@ -280,9 +283,11 @@ void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj)
mutex_unlock
(
&
table
->
mutex
);
mutex_unlock
(
&
table
->
mutex
);
}
}
void
*
mlx4_table_find
(
struct
mlx4_icm_table
*
table
,
int
obj
,
dma_addr_t
*
dma_handle
)
void
*
mlx4_table_find
(
struct
mlx4_icm_table
*
table
,
u32
obj
,
dma_addr_t
*
dma_handle
)
{
{
int
idx
,
offset
,
dma_offset
,
i
;
int
offset
,
dma_offset
,
i
;
u64
idx
;
struct
mlx4_icm_chunk
*
chunk
;
struct
mlx4_icm_chunk
*
chunk
;
struct
mlx4_icm
*
icm
;
struct
mlx4_icm
*
icm
;
struct
page
*
page
=
NULL
;
struct
page
*
page
=
NULL
;
...
@@ -292,7 +297,7 @@ void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_han
...
@@ -292,7 +297,7 @@ void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_han
mutex_lock
(
&
table
->
mutex
);
mutex_lock
(
&
table
->
mutex
);
idx
=
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
;
idx
=
(
u64
)
(
obj
&
(
table
->
num_obj
-
1
))
*
table
->
obj_size
;
icm
=
table
->
icm
[
idx
/
MLX4_TABLE_CHUNK_SIZE
];
icm
=
table
->
icm
[
idx
/
MLX4_TABLE_CHUNK_SIZE
];
dma_offset
=
offset
=
idx
%
MLX4_TABLE_CHUNK_SIZE
;
dma_offset
=
offset
=
idx
%
MLX4_TABLE_CHUNK_SIZE
;
...
@@ -326,10 +331,11 @@ void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_han
...
@@ -326,10 +331,11 @@ void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_han
}
}
int
mlx4_table_get_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
mlx4_table_get_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
start
,
int
end
)
u32
start
,
u32
end
)
{
{
int
inc
=
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
;
int
inc
=
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
;
int
i
,
err
;
int
err
;
u32
i
;
for
(
i
=
start
;
i
<=
end
;
i
+=
inc
)
{
for
(
i
=
start
;
i
<=
end
;
i
+=
inc
)
{
err
=
mlx4_table_get
(
dev
,
table
,
i
);
err
=
mlx4_table_get
(
dev
,
table
,
i
);
...
@@ -349,9 +355,9 @@ int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table,
...
@@ -349,9 +355,9 @@ int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table,
}
}
void
mlx4_table_put_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
void
mlx4_table_put_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
start
,
int
end
)
u32
start
,
u32
end
)
{
{
int
i
;
u32
i
;
for
(
i
=
start
;
i
<=
end
;
i
+=
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
)
for
(
i
=
start
;
i
<=
end
;
i
+=
MLX4_TABLE_CHUNK_SIZE
/
table
->
obj_size
)
mlx4_table_put
(
dev
,
table
,
i
);
mlx4_table_put
(
dev
,
table
,
i
);
...
...
drivers/net/ethernet/mellanox/mlx4/icm.h
浏览文件 @
2116fe4e
...
@@ -71,17 +71,17 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
...
@@ -71,17 +71,17 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
gfp_t
gfp_mask
,
int
coherent
);
gfp_t
gfp_mask
,
int
coherent
);
void
mlx4_free_icm
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm
*
icm
,
int
coherent
);
void
mlx4_free_icm
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm
*
icm
,
int
coherent
);
int
mlx4_table_get
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
obj
);
int
mlx4_table_get
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
u32
obj
);
void
mlx4_table_put
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
obj
);
void
mlx4_table_put
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
u32
obj
);
int
mlx4_table_get_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
mlx4_table_get_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
start
,
int
end
);
u32
start
,
u32
end
);
void
mlx4_table_put_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
void
mlx4_table_put_range
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
start
,
int
end
);
u32
start
,
u32
end
);
int
mlx4_init_icm_table
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
int
mlx4_init_icm_table
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
,
u64
virt
,
int
obj_size
,
u32
nobj
,
int
reserved
,
u64
virt
,
int
obj_size
,
u32
nobj
,
int
reserved
,
int
use_lowmem
,
int
use_coherent
);
int
use_lowmem
,
int
use_coherent
);
void
mlx4_cleanup_icm_table
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
);
void
mlx4_cleanup_icm_table
(
struct
mlx4_dev
*
dev
,
struct
mlx4_icm_table
*
table
);
void
*
mlx4_table_find
(
struct
mlx4_icm_table
*
table
,
int
obj
,
dma_addr_t
*
dma_handle
);
void
*
mlx4_table_find
(
struct
mlx4_icm_table
*
table
,
u32
obj
,
dma_addr_t
*
dma_handle
);
static
inline
void
mlx4_icm_first
(
struct
mlx4_icm
*
icm
,
static
inline
void
mlx4_icm_first
(
struct
mlx4_icm
*
icm
,
struct
mlx4_icm_iter
*
iter
)
struct
mlx4_icm_iter
*
iter
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录