Commit 69e42dd4 authored by Robert Schmidt's avatar Robert Schmidt

Remove sched_resp

parent b8f5ea90
...@@ -170,9 +170,6 @@ static void tx_func(processingData_L1tx_t *info) ...@@ -170,9 +170,6 @@ static void tx_func(processingData_L1tx_t *info)
ru_tx_func((void *)&syncMsgRU); ru_tx_func((void *)&syncMsgRU);
stop_meas(&info->gNB->phy_proc_tx); stop_meas(&info->gNB->phy_proc_tx);
} }
/* this thread is done with the sched_info, decrease the reference counter */
LOG_D(NR_PHY, "Calling deref_sched_response for id %d (tx_func) in %d.%d\n", info->sched_response_id, frame_tx, slot_tx);
deref_sched_response(info->sched_response_id);
} }
void *L1_rx_thread(void *arg) void *L1_rx_thread(void *arg)
......
...@@ -817,8 +817,6 @@ typedef struct processingData_L1tx { ...@@ -817,8 +817,6 @@ typedef struct processingData_L1tx {
uint16_t num_pdsch_slot; uint16_t num_pdsch_slot;
int num_dl_pdcch; int num_dl_pdcch;
int num_ul_pdcch; int num_ul_pdcch;
/* a reference to the sched_response, to release it when not needed anymore */
int sched_response_id;
} processingData_L1tx_t; } processingData_L1tx_t;
typedef struct processingData_L1rx { typedef struct processingData_L1rx {
......
...@@ -232,8 +232,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) ...@@ -232,8 +232,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
bool is_ul = slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT; bool is_ul = slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT;
processingData_L1tx_t *msgTx = gNB->msgDataTx; processingData_L1tx_t *msgTx = gNB->msgDataTx;
/* store the sched_response_id for the TX thread to release it when done */
msgTx->sched_response_id = Sched_INFO->sched_response_id;
DevAssert(Sched_INFO->DL_req.SFN == frame); DevAssert(Sched_INFO->DL_req.SFN == frame);
DevAssert(Sched_INFO->DL_req.Slot == slot); DevAssert(Sched_INFO->DL_req.Slot == slot);
...@@ -249,11 +247,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) ...@@ -249,11 +247,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
nr_schedule_tx_req(gNB, &Sched_INFO->TX_req); nr_schedule_tx_req(gNB, &Sched_INFO->TX_req);
nr_schedule_ul_dci_req(gNB, &Sched_INFO->UL_dci_req); nr_schedule_ul_dci_req(gNB, &Sched_INFO->UL_dci_req);
/* Both the current thread and the TX thread will access the sched_info
* at the same time, so increase its reference counter, so that it is
* released only when both threads are done with it.
*/
inc_ref_sched_response(Sched_INFO->sched_response_id);
} }
/* /*
...@@ -297,11 +290,5 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) ...@@ -297,11 +290,5 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
#endif #endif
} }
*/ */
/* this thread is done with the sched_info, decrease the reference counter */
if ((slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) && NFAPI_MODE == NFAPI_MONOLITHIC) {
LOG_D(NR_PHY, "Calling dref_sched_response for id %d in %d.%d (sched_response)\n", Sched_INFO->sched_response_id, frame, slot);
deref_sched_response(Sched_INFO->sched_response_id);
}
stop_meas(&gNB->schedule_response_stats); stop_meas(&gNB->schedule_response_stats);
} }
...@@ -987,7 +987,6 @@ int main(int argc, char **argv) ...@@ -987,7 +987,6 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
memset(Sched_INFO, 0, sizeof(*Sched_INFO)); memset(Sched_INFO, 0, sizeof(*Sched_INFO));
Sched_INFO->sched_response_id = -1;
while ((round<num_rounds) && (UE_harq_process->ack==0)) { while ((round<num_rounds) && (UE_harq_process->ack==0)) {
round_trials[round]++; round_trials[round]++;
......
...@@ -715,7 +715,6 @@ int main(int argc, char *argv[]) ...@@ -715,7 +715,6 @@ int main(int argc, char *argv[])
NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO));
memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO));
nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req; nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req;
Sched_INFO->sched_response_id = -1;
nr_phy_data_tx_t phy_data = {0}; nr_phy_data_tx_t phy_data = {0};
......
...@@ -84,8 +84,6 @@ typedef struct { ...@@ -84,8 +84,6 @@ typedef struct {
typedef struct { typedef struct {
/// the ID of this sched_response - used by sched_reponse memory management
int sched_response_id;
/// Module ID /// Module ID
module_id_t module_id; module_id_t module_id;
/// CC ID /// CC ID
......
...@@ -77,25 +77,15 @@ void init_sched_response(void) ...@@ -77,25 +77,15 @@ void init_sched_response(void)
NR_Sched_Rsp_t *allocate_sched_response(void) NR_Sched_Rsp_t *allocate_sched_response(void)
{ {
NR_Sched_Rsp_t *ret; NR_Sched_Rsp_t *ret;
int new_head;
if (pthread_mutex_lock(&resp_mutex)) if (pthread_mutex_lock(&resp_mutex))
AssertFatal(0, "pthread_mutex_lock failed\n"); AssertFatal(0, "pthread_mutex_lock failed\n");
AssertFatal(resp_freelist_inited, "sched_response used before init\n"); AssertFatal(resp_freelist_inited, "sched_response used before init\n");
if (resp_freelist_head == -1) { static int next = 0;
LOG_E(PHY, "fatal: sched_response cannot be allocated, increase N_RESP\n"); ret = &resp[next++];
exit(1); next %= N_RESP;
}
ret = &resp[resp_freelist_head];
ret->sched_response_id = resp_freelist_head;
resp_refcount[resp_freelist_head] = 1;
new_head = resp_freelist_next[resp_freelist_head];
resp_freelist_next[resp_freelist_head] = -1;
resp_freelist_head = new_head;
if (pthread_mutex_unlock(&resp_mutex)) if (pthread_mutex_unlock(&resp_mutex))
AssertFatal(0, "pthread_mutex_unlock failed\n"); AssertFatal(0, "pthread_mutex_unlock failed\n");
...@@ -106,12 +96,11 @@ NR_Sched_Rsp_t *allocate_sched_response(void) ...@@ -106,12 +96,11 @@ NR_Sched_Rsp_t *allocate_sched_response(void)
static void release_sched_response(int sched_response_id) static void release_sched_response(int sched_response_id)
{ {
LOG_D(NR_MAC,"Releasing sched_response %d\n",sched_response_id); LOG_D(NR_MAC,"Releasing sched_response %d\n",sched_response_id);
resp_freelist_next[sched_response_id] = resp_freelist_head;
resp_freelist_head = sched_response_id;
} }
void deref_sched_response(int sched_response_id) void deref_sched_response(int sched_response_id)
{ {
AssertFatal(false, "don't call\n");
/* simulators (ulsim/dlsim) deal with their own sched_response but call /* simulators (ulsim/dlsim) deal with their own sched_response but call
* functions that call this one, let's handle this case with a special * functions that call this one, let's handle this case with a special
* value -1 where we do nothing (yes it's a hack) * value -1 where we do nothing (yes it's a hack)
...@@ -136,6 +125,7 @@ void deref_sched_response(int sched_response_id) ...@@ -136,6 +125,7 @@ void deref_sched_response(int sched_response_id)
void inc_ref_sched_response(int sched_response_id) void inc_ref_sched_response(int sched_response_id)
{ {
AssertFatal(false, "don't call\n");
/* simulators (ulsim/dlsim) deal with their own sched_response but call /* simulators (ulsim/dlsim) deal with their own sched_response but call
* functions that call this one, let's handle this case with a special * functions that call this one, let's handle this case with a special
* value -1 where we do nothing (yes it's a hack) * value -1 where we do nothing (yes it's a hack)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment