fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/35780?usp=email )


Change subject: layer23/modem: handle and forward L1CTL UL BLOCK.cnf
......................................................................

layer23/modem: handle and forward L1CTL UL BLOCK.cnf

Change-Id: I9255ac17529b5ac260f9a0f141f3af6b3b72a802
Depends: libosmo-gprs.git I145b9586f83ae0235b4648916bd44996e8dc57f0
---
M src/host/layer23/include/osmocom/bb/common/ms.h
M src/host/layer23/include/osmocom/bb/modem/grr.h
M src/host/layer23/src/common/l1ctl.c
M src/host/layer23/src/modem/grr.c
M src/host/layer23/src/modem/rlcmac.c
5 files changed, 68 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/80/35780/1

diff --git a/src/host/layer23/include/osmocom/bb/common/ms.h 
b/src/host/layer23/include/osmocom/bb/common/ms.h
index 0b3e13c..36d3e3b 100644
--- a/src/host/layer23/include/osmocom/bb/common/ms.h
+++ b/src/host/layer23/include/osmocom/bb/common/ms.h
@@ -42,6 +42,7 @@

 struct osmol1_entity {
        int (*l1_traffic_ind)(struct osmocom_ms *ms, struct msgb *msg);
+       int (*l1_gprs_ul_block_cnf)(struct osmocom_ms *ms, struct msgb *msg);
        int (*l1_gprs_dl_block_ind)(struct osmocom_ms *ms, struct msgb *msg);
        int (*l1_gprs_rts_ind)(struct osmocom_ms *ms, struct msgb *msg);
 };
diff --git a/src/host/layer23/include/osmocom/bb/modem/grr.h 
b/src/host/layer23/include/osmocom/bb/modem/grr.h
index 99800ad..a86a089 100644
--- a/src/host/layer23/include/osmocom/bb/modem/grr.h
+++ b/src/host/layer23/include/osmocom/bb/modem/grr.h
@@ -25,6 +25,7 @@
        GRR_EV_PDCH_UL_TBF_CFG_REQ,
        GRR_EV_PDCH_DL_TBF_CFG_REQ,
        GRR_EV_PDCH_BLOCK_REQ,
+       GRR_EV_PDCH_BLOCK_CNF,
        GRR_EV_PDCH_BLOCK_IND,
        GRR_EV_PDCH_RTS_IND,
 };
diff --git a/src/host/layer23/src/common/l1ctl.c 
b/src/host/layer23/src/common/l1ctl.c
index a0f25b8..db2903c 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -949,6 +949,34 @@
        return 0;
 }

+/* Receive L1CTL_GPRS_UL_BLOCK_CNF */
+static int rx_l1_gprs_ul_block_cnf(struct osmocom_ms *ms, struct msgb *msg)
+{
+       const struct l1ctl_gprs_ul_block_cnf *cnf = (void *)msg->l1h;
+
+       if (msgb_l1len(msg) < sizeof(*cnf)) {
+               LOGP(DL1C, LOGL_ERROR,
+                    "Rx malformed GPRS UL BLOCK.cnf (len=%u < %zu)\n",
+                    msgb_l1len(msg), sizeof(*cnf));
+               return -EINVAL;
+       }
+       if (OSMO_UNLIKELY(cnf->tn >= 8)) {
+               LOGP(DL1C, LOGL_ERROR,
+                    "Rx malformed GPRS UL BLOCK.cnf (tn=%u)\n", cnf->tn);
+               return -EINVAL;
+       }
+
+       DEBUGP(DL1C, "Rx GPRS UL BLOCK.cnf (fn=%u, tn=%u)\n",
+              ntohl(cnf->fn), cnf->tn);
+
+       /* distribute or drop */
+       if (ms->l1_entity.l1_gprs_ul_block_cnf)
+               return ms->l1_entity.l1_gprs_ul_block_cnf(ms, msg);
+
+       msgb_free(msg);
+       return 0;
+}
+
 /* Receive L1CTL_GPRS_DL_BLOCK_IND */
 static int rx_l1_gprs_dl_block_ind(struct osmocom_ms *ms, struct msgb *msg)
 {
@@ -1171,6 +1199,9 @@
        case L1CTL_TRAFFIC_CONF:
                msgb_free(msg);
                break;
+       case L1CTL_GPRS_UL_BLOCK_CNF:
+               rc = rx_l1_gprs_ul_block_cnf(ms, msg);
+               break;
        case L1CTL_GPRS_DL_BLOCK_IND:
                rc = rx_l1_gprs_dl_block_ind(ms, msg);
                break;
diff --git a/src/host/layer23/src/modem/grr.c b/src/host/layer23/src/modem/grr.c
index cbabdc9..0953a2b 100644
--- a/src/host/layer23/src/modem/grr.c
+++ b/src/host/layer23/src/modem/grr.c
@@ -521,6 +521,16 @@
        osmo_fsm_inst_state_chg(fi, GRR_ST_PACKET_TRANSFER, 0, 0);
 }

+static void handle_pdch_block_cnf(struct osmocom_ms *ms, struct msgb *msg)
+{
+       const struct l1ctl_gprs_ul_block_cnf *cnf = (void *)msg->l1h;
+       const uint32_t fn = osmo_load32be(&cnf->fn);
+       struct osmo_gprs_rlcmac_prim *prim;
+
+       prim = osmo_gprs_rlcmac_prim_alloc_l1ctl_pdch_data_cnf(cnf->tn, fn, 
NULL, 0); /* XXX */
+       osmo_gprs_rlcmac_prim_lower_up(prim);
+}
+
 static void handle_pdch_block_ind(struct osmocom_ms *ms, struct msgb *msg)
 {
        const struct l1ctl_gprs_dl_block_ind *ind = (void *)msg->l1h;
@@ -753,6 +763,9 @@
                                           lp->pdch_data_req.data_len);
                break;
        }
+       case GRR_EV_PDCH_BLOCK_CNF:
+               handle_pdch_block_cnf(ms, (struct msgb *)data);
+               break;
        case GRR_EV_PDCH_BLOCK_IND:
                handle_pdch_block_ind(ms, (struct msgb *)data);
                break;
@@ -819,6 +832,7 @@
                .in_event_mask  = S(GRR_EV_PDCH_UL_TBF_CFG_REQ)
                                | S(GRR_EV_PDCH_DL_TBF_CFG_REQ)
                                | S(GRR_EV_PDCH_BLOCK_REQ)
+                               | S(GRR_EV_PDCH_BLOCK_CNF)
                                | S(GRR_EV_PDCH_BLOCK_IND)
                                | S(GRR_EV_PDCH_RTS_IND)
                                | S(GRR_EV_PDCH_RELEASE_REQ),
@@ -838,6 +852,7 @@
        OSMO_VALUE_STRING(GRR_EV_PDCH_UL_TBF_CFG_REQ),
        OSMO_VALUE_STRING(GRR_EV_PDCH_DL_TBF_CFG_REQ),
        OSMO_VALUE_STRING(GRR_EV_PDCH_BLOCK_REQ),
+       OSMO_VALUE_STRING(GRR_EV_PDCH_BLOCK_CNF),
        OSMO_VALUE_STRING(GRR_EV_PDCH_BLOCK_IND),
        OSMO_VALUE_STRING(GRR_EV_PDCH_RTS_IND),
        { 0, NULL }
diff --git a/src/host/layer23/src/modem/rlcmac.c 
b/src/host/layer23/src/modem/rlcmac.c
index a9588f7..7f7b566 100644
--- a/src/host/layer23/src/modem/rlcmac.c
+++ b/src/host/layer23/src/modem/rlcmac.c
@@ -162,12 +162,17 @@
        }
 }

-static int l1ctl_dl_block_cb(struct osmocom_ms *ms, struct msgb *msg)
+static int l1ctl_ul_block_cnf_cb(struct osmocom_ms *ms, struct msgb *msg)
+{
+       return osmo_fsm_inst_dispatch(ms->grr_fi, GRR_EV_PDCH_BLOCK_CNF, msg);
+}
+
+static int l1ctl_dl_block_ind_cb(struct osmocom_ms *ms, struct msgb *msg)
 {
        return osmo_fsm_inst_dispatch(ms->grr_fi, GRR_EV_PDCH_BLOCK_IND, msg);
 }

-static int l1ctl_rts_cb(struct osmocom_ms *ms, struct msgb *msg)
+static int l1ctl_rts_ind_cb(struct osmocom_ms *ms, struct msgb *msg)
 {
        return osmo_fsm_inst_dispatch(ms->grr_fi, GRR_EV_PDCH_RTS_IND, msg);
 }
@@ -186,8 +191,9 @@
        osmo_gprs_rlcmac_prim_set_up_cb(modem_rlcmac_prim_up_cb, ms);
        osmo_gprs_rlcmac_prim_set_down_cb(modem_rlcmac_prim_down_cb, ms);

-       ms->l1_entity.l1_gprs_dl_block_ind = &l1ctl_dl_block_cb;
-       ms->l1_entity.l1_gprs_rts_ind = &l1ctl_rts_cb;
+       ms->l1_entity.l1_gprs_ul_block_cnf = &l1ctl_ul_block_cnf_cb;
+       ms->l1_entity.l1_gprs_dl_block_ind = &l1ctl_dl_block_ind_cb;
+       ms->l1_entity.l1_gprs_rts_ind = &l1ctl_rts_ind_cb;

        return rc;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35780?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I9255ac17529b5ac260f9a0f141f3af6b3b72a802
Gerrit-Change-Number: 35780
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to