pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/39071?usp=email )
Change subject: osmo_io: Track IOFD_FLAG_FD_REGISTERED in all backends
......................................................................
osmo_io: Track IOFD_FLAG_FD_REGISTERED in all backends
This will be used in common segmentation handling code to figure out
whether the iofd is still registered or was unregistered by the user
during the read cb, in order to know whether to continue submitting read
events upwards or to discard the handling.
Change-Id: Id5e92aa22ce1c5d76028c539784118be227b9d5a
---
M src/core/osmo_io.c
M src/core/osmo_io_poll.c
2 files changed, 21 insertions(+), 15 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 387cefb..c61c8e9 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -737,19 +737,29 @@
{
int rc = 0;
- if (fd >= 0)
- iofd->fd = fd;
- else if (iofd->fd < 0) {
+ if (fd < 0 && iofd->fd < 0) {
/* this might happen if both osmo_iofd_setup() and osmo_iofd_register() are called with -1 */
LOGPIO(iofd, LOGL_ERROR, "Cannot register io_fd using invalid fd == %d\n", iofd->fd);
return -EBADF;
}
+ if (fd < 0)
+ fd = iofd->fd;
+ else if (iofd->fd < 0)
+ iofd->fd = fd;
+
+ if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) {
+ /* If re-registering same fd, handle as NO-OP.
+ * New FD should go through unregister() first. */
+ return iofd->fd == fd ? 0 : -ENOTSUP;
+ }
rc = osmo_iofd_ops.register_fd(iofd);
if (rc)
return rc;
IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED);
+ IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED);
+
if ((iofd->mode == OSMO_IO_FD_MODE_READ_WRITE && iofd->io_ops.read_cb) ||
(iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb) ||
(iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG && iofd->io_ops.recvmsg_cb)) {
@@ -772,7 +782,14 @@
*/
int osmo_iofd_unregister(struct osmo_io_fd *iofd)
{
- return osmo_iofd_ops.unregister_fd(iofd);
+ int rc;
+
+ if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
+ return 0;
+
+ rc = osmo_iofd_ops.unregister_fd(iofd);
+ IOFD_FLAG_UNSET(iofd, IOFD_FLAG_FD_REGISTERED);
+ return rc;
}
/*! Retrieve the number of messages pending in the transmit queue.
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index 92f03f8..bf0291e 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -128,29 +128,18 @@
struct osmo_fd *ofd = &iofd->u.poll.ofd;
int rc;
- if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
- return 0;
-
osmo_fd_setup(ofd, iofd->fd, 0, &iofd_poll_ofd_cb_dispatch, iofd, 0);
if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED))
osmo_fd_write_enable(&iofd->u.poll.ofd);
rc = osmo_fd_register(ofd);
- if (!rc)
- IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED);
-
return rc;
}
static int iofd_poll_unregister(struct osmo_io_fd *iofd)
{
struct osmo_fd *ofd = &iofd->u.poll.ofd;
-
- if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
- return 0;
osmo_fd_unregister(ofd);
- IOFD_FLAG_UNSET(iofd, IOFD_FLAG_FD_REGISTERED);
-
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39071?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id5e92aa22ce1c5d76028c539784118be227b9d5a
Gerrit-Change-Number: 39071
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria.
pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39079?usp=email )
Change subject: s1gw: add constants for PFCP FAR IDs
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39079?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib25e5cc9ca21047f9884e1c13d0861bf4f7251a1
Gerrit-Change-Number: 39079
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 10 Dec 2024 11:21:30 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/39070?usp=email )
Change subject: osmo_io: close() op in backend only takes care of closing
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39070?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0150afcc0b83ea8b2d00d108658ed688ce487f7f
Gerrit-Change-Number: 39070
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 10 Dec 2024 11:19:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria.
pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39076?usp=email )
Change subject: s1gw: make f_ConnHdlr_rx_session_modify_req() more flexible
......................................................................
Patch Set 1:
(1 comment)
File s1gw/S1GW_ConnHdlr.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39076/comment/24099919_22cd… :
PS1, Line 739: far_id := 1);
> FAR ID is not specific to an E-RAB. Each E-RAB has two FAR IDs, it's always 1 and 2. […]
isn't far ids being 1 and 2 just an implementation detail on how the node works? It could be any number right? May be worth properly documenting that with a constant or whatever, or also manage it as a param as mentioned.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39076?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I52317e79ac02cb4e321b49c2cd824de28e25a1c6
Gerrit-Change-Number: 39076
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 10 Dec 2024 11:18:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>