Message ID | 20110609003321.904295399@vyatta.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
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! -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> 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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- 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;
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> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html