pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32597 )
Change subject: layer23: Store and use SAPI & NSAPI in apn->pdp ...................................................................... layer23: Store and use SAPI & NSAPI in apn->pdp Change-Id: If82c94ca9c84a94e63a9a5d642a27a7b4e3ff089 --- M src/host/layer23/include/osmocom/bb/common/apn.h M src/host/layer23/src/common/apn.c M src/host/layer23/src/modem/sm.c M src/host/layer23/src/modem/sndcp.c 4 files changed, 24 insertions(+), 10 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/common/apn.h b/src/host/layer23/include/osmocom/bb/common/apn.h index 538b31d..c449530 100644 --- a/src/host/layer23/include/osmocom/bb/common/apn.h +++ b/src/host/layer23/include/osmocom/bb/common/apn.h @@ -28,6 +28,11 @@ #define APN_TYPE_IPv6 0x02 /* v6-only */ #define APN_TYPE_IPv4v6 0x04 /* v4v6 dual-stack */ +struct osmobb_pdp_ctx { + uint8_t nsapi; + uint8_t llc_sapi; +}; + struct osmobb_apn { /* list of APNs inside MS */ struct llist_head list; @@ -52,6 +57,7 @@ } cfg; struct osmo_tundev *tun; struct apn_fsm_ctx fsm; + struct osmobb_pdp_ctx pdp; }; struct osmobb_apn *apn_alloc(struct osmocom_ms *ms, const char *name); diff --git a/src/host/layer23/src/common/apn.c b/src/host/layer23/src/common/apn.c index b9b032c..4ea5d3a 100644 --- a/src/host/layer23/src/common/apn.c +++ b/src/host/layer23/src/common/apn.c @@ -23,6 +23,8 @@ #include <talloc.h> +#include <osmocom/gprs/sm/sm.h> + #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> @@ -49,6 +51,9 @@ osmo_tundev_set_priv_data(apn->tun, apn); apn->ms = ms; + /* FIXME: may want to configure or pick free one in the future: */ + apn->pdp.nsapi = 6; + apn->pdp.llc_sapi = OSMO_GPRS_SM_LLC_SAPI_SAPI3; llist_add_tail(&apn->list, &ms->gprs.apn_list); return apn; diff --git a/src/host/layer23/src/modem/sm.c b/src/host/layer23/src/modem/sm.c index aac2b52..03982c6 100644 --- a/src/host/layer23/src/modem/sm.c +++ b/src/host/layer23/src/modem/sm.c @@ -229,8 +229,6 @@ struct osmo_gprs_sm_prim *sm_prim; const struct gsm_subscriber *subscr = &ms->subscr; enum osmo_gprs_sm_pdp_addr_ietf_type pdp_addr_ietf_type; - uint8_t nsapi = 6; - enum osmo_gprs_sm_llc_sapi llc_sapi = OSMO_GPRS_SM_LLC_SAPI_SAPI3; struct osmo_sockaddr pdp_addr_any = {0}; uint8_t qos[OSMO_GPRS_SM_QOS_MAXLEN] = {0}; uint8_t pco[OSMO_GPRS_SM_QOS_MAXLEN] = {0}; @@ -248,8 +246,8 @@ } sm_prim = osmo_gprs_sm_prim_alloc_smreg_pdp_act_req(); - sm_prim->smreg.pdp_act_req.nsapi = nsapi; - sm_prim->smreg.pdp_act_req.llc_sapi = llc_sapi; + sm_prim->smreg.pdp_act_req.nsapi = apn->pdp.nsapi; + sm_prim->smreg.pdp_act_req.llc_sapi = apn->pdp.llc_sapi; sm_prim->smreg.pdp_act_req.pdp_addr_ietf_type = pdp_addr_ietf_type; sm_prim->smreg.pdp_act_req.pdp_addr_v4 = pdp_addr_any; sm_prim->smreg.pdp_act_req.pdp_addr_v6 = pdp_addr_any; diff --git a/src/host/layer23/src/modem/sndcp.c b/src/host/layer23/src/modem/sndcp.c index b4b7761..7814e50 100644 --- a/src/host/layer23/src/modem/sndcp.c +++ b/src/host/layer23/src/modem/sndcp.c @@ -181,10 +181,8 @@ /* TODO: look up PDP context IDs from ms once we have GMM layer. */ uint32_t tlli = 0xe1c5d364; - uint8_t sapi = OSMO_GPRS_LLC_SAPI_SNDCP3; - uint8_t nsapi = 1; - sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, sapi, nsapi); + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, apn->pdp.llc_sapi, apn->pdp.nsapi); OSMO_ASSERT(sndcp_prim); sndcp_prim->sn.xid_req.pcomp_rfc1144.active = set->pcomp_rfc1144.active; sndcp_prim->sn.xid_req.pcomp_rfc1144.s01 = set->pcomp_rfc1144.s01; @@ -203,10 +201,8 @@ /* TODO: look up PDP context IDs from apn->ms once we have GMM layer. */ uint32_t tlli = 0xe1c5d364; - uint8_t sapi = OSMO_GPRS_LLC_SAPI_SNDCP3; - uint8_t nsapi = 1; - sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_unitdata_req(tlli, sapi, nsapi, npdu, npdu_len); + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_unitdata_req(tlli, apn->pdp.llc_sapi, apn->pdp.nsapi, npdu, npdu_len); OSMO_ASSERT(sndcp_prim); rc = osmo_gprs_sndcp_prim_upper_down(sndcp_prim); return rc; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32597 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: If82c94ca9c84a94e63a9a5d642a27a7b4e3ff089 Gerrit-Change-Number: 32597 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged