abis_rsl: add support for sending IMMEDIATE ASSIGNMENT through PCH

The IMMEDIATE ASSIGNMENT for downlink TBFs needs to be sent through the
PCH instead of the AGCH. Since this method is not specified in RSL, it
is usually a vendor specific extension.

Change-Id: I4452f4973d1ec69c96aad527b057226e8a6edf99
Related: OS#5198
This commit is contained in:
Philipp Maier 2023-01-31 16:16:01 +01:00
parent 84811c901e
commit 7a346a547e
3 changed files with 50 additions and 11 deletions

View File

@ -65,7 +65,7 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id);
int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id);
/* Ericcson vendor specific RSL extensions */
int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val);
int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val, uint8_t pag_grp);
/* Siemens vendor-specific RSL extensions */
int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);

View File

@ -964,12 +964,16 @@ int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val)
}
/* Chapter 8.5.6 Immediate Assignment Command (with Ericcson vendor specific RSL extension) */
int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val)
int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val, uint8_t pag_grp)
{
struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
if (!msg)
return 1;
/* Append ericsson proprietary paging group IE, this will instruct the BTS to
* send this immediate assignment through PCH instead of AGCH. */
msgb_tv_put(msg, RSL_IE_ERIC_PAGING_GROUP, pag_grp);
/* ericsson can handle a reference at the end of the message which is used in
* the confirm message. The confirm message is only sent if the trailer is present */
msgb_put_u8(msg, RSL_IE_ERIC_MOBILE_ID);

View File

@ -402,6 +402,27 @@ static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group,
return rc;
}
/* Helper function for pcu_rx_data_req() to extract paging group info (3 byte) */
static uint8_t extract_paging_group(struct gsm_bts *bts, uint8_t *data)
{
char imsi_digit_buf[4];
uint8_t pag_grp;
/* the first three bytes are the last three digits of the IMSI, which we need to compute the paging group */
imsi_digit_buf[0] = data[0];
imsi_digit_buf[1] = data[1];
imsi_digit_buf[2] = data[2];
imsi_digit_buf[3] = '\0';
pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
str_to_imsi(imsi_digit_buf));
LOGP(DPCU, LOGL_DEBUG, "Calculating paging group: imsi_digit_buf=%s ==> pag_grp=0x%02x\n",
imsi_digit_buf, pag_grp);
return pag_grp;
}
static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
struct gsm_pcu_if_data *data_req)
{
@ -444,27 +465,41 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
}
break;
case PCU_IF_SAPI_PCH_DT:
/* DT = direct tlli. A tlli is prefixed */
/* DT = direct TLLI. A tlli is prefixed so that the BSC/BTS can confirm the sending of the downlink
* IMMEDIATE ASSIGNMENT towards the PCU using this TLLI as a reference. */
if (data_req->len < 5) {
if (data_req->len < 8) {
LOGP(DPCU, LOGL_ERROR, "Received PCU data request with invalid/small length %d\n",
data_req->len);
break;
}
/* Extract 4 byte TLLI */
memcpy(&tlli, data_req->data, 4);
msg = msgb_alloc(data_req->len - 4, "pcu_agch");
/* Extract 3 byte paging group */
pag_grp = extract_paging_group(bts, data_req->data + 4);
LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via PCH (tlli=0x%08x, pag_grp=0x%02x)\n",
tlli, pag_grp);
msg = msgb_alloc(data_req->len - 7, "pcu_pch");
if (!msg) {
rc = -ENOMEM;
break;
}
msg->l3h = msgb_put(msg, data_req->len - 4);
memcpy(msg->l3h, data_req->data + 4, data_req->len - 4);
msg->l3h = msgb_put(msg, data_req->len - 7);
memcpy(msg->l3h, data_req->data + 7, data_req->len - 7);
if (bts->type == GSM_BTS_TYPE_RBS2000)
rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, msg->data);
else
rc = rsl_imm_assign_cmd(bts, msg->len, msg->data);
/* NOTE: Sending an IMMEDIATE ASSIGNMENT via PCH became necessary with GPRS in order to be able to
* assign downlink TBFs directly through the paging channel. However, this method never became part
* of the RSL specs. This means that each BTS vendor has to come up with a proprietary method. At
* the moment we only support Ericsson RBS here. */
if (bts->type == GSM_BTS_TYPE_RBS2000) {
rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, msg->data, pag_grp);
} else {
LOGP(DPCU, LOGL_ERROR, "BTS model does not support sending immediate assignment via PCH!\n");
rc = -ENOTSUP;
}
if (rc) {
msgb_free(msg);