[MERGED] libosmocore[master]: sercomm: make rx msg size configurable per instance

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 17 10:46:41 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: sercomm: make rx msg size configurable per instance
......................................................................


sercomm: make rx msg size configurable per instance

Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
---
M include/osmocom/core/sercomm.h
M src/sercomm.c
2 files changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/sercomm.h b/include/osmocom/core/sercomm.h
index 10deb7c..d84786e 100644
--- a/include/osmocom/core/sercomm.h
+++ b/include/osmocom/core/sercomm.h
@@ -39,6 +39,7 @@
 	/* receive side */
 	struct {
 		dlci_cb_t dlci_handler[_SC_DLCI_MAX];
+		unsigned int msg_size;
 		struct msgb *msg;
 		int state;
 		uint8_t dlci;
diff --git a/src/sercomm.c b/src/sercomm.c
index b0ba492..f96be83 100644
--- a/src/sercomm.c
+++ b/src/sercomm.c
@@ -28,7 +28,7 @@
 
 #ifdef HOST_BUILD
 
-# define SERCOMM_RX_MSG_SIZE	2048
+# define DEFAULT_RX_MSG_SIZE	2048
 # ifndef ARRAY_SIZE
 #  define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 # endif
@@ -39,7 +39,7 @@
 
 #else
 
-# define SERCOMM_RX_MSG_SIZE	256
+# define DEFAULT_RX_MSG_SIZE	256
 # include <debug.h>
 # include <osmocom/core/linuxlist.h>
 # include <asm/system.h>
@@ -87,6 +87,8 @@
 		INIT_LLIST_HEAD(&sercomm->tx.dlci_queues[i]);
 
 	sercomm->rx.msg = NULL;
+	if (!sercomm->rx.msg_size)
+		sercomm->rx.msg_size = DEFAULT_RX_MSG_SIZE;
 	sercomm->initialized = 1;
 
 	/* set up the echo dlci */
@@ -262,12 +264,12 @@
 	 * which means that any data structures we use need to be for
 	 * our exclusive access */
 	if (!sercomm->rx.msg)
-		sercomm->rx.msg = osmo_sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
+		sercomm->rx.msg = osmo_sercomm_alloc_msgb(sercomm->rx.msg_size);
 
 	if (msgb_tailroom(sercomm->rx.msg) == 0) {
 		//cons_puts("sercomm_drv_rx_char() overflow!\n");
 		msgb_free(sercomm->rx.msg);
-		sercomm->rx.msg = osmo_sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
+		sercomm->rx.msg = osmo_sercomm_alloc_msgb(sercomm->rx.msg_size);
 		sercomm->rx.state = RX_ST_WAIT_START;
 		return 0;
 	}

-- 
To view, visit https://gerrit.osmocom.org/2636
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list