pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/32080 )
Change subject: layer23: modem: Forward GMMRR primitives between GMM and RLCMAC layers
......................................................................
layer23: modem: Forward GMMRR primitives between GMM and RLCMAC layers
Related: OS#5501
Change-Id: I7603d8bbda0cdd437eb7557267efb7bbc3552565
---
M src/host/layer23/src/modem/gmm.c
M src/host/layer23/src/modem/rlcmac.c
2 files changed, 42 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/src/host/layer23/src/modem/gmm.c b/src/host/layer23/src/modem/gmm.c
index f88226e..9472e32 100644
--- a/src/host/layer23/src/modem/gmm.c
+++ b/src/host/layer23/src/modem/gmm.c
@@ -35,6 +35,7 @@
#include <osmocom/gprs/llc/llc_prim.h>
#include <osmocom/gprs/gmm/gmm_prim.h>
#include <osmocom/gprs/gmm/gmm.h>
+#include <osmocom/gprs/rlcmac/rlcmac_prim.h>
#include <osmocom/bb/common/settings.h>
#include <osmocom/bb/common/logging.h>
@@ -42,7 +43,6 @@
#include <osmocom/bb/common/ms.h>
#include <osmocom/bb/modem/gmm.h>
-
static int modem_gmm_prim_up_cb(struct osmo_gprs_gmm_prim *gmm_prim, void *user_data)
{
const char *pdu_name = osmo_gprs_gmm_prim_name(gmm_prim);
@@ -72,7 +72,22 @@
const char *pdu_name = osmo_gprs_gmm_prim_name(gmm_prim);
int rc = 0;
+ osmo_static_assert(sizeof(struct osmo_gprs_gmm_gmmrr_prim) == sizeof(struct
osmo_gprs_rlcmac_gmmrr_prim),
+ _gmmrr_prim_size);
+
switch (gmm_prim->oph.sap) {
+ case OSMO_GPRS_GMM_SAP_GMMRR:
+ /* Forward it to lower layers, pass ownership over to RLCMAC: */
+ /* Optimization: GMM-GMMRR-ASSIGN-REQ is 1-to-1 ABI compatible with
+ RLCMAC-GMMRR-ASSIGN-REQ, we just need to adapt the header.
+ See osmo_static_assert(_gmmrr_prim_size) above.
+ */
+ OSMO_ASSERT(gmm_prim->oph.primitive == OSMO_GPRS_GMM_GMMRR_ASSIGN);
+ gmm_prim->oph.sap = OSMO_GPRS_RLCMAC_SAP_GMMRR;
+ gmm_prim->oph.primitive = OSMO_GPRS_RLCMAC_GMMRR_ASSIGN;
+ osmo_gprs_rlcmac_prim_upper_down((struct osmo_gprs_rlcmac_prim *)gmm_prim);
+ rc = 1; /* Tell GMM that we take ownership of the prim. */
+ break;
case OSMO_GPRS_GMM_SAP_GMMREG:
default:
LOGP(DGMM, LOGL_ERROR, "%s(): Unexpected Rx %s\n", __func__, pdu_name);
diff --git a/src/host/layer23/src/modem/rlcmac.c b/src/host/layer23/src/modem/rlcmac.c
index 8327620..deb366a 100644
--- a/src/host/layer23/src/modem/rlcmac.c
+++ b/src/host/layer23/src/modem/rlcmac.c
@@ -35,6 +35,7 @@
#include <osmocom/gprs/rlcmac/rlcmac_prim.h>
#include <osmocom/gprs/rlcmac/rlcmac.h>
#include <osmocom/gprs/llc/llc_prim.h>
+#include <osmocom/gprs/gmm/gmm_prim.h>
#include <osmocom/bb/common/logging.h>
#include <osmocom/bb/common/l1ctl.h>
@@ -75,12 +76,24 @@
static int modem_rlcmac_handle_gmmrr(struct osmo_gprs_rlcmac_prim *rlcmac_prim)
{
+ struct osmo_gprs_gmm_prim *gmm_prim;
int rc;
+
+ osmo_static_assert(sizeof(struct osmo_gprs_rlcmac_gmmrr_prim) == sizeof(struct
osmo_gprs_gmm_gmmrr_prim),
+ _gmmrr_prim_size);
+
switch (rlcmac_prim->oph.primitive) {
case OSMO_GPRS_RLCMAC_GMMRR_PAGE:
- LOGP(DRLCMAC, LOGL_ERROR, "%s(): TODO: implement answering to paging indication
TLLI=0x%08x\n",
- __func__, rlcmac_prim->gmmrr.page_ind.tlli);
- rc = 0;
+ /* Forward it to upper layers, pass ownership over to GMM: */
+ /* Optimization: RLCMAC-GMMRR-ASSIGN-REQ is 1-to-1 ABI compatible with
+ GMM-GMMRR-ASSIGN-REQ, we just need to adapt the header.
+ See osmo_static_assert(_gmmrr_prim_size) above.
+ */
+ gmm_prim = (struct osmo_gprs_gmm_prim *)rlcmac_prim;
+ gmm_prim->oph.sap = OSMO_GPRS_GMM_SAP_GMMRR;
+ gmm_prim->oph.primitive = OSMO_GPRS_RLCMAC_GMMRR_PAGE;
+ osmo_gprs_gmm_prim_lower_up(gmm_prim);
+ rc = 1; /* Tell RLCMAC that we take ownership of the prim. */
break;
default:
LOGP(DRLCMAC, LOGL_NOTICE, "%s(): Unexpected Rx RLCMAC GMMRR prim %u\n",
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/32080
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I7603d8bbda0cdd437eb7557267efb7bbc3552565
Gerrit-Change-Number: 32080
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged