summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif
AgeCommit message (Collapse)AuthorFilesLines
2023-05-16memif: fix coverity warningsMarvin Liu3-8/+7
Type: fix Signed-off-by: Marvin Liu <yong.liu@intel.com> Change-Id: Ie3f390be16df81f6824344034377f9a6f4fa9f92
2023-04-25memif: support dma optionMarvin Liu8-20/+925
Introduce async model into memif by utilizing new DMA API. Original process is broken down to submission stage and completion stage. As multiple submissions may in flight simultaneously, per thread data is no longer safe, now replace thread data into each dma data structure. As slave side already support zero copy mode, DMA option is only added in master side. Type: feature Signed-off-by: Marvin Liu <yong.liu@intel.com> Change-Id: I084f253866f5127cdc73b9a08c8ce73b091488f3
2023-03-14memif: don't leak error strings in API handlersDamjan Marion1-4/+4
Type: fix Fixes: ab4d917 Change-Id: I226044f64e1577033798fd203a2e981c894830d6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-03-06memif: fix input vector rate of memif-input nodeLiangxing Wang1-1/+4
Explicitly set the ptd->n_packets to 0 if no packet is received in memif_device_input_inline(). Otherwise ptd->n_packets just keeps last time rx packets number, then this stale number is added to memif_input_node->vectors_since_last_overflow in every dispatch_node() call for memif_input_node. Type: fix Signed-off-by: Liangxing Wang <liangxing.wang@arm.com> Change-Id: Ide98a481c925262f9a609535a314f784cab424d8
2023-03-06memif: autogenerate socket_idsNathan Skrzypczak5-0/+181
This patch adds an API memif_socket_filename_add_del_v2 that allows autogenerating memif socket_id when passing ~0 in the socket_id field. It opportunistically walks the hash to find a free ID to use, and returns it in the reply. socket_filename also becomes a variable length string, to accomodate for longer names (in case a netns gets passed) Type: feature Change-Id: I33fc3e1cf553af27579d6bad8691b22b530531cc Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2023-02-06vppinfra: refactor clib_socket_init, add linux netns supportDamjan Marion4-137/+76
Type: improvement Change-Id: Ida2d044bccf0bc8914b4fe7d383f827400fa6a52 Signed-off-by: Damjan Marion <dmarion@me.com>
2023-02-01memif: improve error reportingDamjan Marion4-122/+62
Type: improvement Change-Id: I12b120d988347cced3df82810e86dc2fd5cfca80 Signed-off-by: Damjan Marion <dmarion@me.com>
2022-08-30memif: Process bad descriptors correctly in memif_process_descSteven Luong1-10/+35
When there is a bad descriptor, it may in the beginning, in the middle, or at the end of the batch if the batch has more than 3 descriptors. When processing a bad descriptor is encountered in the batch, we need to rollback n_buffers in memif_process_desc(), or the statement in the same function memif_add_copy_op (ptd, mb0 + src_off, bytes_to_copy, dst_off, n_buffers - 1); is wrong because it picks up the wrong buffer_vec_index of the bad descriptor while parsing a good descriptor immediately following the bad descriptor. n_buffers was incremented in the beginning of while (n_left) loop. The other problem is we should count the number of bad packets and reduce ptd->n_packets to get the correct number of packets for subsequent processing in device_input. The last fix is to check if n_buffers == 0 in device_input and skip doing any descriptor copy. This case can happen when all the descriptors are bad in the batch. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I28ed1d87236b045657006755747b5750a9a733be
2022-08-17memif: crash on recceiving a bad descriptorSteven Luong1-1/+1
We validate each descriptor via memif_validate_desc_data and set desc_status to non-zero for the corresponding descriptor when the descriptor is bad. However, desc_status is not propagated back to xor_status in memif_validate_desc_data which eventually sets ptd->xor_status. Not setting ptd->xor_status causes us to treat all descriptors as "simple". In that case, when we try to copy also the bad descriptors to the buffers, it results a crash since desc_data is not set to point to the correct memory in the descriptor. The fix is to set xor_status in memif_validate_desc_data such that if there is a bad descriptor in the frame, "is_simple" is set to false and we have to selectively copy only the good descriptors to the buffers. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I780f51a42aa0f8745edcddebbe02b2961c183598
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion3-5/+3
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-22memif: fix the maxmimum number of txqsMohsin Kazmi1-1/+1
Type: fix With multi-txq in VPP, user should be able to create more txqs than vpp threads. MEMIF_MAX_M2S_RING should be defined to 256 instead of number of vpp threads. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I337c3a5ea691470815653ff2dbfa862bb324b240
2022-03-18memif: fix rx/txqueue RC on connectedNathan Skrzypczak1-9/+12
Type: fix Calling vnet_hw_if_register_tx_queue should be done with the worker barrier held, as virtio-pre-input might be grabbing a queue while a memif connect event is triggered. Change-Id: Ie1272cdfd2477faf7a4e10f30778279872f04916 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2022-03-15memif: fix memif_process_desc indexingMauro Sardara1-4/+2
The index i was incremented in the wrong place, and the check on the presence of a next buffer in the chain was actually done for the next desc_status rather than the current one. Type: fix Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I74a64a34fea497900b7969cd96e1aeeb570a1bba
2022-02-18vnet: add set_max_frame_size callbacks for several interfacesArtem Glazychev1-0/+9
This is required after distinguishing between max_frame_size and MTU Type: fix Signed-off-by: Artem Glazychev <artem.glazychev@xored.com> Change-Id: Ie642bee4e30ca76903bb8be5eeb6914c2c09bf35
2022-02-13memif: Fix underflowNathan Skrzypczak1-2/+2
Type: fix Change-Id: Id183c47328510b5db7ffcc7a4dfb41f5a3151399 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2022-02-07memif: memory leak when deleting memif interfaceSteven Luong1-0/+1
When deleting a memif interface, there is a memory leak in mif->local_disc_string. The code that leads to memory leak is memif_delete_if -> memif_disconect -> vec_dup Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I579c743c3d47770131153e083e65f6cd899067b3
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>