diff --git a/include/osmocom/gprs/sndcp/sndcp_private.h b/include/osmocom/gprs/sndcp/sndcp_private.h index 21c6a40..5630c97 100644 --- a/include/osmocom/gprs/sndcp/sndcp_private.h +++ b/include/osmocom/gprs/sndcp/sndcp_private.h @@ -151,6 +151,9 @@ struct gprs_sndcp_entity { /* The NSAPI we shall use on top of LLC */ uint8_t nsapi; + /* Radio Priority (MS only, used by LLC/RLCMAC), TS 24.008 10.5.7.2 */ + uint8_t radio_prio; + /* NPDU number for the GTP->SNDCP side */ uint16_t tx_npdu_nr; /* SNDCP eeceiver state */ diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c index d71cac9..7e82b5d 100644 --- a/src/sndcp/sndcp.c +++ b/src/sndcp/sndcp.c @@ -222,6 +222,18 @@ int gprs_sndcp_sne_submit_llc_ll_xid_req(struct gprs_sndcp_entity *sne) return rc; } +int gprs_sndcp_sne_submit_llc_ll_unitdata_req(struct gprs_sndcp_entity *sne, uint8_t *data, unsigned int len) +{ + struct osmo_gprs_llc_prim *llc_prim_tx; + int rc; + + llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_unitdata_req(sne->snme->tlli, sne->llc_sapi, data, len); + OSMO_ASSERT(llc_prim_tx); + llc_prim_tx->ll.unitdata_req.radio_prio = sne->radio_prio; + rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); + return rc; +} + int gprs_sndcp_sne_submit_sn_xid_cnf(struct gprs_sndcp_entity *sne) { struct osmo_gprs_sndcp_prim *sndcp_prim_tx; @@ -530,7 +542,6 @@ static int gprs_sndcp_send_ud_frag(struct sndcp_frag_state *fs, unsigned int len; uint8_t *data; int rc, more; - struct osmo_gprs_llc_prim *llc_prim_tx; fmsg = msgb_alloc_headroom(sne->n201_u+256, 128, "SNDCP Frag"); if (!fmsg) { @@ -588,9 +599,7 @@ static int gprs_sndcp_send_ud_frag(struct sndcp_frag_state *fs, sch->more = more; /* Send down the stack SNDCP->LLC as LL-UNITDATA.req: */ - llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_unitdata_req(sne->snme->tlli, sne->llc_sapi, fmsg->data, fmsg->len); - OSMO_ASSERT(llc_prim_tx); - rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); + rc = gprs_sndcp_sne_submit_llc_ll_unitdata_req(sne, fmsg->data, fmsg->len); msgb_free(fmsg); /* abort in case of error, do not advance frag_nr / next_byte */ if (rc < 0) { @@ -622,7 +631,6 @@ int gprs_sndcp_sne_handle_sn_unitdata_req(struct gprs_sndcp_entity *sne, uint8_t uint8_t dcomp = 0; int rc; struct msgb *msg = msgb_alloc_headroom(npdu_len + 256, 128, "sndcp-tx"); - struct osmo_gprs_llc_prim *llc_prim_tx; memcpy(msgb_put(msg, npdu_len), npdu, npdu_len); @@ -711,9 +719,7 @@ int gprs_sndcp_sne_handle_sn_unitdata_req(struct gprs_sndcp_entity *sne, uint8_t sch->nsapi = sne->nsapi; /* Send down the stack SNDCP->LLC as LL-UNITDATA.req: */ - llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_unitdata_req(sne->snme->tlli, sne->llc_sapi, msg->data, msg->len); - OSMO_ASSERT(llc_prim_tx); - rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); + rc = gprs_sndcp_sne_submit_llc_ll_unitdata_req(sne, msg->data, msg->len); free_ret: msgb_free(msg); return rc; diff --git a/src/sndcp/sndcp_prim.c b/src/sndcp/sndcp_prim.c index e371416..2e2139c 100644 --- a/src/sndcp/sndcp_prim.c +++ b/src/sndcp/sndcp_prim.c @@ -661,6 +661,8 @@ static int gprs_sndcp_prim_handle_sndcp_snsm_activate_ind(struct osmo_gprs_sndcp if (g_sndcp_ctx->location != OSMO_GPRS_SNDCP_LOCATION_MS) return 0; + sne->radio_prio = sndcp_prim->snsm.activate_ind.radio_prio; + /* TODO: when supporting and using LLC ABM mode, flow should go through * LL-ESTABLISH.req, as per TS 24.007 C.6 "No LLC link exists yet, * establish a link and exchange XID"