Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
47c94655
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
47c94655
编写于
9月 23, 2012
作者:
A
Antonio Quartulli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: refactor code to simplify long lines
Signed-off-by:
N
Antonio Quartulli
<
ordex@autistici.org
>
上级
7c1fd91d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
32 deletion
+30
-32
net/batman-adv/translation-table.c
net/batman-adv/translation-table.c
+30
-32
未找到文件。
net/batman-adv/translation-table.c
浏览文件 @
47c94655
...
...
@@ -242,86 +242,84 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
int
ifindex
)
{
struct
batadv_priv
*
bat_priv
=
netdev_priv
(
soft_iface
);
struct
batadv_tt_local_entry
*
tt_local
_entry
=
NULL
;
struct
batadv_tt_global_entry
*
tt_global
_entry
=
NULL
;
struct
batadv_tt_local_entry
*
tt_local
=
NULL
;
struct
batadv_tt_global_entry
*
tt_global
=
NULL
;
struct
hlist_head
*
head
;
struct
hlist_node
*
node
;
struct
batadv_tt_orig_list_entry
*
orig_entry
;
int
hash_added
;
tt_local
_entry
=
batadv_tt_local_hash_find
(
bat_priv
,
addr
);
tt_local
=
batadv_tt_local_hash_find
(
bat_priv
,
addr
);
if
(
tt_local
_entry
)
{
tt_local
_entry
->
last_seen
=
jiffies
;
if
(
tt_local
)
{
tt_local
->
last_seen
=
jiffies
;
/* possibly unset the BATADV_TT_CLIENT_PENDING flag */
tt_local
_entry
->
common
.
flags
&=
~
BATADV_TT_CLIENT_PENDING
;
tt_local
->
common
.
flags
&=
~
BATADV_TT_CLIENT_PENDING
;
goto
out
;
}
tt_local
_entry
=
kmalloc
(
sizeof
(
*
tt_local_entry
),
GFP_ATOMIC
);
if
(
!
tt_local
_entry
)
tt_local
=
kmalloc
(
sizeof
(
*
tt_local
),
GFP_ATOMIC
);
if
(
!
tt_local
)
goto
out
;
batadv_dbg
(
BATADV_DBG_TT
,
bat_priv
,
"Creating new local tt entry: %pM (ttvn: %d)
\n
"
,
addr
,
(
uint8_t
)
atomic_read
(
&
bat_priv
->
tt
.
vn
));
memcpy
(
tt_local
_entry
->
common
.
addr
,
addr
,
ETH_ALEN
);
tt_local
_entry
->
common
.
flags
=
BATADV_NO_FLAGS
;
memcpy
(
tt_local
->
common
.
addr
,
addr
,
ETH_ALEN
);
tt_local
->
common
.
flags
=
BATADV_NO_FLAGS
;
if
(
batadv_is_wifi_iface
(
ifindex
))
tt_local
_entry
->
common
.
flags
|=
BATADV_TT_CLIENT_WIFI
;
atomic_set
(
&
tt_local
_entry
->
common
.
refcount
,
2
);
tt_local
_entry
->
last_seen
=
jiffies
;
tt_local
_entry
->
common
.
added_at
=
tt_local_entry
->
last_seen
;
tt_local
->
common
.
flags
|=
BATADV_TT_CLIENT_WIFI
;
atomic_set
(
&
tt_local
->
common
.
refcount
,
2
);
tt_local
->
last_seen
=
jiffies
;
tt_local
->
common
.
added_at
=
tt_local
->
last_seen
;
/* the batman interface mac address should never be purged */
if
(
batadv_compare_eth
(
addr
,
soft_iface
->
dev_addr
))
tt_local
_entry
->
common
.
flags
|=
BATADV_TT_CLIENT_NOPURGE
;
tt_local
->
common
.
flags
|=
BATADV_TT_CLIENT_NOPURGE
;
/* The local entry has to be marked as NEW to avoid to send it in
* a full table response going out before the next ttvn increment
* (consistency check)
*/
tt_local
_entry
->
common
.
flags
|=
BATADV_TT_CLIENT_NEW
;
tt_local
->
common
.
flags
|=
BATADV_TT_CLIENT_NEW
;
hash_added
=
batadv_hash_add
(
bat_priv
->
tt
.
local_hash
,
batadv_compare_tt
,
batadv_choose_orig
,
&
tt_local_entry
->
common
,
&
tt_local_entry
->
common
.
hash_entry
);
batadv_choose_orig
,
&
tt_local
->
common
,
&
tt_local
->
common
.
hash_entry
);
if
(
unlikely
(
hash_added
!=
0
))
{
/* remove the reference for the hash */
batadv_tt_local_entry_free_ref
(
tt_local
_entry
);
batadv_tt_local_entry_free_ref
(
tt_local
);
goto
out
;
}
batadv_tt_local_event
(
bat_priv
,
addr
,
tt_local
_entry
->
common
.
flags
);
batadv_tt_local_event
(
bat_priv
,
addr
,
tt_local
->
common
.
flags
);
/* remove address from global hash if present */
tt_global
_entry
=
batadv_tt_global_hash_find
(
bat_priv
,
addr
);
tt_global
=
batadv_tt_global_hash_find
(
bat_priv
,
addr
);
/* Check whether it is a roaming! */
if
(
tt_global
_entry
)
{
if
(
tt_global
)
{
/* These node are probably going to update their tt table */
head
=
&
tt_global
_entry
->
orig_list
;
head
=
&
tt_global
->
orig_list
;
rcu_read_lock
();
hlist_for_each_entry_rcu
(
orig_entry
,
node
,
head
,
list
)
{
batadv_send_roam_adv
(
bat_priv
,
tt_global_entry
->
common
.
addr
,
batadv_send_roam_adv
(
bat_priv
,
tt_global
->
common
.
addr
,
orig_entry
->
orig_node
);
}
rcu_read_unlock
();
/* The global entry has to be marked as ROAMING and
* has to be kept for consistency purpose
*/
tt_global
_entry
->
common
.
flags
|=
BATADV_TT_CLIENT_ROAM
;
tt_global
_entry
->
roam_at
=
jiffies
;
tt_global
->
common
.
flags
|=
BATADV_TT_CLIENT_ROAM
;
tt_global
->
roam_at
=
jiffies
;
}
out:
if
(
tt_local
_entry
)
batadv_tt_local_entry_free_ref
(
tt_local
_entry
);
if
(
tt_global
_entry
)
batadv_tt_global_entry_free_ref
(
tt_global
_entry
);
if
(
tt_local
)
batadv_tt_local_entry_free_ref
(
tt_local
);
if
(
tt_global
)
batadv_tt_global_entry_free_ref
(
tt_global
);
}
static
void
batadv_tt_realloc_packet_buff
(
unsigned
char
**
packet_buff
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录