bugfix: change memory management of interface between PHY and MAC scheduler

This commit fixes a bug caused by global variables in the gNB_MAC_INST
structure used to transfer MAC scheduler's results to the PHY layer.

When using several threads in the PHY layer, it may happen that the
MAC scheduler is called a second time by the second PHY thread for the
next slot before the content of the global variables in the gNB_MAC_INST
structure used to store the result of the MAC scheduler for the current
slot have been consumed by the first thread, leading to unpredictable
results (all of them certainly wrong).

The solution is to introduce a small memory management module for the
interface between the PHY threads and the MAC scheduler. The MAC
scheduler now fills the data structures passed to it, and not a
global variable anymore. The PHY layer manages the structures and
ensures that no data is overwritten before being fully consumed by
the various threads of the PHY layer.

Some care has to be taken because several PHY threads will access the
same structures at the same time for a given slot (in read mode, so
it's okay). A mechanism of reference counting has thus been introduced.

Only one CC is supported. This restriction should not be too hard
to remove if/when needed. (The code before this commit does not seem
to work for more than one CC anyway.)
This commit is contained in:
Cedric Roux
2023-04-05 16:39:12 +02:00
parent 1f97969675
commit 733c7e5e89
23 changed files with 497 additions and 149 deletions
+6 -4
View File
@@ -83,6 +83,8 @@ typedef struct {
typedef struct {
/// the ID of this sched_response - used by sched_reponse memory management
int sched_response_id;
/// Module ID
module_id_t module_id;
/// CC ID
@@ -92,13 +94,13 @@ typedef struct {
/// slot
slot_t slot;
/// nFAPI DL Config Request
nfapi_nr_dl_tti_request_t *DL_req;
nfapi_nr_dl_tti_request_t DL_req;
/// nFAPI UL Config Request
nfapi_nr_ul_tti_request_t *UL_tti_req;
nfapi_nr_ul_tti_request_t UL_tti_req;
/// nFAPI UL_DCI Request
nfapi_nr_ul_dci_request_t *UL_dci_req;
nfapi_nr_ul_dci_request_t UL_dci_req;
/// Pointers to DL SDUs
nfapi_nr_tx_data_request_t *TX_req;
nfapi_nr_tx_data_request_t TX_req;
} NR_Sched_Rsp_t;
typedef struct {