Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
195e952d
Commit
195e952d
authored
Nov 06, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kill zerocopy_sg_from_iovec()
no users left Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
f5ff53b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
65 deletions
+2
-65
include/linux/skbuff.h
include/linux/skbuff.h
+0
-2
net/core/datagram.c
net/core/datagram.c
+2
-63
No files found.
include/linux/skbuff.h
View file @
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
View file @
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment