Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
a943cac1
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a943cac1
编写于
7月 30, 2011
作者:
M
Marek Lindner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: merge update_transtable() into tt related code
Signed-off-by:
N
Marek Lindner
<
lindner_marek@yahoo.de
>
上级
267151cd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
74 deletion
+70
-74
net/batman-adv/routing.c
net/batman-adv/routing.c
+3
-63
net/batman-adv/translation-table.c
net/batman-adv/translation-table.c
+64
-5
net/batman-adv/translation-table.h
net/batman-adv/translation-table.h
+3
-6
未找到文件。
net/batman-adv/routing.c
浏览文件 @
a943cac1
...
@@ -64,65 +64,6 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
...
@@ -64,65 +64,6 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
}
}
}
}
static
void
update_transtable
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
const
unsigned
char
*
tt_buff
,
uint8_t
tt_num_changes
,
uint8_t
ttvn
,
uint16_t
tt_crc
)
{
uint8_t
orig_ttvn
=
(
uint8_t
)
atomic_read
(
&
orig_node
->
last_ttvn
);
bool
full_table
=
true
;
/* the ttvn increased by one -> we can apply the attached changes */
if
(
ttvn
-
orig_ttvn
==
1
)
{
/* the OGM could not contain the changes due to their size or
* because they have already been sent TT_OGM_APPEND_MAX times.
* In this case send a tt request */
if
(
!
tt_num_changes
)
{
full_table
=
false
;
goto
request_table
;
}
tt_update_changes
(
bat_priv
,
orig_node
,
tt_num_changes
,
ttvn
,
(
struct
tt_change
*
)
tt_buff
);
/* Even if we received the precomputed crc with the OGM, we
* prefer to recompute it to spot any possible inconsistency
* in the global table */
orig_node
->
tt_crc
=
tt_global_crc
(
bat_priv
,
orig_node
);
/* The ttvn alone is not enough to guarantee consistency
* because a single value could represent different states
* (due to the wrap around). Thus a node has to check whether
* the resulting table (after applying the changes) is still
* consistent or not. E.g. a node could disconnect while its
* ttvn is X and reconnect on ttvn = X + TTVN_MAX: in this case
* checking the CRC value is mandatory to detect the
* inconsistency */
if
(
orig_node
->
tt_crc
!=
tt_crc
)
goto
request_table
;
/* Roaming phase is over: tables are in sync again. I can
* unset the flag */
orig_node
->
tt_poss_change
=
false
;
}
else
{
/* if we missed more than one change or our tables are not
* in sync anymore -> request fresh tt data */
if
(
ttvn
!=
orig_ttvn
||
orig_node
->
tt_crc
!=
tt_crc
)
{
request_table:
bat_dbg
(
DBG_TT
,
bat_priv
,
"TT inconsistency for %pM. "
"Need to retrieve the correct information "
"(ttvn: %u last_ttvn: %u crc: %u last_crc: "
"%u num_changes: %u)
\n
"
,
orig_node
->
orig
,
ttvn
,
orig_ttvn
,
tt_crc
,
orig_node
->
tt_crc
,
tt_num_changes
);
send_tt_request
(
bat_priv
,
orig_node
,
ttvn
,
tt_crc
,
full_table
);
return
;
}
}
}
static
void
update_route
(
struct
bat_priv
*
bat_priv
,
static
void
update_route
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
struct
orig_node
*
orig_node
,
struct
neigh_node
*
neigh_node
)
struct
neigh_node
*
neigh_node
)
...
@@ -499,10 +440,9 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
...
@@ -499,10 +440,9 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
if
(((
batman_packet
->
orig
!=
ethhdr
->
h_source
)
&&
if
(((
batman_packet
->
orig
!=
ethhdr
->
h_source
)
&&
(
batman_packet
->
ttl
>
2
))
||
(
batman_packet
->
ttl
>
2
))
||
(
batman_packet
->
flags
&
PRIMARIES_FIRST_HOP
))
(
batman_packet
->
flags
&
PRIMARIES_FIRST_HOP
))
update_transtable
(
bat_priv
,
orig_node
,
tt_buff
,
tt_update_orig
(
bat_priv
,
orig_node
,
tt_buff
,
batman_packet
->
tt_num_changes
,
batman_packet
->
tt_num_changes
,
batman_packet
->
ttvn
,
batman_packet
->
ttvn
,
batman_packet
->
tt_crc
);
batman_packet
->
tt_crc
);
if
(
orig_node
->
gw_flags
!=
batman_packet
->
gw_flags
)
if
(
orig_node
->
gw_flags
!=
batman_packet
->
gw_flags
)
gw_node_update
(
bat_priv
,
orig_node
,
batman_packet
->
gw_flags
);
gw_node_update
(
bat_priv
,
orig_node
,
batman_packet
->
gw_flags
);
...
...
net/batman-adv/translation-table.c
浏览文件 @
a943cac1
...
@@ -1079,8 +1079,9 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
...
@@ -1079,8 +1079,9 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
return
skb
;
return
skb
;
}
}
int
send_tt_request
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
dst_orig_node
,
static
int
send_tt_request
(
struct
bat_priv
*
bat_priv
,
uint8_t
ttvn
,
uint16_t
tt_crc
,
bool
full_table
)
struct
orig_node
*
dst_orig_node
,
uint8_t
ttvn
,
uint16_t
tt_crc
,
bool
full_table
)
{
{
struct
sk_buff
*
skb
=
NULL
;
struct
sk_buff
*
skb
=
NULL
;
struct
tt_query_packet
*
tt_request
;
struct
tt_query_packet
*
tt_request
;
...
@@ -1455,9 +1456,10 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
...
@@ -1455,9 +1456,10 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
orig_node_free_ref
(
orig_node
);
orig_node_free_ref
(
orig_node
);
}
}
void
tt_update_changes
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
static
void
tt_update_changes
(
struct
bat_priv
*
bat_priv
,
uint16_t
tt_num_changes
,
uint8_t
ttvn
,
struct
orig_node
*
orig_node
,
struct
tt_change
*
tt_change
)
uint16_t
tt_num_changes
,
uint8_t
ttvn
,
struct
tt_change
*
tt_change
)
{
{
_tt_update_changes
(
bat_priv
,
orig_node
,
tt_change
,
tt_num_changes
,
_tt_update_changes
(
bat_priv
,
orig_node
,
tt_change
,
tt_num_changes
,
ttvn
);
ttvn
);
...
@@ -1802,3 +1804,60 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
...
@@ -1802,3 +1804,60 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
tt_local_entry_free_ref
(
tt_local_entry
);
tt_local_entry_free_ref
(
tt_local_entry
);
return
ret
;
return
ret
;
}
}
void
tt_update_orig
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
const
unsigned
char
*
tt_buff
,
uint8_t
tt_num_changes
,
uint8_t
ttvn
,
uint16_t
tt_crc
)
{
uint8_t
orig_ttvn
=
(
uint8_t
)
atomic_read
(
&
orig_node
->
last_ttvn
);
bool
full_table
=
true
;
/* the ttvn increased by one -> we can apply the attached changes */
if
(
ttvn
-
orig_ttvn
==
1
)
{
/* the OGM could not contain the changes due to their size or
* because they have already been sent TT_OGM_APPEND_MAX times.
* In this case send a tt request */
if
(
!
tt_num_changes
)
{
full_table
=
false
;
goto
request_table
;
}
tt_update_changes
(
bat_priv
,
orig_node
,
tt_num_changes
,
ttvn
,
(
struct
tt_change
*
)
tt_buff
);
/* Even if we received the precomputed crc with the OGM, we
* prefer to recompute it to spot any possible inconsistency
* in the global table */
orig_node
->
tt_crc
=
tt_global_crc
(
bat_priv
,
orig_node
);
/* The ttvn alone is not enough to guarantee consistency
* because a single value could represent different states
* (due to the wrap around). Thus a node has to check whether
* the resulting table (after applying the changes) is still
* consistent or not. E.g. a node could disconnect while its
* ttvn is X and reconnect on ttvn = X + TTVN_MAX: in this case
* checking the CRC value is mandatory to detect the
* inconsistency */
if
(
orig_node
->
tt_crc
!=
tt_crc
)
goto
request_table
;
/* Roaming phase is over: tables are in sync again. I can
* unset the flag */
orig_node
->
tt_poss_change
=
false
;
}
else
{
/* if we missed more than one change or our tables are not
* in sync anymore -> request fresh tt data */
if
(
ttvn
!=
orig_ttvn
||
orig_node
->
tt_crc
!=
tt_crc
)
{
request_table:
bat_dbg
(
DBG_TT
,
bat_priv
,
"TT inconsistency for %pM. "
"Need to retrieve the correct information "
"(ttvn: %u last_ttvn: %u crc: %u last_crc: "
"%u num_changes: %u)
\n
"
,
orig_node
->
orig
,
ttvn
,
orig_ttvn
,
tt_crc
,
orig_node
->
tt_crc
,
tt_num_changes
);
send_tt_request
(
bat_priv
,
orig_node
,
ttvn
,
tt_crc
,
full_table
);
return
;
}
}
}
net/batman-adv/translation-table.h
浏览文件 @
a943cac1
...
@@ -49,14 +49,8 @@ void tt_save_orig_buffer(struct bat_priv *bat_priv, struct orig_node *orig_node,
...
@@ -49,14 +49,8 @@ void tt_save_orig_buffer(struct bat_priv *bat_priv, struct orig_node *orig_node,
uint16_t
tt_local_crc
(
struct
bat_priv
*
bat_priv
);
uint16_t
tt_local_crc
(
struct
bat_priv
*
bat_priv
);
uint16_t
tt_global_crc
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
);
uint16_t
tt_global_crc
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
);
void
tt_free
(
struct
bat_priv
*
bat_priv
);
void
tt_free
(
struct
bat_priv
*
bat_priv
);
int
send_tt_request
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
dst_orig_node
,
uint8_t
ttvn
,
uint16_t
tt_crc
,
bool
full_table
);
bool
send_tt_response
(
struct
bat_priv
*
bat_priv
,
bool
send_tt_response
(
struct
bat_priv
*
bat_priv
,
struct
tt_query_packet
*
tt_request
);
struct
tt_query_packet
*
tt_request
);
void
tt_update_changes
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
uint16_t
tt_num_changes
,
uint8_t
ttvn
,
struct
tt_change
*
tt_change
);
bool
is_my_client
(
struct
bat_priv
*
bat_priv
,
const
uint8_t
*
addr
);
bool
is_my_client
(
struct
bat_priv
*
bat_priv
,
const
uint8_t
*
addr
);
void
handle_tt_response
(
struct
bat_priv
*
bat_priv
,
void
handle_tt_response
(
struct
bat_priv
*
bat_priv
,
struct
tt_query_packet
*
tt_response
);
struct
tt_query_packet
*
tt_response
);
...
@@ -64,5 +58,8 @@ void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
...
@@ -64,5 +58,8 @@ void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
struct
orig_node
*
orig_node
);
struct
orig_node
*
orig_node
);
void
tt_commit_changes
(
struct
bat_priv
*
bat_priv
);
void
tt_commit_changes
(
struct
bat_priv
*
bat_priv
);
bool
is_ap_isolated
(
struct
bat_priv
*
bat_priv
,
uint8_t
*
src
,
uint8_t
*
dst
);
bool
is_ap_isolated
(
struct
bat_priv
*
bat_priv
,
uint8_t
*
src
,
uint8_t
*
dst
);
void
tt_update_orig
(
struct
bat_priv
*
bat_priv
,
struct
orig_node
*
orig_node
,
const
unsigned
char
*
tt_buff
,
uint8_t
tt_num_changes
,
uint8_t
ttvn
,
uint16_t
tt_crc
);
#endif
/* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
#endif
/* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录