> -----Original Message----- > From: Ouyang, Changchun > Sent: Wednesday, September 09, 2015 11:18 AM > To: Xie, Huawei; dev at dpdk.org > Cc: Ouyang, Changchun > Subject: RE: vring_init bug > > > > -----Original Message----- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Xie, Huawei > > Sent: Wednesday, September 9, 2015 11:00 AM > > To: dev at dpdk.org > > Subject: [dpdk-dev] vring_init bug > > > > static inline void > > vring_init(struct vring *vr, unsigned int num, uint8_t *p, > > unsigned long align) > > { > > vr->num = num; > > vr->desc = (struct vring_desc *) p; > > vr->avail = (struct vring_avail *) (p + > > num * sizeof(struct vring_desc)); > > vr->used = (void *) > > RTE_ALIGN_CEIL((uintptr_t)(&vr->avail->ring[num]), align); } > > > > There is a bug in vr->used calculation. 2 bytes of used_event_idx isn't > > considered. Would submit a fix. > > __u16 available[num]; > > __u16 used_event_idx; > > For vring_used ring, it also misses avail_event. > > struct vring_used { > u16 flags ; > u16 idx ; > struct vring_used_elem r ing [qsz] ; > u16 avail_event ; // this one missed in dpdk > } ; > > It doesn't affect the offset calculation, but it will be great if you can add > it > together.
No need to add this field for use vring and you couldn't because previous array is variable length.