* [PATCH 1/2] tun: reserves space for network in skb
[not found] <20110609003306.651532958@vyatta.com>
@ 2011-06-09 0:33 ` Stephen Hemminger
2011-06-09 7:09 ` David Miller
2011-06-09 0:33 ` [PATCH 2/2] tun: dont force inline of functions Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2011-06-09 0:33 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
[-- Attachment #1: tun-tap-pad.patch --]
[-- Type: text/plain, Size: 1127 bytes --]
The tun driver allocates skb's to hold data from user and then passes
the data into the network stack as received data. Most network devices
allocate the receive skb with routines like dev_alloc_skb() that reserves
additional space for use by network protocol stack but tun does not.
Because of the lack of padding, when the packet is passed through bridge
netfilter a new skb has to be allocated.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tun.c 2011-05-13 12:37:11.619318207 -0700
+++ b/drivers/net/tun.c 2011-05-13 16:43:25.643040523 -0700
@@ -584,7 +584,7 @@ static __inline__ ssize_t tun_get_user(s
{
struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
struct sk_buff *skb;
- size_t len = count, align = 0;
+ size_t len = count, align = NET_SKB_PAD;
struct virtio_net_hdr gso = { 0 };
int offset = 0;
@@ -614,7 +614,7 @@ static __inline__ ssize_t tun_get_user(s
}
if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
- align = NET_IP_ALIGN;
+ align += NET_IP_ALIGN;
if (unlikely(len < ETH_HLEN ||
(gso.hdr_len && gso.hdr_len < ETH_HLEN)))
return -EINVAL;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] tun: dont force inline of functions
[not found] <20110609003306.651532958@vyatta.com>
2011-06-09 0:33 ` [PATCH 1/2] tun: reserves space for network in skb Stephen Hemminger
@ 2011-06-09 0:33 ` Stephen Hemminger
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2011-06-09 0:33 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
[-- Attachment #1: tun-tap-noinline.patch --]
[-- Type: text/plain, Size: 1708 bytes --]
Current standard practice is to not mark most functions as inline
and let compiler decide instead.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/tun.c 2011-05-13 16:43:25.643040523 -0700
+++ b/drivers/net/tun.c 2011-05-13 16:47:06.041228664 -0700
@@ -550,9 +550,9 @@ static unsigned int tun_chr_poll(struct
/* prepad is the amount to reserve at front. len is length after that.
* linear is a hint as to how much to copy (usually headers). */
-static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
- size_t prepad, size_t len,
- size_t linear, int noblock)
+static struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
+ size_t prepad, size_t len,
+ size_t linear, int noblock)
{
struct sock *sk = tun->socket.sk;
struct sk_buff *skb;
@@ -578,9 +578,9 @@ static inline struct sk_buff *tun_alloc_
}
/* Get packet from user space buffer */
-static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
- const struct iovec *iv, size_t count,
- int noblock)
+static ssize_t tun_get_user(struct tun_struct *tun,
+ const struct iovec *iv, size_t count,
+ int noblock)
{
struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
struct sk_buff *skb;
@@ -729,9 +729,9 @@ static ssize_t tun_chr_aio_write(struct
}
/* Put packet to the user space buffer */
-static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
- struct sk_buff *skb,
- const struct iovec *iv, int len)
+static ssize_t tun_put_user(struct tun_struct *tun,
+ struct sk_buff *skb,
+ const struct iovec *iv, int len)
{
struct tun_pi pi = { 0, skb->protocol };
ssize_t total = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] tun: reserves space for network in skb
2011-06-09 0:33 ` [PATCH 1/2] tun: reserves space for network in skb Stephen Hemminger
@ 2011-06-09 7:09 ` David Miller
2011-06-09 14:16 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-06-09 7:09 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:33:07 -0700
> The tun driver allocates skb's to hold data from user and then passes
> the data into the network stack as received data. Most network devices
> allocate the receive skb with routines like dev_alloc_skb() that reserves
> additional space for use by network protocol stack but tun does not.
>
> Because of the lack of padding, when the packet is passed through bridge
> netfilter a new skb has to be allocated.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Netconf must be coming up soon, Stephen Hemminger is submitting patches
again :-)
Both applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] tun: reserves space for network in skb
2011-06-09 7:09 ` David Miller
@ 2011-06-09 14:16 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2011-06-09 14:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 08 Jun 2011 17:33:07 -0700
>
> > The tun driver allocates skb's to hold data from user and then
> > passes the data into the network stack as received data. Most
> > network devices
> > allocate the receive skb with routines like dev_alloc_skb() that
> > reserves additional space for use by network protocol stack but tun
> > does not.
> >
> > Because of the lack of padding, when the packet is passed through
> > bridge netfilter a new skb has to be allocated.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Netconf must be coming up soon, Stephen Hemminger is submitting
> patches again :-)
12 hours on plane + 8 hours in airports tend to get the
trivial patch backlog moving again.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-09 14:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20110609003306.651532958@vyatta.com>
2011-06-09 0:33 ` [PATCH 1/2] tun: reserves space for network in skb Stephen Hemminger
2011-06-09 7:09 ` David Miller
2011-06-09 14:16 ` Stephen Hemminger
2011-06-09 0:33 ` [PATCH 2/2] tun: dont force inline of functions Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).