Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
195e952d
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看板
提交
195e952d
编写于
11月 06, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kill zerocopy_sg_from_iovec()
no users left Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
f5ff53b4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
65 deletion
+2
-65
include/linux/skbuff.h
include/linux/skbuff.h
+0
-2
net/core/datagram.c
net/core/datagram.c
+2
-63
未找到文件。
include/linux/skbuff.h
浏览文件 @
195e952d
...
...
@@ -2661,8 +2661,6 @@ int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset,
int
len
);
int
skb_copy_datagram_from_iter
(
struct
sk_buff
*
skb
,
int
offset
,
struct
iov_iter
*
from
,
int
len
);
int
zerocopy_sg_from_iovec
(
struct
sk_buff
*
skb
,
const
struct
iovec
*
frm
,
int
offset
,
size_t
count
);
int
skb_copy_datagram_iter
(
const
struct
sk_buff
*
from
,
int
offset
,
struct
iov_iter
*
to
,
int
size
);
int
zerocopy_sg_from_iter
(
struct
sk_buff
*
skb
,
struct
iov_iter
*
frm
);
...
...
net/core/datagram.c
浏览文件 @
195e952d
...
...
@@ -645,76 +645,15 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
EXPORT_SYMBOL
(
skb_copy_datagram_from_iter
);
/**
* zerocopy_sg_from_i
ovec - Build a zerocopy datagram from an iovec
* zerocopy_sg_from_i
ter - Build a zerocopy datagram from an iov_iter
* @skb: buffer to copy
* @from: io vector to copy from
* @offset: offset in the io vector to start copying from
* @count: amount of vectors to copy to buffer from
* @from: the source to copy from
*
* The function will first copy up to headlen, and then pin the userspace
* pages and build frags through them.
*
* Returns 0, -EFAULT or -EMSGSIZE.
* Note: the iovec is not modified during the copy
*/
int
zerocopy_sg_from_iovec
(
struct
sk_buff
*
skb
,
const
struct
iovec
*
from
,
int
offset
,
size_t
count
)
{
int
len
=
iov_length
(
from
,
count
)
-
offset
;
int
copy
=
min_t
(
int
,
skb_headlen
(
skb
),
len
);
int
size
;
int
i
=
0
;
/* copy up to skb headlen */
if
(
skb_copy_datagram_from_iovec
(
skb
,
0
,
from
,
offset
,
copy
))
return
-
EFAULT
;
if
(
len
==
copy
)
return
0
;
offset
+=
copy
;
while
(
count
--
)
{
struct
page
*
page
[
MAX_SKB_FRAGS
];
int
num_pages
;
unsigned
long
base
;
unsigned
long
truesize
;
/* Skip over from offset and copied */
if
(
offset
>=
from
->
iov_len
)
{
offset
-=
from
->
iov_len
;
++
from
;
continue
;
}
len
=
from
->
iov_len
-
offset
;
base
=
(
unsigned
long
)
from
->
iov_base
+
offset
;
size
=
((
base
&
~
PAGE_MASK
)
+
len
+
~
PAGE_MASK
)
>>
PAGE_SHIFT
;
if
(
i
+
size
>
MAX_SKB_FRAGS
)
return
-
EMSGSIZE
;
num_pages
=
get_user_pages_fast
(
base
,
size
,
0
,
&
page
[
i
]);
if
(
num_pages
!=
size
)
{
release_pages
(
&
page
[
i
],
num_pages
,
0
);
return
-
EFAULT
;
}
truesize
=
size
*
PAGE_SIZE
;
skb
->
data_len
+=
len
;
skb
->
len
+=
len
;
skb
->
truesize
+=
truesize
;
atomic_add
(
truesize
,
&
skb
->
sk
->
sk_wmem_alloc
);
while
(
len
)
{
int
off
=
base
&
~
PAGE_MASK
;
int
size
=
min_t
(
int
,
len
,
PAGE_SIZE
-
off
);
skb_fill_page_desc
(
skb
,
i
,
page
[
i
],
off
,
size
);
base
+=
size
;
len
-=
size
;
i
++
;
}
offset
=
0
;
++
from
;
}
return
0
;
}
EXPORT_SYMBOL
(
zerocopy_sg_from_iovec
);
int
zerocopy_sg_from_iter
(
struct
sk_buff
*
skb
,
struct
iov_iter
*
from
)
{
int
len
=
iov_iter_count
(
from
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录