diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2023-08-25 14:44:54 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2023-08-31 11:01:25 +0200 |
commit | f20e13d16081ee31054d5ed4add64edf7b3fbfc4 (patch) | |
tree | 55f7c8695bcaf14595b7889e36e1813f3c7f00b1 | |
parent | 55a21dc1c3d63f46fcbb8a941385234239f24b08 (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. 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
-rw-r--r-- | include/osmo-bts/bts.h | 7 | ||||
-rw-r--r-- | include/osmo-bts/pcu_if.h | 2 | ||||
-rw-r--r-- | include/osmo-bts/pcuif_proto.h | 13 | ||||
-rw-r--r-- | src/common/bts.c | 7 | ||||
-rw-r--r-- | src/common/paging.c | 2 | ||||
-rw-r--r-- | src/common/pcu_sock.c | 24 |
6 files changed, 47 insertions, 8 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index b2dd024e..d3329355 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -442,4 +442,11 @@ struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts); 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 4b375606..3563c5ba 100644 --- a/include/osmo-bts/pcu_if.h +++ b/include/osmo-bts/pcu_if.h @@ -23,7 +23,7 @@ int pcu_tx_rach_ind(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, 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 498d9d44..b47dc75a 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 @@ 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/common/bts.c b/src/common/bts.c index 0f2a0191..3cd91e7e 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 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt 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 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt 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 9738bd64..0d3877d9 100644 --- a/src/common/paging.c +++ b/src/common/paging.c @@ -734,7 +734,7 @@ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *g 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 333937ad..e1004641 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -60,6 +60,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", }; /* @@ -618,7 +619,7 @@ int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed) 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 @@ int pcu_tx_pch_data_cnf(uint32_t msg_id) 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 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, 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); |