daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/34577?usp=email )
Change subject: osmo_io: Only allow reading/writing if the relevant callback is set
......................................................................
osmo_io: Only allow reading/writing if the relevant callback is set
Allow the callbacks to be NULL, but then sending/receiving is disabled.
There are some cases where we only care about writing to or reading from
an fd.
Change-Id: I11ce072510b591f7881d09888524426579bd0169
---
M src/core/osmo_io.c
1 file changed, 43 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/34577/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index c67787b..2b2b7dd 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -355,6 +355,12 @@
int osmo_iofd_write_msgb(struct osmo_io_fd *iofd, struct msgb *msg)
{
int rc;
+
+ if (OSMO_UNLIKELY(!iofd->io_ops.write_cb)) {
+ LOGPIO(iofd, LOGL_ERROR, "write_cb not set, Rejecting msgb\n");
+ return -EINVAL;
+ }
+
struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg);
if (!msghdr)
return -ENOMEM;
@@ -392,6 +398,10 @@
int rc;
OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO);
+ if (OSMO_UNLIKELY(!iofd->io_ops.sendto_cb)) {
+ LOGPIO(iofd, LOGL_ERROR, "sendto_cb not set, Rejecting msgb\n");
+ return -EINVAL;
+ }
struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_SENDTO, msg);
if (!msghdr)
@@ -477,7 +487,8 @@
return rc;
IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED);
- osmo_iofd_ops.read_enable(iofd);
+ if (iofd->io_ops.read_cb)
+ osmo_iofd_ops.read_enable(iofd);
if (iofd->tx_queue.current_length > 0)
osmo_iofd_ops.write_enable(iofd);
@@ -658,6 +669,24 @@
void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
{
iofd->io_ops = *ioops;
+
+ switch (iofd->mode) {
+ case OSMO_IO_FD_MODE_READ_WRITE:
+ if (iofd->io_ops.read_cb)
+ osmo_iofd_ops.read_enable(iofd);
+ else
+ osmo_iofd_ops.read_disable(iofd);
+ break;
+ case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
+ if (iofd->io_ops.recvfrom_cb)
+ osmo_iofd_ops.read_enable(iofd);
+ else
+ osmo_iofd_ops.read_disable(iofd);
+ break;
+ case OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG:
+ default:
+ OSMO_ASSERT(0);
+ }
}
/*! Notify the user if/when the socket is connected.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34577?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I11ce072510b591f7881d09888524426579bd0169
Gerrit-Change-Number: 34577
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: daniel.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/34576?usp=email )
Change subject: stream_srv: Make osmo_stream_srv_clear_tx_queue() aware of osmo_io
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34576?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I818fe4e3792ed88ae4d6fd6afb677b39264ab662
Gerrit-Change-Number: 34576
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:51:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS1:
> I am not sure if I understand the question correctly. […]
Ah I see it now, in common code:
#ifdef ENABLE_DIRECT_PHY
bts->trx[trx_nr].fl1h = l1if_open_trx(
...
#endif
This is called though based on this condition:
if ((info_ind->flags & PCU_IF_FLAG_SYSMO)
&& info_ind->trx[trx_nr].hlayer1) {
Are you passing PCUIF_FLAG_SYSMO when using an RBS from within osmo-bsc? this looks wrong imho, that flag is SYSMO specific and doesn't relate to RBS? Or maybe we don't need anything SYSMO specific and we can rename it?
I envision at some point the PCU needs to know the type of BTS, so it knows how to hook to it on the l1if. And knowing if it's SYSMO or not is not enough imho.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:37:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: comment
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS1:
> idk, I'm just asking if that field is also used in the sysmobts l1if lower layers of osmo-pcu, as in […]
I am not sure if I understand the question correctly. The field is populated by l1if_open_trx() in pcu_l1_if.cpp:pcu_rx_info_ind() and it is basically holds the context that is needed to access the hardware. When the socket closed it is passed to l1if_close_trx(), see also: src/pcuif_sock.c.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:31:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: dexter.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:25:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:20:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter, pespin.
Hello pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by pespin
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
gprs_rlcmac_sched: check if we really use direct phy
In gprs_rlcmac_sched we have a flag to skip idle frames in case we do not
use the so called "direct phy access". A similar mechanism also exists
in pcu_l1_if.cpp in function pcu_rx_rts_req_ptcch().
Unfortunately the check is not done correctly. The flag gets set when
the ENABLE_DIRECT_PHY define constant is set. However, this does not say
much about whether we access a PHY directly or not. The define constant
is intended to be used to disable direct phy related code in
on platforms where no direct phy code is used or cannot be used.
In order to know if we actually accessing a PHY directly we must check
the presence of fl1h on the related TRX. (see also pcu_l1_if.cpp,
function pcu_l1if_tx_pdtch)
Related: OS#6191
Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
---
M src/gprs_rlcmac_sched.cpp
M src/pcu_l1_if.cpp
2 files changed, 34 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/75/34575/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: dexter.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> I didn't try this on real hardware or in the TTCN3 testsuite yet. […]
idk, I'm just asking if that field is also used in the sysmobts l1if lower layers of osmo-pcu, as in whether it makes sense to check that also for those builds.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:14:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email )
Change subject: gprs_rlcmac_sched: check if we really use direct phy
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> did you check this is also valid for sysmo,lc15,oc2g? is that field set there?
I didn't try this on real hardware or in the TTCN3 testsuite yet. I would expect that it should be fine with all BTSs that use direct phy access.
Or do you think we still might run into a problem in case we use a sysmo-bts, but in non-direct-phy mode?
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/34575?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0808950b1154bbb9a789c3f706ad9fb6618764ec
Gerrit-Change-Number: 34575
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 28 Sep 2023 15:11:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment