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/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22447 ) Change subject: WIP mtu support ...................................................................... WIP mtu support Change-Id: Iaf621da527ace8b3fcaa8f51f5e8b4f26fdae9b7 --- M include/osmocom/gprs/bssgp_bvc_fsm.h M include/osmocom/gprs/gprs_bssgp2.h M src/gb/bssgp_bvc_fsm.c M src/gb/gprs_bssgp2.c 4 files changed, 29 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/22447/1 diff --git a/include/osmocom/gprs/bssgp_bvc_fsm.h b/include/osmocom/gprs/bssgp_bvc_fsm.h index e69c205..9d37c3d 100644 --- a/include/osmocom/gprs/bssgp_bvc_fsm.h +++ b/include/osmocom/gprs/bssgp_bvc_fsm.h @@ -30,6 +30,7 @@ BSSGP_BVCFSM_E_REQ_UNBLOCK, BSSGP_BVCFSM_E_REQ_RESET, /* data: uint8_t *cause */ BSSGP_BVCFSM_E_REQ_FC_BVC, /* data: struct bssgp2_flow_ctrl */ + BSSGP_BVCFSM_E_REQ_STATUS, /* data: struct bssgp2_status */ }; struct bssgp_bvc_fsm_ops { @@ -64,3 +65,5 @@ 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_mtu(struct osmo_fsm_inst *fi, uint16_t mtu); \ No newline at end of file diff --git a/include/osmocom/gprs/gprs_bssgp2.h b/include/osmocom/gprs/gprs_bssgp2.h index bf814cb..2396bea 100644 --- a/include/osmocom/gprs/gprs_bssgp2.h +++ b/include/osmocom/gprs/gprs_bssgp2.h @@ -4,6 +4,9 @@ #include <osmocom/gprs/protocol/gsm_08_18.h> #include <osmocom/gprs/gprs_ns2.h> +/* Set a conservative MTU as default (Ethernet MTU of 1500 - IPv6 Header - UDP Header */ +#define DEFAULT_BSSGP_MTU (1500 - 40 - 8) + struct bssgp2_flow_ctrl; struct gprs_ns2_inst; struct gprs_ra_id; @@ -38,6 +41,12 @@ } u; }; +struct bssgp2_status { + uint8_t cause; + /* Only used if cause is "BVCI blocked" or "BVCI unknown" */ + const uint16_t *bvci; + const struct msgb *orig_msg; +}; int bssgp2_nsi_tx_ptp(struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, struct msgb *msg, uint32_t lsp); @@ -59,7 +68,7 @@ struct msgb *bssgp2_enc_bvc_reset_ack(uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, const uint8_t *feat_bm, const uint8_t *ext_feat_bm); -struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg); +struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg, uint16_t mtu); int bssgp2_dec_fc_bvc(struct bssgp2_flow_ctrl *fc, const struct tlv_parsed *tp); diff --git a/src/gb/bssgp_bvc_fsm.c b/src/gb/bssgp_bvc_fsm.c index 6de0028..8db8866 100644 --- a/src/gb/bssgp_bvc_fsm.c +++ b/src/gb/bssgp_bvc_fsm.c @@ -116,6 +116,8 @@ /* NSEI of the underlying NS Entity */ uint16_t nsei; + /* MTU of the underlying NS Entity */ + uint16_t mtu; /* BVCI of this BVC */ uint16_t bvci; @@ -236,7 +238,7 @@ if (cause == BSSGP_CAUSE_UNKNOWN_BVCI || cause == BSSGP_CAUSE_BVCI_BLOCKED) bvci = &bfp->bvci; - tx = bssgp2_enc_status(cause, bvci, rx); + tx = bssgp2_enc_status(cause, bvci, rx, bfp->mtu); if (msgb_bvci(rx) == 0) fi_tx_sig(fi, tx); @@ -666,6 +668,7 @@ bfp->role_sgsn = role_sgsn; bfp->nsei = nsei; bfp->bvci = bvci; + bfp->mtu = DEFAULT_BSSGP_MTU; return fi; } diff --git a/src/gb/gprs_bssgp2.c b/src/gb/gprs_bssgp2.c index 5a8d41f..5ae31e7 100644 --- a/src/gb/gprs_bssgp2.c +++ b/src/gb/gprs_bssgp2.c @@ -217,8 +217,9 @@ /*! Encode BSSGP STATUS PDU as per TS 48.018 Section 10.4.14. * \param[in] cause BSSGP Cause value * \param[in] bvci optional BVCI - only encoded if non-NULL - * \param[in] msg optional message buffer containing PDU in error - only encoded if non-NULL */ -struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg) + * \param[in] msg optional message buffer containing PDU in error - only encoded if non-NULL + * \param[in] mtu Maximum size the NS layer accepts as payload */ +struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg, uint16_t mtu) { struct msgb *msg = bssgp_msgb_alloc(); struct bssgp_normal_hdr *bgph; @@ -229,12 +230,19 @@ bgph = (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph)); bgph->pdu_type = BSSGP_PDUT_STATUS; msgb_tvlv_put(msg, BSSGP_IE_CAUSE, 1, &cause); + /* FIXME: Require/encode BVCI only if cause is BVCI unknown/blocked + * See 3GPP TS 48.018 Ch. 10.4.14 */ if (bvci) { uint16_t _bvci = osmo_htons(*bvci); msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci); } - if (orig_msg) - msgb_tvlv_put(msg, BSSGP_IE_PDU_IN_ERROR, msgb_bssgp_len(orig_msg), msgb_bssgph(orig_msg)); + if (orig_msg) { + uint16_t len; + /* Calculate how long the orig_msg may be */ + mtu = mtu - msgb_length(msg); + len = OSMO_MIN(msgb_bssgp_len(orig_msg), mtu); + msgb_tvlv_put(msg, BSSGP_IE_PDU_IN_ERROR, len, msgb_bssgph(orig_msg)); + } return msg; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22447 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iaf621da527ace8b3fcaa8f51f5e8b4f26fdae9b7 Gerrit-Change-Number: 22447 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210126/e71ecc49/attachment.htm>