[PATCH net v2 2/3] packet: always probe for transport header

2015-11-10 Thread Daniel Borkmann
We concluded that the skb_probe_transport_header() should better be
called unconditionally. Avoiding the call into the flow dissector has
also not really much to do with the direct xmit mode.

While it seems that only virtio_net code makes use of GSO from non
RX/TX ring packet socket paths, we should probe for a transport header
nevertheless before they hit devices.

Reference: http://thread.gmane.org/gmane.linux.network/386173/
Signed-off-by: Daniel Borkmann 
Cc: Jason Wang 
---
 net/packet/af_packet.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 80c36c0..bdecf17 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2447,8 +2447,7 @@ static int tpacket_fill_skb(struct packet_sock *po, 
struct sk_buff *skb,
len = ((to_write > len_max) ? len_max : to_write);
}
 
-   if (!packet_use_direct_xmit(po))
-   skb_probe_transport_header(skb, 0);
+   skb_probe_transport_header(skb, 0);
 
return tp_len;
 }
@@ -2808,8 +2807,8 @@ static int packet_snd(struct socket *sock, struct msghdr 
*msg, size_t len)
len += vnet_hdr_len;
}
 
-   if (!packet_use_direct_xmit(po))
-   skb_probe_transport_header(skb, reserve);
+   skb_probe_transport_header(skb, reserve);
+
if (unlikely(extra_len == 4))
skb->no_fcs = 1;
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net v2 2/3] packet: always probe for transport header

2015-11-10 Thread Jason Wang


On 11/11/2015 06:03 AM, Daniel Borkmann wrote:
> We concluded that the skb_probe_transport_header() should better be
> called unconditionally. Avoiding the call into the flow dissector has
> also not really much to do with the direct xmit mode.
>
> While it seems that only virtio_net code makes use of GSO from non
> RX/TX ring packet socket paths, we should probe for a transport header
> nevertheless before they hit devices.
>
> Reference: http://thread.gmane.org/gmane.linux.network/386173/
> Signed-off-by: Daniel Borkmann 
> Cc: Jason Wang 
> ---
>  net/packet/af_packet.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 80c36c0..bdecf17 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2447,8 +2447,7 @@ static int tpacket_fill_skb(struct packet_sock *po, 
> struct sk_buff *skb,
>   len = ((to_write > len_max) ? len_max : to_write);
>   }
>  
> - if (!packet_use_direct_xmit(po))
> - skb_probe_transport_header(skb, 0);
> + skb_probe_transport_header(skb, 0);
>  
>   return tp_len;
>  }
> @@ -2808,8 +2807,8 @@ static int packet_snd(struct socket *sock, struct 
> msghdr *msg, size_t len)
>   len += vnet_hdr_len;
>   }
>  
> - if (!packet_use_direct_xmit(po))
> - skb_probe_transport_header(skb, reserve);
> + skb_probe_transport_header(skb, reserve);
> +
>   if (unlikely(extra_len == 4))
>   skb->no_fcs = 1;
>  

Acked-by: Jason Wang 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html