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
This commit is contained in:
Daniel Willmann 2021-02-12 05:05:14 +01:00
parent a8fa567117
commit a8b61659e6
4 changed files with 13 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/gprs/frame_relay.h>
#include <osmocom/gprs/gprs_ns2.h>
#include <osmocom/vty/command.h>
@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}