aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
AgeCommit message (Collapse)AuthorFilesLines
7 daysvcl: Only exclude vcl ldpreload on FreeBSDTom Jones1-5/+4
Previously all of the vcl library was excluded from the build on FreeBSD, this was too agressive as only the ldpreload component requeres platform specific implementation for FreeBSD Type: improvement Change-Id: I94e70d7730878cc98060561eedf07cb7e4d1868a Signed-off-by: Tom Jones <thj@freebsd.org>
2024-03-29session: improve use of session handlesFlorin Coras2-5/+5
First step towards moving to an 8 byte struct instead of u64. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idd0b95520ab7158e175b9af1702fc09c0613a4bb
2024-03-25vcl: add api to retrieve num bytes for txFlorin Coras3-2/+21
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iaa1b026e2baea1c03f8c75e7d6879d0ff6d379d6
2024-03-19vcl: Only build vcl_ldpreload on LinuxTom Jones1-1/+6
vcl_ldpreload requires some additional porting for FreeBSD, until that can be completed only build on Linux. Type: improvement Change-Id: I9b0942114252a0c6241640d2e454861c2b5d4304 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-03-13vcl: fix bitfield truncation with clang16Florin Coras1-1/+1
Reported by phlax while building Envoy with clang16 error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib1b731780cf27a9498299f0424a06000dc67e81e
2024-03-12misc: remove GNU Indent directivesDamjan Marion3-16/+0
Type: refactor Change-Id: I5235bf3e9aff58af6ba2c14e8c6529c4fc9ec86c Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-02-23vcl: Use FreeBSD specific errno value for bad fdTom Jones1-0/+7
Type: improvement Change-Id: I7693f2647f65f662c9b20f77bbf7e1a530b58259 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vcl: fix epollet test for unhandled evtsFlorin Coras1-1/+1
Argument to vcl_epoll_ctl_add_unhandled_event is often the result of an and between events and EPOLLET which is larger than u8 Type: fix Change-Id: I8c98f557fa1db9f3eb79c90ecdd60ac9366d4d40 Signed-off-by: Florin Coras <fcoras@cisco.com>
2024-01-09session: support for cl port reuseFlorin Coras1-4/+5
Adds support for connectionless listener port reuse. Until now, cl listeners had fifos allocated to them and therefore only one app worker could ever listen, i.e., a session cannot have multiple fifos. To circumvent the limitation, this separates the fifos from the listener by allocating new cl sessions for each app worker that reuses the app listener. Flows are hashed to app worker cl sessions but, for now, this is not a consistent/fixed hash. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic6533cd47f2765903669f88c288bd592fb17a19e
2023-12-01vcl: remove perror ldp callFlorin Coras1-1/+0
Reported by coverity Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idae1bceb1eeb6dfe0394eed39ced9d09342d201f
2023-11-29vcl: fix init of ldp workersFlorin Coras1-4/+2
LDP workers is used as vector but was initialized as a pool. There was no side effect but ASAN does not properly unpoison memory and this triggers false used-after-poison crashes. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie769dad0e86ab970de9929800d0a4131f846e70e
2023-11-07misc: silence -Wmaybe-uninitialized warningsJieqiang Wang1-1/+1
GCC 12 complains about such errors while the code itself looks good. Type: fix Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com> Change-Id: I021719fdbf7d9bd93a12eac76aeac8cbca13a810
2023-10-30vcl: propagate correctly EADDRINUSE for UDP bindMohammed Hawari1-2/+6
Change-Id: Ia8b5421cbaaf861ddb3ad7aeca53a077ff18864e Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: fix
2023-09-18vcl: unset fifo evt before size checkFlorin Coras1-6/+8
For blocking sessions, if fifo event still active before size check it could lead to vpp not generating an event because of race to check flag in vpp and to eventually unset flag in vcl. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0e350b9ff92a4e08a9249345ae224589c09d305b
2023-09-01vcl: set min threshold for tx ntfFlorin Coras1-1/+5
Make sure there's at least 3% space in the tx fifo before notifying vcl of a tx event. The threshold is somewhat arbibrary but for a 4M fifo, it now means that ~120kB of space should be available. Should help minimize the amount of tx notifications generated by session layer when apps are faster. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I11dd0931dca8f989000a2481f1f495bd267589c4
2023-08-15vcl: fix ldp epoll events array overrunFlorin Coras1-1/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3dd65946c220f958a4fda0551b053d690bf06c39
2023-08-15vcl: handle postponed disconnects with selectFlorin Coras1-5/+36
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia8449344a471129c0d148b39d97a5d310c2a1fc7
2023-08-15vcl: fix error state switch for vcl_handle_mq_eventwanghanlin1-2/+18
When a listen session receives an ACCEPTED message, but then receives either a RESET or DISCONNECTED message from VPP before the session is accepted, the listen session state is switched to VPP_CLOSING or DISCONNECT. The subsequent CLEANUP message handler attempts to send a disconneted or reset reply message to VPP, but since the vpp_evt_q for the listen session is null, this leads to a crash. Type: fix Change-Id: Ic51f78f631fe8d15bf8c56b795f4a900c3e2f724 Signed-off-by: wanghanlin <wanghanlin@corp.netease.com>
2023-08-08vcl: Fix the ldp init checkGao Feng1-1/+5
Maybe some function calls the wrapper funtion like read which invokes the ldp_init_check in the other libs as a constructor before ldp_constructor. Then the ldp has been initialized already when ldp_constructor is invoked. And it's normal case, we shouldn't treat it as an error. So ldp_init should return success if ldp is initialized already instead of an assert. Type: fix Change-Id: Ifa2a7b1d5471981a3f840b14a4fa5d48fb1f1374 Signed-off-by: Gao Feng <gfree.wind@outlook.com>
2023-08-07vcl: fix error state switch for VCL_STATE_LISTEN_NO_MQ sessionswanghanlin1-3/+4
When a VCL_STATE_LISTEN_NO_MQ session receives an ACCEPTED message, but then receives either a RESET or DISCONNECTED message from VPP before the session is unlistened, the listen session state is switched to DISCONNECT. The subsequent CLEANUP message handler attempts to send a reset reply message to VPP, but since the vpp_evt_q for the listen session is null, this leads to a crash. Type: fix Change-Id: Id7e88dcb16df3eda912b3f763730ec8d8973473a Signed-off-by: wanghanlin <wanghanlin@corp.netease.com>
2023-07-26vcl: allow rx of zero length dgramsFlorin Coras1-1/+2
Type: fix Change-Id: I438ef488357456e9415e51a17355e9eba8518808 Signed-off-by: Florin Coras <fcoras@cisco.com>
2023-07-21vcl: ldp support SO_ORIGINAL_DSTqinyang7-2/+65
Type: improvement Support SO_ORIGINAL_DST socket option to get original dst_ip4 and dst_port if nat44 rule enabled. Change-Id: If00e00d03e48f3b78a23a68f1b078954d79dd0f7 Signed-off-by: qinyang <qiny@yusur.tech>
2023-07-19vcl: zero out cmsg for recvmsg APISteven Luong1-0/+1
When msg->msg_controllen is set in recvmsg, the caller wants to receive additional information about the messages. However, they might not always be available. In that case, we should clear cmsg since the caller uses CMSG_NXTHDR which might access uninitialized fields in cmsg. Type: fix Change-Id: Ifdf9634bfcb1427f7ae3812014a46bfd7f4bc473 Signed-off-by: Steven Luong <sluong@cisco.com>
2023-06-20vcl: fix epoll lt coverity warningFlorin Coras1-3/+3
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6900d9ab147d35f99f944bf741f6bb329c8ea0df
2023-06-16vcl: no hup events in lt mode if session not epolledFlorin Coras1-24/+38
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9f7dfe086bf7e11b7e0de7392f020c1052ba656a
2023-06-14vcl: fix debug logging of mapped segmentsFlorin Coras2-2/+2
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I73034cdba51157466713884c3fbeae7054d92ad7
2023-06-06vcl: fix epoll ctl frequent deq ntf requestsFlorin Coras1-18/+30
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL should be treated as a config option that is not frequently changed. Or alternatively, it should be set together with SVM_FIFO_WANT_DEQ_NOTIF to elicit a one time tx notification. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie4132c7789ee87227a875ff981eb98f9f4d898a9
2023-06-05vcl: avoid duplicate tx events with epoll ltFlorin Coras1-1/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic6436426ead561e47fb77ed9a95afbd85f2998ae
2023-06-02vcl: refactor want deq ntf checks for null fifosFlorin Coras2-29/+28
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5d0445ca381f1a4943bb2fe454433b3454043b56
2023-05-23vcl: avoid reusing user provided events in lt modeFlorin Coras1-4/+6
Epoll events might not have been cleared by user so always compute event flags locally and assign to user provided epoll event. Type: fix Signed-off-by: Ping Yu <ping.yu@intel.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3b594a0fd7be345a0e0ad81d1d3636e9354cc15d
2023-05-19vcl: set want deq flag earlier in epoll ctl modFlorin Coras1-8/+10
On epoll ctl mod, set want deq flag before checking if unhandled events are needed. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id1491837c7156a66c21e0e45af60b04b1c18601c
2023-05-19vcl: always reset deq ntf flag in epoll evt handlerFlorin Coras1-2/+2
Reset deq notification flag even if session is no longer epolled. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4e9aed1849aa2817176f3a54ae41910df5e704a0
2023-05-16vcl: avoid skipping last event in epoll ltFlorin Coras1-4/+9
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic89256d16230593b61a7b3e29582444fb3f93e4d
2023-05-12vcl: fix ldp ioctl FIONBIO handlerFlorin Coras1-1/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ife5f72dc9587c9f6b8aa513cd039fa28bb22fca3
2023-04-28vcl: inherit connected flag on accepted cl sessionsFlorin Coras1-0/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2d1976cb8061534a7e93d4dd2283abaf70a33f7c
2023-03-14session vcl: refactor builtin tx event for main txFlorin Coras2-6/+17
Rename unused SESSION_IO_EVT_BUILTIN_TX to SESSION_IO_EVT_TX_MAIN and leverage it for non-connected udp tx. Non-connected udp sessions are listeners and are therefore allocated on main thread. Consequently, whenever session queue node is not polling main, tx events generated by external applications might be missed or processed with some delay. To solve this, request that apps use SESSION_IO_EVT_TX_MAIN tx events as opposed to SESSION_IO_EVT_TX and send that to first worker as opposed to main. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5df5ac3dc80c0f192b2eefb1d465e9deefe8786b
2023-03-10vcl: init ldp config before vcl initFlorin Coras1-26/+31
This avoids printing ldp debug messages while debug is disabled and vcl is initializing. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5dfd1d59032db937fea146b6b84b8e26307a0de0
2023-03-09vcl: fix select connected deq notificationFlorin Coras1-6/+12
Also make sure that only sessions with fifos try to set deq notification flag on fifo Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I878c2d2e18bb98109ee03b42a4f0f8c48aa23e9f
2023-03-09vcl: fix epoll out evt on connectFlorin Coras1-1/+1
Make sure session has a tx fifo. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ibde40645b401ca0255da298ea4ba691ee924a2d2
2023-03-06vcl: do not stop listeners on vls epoll delFlorin Coras1-1/+7
Although removal from epoll means listener no longer accepts new sessions, the accept queue built by vpp cannot be drained by stopping the listener. Morover, some applications, e.g., nginx, might constantly remove and add listeners to their epfds. Removing listeners in such situations causes a lot of churn in vpp as segments and segment managers need to be recreated. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia412b3f8d50fbb4881a99ff024f798353b521af7
2023-03-06vcl: always drain libc epoll with eventfds in ldpFlorin Coras1-17/+36
Otherwise if vcl epoll lt events are ignored by the app, libc and vcl mq events are never drained. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1e22f6da46d56236c52714181f6c20dcb80a33a5
2023-03-01vcl: accept bound notifications in epoll waitFlorin Coras1-0/+3
Async binds may be possible due to vls generated async binds as a result of application adding or removing listeners from epoll. App does not need to be notified of the event. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4d01be7ddb39ba894db85feef55e9935556c24f5
2023-03-01vcl: accept vcl spurious wakeup in epoll wait eventfdFlorin Coras1-1/+5
Accept one spurious wakeup from vcl in epoll_pwait_eventfd to avoid returning zero events to app without timeout. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I447c7f8176413c562be28605376a92d15e22a1f9
2023-03-01vcl: close libc epfd on vls epfd closeFlorin Coras1-7/+7
Nginx recreates epfds. Make sure ldp tracks the event and recreates the libc epfd or eventfd flavor of epoll pwait will not work. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2994bead9494f0fbb85dd32767cecc1cf69ff6eb
2023-03-01vcl: only add sessions to lt list if neededFlorin Coras1-1/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I777979dbb89f9af774533cb280e77af58b81fb29
2023-03-01vcl: fix undeclared UDP_SEGMENT for centos 8Tianyu Li1-0/+4
Old distros Centos 8 / Ubuntu 18.04 header files doesn't have UDP_SEGMENT declared, define UDP_SEGMENT to right value if not defined. Type: fix Fixes: eff5f7aea8c7 ("vcl: ldp support for ip_pktinfo") Signed-off-by: Tianyu Li <tianyu.li@arm.com> Change-Id: I99314b895e7d09962a36e7f5582c09d0d77563dc
2023-02-28vcl: use program invocation name in ldp app nameFlorin Coras1-3/+2
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2c97faa2cdca32d083aabc3344c8fe67c74ff2fd
2023-02-28vcl: handle lt events in epoll ctlFlorin Coras1-18/+26
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4e176e9ada32d5f61d10aeca1c68f72114dec9b8
2023-02-27vcl: improve vls handling of shared listenersFlorin Coras3-54/+49
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1970408de52e53d24cea06b3ae0cc68a38cbc97a
2023-02-20vcl: ldp support for ip_pktinfoFlorin Coras4-87/+245
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c15f38a4a3f5e92506059277948e7fca9cd8b55