diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-01-05 18:43:39 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-01-05 18:46:23 +0100 |
commit | 51028e2c16820d50808900f2003310d8dcbf2d49 (patch) | |
tree | 73a9c94e215c937a699a3ab1d5bef546403b52ba | |
parent | e69f460ae7d0f12999cc967bc4c362399a0892d0 (diff) |
Properly split llc->sndcp->gtp unitdata pathi through extra func call
Beforehand the function handling the LL-UNITDATA primitive from LLC was
already submitting the packet to GTP code which had an SNDCP related
name, so everything was really confusing and layer separation was not
clean.
Change-Id: Ia544a9dd4c0c7647b0c1b64ca110351f40820618
-rw-r--r-- | include/osmocom/sgsn/gprs_sndcp.h | 4 | ||||
-rw-r--r-- | include/osmocom/sgsn/gtp.h | 3 | ||||
-rw-r--r-- | include/osmocom/sgsn/sgsn.h | 3 | ||||
-rw-r--r-- | src/sgsn/gprs_sndcp.c | 23 | ||||
-rw-r--r-- | src/sgsn/sgsn_libgtp.c | 2 |
5 files changed, 24 insertions, 11 deletions
diff --git a/include/osmocom/sgsn/gprs_sndcp.h b/include/osmocom/sgsn/gprs_sndcp.h index caf675cdd..b77fff292 100644 --- a/include/osmocom/sgsn/gprs_sndcp.h +++ b/include/osmocom/sgsn/gprs_sndcp.h @@ -81,4 +81,8 @@ int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf, /* Clean up all gprs_sndcp_entities related to llme (OS#4824) */ void gprs_sndcp_sm_deactivate_ind_by_llme(const struct gprs_llc_llme *llme); +/* Called by SNDCP when it has received/re-assembled a N-PDU */ +int sndcp_sn_ud_ind(struct gprs_sndcp_entity *sne, struct msgb *msg, + uint32_t npdu_len, uint8_t *npdu); + #endif /* INT_SNDCP_H */ diff --git a/include/osmocom/sgsn/gtp.h b/include/osmocom/sgsn/gtp.h index 85a50d3b7..e835b536a 100644 --- a/include/osmocom/sgsn/gtp.h +++ b/include/osmocom/sgsn/gtp.h @@ -3,3 +3,6 @@ struct sgsn_instance; int sgsn_gtp_init(struct sgsn_instance *sgi); + +int sgsn_gtp_data_req(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, + struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index 76d5702c2..f2bb49fd1 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -186,9 +186,6 @@ int sgsn_mme_ran_info_req(struct sgsn_mme_ctx *mme, const struct bssgp_ran_infor int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); /* Entry point for the SNSM-DEACTIVATE.indication */ int sndcp_sm_deactivate_ind(const struct gprs_llc_lle *lle, uint8_t nsapi); -/* Called by SNDCP when it has received/re-assembled a N-PDU */ -int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, - struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, void *mmcontext); int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c index a0c35bfbc..8ee752e8d 100644 --- a/src/sgsn/gprs_sndcp.c +++ b/src/sgsn/gprs_sndcp.c @@ -42,6 +42,7 @@ #include <osmocom/sgsn/gprs_sndcp_dcomp.h> #include <osmocom/sgsn/gprs_sndcp_comp.h> #include <osmocom/sgsn/gprs_gmm.h> +#include <osmocom/sgsn/gtp.h> #define DEBUG_IP_PACKETS 0 /* 0=Disabled, 1=Enabled */ @@ -397,9 +398,8 @@ static int defrag_segments(struct gprs_sndcp_entity *sne) expnd = npdu; } - /* Hand off packet to gtp */ - rc = sgsn_rx_sndcp_ud_ind(&sne->ra_id, sne->lle->llme->tlli, - sne->nsapi, msg, npdu_len, expnd); + /* Hand off packet to SGSN (SNDCP SN-UNITDATA.ind), which will forward it to GGSN (GTP): */ + rc = sndcp_sn_ud_ind(sne, msg, npdu_len, expnd); ret_free: /* we must free the memory we allocated above; ownership is not transferred @@ -864,8 +864,7 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, LOGP(DSNDCP, LOGL_ERROR, "Short SNDCP N-PDU: %d\n", npdu_len); return -EIO; } - /* actually send the N-PDU to the SGSN core code, which then - * hands it off to the correct GTP tunnel + GGSN via gtp_data_req() */ + /* actually send the N-PDU to the SGSN core code (SNDCP SN-UNITDATA.ind) */ /* Decompress packet */ if (any_pcomp_or_dcomp_active(sgsn)) { @@ -879,8 +878,7 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, } /* Hand off packet to gtp */ - rc = sgsn_rx_sndcp_ud_ind(&sne->ra_id, lle->llme->tlli, - sne->nsapi, msg, npdu_len, expnd); + rc = sndcp_sn_ud_ind(sne, msg, npdu_len, expnd); ret_free: if (any_pcomp_or_dcomp_active(sgsn)) @@ -889,6 +887,17 @@ ret_free: return rc; } +/* 5.1.1.4 SN-UNITDATA.indication + * Called by SNDCP when it has received/re-assembled a N-PDU + */ +int sndcp_sn_ud_ind(struct gprs_sndcp_entity *sne, + struct msgb *msg, uint32_t npdu_len, uint8_t *npdu) +{ + /* Hand it off N-PDU to the correct GTP tunnel + GGSN: */ + return sgsn_gtp_data_req(&sne->ra_id, sne->lle->llme->tlli, + sne->nsapi, msg, npdu_len, npdu); +} + #if 0 /* Section 5.1.2.1 LL-RESET.ind */ static int sndcp_ll_reset_ind(struct gprs_sndcp_entity *se) diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index 58e912d45..f76180a27 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -809,7 +809,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len) } /* Called by SNDCP when it has received/re-assembled a N-PDU */ -int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, +int sgsn_gtp_data_req(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, struct msgb *msg, uint32_t npdu_len, uint8_t *npdu) { struct sgsn_mm_ctx *mmctx; |