Re: NETIF_F_GSO_SOFTWARE vs NETIF_F_GSO

From: Jason A. Donenfeld
Date: Thu Nov 05 2015 - 11:28:56 EST


On Thu, Nov 5, 2015 at 4:56 PM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
> It is a performance benefit only if you use the helpers from
> net/core/tso.c as some drivers already do.
>
> Otherwise, calling the skb_gso_segment() from your driver has no gain
> compared to the one done from core networking stack.

Interesting, okay. It looks like it will be, in fact, useful to be
able to call skb_gso_segment() from my own driver. The reasoning is as
follows:

As mentioned, I receive packets on ndo_start_xmit, "do something to
them with function magic()", and then push them out of a UDP socket
using udp_tunnel_xmit_skb. There appears to be significant overhead
from calling udp_tunnel_xmit_skb over and over. What I'd really like
to do is pass the NETIF_F_GSO_SOFTWARE-provided super packet directly
to udp_tunnel_xmit_skb, but in fact the magic() function mentioned
above needs to work on an entire MTU-sized IP packet, not a a super
packet. So, instead, what it's looking like is:

1. Set NETIF_F_GSO_SOFTWARE to receive super packets.
2. For each super packet, break it down using skb_gso_segment().
2a. For each segmented packet, "do my magic() function"
3. After having done the magic() to each of the segmented packets, I
*repack the results* into a new super packet. I then pass that super
packet to udp_tunnel_xmit_skb().

Is this approach a real possibility?

If so, it seems like the best way to get GSO-like qualities out of
udp_tunnel_xmit_skb. I've successfully done (1) and (2), following the
example of validate_xmit_skb() from net/core/dev.c. Now I need to
figure out how to do (3). Hopefully I'll find some nice convenience
functions for this...

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/