aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-18vcl svm: fix rx event losshanlin1-2/+5
When vcl_epoll_wait_handle_mq handles rx events exceeding maxevents, VPP will not signal because cursize > 0, and the remaining rx events cannot be triggered because the eventfd event has been read. Therefore, we should dequeue all events until cursize = 0. And then handle msg up to maxevents with vcl_epoll_wait_handle_mq_event and those beyond with vcl_handle_mq_event. Type: fix Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I8a0c87cb41c837deb8284b40f668cc3c7d9d6e56 Signed-off-by: hanlin <hanlin_wang@163.com> (cherry picked from commit d0e646f6892e9c85278c9538760a8940c86dcdbb)
2020-08-18vcl: de-init vcl on destroyFlorin Coras1-0/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If3372e3edd403240c2c9da746246170549a3e644 (cherry picked from commit 69d97256d5ca5b06b4399d8369a7a4c3b544a94d)
2020-08-18vcl: allow vcl worker index to be set by applicationsIJsbrand Wijnands1-0/+6
When using vppcom_session* apis to setup TCP sessions in applications build outside of the VPP repository, it is necessary to set the worker_index explicitly when these apis are called from the none-VCL worker threads. An example is when data is to be sent to the TCP session that is originated from a different thread, like the main program thread or from the bin api thread. This change allows the application to set it. Type: fix Signed-off-by: IJsbrand Wijnands <ice@cisco.com> Change-Id: I37f3654a49ea9a8cf3a0d3d0e672583018c12299 (cherry picked from commit 6017ff0dd7a27c062d0ad4687bfc70a69747ac55)
2020-08-18vcl: disconnect both flavors of bapi transport on destroyFlorin Coras1-5/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6697296b45c5816a31535b0cf44b8e726292b8bb (cherry picked from commit dc0ded7dd7a6b8ee68df25cd56666de804e55e64)
2020-08-13vcl: generate select events on read/write errorsFlorin Coras1-8/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3429f9d0406b6d710846fc82d77400f26f77fdf4 (cherry picked from commit 5e6222a0332e38316b5a58b23c35cca69bb72025)
2020-08-13vcl: fix use-after-freeBenoît Ganne1-1/+2
Make sure we disconnect from vlib prior to free-ing the last worker, as we'll need to access it. Type: fix Change-Id: Id5bdd17f0f5efa1ce52021b4270eb4f1e95cc61d Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 38ab5672b599df8ef201ca6733c9b008c37fdfa3)
2020-08-13vcl: ensure sessions are open on select eventsFlorin Coras1-7/+5
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4d56b61af574dfdaf6028160ce331606bdf65609 (cherry picked from commit f49cf470c583507fa1b5b841887107071701ef5e)
2020-08-13vcl: fix app destroyFlorin Coras1-20/+19
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I21daa87b1a301142270a1bf20680dd9e9395aac9 (cherry picked from commit ce815deb72fd3941b000aecec931131afc9d6c34)
2020-08-12vcl: clear accept msg flagsFlorin Coras1-0/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idb513232e7b091c8f767726bfa1deb10a7e3b751 (cherry picked from commit e88845e4fea2c6b6743ff7790cc2247631d65189)
2020-08-12vcl: always report EPOLLHUP/EPOLLRDHUP on closeFlorin Coras1-4/+0
Type: fix Change-Id: I3d24a7973c7113ffeb9109e89cda7fa960e73a5b Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit ddb90a063cb3fa797257d8a632cba8cf2a01a455)
2020-08-12vcl: add rx event on epoll ctl if neededFlorin Coras1-2/+10
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib6d0387076a4bb0b52e4cdfdcd62b6060b704fe6 (cherry picked from commit 6e3c1f8ec3faa8f0cad591fada32ad2f506ec0a0)
2020-08-12vcl: EPOLLOUT should be generated when epoll_ctl called with EPOLLOUThanlin1-0/+20
event Type: fix When we call epoll_ctl to add or mod fd with EPOLLOUT event, mostly to check if we can write. So we expect a EPOLLOUT event should be generated immediately unless tx queue is full. Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: Ie99986a44dbb07b6ff2fba6512171056f79e77bd (cherry picked from commit 475c9d7bcd0f2ceca77022eaef67ad9a84365609)
2020-08-12vcl: RX event may lost when accept session repeatedlywanghanlin1-1/+1
Type: fix Some applications may call accept repeatedly to process all connect request until get EAGIAIN error. Subsequent call may get RX event of previous accepted session, then should process it rather than just discard it. Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Ice53442de66289a62591b79a9cc31e883e894c23 (cherry picked from commit 96453fd2417ebd1d69354a7fb692976129cea80e)
2020-08-12vcl: resolve VCL part session cleanup issueYu Ping1-0/+2
In Nginx performance test, we notice that there are so many session kept open with the state of TRANSPORT_DELETE, and it is root caused that vppcom fails to return close state. Type: fix Change-Id: Ia30f959e0e5adb5b8bcfa13fb1dd7b2cb410a31b Signed-off-by: Yu Ping <ping.yu@intel.com> (cherry picked from commit b2955355cc9a654447d8647e33def67cd27892f6)
2019-12-01vcl: if the ldp user send buf with 0 len, it will assert failed.jiangxiaoming1-1/+1
Type: fix Change-Id: I8ff60cf8726c463491c687e170ad0b1026a1303a Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> (cherry picked from commit ff31ac6809d9913ebd2f58a3a4153a0f419b9a77)
2019-11-28vcl: fix nonblocking accept with >1 event in the queueCarl Smith1-3/+3
We discard unwanted events until we get an ACCEPTED. But if we are non-blocking we need to check the queue length every time and EAGAIN if empty before waiting. Type: fix Signed-off-by: Carl Smith <carl.smith@alliedtelesis.co.nz> Change-Id: Ie0c7e5cb00f0d37d2e1534f8bb384221ff56f2e3 (cherry picked from commit 592a909a302262cf4088a5468b8e427f577725e8)
2019-11-28vcl: fix epoll connected events sidFlorin Coras1-2/+1
Type: fix Use sid returned by vcl_session_connected_handler instead of trying to infer it from vpp session handle. Change-Id: Ic0fbb90ec2bd851b435fc3f2a34265ac9a8ab29f Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit f1653e62fe41e3df429aadaaab22d0cc8aaa227a)
2019-11-18vcl: handle segment map errorsFlorin Coras1-8/+12
Type: fix Change-Id: Ibd122a4565c067627c4bbc8cac7df2d5b6497392 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit dbc9c599b9d4453c7433ac59dd21f088778e024b)
2019-11-15vcl: add api to set lcl ipFlorin Coras1-6/+39
Type: feature Change-Id: I40169fbbe8a20670dd612c341b6c78b5c925bf74 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit ef7cbf6adf1882af4d4ae8657632d4a2a59efcb2)
2019-11-05vcl: handle rx notifications on reused sessionsFlorin Coras1-0/+2
Type: fix Ignore events on sessions that have been reused but not fully initialized. Change-Id: Ided020eb5245d665d0a2e4a9e1f8a6dddebae009 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit bd52e46fe8193182cce150292e9df1c517795011)
2019-10-03vcl: allow non-blocking connectsFlorin Coras1-3/+14
Type: feature Change-Id: I55349f482ce6781337f747b2f0d2c0a027c3a675 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit 57c88938f8a80e63e7307cacaca23b0ab3a51b6c)
2019-09-30session: move ctrl messages from bapi to mqFlorin Coras1-18/+106
Type:refactor Moves connect, disconnect, bind, unbind and app detach to message queue from binary api. Simplifies app/vcl interaction with the session layer since all session control messages are now handled over the mq. Add/del segment messages require internal C api changes which affect all builtin applications. They'll be moved in a different patch and might not be back portable to 19.08. Change-Id: I93f6d18e551b024effa75d47f5ff25f23ba8aff5 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit 458089bbad9cf5bef6cf8119f23fc44e66b36ad3)
2019-08-05vcl: fix bapi disconnect with socket transportFlorin Coras1-1/+1
Type:fix Change-Id: I7b69c28118f3d7054a20ca48792dfc403a8e2694 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-31vcl: fix epoll chain validationFlorin Coras1-22/+22
Type:fix Change-Id: I91dfe7e0ae2e632022fbf639ca16c93f570849de Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-19vcl: fix coverity warningFlorin Coras1-1/+2
Type:fix Change-Id: I7b91ce9359f94131882ab430606586b1a6cf3e02 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-19session: Use parent_handle instead of transport_optsNathan Skrzypczak1-2/+2
Type: feature This is mostly used for quic in the case of a stream creation (i.e. connect on an already established QUIC session). We want do default parent_handle to INVALID to be able to distinguish it from parent_handle = 0 Change-Id: Id5ac0b0155a3c44e51334231b711e4fd87a96a10 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-07-18vcl: add QUIC supportNathan Skrzypczak1-13/+155
Type: feature * Adds the concept of a "connectable listener" : a session that can be both connected and accepted on. * vppcom_session_is_connectable_listener (fd) that tells if the fd is a connectable listener * vppcom_session_listener (fd) that gives you the listener's fd that accepted the session (if any) * vppcom_session_n_accepted (fd) that gives the number of sessions a listener accepted. Change-Id: Id89d67d8339fb15a7cf7e00a9c5448175eca04fc Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-07-08vcl: add worker unregister apiFlorin Coras1-0/+7
Type:feature Change-Id: Ie73644aed94e58d5dce822de5000183e414401df Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-08vcl: cleanup listener accept fifoFlorin Coras1-0/+14
Type: fix Change-Id: Ic470d429f4bf1924185f720d66efe06f4727bcbd Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-29svm: rename fifo tx notifications to reflect useFlorin Coras1-8/+8
Type: refactor Change-Id: I651db44acdcb666a9c63e1037352cf88c68795b5 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-06vcl: avoid hash table lookup on acceptFlorin Coras1-23/+27
Type: refactor Change-Id: I363a97b9f5ab0dbda78e13582630e78d57fb83e7 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-06vcl: cap epoll dequeue batch size to max eventsFlorin Coras1-14/+14
Type: fix Change-Id: Ia9be1413cf9423552137885521cefdbecc3e5df5 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Ping Yu <ping.yu@intel.com>
2019-04-25session: cleanup segment manager and fifo segmentFlorin Coras1-5/+5
Change-Id: I984f347fb465c0c405cef668d8690457e81788e2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-25session: use teps in accept/connect notificationsFlorin Coras1-9/+9
Change-Id: I58e713661a38cecbfdebd4609292d9d12e880cd2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-17vcl/session: tx notifications for cut-thru sessionsFlorin Coras1-0/+8
Change-Id: I076c753e419bbb177d2d28609190715e9895b398 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-16svm_fifo rework to avoid contention on cursizeSirshak Das1-8/+9
Problems Addressed: - Contention of cursize by producer and consumer. - Reduce the no of modulo operations. Changes: - Synchronization between producer and consumer changed from cursize to head and tail indexes Implications: reduces the usable size of fifo by 1. - Using weaker memory ordering C++11 atomics to access head and tail based on producer and consumer role. - Head and tail indexes are unsigned 32 bit integers. Additions and subtraction on them are implicit 32 bit Modulo operation. - Adding weaker memory ordering variants of max_enq, max_deq, is_empty and is_full Using them appropriately in all places. Perfomance improvement (iperf3 via Hoststack): iperf3 Server: Marvell ThunderX2(AArch64) - iperf3 Client: Skylake(x86) ~6%(256 rxd/txd) - ~11%(2048 rxd/txd) Change-Id: I1d484e000e437430fdd5a819657d1c6b62443018 Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2019-03-15vcl: cleanup debug messagesFlorin Coras1-240/+170
Change-Id: Ida3ecffc9a4d7a080ad63cd48fd4b5330b732ffb Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-14vcl: fix coverity warningFlorin Coras1-1/+1
Change-Id: I048276fd26e6e079ce31b9aeb1265f5d929f8540 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-08session/tcp/vcl: fixes and optimizationsFlorin Coras1-13/+48
Change-Id: Idc7dfe743399dd8dee0f6b3ec83f194f3fca580b Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-07session: cleanup instances of deprecated io evtsFlorin Coras1-1/+1
Change-Id: Iad119e05ae5e570fbfcf66747c95822cee647c99 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-06session: use session index instead of fifo for evtFlorin Coras1-38/+43
Avoids derefrencing fifo pointers whose segments could have been unmapped. Change-Id: Ifb0b7399e424f145f3f94b769391a6f4e31bb4e6 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-06session: use vpp to switch io events for ct sessionsFlorin Coras1-246/+71
Instead of allocating pairs of message queues per cut-thru session and having the applications map them, this uses vpp as an io event message switch. Change-Id: I51db1c7564df479a7d1a3288342394251fd188bb Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-04vcl: remove unused fields and structuresFlorin Coras1-8/+1
Change-Id: I49a95c4e2eb17e5a6ab514dde2505294a4c01353 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-21vcl/session: send unlisten over message queueFlorin Coras1-1/+34
Change-Id: I68cd6c0e6be3e8088792df3885ae190bb00462b0 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-04session: cleanup part 1Florin Coras1-5/+5
Rename core data structures. This will break compatibility for out of tree builtin apps. - stream_session_t to session_t - server_rx/tx_fifo to rx/tx_fifo - stream_session.h to session_types.h - update copyright Change-Id: I414097c6e28bcbea866fbf13b8773c7db3f49325 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-31vcl: improve handling of close on rwFlorin Coras1-48/+27
Change-Id: Ie01a37612d7e3e0d0bad0f0aa9583b3ed411f46f Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-30vls: support passive listenersFlorin Coras1-3/+11
If an application worker calls listen on a session, vpp registers the worker to the listener's work load balance group and, as new connections are accepted, it may potentially push accept notifications to it. There are however applications, like nginx, that on some workers may never accept new connections on a session they've started listening on. To avoid accumulating accept events on such workers, this patch adds support for passive listeners. That is, workers that have started listening on a session but then never call accept or epoll/select on that listener. Change-Id: I007e6dcb54fc88a0e3aab3c6e2a3d1ef135cbd58 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-29vls: multi-process and multi-threaded apps improvementsFlorin Coras1-74/+8
- More fine tuning for multi-process applications. - Experimental support for multi-thread apps. This is meant for app whose threads are not vcl workers and the sessions are shared between them. Change-Id: Ie07651da5f2cdcf39f5dead5431f50ad39cf3f74 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-26vcl: add api to expose worker message queues epfdFlorin Coras1-0/+9
This only works if vcl is configured to do eventd based message queue notifications, instead of condvars. For that, add "use-mq-eventfd" to vcl startup conf. Change-Id: Id0f0288a40ec7d3daef7370f8b88420425867ab6 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-24session/vcl: support worker ownership change for listenersFlorin Coras1-7/+14
Change-Id: I2ad54b20b96f10b009c3e651b2a2f885577ca5b6 Signed-off-by: Florin Coras <fcoras@cisco.com>