On Thu, May 5, 2022 at 4:23 PM Jason Wang <jasowang@xxxxxxxxxx> wrote: > > On Thu, May 5, 2022 at 4:06 PM Yongji Xie <xieyongji@xxxxxxxxxxxxx> wrote: > > > > On Thu, May 5, 2022 at 3:47 PM Jason Wang <jasowang@xxxxxxxxxx> wrote: > > > > > > On Wed, May 4, 2022 at 4:12 PM Xie Yongji <xieyongji@xxxxxxxxxxxxx> wrote: > > > > > > > > We should use size of descriptor chain to check the maximum > > > > number of consumed descriptors in indirect case. > > > > > > AFAIK, it's a guard for loop descriptors. > > > > > > > Yes, but for indirect descriptors, we know the size of the descriptor > > chain. Should we use it to test loop condition rather than using > > virtqueue size? > > Yes. > > > > > > > And the > > > > statistical counts should also be reset to zero each time > > > > we get an indirect descriptor. > > > > > > What might happen if we don't have this patch? > > > > > > > Then we can't handle the case that one request includes multiple > > indirect descriptors. Although I never see this kind of case now, the > > spec doesn't forbid it. > > It looks to me we need to introduce dedicated counters for indirect > descriptors instead of trying to use a single counter? > OK, I see. > (All evils came from the move_to_indirect()/return_from_indierct() > logic, vhost have dedicated helper to deal with indirect descriptors - > get_indirect()). > Yes, it tries to handle both direct and indirect cases in one loop. Thanks, Yongji