summaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest
AgeCommit message (Collapse)AuthorFilesLines
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-09add mactime plugin unit / code coverage testsDave Barach2-0/+182
The unit and code coverage tests are boring. The rest of the patch involves test and packet-generator infra cleanups. Teach the "make test-xxx" family of targets to set the api test plugin path correctly, to make "binary-api <api-message-name> <args>" debug CLI commands work correctly in the "make test" environment. Unfortunately involves both the top-level and test Makefiles. Add a minor pg cli feature, a CLI to manually set s->sw_if_index[VLIB_TX]. Consider the case where one configures an interface with both a device-input and an output feature. To test the output feature using the pg, it's necessary to inject packets into the interface output node with both b->sw_if_index[VLIB_TX] and b->sw_if_index[VLIB_RX] set correctly. For example: packet-generator new { name tx limit 15 size 128-128 interface local0 # rx: device input feature not configured on local0 tx-interface loop0 # tx: output node requires b->sw_if_index[VLIB_TX] node loop0-output data { hex 0x01005e7ffffa000dead0000008000102030405060708090a0b0c0d0e0f0102030405 } } Fix a longstanding bug in the packet generator stream setup. Remove kludges which set b->sw_if_index[VLIB_TX] to ~0 [in multiple places] instead of using the stream value s->sw_if_index[VLIB_TX], and setting THAT datum correctly. Change-Id: I1097a18e8db73661ded6b822c1d718f7e5cf36ed Signed-off-by: Dave Barach <dave@barachs.net>
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-07Add bihash statistics hookDave Barach1-1/+67
Example / unit-test in .../src/plugins/unittest/bihash_test.c Change-Id: I23fd0ba742d65291667a755965aee1a3d3477ca2 Signed-off-by: Dave Barach <dave@barachs.net>
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-25crypto: AES GCM IV length is always 12Damjan Marion1-2/+0
... at least for use cases we are interested in Change-Id: I1156ff354635e8f990ce2664ebc8dcd3786ddca5 Signed-off-by: Damjan Marion <damarion@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-25unittest: AES GCM test cases cleanupDamjan Marion1-270/+126
This reverts commit 7f2d57b69ea031cc6110b3a1f4c1ef1c35b67181. Change-Id: I23c3b4d2dab6e13cc8fbbf0ac9d0cfd8af3241c1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-04-25crypto: improve key handlingDamjan Marion2-17/+32
Change-Id: If96f661d507305da4b96cac7b1a8f14ba90676ad Signed-off-by: Damjan Marion <damarion@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 mq test to ut pluginFlorin Coras1-4/+101
Change-Id: Ic4e882b784e5773198e55bd97b1bbd3d6dda888a Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24session: remove unused fifo allo return valueFlorin Coras1-3/+1
Change-Id: I50a6bcc127e4b44becc4b694bdd3018ac9bfab5c 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-23Enable 'test crash' command when running unittest plugin.Paul Vinciguerra1-0/+1
Change-Id: Icf0cff122dfbd260a2865b6c83531f4a8c726132 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-04-19rbtree: add successor and predecessor functionsFlorin Coras1-4/+54
Change-Id: I6934beaf5c08bae2d4f0bd3a6bb811810407c1f9 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-19svm: move fifo tests to a separate fileFlorin Coras3-1160/+1199
Change-Id: Iac9ac9f5a6873aae1882316af4f6c919788a0cef Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-19svm: support addition of chunks to fifosFlorin Coras1-2/+135
Change-Id: Ia56cad89b85b7a99ab4bfb85318a45a71381fb53 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-18svm: allow indirect fifo data chunksFlorin Coras2-4/+4
Fifos can use multiple memory chunks for simple read/write operations. Adding/removing chunks after assignment not yet supported. Change-Id: I2aceab6aea78059d74e0d3a9993c40d5196d077b Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-16svm_fifo rework to avoid contention on cursizeSirshak Das1-2/+1
Problems Addressed: - Contention of cursize by producer and consumer. - Reduce the no of modulo operations. Changes: - Synchronization between producer and consumer changed from cursize to head and tail indexes Implications: reduces the usable size of fifo by 1. - Using weaker memory ordering C++11 atomics to access head and tail based on producer and consumer role. - Head and tail indexes are unsigned 32 bit integers. Additions and subtraction on them are implicit 32 bit Modulo operation. - Adding weaker memory ordering variants of max_enq, max_deq, is_empty and is_full Using them appropriately in all places. Perfomance improvement (iperf3 via Hoststack): iperf3 Server: Marvell ThunderX2(AArch64) - iperf3 Client: Skylake(x86) ~6%(256 rxd/txd) - ~11%(2048 rxd/txd) Change-Id: I1d484e000e437430fdd5a819657d1c6b62443018 Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2019-04-16vppinfra: add basic rbtreeFlorin Coras2-0/+203
Algorithm from CLRS, Introduction to Algorithms 3rd Edition, Ch. 13 Change-Id: I5bc2c507593770939cd5584f21dacf36ebd2b4c1 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-15crypto: fix coverity warningsFilip Tehlar1-2/+5
Change-Id: Id9dfd912517c44cf812953bd05ac04c9e172a2b7 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-04-14crypto: add support for AES-CTR cipherfituldo2-1/+118
Change-Id: I7d84bab7768421ed37813702c0413e52167f41ab Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-04-11crypto: add more AES-GCM test casesFilip Tehlar1-1/+309
Change-Id: Ibb3e2f3ba5f31482fc2f0dce53d68f8476608f4b Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-04-11crypto: add performace test to unittest pluginDamjan Marion2-1/+197
Change-Id: I49c710c5ace24a4c1f083120fd4c2972566a1695 Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-04-08fixing typosJim Thompson1-6/+6
Change-Id: I215e1e0208a073db80ec6f87695d734cf40fabe3 Signed-off-by: Jim Thompson <jim@netgate.com>
2019-04-08vlib-punt: fix error node countingNeale Ranns1-5/+0
Change-Id: I271aa8b8f4917c187ad52db774e4ad26677e2b82 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-04-07crypto: add support for AEAD and AES-GCMDamjan Marion8-204/+416
Change-Id: Iff6f81a49b9cff5522fbb4914d47472423eac5db Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-04-02vppinfra: fix sparse_vec_index() returning non-zero index for some ↵Andrew Yourtchenko2-0/+74
nonexistent elements If we are testing for an index whose membership bitmask happens to sit in LSB of uword, and there is nothing else set in that uword in the member bitmask, the shortcut path returning the valid index is taken even if the element with a given index doesn't exist in the sparse vector. This happens because the count of leading zeroes on the value of 0 is zero, which is equal to the value taken modulo bitsize uword. Take care of that case. Also add unittests showing the problem and verifying that sparse_vec_index2 does not have the same issue. Change-Id: I19117e13817c3e5de579b9250bb741de42491985 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-03-28crypto: add vnet_crypto_op_init (...)Damjan Marion1-1/+1
Change-Id: I2018d8367bb010e1ab30d9c7c23d9501fc38a2e5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-03-28Punt InfraNeale Ranns2-0/+403
A punt/exception path that provides: 1) clients that use the infra 2) clients can create punt reasons 3) clients can register to recieve packets that are punted for a given reason to be sent to the desired node. 4) nodes which punt packets fill in the {reason,protocol} of the buffere (in the meta-data) and send to the new node "punt-dispatch" 5) punt-dispatch sends packets to the registered nodes or drops Change-Id: Ia4f144337f1387cbe585b4f375d0842aefffcde5 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra2-3/+3
Change-Id: I53ab8d17914e6563110354e4052109ac02bf8f3b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-22crypto: implement rfc4231 test casesFilip Tehlar4-2/+422
Change-Id: I540241672a20f687d20bb70adbf2b33200f34167 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-03-22ADJ: more thorough link up checkNeale Ranns1-0/+3
Change-Id: I04dbfb914706b25fcc3bd6ee0d19cfdc810234ae Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-22tcp: improve handling of snd_nxtFlorin Coras1-2/+2
- avoid changing snd_nxt when doing fast retransmits - use snd_una_max only to keep track of the max seq number sent - simplify future ack testing Change-Id: I3580ad3aefe30128486c3375d0ac3f3f62c04c5e Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-22IPSEC: test for packet drop on sequence number wrapNeale Ranns2-0/+76
Change-Id: Id546c56a4904d13d4278055f3c5a5e4548e2efd0 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-20tests: implement crypto tests per RFC2202Filip Tehlar4-85/+416
Change-Id: I18b30d5ee8aa60c34d52b7716b5feb7225cb0d59 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-03-19crypto: introduce crypto infraDamjan Marion6-0/+661
Change-Id: Ibf320b3e7b054b686f3af9a55afd5d5bda9b1048 Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-03-14TEST: link-state up/down notifications on FIB forwardingNeale Ranns2-0/+76
Change-Id: I478c4e5feb9603b7443efdf2967f98f9bde7ea0f Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-13VPP-1576: fix a set of coverity warningsDave Barach1-0/+3
Change-Id: Ifd34aed8692d5acaa370d4976d974ac573e43705 Signed-off-by: Dave Barach <dave@barachs.net>
2019-03-12svm mq: add unit testFlorin Coras1-0/+179
Change-Id: I2f1fa15a99163b9c105707484503dc9502265c52 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-02session: cleanup/rename functionsFlorin Coras1-1/+1
- remove unused functions - rename old "stream" functions Change-Id: Icbb03daa9f9f1c58b5be5c38aa8a9cbcf9159b47 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-27string_test: The dark side of coveritySteven Luong1-4/+0
Me: "Mr Coverity, I thought I fixed the dead code warning just few days ago in this file. Why are you still complaining about the same stuff to me?" Mr. Coverity: "Duh! But you are supposed to fix all occurences in the same file." Me: "Mr. Coverity, I didn't see you flag the warning in the other places last time?" Mr. Coverity: "Shh! That is the secret of my dark side!" Change-Id: I565eccd90bf1bb39c9881664d361f83396ca8bcc Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-21string_test: Coverity woeSteven Luong1-2/+0
Coverity complains about dead code as shown below and it is right. The fix is to simply remove the dead code. 503 if (v_indicator != indicator) CID 190173 (#3 of 3): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: return -1;. 504 return -1; Change-Id: Ibca9e10451a4459db099bef5ecc6939474bdb903 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-19VPP-1568:when entry src cover change, recursive-loop fib still can not work.mu.duojiao1-0/+75
Change-Id: I90762b59f94175f278380c95776471a30bc94d34 Signed-off-by: mu.duojiao <mu.duojiao@zte.com.cn>
2019-02-18session: move fifo allocation logic to app workerFlorin Coras1-1/+1
Change-Id: I1662ec4b5503cb64a8a86a2441842311d959b3a6 Signed-off-by: Florin Coras <fcoras@cisco.com>