summaryrefslogtreecommitdiffstats
path: root/extras/libmemif
AgeCommit message (Collapse)AuthorFilesLines
2021-10-13libmemif: docs md->rstNathan Skrzypczak10-494/+652
Type: improvement Change-Id: Ibebd2d47a4268189f11601d004073e4858548f25 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-13libmemif: update documentationJakub Grajciar4-331/+157
Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I0094ea8627cd8bcd5ea119c2fd48f077c8e2e4bb
2021-09-29libmemif: Fix abstract socketsNathan Skrzypczak2-13/+22
This fixes size computation when using abstract sockets with libmemif Type: fix Change-Id: I3a686e4ff2132b9fb295bbe30633958dcfec672b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-09-27libmemif: refactor connection establishmentJakub Grajciar5-1572/+1160
per_thread_ namespace fuctionality replaced by memif socket. Interfaces are grouped by memif socket which holds interface database. Each thread can create it's unique memif socket. The path name can be equal across threads so that the app only uses one UNIX socket. In case of listener socket, listener fd can be obtained and set using APIs. This change allows: - No lookup on file descriptor events - improves interrupt handling - Loopback support (connect two interfaces in one app) - usefull for debugging and testing - Improves code readability by providing control channel abstraction for each interface and listener sockets Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I1b8261042431c0376646ab4c4c831f6e59dd3eed
2021-09-27libmemif: remove per_thread_ namespaceJakub Grajciar2-562/+1
Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ib5a88132ad28860553fc82f5aaaf84e0a1b8e8bf
2021-09-27libmemif: remove old examplesJakub Grajciar9-6116/+4
Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I2331f6fb43ca533afb32f7d448adda27b19689ac
2021-09-27libmemif: remove outdated unit testsJakub Grajciar8-1799/+0
Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ie42c03980cf2cc0766308043d7d3ea5301a59b75
2021-03-15libmemif: fix the include for ssize_tAndrew Yourtchenko1-0/+1
Change-Id: I83830e64fb0fc302474837ebfa4f8cb133b1dccf Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2021-03-12libmemif: add an include of sys/types.h header fileAndrew Yourtchenko1-0/+1
the ssize_t is defined there. Change-Id: Ie46d196347ab91d0a92c15f331db14fe3b57061c Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2021-03-04libmemif: verify length of transmitted buffersJakub Grajciar1-3/+4
In memif_tx_burst verify that total buffer size (data_offset + data_len) does not exceed buffer size. If not valid returns MEMIF_ERR_INVAL_ARG. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ifae8f92344a401febbc1efd22c301356ccf83d44
2021-03-04libmemif: socket filename length 108Jakub Grajciar2-27/+3
Dynamic size array was causing trouble in strlcpy. LINUX allows for max 108 filename length, so we can use that to make the array constant size. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I76b1fc41f9d93cfbc9ad11bdca0c96a1fc261e84
2021-02-08libmemif: fix insecure uses of strncpyAndrew Yourtchenko4-45/+67
A calling patterm of "strncpy(dst, src, strlen(src))" invites a lot of troubles. However, even using the target size may result in a problem if the string is longer, since then the termination is not done. Use strlcpy(dst, src, sizeof(dst)), which will always null-terminate the string. Change-Id: I8ddaf3dc8380a78af08914e81849279dae7ab24a Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2021-02-08libmemif: set data offset for memif bufferJakub Grajciar1-2/+25
Update descriptor offset based on data pointer in memif_buffer_t. Slave only, master will not modify the descriptor. Type: feature Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ice1e94cec366face650c58df81795f4dea727010
2021-02-05libmemif: fix memif_refill_queueJakub Grajciar1-5/+6
Fix arithmetic error in memif_refill_queue., where some of the buffers didn't get properly refilled. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I9815a8ac9b899216581452c352e75e2a0454cbce
2021-02-05libmemif: set next free bufferJakub Grajciar2-0/+41
Adds memif_set_next_free_buffer - set internal pointer to next free descriptor for any tx queue. Type: feature Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ia24345a886a52c25c1723c6dbce023f2aed4a42c
2021-01-21libmemif: buffer enqueue refactorJakub Grajciar3-75/+121
Refactored memif_buffer_enq_tx - dequeue buffers from any queue (rx/tx) and enqueue them to any tx queue. Added memif_buffer_requeue - swap descriptors of provided buffers. Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I8482824df920aaaf8325d52a297ed57a815aaba6
2020-12-04libmemif: clean up typosPaul Vinciguerra10-46/+46
Type: style Change-Id: I0d25d922312dfd60a665916cf47c3d2faa29ea49 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-09-09docs: Fix create memif cliNathan Skrzypczak3-4/+4
Type: docs Change-Id: I91a954abf77335e1ddcbd1468633d9d7980bbac2 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-05-18libmemif: cleanup typosPaul Vinciguerra7-42/+42
cleaned up typos in documetation while doing a read through. Type: style Change-Id: Id8abbd8d6297ee10490c12a8e62097224f7ec1e1 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-05-08build: various improvementsDamjan Marion4-26/+91
- add option to install only host tools - add option to specify lib and runtime dir Type: improvement Change-Id: I6356b52df459120fc9b0127948bae7679fb10e52 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-06docs: clean up make docs jobPaul Vinciguerra2-2/+2
Type: docs Change-Id: I9b5e5137eb4c1e89f6e8d7a278cd11a0fd496471 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-03-21libmemif: don't consume rx queue interrupt, if memif_rx_burst failsJan Cavojsky3-5/+16
Type: fix Signed-off-by: Jan Cavojsky <jan.cavojsky@pantheon.tech> Change-Id: Ic6c15c88c80c4045c290cd78533be6f070c7470a
2020-01-27libmemif: memif_control_fd_update always pass context from libmemif_mainJakub Grajciar3-17/+23
Event polling instance is always identified by libmemif main private context. Fixes event polling handled by libmemif. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I51dcdb279b18f8ce97bad3b2695848e0b25a232d
2019-11-05libmemif: reset number of queues on disconnectJakub Grajciar1-9/+6
Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: If4df47b1109ac90d4d5834b3aa7d326f6b3761d2
2019-09-09libmemif: prevent crash in case of invalid connection handleJakub Grajciar1-9/+31
Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I803c86a48e0148ef143026a5cd93e4510c4f0611 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-08-21libmemif: introduce 'memif_per_thread_' namespaceJakub Grajciar9-113/+1314
APIs in 'memif_per_thread_' namespace are used to split the global database into separate databases, to improve multi-thread use cases. Using 'memif_per_thread_init' client can create separate libmemif databases (libmemif_main_t). Client will reference these databases using memif_per_thread_handle_t. Each database requires unique socket. Created interface will be stored in the same database as the socket passed in connection arguments. Example code: extras/libmemif/examples/icmp_responder_3-1/main.c Type: feature Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I261563ecc34761a76e94f20c20015394398ddfd7 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-07-26libmemif: fix autoconnectJakub Grajciar1-4/+4
Type: fix Change-Id: I426e210c47869904a01712b765db2356439f706f Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-07-25libmemif: fix chained buffer flagJakub Grajciar1-0/+1
fixes issue: MEMIF_DESC_FLAG_NEXT persisted when enqueueing stored buffers Type: fix Change-Id: I9e973ed6e0339612fe1dd3e3bd80ed7c05093791 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-07-02libmemif: version 3.0Jakub Grajciar12-339/+423
Add support for multi-thread connection establishment. - control_fd_update() callback now passes private context associated with updated file descriptor. File descriptor can belong to memif socket, memif connection or timerfd. In case of timerfd the context is NULL. - memif_create_socket() new API. Creates memif socket handle to be passed to memif_create() in memif_conn_args_t. This API allows to pass private context whenever the file descriptor is updated. - memif_delete_socket() new API. Deletes memif socket. Socket must not be in use by any interface. Type: feature Change-Id: I7ca4e4349595d4477195f1c32403d3e3a6eb5361 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-07-01libmemif: icmp-responder example buffer management fixJakub Grajciar1-5/+8
Type: fix Change-Id: Ieeb763f282ee929a121585747119f458c00056ae Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-06-07build: add -Wall and -fno-common, fix reported issuesBenoît Ganne8-45/+14
Type: refactor Change-Id: I8489ccd54411c2aa9355439c5641dc31012c64a2 Signed-off-by: Benoît Ganne <bganne@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-04-08fixing typosJim Thompson1-1/+1
Change-Id: I215e1e0208a073db80ec6f87695d734cf40fabe3 Signed-off-by: Jim Thompson <jim@netgate.com>
2019-03-04libmemif: Connection request APIsJakub Grajciar4-84/+147
Add APIs that allow changing reconnect timer and request connection. First connection request is automatically sent once slave interface is created. Change-Id: Ie3558b7b94a780b046755f7f0ac6c3dcf07633e4 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-01-04libmemif: fix incorrect write leading to memory corruptionKoichiro Den1-3/+3
in the worst case scenario this leads to segfault in a hard-to-debug way. Change-Id: I165adae0bd2dee26af777a2665c8c124d3a49808 Signed-off-by: Koichiro Den <den@klaipeden.com>
2018-12-18Remove autotools files from extras/libmemifMauro Sardara3-117/+0
Change-Id: I6c5f7ab5bb6c0022746d3feedd71b5981f31c7fb Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
2018-12-17libmemif: fix possible segfault on memif_get_detailsKoichiro Den1-31/+28
insufficient buflen does not mean immediate return but fallthrough by design so assigning values to these array elements should just be skipped in that case. Change-Id: Iaa9718db073108e44a9b05e1c8ffb0725147ff1f Signed-off-by: Koichiro Den <den@klaipeden.com>
2018-12-17Added CMake building system for libmemifmsardara12-69/+367
Added Cpack support for building libmemif DEB/RPM packages Fixed compilation errors in libmemif test and examples Change-Id: I59a237a4ca8eb08840857d5b0e666f3a8d74411d Signed-off-by: msardara <msardara+fdio@cisco.com>
2018-09-27libmemif: external region bugfixJakub Grajciar2-2/+5
Change-Id: I7dbece80dda917ff78f53f8f4074132895aed316 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-09-07libmemif: slave connecting bugfixJakub Grajciar3-48/+70
in case first connecting slave fails continue connecting others add disconnect string to memif details Change-Id: I9d83db4724de1cab60786dca566e004016cf1e59 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-08-30libmemif: external region supportJakub Grajciar9-123/+1460
region 0: descriptors region 1: buffers (external) Change-Id: Ia728967817b4c78bc00f8eed44606d0c5bc386b0 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-07-11memif: fix max number of ringsDamjan Marion1-1/+1
Change-Id: Ie7621a38a44e7c692e23e58c43d27d8d2aab43e6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-06-28libmemif: fixing head/tail arithmetics & queue reallocationMilan Lenco2-11/+6
Change-Id: Ibc1f01b1cc99e7be77e892e53b7e1283f2a145cf Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2018-04-26libmemif: fix build on ununtu 18.04 (VPP-1244)Damjan Marion1-0/+1
Change-Id: If830dc0c8171b14c8a686db899885e26628a6f91 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-04-24libmemif: fix implicit declaration of memfd_createJakub Grajciar1-0/+1
Change-Id: Icdeaad1d5df63bd5e9426958a3b73582bbd226b7 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-04-12libmemif: fix clang compilation errors/warningsJakub Grajciar3-16/+15
Change-Id: I09444281a932d367162a10b90c3759db71c03350 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-03-30libmemif: zero-copy-slave mode + header spaceJakub Grajciar10-72/+1696
Slave is now able to dequeue buffers from rx queue and enqueue them to tx queue (zero-copy operation). Slave can produce buffers with headroom, which will allow adding encap without copy. Change-Id: Ia189f8de1a68be787545ed46cf78d36403e7e9bf Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-03-28Build libmemif as part of verify jobDamjan Marion4-7/+11
Change-Id: I7e808b5bcbb74343a4ed6782f115ed07e9bfe3a6 Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-03-28libmemif: add private header size fieldJakub Grajciar4-2/+10
Change-Id: I09567c8ee9c92e91918840f80942a005069d9842 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-03-26libmemif: version 2Jakub Grajciar16-918/+620
Change-Id: Ia2532695aa9199d2a7b684aebef43df0b8235531 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-03-13libmemif: ubuntu 18.04 build fixJakub Grajciar4-15/+23
Change-Id: I6624cacd625eea6a9b8214f67d14ec162e2c0195 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>