Commit 394ab219 authored by liuxu's avatar liuxu

rb done231108

parent e47493a8
...@@ -2051,6 +2051,7 @@ add_executable(nr-softmodem ...@@ -2051,6 +2051,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/executables/nr-ru.c ${OPENAIR_DIR}/executables/nr-ru.c
${OPENAIR_DIR}/executables/nr-softmodem.c ${OPENAIR_DIR}/executables/nr-softmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/executables/gnbSendToManager_client.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c ${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c ${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
......
...@@ -8,14 +8,16 @@ ...@@ -8,14 +8,16 @@
#include <unistd.h> #include <unistd.h>
#define GNBSENDTOMANAGER_PORT 7789 #define GNBSENDTOMANAGER_PORT 7789
#define GNBSENDTOMANAGER_MAX_LEN 2990 #define GNBSENDTOMANAGER_MAX_LEN 11598
/* /*
gcc -o manager_s Manager_sever.c -pthread gcc -o manager_s Manager_sever.c -pthread
*/ */
int main(void){ int main(void){
uint16_t r_buf[GNBSENDTOMANAGER_MAX_LEN]; uint8_t read_buf[GNBSENDTOMANAGER_MAX_LEN];
uint16_t *data;
struct sockaddr_in addr,cli_addr; struct sockaddr_in addr,cli_addr;
int len=sizeof(addr); int len=sizeof(addr);
int sockfd=socket(AF_INET,SOCK_STREAM,0);//IPV4,tcp int sockfd=socket(AF_INET,SOCK_STREAM,0);//IPV4,tcp
...@@ -50,44 +52,131 @@ int main(void){ ...@@ -50,44 +52,131 @@ int main(void){
return -1; return -1;
} }
printf("client %s connected!\n", inet_ntoa(cli_addr.sin_addr)); printf("client %s connected!\n", inet_ntoa(cli_addr.sin_addr));
/*LSB -> MSB : ulsch || acknack || csi-report || sr || srs*/
uint8_t ul_sched_flag;
uint16_t csi_report_frame;
uint16_t sr_frame;
uint16_t srs_frame;
uint16_t acknack_frame;
uint16_t ulsch_frame;
uint16_t csi_report_slot;
uint16_t sr_slot;
uint16_t srs_slot;
uint16_t acknack_slot;
uint16_t ulsch_slot;
float dl_velocity; float dl_velocity;
float ul_velocity; float ul_velocity;
uint16_t dl_mcs; uint16_t dl_mcs;
uint16_t ul_mcs; uint16_t ul_mcs;
float dl_bler; float dl_bler;
float ul_bler; float ul_bler;
// int16_t snr; int16_t pucch_snr;
int16_t pusch_snr;
int16_t rsrp; int16_t rsrp;
int rec_len, data_len, UE_id, frame, slot, count; int rec_len, data_len, UE_id, frame, slot, count;
FILE *fp;
fp = fopen("/home/witcomm/work/liuxu/5gManager/ran/executables/management.csv", "w");
// fp = stdout;
if (fp == NULL) {
printf("Failed to open file.\n");
return 1;
}
while(1) while(1)
{ {
count = 0; count = 0;
memset(r_buf,-1,sizeof(r_buf)); memset(read_buf,0,sizeof(read_buf));
rec_len = recv(comfd,(void *)r_buf,GNBSENDTOMANAGER_MAX_LEN,0); rec_len = read(comfd,read_buf,GNBSENDTOMANAGER_MAX_LEN);
data = (uint16_t *)&read_buf[0];
data_len = r_buf[0]; data_len = data[count++];
printf("recv length:%d, data length:%d\n", rec_len, data_len); fprintf(fp, "recv length:%d, data length:%d\n", rec_len, data_len);
UE_id = r_buf[1]; if (rec_len==data_len){
frame = r_buf[2]; memcpy(data, read_buf, data_len);
slot = r_buf[3]; UE_id = data[count++];
dl_velocity = r_buf[4]*1.0/1000; frame = data[count++];
ul_velocity = (float)r_buf[5]*1.0/1000; slot = data[count++];
dl_mcs = r_buf[6]; ul_sched_flag = data[count++];
ul_mcs = r_buf[7]; csi_report_frame= data[count++];
dl_bler = r_buf[8]*1.0/100; sr_frame= data[count++];
ul_bler = r_buf[9]*1.0/100; srs_frame= data[count++];
rsrp = r_buf[10]; acknack_frame= data[count++];
printf("%d.%d: dl_velocity %fMpbs ul_velocity %fMpbs dl_mcs %d ul_mcs %d dl_bler %f ul_bler %f rsrp %ddBm\n", ulsch_frame= data[count++];
frame, slot, dl_velocity, ul_velocity, dl_mcs, ul_mcs, dl_bler,ul_bler, rsrp); csi_report_slot= data[count++];
for (int rb = 0; rb < 5; rb++){ sr_slot= data[count++];
for (int symbol = 0; symbol < 14; symbol++){ srs_slot= data[count++];
printf("%d ", r_buf[11+count]); acknack_slot= data[count++];
count++; ulsch_slot= data[count++];
dl_velocity = data[count++]*1.0/1000;
ul_velocity = (float)data[count++]*1.0/1000;
dl_mcs = data[count++];
ul_mcs = data[count++];
dl_bler = data[count++]*1.0/100;
ul_bler = data[count++]*1.0/100;
pucch_snr = data[count++];
pusch_snr = data[count++];
rsrp = data[count++];
fprintf(fp, "ul_sched_flag %x ulsch %d.%d acknack %d.%d csi_report %d.%d sr %d.%d srs %d.%d\n",
ul_sched_flag,
ulsch_frame, ulsch_slot, acknack_frame, acknack_slot,
csi_report_frame, csi_report_slot, sr_frame, sr_slot,
srs_frame, srs_slot);
fprintf(fp, "%d.%d: dl_velocity %fMpbs, ul_velocity %fMpbs, dl_mcs %d, ul_mcs %d, dl_bler %f, ul_bler %f, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
frame, slot, dl_velocity, ul_velocity, dl_mcs, ul_mcs, dl_bler,ul_bler, pucch_snr, pusch_snr,rsrp);
fprintf(fp, "Downlink RB position:\n");
for (int rb = 0; rb < 275; rb++){
// if (rb < 5)
fprintf(fp, "%d,", data[count++]);
// count++;
}
fprintf(fp, "\n");
fprintf(fp, "Uplink RB position:\n");
for (int i = 0; i < 20; i++){
for (int rb = 0; rb < 275; rb++){
// if (rb < 5)
fprintf(fp, "%d,", data[count++]);
// count++;
}
fprintf(fp, "\n");
} }
printf("\n"); }
} else{
memcpy(data, read_buf, rec_len);
UE_id = data[count++];
frame = data[count++];
slot = data[count++];
ul_sched_flag = data[count++];
csi_report_frame= data[count++];
sr_frame= data[count++];
srs_frame= data[count++];
acknack_frame= data[count++];
ulsch_frame= data[count++];
csi_report_slot= data[count++];
sr_slot= data[count++];
srs_slot= data[count++];
acknack_slot= data[count++];
ulsch_slot= data[count++];
dl_velocity = data[count++]*1.0/1000;
ul_velocity = (float)data[count++]*1.0/1000;
dl_mcs = data[count++];
ul_mcs = data[count++];
dl_bler = data[count++]*1.0/100;
ul_bler = data[count++]*1.0/100;
pucch_snr = data[count++];
pusch_snr = data[count++];
rsrp = data[count++];
fprintf(fp, "ul_sched_flag %x ulsch %d.%d acknack %d.%d csi_report %d.%d sr %d.%d srs %d.%d\n",
ul_sched_flag,
ulsch_frame, ulsch_slot, acknack_frame, acknack_slot,
csi_report_frame, csi_report_slot, sr_frame, sr_slot,
srs_frame, srs_slot);
fprintf(fp, "%d.%d: dl_velocity %fMpbs, ul_velocity %fMpbs, dl_mcs %d, ul_mcs %d, dl_bler %f, ul_bler %f, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
frame, slot, dl_velocity, ul_velocity, dl_mcs, ul_mcs, dl_bler,ul_bler, pucch_snr, pusch_snr,rsrp);
}
} }
fclose(fp);
close(sockfd); close(sockfd);
close(comfd); close(comfd);
......
...@@ -8,14 +8,16 @@ ...@@ -8,14 +8,16 @@
#include <unistd.h> #include <unistd.h>
#include <semaphore.h> #include <semaphore.h>
#include "nr-softmodem-common.h" #include "nr-softmodem-common.h"
#include "../openair2/LAYER2/NR_MAC_gNB/slotmap.h"
#define GNBSENDTOMANAGER_PORT 7788 #define GNBSENDTOMANAGER_PORT 7788
#define GNBSENDTOMANAGER_MAX_LEN (sizeof(sim_socket_t)) #define GNBSENDTOMANAGER_MAX_LEN (sizeof(sim_socket_t))
// #define GNBSENDTOMANAGER_UPLINK_LEN 3*14*106*2
#define GNBSENDTOMANAGER_IP "127.0.0.1" #define GNBSENDTOMANAGER_IP "127.0.0.1"
//#define GNBSENDTOMANAGER_MAX_LEN 65536 //#define GNBSENDTOMANAGER_MAX_LEN 65536
sem_t gnbSendToManager_sem; sem_t gnbSendToManager_sem;
uint16_t *gnbSendToManager_buf; uint8_t *gnbSendToManager_buf;
unsigned int gnbSendToManager_len; unsigned int gnbSendToManager_len;
...@@ -65,8 +67,9 @@ void *gnbSendToManager_task(void *args_p) ...@@ -65,8 +67,9 @@ void *gnbSendToManager_task(void *args_p)
// } // }
// printf("\n"); // printf("\n");
// } // }
send_len = send(sockfd, (void *)gnbSendToManager_buf, gnbSendToManager_len, 0); send_len = send(sockfd, gnbSendToManager_buf, GNBSENDTOMANAGER_MAX_LEN, 0);
// printf("send_len=%d\n", send_len);
printf("send_len=%d\n", send_len);
} }
close(sockfd); close(sockfd);
......
...@@ -158,7 +158,7 @@ extern int numerology; ...@@ -158,7 +158,7 @@ extern int numerology;
extern int usrp_tx_thread; extern int usrp_tx_thread;
extern sem_t gnbSendToManager_sem; extern sem_t gnbSendToManager_sem;
extern uint16_t *gnbSendToManager_buf; extern uint8_t *gnbSendToManager_buf;
extern unsigned int gnbSendToManager_len; extern unsigned int gnbSendToManager_len;
extern void *gnbSendToManager_task(void *args_p); extern void *gnbSendToManager_task(void *args_p);
#endif #endif
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
//#define DEBUG_CH //#define DEBUG_CH
//#define DEBUG_PUSCH //#define DEBUG_PUSCH
//#define SRS_DEBUG // #define SRS_DEBUG
#define NO_INTERP 1 #define NO_INTERP 1
#define dBc(x,y) (dB_fixed(((int32_t)(x))*(x) + ((int32_t)(y))*(y))) #define dBc(x,y) (dB_fixed(((int32_t)(x))*(x) + ((int32_t)(y))*(y)))
......
...@@ -49,11 +49,15 @@ ...@@ -49,11 +49,15 @@
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "executables/nr-softmodem.h" #include "executables/nr-softmodem.h"
#include "executables/nr-softmodem-common.h"
#include "slotmap.h"
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1}; const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1};
sim_socket_t sim_socket_manager;
void clear_nr_nfapi_information(gNB_MAC_INST *gNB, void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
int CC_idP, int CC_idP,
...@@ -187,12 +191,35 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ ...@@ -187,12 +191,35 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const int size = gNB->vrb_map_UL_size; const int size = gNB->vrb_map_UL_size;
const int prev_slot = frame * num_slots + slot + size - 1; const int prev_slot = frame * num_slots + slot + size - 1;
LOG_D(PHY, "prev_slot %d vrb_map_UL_size %d num_slots %d prev_slot %% size = %d\n", prev_slot, gNB->vrb_map_UL_size, num_slots, prev_slot % size);
uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL; uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL;
memcpy(&vrb_map_UL[prev_slot % size * MAX_BWP_SIZE], &gNB->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE); memcpy(&vrb_map_UL[prev_slot % size * MAX_BWP_SIZE], &gNB->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE);
clear_nr_nfapi_information(gNB, CC_id, frame, slot, &sched_info->DL_req, &sched_info->TX_req, &sched_info->UL_dci_req); clear_nr_nfapi_information(gNB, CC_id, frame, slot, &sched_info->DL_req, &sched_info->TX_req, &sched_info->UL_dci_req);
} }
for (int UE_id_map = 0; UE_id_map < MAX_NUM_CCs; UE_id_map++){
// clear vrb_maps
memset(sim_socket_manager.vrb_map_socket, 0, sizeof(uint16_t) * RB_TOTAL_MAP_SOCKET*SYMBOL_PER_SLOT_MAP_SOCKET);
// clear last scheduled slot's content (only)!
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const int size = gNB->vrb_map_UL_size;
const int prev_slot = frame * num_slots + slot + size - 1;
uint16_t *vrb_map_UL = sim_socket_manager.vrb_map_ul_socket;
memcpy(&vrb_map_UL[prev_slot % size * RB_TOTAL_MAP_SOCKET], &gNB->ulprbbl, sizeof(uint16_t) * RB_TOTAL_MAP_SOCKET);
sim_socket_manager.UE_id = UE_id_map;
sim_socket_manager.slot = slot;
sim_socket_manager.frame = frame;
sim_socket_manager.data_len = 0;
sim_socket_manager.ulsch_frame = sim_socket_manager.ulsch_slot = 0;
sim_socket_manager.acknack_frame = sim_socket_manager.acknack_slot = 0;
sim_socket_manager.csi_report_frame = sim_socket_manager.csi_report_slot = 0;
sim_socket_manager.sr_frame = sim_socket_manager.sr_slot = 0;
sim_socket_manager.srs_frame = sim_socket_manager.srs_slot = 0;
sim_socket_manager.ul_sched_flag = 0;
}
if ((slot == 0) && (frame & 127) == 0) { if ((slot == 0) && (frame & 127) == 0) {
char stats_output[16000] = {0}; char stats_output[16000] = {0};
dump_mac_stats(gNB, stats_output, sizeof(stats_output), true); dump_mac_stats(gNB, stats_output, sizeof(stats_output), true);
...@@ -261,4 +288,32 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ ...@@ -261,4 +288,32 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
stop_meas(&gNB->eNB_scheduler); stop_meas(&gNB->eNB_scheduler);
NR_SCHED_UNLOCK(&gNB->sched_lock); NR_SCHED_UNLOCK(&gNB->sched_lock);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
// for (int rb = 0; rb < 5; rb++){
// printf("In[%s] gnbSendToManager_buf[%d+0]= %d\n",__FUNCTION__,rb,gnbSendToManager_buf[rb+0]);
// }
if (RC.nrmac[module_idP]->UE_info.list[0]!=NULL){
gnbSendToManager_buf = &sim_socket_manager;
sim_socket_manager.data_len = sizeof(sim_socket_t);
gnbSendToManager_len = sim_socket_manager.data_len;
printf("data_len %d\n", sim_socket_manager.data_len);
sim_socket_manager.dl_velocity = RC.nrmac[module_idP]->UE_info.list[0]->mac_stats.dl.current_bytes*8*2;
sim_socket_manager.ul_velocity = RC.nrmac[module_idP]->UE_info.list[0]->mac_stats.ul.current_bytes*8*2;
sim_socket_manager.dl_mcs = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.dl_bler_stats.mcs;
sim_socket_manager.ul_mcs = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.ul_bler_stats.mcs;
sim_socket_manager.dl_bler = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.dl_bler_stats.bler*100;
sim_socket_manager.ul_bler = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.ul_bler_stats.bler*100;
sim_socket_manager.pucch_snr = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.pucch_snrx10/10;
sim_socket_manager.pusch_snr = RC.nrmac[module_idP]->UE_info.list[0]->UE_sched_ctrl.pusch_snrx10/10;
NR_mac_stats_t *stats = &RC.nrmac[module_idP]->UE_info.list[0]->mac_stats;
sim_socket_manager.rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
printf("[%d.%d] ul_sched_flag %x ulsch %d.%d acknack %d.%d csi_report %d.%d sr %d.%d srs %d.%d\n",
frame, slot, sim_socket_manager.ul_sched_flag,
sim_socket_manager.ulsch_frame, sim_socket_manager.ulsch_slot, sim_socket_manager.acknack_frame, sim_socket_manager.acknack_slot,
sim_socket_manager.csi_report_frame, sim_socket_manager.csi_report_slot, sim_socket_manager.sr_frame, sim_socket_manager.sr_slot,
sim_socket_manager.srs_frame, sim_socket_manager.srs_slot);
sem_post(&gnbSendToManager_sem);
}
} }
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "NR_MAC_gNB/nr_mac_gNB.h" #include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h" #include "NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "slotmap.h"
/*NFAPI*/ /*NFAPI*/
#include "nfapi_nr_interface.h" #include "nfapi_nr_interface.h"
...@@ -568,9 +569,24 @@ static bool allocate_dl_retransmission(module_id_t module_id, ...@@ -568,9 +569,24 @@ static bool allocate_dl_retransmission(module_id_t module_id,
/* retransmissions: directly allocate */ /* retransmissions: directly allocate */
*n_rb_sched -= sched_ctrl->sched_pdsch.rbSize; *n_rb_sched -= sched_ctrl->sched_pdsch.rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++){
rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols); uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols);
rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= slbitmap;
sim_socket_manager.vrb_map_socket[rb + sched_ctrl->sched_pdsch.rbStart] |= slbitmap;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",rb + sched_ctrl->sched_pdsch.rbStart, __FUNCTION__, __LINE__, slbitmap);
for (int symbol = slbitmap, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
return true; return true;
} }
...@@ -809,9 +825,24 @@ static void pf_dl(module_id_t module_id, ...@@ -809,9 +825,24 @@ static void pf_dl(module_id_t module_id,
/* transmissions: directly allocate */ /* transmissions: directly allocate */
n_rb_sched -= sched_pdsch->rbSize; n_rb_sched -= sched_pdsch->rbSize;
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap;
for (int rb = 0; rb < sched_pdsch->rbSize; rb++){
rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap;
sim_socket_manager.vrb_map_socket[rb + sched_pdsch->rbStart] |= slbitmap;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",rb + sched_pdsch->rbStart, __FUNCTION__, __LINE__, slbitmap);
for (int symbol = slbitmap, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
remainUEs--; remainUEs--;
iterator++; iterator++;
} }
...@@ -1204,7 +1235,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1204,7 +1235,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
sched_ctrl->coreset, sched_ctrl->coreset,
gNB_mac->cset0_bwp_size); gNB_mac->cset0_bwp_size);
LOG_D(NR_MAC, LOG_I(NR_MAC,
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", "coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
(unsigned long long)pdcch_pdu->FreqDomainResource, (unsigned long long)pdcch_pdu->FreqDomainResource,
pdcch_pdu->StartSymbolIndex, pdcch_pdu->StartSymbolIndex,
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#include "slotmap.h"
//#define SRS_DEBUG //#define SRS_DEBUG
...@@ -471,8 +472,23 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, ...@@ -471,8 +472,23 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE]; uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols); uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols);
for (int i = 0; i < srs_pdu->bwp_size; ++i) for (int i = 0; i < srs_pdu->bwp_size; ++i){
vrb_map_UL[i + srs_pdu->bwp_start] |= mask; vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
sim_socket_manager.vrb_map_ul_socket[sim_socket_manager.srs_slot*RB_TOTAL_MAP_SOCKET+ i + srs_pdu->bwp_start] |= mask;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",i + srs_pdu->bwp_start, __FUNCTION__, __LINE__, mask);
for (int symbol = mask, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
} }
static void nr_fill_nfapi_srs(int module_id, static void nr_fill_nfapi_srs(int module_id,
...@@ -581,11 +597,14 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) ...@@ -581,11 +597,14 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
// Check if UE will transmit the SRS in this frame // Check if UE will transmit the SRS in this frame
if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) { if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) {
LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot); LOG_I(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource); nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource);
sched_ctrl->sched_srs.frame = sched_frame; sched_ctrl->sched_srs.frame = sched_frame;
sched_ctrl->sched_srs.slot = sched_slot; sched_ctrl->sched_srs.slot = sched_slot;
sched_ctrl->sched_srs.srs_scheduled = true; sched_ctrl->sched_srs.srs_scheduled = true;
sim_socket_manager.srs_frame = sched_frame;
sim_socket_manager.srs_slot = sched_slot;
sim_socket_manager.ul_sched_flag |= 0x10;
} }
} }
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "common/ran_context.h" #include "common/ran_context.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "slotmap.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -238,7 +238,7 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -238,7 +238,7 @@ void nr_csi_meas_reporting(int Mod_idP,
continue; continue;
AssertFatal(is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[sched_slot / 64], sched_slot), "CSI reporting slot %d is not set for an uplink slot\n", sched_slot); AssertFatal(is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[sched_slot / 64], sched_slot), "CSI reporting slot %d is not set for an uplink slot\n", sched_slot);
LOG_D(NR_MAC, "CSI reporting in frame %d slot %d CSI report ID %ld\n", sched_frame, sched_slot, csirep->reportConfigId); LOG_I(NR_MAC, "CSI reporting in frame %d slot %d CSI report ID %ld\n", sched_frame, sched_slot, csirep->reportConfigId);
const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1
const int n = pucchresset->resourceList.list.count; const int n = pucchresset->resourceList.list.count;
...@@ -258,6 +258,9 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -258,6 +258,9 @@ void nr_csi_meas_reporting(int Mod_idP,
curr_pucch->r_pucch = -1; curr_pucch->r_pucch = -1;
curr_pucch->frame = sched_frame; curr_pucch->frame = sched_frame;
curr_pucch->ul_slot = sched_slot; curr_pucch->ul_slot = sched_slot;
sim_socket_manager.csi_report_frame = sched_frame;
sim_socket_manager.csi_report_slot = sched_slot;
sim_socket_manager.ul_sched_flag |= 0x04;
curr_pucch->resource_indicator = res_index; curr_pucch->resource_indicator = res_index;
curr_pucch->csi_bits += nr_get_csi_bitlen(UE->csi_report_template, csi_report_id); curr_pucch->csi_bits += nr_get_csi_bitlen(UE->csi_report_template, csi_report_id);
curr_pucch->active = true; curr_pucch->active = true;
...@@ -275,10 +278,13 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -275,10 +278,13 @@ void nr_csi_meas_reporting(int Mod_idP,
int start = pucchres->startingPRB; int start = pucchres->startingPRB;
int len = 1; int len = 1;
uint64_t mask = 0; uint64_t mask = 0;
uint64_t startSymbol, nrofSymbol;
switch(pucchres->format.present){ switch(pucchres->format.present){
case NR_PUCCH_Resource__format_PR_format2: case NR_PUCCH_Resource__format_PR_format2:
len = pucchres->format.choice.format2->nrofPRBs; len = pucchres->format.choice.format2->nrofPRBs;
mask = SL_to_bitmap(pucchres->format.choice.format2->startingSymbolIndex, pucchres->format.choice.format2->nrofSymbols); mask = SL_to_bitmap(pucchres->format.choice.format2->startingSymbolIndex, pucchres->format.choice.format2->nrofSymbols);
startSymbol = pucchres->format.choice.format2->startingSymbolIndex;
nrofSymbol = pucchres->format.choice.format2->nrofSymbols;
curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI; curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"%d.%d Allocating PUCCH format 2, startPRB %d, nPRB %d, simulHARQ %d, num_bits %d\n", "%d.%d Allocating PUCCH format 2, startPRB %d, nPRB %d, simulHARQ %d, num_bits %d\n",
...@@ -292,10 +298,14 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -292,10 +298,14 @@ void nr_csi_meas_reporting(int Mod_idP,
case NR_PUCCH_Resource__format_PR_format3: case NR_PUCCH_Resource__format_PR_format3:
len = pucchres->format.choice.format3->nrofPRBs; len = pucchres->format.choice.format3->nrofPRBs;
mask = SL_to_bitmap(pucchres->format.choice.format3->startingSymbolIndex, pucchres->format.choice.format3->nrofSymbols); mask = SL_to_bitmap(pucchres->format.choice.format3->startingSymbolIndex, pucchres->format.choice.format3->nrofSymbols);
startSymbol = pucchres->format.choice.format3->startingSymbolIndex;
nrofSymbol = pucchres->format.choice.format3->nrofSymbols;
curr_pucch->simultaneous_harqcsi = pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI; curr_pucch->simultaneous_harqcsi = pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI;
break; break;
case NR_PUCCH_Resource__format_PR_format4: case NR_PUCCH_Resource__format_PR_format4:
mask = SL_to_bitmap(pucchres->format.choice.format4->startingSymbolIndex, pucchres->format.choice.format4->nrofSymbols); mask = SL_to_bitmap(pucchres->format.choice.format4->startingSymbolIndex, pucchres->format.choice.format4->nrofSymbols);
startSymbol = pucchres->format.choice.format4->startingSymbolIndex;
nrofSymbol = pucchres->format.choice.format4->nrofSymbols;
curr_pucch->simultaneous_harqcsi = pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI; curr_pucch->simultaneous_harqcsi = pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI;
break; break;
default: default:
...@@ -312,8 +322,23 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -312,8 +322,23 @@ void nr_csi_meas_reporting(int Mod_idP,
sched_slot); sched_slot);
memset(curr_pucch, 0, sizeof(*curr_pucch)); memset(curr_pucch, 0, sizeof(*curr_pucch));
} }
else else{
vrb_map_UL[i+bwp_start] |= mask; vrb_map_UL[i+bwp_start] |= mask;
sim_socket_manager.vrb_map_ul_socket[sim_socket_manager.csi_report_slot*RB_TOTAL_MAP_SOCKET+ i + bwp_start] |= mask;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",i + bwp_start, __FUNCTION__, __LINE__, mask);
for (int symbol = mask, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
} }
} }
} }
...@@ -1140,8 +1165,9 @@ static bool test_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t * ...@@ -1140,8 +1165,9 @@ static bool test_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t *
return true; return true;
} }
static void set_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t *vrb_map_UL, const int bwp_start) static void set_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t *vrb_map_UL, const int bwp_start, int flag)
{ {
uint16_t slot = flag ? sim_socket_manager.acknack_slot : sim_socket_manager.sr_slot;
for (int l=0; l<pucch->nr_of_symb; l++) { for (int l=0; l<pucch->nr_of_symb; l++) {
uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1); uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1);
int prb; int prb;
...@@ -1150,6 +1176,20 @@ static void set_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t *v ...@@ -1150,6 +1176,20 @@ static void set_pucch0_vrb_occupation(const NR_sched_pucch_t *pucch, uint16_t *v
else else
prb = pucch->prb_start; prb = pucch->prb_start;
vrb_map_UL[bwp_start+prb] |= symb; vrb_map_UL[bwp_start+prb] |= symb;
sim_socket_manager.vrb_map_ul_socket[slot*RB_TOTAL_MAP_SOCKET+ prb + bwp_start] |= symb;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",prb + bwp_start, __FUNCTION__, __LINE__, symb);
for (int symbol = symb, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
} }
} }
...@@ -1302,12 +1342,15 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -1302,12 +1342,15 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
curr_pucch->dai_c++; curr_pucch->dai_c++;
curr_pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources curr_pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources
curr_pucch->r_pucch=r_pucch; curr_pucch->r_pucch=r_pucch;
sim_socket_manager.acknack_frame = pucch_frame;
sim_socket_manager.acknack_slot = pucch_slot;
sim_socket_manager.ul_sched_flag |= 0x02;
LOG_D(NR_MAC, "DL %4d.%2d, UL_ACK %4d.%2d Scheduling ACK/NACK in PUCCH %d with timing indicator %d DAI %d\n", LOG_I(NR_MAC, "DL %4d.%2d, UL_ACK %4d.%2d Scheduling ACK/NACK in PUCCH %d with timing indicator %d DAI %d\n",
frame, slot, curr_pucch->frame, curr_pucch->ul_slot, pucch_index, f, curr_pucch->dai_c); frame, slot, curr_pucch->frame, curr_pucch->ul_slot, pucch_index, f, curr_pucch->dai_c);
// blocking resources for current PUCCH in VRB map // blocking resources for current PUCCH in VRB map
set_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start); set_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start, 1);
return pucch_index; // index of current PUCCH structure return pucch_index; // index of current PUCCH structure
} }
...@@ -1346,7 +1389,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) ...@@ -1346,7 +1389,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
find_period_offset_SR(SchedulingRequestResourceConfig,&SR_period,&SR_offset); find_period_offset_SR(SchedulingRequestResourceConfig,&SR_period,&SR_offset);
// convert to int to avoid underflow of uint // convert to int to avoid underflow of uint
int sfn_sf = SFN * n_slots_frame + slot; int sfn_sf = SFN * n_slots_frame + slot;
LOG_D(NR_MAC,"SR_resource_id %d: SR_period %d, SR_offset %d\n",SR_resource_id,SR_period,SR_offset); LOG_I(NR_MAC,"SR_resource_id %d: SR_period %d, SR_offset %d\n",SR_resource_id,SR_period,SR_offset);
if ((sfn_sf - SR_offset) % SR_period != 0) if ((sfn_sf - SR_offset) % SR_period != 0)
continue; continue;
LOG_D(NR_MAC, "%4d.%2d Scheduling Request UE %04x identified\n", SFN, slot, UE->rnti); LOG_D(NR_MAC, "%4d.%2d Scheduling Request UE %04x identified\n", SFN, slot, UE->rnti);
...@@ -1397,7 +1440,10 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) ...@@ -1397,7 +1440,10 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
curr_pucch->resource_indicator = idx; curr_pucch->resource_indicator = idx;
curr_pucch->r_pucch = -1; curr_pucch->r_pucch = -1;
curr_pucch->active = true; curr_pucch->active = true;
set_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start); sim_socket_manager.sr_frame = curr_pucch->frame;
sim_socket_manager.sr_slot = curr_pucch->ul_slot;
sim_socket_manager.ul_sched_flag |= 0x08;
set_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start, 0);
} }
} }
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <openair2/UTIL/OPT/opt.h> #include <openair2/UTIL/OPT/opt.h>
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "slotmap.h"
//#define SRS_IND_DEBUG //#define SRS_IND_DEBUG
...@@ -1611,8 +1612,24 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1611,8 +1612,24 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
/* Mark the corresponding RBs as used */ /* Mark the corresponding RBs as used */
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++){
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols); uint16_t slbitmap = SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols);;
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap;
sim_socket_manager.vrb_map_ul_socket[sched_pusch->slot*RB_TOTAL_MAP_SOCKET+ rb + sched_ctrl->sched_pusch.rbStart] |= slbitmap;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",rb + sched_ctrl->sched_pusch.rbStart, __FUNCTION__, __LINE__, slbitmap);
for (int symbol = slbitmap, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
return true; return true;
} }
...@@ -1652,7 +1669,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1652,7 +1669,7 @@ static void pf_ul(module_id_t module_id,
if (UE->Msg4_ACKed != true || sched_ctrl->ul_failure) if (UE->Msg4_ACKed != true || sched_ctrl->ul_failure)
continue; continue;
LOG_D(NR_MAC,"pf_ul: preparing UL scheduling for UE %04x\n",UE->rnti); LOG_I(NR_MAC,"pf_ul: preparing UL scheduling for UE %04x\n",UE->rnti);
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP; NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
int rbStart = 0; // wrt BWP start int rbStart = 0; // wrt BWP start
...@@ -1671,7 +1688,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1671,7 +1688,7 @@ static void pf_ul(module_id_t module_id,
/* Check if retransmission is necessary */ /* Check if retransmission is necessary */
sched_pusch->ul_harq_pid = sched_ctrl->retrans_ul_harq.head; sched_pusch->ul_harq_pid = sched_ctrl->retrans_ul_harq.head;
LOG_D(NR_MAC,"pf_ul: UE %04x harq_pid %d\n",UE->rnti,sched_pusch->ul_harq_pid); LOG_I(NR_MAC,"pf_ul: UE %04x harq_pid %d\n",UE->rnti,sched_pusch->ul_harq_pid);
if (sched_pusch->ul_harq_pid >= 0) { if (sched_pusch->ul_harq_pid >= 0) {
/* Allocate retransmission*/ /* Allocate retransmission*/
const int tda = get_ul_tda(nrmac, scc, sched_pusch->frame, sched_pusch->slot); const int tda = get_ul_tda(nrmac, scc, sched_pusch->frame, sched_pusch->slot);
...@@ -1705,7 +1722,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1705,7 +1722,7 @@ static void pf_ul(module_id_t module_id,
/* preprocessor computed sched_frame/sched_slot */ /* preprocessor computed sched_frame/sched_slot */
const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity); const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity);
LOG_D(NR_MAC,"pf_ul: do_sched UE %04x => %s\n",UE->rnti,do_sched ? "yes" : "no"); LOG_I(NR_MAC,"pf_ul: do_sched UE %04x => %s B = %d rrc_processing_timer %d\n",UE->rnti,do_sched ? "yes" : "no", B, sched_ctrl->rrc_processing_timer);
if ((B == 0 && !do_sched) || (sched_ctrl->rrc_processing_timer > 0)) { if ((B == 0 && !do_sched) || (sched_ctrl->rrc_processing_timer > 0)) {
continue; continue;
} }
...@@ -1731,7 +1748,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1731,7 +1748,7 @@ static void pf_ul(module_id_t module_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(NR_MAC, "[UE %04x][%4d.%2d] no free CCE for UL DCI (BSR 0)\n", LOG_I(NR_MAC, "[UE %04x][%4d.%2d] no free CCE for UL DCI (BSR 0)\n",
UE->rnti, UE->rnti,
frame, frame,
slot); slot);
...@@ -1746,13 +1763,13 @@ static void pf_ul(module_id_t module_id, ...@@ -1746,13 +1763,13 @@ static void pf_ul(module_id_t module_id,
&sched_pusch->tda_info, &sched_pusch->tda_info,
sched_pusch->nrOfLayers); sched_pusch->nrOfLayers);
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d num_dmrs_cdm_grps_no_data %d\n", LOG_I(NR_MAC,"Looking for min_rb %d RBs, starting at %d num_dmrs_cdm_grps_no_data %d\n",
min_rb, rbStart, sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data); min_rb, rbStart, sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data);
const uint16_t slbitmap = SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols);
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
if (rbStart + min_rb >= bwpSize) { if (rbStart + min_rb >= bwpSize) {
LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not allocate continuous UL data: no resources (rbStart %d, min_rb %d, bwpSize %d)\n", LOG_I(NR_MAC, "[UE %04x][%4d.%2d] could not allocate continuous UL data: no resources (rbStart %d, min_rb %d, bwpSize %d)\n",
UE->rnti, UE->rnti,
frame, frame,
slot, slot,
...@@ -1785,8 +1802,27 @@ static void pf_ul(module_id_t module_id, ...@@ -1785,8 +1802,27 @@ static void pf_ul(module_id_t module_id,
/* Mark the corresponding RBs as used */ /* Mark the corresponding RBs as used */
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++){
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap; rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap;
// for (int symbol = sched_pusch->tda_info.startSymbolIndex; symbol < sched_pusch->tda_info.nrOfSymbols + sched_pusch->tda_info.startSymbolIndex; symbol++){
// sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol] = 1;
// }
sim_socket_manager.vrb_map_ul_socket[sched_pusch->slot*RB_TOTAL_MAP_SOCKET+ rb + sched_ctrl->sched_pusch.rbStart] |= slbitmap;
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d [%s %d] slbitmap %d\n",rb + sched_ctrl->sched_pusch.rbStart, __FUNCTION__, __LINE__, slbitmap);
for (int symbol = slbitmap, i = 0; i < SYMBOL_PER_SLOT_MAP_SOCKET; i++, symbol = symbol>>1){
if (symbol&1){
printf("1 ");
}
else{
printf("0 ");
}
// printf("%d ",sim_socket_manager.vrb_map_ul_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
}
remainUEs--; remainUEs--;
continue; continue;
...@@ -1796,7 +1832,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1796,7 +1832,7 @@ static void pf_ul(module_id_t module_id,
/* Calculate coefficient*/ /* Calculate coefficient*/
const uint32_t tbs = ul_pf_tbs[current_BWP->mcs_table][sched_pusch->mcs]; const uint32_t tbs = ul_pf_tbs[current_BWP->mcs_table][sched_pusch->mcs];
float coeff_ue = (float) tbs / UE->ul_thr_ue; float coeff_ue = (float) tbs / UE->ul_thr_ue;
LOG_D(NR_MAC, "[UE %04x][%4d.%2d] b %d, ul_thr_ue %f, tbs %d, coeff_ue %f\n", LOG_I(NR_MAC, "[UE %04x][%4d.%2d] b %d, ul_thr_ue %f, tbs %d, coeff_ue %f\n",
UE->rnti, UE->rnti,
frame, frame,
slot, slot,
...@@ -1896,7 +1932,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1896,7 +1932,7 @@ static void pf_ul(module_id_t module_id,
sched_pusch->rbSize = rbSize; sched_pusch->rbSize = rbSize;
sched_pusch->tb_size = TBS; sched_pusch->tb_size = TBS;
LOG_D(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", LOG_I(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B, rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,
sched_ctrl->cce_index,sched_pusch->dmrs_info.num_dmrs_symb,sched_pusch->dmrs_info.N_PRB_DMRS); sched_ctrl->cce_index,sched_pusch->dmrs_info.num_dmrs_symb,sched_pusch->dmrs_info.N_PRB_DMRS);
...@@ -1910,9 +1946,21 @@ static void pf_ul(module_id_t module_id, ...@@ -1910,9 +1946,21 @@ static void pf_ul(module_id_t module_id,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level);
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++){
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap; rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap;
#if 0
for (int symbol = sched_pusch->tda_info.startSymbolIndex; symbol < sched_pusch->tda_info.nrOfSymbols + sched_pusch->tda_info.startSymbolIndex; symbol++){
sim_socket_manager.vrb_map_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol] = 1;
}
#ifdef VRB_MAP_TEST_MANAGER
printf("RB:%d %s %d\n",rb + sched_ctrl->sched_pusch.rbStart, __FUNCTION__, __LINE__);
for (int symbol = 0; symbol < SYMBOL_PER_SLOT_MAP_SOCKET; symbol++){
printf("%d ",sim_socket_manager.vrb_map_socket[(rb + sched_ctrl->sched_pusch.rbStart)*SYMBOL_PER_SLOT_MAP_SOCKET+symbol]);
}
printf("\n");
#endif
#endif
}
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
remainUEs--; remainUEs--;
iterator++; iterator++;
...@@ -1995,7 +2043,7 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -1995,7 +2043,7 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_
} }
st = e - len + 1; st = e - len + 1;
LOG_D(NR_MAC,"UL %d.%d : start_prb %d, end PRB %d\n",frame,slot,st,e); LOG_I(NR_MAC,"UL %d.%d : start_prb %d, end PRB %d\n",frame,slot,st,e);
uint16_t rballoc_mask[bwpSize]; uint16_t rballoc_mask[bwpSize];
...@@ -2155,8 +2203,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n ...@@ -2155,8 +2203,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
UE->mac_stats.ul.current_rbs = sched_pusch->rbSize; UE->mac_stats.ul.current_rbs = sched_pusch->rbSize;
sched_ctrl->last_ul_frame = sched_pusch->frame; sched_ctrl->last_ul_frame = sched_pusch->frame;
sched_ctrl->last_ul_slot = sched_pusch->slot; sched_ctrl->last_ul_slot = sched_pusch->slot;
sim_socket_manager.ulsch_frame = sched_pusch->frame;
sim_socket_manager.ulsch_slot = sched_pusch->slot;
sim_socket_manager.ul_sched_flag |= 0x01;
LOG_D(NR_MAC, LOG_I(NR_MAC,
"ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS Table %2d MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS Table %2d MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n",
frame, frame,
slot, slot,
...@@ -2397,7 +2448,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n ...@@ -2397,7 +2448,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
ss, ss,
coreset, coreset,
nr_mac->cset0_bwp_size); nr_mac->cset0_bwp_size);
LOG_I(NR_MAC,
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
(unsigned long long)pdcch_pdu->FreqDomainResource,
pdcch_pdu->StartSymbolIndex,
pdcch_pdu->DurationSymbols);
memset(sched_pusch, 0, sizeof(*sched_pusch)); memset(sched_pusch, 0, sizeof(*sched_pusch));
} }
} }
#ifndef __SLOTMAP_H__
#define __SLOTMAP_H__
#define RB_TOTAL_MAP_SOCKET 275
#define RE_PER_RB_MAP_SOCKET 12
#define SYMBOL_PER_SLOT_MAP_SOCKET 14
#define SLOT_PER_SUBFRAME_MAP_SOCKET 2
#define SUBFRAME_PER_FRAME_MAP_SOCKET 10
#define SLOT_PER_FRAME_MAP_SOCKET (SUBFRAME_PER_FRAME_MAP_SOCKET * SLOT_PER_SUBFRAME_MAP_SOCKET)
#define SLOT_UPLINK_MANAGER 3
#define SLOT_DOWNLINK_MANAGER 7
#define MAX_UE_NUMBER_MAP_SOCKET 1
#define VRB_MAP_TEST_MANAGER
typedef struct {
uint16_t data_len;
uint16_t UE_id;
uint16_t frame;
uint16_t slot;
/*LSB -> MSB : ulsch || acknack || csi-report || sr || srs*/
uint8_t ul_sched_flag;
uint16_t csi_report_frame;
uint16_t sr_frame;
uint16_t srs_frame;
uint16_t acknack_frame;
uint16_t ulsch_frame;
uint16_t csi_report_slot;
uint16_t sr_slot;
uint16_t srs_slot;
uint16_t acknack_slot;
uint16_t ulsch_slot;
uint16_t dl_velocity;
uint16_t ul_velocity;
uint16_t dl_mcs;
uint16_t ul_mcs;
uint16_t dl_bler;
uint16_t ul_bler;
int16_t pucch_snr;
int16_t pusch_snr;
int16_t rsrp;
uint16_t vrb_map_socket[RB_TOTAL_MAP_SOCKET];
uint16_t vrb_map_ul_socket[SLOT_PER_FRAME_MAP_SOCKET*RB_TOTAL_MAP_SOCKET];
}sim_socket_t;
extern sim_socket_t sim_socket_manager;
// extern uint16_t vrb_map_socket[MAX_UE_NUMBER_MAP_SOCKET][SLOT_PER_FRAME_MAP_SOCKET][RB_TOTAL_MAP_SOCKET];
#endif
\ No newline at end of file
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