search for: new_idx

Displaying 20 results from an estimated 97 matches for "new_idx".

2011 May 18
2
[LLVMdev] access array problem
...Value *OldCounterSize =new LoadInst(ElementPtrC, "OldCounterSize", InsertPos); Value *OldCounterSize =new LoadInst(ElementPtrC, "", InsertPos); //create a getelementptr instruction: we want get &Counters[OldCounterSize] std::vector<Value*>new_idx; new_idx.push_back(OldCounterSize); // ERROR? Value *nextaddr = GetElementPtrInst::Create(Counters, new_idx.begin(), new_idx.end(), "", InsertPos); Thanks! ? 2011/5/18 16:04, Duncan Sands ??: > Hi Guangming Tan, > >>>> GlobalVariable: >>>> int *counter; //c...
2011 May 18
0
[LLVMdev] access array problem
Hi Guangming Tan, > I rewrote the code, please help check why it still does not work: next time please be more explicit about exactly what goes wrong. > //create a getelementptr instruction: we want get &Counters[OldCounterSize] > std::vector<Value*>new_idx; > new_idx.push_back(OldCounterSize); // ERROR? > Value *nextaddr = GetElementPtrInst::Create(Counters, new_idx.begin(), > new_idx.end(), "", InsertPos); You need to push an index of zero before pushing the OldCounterSize index. Ciao, Duncan.
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...; > needs_kick = vring_need_event(event_idx, new, old); > > > > > > > > I suspect this hack won't work for non power of 2 ring. > > > > > > Above code doesn't require the ring size to be a power of 2. > > > > > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > > > > > old = vq->next_avail_idx - vq->num_added; > > > new = vq->next_avail_idx; > > > > > > When vq->next_avail_idx >= vq->num_added, it's obvious that, > > > (__u16)...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...; > needs_kick = vring_need_event(event_idx, new, old); > > > > > > > > I suspect this hack won't work for non power of 2 ring. > > > > > > Above code doesn't require the ring size to be a power of 2. > > > > > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > > > > > old = vq->next_avail_idx - vq->num_added; > > > new = vq->next_avail_idx; > > > > > > When vq->next_avail_idx >= vq->num_added, it's obvious that, > > > (__u16)...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...nt_idx -= vq->vring_packed.num; > > > > > > needs_kick = vring_need_event(event_idx, new, old); > > > > I suspect this hack won't work for non power of 2 ring. > > Above code doesn't require the ring size to be a power of 2. > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > old = vq->next_avail_idx - vq->num_added; > new = vq->next_avail_idx; > > When vq->next_avail_idx >= vq->num_added, it's obvious that, > (__u16)(new_idx - old) is vq->num_added. > > And when vq-...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...nt_idx -= vq->vring_packed.num; > > > > > > needs_kick = vring_need_event(event_idx, new, old); > > > > I suspect this hack won't work for non power of 2 ring. > > Above code doesn't require the ring size to be a power of 2. > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > old = vq->next_avail_idx - vq->num_added; > new = vq->next_avail_idx; > > When vq->next_avail_idx >= vq->num_added, it's obvious that, > (__u16)(new_idx - old) is vq->num_added. > > And when vq-...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...>>>> So how about we use the straightforward way then? >>> You mean we do new += vq->vring_packed.num instead >>> of event_idx -= vq->vring_packed.num before calling >>> vring_need_event()? >>> >>> The problem is that, the second param (new_idx) of >>> vring_need_event() will be used for: >>> >>> (__u16)(new_idx - event_idx - 1) >>> (__u16)(new_idx - old) >>> >>> So if we change new, we will need to change old too. >> I think that since we have a branch there anyway, >> we...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...>>>> So how about we use the straightforward way then? >>> You mean we do new += vq->vring_packed.num instead >>> of event_idx -= vq->vring_packed.num before calling >>> vring_need_event()? >>> >>> The problem is that, the second param (new_idx) of >>> vring_need_event() will be used for: >>> >>> (__u16)(new_idx - event_idx - 1) >>> (__u16)(new_idx - old) >>> >>> So if we change new, we will need to change old too. >> I think that since we have a branch there anyway, >> we...
2015 Apr 15
2
[PATCH] virtio: fix typo in vring_need_event() doc comment
...signed vring_size(unsigned int num, unsigned long align) } /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ -/* Assuming a given event_idx value from the other size, if +/* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, * should we trigger an event? */ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) -- 2.1.0
2015 Apr 15
2
[PATCH] virtio: fix typo in vring_need_event() doc comment
...signed vring_size(unsigned int num, unsigned long align) } /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ -/* Assuming a given event_idx value from the other size, if +/* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, * should we trigger an event? */ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) -- 2.1.0
2018 Nov 30
4
[PATCH net-next v3 01/13] virtio: add packed ring types and macros
...uppression structure > + * of packed ring. > + */ > +#define VRING_PACKED_EVENT_F_WRAP_CTR 15 > + > /* We support indirect buffer descriptors */ > #define VIRTIO_RING_F_INDIRECT_DESC 28 > > @@ -171,4 +195,32 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) > return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); > } > > +struct vring_packed_desc_event { > + /* Descriptor Ring Change Event Offset/Wrap Counter. */ > + __le16 off_wrap; > + /* Descriptor Ring Change Event Flags. */ > + __le16 flag...
2018 Nov 30
4
[PATCH net-next v3 01/13] virtio: add packed ring types and macros
...uppression structure > + * of packed ring. > + */ > +#define VRING_PACKED_EVENT_F_WRAP_CTR 15 > + > /* We support indirect buffer descriptors */ > #define VIRTIO_RING_F_INDIRECT_DESC 28 > > @@ -171,4 +195,32 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) > return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); > } > > +struct vring_packed_desc_event { > + /* Descriptor Ring Change Event Offset/Wrap Counter. */ > + __le16 off_wrap; > + /* Descriptor Ring Change Event Flags. */ > + __le16 flag...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...> > > > > > > needs_kick = vring_need_event(event_idx, new, old); > > > > > > I suspect this hack won't work for non power of 2 ring. > > > > Above code doesn't require the ring size to be a power of 2. > > > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > > > old = vq->next_avail_idx - vq->num_added; > > new = vq->next_avail_idx; > > > > When vq->next_avail_idx >= vq->num_added, it's obvious that, > > (__u16)(new_idx - old) is vq->num_...
2018 Sep 07
2
[PATCH net-next v2 1/5] virtio: add packed ring definitions
...; /* We support indirect buffer descriptors */ > #define VIRTIO_RING_F_INDIRECT_DESC 28 > These are for the packed ring, right? Pls prefix accordingly. Also, you likely need macros for the wrap counters. > @@ -171,4 +186,32 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) > return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); > } > > +struct vring_packed_desc_event { > + /* Descriptor Ring Change Event Offset/Wrap Counter. */ > + __virtio16 off_wrap; > + /* Descriptor Ring Change Event Flags. */ > + __virtio16...
2018 Sep 07
2
[PATCH net-next v2 1/5] virtio: add packed ring definitions
...; /* We support indirect buffer descriptors */ > #define VIRTIO_RING_F_INDIRECT_DESC 28 > These are for the packed ring, right? Pls prefix accordingly. Also, you likely need macros for the wrap counters. > @@ -171,4 +186,32 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) > return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); > } > > +struct vring_packed_desc_event { > + /* Descriptor Ring Change Event Offset/Wrap Counter. */ > + __virtio16 off_wrap; > + /* Descriptor Ring Change Event Flags. */ > + __virtio16...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...d_event(event_idx, new, old); > > > > > > > > > > I suspect this hack won't work for non power of 2 ring. > > > > > > > > Above code doesn't require the ring size to be a power of 2. > > > > > > > > For (__u16)(new_idx - old), what we want to get is vq->num_added. > > > > > > > > old = vq->next_avail_idx - vq->num_added; > > > > new = vq->next_avail_idx; > > > > > > > > When vq->next_avail_idx >= vq->num_added, it's obvious tha...
2014 Oct 22
2
[PATCH RFC v2 01/16] virtio: memory access APIs
..._u16) * 3 + sizeof(struct vring_used_elem) * num; + + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other size, if * we have just incremented index from old to new_idx, * should we trigger an event? */ -static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) +static inline int vring_need_event(__virtio16 event_idx, __virtio16 new_idx, __virtio16 old) { /* Note: Xen has similar logic for notification hold-off * in include/xen/interfac...
2014 Oct 22
2
[PATCH RFC v2 01/16] virtio: memory access APIs
..._u16) * 3 + sizeof(struct vring_used_elem) * num; + + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other size, if * we have just incremented index from old to new_idx, * should we trigger an event? */ -static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) +static inline int vring_need_event(__virtio16 event_idx, __virtio16 new_idx, __virtio16 old) { /* Note: Xen has similar logic for notification hold-off * in include/xen/interfac...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
On Wed, May 02, 2018 at 03:28:19PM +0800, Tiwei Bie wrote: > On Wed, May 02, 2018 at 10:51:06AM +0800, Jason Wang wrote: > > On 2018?04?25? 13:15, Tiwei Bie wrote: > > > This commit introduces the event idx support in packed > > > ring. This feature is temporarily disabled, because the > > > implementation in this patch may not work as expected, > > >
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
On Wed, May 02, 2018 at 03:28:19PM +0800, Tiwei Bie wrote: > On Wed, May 02, 2018 at 10:51:06AM +0800, Jason Wang wrote: > > On 2018?04?25? 13:15, Tiwei Bie wrote: > > > This commit introduces the event idx support in packed > > > ring. This feature is temporarily disabled, because the > > > implementation in this patch may not work as expected, > > >