summaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest/svm_fifo_test.c
AgeCommit message (Collapse)AuthorFilesLines
2021-09-23svm: remove unused fifo functionsFlorin Coras1-3/+3
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4525bc669d1c42c41dbc398cf239a093b6853298
2020-12-30svm: fifo segment sptr for fifo hdr free listFlorin Coras1-3/+3
With this there are no more pointers in data structures allocated on fifo segments. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ibe584b7b6809fa360a105974655a91674db69ab6
2020-12-26svm: change fifo pointers to offsetsFlorin Coras1-10/+11
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I113a630d6db4741f54e508f7e0ed77be139df0e4
2020-12-24svm: split fifo into private and shared structsFlorin Coras1-47/+47
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id8e77e8b2623be719fd43a95e181eaa5b7df2b6e
2020-12-23svm: separate private from shared fifo segment ptrsFlorin Coras1-6/+13
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idcc8d862b98dba4a67f829c1778377f35ad47b00
2020-12-23svm: remove fifo segment heapFlorin Coras1-7/+16
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I518e096fe13847759806ff62009e73fd8f7451b7
2020-10-21svm: fix fifo unit testBenoît Ganne1-4/+6
- fix fifo initialization overflowing chunk size - stick to the default base virtual address to initialize fifo. ASAN can be picky about address space Type: fix Change-Id: If9a29138d2c207859d72845e928290c808c4a982 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-08svm session: document unsupported fifo deq combinationsFlorin Coras1-5/+21
Type: fix - Document that ooo dequeues with ooo lookups cannot be done in combination with in order dequeues. - Added assert to capture this scenario and de-initialized rbtrees for cut-through tx fifo Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic40d020b3f0391fcf022ea3c906b86121744144f
2020-04-22svm: asan: fix asan supportBenoît Ganne1-2/+2
- restrict the unittests SVM address space to what is supported by ASan - mark SVM mmap()ed address space accessible for ASan - SVM shared memory heap scheme means some allocation can happen outside the current process. Lazily mark those accessible for ASan Type: fix Change-Id: I7c196c80b2a5297651d0afa54f1a8e478fcf59b1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-04-20svm: check if fifo free list index is valid on allocFlorin Coras1-12/+29
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Benoît Ganne <bganne@cisco.com> Change-Id: Ib85c2f01dc7ec9858f2f88b89e209f989d78c5d9
2020-03-17svm: fifo testRyujiro Shibuya1-0/+66
Type: feature Adding a very simple test case just to confirm that setting fifo size same as the current in-use size would result no space to enqueue, which is zero-window in the TCP. Signed-off-by: Ryujiro Shibuya <ryujiro.shibuya@owmobility.com> Change-Id: I6d60449386eaa270f801d2046cc7e546f843bf34
2020-02-29svm: fix slice locking on fifo allocFlorin Coras1-1/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1fef115ffc2277ad6e0673b49be137147808891c
2020-02-26svm: support multi-chunk fifo chunk allocFlorin Coras1-4/+4
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id601cd241a2d124d3189057edab4299ffde7ee32
2020-02-25svm: minimal initial fifoFlorin Coras1-0/+2
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4ee46a6c3c53c58199c275e20702f7fd11b60d9a
2020-02-25svm: refactor fifoFlorin Coras1-799/+724
Type: refactor Switch from a wrapped byte space to a "continuous" one wherein fifo chunks are appended to the fifo as more data is enqueued and chunks are removed as data is dequeued. The fifo is still subject to a maximum size, i.e., maximum number of bytes that can be enqueued, so the max number of chunks associated to the fifo is also constrained. When enqueueing data, which must fit within the available free space, if not enough "supporting" chunk memory is available, the fifo asks the fifo segment for enough chunk memory to ensure that the write can succeed. To avoid allocating large amounts of small chunks due to small writes, if possible, the size of the chunks requested is lower capped by min_alloc. When dequeuing data, all the chunks that have been completely drained, i.e., head moved beyond the chunks’ end bytes, are unlinked from the fifo and returned to the fifo segment. The one exception to this is the last chunk which is never unlinked. Change-Id: I98c1dbd9135fb79650365c7e40c29238b96cd4ee Signed-off-by: Florin Coras <fcoras@cisco.com>
2020-02-25svm: refactor fifo chunk trackingFlorin Coras1-2/+12
Avoid tracking with rbtrees all of the chunks associated to a fifo. Instead, only track chunks when doing out-of-order operations (peek or ooo enqueue). Type: refactor Change-Id: I9f8bd266211746637d98e6a12ffc4b2d6346950a Signed-off-by: Florin Coras <fcoras@cisco.com>
2020-02-07svm: use default SVM address in fifo unit testsBenoît Ganne1-1/+2
Using random addresses can confuse AddressSanitizer Type: fix Change-Id: I44368093f899672ac4d511cc5a01ed87c988e63a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-12-12session svm: per thread fifo segment slicesFlorin Coras1-12/+15
Type: refactor Change-Id: I9be652e56cdb48b0aee3253f7ce8d9bed299d824 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2019-10-16svm: reset vector data instead of lengthBenoît Ganne1-1/+1
Reseting vector length confuses ASAN and does not reset data either. Only reset data instead. Type: fix Change-Id: Id60b8333df28a5b636a9d302b987bbad95c85c38 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-07-03svm: fix multi-chunk fifo alloc and add more testsFlorin Coras1-11/+148
Type: fix - make sure that chunks and the rbtree are initialized if fifo segment allocates multiple chunks for the fifo. - ensure head/tail chunks are updated on all enqueue/dequeue events, including when dropping data. - more unit tests Also fixes dequeue drop updates of head chunk. Change-Id: I77f3550bc4e8b4e077f80ea87fe82b83ed013aeb Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-27svm: improve fifo segment testFlorin Coras1-1/+13
Type: feature Try to also catch weirdness when running tests on arm cpus. Change-Id: I45ab7c225f43623447271e67ebf37f94236a288f Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-26svm: fix fifo segment free chunk bytes accountingFlorin Coras1-17/+112
Type:fix Change-Id: Icab89337eb3dbdc93d0fb453cfd34090026072b7 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-14svm: improve fifo segment prealloc supportFlorin Coras1-1/+114
- track fifo segment free and chunk freelist memory - improve fifo alloc. If there are enough chunks to satisfy a fifo allocation request but not enough free memory, allocate a multi-chunk fifo - add apis to preallocate chunks and fifo headers - more tests Change-Id: If18dba7ab856272c9f565d36ac36365139793e0b Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-07svm: decouple fifo and default chunk allocationFlorin Coras1-13/+29
Default chunk is no longer embedded into the fifo and on free is returned to its respective chunk list. Change-Id: Ifc5d214eaa6eca44356eb79dd75650fb8569113f Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03session/svm: apis for fifo shrinkingFlorin Coras1-0/+75
Change-Id: Ie519683bb90aae6fb95f2a09e251cded1890ed41 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03svm: basic support for fifo shrinkingFlorin Coras1-0/+400
As opposed to growing, this is not a bulk operation, instead dependent on how the producer/consumer advance head and tail, the fifo will shrink in one or multiple steps. Only once the fifo's nitems and size are reduced to their appropriate values, equal or larger to what was requested, can the fifo chunks be collected by the owner. Chunk collection must be done with the segment heap pushed. Change-Id: Iae407ccf48d85320aa3c1e0304df56c5972c88c1 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03svm: store normalized head/tail for fifoFlorin Coras1-2/+7
If head/tail are stored as "absolute" values that are normalized to [0, fifo_size] interval, when fifo is shrunk/grown the consumer and producer have to independently update to the new fifo size and fix head and tail, respectively. If the head and tail are stored as normalized values, under the right conditions, they don't need to be fixed when fifo size changes. This reverts one of the changes in gerrit 18223. Change-Id: I55a908828afe90925cf7c20186a940b25e5805f9 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-30svm: more fifo refactor/cleanupFlorin Coras1-83/+83
Change-Id: Ie76c69641c8598164d0d00fd498018037258fd86 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-27svm: fix fifo tail/head/ooo logic for u32 wrapFlorin Coras1-12/+279
These were introduced with the switch to unbound tail/head size, so they only affect master. Added unit tests to avoid future surprises. Change-Id: I83b6c9efbe31d8092ba59b8e2ed46f4da97f35db Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-26svm: fifo segment support for chunk allocationFlorin Coras1-5/+93
Change-Id: Ie96706b4d8bcb32d2d5f065bc765f95f4e9369e7 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-25session: cleanup segment manager and fifo segmentFlorin Coras1-73/+73
Change-Id: I984f347fb465c0c405cef668d8690457e81788e2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24svm: fifo ooo reads/writes with multiple chunksFlorin Coras1-16/+161
Change-Id: If23a04623a7138c9f6c98ee9ecfa587396618a60 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24svm: move fifo tests to ut pluginFlorin Coras1-0/+271
Change-Id: I638facf6e2128334c3d1a5a8494f378505831e1b Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-19svm: move fifo tests to a separate fileFlorin Coras1-0/+1197
Change-Id: Iac9ac9f5a6873aae1882316af4f6c919788a0cef Signed-off-by: Florin Coras <fcoras@cisco.com>