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
nexedi
linux
Commits
7976f8f6
Commit
7976f8f6
authored
Jun 18, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Mark skb_linearize() as deprecated.
parent
80b3ea5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
64 deletions
+71
-64
include/linux/skbuff.h
include/linux/skbuff.h
+6
-1
net/core/dev.c
net/core/dev.c
+63
-3
net/core/skbuff.c
net/core/skbuff.c
+1
-59
net/netsyms.c
net/netsyms.c
+1
-1
No files found.
include/linux/skbuff.h
View file @
7976f8f6
...
...
@@ -16,6 +16,7 @@
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/time.h>
#include <linux/cache.h>
...
...
@@ -1127,7 +1128,11 @@ static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
* If there is no free memory -ENOMEM is returned, otherwise zero
* is returned and the old skb data released.
*/
int
skb_linearize
(
struct
sk_buff
*
skb
,
int
gfp
);
extern
int
__skb_linearize
(
struct
sk_buff
*
skb
,
int
gfp
);
static
inline
int
__deprecated
skb_linearize
(
struct
sk_buff
*
skb
,
int
gfp
)
{
return
__skb_linearize
(
skb
,
gfp
);
}
static
inline
void
*
kmap_skb_frag
(
const
skb_frag_t
*
frag
)
{
...
...
net/core/dev.c
View file @
7976f8f6
...
...
@@ -1018,6 +1018,66 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
#define illegal_highdma(dev, skb) (0)
#endif
extern
void
skb_release_data
(
struct
sk_buff
*
);
/* Keep head the same: replace data */
int
__skb_linearize
(
struct
sk_buff
*
skb
,
int
gfp_mask
)
{
unsigned
int
size
;
u8
*
data
;
long
offset
;
struct
skb_shared_info
*
ninfo
;
int
headerlen
=
skb
->
data
-
skb
->
head
;
int
expand
=
(
skb
->
tail
+
skb
->
data_len
)
-
skb
->
end
;
if
(
skb_shared
(
skb
))
BUG
();
if
(
expand
<=
0
)
expand
=
0
;
size
=
skb
->
end
-
skb
->
head
+
expand
;
size
=
SKB_DATA_ALIGN
(
size
);
data
=
kmalloc
(
size
+
sizeof
(
struct
skb_shared_info
),
gfp_mask
);
if
(
!
data
)
return
-
ENOMEM
;
/* Copy entire thing */
if
(
skb_copy_bits
(
skb
,
-
headerlen
,
data
,
headerlen
+
skb
->
len
))
BUG
();
/* Set up shinfo */
ninfo
=
(
struct
skb_shared_info
*
)(
data
+
size
);
atomic_set
(
&
ninfo
->
dataref
,
1
);
ninfo
->
tso_size
=
skb_shinfo
(
skb
)
->
tso_size
;
ninfo
->
tso_segs
=
skb_shinfo
(
skb
)
->
tso_segs
;
ninfo
->
nr_frags
=
0
;
ninfo
->
frag_list
=
NULL
;
/* Offset between the two in bytes */
offset
=
data
-
skb
->
head
;
/* Free old data. */
skb_release_data
(
skb
);
skb
->
head
=
data
;
skb
->
end
=
data
+
size
;
/* Set up new pointers */
skb
->
h
.
raw
+=
offset
;
skb
->
nh
.
raw
+=
offset
;
skb
->
mac
.
raw
+=
offset
;
skb
->
tail
+=
offset
;
skb
->
data
+=
offset
;
/* We are no longer a clone, even if we were. */
skb
->
cloned
=
0
;
skb
->
tail
+=
skb
->
data_len
;
skb
->
data_len
=
0
;
return
0
;
}
/**
* dev_queue_xmit - transmit a buffer
* @skb: buffer to transmit
...
...
@@ -1039,7 +1099,7 @@ int dev_queue_xmit(struct sk_buff *skb)
if
(
skb_shinfo
(
skb
)
->
frag_list
&&
!
(
dev
->
features
&
NETIF_F_FRAGLIST
)
&&
skb_linearize
(
skb
,
GFP_ATOMIC
))
__
skb_linearize
(
skb
,
GFP_ATOMIC
))
goto
out_kfree_skb
;
/* Fragmented skb is linearized if device does not support SG,
...
...
@@ -1048,7 +1108,7 @@ int dev_queue_xmit(struct sk_buff *skb)
*/
if
(
skb_shinfo
(
skb
)
->
nr_frags
&&
(
!
(
dev
->
features
&
NETIF_F_SG
)
||
illegal_highdma
(
dev
,
skb
))
&&
skb_linearize
(
skb
,
GFP_ATOMIC
))
__
skb_linearize
(
skb
,
GFP_ATOMIC
))
goto
out_kfree_skb
;
/* If packet is not checksummed and device does not support
...
...
@@ -1356,7 +1416,7 @@ static int deliver_to_old_ones(struct packet_type *pt,
if
(
!
skb
)
goto
out
;
}
if
(
skb_is_nonlinear
(
skb
)
&&
skb_linearize
(
skb
,
GFP_ATOMIC
))
if
(
skb_is_nonlinear
(
skb
)
&&
__
skb_linearize
(
skb
,
GFP_ATOMIC
))
goto
out_kfree
;
#ifdef CONFIG_SMP
...
...
net/core/skbuff.c
View file @
7976f8f6
...
...
@@ -181,7 +181,7 @@ static void skb_clone_fraglist(struct sk_buff *skb)
skb_get
(
list
);
}
static
void
skb_release_data
(
struct
sk_buff
*
skb
)
void
skb_release_data
(
struct
sk_buff
*
skb
)
{
if
(
!
skb
->
cloned
||
atomic_dec_and_test
(
&
(
skb_shinfo
(
skb
)
->
dataref
)))
{
...
...
@@ -412,64 +412,6 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, int gfp_mask)
return
n
;
}
/* Keep head the same: replace data */
int
skb_linearize
(
struct
sk_buff
*
skb
,
int
gfp_mask
)
{
unsigned
int
size
;
u8
*
data
;
long
offset
;
struct
skb_shared_info
*
ninfo
;
int
headerlen
=
skb
->
data
-
skb
->
head
;
int
expand
=
(
skb
->
tail
+
skb
->
data_len
)
-
skb
->
end
;
if
(
skb_shared
(
skb
))
BUG
();
if
(
expand
<=
0
)
expand
=
0
;
size
=
skb
->
end
-
skb
->
head
+
expand
;
size
=
SKB_DATA_ALIGN
(
size
);
data
=
kmalloc
(
size
+
sizeof
(
struct
skb_shared_info
),
gfp_mask
);
if
(
!
data
)
return
-
ENOMEM
;
/* Copy entire thing */
if
(
skb_copy_bits
(
skb
,
-
headerlen
,
data
,
headerlen
+
skb
->
len
))
BUG
();
/* Set up shinfo */
ninfo
=
(
struct
skb_shared_info
*
)(
data
+
size
);
atomic_set
(
&
ninfo
->
dataref
,
1
);
ninfo
->
tso_size
=
skb_shinfo
(
skb
)
->
tso_size
;
ninfo
->
tso_segs
=
skb_shinfo
(
skb
)
->
tso_segs
;
ninfo
->
nr_frags
=
0
;
ninfo
->
frag_list
=
NULL
;
/* Offset between the two in bytes */
offset
=
data
-
skb
->
head
;
/* Free old data. */
skb_release_data
(
skb
);
skb
->
head
=
data
;
skb
->
end
=
data
+
size
;
/* Set up new pointers */
skb
->
h
.
raw
+=
offset
;
skb
->
nh
.
raw
+=
offset
;
skb
->
mac
.
raw
+=
offset
;
skb
->
tail
+=
offset
;
skb
->
data
+=
offset
;
/* We are no longer a clone, even if we were. */
skb
->
cloned
=
0
;
skb
->
tail
+=
skb
->
data_len
;
skb
->
data_len
=
0
;
return
0
;
}
/**
* pskb_copy - create copy of an sk_buff with private head.
...
...
net/netsyms.c
View file @
7976f8f6
...
...
@@ -148,7 +148,7 @@ EXPORT_SYMBOL(sock_rfree);
EXPORT_SYMBOL
(
sock_wfree
);
EXPORT_SYMBOL
(
sock_wmalloc
);
EXPORT_SYMBOL
(
sock_rmalloc
);
EXPORT_SYMBOL
(
skb_linearize
);
EXPORT_SYMBOL
(
__
skb_linearize
);
EXPORT_SYMBOL
(
skb_checksum
);
EXPORT_SYMBOL
(
skb_checksum_help
);
EXPORT_SYMBOL
(
skb_recv_datagram
);
...
...
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