Subject: Re: [Xen-devel] [PATCH net] Xen-netback: Fix issue caused by using gso_type wrongly

From: Zoltan Kiss <[email-masked]>
Date: Mon, 10 Mar 2014 13:29:08 +0000

On 10/03/14 13:23, annie li wrote:
> On 2014/3/10 17:51, Paul Durrant wrote:
>>> @@ -299,12 +299,12 @@ static void xenvif_gop_frag_copy(struct xenvif
>>> *vif,
>>> struct sk_buff *skb,
>>>           }
>>>
>>>           /* Leave a gap for the GSO descriptor. */
>>> -        if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
>>> -            gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
>>> -        else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
>>> -            gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
>>> -        else
>>> -            gso_type = XEN_NETIF_GSO_TYPE_NONE;
>>> +        if (skb_shinfo(skb)->gso_size) {
>> You should probably use skb_is_gso(skb) for your test.
>
> skb_is_gso does the same thing, skb_iso_gso and
> skb_shinfo(skb)->gso_size coexist. But I can change the code as you
> suggested if you like, will post a v2 patch for this.

It's always better to use core functions which codify these rules. Also, 
from the reader's point of view, it's more obvious to see skb_is_gso, 
than checking gso_size.