dexter has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/34060 )
Change subject: pcu_sock: use PCU_IF_SAPI_AGCH_2 instead PCU_IF_SAPI_AGCH
......................................................................
pcu_sock: use PCU_IF_SAPI_AGCH_2 instead PCU_IF_SAPI_AGCH
In PCUIF v.11 we use PCU_IF_SAPI_AGCH_2 exclusively. We use this SAPI
to transfer IMMEDIATE ASSIGNMENT messages for uplink and downlink. One
new feature of PCU_IF_SAPI_AGCH_2 is that the PCU may ask to send a
confirmation when the MAC block is sent.
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/pcu_if.h
M include/osmocom/bsc/pcuif_proto.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/pcu_sock.c
4 files changed, 60 insertions(+), 13 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/include/osmocom/bsc/pcu_if.h b/include/osmocom/bsc/pcu_if.h
index d2d3444..6a07f2e 100644
--- a/include/osmocom/bsc/pcu_if.h
+++ b/include/osmocom/bsc/pcu_if.h
@@ -24,8 +24,8 @@
int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn,
uint8_t is_11bit, enum ph_burst_type burst_type);
-/* Confirm the sending of an immediate assignment to the pcu */
-int pcu_tx_pch_confirm(struct gsm_bts *bts, uint32_t msg_id);
+/* Confirm the sending of an AGCH or PCH MAC block to the pcu */
+int pcu_tx_data_cnf(struct gsm_bts *bts, uint32_t msg_id, uint8_t sapi);
/* Open connection to PCU */
int pcu_sock_init(struct gsm_network *net);
diff --git a/include/osmocom/bsc/pcuif_proto.h b/include/osmocom/bsc/pcuif_proto.h
index aa22447..cd2a298 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_2 0x08 /* assignment on PCH (confirmed using message id) */
+#define PCU_IF_SAPI_AGCH_2 0x09 /* assignment on AGCH (confirmed using message id) */
/* flags */
#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
@@ -276,6 +277,18 @@
bool confirm;
} __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_2. */
+struct gsm_pcu_if_agch {
+ /* message id as reference for confirmation */
+ uint32_t msg_id;
+ /* GSM mac-block (with immediate assignment message) */
+ uint8_t data[GSM_MACBLOCK_LEN];
+ /* Set to true in case the receiving end must send a confirmation
+ * when the MAC block (data) has been sent. */
+ bool confirm;
+} __attribute__((packed));
+
struct gsm_pcu_if {
/* context based information */
uint8_t msg_type; /* message type */
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 76948c9..860e4a2 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -44,6 +44,7 @@
#include <osmocom/gsm/rsl.h>
#include <osmocom/core/talloc.h>
#include <osmocom/bsc/pcu_if.h>
+#include <osmocom/bsc/pcuif_proto.h>
#include <osmocom/bsc/gsm_08_08.h>
#include <osmocom/netif/rtp.h>
#include <osmocom/core/tdef.h>
@@ -2567,7 +2568,7 @@
else {
msgb_pull(msg, 1); /* drop previous data to use msg_pull_u32 */
msg_id = msgb_pull_u32(msg);
- pcu_tx_pch_confirm(sign_link->trx->bts, msg_id);
+ pcu_tx_data_cnf(sign_link->trx->bts, msg_id, PCU_IF_SAPI_PCH_2);
}
return 0;
}
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 696d5f3..dc2b8e9 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -57,6 +57,7 @@
[PCU_IF_SAPI_PRACH] = "PRACH",
[PCU_IF_SAPI_PTCCH] = "PTCCH",
[PCU_IF_SAPI_PCH_2] = "PCH_2",
+ [PCU_IF_SAPI_AGCH_2] = "AGCH_2",
};
bool pcu_connected(const struct gsm_network *net)
@@ -435,14 +436,14 @@
return pcu_sock_send(bts->network, msg);
}
-/* Confirm the sending of an immediate assignment to the pcu */
-int pcu_tx_pch_confirm(struct gsm_bts *bts, uint32_t msg_id)
+int pcu_tx_data_cnf(struct gsm_bts *bts, uint32_t msg_id, uint8_t sapi)
{
struct msgb *msg;
struct gsm_pcu_if *pcu_prim;
struct gsm_pcu_if_data_cnf *data_cnf;
- LOG_BTS(bts, DPCU, LOGL_INFO, "Sending PCH confirm with message id\n");
+ LOGP(DPCU, LOGL_DEBUG, "Sending DATA.cnf: sapi=%s msg_id=%08x\n",
+ sapi_string[sapi], msg_id);
msg = pcu_msgb_alloc(PCU_IF_MSG_DATA_CNF_2, bts->nr);
if (!msg)
@@ -450,7 +451,7 @@
pcu_prim = (struct gsm_pcu_if *) msg->data;
data_cnf = &pcu_prim->u.data_cnf2;
- data_cnf->sapi = PCU_IF_SAPI_PCH_2;
+ data_cnf->sapi = sapi;
data_cnf->msg_id = msg_id;
return pcu_sock_send(bts->network, msg);
@@ -528,8 +529,9 @@
{
uint8_t pag_grp;
int rc = 0;
- struct gsm_pcu_if_pch *pch;
- struct gsm48_imm_ass *gsm48_imm_ass;
+ const struct gsm_pcu_if_pch *pch;
+ const struct gsm_pcu_if_agch *agch;
+ const struct gsm48_imm_ass *gsm48_imm_ass;
LOG_BTS(bts, DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d "
"block=%d data=%s\n", sapi_string[data_req->sapi],
@@ -537,9 +539,21 @@
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))
- rc = -EIO;
+ case PCU_IF_SAPI_AGCH_2:
+ if (data_req->len < sizeof(struct gsm_pcu_if_agch)) {
+ LOG_BTS(bts, DPCU, LOGL_ERROR, "Received PCU data request with invalid/small
length %d\n",
+ data_req->len);
+ break;
+ }
+
+ agch = (struct gsm_pcu_if_agch *)data_req->data;
+ if (rsl_imm_assign_cmd(bts, GSM_MACBLOCK_LEN, agch->data))
+ return -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 */
+ if (agch->confirm)
+ return pcu_tx_data_cnf(bts, agch->msg_id, PCU_IF_SAPI_AGCH_2);
break;
case PCU_IF_SAPI_PCH_2:
if (data_req->len < sizeof(struct gsm_pcu_if_pch)) {
@@ -558,7 +572,7 @@
if (pcu_rx_rr_paging_pch(bts, pag_grp, pch))
return -EIO;
if (pch->confirm)
- return pcu_tx_pch_confirm(bts, pch->msg_id);
+ return pcu_tx_data_cnf(bts, pch->msg_id, PCU_IF_SAPI_PCH_2);
break;
default:
LOG_BTS(bts, DPCU, LOGL_ERROR, "Received PCU data request with "
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/34060
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I709c27adaf09a6766cfde4d76d878626d30ebb3c
Gerrit-Change-Number: 34060
Gerrit-PatchSet: 6
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged