[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130904.175147.516807555661755710.davem@davemloft.net>
Date: Wed, 04 Sep 2013 17:51:47 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: dwmw2@...radead.org
Cc: netdev@...r.kernel.org, simon@...e.lp0.eu,
linux-atm-general@...ts.sourceforge.net, nathan@...verse.com.au
Subject: Re: [PATCH RFC] solos-pci: Fix BUG() with shared skb
From: David Woodhouse <dwmw2@...radead.org>
Date: Wed, 04 Sep 2013 21:41:15 +0100
> On Wed, 2013-09-04 at 14:30 -0400, David Miller wrote:
>> skb_realloc_headroom() should do everything you need.
>
> Great, thanks! Something like this then... ?
>
> Do I really need the truesize check? And if so, is there a better way to
> handle the ATM accounting? It just *happens* to be the case that the the
> br2684_pop() and pppoatm_pop() functions don't mind being bypassed in
> this fashion, and we should probably get away with tweaking the core ATM
> accounting directly like this. Doesn't make me happy though...
...
> + nskb = skb_realloc_headroom(skb, sizeof(*header));
> + if (!nskb) {
> + solos_pop(vcc, skb);
> + return -ENOMEM;
> + }
> + if (skb->truesize != nskb->truesize)
> + atm_force_charge(vcc, nskb->truesize - skb->truesize);
My understanding is that truesize will not be changed by calls to
skb_realloc_headroom(), because if it did then every ethernet driver
would be screwed as the skb->truesize adjustment would corrupt socket
memory accounting.
The only thing you need to be mindful is that after the
skb_realloc_headroom() call all skb data pointers change, and
therefore things like packet pointers are now stale and need to be
recalculated.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists