<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13004">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gsm0808: make msgb size and headroom configurable<br><br>Allow for manual configuration of buffer size and headroom by exposing<br>osmo_gsm0808_msg_size and osmo_gsm0808_msg_headroom; if unset (remaining 0),<br>the current defaults remain in effect.<br><br>In osmo-msc, I would like to prepend an osmo_prim to the msgb created by<br>gsm0808 API, but turns out the headroom is too small:<br><br>    msgb(0x61700001b660): Not enough headroom msgb_push (126 < 264)<br><br>Instead of always copying a msgb that has just that instant been created, it<br>makes more sense to allocate sufficient headroom in the first place. The<br>gsm0808 API allocates msgb implicitly, this is the least impact fix.<br><br>Compat: the BSSMAP_MSG_SIZE and BSSMAP_HEADROOM_SIZE can no longer be used as<br>constants, e.g. to initialize the size of static things. They should only ever<br>be used with msgb_alloc_headroom(), so I assert that this is fine.<br>I am not sure why these #defines are in the public header in the first place,<br>but since they are, keep them there and make them reflect the actually used<br>sizes.<br><br>Change-Id: I95729991eb49555f8bba60c5dc916131b03b6cf2<br>---<br>M TODO-RELEASE<br>M include/osmocom/gsm/gsm0808.h<br>M src/gsm/gsm0808.c<br>M src/gsm/libosmogsm.map<br>4 files changed, 12 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/04/13004/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/TODO-RELEASE b/TODO-RELEASE</span><br><span>index 8ccfa49..9bf5b03 100644</span><br><span>--- a/TODO-RELEASE</span><br><span>+++ b/TODO-RELEASE</span><br><span>@@ -7,3 +7,4 @@</span><br><span> # If any interfaces have been added since the last public release: c:r:a + 1.</span><br><span> # If any interfaces have been removed or changed since the last public release: c:r:0.</span><br><span> #library    what                    description / commit summary line</span><br><span style="color: hsl(120, 100%, 40%);">+gsm          gsm0808.h               GSM0808_MSG_SIZE and GSM0808_MSG_HEADROOM are no longer compile-time constant numbers</span><br><span>diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h</span><br><span>index 35e7a8e..dfab29a 100644</span><br><span>--- a/include/osmocom/gsm/gsm0808.h</span><br><span>+++ b/include/osmocom/gsm/gsm0808.h</span><br><span>@@ -29,8 +29,12 @@</span><br><span> #include <osmocom/gsm/gsm23003.h></span><br><span> #include <osmocom/core/utils.h></span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define BSSMAP_MSG_SIZE 512</span><br><span style="color: hsl(0, 100%, 40%);">-#define BSSMAP_MSG_HEADROOM 128</span><br><span style="color: hsl(120, 100%, 40%);">+#define BSSMAP_MSG_DEFAULT_SIZE 512</span><br><span style="color: hsl(120, 100%, 40%);">+#define BSSMAP_MSG_DEFAULT_HEADROOM 128</span><br><span style="color: hsl(120, 100%, 40%);">+extern size_t osmo_gsm0808_msg_size;</span><br><span style="color: hsl(120, 100%, 40%);">+extern size_t osmo_gsm0808_msg_headroom;</span><br><span style="color: hsl(120, 100%, 40%);">+#define BSSMAP_MSG_HEADROOM (osmo_gsm0808_msg_headroom ? : BSSMAP_MSG_DEFAULT_HEADROOM)</span><br><span style="color: hsl(120, 100%, 40%);">+#define BSSMAP_MSG_SIZE (osmo_gsm0808_msg_size ? : BSSMAP_MSG_DEFAULT_SIZE - BSSMAP_MSG_DEFAULT_HEADROOM + BSSMAP_MSG_HEADROOM)</span><br><span> </span><br><span> struct sockaddr_storage;</span><br><span> </span><br><span>diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c</span><br><span>index 4873076..ff17bd2 100644</span><br><span>--- a/src/gsm/gsm0808.c</span><br><span>+++ b/src/gsm/gsm0808.c</span><br><span>@@ -27,6 +27,9 @@</span><br><span> #include <osmocom/gsm/protocol/gsm_08_08.h></span><br><span> #include <osmocom/gsm/gsm48.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+size_t osmo_gsm0808_msg_size = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+size_t osmo_gsm0808_msg_headroom = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \addtogroup gsm0808</span><br><span>  *  @{</span><br><span>  *  \file gsm0808.c</span><br><span>diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map</span><br><span>index 48757a7..525fa0d 100644</span><br><span>--- a/src/gsm/libosmogsm.map</span><br><span>+++ b/src/gsm/libosmogsm.map</span><br><span>@@ -228,6 +228,8 @@</span><br><span> gsm0808_lcls_status_names;</span><br><span> gsm0808_enc_lcls;</span><br><span> gsm0808_dec_lcls;</span><br><span style="color: hsl(120, 100%, 40%);">+osmo_gsm0808_msg_size;</span><br><span style="color: hsl(120, 100%, 40%);">+osmo_gsm0808_msg_headroom;</span><br><span> </span><br><span> gsm29118_msgb_alloc;</span><br><span> gsm29118_create_alert_req;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13004">change 13004</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13004"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I95729991eb49555f8bba60c5dc916131b03b6cf2 </div>
<div style="display:none"> Gerrit-Change-Number: 13004 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>