Set matching USF if available when polling a UL TBF

When the scheduler detects it's time to receive a UL block due to a
scheduled poll, if that polling is done on a UL TBF, then use its USF if
available instead of using USF_UNUSED (=7) when sending a DL block on
that same FN.

This is not really needed for correct work, since MS take care
themselves of scheduling a UL block when they receive the poll (RRBP)
some time before, and don't check the USF at the time of transmitting.
In any case, it helps understand better when looking at pcap traces that
indeed it a UL block from that MS was requested, instead of setting USF
to 7.

Related: OS#5033
Change-Id: I2ad9d8ea6afc8f83192033470bd27010a7474430
This commit is contained in:
Pau Espin 2021-03-24 13:14:09 +01:00
parent 4bab867d9f
commit 7bd92a3e1d
3 changed files with 23 additions and 16 deletions

View File

@ -461,27 +461,31 @@ int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
/* polling for next uplink block */
poll_fn = rts_next_fn(fn, block_nr);
/* check uplink resource for polling */
if ((poll_tbf = pdch_ulc_get_tbf_poll(pdch->ulc, poll_fn))) {
/* check for sba */
if ((sba = pdch_ulc_get_sba(pdch->ulc, poll_fn))) {
LOGPDCH(pdch, DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: "
"FN=%d block_nr=%d scheduling free USF for "
"single block allocation at FN=%d\n", fn, block_nr, sba->fn);
/* else, check uplink resource for polling */
} else if ((poll_tbf = pdch_ulc_get_tbf_poll(pdch->ulc, poll_fn))) {
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: TRX=%d "
"TS=%d FN=%d block_nr=%d scheduling free USF for "
"polling at FN=%d of %s\n", trx, ts, fn,
block_nr, poll_fn, tbf_name(poll_tbf));
/* else. check for sba */
} else if ((sba = pdch_ulc_get_sba(pdch->ulc, poll_fn))) {
LOGPDCH(pdch, DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: "
"FN=%d block_nr=%d scheduling free USF for "
"single block allocation at FN=%d\n", fn, block_nr, sba->fn);
/* else, we search for uplink resource */
/* If POLL TBF is UL and already has a USF assigned on this TS,
* let's set its USF in the DL msg. This is not really needed,
* but it helps understand better the flow when looking at
* pcaps. */
if (poll_tbf->direction == GPRS_RLCMAC_UL_TBF && as_ul_tbf(poll_tbf)->m_usf[ts] != USF_INVALID)
usf_tbf = as_ul_tbf(poll_tbf);
/* else, search for uplink tbf */
} else {
usf_tbf = sched_select_uplink(trx, ts, fn, block_nr, pdch, require_gprs_only);
/* If MS selected for USF is GPRS-only, then it will only be
* able to read USF if dl block uses GMSK * (CS1-4, MCS1-4)
*/
if (usf_tbf && req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
req_mcs_kind = EGPRS_GMSK;
}
/* If MS selected for USF is GPRS-only, then it will only be
* able to read USF if dl block uses GMSK * (CS1-4, MCS1-4) */
if (usf_tbf && req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
req_mcs_kind = EGPRS_GMSK;
get_tbf_candidates(bts, trx, ts, &tbf_cand);

View File

@ -213,7 +213,7 @@ gprs_rlcmac_ul_tbf::gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms)
m_ul_gprs_ctrs(NULL),
m_ul_egprs_ctrs(NULL)
{
memset(&m_usf, 0, sizeof(m_usf));
memset(&m_usf, USF_INVALID, sizeof(m_usf));
}
/*

View File

@ -47,6 +47,9 @@ enum tbf_egprs_ul_counters {
TBF_CTR_EGPRS_UL_MCS9,
};
/* Used in ul_tbf->m_usf[] to flag unassigned USF on a given TS: */
#define USF_INVALID 0xFF
#define LOGPTBFUL(tbf, level, fmt, args...) LOGP(DTBFUL, level, "%s " fmt, tbf_name(tbf), ## args)
struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
@ -90,7 +93,7 @@ struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
* variables are in both (dl and ul) structs and not outside union.
*/
int32_t m_rx_counter; /* count all received blocks */
uint8_t m_usf[8]; /* list USFs per PDCH (timeslot) */
uint8_t m_usf[8]; /* list USFs per PDCH (timeslot), initialized to USF_INVALID */
uint8_t m_contention_resolution_done; /* set after done */
uint8_t m_final_ack_sent; /* set if we sent final ack */