dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/34060 )
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 Change-Id: I709c27adaf09a6766cfde4d76d878626d30ebb3c --- M include/osmocom/bsc/pcuif_proto.h M src/osmo-bsc/pcu_sock.c 2 files changed, 47 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/60/34060/1
diff --git a/include/osmocom/bsc/pcuif_proto.h b/include/osmocom/bsc/pcuif_proto.h index 1dda160..0d02379 100644 --- a/include/osmocom/bsc/pcuif_proto.h +++ b/include/osmocom/bsc/pcuif_proto.h @@ -42,6 +42,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 */ @@ -282,6 +283,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/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index 8a1d5b0..7d05788 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -528,7 +528,9 @@ uint8_t pag_grp; int rc = 0; struct gsm_pcu_if_pch_dt *pch_dt; + struct gsm_pcu_if_agch_dt *agch_dt; struct gsm48_imm_ass *gsm48_imm_ass; + bool confirm;
LOG_BTS(bts, DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d " "block=%d data=%s\n", sapi_string[data_req->sapi], @@ -536,9 +538,23 @@ osmo_hexdump(data_req->data, data_req->len));
switch (data_req->sapi) { - case PCU_IF_SAPI_AGCH: - if (rsl_imm_assign_cmd(bts, data_req->len, data_req->data)) + case PCU_IF_SAPI_AGCH_DT: + if (data_req->len < sizeof(struct gsm_pcu_if_agch_dt)) { + LOG_BTS(bts, DPCU, LOGL_ERROR, "Received PCU data request with invalid/small length %d\n", + data_req->len); + break; + } + + agch_dt = (struct gsm_pcu_if_agch_dt *)data_req->data; + if (rsl_imm_assign_cmd(bts, GSM_MACBLOCK_LEN, agch_dt->data)) rc = -EIO; + + /* Send the confirmation immediately. This is as accurate as we can get since from this point on the + * BTS hardware is responsible to schedule the sending of the IMMEDIATE ASSIGNMENT */ + gsm48_imm_ass = (struct gsm48_imm_ass *)agch_dt->data; + confirm = (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS); + if (confirm) + return pcu_tx_pch_confirm(bts, agch_dt->tlli); break; case PCU_IF_SAPI_PCH_DT: /* DT = direct TLLI. A tlli is prefixed so that the BSC/BTS can confirm the sending of the downlink