Merge branch 'episys/andrew/debugging_rach+fixing_rx_unpack' into 'episys/master'
Episys/andrew/debugging rach+fixing rx unpack See merge request aburger/openairinterface5g!4
This commit is contained in:
@@ -710,13 +710,9 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool is_ue_same(int ue_id_1, int ue_id_2)
|
||||
static bool is_ue_same(uint16_t ue_id_1, uint16_t ue_id_2)
|
||||
{
|
||||
if (ue_id_1 == ue_id_2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (ue_id_1 == ue_id_2);
|
||||
}
|
||||
|
||||
static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
|
||||
@@ -731,8 +727,8 @@ static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
|
||||
|
||||
for (int j = i + 1; j < num_cqis; j++)
|
||||
{
|
||||
int rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti;
|
||||
int rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti;
|
||||
uint16_t rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti;
|
||||
uint16_t rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti;
|
||||
if (is_ue_same(rnti_i, rnti_j))
|
||||
{
|
||||
LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n",
|
||||
@@ -1253,6 +1249,25 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_config_req)
|
||||
{
|
||||
int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
|
||||
nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list;
|
||||
|
||||
if (index >= num_pdus || index < 0)
|
||||
{
|
||||
LOG_E(MAC, "%s() Unable to drop bad ul_config_req PDU\n", __FUNCTION__);
|
||||
abort();
|
||||
}
|
||||
|
||||
for(int i = index; i + 1 < num_pdus; i++)
|
||||
{
|
||||
pdu_list[i] = pdu_list[i + 1];
|
||||
}
|
||||
|
||||
ul_config_req->ul_config_request_body.number_of_pdus--;
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
@@ -1261,35 +1276,45 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
LOG_D(PHY, "[VNF] %s() UL_CONFIG Frame: %d Subframe: %d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
|
||||
__FUNCTION__, NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus,
|
||||
ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
|
||||
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
|
||||
|
||||
uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
|
||||
int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
|
||||
nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list;
|
||||
for (int i = 0; i < num_pdus; i++)
|
||||
{
|
||||
uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type;
|
||||
if (pdu_type != 1)
|
||||
uint8_t pdu_type = pdu_list[i].pdu_type;
|
||||
if (pdu_type != NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u\n",
|
||||
num_pdus, i, pdu_type);
|
||||
|
||||
LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n",
|
||||
num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15);
|
||||
|
||||
for (int j = i + 1; j < num_pdus; j++)
|
||||
{
|
||||
uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type;
|
||||
if (pdu_type == pdu_type2)
|
||||
uint8_t pdu_type2 = pdu_list[j].pdu_type;
|
||||
if (pdu_type != pdu_type2)
|
||||
{
|
||||
uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
|
||||
uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
|
||||
if (is_ue_same(rnti_i, rnti_j))
|
||||
{
|
||||
LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x\n",
|
||||
rnti_i);
|
||||
abort();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t rnti_i = pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
|
||||
uint16_t rnti_j = pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
|
||||
if (!is_ue_same(rnti_i, rnti_j))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
remove_ul_config_req_pdu(j, ul_config_req);
|
||||
j--;
|
||||
num_pdus--;
|
||||
|
||||
LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n",
|
||||
rnti_i);
|
||||
}
|
||||
}
|
||||
|
||||
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
|
||||
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,31 @@
|
||||
#include <nfapi.h>
|
||||
#include <debug.h>
|
||||
|
||||
static const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
|
||||
{
|
||||
char *p = out;
|
||||
char *endp = out + out_len;
|
||||
const uint8_t *q = data;
|
||||
snprintf(p, endp - p, "[%zu]", data_len);
|
||||
p += strlen(p);
|
||||
for (size_t i = 0; i < data_len; ++i)
|
||||
{
|
||||
if (p >= endp)
|
||||
{
|
||||
static const char ellipses[] = "...";
|
||||
char *s = endp - sizeof(ellipses);
|
||||
if (s >= p)
|
||||
{
|
||||
strcpy(s, ellipses);
|
||||
}
|
||||
break;
|
||||
}
|
||||
snprintf(p, endp - p, " %02X", *q++);
|
||||
p += strlen(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
|
||||
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
|
||||
|
||||
@@ -4931,35 +4956,35 @@ static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPacked
|
||||
return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
|
||||
}
|
||||
|
||||
static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
|
||||
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv;
|
||||
|
||||
// the rxBodyEnd points to the end of the cqi PDU's
|
||||
uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
||||
uint8_t* rxPduEnd = rxBodyEnd;
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
|
||||
value->tl.length);
|
||||
uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
||||
|
||||
uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
|
||||
|
||||
if(rxBodyEnd > end)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
|
||||
rxBodyEnd, end);
|
||||
if (rxBodyEnd > end)
|
||||
{
|
||||
// pdu end is past buffer end
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
||||
if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
||||
return 0;
|
||||
|
||||
if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
|
||||
if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(value->number_of_pdus > 0)
|
||||
if (value->number_of_pdus > 0)
|
||||
{
|
||||
value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
|
||||
if(value->rx_pdu_list == NULL)
|
||||
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
|
||||
if (value->rx_pdu_list == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
|
||||
return 0;
|
||||
@@ -4969,87 +4994,97 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked
|
||||
{
|
||||
value->rx_pdu_list = 0;
|
||||
}
|
||||
|
||||
uint8_t i = 0;
|
||||
nfapi_rx_indication_pdu_t* pdu = 0;
|
||||
while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
|
||||
{
|
||||
nfapi_tl_t generic_tl;
|
||||
if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
return 0;
|
||||
|
||||
switch(generic_tl.tag)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
|
||||
for (int i = 0; i < value->number_of_pdus; i++)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s i = %u\n", __FUNCTION__, i);
|
||||
nfapi_tl_t generic_tl;
|
||||
|
||||
// NFAPI_RX_UE_INFORMATION_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
case NFAPI_RX_UE_INFORMATION_TAG:
|
||||
{
|
||||
pdu = &(value->rx_pdu_list[i++]);
|
||||
pdu->rx_ue_information.tl = generic_tl;
|
||||
if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case NFAPI_RX_INDICATION_REL8_TAG:
|
||||
{
|
||||
if(pdu != 0)
|
||||
{
|
||||
pdu->rx_indication_rel8.tl = generic_tl;
|
||||
if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
|
||||
if(pdu->rx_indication_rel8.offset > 0)
|
||||
{
|
||||
// Need to check that the data is within the tlv
|
||||
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
|
||||
{
|
||||
// If this the first pdu set the rxPduEnd
|
||||
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
|
||||
{
|
||||
rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
|
||||
|
||||
if(rxPduEnd > end)
|
||||
{
|
||||
// pdu end is past buffer end
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NFAPI_RX_INDICATION_REL9_TAG:
|
||||
{
|
||||
if(pdu != 0)
|
||||
{
|
||||
pdu->rx_indication_rel9.tl = generic_tl;
|
||||
if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
|
||||
}
|
||||
break;
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
||||
|
||||
pdu->rx_ue_information.tl = generic_tl;
|
||||
if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NFAPI_RX_INDICATION_REL8_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
pdu->rx_indication_rel8.tl = generic_tl;
|
||||
if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
//What is offset not stripping 10 bytes
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
|
||||
pdu->rx_indication_rel8.offset);
|
||||
|
||||
// NFAPI_RX_INDICATION_REL9_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
pdu->rx_indication_rel9.tl = generic_tl;
|
||||
if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t idx = 0;
|
||||
for(idx = 0; idx < value->number_of_pdus; ++idx)
|
||||
|
||||
for (int i = 0; i < value->number_of_pdus; ++i)
|
||||
{
|
||||
if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
|
||||
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
||||
if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
|
||||
{
|
||||
uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
|
||||
value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
|
||||
if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
|
||||
uint32_t length = pdu->rx_indication_rel8.length;
|
||||
value->rx_pdu_list[i].data = nfapi_p7_allocate(length, config);
|
||||
|
||||
if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6319,7 +6354,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
if(result == 0)
|
||||
return -1;
|
||||
else
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1269,6 +1269,7 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
if (vnf_p7 && vnf_p7->p7_connections)
|
||||
{
|
||||
int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
|
||||
printf("vnf_pnf_sfnsf_delta = %d adjusting now\n", vnf_pnf_sfnsf_delta); fflush(stdout);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
|
||||
|
||||
|
||||
@@ -84,8 +84,9 @@
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
#else
|
||||
#define MAX_MOBILES_PER_ENB 4
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 4
|
||||
// TODO: Change after gaining stability on 20 UES or less
|
||||
#define MAX_MOBILES_PER_ENB 20
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 20
|
||||
#define MAX_MOBILES_PER_GNB 2//16
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
|
||||
@@ -571,16 +571,30 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
UE_sched_ctrl_t *UE_scheduling_control = NULL;
|
||||
start_meas(&(eNB->eNB_scheduler));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_IN);
|
||||
|
||||
if ((frameP == eNB->frame && subframeP <= eNB->subframe) || (frameP == ((eNB->frame + 1023) & 1023)))
|
||||
// TODO: Better solution needed this is the first
|
||||
// 3 indications of this function on startup
|
||||
// 1303275.278188 [MAC] XXX 0.0 -> 0.4 = 4
|
||||
// 1303275.279443 [MAC] XXX 0.4 -> 639.5 = 6391
|
||||
// 1303275.348686 [MAC] XXX 646.3 -> 646.3 = 0
|
||||
int delta = (frameP * 10 + subframeP) - (eNB->frame * 10 + eNB->subframe);
|
||||
if (delta < 0)
|
||||
{
|
||||
LOG_E(MAC, "Scheduler being called twice for same subframe SF.SFN: %u.%u\n", frameP, subframeP);
|
||||
delta += 10240; // sfn_sf decimal values range from 0 to 10239
|
||||
}
|
||||
// If we ever see a difference this big something is very wrong
|
||||
// This threshold is arbitrary
|
||||
if (delta > 8500 || delta == 0) // 850 frames
|
||||
{
|
||||
LOG_I(MAC, "scheduler ignoring outerspace %d.%d -> %d.%d = %d\n",
|
||||
eNB->frame, eNB->subframe, frameP, subframeP, delta);
|
||||
return;
|
||||
}
|
||||
LOG_I(MAC, "Entering dlsch_ulsch scheduler %d.%d -> %d.%d = %d\n",
|
||||
eNB->frame, eNB->subframe, frameP, subframeP, delta);
|
||||
|
||||
eNB->frame = frameP;
|
||||
eNB->subframe = subframeP;
|
||||
|
||||
LOG_I(MAC, "Entering dlsch_ulsch scheduler Frame: %u Subframe: %u\n", frameP, subframeP);
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
mbsfn_status[CC_id] = 0;
|
||||
/* Clear vrb_maps */
|
||||
|
||||
@@ -67,6 +67,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
|
||||
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
|
||||
rarh->RAPID);
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
UE_mac_inst[module_idP].UE_mode[0] = RA_RESPONSE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -77,9 +78,10 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
|
||||
}
|
||||
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY,
|
||||
LOG_I(MAC,
|
||||
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
|
||||
best_rx_rapid);
|
||||
UE_mac_inst[module_idP].UE_mode[0] = PRACH;
|
||||
break;
|
||||
} else {
|
||||
rarh++;
|
||||
|
||||
@@ -95,9 +95,10 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,
|
||||
pdu->rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
|
||||
pdu->rx_indication_rel9.timing_advance_r9 = 0;
|
||||
|
||||
// ulsch_buffer is necessary to keep its value.
|
||||
pdu->data = malloc(buflen);
|
||||
memcpy(pdu->data, ulsch_buffer, buflen);
|
||||
LOG_I(MAC, "buflen of rx_ind pdu_data = %u SFN.SF: %d.%d\n", buflen,
|
||||
frame, subframe);
|
||||
// estimate timing advance for MAC
|
||||
timing_advance_update = 0; // Don't know what to put here
|
||||
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
|
||||
@@ -832,7 +833,8 @@ void dl_config_req_UE_MAC_dci(int sfn,
|
||||
&UE_mac_inst[ue_id].crnti, //t-crnti
|
||||
UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex,
|
||||
tx_request_pdu_list[pdu_index].segments[0].segment_data);
|
||||
UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE;
|
||||
// UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE;
|
||||
LOG_I(MAC, "setting UE_MODE now: %d\n", UE_mac_inst[ue_id].UE_mode[0]);
|
||||
// Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first
|
||||
// ULSCH Txon for the UE)
|
||||
UE_mac_inst[ue_id].first_ULSCH_Tx = 1;
|
||||
@@ -920,7 +922,7 @@ void hi_dci0_req_UE_MAC(int sfn,
|
||||
|
||||
// The following set of memcpy functions should be getting called as callback
|
||||
// functions from pnf_p7_subframe_ind.
|
||||
int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
|
||||
int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
|
||||
nfapi_pnf_p7_config_t *pnf_p7,
|
||||
nfapi_dl_config_request_t *req) {
|
||||
|
||||
@@ -1299,10 +1301,46 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
|
||||
return out;
|
||||
}
|
||||
|
||||
static void print_rx_ind(nfapi_rx_indication_t *p)
|
||||
{
|
||||
printf("Printing RX_IND fields\n");
|
||||
printf("header.message_id: %u\n", p->header.message_id);
|
||||
printf("header.phy_id: %u\n", p->header.phy_id);
|
||||
printf("header.message_id: %u\n", p->header.message_id);
|
||||
printf("header.m_segment_sequence: %u\n", p->header.m_segment_sequence);
|
||||
printf("header.checksum: %u\n", p->header.checksum);
|
||||
printf("header.transmit_timestamp: %u\n", p->header.transmit_timestamp);
|
||||
printf("sfn_sf: %u\n", p->sfn_sf);
|
||||
printf("rx_indication_body.tl.tag: 0x%x\n", p->rx_indication_body.tl.tag);
|
||||
printf("rx_indication_body.tl.length: %u\n", p->rx_indication_body.tl.length);
|
||||
printf("rx_indication_body.number_of_pdus: %u\n", p->rx_indication_body.number_of_pdus);
|
||||
|
||||
nfapi_rx_indication_pdu_t *pdu = p->rx_indication_body.rx_pdu_list;
|
||||
for (int i = 0; i < p->rx_indication_body.number_of_pdus; i++)
|
||||
{
|
||||
printf("pdu %d nfapi_rx_ue_information.tl.tag: 0x%x\n", i, pdu->rx_ue_information.tl.tag);
|
||||
printf("pdu %d nfapi_rx_ue_information.tl.length: %u\n", i, pdu->rx_ue_information.tl.length);
|
||||
printf("pdu %d nfapi_rx_ue_information.handle: %u\n", i, pdu->rx_ue_information.handle);
|
||||
printf("pdu %d nfapi_rx_ue_information.rnti: %u\n", i, pdu->rx_ue_information.rnti);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.tl.tag: 0x%x\n", i, pdu->rx_indication_rel8.tl.tag);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.tl.length: %u\n", i, pdu->rx_indication_rel8.tl.length);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.length: %u\n", i, pdu->rx_indication_rel8.length);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.offset: %u\n", i, pdu->rx_indication_rel8.offset);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.ul_cqi: %u\n", i, pdu->rx_indication_rel8.ul_cqi);
|
||||
printf("pdu %d nfapi_rx_indication_rel8.timing_advance: %u\n", i, pdu->rx_indication_rel8.timing_advance);
|
||||
printf("pdu %d nfapi_rx_indication_rel9.tl.tag: 0x%x\n", i, pdu->rx_indication_rel9.tl.tag);
|
||||
printf("pdu %d nfapi_rx_indication_rel9.tl.length: %u\n", i, pdu->rx_indication_rel9.tl.length);
|
||||
printf("pdu %d nfapi_rx_indication_rel9.timing_advance_r9: %u\n", i, pdu->rx_indication_rel9.timing_advance_r9);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type)
|
||||
{
|
||||
int encoded_size = -1;
|
||||
char buffer[1024];
|
||||
|
||||
switch (msg_type)
|
||||
{
|
||||
case NFAPI_RACH_INDICATION:
|
||||
@@ -1323,7 +1361,7 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
|
||||
UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus);
|
||||
break;
|
||||
case NFAPI_RX_CQI_INDICATION:
|
||||
encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1
|
||||
encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL);
|
||||
LOG_I(MAC, "CQI_IND sent to Proxy, Size: %d num_cqis: %u\n", encoded_size,
|
||||
UL->cqi_ind.cqi_indication_body.number_of_cqis);
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef OPENAIRINTERFACE5G_LIMITS_H_
|
||||
#define OPENAIRINTERFACE5G_LIMITS_H_
|
||||
|
||||
#include "platform_constants.h"
|
||||
|
||||
#if 1 /*defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)*/
|
||||
# define NUMBER_OF_eNB_MAX 1
|
||||
# define NUMBER_OF_gNB_MAX 1
|
||||
@@ -14,7 +16,7 @@
|
||||
// now , if we use --mu option in UE, compiling error will occur.
|
||||
// This problem will be fixed in the future.
|
||||
# ifndef UESIM_EXPANSION
|
||||
# define NUMBER_OF_UE_MAX 4
|
||||
# define NUMBER_OF_UE_MAX 20
|
||||
# define NUMBER_OF_NR_UE_MAX 4
|
||||
# define NUMBER_OF_UCI_VARS_MAX 14
|
||||
# define NUMBER_OF_CONNECTED_eNB_MAX 1
|
||||
@@ -107,4 +109,12 @@ and the other are using MAX_MOBILES_PER_ENB in for-loop.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if MAX_MOBILES_PER_ENB != NUMBER_OF_UE_MAX
|
||||
#error "Invalid configuration of UE's"
|
||||
#endif
|
||||
|
||||
#if MAX_MOBILES_PER_ENB_NB_IoT != NUMBER_OF_UE_MAX
|
||||
#error "Invalid configuration of UE's"
|
||||
#endif
|
||||
|
||||
#endif /* OPENAIRINTERFACE5G_LIMITS_H_ */
|
||||
|
||||
+41
-21
@@ -1030,6 +1030,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
|
||||
|
||||
int num_pairs = 0;
|
||||
int num_lone = 0;
|
||||
int last_sfn_sf = -1;
|
||||
|
||||
while (!oai_exit) {
|
||||
bool sent_any = false;
|
||||
@@ -1037,7 +1038,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
|
||||
LOG_E(MAC, "sem_wait() error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
int sfn_sf = current_sfn_sf;
|
||||
if (sfn_sf == last_sfn_sf)
|
||||
{
|
||||
LOG_W(MAC, "repeated sfn_sf = %d.%d\n",
|
||||
sfn_sf >> 4, sfn_sf & 15);
|
||||
continue;
|
||||
}
|
||||
last_sfn_sf = sfn_sf;
|
||||
|
||||
nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue);
|
||||
nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue);
|
||||
@@ -1163,33 +1172,44 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
|
||||
// Prepare the future Tx data
|
||||
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
|
||||
(UE->frame_parms.frame_type == FDD))
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (UE->mode != loop_through_memory)
|
||||
{
|
||||
// We make the start of RA between consecutive UEs differ by 20 frames
|
||||
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
|
||||
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
|
||||
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE &&
|
||||
is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)))
|
||||
{
|
||||
UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH;
|
||||
}
|
||||
LOG_I(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]);
|
||||
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH)
|
||||
{ //&& ue_Mod_id == next_Mod_id) {
|
||||
next_ra_frame++;
|
||||
if (next_ra_frame > 500) {
|
||||
// check if we have PRACH opportunity
|
||||
if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
|
||||
// The one working strangely...
|
||||
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
|
||||
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
|
||||
if (prach_resources != NULL) {
|
||||
UE_mac_inst[ue_Mod_id].ra_frame = rx_frame;
|
||||
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
|
||||
fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
|
||||
sent_any = true;
|
||||
Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
|
||||
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
|
||||
next_Mod_id = ue_Mod_id + 1;
|
||||
//next_ra_frame = (rx_frame + 20)%1000;
|
||||
next_ra_frame = 0;
|
||||
}
|
||||
|
||||
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
|
||||
// check if we have PRACH opportunity
|
||||
if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1)
|
||||
{
|
||||
// The one working strangely...
|
||||
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
|
||||
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
|
||||
if (prach_resources != NULL)
|
||||
{
|
||||
LOG_I(MAC, "preamble_received_tar_power: %d\n",
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
|
||||
UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew
|
||||
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
|
||||
fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
|
||||
sent_any = true;
|
||||
Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
|
||||
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
|
||||
next_Mod_id = ue_Mod_id + 1;
|
||||
//next_ra_frame = (rx_frame + 20)%1000;
|
||||
next_ra_frame = 0;
|
||||
}
|
||||
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
|
||||
}
|
||||
} // mode is PRACH
|
||||
}
|
||||
} // mode is PRACH
|
||||
|
||||
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
|
||||
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
|
||||
|
||||
Reference in New Issue
Block a user