pcuif_proto: add confirm flag to struct gsm_pcu_if_pch

At the moment we let OsmoBTS (or OsmoBSC) look into the MAC block we
send and in case it is an IMMEDIATE ASSIGNMENT message, a confirmation
would be sent back. Unfortunately, this method is not very practical,
lets add a flag to struct gsm_pcu_if_pch to tell the receiving end that
the MAC block (data) needs to be confirmed when it is sent.

Related: OS#5927
Change-Id: Ia202862aafc1f0cb6601574ef61eb9155de11f04
diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h
index bf49b06..aa22447 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/pcuif_proto.h
@@ -271,6 +271,9 @@
 	char imsi[OSMO_IMSI_BUF_SIZE];
 	/* 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 {
diff --git a/src/bts.cpp b/src/bts.cpp
index 497c2ce..5c483d5 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1129,7 +1129,7 @@
 	if (plen >= 0) {
 		bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_DL_TBF);
 		if (the_pcu->pcu_if_version >= 0x0b)
-			pcu_l1if_tx_pch2(bts, immediate_assignment, plen, tbf->imsi(), tbf->tlli());
+			pcu_l1if_tx_pch2(bts, immediate_assignment, plen, true, tbf->imsi(), tbf->tlli());
 		else
 			pcu_l1if_tx_pch(bts, immediate_assignment, plen, tbf->imsi());
 	}
diff --git a/src/gprs_rlcmac.c b/src/gprs_rlcmac.c
index 40fdfaf..d15445e 100644
--- a/src/gprs_rlcmac.c
+++ b/src/gprs_rlcmac.c
@@ -45,7 +45,7 @@
 	bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS);
 
 	if (the_pcu->pcu_if_version >= 0x0b)
-		pcu_l1if_tx_pch2(bts, paging_request, plen, imsi, GSM_RESERVED_TMSI);
+		pcu_l1if_tx_pch2(bts, paging_request, plen, false, imsi, GSM_RESERVED_TMSI);
 	else
 		pcu_l1if_tx_pch(bts, paging_request, plen, imsi);
 
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 654063e..f92f08e 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -300,7 +300,8 @@
 /* Send a MAC block via the paging channel. This will (obviously) only work for MAC blocks that contain an
  * IMMEDIATE ASSIGNMENT or a PAGING COMMAND message. In case the MAC block contains an IMMEDIATE ASSIGNMENT
  * message, the receiving end is required to confirm when the IMMEDIATE ASSIGNMENT has been sent. */
-void pcu_l1if_tx_pch2(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, const char *imsi, uint32_t msg_id)
+void pcu_l1if_tx_pch2(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, bool confirm,
+		      const char *imsi, uint32_t msg_id)
 {
 	struct gsm_pcu_if_pch pch = { 0 };
 
@@ -312,6 +313,7 @@
 	 * (TS 45.002 6.5.3, 6.5.6).
 	 */
 
+	pch.confirm = confirm;
 	pch.data[0] = (plen << 2) | 0x01;
 	bitvec_pack(block, pch.data + 1);
 
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 19ec60a..138636d 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -156,8 +156,8 @@
 
 int pcu_tx_neigh_addr_res_req(struct gprs_rlcmac_bts *bts, const struct neigh_cache_entry_key *neigh_key);
 void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, const char *imsi);
-void pcu_l1if_tx_pch2(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, const char *imsi, uint32_t msg_id);
-
+void pcu_l1if_tx_pch2(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, bool confirm,
+		      const char *imsi, uint32_t msg_id);
 int pcu_rx(struct gsm_pcu_if *pcu_prim, size_t pcu_prim_length);
 int pcu_l1if_open(void);
 void pcu_l1if_close(void);