<p>daniel <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/22873">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bssgp_bvc_fsm: Set/get maximum BSSGP PDU length<br><br>Add functions to get/set the maximum supported BSSGP PDU size by the NS<br>layer.<br><br>IPv4 and IPv6 should not matter since we can just enable IP<br>fragmentation and send NS PDUs up to 2**16 + bytes. Frame relay does not<br>support fragmentation and this is the reason we need to be aware of the<br>maximum PDU size. Luckily with 1600 bytes the MTU in frame relay can hold a<br>regular IP packet including NS/BSSGP overhead.<br><br>On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA<br>(3GPP TS 48.016 Ch. 9.2.10)<br><br>Change-Id: I9bb82ead27366b7370c9ff968e03ca2113ec11f0<br>Related: OS#4889<br>---<br>M include/osmocom/gprs/bssgp_bvc_fsm.h<br>M src/gb/bssgp_bvc_fsm.c<br>M src/gb/libosmogb.map<br>3 files changed, 28 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gprs/bssgp_bvc_fsm.h b/include/osmocom/gprs/bssgp_bvc_fsm.h</span><br><span>index e69c205..824cdec 100644</span><br><span>--- a/include/osmocom/gprs/bssgp_bvc_fsm.h</span><br><span>+++ b/include/osmocom/gprs/bssgp_bvc_fsm.h</span><br><span>@@ -64,3 +64,6 @@</span><br><span> uint32_t bssgp_bvc_get_features_advertised(struct osmo_fsm_inst *fi);</span><br><span> uint32_t bssgp_bvc_get_features_received(struct osmo_fsm_inst *fi);</span><br><span> uint32_t bssgp_bvc_get_features_negotiated(struct osmo_fsm_inst *fi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len);</span><br><span style="color: hsl(120, 100%, 40%);">+uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi);</span><br><span>\ No newline at end of file</span><br><span>diff --git a/src/gb/bssgp_bvc_fsm.c b/src/gb/bssgp_bvc_fsm.c</span><br><span>index 6b8bd14..d2ee146 100644</span><br><span>--- a/src/gb/bssgp_bvc_fsm.c</span><br><span>+++ b/src/gb/bssgp_bvc_fsm.c</span><br><span>@@ -116,6 +116,8 @@</span><br><span> </span><br><span>       /* NSEI of the underlying NS Entity */</span><br><span>       uint16_t nsei;</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Maximum size of the BSSGP PDU */</span><br><span style="color: hsl(120, 100%, 40%);">+   uint16_t max_pdu_len;</span><br><span> </span><br><span>    /* BVCI of this BVC */</span><br><span>       uint16_t bvci;</span><br><span>@@ -666,6 +668,7 @@</span><br><span>         bfp->role_sgsn = role_sgsn;</span><br><span>       bfp->nsei = nsei;</span><br><span>         bfp->bvci = bvci;</span><br><span style="color: hsl(120, 100%, 40%);">+  bfp->max_pdu_len = UINT16_MAX;</span><br><span> </span><br><span>        return fi;</span><br><span> }</span><br><span>@@ -817,6 +820,26 @@</span><br><span>       return bfp->features.negotiated;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Set the maximum size of a BSSGP PDU.</span><br><span style="color: hsl(120, 100%, 40%);">+ *! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10) */</span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len) {</span><br><span style="color: hsl(120, 100%, 40%);">+     struct bvc_fsm_priv *bfp = fi->priv;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     OSMO_ASSERT(fi->fsm == &bssgp_bvc_fsm);</span><br><span style="color: hsl(120, 100%, 40%);">+        bfp->max_pdu_len = max_pdu_len;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*! Return the maximum size of a BSSGP PDU</span><br><span style="color: hsl(120, 100%, 40%);">+ *! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10) */</span><br><span style="color: hsl(120, 100%, 40%);">+uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   const struct bvc_fsm_priv *bfp = fi->priv;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       OSMO_ASSERT(fi->fsm == &bssgp_bvc_fsm);</span><br><span style="color: hsl(120, 100%, 40%);">+        return bfp->max_pdu_len;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static __attribute__((constructor)) void on_dso_load_bvc_fsm(void)</span><br><span> {</span><br><span>        OSMO_ASSERT(osmo_fsm_register(&bssgp_bvc_fsm) == 0);</span><br><span>diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map</span><br><span>index 7da11cd..2327815 100644</span><br><span>--- a/src/gb/libosmogb.map</span><br><span>+++ b/src/gb/libosmogb.map</span><br><span>@@ -96,6 +96,8 @@</span><br><span> bssgp_bvc_get_features_advertised;</span><br><span> bssgp_bvc_get_features_received;</span><br><span> bssgp_bvc_get_features_negotiated;</span><br><span style="color: hsl(120, 100%, 40%);">+bssgp_bvc_fsm_set_max_pdu_len;</span><br><span style="color: hsl(120, 100%, 40%);">+bssgp_bvc_fsm_get_max_pdu_len;</span><br><span> </span><br><span> osmo_fr_network_alloc;</span><br><span> osmo_fr_link_alloc;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/22873">change 22873</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/c/libosmocore/+/22873"/><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-Change-Id: I9bb82ead27366b7370c9ff968e03ca2113ec11f0 </div>
<div style="display:none"> Gerrit-Change-Number: 22873 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>