[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140821.212514.4787122329921320.davem@davemloft.net>
Date: Thu, 21 Aug 2014 21:25:14 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: bpoirier@...e.de
Cc: mchan@...adcom.com, prashant@...adcom.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] tg3: Fix tx_pending checks for tg3_tso_bug
From: Benjamin Poirier <bpoirier@...e.de>
Date: Thu, 21 Aug 2014 14:59:11 -0700
> Ah, now I understand the reason for the * 3 in
> u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3;
>
> /* Estimate the number of fragments in the worst case */
> but that is not really the "worst case". It's not forbidden to have more than
> two frags per skb output from skb_gso_segment(). I've kept this estimation
> approach but I've added code to validate the estimation or else linearize the
> skb.
This is a common situation drivers run into, and there have been a few
notable situations in virtualization drivers recently. Although in
those cases the problems arise from the fact that if an SKB fragment
is a compound page, this can evaluate to requiring multiple
descriptors, one for each 4K segment within that fragment.
Anyways, the point I wanted to make is that you shouldn't do anything
too complicated to handle all of this. And I think your conclusion
to linearize if the estimation fails is a good one.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists