Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
20a17bf6
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
20a17bf6
编写于
9月 01, 2015
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flow_dissector: Use 'const' where possible.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
de4c1f8b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
46 deletion
+49
-46
include/linux/skbuff.h
include/linux/skbuff.h
+4
-4
include/net/flow.h
include/net/flow.h
+4
-4
net/core/flow_dissector.c
net/core/flow_dissector.c
+41
-38
未找到文件。
include/linux/skbuff.h
浏览文件 @
20a17bf6
...
...
@@ -1029,9 +1029,9 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
return
skb
->
hash
;
}
__u32
__skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
struct
flowi6
*
fl6
);
__u32
__skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
const
struct
flowi6
*
fl6
);
static
inline
__u32
skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
struct
flowi6
*
fl6
)
static
inline
__u32
skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
const
struct
flowi6
*
fl6
)
{
if
(
!
skb
->
l4_hash
&&
!
skb
->
sw_hash
)
{
struct
flow_keys
keys
;
...
...
@@ -1043,9 +1043,9 @@ static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6)
return
skb
->
hash
;
}
__u32
__skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
struct
flowi4
*
fl
);
__u32
__skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
const
struct
flowi4
*
fl
);
static
inline
__u32
skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
struct
flowi4
*
fl4
)
static
inline
__u32
skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
const
struct
flowi4
*
fl4
)
{
if
(
!
skb
->
l4_hash
&&
!
skb
->
sw_hash
)
{
struct
flow_keys
keys
;
...
...
include/net/flow.h
浏览文件 @
20a17bf6
...
...
@@ -244,18 +244,18 @@ void flow_cache_flush(struct net *net);
void
flow_cache_flush_deferred
(
struct
net
*
net
);
extern
atomic_t
flow_cache_genid
;
__u32
__get_hash_from_flowi6
(
struct
flowi6
*
fl6
,
struct
flow_keys
*
keys
);
__u32
__get_hash_from_flowi6
(
const
struct
flowi6
*
fl6
,
struct
flow_keys
*
keys
);
static
inline
__u32
get_hash_from_flowi6
(
struct
flowi6
*
fl6
)
static
inline
__u32
get_hash_from_flowi6
(
const
struct
flowi6
*
fl6
)
{
struct
flow_keys
keys
;
return
__get_hash_from_flowi6
(
fl6
,
&
keys
);
}
__u32
__get_hash_from_flowi4
(
struct
flowi4
*
fl4
,
struct
flow_keys
*
keys
);
__u32
__get_hash_from_flowi4
(
const
struct
flowi4
*
fl4
,
struct
flow_keys
*
keys
);
static
inline
__u32
get_hash_from_flowi4
(
struct
flowi4
*
fl4
)
static
inline
__u32
get_hash_from_flowi4
(
const
struct
flowi4
*
fl4
)
{
struct
flow_keys
keys
;
...
...
net/core/flow_dissector.c
浏览文件 @
20a17bf6
...
...
@@ -19,14 +19,14 @@
#include <net/flow_dissector.h>
#include <scsi/fc/fc_fcoe.h>
static
bool
skb_flow_dissector_uses_key
(
struct
flow_dissector
*
flow_dissector
,
enum
flow_dissector_key_id
key_id
)
static
bool
dissector_uses_key
(
const
struct
flow_dissector
*
flow_dissector
,
enum
flow_dissector_key_id
key_id
)
{
return
flow_dissector
->
used_keys
&
(
1
<<
key_id
);
}
static
void
skb_flow_
dissector_set_key
(
struct
flow_dissector
*
flow_dissector
,
enum
flow_dissector_key_id
key_id
)
static
void
dissector_set_key
(
struct
flow_dissector
*
flow_dissector
,
enum
flow_dissector_key_id
key_id
)
{
flow_dissector
->
used_keys
|=
(
1
<<
key_id
);
}
...
...
@@ -51,20 +51,20 @@ void skb_flow_dissector_init(struct flow_dissector *flow_dissector,
* boundaries of unsigned short.
*/
BUG_ON
(
key
->
offset
>
USHRT_MAX
);
BUG_ON
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
key
->
key_id
));
BUG_ON
(
dissector_uses_key
(
flow_dissector
,
key
->
key_id
));
skb_flow_
dissector_set_key
(
flow_dissector
,
key
->
key_id
);
dissector_set_key
(
flow_dissector
,
key
->
key_id
);
flow_dissector
->
offset
[
key
->
key_id
]
=
key
->
offset
;
}
/* Ensure that the dissector always includes control and basic key.
* That way we are able to avoid handling lack of these in fast path.
*/
BUG_ON
(
!
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_CONTROL
));
BUG_ON
(
!
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_BASIC
));
BUG_ON
(
!
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_CONTROL
));
BUG_ON
(
!
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_BASIC
));
}
EXPORT_SYMBOL
(
skb_flow_dissector_init
);
...
...
@@ -154,8 +154,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
FLOW_DISSECTOR_KEY_BASIC
,
target_container
);
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_ETH_ADDRS
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_ETH_ADDRS
))
{
struct
ethhdr
*
eth
=
eth_hdr
(
skb
);
struct
flow_dissector_key_eth_addrs
*
key_eth_addrs
;
...
...
@@ -178,8 +178,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
ip_proto
=
iph
->
protocol
;
if
(
!
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_IPV4_ADDRS
))
if
(
!
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_IPV4_ADDRS
))
break
;
key_addrs
=
skb_flow_dissector_target
(
flow_dissector
,
...
...
@@ -218,8 +218,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
ip_proto
=
iph
->
nexthdr
;
nhoff
+=
sizeof
(
struct
ipv6hdr
);
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_IPV6_ADDRS
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_IPV6_ADDRS
))
{
struct
flow_dissector_key_ipv6_addrs
*
key_ipv6_addrs
;
key_ipv6_addrs
=
skb_flow_dissector_target
(
flow_dissector
,
...
...
@@ -232,8 +232,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
flow_label
=
ip6_flowlabel
(
iph
);
if
(
flow_label
)
{
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_FLOW_LABEL
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_FLOW_LABEL
))
{
key_tags
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_FLOW_LABEL
,
target_container
);
...
...
@@ -257,8 +257,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if
(
!
vlan
)
goto
out_bad
;
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_VLANID
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_VLANID
))
{
key_tags
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_VLANID
,
target_container
);
...
...
@@ -298,8 +298,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if
(
!
hdr
)
goto
out_bad
;
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_TIPC_ADDRS
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_TIPC_ADDRS
))
{
key_addrs
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_TIPC_ADDRS
,
target_container
);
...
...
@@ -320,8 +320,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if
((
ntohl
(
hdr
[
0
].
entry
)
&
MPLS_LS_LABEL_MASK
)
>>
MPLS_LS_LABEL_SHIFT
==
MPLS_LABEL_ENTROPY
)
{
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_MPLS_ENTROPY
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_MPLS_ENTROPY
))
{
key_keyid
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_MPLS_ENTROPY
,
target_container
);
...
...
@@ -374,8 +374,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if
(
!
keyid
)
goto
out_bad
;
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_GRE_KEYID
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_GRE_KEYID
))
{
key_keyid
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_GRE_KEYID
,
target_container
);
...
...
@@ -470,8 +470,8 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
break
;
}
if
(
skb_flow_
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_PORTS
))
{
if
(
dissector_uses_key
(
flow_dissector
,
FLOW_DISSECTOR_KEY_PORTS
))
{
key_ports
=
skb_flow_dissector_target
(
flow_dissector
,
FLOW_DISSECTOR_KEY_PORTS
,
target_container
);
...
...
@@ -497,18 +497,21 @@ static __always_inline void __flow_hash_secret_init(void)
net_get_random_once
(
&
hashrnd
,
sizeof
(
hashrnd
));
}
static
__always_inline
u32
__flow_hash_words
(
u32
*
words
,
u32
length
,
u32
keyval
)
static
__always_inline
u32
__flow_hash_words
(
const
u32
*
words
,
u32
length
,
u32
keyval
)
{
return
jhash2
(
words
,
length
,
keyval
);
}
static
inline
void
*
flow_keys_hash_start
(
struct
flow_keys
*
flow
)
static
inline
const
u32
*
flow_keys_hash_start
(
const
struct
flow_keys
*
flow
)
{
const
void
*
p
=
flow
;
BUILD_BUG_ON
(
FLOW_KEYS_HASH_OFFSET
%
sizeof
(
u32
));
return
(
void
*
)
flow
+
FLOW_KEYS_HASH_OFFSET
;
return
(
const
u32
*
)(
p
+
FLOW_KEYS_HASH_OFFSET
)
;
}
static
inline
size_t
flow_keys_hash_length
(
struct
flow_keys
*
flow
)
static
inline
size_t
flow_keys_hash_length
(
const
struct
flow_keys
*
flow
)
{
size_t
diff
=
FLOW_KEYS_HASH_OFFSET
+
sizeof
(
flow
->
addrs
);
BUILD_BUG_ON
((
sizeof
(
*
flow
)
-
FLOW_KEYS_HASH_OFFSET
)
%
sizeof
(
u32
));
...
...
@@ -598,7 +601,7 @@ static inline u32 __flow_hash_from_keys(struct flow_keys *keys, u32 keyval)
__flow_hash_consistentify
(
keys
);
hash
=
__flow_hash_words
(
(
u32
*
)
flow_keys_hash_start
(
keys
),
hash
=
__flow_hash_words
(
flow_keys_hash_start
(
keys
),
flow_keys_hash_length
(
keys
),
keyval
);
if
(
!
hash
)
hash
=
1
;
...
...
@@ -677,7 +680,7 @@ __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb)
}
EXPORT_SYMBOL
(
skb_get_hash_perturb
);
__u32
__skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
struct
flowi6
*
fl6
)
__u32
__skb_get_hash_flowi6
(
struct
sk_buff
*
skb
,
const
struct
flowi6
*
fl6
)
{
struct
flow_keys
keys
;
...
...
@@ -701,7 +704,7 @@ __u32 __skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6)
}
EXPORT_SYMBOL
(
__skb_get_hash_flowi6
);
__u32
__skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
struct
flowi4
*
fl4
)
__u32
__skb_get_hash_flowi4
(
struct
sk_buff
*
skb
,
const
struct
flowi4
*
fl4
)
{
struct
flow_keys
keys
;
...
...
@@ -787,7 +790,7 @@ u32 skb_get_poff(const struct sk_buff *skb)
return
__skb_get_poff
(
skb
,
skb
->
data
,
&
keys
,
skb_headlen
(
skb
));
}
__u32
__get_hash_from_flowi6
(
struct
flowi6
*
fl6
,
struct
flow_keys
*
keys
)
__u32
__get_hash_from_flowi6
(
const
struct
flowi6
*
fl6
,
struct
flow_keys
*
keys
)
{
memset
(
keys
,
0
,
sizeof
(
*
keys
));
...
...
@@ -806,7 +809,7 @@ __u32 __get_hash_from_flowi6(struct flowi6 *fl6, struct flow_keys *keys)
}
EXPORT_SYMBOL
(
__get_hash_from_flowi6
);
__u32
__get_hash_from_flowi4
(
struct
flowi4
*
fl4
,
struct
flow_keys
*
keys
)
__u32
__get_hash_from_flowi4
(
const
struct
flowi4
*
fl4
,
struct
flow_keys
*
keys
)
{
memset
(
keys
,
0
,
sizeof
(
*
keys
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录