On Fri, 18 Nov 2016 18:43:55 -0800, John Fastabend wrote:
> On 16-11-18 06:10 PM, Jakub Kicinski wrote:
> > On Fri, 18 Nov 2016 13:09:53 -0800, Jakub Kicinski wrote:  
> >> Looks very cool! :)
> >>
> >> On Fri, 18 Nov 2016 11:00:41 -0800, John Fastabend wrote:  
>  [...]  
> >>
> >> Is num_online_cpus() correct here?  
> > 
> > Sorry, I don't know the virto_net code, so I'm probably wrong.  I was
> > concerned whether the number of cpus can change but also that the cpu
> > mask may be sparse and therefore offsetting by smp_processor_id()
> > into the queue table below could bring trouble.
> >   
> 
> Seem like a valid concerns to me how about num_possible_cpus() instead.

That would solve problem 1, but could cpu_possible_mask still be sparse
on strange setups?  Let me try to dig into this, I recall someone
(Eric?) was fixing similar problems some time ago.

> > @@ -353,9 +381,15 @@ static u32 do_xdp_prog(struct virtnet_info *vi,
> >     switch (act) {
> >     case XDP_PASS:
> >             return XDP_PASS;
> > +   case XDP_TX:
> > +           qp = vi->curr_queue_pairs -
> > +                   vi->xdp_queue_pairs +
> > +                   smp_processor_id();
> > +           xdp.data = buf + (vi->mergeable_rx_bufs ? 0 : 4);
> > +           virtnet_xdp_xmit(vi, qp, &xdp);
> > +           return XDP_TX;
> >     default:
> >             bpf_warn_invalid_xdp_action(act);
> > -   case XDP_TX:
> >     case XDP_ABORTED:
> >     case XDP_DROP:
> >             return XDP_DROP;
> >   

Reply via email to