summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif
AgeCommit message (Collapse)AuthorFilesLines
2022-01-07ethernet: new interface registration functionDamjan Marion1-4/+7
Prep for supporting multiple callbacks, optional args, etc. Type: improvement Change-Id: I96244c098712e8213374678623f12527b0e7f387 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-05interface: refactor interface capabilities codeDamjan Marion1-3/+1
Make it shorter to type, easier to debug, make adding callbacks in future simpler. Type: improvement Change-Id: I6cdd6375e36da23bd452a7c7273ff42789e94433 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-12-22memif: refactor descriptor handling in the input nodeDamjan Marion3-184/+446
Type: improvement Change-Id: I06130447b4e6f4726c4f5bffbe606385c45b8bd4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-12-08memif: fix the memory leak when memif cli getting wrong parameters inputsHan Wu1-4/+12
Type: fix Signed-off-by: Han Wu <wuhan9084@163.com> Change-Id: I0aeafd273b3d1d01df02d638c72461943f91ef90
2021-12-03interface: add multi tx-queues support for new tx infraMohsin Kazmi1-2/+2
Type: feature Change-Id: I231f782b3c56dc2b10321e4569ac7acdad1c11da Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-11-15memif: fix the coverity warningMohsin Kazmi1-5/+8
Type: fix Fixes: 2bae16b238bd ("memif: fix the default txq placement") Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I8fbb2aa92dc31d84a5cd0f7b9a3c7f39dfb064ee
2021-11-12memif: fix the default txq placementMohsin Kazmi1-3/+9
Type: fix Fixes: 3effb4e63068 ("memif: integrate with new tx infra") "memif: integrate with new tx infra" patch integrated memif with new tx infra. There might be scenarios when txqs were less than vpp threads, in which case, txqs should be shared among threads. This patch fixes it. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I1c64a1370f5024240ab56311f75665db31714b60
2021-11-09memif: memif linkstate can't become upDaniel Béreš1-1/+8
Admin down implies Link down but nothing came with admin up. Ticket: VPP-1959 Type: fix Change-Id: I43725329ae7918659c73d703280c25de5f0b1d14 Signed-off-by: Daniel Béreš <daniel.beres@pantheon.tech>
2021-10-16memif: Enhance show memif descriptors to display regionSteven Luong1-14/+13
memif descriptors table may have more than one shared memory region. To see whether a descriptor's memory address is valid or not, it is beneficial to also display the descriptor's region. While at it, fix the truncation problem for the offset field. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ia3b7062ac0323c39ade6f3a58333c6405889148f
2021-10-12memif: fix the memif crash when slave disconnectMohsin Kazmi1-1/+2
Type: fix Fixes: 3effb4e63068 ("memif: integrate with new tx infra") memif is recently integrated with new tx infra. But it introduces a crash when slave disconnect from master but interface is not deleted. Disconnect routine was missing unregister of all tx queues. This patch fixes it. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I81c59cc1a03561248ec8595d5e3caa54f421833e
2021-10-04memif: integrate with new tx infraMohsin Kazmi3-15/+17
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I7c2b9891e269f23c3aa2a0abfee3cf0a0f1e2135
2021-09-27misc: api move continuedFlorin Coras1-2/+1
Move control ping and change dependencies from vpe.api_types to memclnt.api_types Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9f8bc442e28738c48d64d1f6794082c8c4f5725b
2021-09-17memif: avoid double pool_put on a clib_fileSteven Luong1-1/+2
When memif CP processes the socket connection error, it may go through the following code paths which may eventually cause double pool_put on a clib_file memif_master_conn_fd_error:633 -> memif_disconnect -> memif_socket_close -> memif_file_del_by_index -> clib_file_del_by_index -> clib_file_del -> pool_put After memif_master_conn_fd_error:633, the code continues on memif_maser_conn_fd_error:651 -> memif_file_del -> clib_file_del -> pool_put The fix is to skip calling memif_file_del in memif_master_conn_fd_error:651 if uf->file_descriptor == ~0 to catch problem from all possible paths in memif_master_conn_fd_error Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0960998db1ff358a8ddd4a5e22188a244eccd270
2021-08-04memif: fix offsetArtem Glazychev1-1/+1
signs were changed here when calculating the offset: d78ba5aa01ff1415bff0b06069ce21e0a78df89c Type: fix Signed-off-by: Artem Glazychev <artem.glazychev@xored.com> Change-Id: I62b7a409caaf478e40efbdd6000922dcc7e92860
2021-07-15misc: replace CLIB_PREFETCH with clib_prefetch_{load,store}Damjan Marion2-16/+12
Type: refactor Change-Id: Id10cbf52e8f2dd809080a228d8fa282308be84ac Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-06-30memif: fix tx desc length for chained buffers in copy modeBenoît Ganne1-0/+1
When enqueuing chained buffer, we must update the descriptor length for each fragment descriptor in addition to the last. Type: fix Change-Id: I9bc95fe557a049eeea4abd41c695153632d52a52 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-06-30memif: fix chain buffer length in zero-copy modeBenoît Ganne1-0/+1
The total_length_not_including_first_buffer field must be reset before being updated otherwise it will quicly grows as stale values are reused. Type: fix Change-Id: Ic48c0822660998b0dfc0b5fdeadae6071b2d03f7 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-06-11memif: fix crash with zero-copy slaveDamjan Marion1-1/+1
Type: fix Change-Id: I456cc0b0a6f2dc32b14791baf9d4a7f67279e8df Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-06-10memif: fix the spinlock and unlock issue.fangtong1-1/+2
when the configuration of tx queues is larger than the worker-threads, the clib_spinlock_lock_if_init will not be executed, and then this function will executed the clib_spinlock_unlock_if_init, so this may caused the issue. Type: fix Signed-off-by: fangtong <fangtong2007@163.com> Change-Id: I3ce244cd5e1f410e9f14bd060b929238f069b9fa
2021-05-26vppinfra: explicit blocking mode for sock connectsFlorin Coras1-2/+3
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3a33230de13fef613dc9523cf24a9968d200c2e5
2021-05-21memif: fix gcc-10 build error on arm platformTianyu Li1-1/+1
In function ‘memcpy’, inlined from ‘memif_device_input_zc_inline’ at src/plugins/memif/node.c:850:7, string_fortified.h:34:10: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/plugins/memif/node.c: In function ‘memif_input_node_fn_neoversen1’: src/plugins/memif/memif.h:175:16: note: at offset 0 to object ‘desc’ with size 0 declared here 175 | memif_desc_t desc[0]; | ^~~~ Using C99 way empty brackets for flexible array members Type: fix Signed-off-by: Tianyu Li <tianyu.li@arm.com> Change-Id: I7a6ad89f95e1b5e3f9aac36546a2559dbda9bd6c
2021-05-20memif: fix input node buffer prefetchTianyu Li1-4/+4
Prefetch should be the next group of buffers instead of current buffers Type: fix Signed-off-by: Tianyu Li <tianyu.li@arm.com> Change-Id: If13967e27f74c10856ae48892420d7ade6f0c92c
2021-05-19memif: remove dead codeDamjan Marion1-1/+1
Type: fix Change-Id: I6fce8c1f91fc5080271c1832bf40a9fb6bbcb7e3 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-17memif: remove unused codeDamjan Marion1-46/+13
Type: refactor Change-Id: I127b8c7131fd993a5fe605c7c36cc1d0b6672984 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-17memif: remove duplicate code in txDamjan Marion1-53/+39
Type: refactor Change-Id: Idb82e28ee2e370ae8fc1becc2f8b92a548bc6b1b Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-17memif: optimize zero-copy rx ring refillDamjan Marion2-65/+47
Type: improvement Change-Id: I8169da230eb5f74651810a8e2490895620c38269 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-17memif: fix "remove barriers" commitDamjan Marion1-2/+2
Type: fix Change-Id: I60bb0261c05bf7e25ca01c72780f1cd77fde7a9a Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-17memif: remove barriersDamjan Marion2-22/+33
Type: improvement Change-Id: Idef30aee80b654ce424b6f1f1f730574ca68874c Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-13tests: move test source to vpp/testDave Wallace2-448/+0
- Generate copyright year and version instead of using hard-coded data Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e
2021-05-08memif: Fix delete on errorNathan Skrzypczak1-8/+0
Type: fix Change-Id: I3cc09630cae999cc194a0eedb4d2cfee7a826b76 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-05-06vlib: rename vl_counter_t to vlib_error_desc_tOle Troan2-2/+2
Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I368b0410db2d633d3c52199c840e24d21952c1b4
2021-05-06memif: add severity to countersOle Troan2-14/+14
Also rename counters in stat segment to make them more filesystem friendly. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I8a3f3ec318931f5475fcb181f8b4a079a1fa4b9c Signed-off-by: Ole Troan <ot@cisco.com>
2021-05-01vlib: refactor trajectory trace debug featureBenoît Ganne1-2/+0
trajectory trace has been broken for a while because we used to save the buffer trajectory in a vector pointed to in opaque2. This does not work well when opaque2 is copied (eg. because of a clone) as 2 buffers end up sharing the same vector. This dedicates a full cacheline in the buffer metadata instead when trajectory is compiled in. No dynamic allocation, no sharing, no tears. Type: refactor Change-Id: I6a028ca1b48d38f393a36979e5e452c2dd48ad3f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-04-18vppinfra: remove linux/syscall.hDamjan Marion1-1/+0
For portabiliy reasons it is better to have all wrapped in clib code. I.e. instead of using getcpu() we have clib_get_current_numa_node () and clib_get_current_cpu_id(). Type: refactor Change-Id: I29b52d7f29bc7f93873402c4070561f564b71c63 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-04-16tests: cpus awarenessKlement Sekera1-1/+14
Introduce MAX_CPUS parameters to control maximum number of CPUs used by VPP(s) during testing, with default value 'auto' corresponding to all CPUs available. Calculate test CPU requirements by taking into account the number of workers, so a test requires 1 (main thread) + # of worker CPUs. When running tests, keep track of both running test jobs (controlled by TEST_JOBS parameter) and free CPUs. This then causes two limits in the system - to not exceed number of jobs in parallel but also to not exceed number of CPUs available. Skip tests which require more CPUs than are available in system (or more than MAX_CPUS) and print a warning message. Type: improvement Change-Id: Ib8fda54e4c6a36179d64160bb87fbd3a0011762d Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-04-08memif: Use log_debug for clib_file_add and clib_file_delSteven Luong1-15/+24
It is more appropriate to use log_debug instead of log_warn when inoking clib_file_add and clib_file_del. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I544d97037cfca3f22ce94242aef0c7b0fea2fa9b
2021-03-26vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()Damjan Marion3-4/+4
Type: improvement Change-Id: If3da7d4338470912f37ff1794620418d928fb77f Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-19interface: add capabilities flagsMohsin Kazmi1-1/+1
Type: improvement This patch adds flags to represent the modern NICs capabilities. Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-03-04memif: Validate descriptors within process boudarySteven Luong1-20/+27
We hit a crash when the client sends us a bogus deescriptor which causes us to access memory beyong the mapping. While the client clearly should not do that, it is rather cheap for VPP to validate the descriptor instead of crash and burn. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id09035810939f5f98530f212f0b23e606132251d
2021-01-22tests: add generalized tags for tests, use them for run-solo testsAndrew Yourtchenko1-4/+2
We have accumulated several scenarios in prod or wishlists where it would be useful to have a general infra to say yes/no about a certain test, and potentially make decisions based on that, for example: - runs solo (aka 'time-dependent') - (wishlist) part of quick smoke-test set - (wishlist) intermittent failure unrelated to timing - (wishlist) test broken with a multi-worker config in vpp Refactor the current "run-solo" code to allow for this extension. Type: test Change-Id: Ia5b3810e57c0543753c8e0dc4dc0cfb4a30b36ac Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-01-21memif: adapt to new rxq frameworkMohammed Hawari3-61/+59
Change-Id: Ifa8bccd8a34ec1b14e772ee53757e9083373e3de Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: feature
2021-01-20memif: fix vpp to go link up immediately on admin upEd Warnicke3-16/+23
Type: improvement Previously, memif would check every 3 seconds to see if an interface had gone admin up. Now it does as soon as admin up occurs. Signed-off-by: Ed Warnicke <hagbard@gmail.com> Change-Id: I808699cd5980fa162c34ac977f43d00ed6b67115 Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion3-8/+7
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-04libmemif: clean up typosPaul Vinciguerra4-4/+4
Type: style Change-Id: I0d25d922312dfd60a665916cf47c3d2faa29ea49 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-03tests: remove py2/py3 six compatability libraryPaul Vinciguerra2-3/+0
Type: test Change-Id: Idb6b8169845e0239e639429ccfd02a683212b7e6 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-11-09vlib: fix trace number accountingBenoît Ganne1-8/+11
When using classifier to filter traces, not all packets will be traced. In that case, we should only count traced packets. Type: fix Change-Id: I87d1e217b580ebff8c6ade7860eb43950420ae78 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-10-26memif: handle unexpected EPOLLOUT for RX queueSteven Luong1-0/+12
Getting an unexpected EPOLLOUT for RX queue and crashing due to missing callback function on write_function to handle EPOLLOUT. (gdb) f 5 f 5 node=<optimized out>, vm=0x7f948bbe4540 <vlib_global_main>) at /vpp/src/vlib/unix/input.c:325 325 errors[n_errors] = f->write_function (f); (gdb) p *e p *e $21 = {events = 4, data = {ptr = 0x23, fd = 35, u32 = 35, u64 = 35}} (gdb) p file_main.file_pool[e->data.fd] p file_main.file_pool[e->data.fd] $22 = {file_descriptor = 37, flags = 1, polling_thread_index = 0, private_data = 65536, read_function = 0x7f944a87b140 <memif_int_fd_read_ready>, write_function = 0x0, error_function = 0x0, description = 0x7f944be22400 "memif0/1 rx 0 int", read_events = 0, write_events = 1, error_events = 0} (gdb) File descriptors are recycled. It is likely that the EPOLLOUT is meant for the previous owner of the same file descriptor number which memif recycled and memif RX did not expect to receive an EPOLLOUT. For defensive play, we create a dummy callback function to ignore the EPOLLOUT instead of crashing. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I535cadbb9b71d3db2995b118c59a12c71f10af09
2020-10-12misc: clang-11 and gcc-10 supportDamjan Marion1-1/+1
clang-11 complains: error: field 'buffer_template' with variable sized type 'vlib_buffer_t' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] Type: improvement Change-Id: I2cb6b4fde723a05b42cf33dd8130df074f0362ab Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-08interface: shorten vnet_hw_if_rx_modeDamjan Marion2-5/+5
This is part of bigger refactor. Type: refactor Change-Id: I6fc2c0a1e2d217a70952901bcf775b8485bd3c20 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-02memif: map shared memory with clib_mem_vm_map_shared(...)Damjan Marion1-10/+25
Type: improvement Change-Id: I91031d56aae884a0a42fca343a2fc24c442b1da8 Signed-off-by: Damjan Marion <damarion@cisco.com>