aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2023-08-25 13:04:28 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2023-08-31 11:03:20 +0200
commite55a114e8ac7b415f91bac394e457762de939775 (patch)
treeff954df0ac15433bd032b002a042ede3fa3a8345
parent33a2a2fed55347a551f0a7a7e82bf2d6547d41ab (diff)
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
-rw-r--r--include/osmocom/bsc/pcu_if.h4
-rw-r--r--include/osmocom/bsc/pcuif_proto.h13
-rw-r--r--src/osmo-bsc/abis_rsl.c3
-rw-r--r--src/osmo-bsc/pcu_sock.c34
4 files changed, 41 insertions, 13 deletions
diff --git a/include/osmocom/bsc/pcu_if.h b/include/osmocom/bsc/pcu_if.h
index d2d3444f0..6a07f2e02 100644
--- a/include/osmocom/bsc/pcu_if.h
+++ b/include/osmocom/bsc/pcu_if.h
@@ -24,8 +24,8 @@ void pcu_info_update(struct gsm_bts *bts);
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 aa22447e8..cd2a29835 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 @@ struct gsm_pcu_if_pch {
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 76948c9bd..860e4a249 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 @@ static int rsl_rx_ericsson_imm_assign_sent(struct msgb *msg)
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 696d5f3a3..dc2b8e9fe 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -57,6 +57,7 @@ static const char *sapi_string[] = {
[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 @@ int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn,
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 @@ int pcu_tx_pch_confirm(struct gsm_bts *bts, uint32_t msg_id)
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 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
{
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 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
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 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
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 "