Re: [RFC PATCH v2] ptr_ring: linked list fallback

From: Michael S. Tsirkin
Date: Tue Feb 27 2018 - 23:11:09 EST


On Wed, Feb 28, 2018 at 11:39:15AM +0800, Jason Wang wrote:
>
>
> On 2018å02æ28æ 11:28, Jason Wang wrote:
> > > > Well I believe the main user for this is qdisc, which use skb
> > > > array. And we
> > > > can not use what implemented in this patch directly for sk_buff
> > > > without some
> > > > changes on the data structure.
> > > Why not? skb has next and prev pointers at 1st two fields:
> > >
> > > struct sk_buff {
> > > ÂÂÂÂÂÂÂÂ union {
> > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct {
> > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ /* These two members must be first. */
> > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct sk_buffÂÂÂÂÂÂÂÂÂ *next;
> > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct sk_buffÂÂÂÂÂÂÂÂÂ *prev;
> > > ...
> > > }
> > >
> > > so it's just a question of casting to struct plist.
> >
> > Well, then the casting can only be done in skb_array implementation?
>
> Ok, could be done in ptr ring. But still looks tricky, because of the
> different meaning of prev and last.
>
> Thanks

It doesn't matter much - the meaning is up to whoever has the skb
queued. But sure - adding struct plist into the union is cleaner
and just as easy.