Attention is currently required from: daniel.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email )
Change subject: osmo_io: Factor out and use common send function from backend
......................................................................
Patch Set 1:
(1 comment)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/e5566153_7ddacd06
PS1, Line 343: void iofd_handle_send(struct osmo_io_fd *iofd, int rc, struct iofd_msghdr *msghdr)
this function (like unfortuntaely many functions in the code base) would benefit from a comment describint what it does. also, the name could be more epxplciit, like "handle_send_completion" or the like.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35078?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: I6da2653d32aedd0e7872be0cf90a841b56462e59
Gerrit-Change-Number: 35078
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 Nov 2023 11:39:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: daniel.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35077?usp=email )
Change subject: osmo_io: Assert that iofd mode is correct when calling *_write_msgb
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35077?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: Ief82ba7f9b280f85d66d68c358c36ba9866fe47a
Gerrit-Change-Number: 35077
Gerrit-PatchSet: 2
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 Nov 2023 11:36:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35080?usp=email )
Change subject: firmware/layer1: avoid 'for' loop initial declarations
......................................................................
firmware/layer1: avoid 'for' loop initial declarations
As was reported by roox, osmocom-bb currently fails to build on OBS:
https://build.opensuse.org/build/home:mnhauke:osmocom:nightly/openSUSE_Tumb…
[ 24s] layer1/prim_tch.c: In function 'l1s_tch_meas_avg':
[ 24s] layer1/prim_tch.c:183:2: error: 'for' loop initial declarations are only allowed in C99 mode
[ 24s] layer1/prim_tch.c:183:2: note: use option -std=c99 or -std=gnu99 to compile your code
We don't specify the C standard explicitly, so let's move the variable
declaration out of the for-loop in l1s_tch_meas_avg().
Change-Id: I6c65fbead4e612c81728e9c6601d5f2107616ee6
Fixes: 7286560a3 "firmware/layer1: fill-in DL info for L1CTL TRAFFIC.ind"
---
M src/target/firmware/layer1/prim_tch.c
1 file changed, 23 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/80/35080/1
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c
index a33cb58..1bc842b 100644
--- a/src/target/firmware/layer1/prim_tch.c
+++ b/src/target/firmware/layer1/prim_tch.c
@@ -179,8 +179,9 @@
{
uint32_t avg_snr = 0;
int32_t avg_dbm8 = 0;
+ unsigned int i;
- for (unsigned int i = 0; i < meas_num; i++) {
+ for (i = 0; i < meas_num; i++) {
int j = (rx_tch.meas_id + FACCH_MEAS_HIST - i) % FACCH_MEAS_HIST;
avg_snr += rx_tch.meas[j].snr;
avg_dbm8 += rx_tch.meas[j].pm_dbm8;
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35080?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I6c65fbead4e612c81728e9c6601d5f2107616ee6
Gerrit-Change-Number: 35080
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
arehbein has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35073?usp=email )
Change subject: port from osmo_stream_*_get_ofd() to osmo_stream_srv_get_fd()
......................................................................
Patch Set 1: Code-Review-1
(4 comments)
Patchset:
PS1:
-1 because of #915
File src/osmo_ss7_asp.c:
https://gerrit.osmocom.org/c/libosmo-sccp/+/35073/comment/3658ad5a_96729220
PS1, Line 738: rc = ipa_msg_recv_buffered(ofd->fd, &msg, &asp->pending_msg);
I think `if (fd < 0) ...` like above would be good here
https://gerrit.osmocom.org/c/libosmo-sccp/+/35073/comment/9934344f_dd3d0b62
PS1, Line 846: asp->sock_name = osmo_sock_get_name(asp, fd);
`osmo_sock_get_name_buf()` (which will be called) does check for `fd < 0`, not sure if we also want to check here in advance
https://gerrit.osmocom.org/c/libosmo-sccp/+/35073/comment/36d319ed_3dbeb89a
PS1, Line 915: return ipa_rx_msg(asp, msg, fd & 0xf);
probably very problematic without a check `if (fd < 0)` ...?
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35073?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I12c66badfb4bdfdfe71f1716de960d353d3548b1
Gerrit-Change-Number: 35073
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 21 Nov 2023 09:22:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email )
Change subject: osmo_io: Factor out and use common send function from backend
......................................................................
Patch Set 1:
(1 comment)
File src/core/osmo_io.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-12527):
https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/4929bf1f_ac6ba335
PS1, Line 361: switch (msghdr->action) {
switch and case should be at the same indent
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35078?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: I6da2653d32aedd0e7872be0cf90a841b56462e59
Gerrit-Change-Number: 35078
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 21 Nov 2023 09:21:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35077?usp=email )
Change subject: osmo_io: Assert that iofd mod is correct when calling *_write_msgb
......................................................................
osmo_io: Assert that iofd mod is correct when calling *_write_msgb
Change-Id: Ief82ba7f9b280f85d66d68c358c36ba9866fe47a
Fixes: OS#6264
---
M src/core/osmo_io.c
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/35077/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 2b2b7dd..f23986f 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -356,6 +356,7 @@
{
int rc;
+ OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE);
if (OSMO_UNLIKELY(!iofd->io_ops.write_cb)) {
LOGPIO(iofd, LOGL_ERROR, "write_cb not set, Rejecting msgb\n");
return -EINVAL;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35077?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: Ief82ba7f9b280f85d66d68c358c36ba9866fe47a
Gerrit-Change-Number: 35077
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newchange
daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35079?usp=email )
Change subject: osmo_io: Remove union in struct osmo_io_ops
......................................................................
osmo_io: Remove union in struct osmo_io_ops
This allows us to check that the correct callbacks are set and log an
error or assert otherwise.
Change-Id: I138d57843edc29000530bb7896bcb239002ecbec
Related: #OS6263
---
M TODO-RELEASE
M include/osmocom/core/osmo_io.h
M src/core/osmo_io.c
3 files changed, 57 insertions(+), 32 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/35079/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index b67161d..5e7a00c 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
core ADD osmo_sock_multiaddr_{add,del}_local_addr()
core ADD gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd()
+core MODIFY remove union from struct osmo_io_ops
diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h
index b3d248f..8433e1b 100644
--- a/include/osmocom/core/osmo_io.h
+++ b/include/osmocom/core/osmo_io.h
@@ -35,38 +35,33 @@
{ return get_value_string(osmo_io_backend_names, val); }
struct osmo_io_ops {
- union {
- /* mode OSMO_IO_FD_MODE_READ_WRITE: */
- struct {
- /*! call-back function when something was read from fd */
- void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg);
- /*! call-back function when write has completed on fd */
- void (*write_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg);
- /*! call-back function to segment the data at message boundaries.
- * Needs to return the size of the next message. If it returns
- * -EAGAIN or a value larger than msgb_length() (message is incomplete)
- * osmo_io will wait for more data to be read. Other negative values
- * cause the msg to be discarded.
- * If a full message was received (segmentation_cb() returns a value <= msgb_length())
- * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any
- * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb()
- * (e.g. setting lxh or msgb->cb). */
- int (*segmentation_cb)(struct msgb *msg);
- };
+ /* mode OSMO_IO_FD_MODE_READ_WRITE: */
+ /*! call-back function when something was read from fd */
+ void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg);
+ /*! call-back function when write has completed on fd */
+ void (*write_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg);
+ /*! call-back function to segment the data at message boundaries.
+ * Needs to return the size of the next message. If it returns
+ * -EAGAIN or a value larger than msgb_length() (message is incomplete)
+ * osmo_io will wait for more data to be read. Other negative values
+ * cause the msg to be discarded.
+ * If a full message was received (segmentation_cb() returns a value <= msgb_length())
+ * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any
+ * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb()
+ * (e.g. setting lxh or msgb->cb). */
+ int (*segmentation_cb)(struct msgb *msg);
- /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */
- struct {
- /*! call-back function emulating recvfrom */
- void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg,
- const struct osmo_sockaddr *saddr);
- /*! call-back function emulating sendto */
- void (*sendto_cb)(struct osmo_io_fd *iofd, int res,
- struct msgb *msg,
- const struct osmo_sockaddr *daddr);
- };
- };
+ /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */
+ /*! call-back function emulating recvfrom */
+ void (*recvfrom_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg,
+ const struct osmo_sockaddr *saddr);
+ /*! call-back function emulating sendto */
+ void (*sendto_cb)(struct osmo_io_fd *iofd, int res,
+ struct msgb *msg,
+ const struct osmo_sockaddr *daddr);
+
};
void osmo_iofd_init(void);
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 68c7233..8a36628 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -462,6 +462,18 @@
return 0;
}
+bool iofd_verify_ioops(const struct osmo_io_fd *iofd, const struct osmo_io_ops *ops) {
+ switch (iofd->mode) {
+ case OSMO_IO_FD_MODE_READ_WRITE:
+ return ops->read_cb || ops->write_cb;
+ case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
+ return ops->recvfrom_cb || ops->sendto_cb;
+ case OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG:
+ default:
+ return false;
+ }
+}
+
/*! Allocate and setup a new iofd.
* \param[in] ctx the parent context from which to allocate
* \param[in] fd the underlying system file descriptor
@@ -485,8 +497,10 @@
if (name)
iofd->name = talloc_strdup(iofd, name);
- if (ioops)
+ if (ioops) {
+ OSMO_ASSERT(iofd_verify_ioops(iofd, ioops));
iofd->io_ops = *ioops;
+ }
iofd->pending = NULL;
@@ -702,6 +716,8 @@
* \param[in] ioops osmo_io_ops structure to be set */
void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
{
+ OSMO_ASSERT(iofd_verify_ioops(iofd, ioops));
+
iofd->io_ops = *ioops;
switch (iofd->mode) {
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35079?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: I138d57843edc29000530bb7896bcb239002ecbec
Gerrit-Change-Number: 35079
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newchange