dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/34059 )
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. 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, 67 insertions(+), 8 deletions(-)
Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index b2dd024..d332935 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -442,4 +442,11 @@
int bts_set_c0_pwr_red(struct gsm_bts *bts, const uint8_t red);
+/* Context information to be put in the control buffer (db) of the AGCH msg + * buffer */ +struct bts_agch_msg_cb { + uint32_t msg_id; + bool confirm; +} __attribute__ ((packed)); + #endif /* _BTS_H */ diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h index 4b37560..3563c5b 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 msg_id); +int pcu_tx_data_cnf(uint32_t msg_id, 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 498d9d4..b47dc75 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_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 */ @@ -235,6 +236,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/common/bts.c b/src/common/bts.c index 0f2a019..3cd91e7 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> @@ -729,6 +730,7 @@ struct msgb *msg = NULL; int rc = 0; int is_empty = 1; + const struct bts_agch_msg_cb *msg_cb;
/* Do queue house keeping. * This needs to be done every time a CCCH message is requested, since @@ -759,6 +761,11 @@
rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_SENT);
+ /* Confirm sending of the AGCH message towards the PCU */ + msg_cb = (struct bts_agch_msg_cb *) msg->cb; + if (msg_cb->confirm) + pcu_tx_data_cnf(msg_cb->msg_id, PCU_IF_SAPI_AGCH_2); + /* 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 9738bd6..0d3877d 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(pr[num_pr]->u.macblock.msg_id); + pcu_tx_data_cnf(pr[num_pr]->u.macblock.msg_id, PCU_IF_SAPI_PCH_2); talloc_free(pr[num_pr]); return GSM_MACBLOCK_LEN; } diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 333937a..e100464 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_2] = "PCH_2", + [PCU_IF_SAPI_AGCH_2] = "AGCH_2", };
/* @@ -618,7 +619,7 @@ return pcu_sock_send(msg); }
-int pcu_tx_pch_data_cnf(uint32_t msg_id) +int pcu_tx_data_cnf(uint32_t msg_id, 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_cnf2 = (struct gsm_pcu_if_data_cnf) { - .sapi = PCU_IF_SAPI_PCH_2, + .sapi = sapi, .msg_id = msg_id, };
@@ -688,19 +689,30 @@ gsm_pcu_if_pch->imsi, gsm_pcu_if_pch->confirm, gsm_pcu_if_pch->data); break; } - case PCU_IF_SAPI_AGCH: - msg = msgb_alloc(data_req->len, "pcu_agch"); + case PCU_IF_SAPI_AGCH_2: + { + const struct gsm_pcu_if_agch *gsm_pcu_if_agch; + struct bts_agch_msg_cb *msg_cb; + + gsm_pcu_if_agch = (struct gsm_pcu_if_agch *)data_req->data; + + 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->data, GSM_MACBLOCK_LEN); + + msg_cb = (struct bts_agch_msg_cb *) msg->cb; + msg_cb->confirm = gsm_pcu_if_agch->confirm; + msg_cb->msg_id = gsm_pcu_if_agch->msg_id; 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);