From cdfd2636605136eb369f37e3cc80a8a835977657 Mon Sep 17 00:00:00 2001 From: Chris McFarlen Date: Wed, 1 Mar 2023 08:31:13 -0600 Subject: [PATCH] Remove support for port event polling --- configure.ac | 13 +--- .../testing/blackbox-testing.en.rst | 1 - include/tscore/ink_config.h.in | 1 - include/tscore/ink_platform.h | 3 - iocore/eventsystem/UnixEThread.cc | 2 - iocore/net/P_UnixNet.h | 72 +------------------ iocore/net/P_UnixPollDescriptor.h | 16 ----- iocore/net/SSLNetVConnection.cc | 7 -- iocore/net/UnixNet.cc | 34 --------- iocore/net/UnixUDPNet.cc | 5 -- src/traffic_layout/info.cc | 1 - tests/README.md | 1 - 12 files changed, 2 insertions(+), 154 deletions(-) diff --git a/configure.ac b/configure.ac index 096c08257ec..5d4edfe32fc 100644 --- a/configure.ac +++ b/configure.ac @@ -1556,14 +1556,9 @@ AC_ARG_WITH([event-interface], use_epoll=0 use_kqueue=0 -use_port=0 AS_IF([test "x$event_interface" = "xauto"], [ - if test "$ac_cv_func_port_create" = "yes"; then - use_port=1 - have_good_poller=1 - AC_MSG_NOTICE([Using port event interface]) - elif test "$ac_cv_func_epoll_ctl" = "yes"; then + if test "$ac_cv_func_epoll_ctl" = "yes"; then use_epoll=1 have_good_poller=1 AC_MSG_NOTICE([Using epoll event interface]) @@ -1580,10 +1575,6 @@ AS_IF([test "x$event_interface" = "xauto"], [ use_epoll=1 AC_MSG_RESULT([forced to epoll]) ;; - xport) - use_port=1 - AC_MSG_RESULT([forced to port]) - ;; xkqueue) use_kqueue=1 AC_MSG_RESULT([forced to kqueue]) @@ -1596,8 +1587,6 @@ AS_IF([test "x$event_interface" = "xauto"], [ AC_SUBST(use_epoll) AC_SUBST(use_kqueue) -AC_SUBST(use_port) - # Profiler support has_profiler=0 diff --git a/doc/developer-guide/testing/blackbox-testing.en.rst b/doc/developer-guide/testing/blackbox-testing.en.rst index 2154270aec8..3544a49c6a6 100644 --- a/doc/developer-guide/testing/blackbox-testing.en.rst +++ b/doc/developer-guide/testing/blackbox-testing.en.rst @@ -247,7 +247,6 @@ Condition Testing - TS_USE_DIAGS - TS_USE_EPOLL - TS_USE_KQUEUE - - TS_USE_PORT - TS_USE_POSIX_CAP - TS_USE_TPROXY - TS_HAS_SO_MARK diff --git a/include/tscore/ink_config.h.in b/include/tscore/ink_config.h.in index 90841cd8aec..b09ef2868ba 100644 --- a/include/tscore/ink_config.h.in +++ b/include/tscore/ink_config.h.in @@ -65,7 +65,6 @@ #define TS_USE_DIAGS @use_diags@ #define TS_USE_EPOLL @use_epoll@ #define TS_USE_KQUEUE @use_kqueue@ -#define TS_USE_PORT @use_port@ #define TS_USE_POSIX_CAP @use_posix_cap@ #define TS_USE_TPROXY @use_tproxy@ #define TS_HAS_SO_MARK @has_so_mark@ diff --git a/include/tscore/ink_platform.h b/include/tscore/ink_platform.h index 922b474c57c..ad72011ee34 100644 --- a/include/tscore/ink_platform.h +++ b/include/tscore/ink_platform.h @@ -118,9 +118,6 @@ struct ifafilt; #if TS_USE_KQUEUE #include #endif -#if TS_USE_PORT -#include -#endif #ifdef HAVE_VALUES_H #include diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc index 115ae6d86f4..d58bf54a4db 100644 --- a/iocore/eventsystem/UnixEThread.cc +++ b/iocore/eventsystem/UnixEThread.cc @@ -90,8 +90,6 @@ EThread::EThread(ThreadType att, int anid) : id(anid), tt(att) Fatal("EThread::EThread: %d=eventfd(0,EFD_NONBLOCK | EFD_CLOEXEC),errno(%d)", evfd, errno); } } -#elif TS_USE_PORT -/* We'll just port_send the event straight over the port. */ #else ink_release_assert(pipe(evpipe) >= 0); fcntl(evpipe[0], F_SETFD, FD_CLOEXEC); diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index dc58c09e8af..1afe6c3835e 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -64,14 +64,6 @@ #define EVENTIO_WRITE INK_EVP_OUT #define EVENTIO_ERROR (0x010 | 0x002 | 0x020) // ERR PRI HUP #endif -#if TS_USE_PORT -#ifdef USE_EDGE_TRIGGER_PORT -#define USE_EDGE_TRIGGER 1 -#endif -#define EVENTIO_READ POLLIN -#define EVENTIO_WRITE POLLOUT -#define EVENTIO_ERROR (POLLERR | POLLPRI | POLLHUP) -#endif struct PollDescriptor; typedef PollDescriptor *EventLoop; @@ -85,7 +77,7 @@ struct NetAccept; /// Unified API for setting and clearing kernel and epoll events. struct EventIO { int fd = -1; ///< file descriptor, often a system port -#if TS_USE_KQUEUE || TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER) || TS_USE_PORT +#if TS_USE_KQUEUE || TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER) int events = 0; ///< a bit mask of enabled events #endif EventLoop event_loop = nullptr; ///< the assigned event loop @@ -677,13 +669,6 @@ EventIO::start_common(EventLoop l, int afd, int e) EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this); return kevent(l->kqueue_fd, &ev[0], n, nullptr, 0, nullptr); #endif -#if TS_USE_PORT - events = e; - int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - Debug("iocore_eventio", "[EventIO::start] e(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, events, retval, - retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - return retval; -#endif } TS_INLINE int @@ -735,38 +720,8 @@ EventIO::modify(int e) else return 0; #endif -#if TS_USE_PORT - int n = 0; - int ne = e; - if (e < 0) { - if (((-e) & events)) { - ne = ~(-e) & events; - if ((-e) & EVENTIO_READ) - n++; - if ((-e) & EVENTIO_WRITE) - n++; - } - } else { - if (!(e & events)) { - ne = events | e; - if (e & EVENTIO_READ) - n++; - if (e & EVENTIO_WRITE) - n++; - } - } - if (n && ne && event_loop) { - events = ne; - int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - Debug("iocore_eventio", "[EventIO::modify] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events, - retval, retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - return retval; - } - return 0; -#else (void)e; // ATS_UNUSED return 0; -#endif } TS_INLINE int @@ -790,28 +745,8 @@ EventIO::refresh(int e) else return 0; #endif -#if TS_USE_PORT - int n = 0; - int ne = e; - if ((e & events)) { - ne = events | e; - if (e & EVENTIO_READ) - n++; - if (e & EVENTIO_WRITE) - n++; - if (n && ne && event_loop) { - events = ne; - int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - Debug("iocore_eventio", "[EventIO::refresh] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events, - retval, retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); - return retval; - } - } - return 0; -#else (void)e; // ATS_UNUSED return 0; -#endif } TS_INLINE int @@ -827,11 +762,6 @@ EventIO::stop() memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN | EPOLLOUT | EPOLLET; retval = epoll_ctl(event_loop->epoll_fd, EPOLL_CTL_DEL, fd, &ev); -#endif -#if TS_USE_PORT - retval = port_dissociate(event_loop->port_fd, PORT_SOURCE_FD, fd); - Debug("iocore_eventio", "[EventIO::stop] %d[%s]=port_dissociate(%d,%d,%d)", retval, retval < 0 ? strerror(errno) : "ok", - event_loop->port_fd, PORT_SOURCE_FD, fd); #endif event_loop = nullptr; return retval; diff --git a/iocore/net/P_UnixPollDescriptor.h b/iocore/net/P_UnixPollDescriptor.h index 37acfba153b..db2154b9761 100644 --- a/iocore/net/P_UnixPollDescriptor.h +++ b/iocore/net/P_UnixPollDescriptor.h @@ -55,9 +55,6 @@ struct PollDescriptor { #if TS_USE_KQUEUE int kqueue_fd; #endif -#if TS_USE_PORT - int port_fd; -#endif PollDescriptor() { init(); } #if TS_USE_EPOLL @@ -91,15 +88,6 @@ struct PollDescriptor { return r; } #define ev_next_event(a, x) -#endif - -#if TS_USE_PORT - port_event_t Port_Triggered_Events[POLL_DESCRIPTOR_SIZE]; -#define get_ev_port(a) ((a)->port_fd) -#define get_ev_events(a, x) ((a)->Port_Triggered_Events[(x)].portev_events) -#define get_ev_data(a, x) ((a)->Port_Triggered_Events[(x)].portev_user) -#define get_ev_odata(a, x) ((a)->Port_Triggered_Events[(x)].portev_object) -#define ev_next_event(a, x) #endif Pollfd * @@ -130,10 +118,6 @@ struct PollDescriptor { #if TS_USE_KQUEUE kqueue_fd = kqueue(); memset(kq_Triggered_Events, 0, sizeof(kq_Triggered_Events)); -#endif -#if TS_USE_PORT - port_fd = port_create(); - memset(Port_Triggered_Events, 0, sizeof(Port_Triggered_Events)); #endif } }; diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index cfa44477e09..f7fb137aa90 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -728,13 +728,6 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) read.triggered = 0; nh->read_ready_list.remove(this); Debug("ssl", "read finished - would block"); -#if TS_USE_PORT - if (ret == SSL_READ_WOULD_BLOCK) { - readReschedule(nh); - } else { - writeReschedule(nh); - } -#endif break; case SSL_READ_EOS: diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc index 721ac80b28b..8fba075f883 100644 --- a/iocore/net/UnixNet.cc +++ b/iocore/net/UnixNet.cc @@ -197,35 +197,6 @@ PollCont::do_poll(ink_hrtime timeout) kevent(pollDescriptor->kqueue_fd, nullptr, 0, pollDescriptor->kq_Triggered_Events, POLL_DESCRIPTOR_SIZE, &tv); NetDebug("v_iocore_net_poll", "[PollCont::pollEvent] kqueue_fd: %d, timeout: %d, results: %d", pollDescriptor->kqueue_fd, poll_timeout, pollDescriptor->result); -#elif TS_USE_PORT - int retval; - timespec_t ptimeout; - ptimeout.tv_sec = poll_timeout / 1000; - ptimeout.tv_nsec = 1000000 * (poll_timeout % 1000); - unsigned nget = 1; - if ((retval = port_getn(pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events, POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < - 0) { - pollDescriptor->result = 0; - switch (errno) { - case EINTR: - case EAGAIN: - case ETIME: - if (nget > 0) { - pollDescriptor->result = (int)nget; - } - break; - default: - ink_assert(!"unhandled port_getn() case:"); - break; - } - } else { - pollDescriptor->result = (int)nget; - } - NetDebug("v_iocore_net_poll", "[PollCont::pollEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)", retval, - retval < 0 ? strerror(errno) : "ok", pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events, - POLL_DESCRIPTOR_SIZE, nget, poll_timeout, pollDescriptor->result); -#else -#error port me #endif } @@ -235,8 +206,6 @@ net_signal_hook_callback(EThread *thread) #if HAVE_EVENTFD uint64_t counter; ATS_UNUSED_RETURN(read(thread->evfd, &counter, sizeof(uint64_t))); -#elif TS_USE_PORT -/* Nothing to drain or do */ #else char dummy[1024]; ATS_UNUSED_RETURN(read(thread->evpipe[0], &dummy[0], 1024)); @@ -579,9 +548,6 @@ NetHandler::signalActivity() #if HAVE_EVENTFD uint64_t counter = 1; ATS_UNUSED_RETURN(write(thread->evfd, &counter, sizeof(uint64_t))); -#elif TS_USE_PORT - PollDescriptor *pd = get_PollDescriptor(thread); - ATS_UNUSED_RETURN(port_send(pd->port_fd, 0, thread->ep)); #else char dummy = 1; ATS_UNUSED_RETURN(write(thread->evpipe[1], &dummy, 1)); diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index 8147bb36a75..60f6659e8c3 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -1462,8 +1462,6 @@ net_signal_hook_callback(EThread *thread) #if HAVE_EVENTFD uint64_t counter; ATS_UNUSED_RETURN(read(thread->evfd, &counter, sizeof(uint64_t))); -#elif TS_USE_PORT -/* Nothing to drain or do */ #else char dummy[1024]; ATS_UNUSED_RETURN(read(thread->evpipe[0], &dummy[0], 1024)); @@ -1601,9 +1599,6 @@ UDPNetHandler::signalActivity() #if HAVE_EVENTFD uint64_t counter = 1; ATS_UNUSED_RETURN(write(thread->evfd, &counter, sizeof(uint64_t))); -#elif TS_USE_PORT - PollDescriptor *pd = get_PollDescriptor(thread); - ATS_UNUSED_RETURN(port_send(pd->port_fd, 0, thread->ep)); #else char dummy = 1; ATS_UNUSED_RETURN(write(thread->evpipe[1], &dummy, 1)); diff --git a/src/traffic_layout/info.cc b/src/traffic_layout/info.cc index 529ca1876c6..14c36a0d7b7 100644 --- a/src/traffic_layout/info.cc +++ b/src/traffic_layout/info.cc @@ -107,7 +107,6 @@ produce_features(bool json) print_feature("TS_USE_DIAGS", TS_USE_DIAGS, json); print_feature("TS_USE_EPOLL", TS_USE_EPOLL, json); print_feature("TS_USE_KQUEUE", TS_USE_KQUEUE, json); - print_feature("TS_USE_PORT", TS_USE_PORT, json); print_feature("TS_USE_POSIX_CAP", TS_USE_POSIX_CAP, json); print_feature("TS_USE_TPROXY", TS_USE_TPROXY, json); print_feature("TS_HAS_SO_MARK", TS_HAS_SO_MARK, json); diff --git a/tests/README.md b/tests/README.md index 579527680e3..aa972c78642 100644 --- a/tests/README.md +++ b/tests/README.md @@ -306,7 +306,6 @@ ts.Disk.remap_config.AddLine( * TS_USE_DIAGS * TS_USE_EPOLL * TS_USE_KQUEUE - * TS_USE_PORT * TS_USE_POSIX_CAP * TS_USE_TPROXY * TS_HAS_SO_MARK