Re: [PATCH net-next 5/8] net: implement virtio helpers to handle UDP GSO tunneling.
From: Jason Wang <jasowang@redhat.com>
Date: 2025-06-03 02:11:45
On Thu, May 29, 2025 at 11:30 PM Paolo Abeni [off-list ref] wrote:
On 5/26/25 6:40 AM, Jason Wang wrote:quoted
On Wed, May 21, 2025 at 6:34 PM Paolo Abeni [off-list ref] wrote:quoted
@@ -242,4 +249,158 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, return 0; } +static inline unsigned int virtio_l3min(bool is_ipv6) +{ + return is_ipv6 ? sizeof(struct ipv6hdr) : sizeof(struct iphdr); +} + +static inline int virtio_net_hdr_tnl_to_skb(struct sk_buff *skb, + const struct virtio_net_hdr *hdr, + unsigned int tnl_hdr_offset, + bool tnl_csum_negotiated, + bool little_endian)Considering tunnel gso requires VERSION_1, I think there's no chance for little_endian to be false here.If tnl_hdr_offset == 0, tunnel gso has not been negotiated, and little_endian could be false. I can assume little_endian is true in the !!tnl_hdr_offset branch.
That would be fine, and I wonder if tnl_hdr_offset is better than having an accepting struct virtio_net_hdr_tunnel * (assuming we agree that it is a part of the uAPI) which seems more consistent and avoids a cast. Thanks
/P