aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
AgeCommit message (Collapse)AuthorFilesLines
46 hoursvcl: allow more rx events on peekHEADmasterFlorin Coras1-1/+10
If peek touches all data in the fifo, unset fifo event to request new events when more data is enqueued. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I878fa017f18ada5cef557600673bba920f230542
2024-03-29session: improve use of session handlesFlorin Coras1-3/+3
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 Coras1-1/+13
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iaa1b026e2baea1c03f8c75e7d6879d0ff6d379d6
2024-03-12misc: remove GNU Indent directivesDamjan Marion1-2/+0
Type: refactor Change-Id: I5235bf3e9aff58af6ba2c14e8c6529c4fc9ec86c Signed-off-by: Damjan Marion <damarion@cisco.com>
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>
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-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-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-21vcl: ldp support SO_ORIGINAL_DSTqinyang1-0/+32
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-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 Coras1-1/+1
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 Coras1-29/+12
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-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 Coras1-6/+11
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-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-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: 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-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 Coras1-52/+34
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1970408de52e53d24cea06b3ae0cc68a38cbc97a
2023-02-20vcl: ldp support for ip_pktinfoFlorin Coras1-11/+62
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c15f38a4a3f5e92506059277948e7fca9cd8b55
2023-01-13vcl: set deq notify flag on epoll connected sessionsFlorin Coras1-0/+4
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I021f8e8bba247b0050d390a37dbc75900dc6a598
2022-12-14vcl: enable gso for 'sendmsg' in LDP mode.Dou Chao1-11/+17
Some upon apps(e.g. Nginx-quic) package it's several protocol buffers into a struct msg which is a combination of gso_buffer and gso_size. but if HostStack regardless the gso_size to the buffer and split the buffer with default mss, that cause peer client failed on parsing the package. Type: improvement Signed-off-by: Dou Chao <chao.dou@intel.com> Change-Id: I805eb642be826038ba96d1b85dad8ec0c0f6c459 Signed-off-by: Dou Chao <chao.dou@intel.com>
2022-10-27vcl: register workers when reattaching to vppMaros Ondrejicka1-2/+45
Type: improvement Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I82a286e2872338974c1930138c30db78103ae499
2022-10-06vcl: add api to check if vcl disconnected from vppMaros Ondrejicka1-0/+11
Type: feature Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I98bc108360f9d04a33126865ce49d2702cbe9cdf
2022-09-27vcl: repatch "align the RST behaviour with kernel"Yacan Liu1-1/+1
The previous patch[37164] was a bit flawed. Type: fix Signed-off-by: Yacan Liu <liuyacan@corp.netease.com> Change-Id: Ia9d8b9c7853e8f4b960ce7de26d0384243deb667
2022-09-20vcl: align the RST behaviour with kernelYacan Liu1-1/+13
When ESTABLISHED TCP connection is terminated by an RST packet, EPOLLHUP + EPOLLRDHUP would be updeliever by VCL. If not using VPP, app would receive EPOLLHUP + EPOLLERR + EPOLLIN(if requested) + EPOLLRDHUP(if requested). libevent will interpret the two cases as different EV combinations. Below is the code snippet for libevent v2.12: if (what & EPOLLERR) { ev = EV_READ | EV_WRITE; } else if ((what & EPOLLHUP) && !(what & EPOLLRDHUP)) { ev = EV_READ | EV_WRITE; } else { if (what & EPOLLIN) ev |= EV_READ; if (what & EPOLLOUT) ev |= EV_WRITE; if (what & EPOLLRDHUP) ev |= EV_CLOSED; } Type: fix Signed-off-by: Yacan Liu <liuyacan@corp.netease.com> Change-Id: Ice3d2861183b6ea499f66b727bbe175eeae5cb05
2022-07-20vcl: new vcl api to get detailed session errorsRadha krishna Saragadam1-0/+32
Sometimes VPP rejects application connection requests due to various reasons. Some errors application can retry to get a successful connection. In a non-blocking session, VCL sends EPOLLHUP. An application can call a new API vppcom_session_get_error to find the details and retry depending on the error. Type: fix Signed-off-by: Radha krishna Saragadam <krishna_srk2003@yahoo.com> Change-Id: If0e21a8e25701f66a190a2799b2209e0c31f897c
2022-06-30vcl: check if listener valid on disconnect cleanupFlorin Coras1-1/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie057d0d5a51d3226a1a188cf9d48a5d82dc4a3c7
2022-06-10vcl: fix iperf3 server crash issue when it runs over vpp host stack.Liangxing Wang1-1/+8
Issue: Let iperf3 server run via ldp and vcl on top of vpp's host stack. If iperf3 client connects this iperf3 server with tcp MSS setting option, iperf3 server will always crash. Root cause: When MSS option is specified by iperf3 client, iperf3 server will recreate the listening socket firstly, then call setsockopt() to set MSS immediately. Iperf3 code can be referred here: https://github.com/esnet/iperf/blob/58332f8154e2140e40a6e0ea060a418138291718/src/iperf_tcp.c#L186. However, in vcl layer vpp_evt_q of this recreated session is not allocated yet. So iperf3 server crashes with vpp_evt_q null pointer access. Fix: Add session vpp_evt_q null pointer check in vcl_session_transport_attr(). Add a vcl test case for this MSS option scenario. Type: fix Signed-off-by: Liangxing Wang <liangxing.wang@arm.com> Change-Id: I2863bd0cffbe6e60108ab333f97c00530c006ba7
2022-03-31vcl: fix api detach if attach failedFlorin Coras1-1/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idd1df83bb01951c2455b23c08e3cc1fcd9b91064
2022-02-17vcl: add support for reconnectFilip Tehlar1-0/+52
Supported only when eventfd option is enabled. Type: feature Change-Id: Ic9d6e38604e978f7bc8e54d74fe9b8f3fc53622d Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2022-01-19svm: update number of segments in svm_fifo_segmentsFlorin Coras1-1/+1
In addition to returning the number of bytes also update the number of segments to reflect the number used. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia87dc2aa62cea38b18dfa83df94dc2abe29d5121
2021-12-08vcl: validate closed sessions on disconnect and resetFlorin Coras1-2/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0375d639e979e29d287dc9fee16b0434fb5c788b
2021-12-07vcl: debug code improvementsFlorin Coras1-36/+33
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I18cd4131c692e776c98eba36161813035e9dec53
2021-12-07vcl: handle reordering of disconnect and reset msgsFlorin Coras1-11/+59
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I817e8510029a060876697701b81a952286597db1
2021-11-30vcl: improve handling of failed connectsFlorin Coras1-10/+13
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If6235888cb0870ec3e1279ab1856a00715bd6c68
2021-11-30vcl: avoid ip format function vnet dependencyFlorin Coras1-167/+59
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I89103d4c99b21c5a466dbe511f0151bd754559a0
2021-11-15vcl: add DSCP support in VCLFilip Tehlar1-0/+13
Type: feature Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I835675267c997b5dc92a0aaccdb58648bc786bb9
2021-11-11vcl: notify vpp if connected inexistent sessionFlorin Coras1-1/+11
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6939a0cdb02067440dce01cb0771f07099ca841e
2021-11-03vcl: fix event triggered after closing connections.liuyacan1-1/+15
Improve the accuracy of epoll event(EPOLLRDHUP). Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: Ia31e696a0666c417ca99e684c6a4515f1cafc646