Commit 6bfe76b0 authored by Raymond Knopp's avatar Raymond Knopp

MAC pdu fixes, testing RX patch of rlc/pdcp/sdap

parent e568b2c8
...@@ -121,7 +121,7 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -121,7 +121,7 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE)
uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18; //2(QPSK)*9(per RB)*6(REG per CCE) uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18; //2(QPSK)*9(per RB)*6(REG per CCE)
if (dci_pdu->RNTI != 0xFFFF) if (dci_pdu->RNTI != 0xFFFF)
LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d, reg_mapping %d), Scrambling_Id %d, ScramblingRNTI %x, PayloadSizeBits %d\n", LOG_I(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d, reg_mapping %d), Scrambling_Id %d, ScramblingRNTI %x, PayloadSizeBits %d\n",
rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType, rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType,
dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits); dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits);
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
...@@ -250,7 +250,7 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -250,7 +250,7 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
} // reg_count } // reg_count
} // symbol_idx } // symbol_idx
LOG_D(PHY, LOG_I(NR_PHY,
"DCI: payloadSize = %d | payload = %llx\n", "DCI: payloadSize = %d | payload = %llx\n",
dci_pdu->PayloadSizeBits, dci_pdu->PayloadSizeBits,
*(unsigned long long *)dci_pdu->Payload); *(unsigned long long *)dci_pdu->Payload);
......
...@@ -597,17 +597,17 @@ void nr_ue_process_mac_sl_pdu(int module_idP, ...@@ -597,17 +597,17 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_I(NR_MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); LOG_I(NR_MAC, "[UE %x] LCID %d, PDU length %d\n", mac->src_id,rx_lcid, pdu_len);
bool ret; bool ret;
switch(rx_lcid){ switch(rx_lcid){
// MAC CE // MAC CE
case SL_SCH_LCID_4_19: case SL_SCH_LCID_4_19:
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
return; return;
LOG_D(NR_MAC, "%4d.%2d : SLSCH -> LCID %d %d bytes\n", frame, slot, rx_lcid, mac_len); LOG_I(NR_MAC, "%4d.%2d : SLSCH -> LCID %d %d bytes\n", frame, slot, rx_lcid, mac_len);
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
0, mac->src_id,
0, 0,
frame, frame,
ENB_FLAG_NO, ENB_FLAG_NO,
...@@ -637,5 +637,9 @@ void nr_ue_process_mac_sl_pdu(int module_idP, ...@@ -637,5 +637,9 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
LOG_W(NR_MAC,"Received unsupported SL LCID %d\n",rx_lcid); LOG_W(NR_MAC,"Received unsupported SL LCID %d\n",rx_lcid);
break; break;
} }
pduP += ( mac_subheader_len + mac_len );
pdu_len -= ( mac_subheader_len + mac_len );
if (pdu_len < 0)
LOG_E(NR_MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu_sl, residual mac pdu length %d < 0!\n", module_idP, frame, slot, pdu_len);
} }
} }
...@@ -3320,7 +3320,7 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac, ...@@ -3320,7 +3320,7 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
start_meas(&mac->rlc_data_req); start_meas(&mac->rlc_data_req);
sdu_length = mac_rlc_data_req(0, sdu_length = mac_rlc_data_req(0,
0, mac->src_id,
0, 0,
frame, frame,
ENB_FLAG_NO, ENB_FLAG_NO,
......
...@@ -210,6 +210,8 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -210,6 +210,8 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
int sci_size = nr_sl_pssch_pscch_pdu->pscch_sci_payload_len; int sci_size = nr_sl_pssch_pscch_pdu->pscch_sci_payload_len;
int sci2_size = nr_sl_pssch_pscch_pdu->sci2_payload_len; int sci2_size = nr_sl_pssch_pscch_pdu->sci2_payload_len;
*sci_payload = 0;
*sci2_payload = 0;
// freq domain allocation starts // freq domain allocation starts
nr_sl_pssch_pscch_pdu->startrb=*sl_res_pool->sl_StartRB_Subchannel_r16; nr_sl_pssch_pscch_pdu->startrb=*sl_res_pool->sl_StartRB_Subchannel_r16;
...@@ -280,7 +282,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -280,7 +282,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
*sci_payload |= (((uint64_t)sci_pdu->resource_reservation_period.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1); *sci_payload |= (((uint64_t)sci_pdu->resource_reservation_period.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// DMRS pattern // DMRS pattern
fsize = sci_pdu->dmrs_pattern.nbits; fsize = sci_pdu->dmrs_pattern.nbits;
LOG_D(NR_MAC,"SCI1A: dmrs_pattern (%d,%d) in position %d\n",sci_pdu->dmrs_pattern.val,fsize,pos); LOG_I(NR_MAC,"SCI1A: dmrs_pattern (%d,%d) in position %d\n",sci_pdu->dmrs_pattern.val,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->dmrs_pattern.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1); *sci_payload |= (((uint64_t)sci_pdu->dmrs_pattern.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// second_stage_sci_format // 2 bits - Table 8.3.1.1-1 // second_stage_sci_format // 2 bits - Table 8.3.1.1-1
...@@ -323,6 +325,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -323,6 +325,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
AssertFatal(1==0,"Unknown format1 %d\n",format1); AssertFatal(1==0,"Unknown format1 %d\n",format1);
break; break;
} }
LOG_D(NR_MAC,"SCI1 payload : %x\n",*sci_payload);
int mcs_tb_ind = 0; int mcs_tb_ind = 0;
if (sci_pdu->additional_mcs.nbits > 0) if (sci_pdu->additional_mcs.nbits > 0)
...@@ -352,7 +355,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -352,7 +355,7 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
N_RE,1+(sci_pdu->number_of_dmrs_port&1))>>3; N_RE,1+(sci_pdu->number_of_dmrs_port&1))>>3;
nr_sl_pssch_pscch_pdu->mcs = sci_pdu->mcs; nr_sl_pssch_pscch_pdu->mcs = sci_pdu->mcs;
nr_sl_pssch_pscch_pdu->num_layers = sci_pdu->number_of_dmrs_port+1; nr_sl_pssch_pscch_pdu->num_layers = sci_pdu->number_of_dmrs_port+1;
LOG_D(NR_MAC,"PSSCH: mcs %d, coderate %d, Nl %d => tbs %d\n",sci_pdu->mcs,nr_sl_pssch_pscch_pdu->target_coderate,nr_sl_pssch_pscch_pdu->num_layers,nr_sl_pssch_pscch_pdu->tb_size); LOG_I(NR_MAC,"PSSCH: mcs %d, coderate %d, Nl %d => tbs %d\n",sci_pdu->mcs,nr_sl_pssch_pscch_pdu->target_coderate,nr_sl_pssch_pscch_pdu->num_layers,nr_sl_pssch_pscch_pdu->tb_size);
nr_sl_pssch_pscch_pdu->tbslbrm = nr_compute_tbslbrm(mcs_tb_ind,NRRIV2BW(sl_bwp->sl_BWP_Generic_r16->sl_BWP_r16->locationAndBandwidth,273),nr_sl_pssch_pscch_pdu->num_layers); nr_sl_pssch_pscch_pdu->tbslbrm = nr_compute_tbslbrm(mcs_tb_ind,NRRIV2BW(sl_bwp->sl_BWP_Generic_r16->sl_BWP_r16->locationAndBandwidth,273),nr_sl_pssch_pscch_pdu->num_layers);
nr_sl_pssch_pscch_pdu->mcs_table=mcs_tb_ind; nr_sl_pssch_pscch_pdu->mcs_table=mcs_tb_ind;
nr_sl_pssch_pscch_pdu->rv_index = sci2_pdu->rv_index; nr_sl_pssch_pscch_pdu->rv_index = sci2_pdu->rv_index;
......
...@@ -635,7 +635,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -635,7 +635,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int i; int i;
if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) { if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) {
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid); LOG_I(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid);
sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap_rx, entity->pdusession_id, ue->rntiMaybeUEid, buf, size); sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap_rx, entity->pdusession_id, ue->rntiMaybeUEid, buf, size);
} }
else{ else{
...@@ -685,7 +685,7 @@ static void deliver_pdu_drb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, ...@@ -685,7 +685,7 @@ static void deliver_pdu_drb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id,
} else { } else {
mem_block_t *memblock = get_free_mem_block(size, __FUNCTION__); mem_block_t *memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size); memcpy(memblock->data, buf, size);
LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); LOG_I(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
//printf("\n"); //printf("\n");
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock);
......
...@@ -93,7 +93,7 @@ void mac_rlc_data_ind ( ...@@ -93,7 +93,7 @@ void mac_rlc_data_ind (
} }
if (rb != NULL) { if (rb != NULL) {
LOG_D(RLC, "RB found! (channel ID %d) \n", channel_idP); LOG_I(RLC, "RB found! (channel ID %d) \n", channel_idP);
rb->set_time(rb, nr_rlc_current_time); rb->set_time(rb, nr_rlc_current_time);
rb->recv_pdu(rb, buffer_pP, tb_sizeP); rb->recv_pdu(rb, buffer_pP, tb_sizeP);
} else { } else {
...@@ -483,7 +483,7 @@ rb_found: ...@@ -483,7 +483,7 @@ rb_found:
exit(1); exit(1);
} }
memcpy(memblock->data, buf, size); memcpy(memblock->data, buf, size);
LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); LOG_I(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__);
if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) { if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__);
/* what to do in case of failure? for the moment: nothing */ /* what to do in case of failure? for the moment: nothing */
......
...@@ -301,9 +301,9 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, ...@@ -301,9 +301,9 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
*/ */
extern int nas_sock_fd[]; extern int nas_sock_fd[];
int len = write(nas_sock_fd[0], &buf[offset], size-offset); int len = write(nas_sock_fd[0], &buf[offset], size-offset);
LOG_D(SDAP, "RX Entity len : %d\n", len); LOG_I(SDAP, "RX Entity len : %d\n", len);
LOG_D(SDAP, "RX Entity size : %d\n", size); LOG_I(SDAP, "RX Entity size : %d\n", size);
LOG_D(SDAP, "RX Entity offset : %d\n", offset); LOG_I(SDAP, "RX Entity offset : %d\n", offset);
if (len != size-offset) if (len != size-offset)
LOG_E(SDAP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(SDAP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
......
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