fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/18387 )


Change subject: BTS::parse_rach_ind(): properly handle EGPRS Packet Channel 
Request
......................................................................

BTS::parse_rach_ind(): properly handle EGPRS Packet Channel Request

Change-Id: Ia15761c33c8048d35c7f7bc93dbea781dd0894b7
---
M src/bts.cpp
1 file changed, 67 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/87/18387/1

diff --git a/src/bts.cpp b/src/bts.cpp
index 934bdef..c305e22 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -671,9 +671,68 @@
  * deprecated, no PACKET CHANNEL REQUEST exists, which means for GPRS we will
  * receive CCCH RACH which doesn't contain any mslot class. Hence in the end we
  * can only receive EGPRS mslot class through 11-bit EGPRS PACKET CHANNEL 
REQUEST. */
+static int parse_egprs_pkt_ch_req(uint16_t ra11, struct chan_req_params 
*chan_req)
+{
+       EGPRS_PacketChannelRequest_t req;
+       int rc;
+
+       rc = decode_egprs_pkt_ch_req(ra11, &req);
+       if (rc) {
+               LOGP(DRLCMAC, LOGL_NOTICE, "Failed to decode "
+                    "EGPRS Packet Channel Request: rc=%d", rc);
+               return rc;
+       }
+
+       LOGP(DRLCMAC, LOGL_INFO, "Rx EGPRS Packet Channel Request: %s\n",
+            get_value_string(egprs_pkt_ch_req_type_names, req.Type));
+
+       switch (req.Type) {
+       case EGPRS_PKT_CHAN_REQ_ONE_PHASE:
+               chan_req->egprs_mslot_class = req.Content.MultislotClass + 1;
+               chan_req->priority = req.Content.Priority + 1;
+               break;
+       case EGPRS_PKT_CHAN_REQ_SHORT:
+               chan_req->priority = req.Content.Priority + 1;
+               if (req.Content.NumberOfBlocks == 0)
+                       chan_req->single_block = true;
+               break;
+       case EGPRS_PKT_CHAN_REQ_ONE_PHASE_RED_LATENCY:
+               chan_req->priority = req.Content.Priority + 1;
+               break;
+       /* Two phase access => single block is needed */
+       case EGPRS_PKT_CHAN_REQ_TWO_PHASE:
+       case EGPRS_PKT_CHAN_REQ_TWO_PHASE_IPA:
+               chan_req->priority = req.Content.Priority + 1;
+               chan_req->single_block = true;
+               break;
+
+       /* Neither unacknowledged RLC mode, nor emergency calls are supported */
+       case EGPRS_PKT_CHAN_REQ_ONE_PHASE_UNACK:
+       case EGPRS_PKT_CHAN_REQ_EMERGENCY_CALL:
+               LOGP(DRLCMAC, LOGL_NOTICE, "%s is not supported, rejecting\n",
+                    get_value_string(egprs_pkt_ch_req_type_names, req.Type));
+               return -ENOTSUP;
+
+       case EGPRS_PKT_CHAN_REQ_SIGNALLING:
+       case EGPRS_PKT_CHAN_REQ_SIGNALLING_IPA:
+       case EGPRS_PKT_CHAN_REQ_DEDICATED_CHANNEL:
+               /* TODO: IIUC, signalling needs only one block */
+               break;
+
+       default:
+               LOGP(DRLCMAC, LOGL_ERROR, "Unknown EGPRS Packet Channel Request 
"
+                    "type=0x%02x, probably a bug in CSN.1 codec\n", req.Type);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 static int parse_rach_ind(const struct rach_ind_params *rip,
                          struct chan_req_params *chan_req)
 {
+       int rc;
+
        switch (rip->burst_type) {
        case GSM_L1_BURST_TYPE_NONE:
                LOGP(DRLCMAC, LOGL_ERROR, "RACH.ind contains no burst type, 
assuming TS0\n");
@@ -697,10 +756,9 @@
                        return -ENOTSUP;
                }

-               /* EGPRS multislot class is only present in One Phase Access 
Request */
-               /* FIXME: properly parse EGPRS Packet Channel Request */
-               if ((rip->ra >> 10) == 0x00) /* .0xx xxx. .... */
-                       chan_req->egprs_mslot_class = ((rip->ra & 0x3e0) >> 5) 
+ 1;
+               rc = parse_egprs_pkt_ch_req(rip->ra, chan_req);
+               if (rc)
+                       return rc;
                break;
        default:
                LOGP(DRLCMAC, LOGL_ERROR, "RACH.ind contains unknown burst type 
0x%02x "
@@ -766,6 +824,11 @@
                chan_req.single_block = true;
        }

+       /* TODO: handle Radio Priority (see 3GPP TS 44.060, table 11.2.5a.5) */
+       if (chan_req.priority > 0)
+               LOGP(DRLCMAC, LOGL_NOTICE, "EGPRS Packet Channel Request 
indicates "
+                    "Radio Priority %u, however we ignore it\n", 
chan_req.priority);
+
        /* Should we allocate a single block or an Uplink TBF? */
        if (chan_req.single_block) {
                rc = sba()->alloc(&trx_no, &ts_no, &sb_fn, ta);

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/18387
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia15761c33c8048d35c7f7bc93dbea781dd0894b7
Gerrit-Change-Number: 18387
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilira...@gmail.com>
Gerrit-MessageType: newchange

Reply via email to