aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2021-01-25 17:02:25 +0100
committerdaniel <dwillmann@sysmocom.de>2021-02-12 14:19:20 +0000
commit1ff86f7cec32d39b84effa896569f8fc7ca703d2 (patch)
tree85bf72a3c478b7e0b793bda5e68ce49265b34513
parentae9899561c56ae071b45713ad186585d2379dd6e (diff)
bssgp_bvc_fsm: Set/get maximum BSSGP PDU length
Add functions to get/set the maximum supported BSSGP PDU size by the NS layer. IPv4 and IPv6 should not matter since we can just enable IP fragmentation and send NS PDUs up to 2**16 + bytes. Frame relay does not support fragmentation and this is the reason we need to be aware of the maximum PDU size. Luckily with 1600 bytes the MTU in frame relay can hold a regular IP packet including NS/BSSGP overhead. On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10) Change-Id: I9bb82ead27366b7370c9ff968e03ca2113ec11f0 Related: OS#4889
-rw-r--r--include/osmocom/gprs/bssgp_bvc_fsm.h3
-rw-r--r--src/gb/bssgp_bvc_fsm.c23
-rw-r--r--src/gb/libosmogb.map2
3 files changed, 28 insertions, 0 deletions
diff --git a/include/osmocom/gprs/bssgp_bvc_fsm.h b/include/osmocom/gprs/bssgp_bvc_fsm.h
index e69c2051..824cdecb 100644
--- a/include/osmocom/gprs/bssgp_bvc_fsm.h
+++ b/include/osmocom/gprs/bssgp_bvc_fsm.h
@@ -64,3 +64,6 @@ uint8_t bssgp_bvc_fsm_get_block_cause(struct osmo_fsm_inst *fi);
uint32_t bssgp_bvc_get_features_advertised(struct osmo_fsm_inst *fi);
uint32_t bssgp_bvc_get_features_received(struct osmo_fsm_inst *fi);
uint32_t bssgp_bvc_get_features_negotiated(struct osmo_fsm_inst *fi);
+
+void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len);
+uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi); \ No newline at end of file
diff --git a/src/gb/bssgp_bvc_fsm.c b/src/gb/bssgp_bvc_fsm.c
index 6b8bd142..d2ee1462 100644
--- a/src/gb/bssgp_bvc_fsm.c
+++ b/src/gb/bssgp_bvc_fsm.c
@@ -116,6 +116,8 @@ struct bvc_fsm_priv {
/* NSEI of the underlying NS Entity */
uint16_t nsei;
+ /* Maximum size of the BSSGP PDU */
+ uint16_t max_pdu_len;
/* BVCI of this BVC */
uint16_t bvci;
@@ -666,6 +668,7 @@ _bvc_fsm_alloc(void *ctx, struct gprs_ns2_inst *nsi, bool role_sgsn, uint16_t ns
bfp->role_sgsn = role_sgsn;
bfp->nsei = nsei;
bfp->bvci = bvci;
+ bfp->max_pdu_len = UINT16_MAX;
return fi;
}
@@ -817,6 +820,26 @@ uint32_t bssgp_bvc_get_features_negotiated(struct osmo_fsm_inst *fi)
return bfp->features.negotiated;
}
+/*! Set the maximum size of a BSSGP PDU.
+ *! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10) */
+void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len) {
+ struct bvc_fsm_priv *bfp = fi->priv;
+
+ OSMO_ASSERT(fi->fsm == &bssgp_bvc_fsm);
+ bfp->max_pdu_len = max_pdu_len;
+}
+
+/*! Return the maximum size of a BSSGP PDU
+ *! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10) */
+uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi)
+{
+ const struct bvc_fsm_priv *bfp = fi->priv;
+
+ OSMO_ASSERT(fi->fsm == &bssgp_bvc_fsm);
+ return bfp->max_pdu_len;
+}
+
+
static __attribute__((constructor)) void on_dso_load_bvc_fsm(void)
{
OSMO_ASSERT(osmo_fsm_register(&bssgp_bvc_fsm) == 0);
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 7da11cda..23278153 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -96,6 +96,8 @@ bssgp_bvc_fsm_get_block_cause;
bssgp_bvc_get_features_advertised;
bssgp_bvc_get_features_received;
bssgp_bvc_get_features_negotiated;
+bssgp_bvc_fsm_set_max_pdu_len;
+bssgp_bvc_fsm_get_max_pdu_len;
osmo_fr_network_alloc;
osmo_fr_link_alloc;