dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/34059 )


Change subject: pcu_sock: use PCU_IF_SAPI_AGCH_DT instead PCU_IF_SAPI_AGCH
......................................................................

pcu_sock: use PCU_IF_SAPI_AGCH_DT instead PCU_IF_SAPI_AGCH

In PCUIF v.11 we use PCU_IF_SAPI_AGCH_DT exclusively. We use this SAPI
to transfer IMMEDIATE ASSIGNMENT messages for uplink and downlink. In
both cases we send a confirmation back to the PCU. For details see
coresponding patch in osmo-pcu.git (see Depends)

CAUTION: This patch breaks compatibility to current master osmo-pcu (See
also "Depends")

Related: OS#5927
Depends: osmo-pcu.git I9effdcec1da91a6e2e7a7c41f95d3300ad1bb292
Depends: osmo-ttcn3-hacks.git Iec00d8144dfb2cd8bcee9093c96a3cc98aea6458
Change-Id: I29858fa20ad8bd0aefe81a5c40ad77a2559a8c10
---
M include/osmo-bts/bts.h
M include/osmo-bts/pcu_if.h
M include/osmo-bts/pcuif_proto.h
M src/common/bts.c
M src/common/paging.c
M src/common/pcu_sock.c
6 files changed, 58 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/59/34059/1

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 677ff9c..b2dd024 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -408,7 +408,6 @@
 int bts_link_estab(struct gsm_bts *bts);

 int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg);
-struct msgb *bts_agch_dequeue(struct gsm_bts *bts);
 int bts_agch_max_queue_length(int T, int bcch_conf);

 enum ccch_msgt {
diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index d6e5d24..e2926c8 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -23,7 +23,7 @@
 int pcu_tx_time_ind(uint32_t fn);
 int pcu_tx_interf_ind(const struct gsm_bts_trx *trx, uint32_t fn);
 int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed);
-int pcu_tx_pch_data_cnf(uint32_t fn, uint32_t tlli);
+int pcu_tx_pch_data_cnf(uint32_t fn, uint32_t tlli, uint8_t sapi);
 int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t 
*ra_id, uint8_t cause);
 int pcu_sock_send(struct msgb *msg);

diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index bae6cda..9957510 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -36,6 +36,7 @@
 #define PCU_IF_SAPI_PRACH      0x06    /* packet random access channel */
 #define PCU_IF_SAPI_PTCCH      0x07    /* packet TA control channel */
 #define PCU_IF_SAPI_PCH_DT     0x08    /* assignment on PCH (confirmed using 
TLLI) */
+#define PCU_IF_SAPI_AGCH_DT    0x09    /* assignment on AGCH (confirmed using 
TLLI) */

 /* flags */
 #define PCU_IF_FLAG_ACTIVE     (1 << 0)/* BTS is active */
@@ -241,6 +242,15 @@
        uint8_t data[GSM_MACBLOCK_LEN];
 } __attribute__((packed));

+/* Struct to send a (confirmed) IMMEDIATE ASSIGNMENT message via AGCH. The 
struct is sent as a data request
+ * (data_req) under SAPI PCU_IF_SAPI_AGCH_DT. */
+struct gsm_pcu_if_agch_dt {
+       /* TLLI as reference for confirmation */
+       uint32_t tlli;
+       /* GSM mac-block (with immediate assignment message) */
+       uint8_t data[GSM_MACBLOCK_LEN];
+} __attribute__((packed));
+
 struct gsm_pcu_if {
        /* context based information */
        uint8_t         msg_type;       /* message type */
diff --git a/src/common/bts.c b/src/common/bts.c
index 40fe354..5ca39ca 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -47,6 +47,7 @@
 #include <osmo-bts/bts_sm.h>
 #include <osmo-bts/dtx_dl_amr_fsm.h>
 #include <osmo-bts/pcuif_proto.h>
+#include <osmo-bts/pcu_if.h>
 #include <osmo-bts/rsl.h>
 #include <osmo-bts/oml.h>
 #include <osmo-bts/signal.h>
@@ -658,7 +659,7 @@
        return 0;
 }

-struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
+static struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
 {
        struct msgb *msg = msgb_dequeue(&bts->agch_queue.queue);
        if (!msg)
@@ -753,12 +754,17 @@
                msg = bts_agch_dequeue(bts);
                if (!msg)
                        return rc;
+
                /* Continue to return AGCH message. */
                break;
        }

        rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_SENT);

+       /* Confirm sending of the AGCH message towards the PCU */
+       if (msg->cb[0])
+               pcu_tx_pch_data_cnf(gt->fn, msg->cb[1], PCU_IF_SAPI_AGCH_DT);
+
        /* Copy AGCH message */
        memcpy(out_buf, msgb_l3(msg), msgb_l3len(msg));
        rc = msgb_l3len(msg);
diff --git a/src/common/paging.c b/src/common/paging.c
index 914a4b5..3c885c5 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -734,7 +734,7 @@
                                                        GSM_MACBLOCK_LEN);
                        /* send a confirmation back (if required) */
                        if (pr[num_pr]->u.macblock.confirm)
-                               pcu_tx_pch_data_cnf(gt->fn, 
pr[num_pr]->u.macblock.tlli);
+                               pcu_tx_pch_data_cnf(gt->fn, 
pr[num_pr]->u.macblock.tlli, PCU_IF_SAPI_PCH_DT);
                        talloc_free(pr[num_pr]);
                        return GSM_MACBLOCK_LEN;
                }
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 9e34fe8..d617782 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -60,6 +60,7 @@
        [PCU_IF_SAPI_PRACH] =   "PRACH",
        [PCU_IF_SAPI_PTCCH] =   "PTCCH",
        [PCU_IF_SAPI_PCH_DT] =  "PCH_DT",
+       [PCU_IF_SAPI_AGCH_DT] = "AGCH_DT",
 };

 /*
@@ -618,7 +619,7 @@
        return pcu_sock_send(msg);
 }

-int pcu_tx_pch_data_cnf(uint32_t fn, uint32_t tlli)
+int pcu_tx_pch_data_cnf(uint32_t fn, uint32_t tlli, uint8_t sapi)
 {
        struct gsm_bts *bts;
        struct msgb *msg;
@@ -634,7 +635,7 @@
                return -ENOMEM;
        pcu_prim = (struct gsm_pcu_if *) msg->data;
        pcu_prim->u.data_cnf_dt = (struct gsm_pcu_if_data_cnf_dt) {
-               .sapi = PCU_IF_SAPI_PCH_DT,
+               .sapi = sapi,
                .tlli = tlli,
                .fn = fn,
        };
@@ -693,19 +694,31 @@
                                         gsm_pcu_if_pch_dt->imsi, confirm, 
gsm_pcu_if_pch_dt->data);
                break;
        }
-       case PCU_IF_SAPI_AGCH:
-               msg = msgb_alloc(data_req->len, "pcu_agch");
+       case PCU_IF_SAPI_AGCH_DT:
+       {
+               const struct gsm_pcu_if_agch_dt *gsm_pcu_if_agch_dt;
+               const struct gsm48_imm_ass *gsm48_imm_ass;
+               bool confirm;
+
+               gsm_pcu_if_agch_dt = (struct gsm_pcu_if_agch_dt 
*)data_req->data;
+               gsm48_imm_ass = (struct gsm48_imm_ass 
*)gsm_pcu_if_agch_dt->data;
+               confirm = (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS);
+
+               msg = msgb_alloc(GSM_MACBLOCK_LEN, "pcu_agch");
                if (!msg) {
                        rc = -ENOMEM;
                        break;
                }
-               msg->l3h = msgb_put(msg, data_req->len);
-               memcpy(msg->l3h, data_req->data, data_req->len);
+               msg->l3h = msgb_put(msg, GSM_MACBLOCK_LEN);
+               memcpy(msg->l3h, gsm_pcu_if_agch_dt->data, GSM_MACBLOCK_LEN);
+               msg->cb[0] = confirm;
+               msg->cb[1] = gsm_pcu_if_agch_dt->tlli;
                if (bts_agch_enqueue(bts, msg) < 0) {
                        msgb_free(msg);
                        rc = -EIO;
                }
                break;
+       }
        case PCU_IF_SAPI_PDTCH:
        case PCU_IF_SAPI_PTCCH:
                trx = gsm_bts_trx_num(bts, data_req->trx_nr);

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/34059
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I29858fa20ad8bd0aefe81a5c40ad77a2559a8c10
Gerrit-Change-Number: 34059
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>
Gerrit-MessageType: newchange

Reply via email to