From a8b61659e68f3796d30968bed02050911331fcc5 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 12 Feb 2021 05:05:14 +0100 Subject: [PATCH] Add SDU length for an NSE (== BSSGP PDU size) Prepare tracking the SDU from NS. Initialize with a conservative default. The value is not yet updated, that will happen in a later patch. Related: OS#4889 Depends: I5016b295db6185ec131d83089cf6c806e34ef1b6 (libosmocore.git) Depends: I9bb82ead27366b7370c9ff968e03ca2113ec11f0 (libosmocore.git) Change-Id: Ic1080abde942ec5a2ae7cdee0ffe716a2fbddb1e --- include/osmocom/sgsn/gb_proxy.h | 7 +++++++ src/gb_proxy.c | 4 ++++ src/gb_proxy_peer.c | 1 + src/gb_proxy_vty.c | 1 + 4 files changed, 13 insertions(+) diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index a36f3051..c9d2fca2 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -21,6 +22,9 @@ #define GBPROXY_INIT_VU_GEN_TX 256 #define GBPROXY_MAX_NR_SGSN 16 +/* Set conservative default BSSGP SDU (FR SDU - size of NS UNITDATA IEs) */ +#define DEFAULT_NSE_SDU (FRAME_RELAY_SDU - 4) + /* BVCI uses 16 bits */ #define BVC_LOG_CTX_FLAG (1<<17) @@ -161,6 +165,9 @@ struct gbproxy_nse { /* NSEI of the NSE */ uint16_t nsei; + /* Maximum side of the NS-UNITDATA NS SDU that can be transported by the NSE */ + uint16_t max_sdu_len; + /* Are we facing towards a SGSN (true) or BSS (false) */ bool sgsn_facing; diff --git a/src/gb_proxy.c b/src/gb_proxy.c index 8b57315c..7f4af5bd 100644 --- a/src/gb_proxy.c +++ b/src/gb_proxy.c @@ -684,6 +684,7 @@ static void bss_ptp_bvc_reset_notif(uint16_t nsei, uint16_t bvci, const struct g sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei, bvci, ra_id, cell_id); OSMO_ASSERT(sgsn_bvc->fi); + bssgp_bvc_fsm_set_max_pdu_len(sgsn_bvc->fi, sgsn_nse->max_sdu_len); bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc); gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc); @@ -828,6 +829,7 @@ static int rx_bvc_reset_from_bss(struct gbproxy_nse *nse, struct msgb *msg, stru gbproxy_bvc_free(from_bvc); return -ENOMEM; } + bssgp_bvc_fsm_set_max_pdu_len(from_bvc->fi, nse->max_sdu_len); bssgp_bvc_fsm_set_ops(from_bvc->fi, &bss_sig_bvc_fsm_ops, from_bvc); } } else { @@ -844,6 +846,7 @@ static int rx_bvc_reset_from_bss(struct gbproxy_nse *nse, struct msgb *msg, stru gbproxy_bvc_free(from_bvc); return -ENOMEM; } + bssgp_bvc_fsm_set_max_pdu_len(from_bvc->fi, nse->max_sdu_len); bssgp_bvc_fsm_set_ops(from_bvc->fi, &bss_ptp_bvc_fsm_ops, from_bvc); } #if 0 @@ -1500,6 +1503,7 @@ void gprs_ns_prim_status_cb(struct gbproxy_config *cfg, struct osmo_gprs_ns2_pri { /* TODO: bss nsei available/unavailable bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_BLOCK, nsvc->nsei, bvc->bvci, 0); * TODO: sgsn nsei available/unavailable + * TODO: Update MTU */ struct gbproxy_bvc *bvc; diff --git a/src/gb_proxy_peer.c b/src/gb_proxy_peer.c index 27d73b8e..a9471f09 100644 --- a/src/gb_proxy_peer.c +++ b/src/gb_proxy_peer.c @@ -447,6 +447,7 @@ struct gbproxy_nse *gbproxy_nse_alloc(struct gbproxy_config *cfg, uint16_t nsei, return NULL; nse->nsei = nsei; + nse->max_sdu_len = DEFAULT_NSE_SDU; nse->cfg = cfg; nse->sgsn_facing = sgsn_facing; diff --git a/src/gb_proxy_vty.c b/src/gb_proxy_vty.c index 04c71732..3a52e32c 100644 --- a/src/gb_proxy_vty.c +++ b/src/gb_proxy_vty.c @@ -241,6 +241,7 @@ DEFUN(cfg_sgsn_nsei, bvc->fi = bssgp_bvc_fsm_alloc_sig_bss(bvc, nse->cfg->nsi, nsei, features); if (!bvc->fi) goto free_bvc; + bssgp_bvc_fsm_set_max_pdu_len(bvc->fi, nse->max_sdu_len); bssgp_bvc_fsm_set_ops(bvc->fi, &sgsn_sig_bvc_fsm_ops, bvc); osmo_fsm_inst_dispatch(bvc->fi, BSSGP_BVCFSM_E_REQ_RESET, &cause); }