Commit aa50fcf0 authored by Xenofon Foukas's avatar Xenofon Foukas

Fixed HARQ reporting to agent and changed sf trigger to report the upcoming subframe

parent 74819596
......@@ -67,6 +67,12 @@
# endif
#endif
//Agent-related headers
#include "ENB_APP/enb_agent_extern.h"
#include "ENB_APP/enb_agent_mac.h"
#include "LAYER2/MAC/enb_agent_mac_proto.h"
//#define DIAG_PHY
#define NS_PER_SLOT 500000
......@@ -1411,6 +1417,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#endif
#endif
if (abstraction_flag == 0) {
start_meas(&phy_vars_eNB->dlsch_encoding_stats);
......@@ -1603,6 +1610,13 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->dlsch_eNB_ra->active = 0;
}
#ifndef DISABLE_SF_TRIGGER
//Send subframe trigger to the controller
if (mac_agent_registered[phy_vars_eNB->Mod_id]) {
agent_mac_xface[phy_vars_eNB->Mod_id]->enb_agent_send_sf_trigger(phy_vars_eNB->Mod_id);
}
#endif
// Now scan UE specific DLSCH
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
{
......
......@@ -180,6 +180,13 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
fprintf(stderr, "pthread_attr_init err\n");
exit(1);
}
struct sched_param sched_param_recv_thread;
sched_param_recv_thread.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;
pthread_attr_setschedparam(&att, &sched_param_recv_thread);
pthread_attr_setschedpolicy(&att, SCHED_FIFO);
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
fprintf(stderr, "pthread_attr_setdetachstate err\n");
exit(1);
......
......@@ -514,6 +514,32 @@ uint16_t get_sfn_sf (mid_t mod_id) {
return sfn_sf;
}
uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
frame_t frame;
sub_frame_t subframe;
uint16_t sfn_sf, frame_mask, sf_mask;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
subframe = ((subframe + ahead_of_time) % 10);
int full_frames_ahead = ((ahead_of_time / 10) % 10);
frame = frame + full_frames_ahead;
if (subframe < get_current_subframe(mod_id)) {
frame++;
}
frame_mask = ((1<<12) - 1);
sf_mask = ((1<<4) - 1);
sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
return sfn_sf;
}
int get_num_ues (mid_t mod_id){
return ((UE_list_t *)enb_ue[mod_id])->num_UEs;
......
......@@ -145,6 +145,8 @@ unsigned int get_current_subframe(mid_t mod_id);
Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/
uint16_t get_sfn_sf (mid_t mod_id);
uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
int get_num_ues(mid_t mod_id);
int get_ue_crnti (mid_t mod_id, mid_t ue_id);
......
......@@ -947,9 +947,27 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran
}
protocol__prp_sf_trigger__init(sf_trigger_msg);
frame_t frame;
sub_frame_t subframe;
int ahead_of_time = 1;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
subframe = ((subframe + ahead_of_time) % 10);
int full_frames_ahead = ((ahead_of_time / 10) % 10);
frame = frame + full_frames_ahead;
if (subframe < get_current_subframe(mod_id)) {
frame++;
}
sf_trigger_msg->header = header;
sf_trigger_msg->has_sfn_sf = 1;
sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id);
sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1);
/*TODO: Fill in the number of dl HARQ related info, based on the number of currently
*transmitting UEs
......@@ -973,7 +991,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran
/*TODO: fill in the right id of this round's HARQ process for this UE*/
int harq_id;
int harq_status;
get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),&harq_id, &harq_status);
get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
dl_info[i]->harq_process_id = harq_id;
dl_info[i]->has_harq_process_id = 1;
/*TODO: fill in the status of the HARQ process (2 TBs)*/
......@@ -1369,8 +1387,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
xface->enb_agent_send_sr_info = enb_agent_send_sr_info;
xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger;
xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats;
xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default;
//xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote;
//xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default;
xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote;
xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config;
xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change;
......
......@@ -216,12 +216,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
}
#ifndef DISABLE_SF_TRIGGER
//Send subframe trigger to the controller
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP);
}
#endif
/* #ifndef DISABLE_SF_TRIGGER */
/* //Send subframe trigger to the controller */
/* if (mac_agent_registered[module_idP]) { */
/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */
/* } */
/* #endif */
//if (subframeP%5 == 0)
//#ifdef EXMIMO
......@@ -971,6 +971,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
allocate_CCEs(module_idP,CC_id,subframeP,0);
#ifndef DISABLE_CONT_STATS
//Send subframe trigger to the controller
if (mac_agent_registered[module_idP]) {
......@@ -978,6 +979,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
}
#endif
LOG_D(MAC,"frameP %d, subframeP %d\n",frameP,subframeP);
stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
......
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