Commit 18d720f3 authored by Raymond Knopp's avatar Raymond Knopp

fixed issue with demux of SCI1/SCI2/SLSCH in SLSCH receiver. Added skeleton...

fixed issue with demux of SCI1/SCI2/SLSCH in SLSCH receiver. Added skeleton for MAC parsing on RX for SL.
parent ba6a8554
......@@ -50,7 +50,7 @@
#include <syscall.h>
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_ULSCH_DECODING
#define DEBUG_ULSCH_DECODING
//#define gNB_DEBUG_TRACE
#define OAI_UL_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384
......@@ -172,6 +172,7 @@ static void nr_processULSegment(void *arg)
nr_deinterleaving_ldpc(E, Qm, harq_e, ulsch_llr + r_offset);
// for (int i =0; i<16; i++)
// printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,ulsch_harq->w[r][i], r_offset);
......@@ -309,7 +310,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// target_code_rate is in 0.1 units
float Coderate = (float) pusch_pdu->target_code_rate / 10240.0f;
LOG_D(PHY,"ULSCH Decoding, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new RX %d\n",
LOG_I(PHY,"ULSCH Decoding, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new RX %d\n",
harq_pid, ulsch->rnti, A, G, mcs, n_layers, nb_rb, Qm, Coderate, pusch_pdu->pusch_data.rv_index, harq_process->round, harq_process->harq_to_be_cleared);
t_nrLDPC_dec_params decParams = {0};
decParams.BG = pusch_pdu->maintenance_parms_v3.ldpcBaseGraph;
......@@ -530,7 +531,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
rdata->ulsch_id = ULSCH_id;
rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
pushTpool(phy_vars_gNB ? &phy_vars_gNB->threadPool : &get_nrUE_params()->Tpool, req);
LOG_D(PHY, "Added a block to decode, in pipe: %d\n", r);
LOG_I(PHY, "Added a block to decode, in pipe: %d\n", r);
r_offset += E;
offset += (Kr_bytes - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0));
//////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -2215,16 +2215,16 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
/*-----------------------------------------------------------------------------------------------------*/
if (gNB) start_meas(&gNB->ulsch_llr_stats);
int sci1_offset=0;
if (symbol <= pssch_pdu->pscch_numsym) {
pusch_vars->ul_valid_re_per_slot[symbol] -= sci1_re_per_symb;
sci1_offset=sci1_re_per_symb;
}
if (ml_rx == false || nrOfLayers == 1) {
if (pssch_pdu && sci2_left>0){
LOG_I(NR_PHY,"valid_re_per_slot[%d] %d\n",symbol,pusch_vars->ul_valid_re_per_slot[symbol]);
int available_sci2_res_in_symb = pusch_vars->ul_valid_re_per_slot[symbol];
int slsch_res_in_symbol;
if (symbol <= pssch_pdu->pscch_numsym) {
available_sci2_res_in_symb = pusch_vars->ul_valid_re_per_slot[symbol] - sci1_re_per_symb;
sci1_offset=sci1_re_per_symb;
LOG_I(NR_PHY,"available_sci2_res_in_symb[%d] %d (sci1_re %d)\n",symbol,available_sci2_res_in_symb,sci1_re_per_symb);
}
int sci2_cnt_prev = sci2_cnt;
if (available_sci2_res_in_symb < sci2_left) {
sci2_cnt += available_sci2_res_in_symb; // take all of the PSSCH REs for SCI2
......@@ -2279,7 +2279,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
//
}
} // (not ML || nrOfLayers==1 ) AND pssch and sci2 REs to handle
if (pssch_pdu) LOG_D(NR_PHY,"symbol %d: PSSCH REs %d (sci1 %d,sci2 %d)\n",symbol,pusch_vars->ul_valid_re_per_slot[symbol],sci1_offset,sci2_cnt_thissymb);
if (pssch_pdu) LOG_I(NR_PHY,"symbol %d: PSSCH REs %d (sci1 %d,sci2 %d)\n",symbol,pusch_vars->ul_valid_re_per_slot[symbol],sci1_offset,sci2_cnt_thissymb);
for (aatx=0; aatx < nrOfLayers; aatx++) {
nr_ulsch_compute_llr(&pusch_vars->rxdataF_comp[aatx * frame_parms->nb_antennas_rx][symbol * (off + rb_size * NR_NB_SC_PER_RB)+sci1_offset+sci2_cnt_thissymb],
pusch_vars->ul_ch_mag0[aatx * frame_parms->nb_antennas_rx],
......
......@@ -70,6 +70,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
// target_code_rate is in 0.1 units
float Coderate = (float) (pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.target_code_rate : pscch_pssch_pdu->target_coderate) / 10240.0f;
if (pscch_pssch_pdu) memcpy(harq_process->a,pscch_pssch_pdu->slsch_payload,A>>3);
///////////
/////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -268,7 +268,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
// for (int i=0;i<(Gsci2>>5)+1;i++) LOG_I(NR_PHY,"sci2_encoded[%d] %x\n",i,sci2_encoded_output[i]);
// for (int g=0;g<G;g++) LOG_I(NR_PHY,"coded_output_f[%d] %d\n",g,harq_process_ul_ue->f[g]);
// LOG_I(NR_PHY,"Scrambling with Nid %x\n",phy_data->pscch_Nid);
nr_pusch_codeword_scrambling(harq_process_ul_ue->f,
G,
pscch_pssch_pdu==NULL ? ulsch_ue->Nid_cell : phy_data->pscch_Nid,
......@@ -305,7 +306,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
available_bits,
mod_order,
(int16_t *)d_mod2);
//for (int i=0;i<100;i+=2) LOG_D(NR_PHY,"SLSCH RE %d/%d: (%d,%d)\n",i/2,available_bits/2,((int16_t*)d_mod2)[i],((int16_t*)d_mod2)[i+1]);
LOG_D(NR_PHY,"SCI bits %d (sci2_re %d), PSSCH bits %d (PSCCH RE %d), max_re %d\n",Gsci2,sci2_re,available_bits,available_bits/mod_order,max_num_re);
memcpy(d_mod+sci2_re,d_mod2,available_bits*sizeof(int32_t)/mod_order);
}
......
......@@ -38,7 +38,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
AssertFatal(1==0,"Should never get here\n");
}
NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti) {
AssertFatal(1==0,"Should never get here\n");
return(NULL);
}
void nr_fill_sl_indication(nr_sidelink_indication_t *sl_ind,
sl_nr_rx_indication_t *rx_ind,
......@@ -86,7 +86,12 @@ void nr_fill_sl_rx_indication(sl_nr_rx_indication_t *rx_ind,
switch (pdu_type){
case SL_NR_RX_PDU_TYPE_SLSCH:
AssertFatal(1==0,"fill this in\n");
sl_nr_slsch_pdu_t *rx_slsch_pdu = &rx_ind->rx_indication_body[n_pdus - 1].rx_slsch_pdu;
slsch_status_t *slsch_status = (slsch_status_t *)typeSpecific;
rx_slsch_pdu->pdu = slsch_status->rdata->ulsch_harq->b;
rx_slsch_pdu->pdu_length = slsch_status->rdata->ulsch_harq->TBS;
rx_slsch_pdu->harq_pid = slsch_status->rdata->harq_pid;
rx_slsch_pdu->ack_nack = (slsch_status->rxok==true) ? 1 : 0;
break;
case FAPI_NR_RX_PDU_TYPE_SSB: {
sl_nr_ssb_pdu_t *ssb_pdu = &rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu;
......@@ -114,17 +119,18 @@ void nr_fill_sl_rx_indication(sl_nr_rx_indication_t *rx_ind,
}
extern int dmrs_pscch_mask[2];
int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH_id, uint8_t harq_pid,UE_nr_rxtx_proc_t *proc,nr_phy_data_t *phy_data) {
int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH_id, UE_nr_rxtx_proc_t *proc,nr_phy_data_t *phy_data) {
sl_nr_ue_phy_params_t *sl_phy_params = &ue->SL_UE_PHY_PARAMS;
NR_DL_FRAME_PARMS *fp = &sl_phy_params->sl_frame_params;
sl_nr_rx_config_pssch_pdu_t *slsch_pdu = ue->slsch[SLSCH_id].harq_process->slsch_pdu;
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu = ue->slsch[SLSCH_id].harq_process->pssch_pdu;
sl_nr_rx_config_pssch_pdu_t *slsch_pdu = &phy_data->nr_sl_pssch_pdu; //ue->slsch[SLSCH_id].harq_process->slsch_pdu;
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu = &phy_data->nr_sl_pssch_sci_pdu; //ue->slsch[SLSCH_id].harq_process->pssch_pdu;
int harq_pid = slsch_pdu->harq_pid;
uint16_t nb_re_dmrs;
uint16_t start_symbol = 1;
uint16_t number_symbols = pssch_pdu->pssch_numsym;
ue->slsch[SLSCH_id].harq_process->harq_to_be_cleared=true;
uint8_t number_dmrs_symbols = 0;
for (int l = start_symbol; l < start_symbol + number_symbols; l++)
number_dmrs_symbols += ((pssch_pdu->dmrs_symbol_position)>>l)&0x01;
......@@ -133,16 +139,15 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
uint32_t rb_size = pssch_pdu->num_subch*pssch_pdu->subchannel_size;
int sci1_dmrs_overlap = pssch_pdu->dmrs_symbol_position & dmrs_pscch_mask[pssch_pdu->pscch_numsym-2];
int sci2_re = get_NREsci2(pssch_pdu->sci2_alpha_times_100,
pssch_pdu->sci2_payload_len,
int sci2_re = get_NREsci2_2(pssch_pdu->sci2_alpha_times_100,
pssch_pdu->sci2_len,
pssch_pdu->sci2_beta_offset,
pssch_pdu->pssch_numsym,
pssch_pdu->pscch_numsym,
pssch_pdu->pscch_numrbs,
pssch_pdu->l_subch,
pssch_pdu->subchannel_size,
pssch_pdu->mcs,
pssch_pdu->mcs_table);
pssch_pdu->targetCodeRate);
uint32_t G = nr_get_G_SL(rb_size,
number_symbols,
nb_re_dmrs,
......@@ -151,15 +156,15 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
pssch_pdu->pscch_numsym,
pssch_pdu->pscch_numrbs,
sci2_re,
pssch_pdu->qam_mod_order,
pusch_pdu->nrOfLayers);
pssch_pdu->mod_order,
pssch_pdu->num_layers);
AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n",
rb_size,
number_symbols,
nb_re_dmrs,
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
pssch_pdu->qam_mod_order,
pssch_pdu->mod_order,
pssch_pdu->num_layers);
LOG_I(NR_PHY,"rb_size %d, number_symbols %d, nb_re_dmrs %d, dmrs symbol positions %d, number_dmrs_symbols %d, qam_mod_order %d, nrOfLayer %d\n",
rb_size,
......@@ -167,19 +172,22 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
nb_re_dmrs,
pssch_pdu->dmrs_symbol_position,
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
pssch_pdu->qam_mod_order,
pssch_pdu->mod_order,
pssch_pdu->num_layers);
nr_ulsch_layer_demapping(ue->pssch_vars[SLSCH_id].llr,
pssch_pdu->num_layers,
pssch_pdu->qam_mod_order,
pssch_pdu->mod_order,
G,
ue->pssch_vars[SLSCH_id].llr_layers);
//for (int g=0;g<G;g++) LOG_I(NR_PHY,"prescrambling_llr[%d] %d\n",g,ue->pssch_vars[SLSCH_id].llr[g]);
//----------------------------------------------------------
//------------------- ULSCH unscrambling -------------------
//----------------------------------------------------------
nr_ulsch_unscrambling(ue->pssch_vars[SLSCH_id].llr, G, phy_data->Nid, 1010);
//LOG_I(NR_PHY,"SLSCH, unscrambling with Nid %x\n",pssch_pdu->Nid);
nr_ulsch_unscrambling(ue->pssch_vars[SLSCH_id].llr, G, pssch_pdu->Nid, 1010);
// for (int g=0;g<32;g++) LOG_I(NR_PHY,"unscrambling_llr[%d] %d\n",g,ue->pssch_vars[SLSCH_id].llr[g]);
//----------------------------------------------------------
//--------------------- ULSCH decoding ---------------------
//----------------------------------------------------------
......@@ -188,14 +196,14 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
nfapi_nr_pusch_pdu_t pusch_pdu;
pusch_pdu.rb_size = rb_size;
pusch_pdu.qam_mod_order = qam_mod_order;
pusch_pdu.mcs_index = pssch_pdu->mcs;
pusch_pdu.qam_mod_order = pssch_pdu->mod_order;
pusch_pdu.mcs_index = slsch_pdu->mcs;
pusch_pdu.nrOfLayers = pssch_pdu->num_layers;
pusch_pdu.pusch_data.tb_size=pssch_pdu->tb_size;
uint32_t A = pssch_pdu->tb_size<<3;
pusch_pdu.target_code_rate=pssch_pdu->target_coderate;
float Coderate = (float) (pssch_pdu->target_coderate) / 10240.0f;
pusch_pdu.pusch_data.rv_index=pssch_pdu->rv_index;
pusch_pdu.pusch_data.tb_size=slsch_pdu->tb_size;
uint32_t A = slsch_pdu->tb_size<<3;
pusch_pdu.target_code_rate=slsch_pdu->target_coderate;
float Coderate = (float) (slsch_pdu->target_coderate) / 10240.0f;
pusch_pdu.pusch_data.rv_index=slsch_pdu->rv_index;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
pusch_pdu.maintenance_parms_v3.ldpcBaseGraph=2;
......@@ -203,10 +211,10 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
else{
pusch_pdu.maintenance_parms_v3.ldpcBaseGraph=1;
}
pusch_pdu.maintenance_parms_v3.tbSizeLbrmBytes=nr_sl_pssch_pdu->tbslbrm>>3;
pusch_pdu.maintenance_parms_v3.tbSizeLbrmBytes=slsch_pdu->tbslbrm>>3;
int nbDecode =
nr_ulsch_decoding(gNB, NULL, SLSCH_id, ue->pssch_vars[SLSCH_id].llr, frame_parms, &pusch_pdu, frame_rx, slot_rx, harq_pid, G,proc,phy_data);
nr_ulsch_decoding(NULL, ue, SLSCH_id, ue->pssch_vars[SLSCH_id].llr, fp, &pusch_pdu, frame_rx, slot_rx, harq_pid, G,proc,phy_data);
return nbDecode;
}
......@@ -216,7 +224,7 @@ void nr_postDecode_slsch(PHY_VARS_NR_UE *UE, notifiedFIFO_elt_t *req,UE_nr_rxtx_
NR_UL_gNB_HARQ_t *slsch_harq = rdata->ulsch_harq;
NR_gNB_ULSCH_t *slsch = rdata->ulsch;
int r = rdata->segment_r;
sl_nr_rx_config_pssch_pdu_t *slsch_pdu = UE->slsch[rdata->ulsch_id].harq_process->slsch_pdu;
sl_nr_rx_config_pssch_pdu_t *slsch_pdu = &phy_data->nr_sl_pssch_pdu;//UE->slsch[rdata->ulsch_id].harq_process->slsch_pdu;
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
slsch_harq->processedSegments++;
LOG_D(NR_PHY,
......@@ -236,8 +244,9 @@ void nr_postDecode_slsch(PHY_VARS_NR_UE *UE, notifiedFIFO_elt_t *req,UE_nr_rxtx_
if (rdata->nbSegments == slsch_harq->processedSegments) {
sl_nr_rx_indication_t sl_rx_indication;
nr_sidelink_indication_t sl_indication;
slsch_status_t slsch_status;
if (!check_abort(&slsch_harq->abort_decode) && !UE->pssch_vars[rdata->ulsch_id].DTX) {
LOG_D(NR_PHY,
LOG_I(NR_PHY,
"[UE] SLSCH: Setting ACK for SFN/SF %d.%d (pid %d, ndi %d, status %d, round %d, TBS %d, Max interation "
"(all seg) %d)\n",
slsch->frame,
......@@ -250,15 +259,12 @@ void nr_postDecode_slsch(PHY_VARS_NR_UE *UE, notifiedFIFO_elt_t *req,UE_nr_rxtx_
rdata->decodeIterations);
slsch->active = false;
slsch_harq->round = 0;
LOG_D(PHY, "SLSCH received ok \n");
slsch_status_t slsch_status;
LOG_I(NR_PHY, "SLSCH received ok \n");
slsch_status.rdata = rdata;
slsch_status.rxok = true;
nr_fill_sl_rx_indication(&sl_rx_indication,SL_NR_RX_PDU_TYPE_SLSCH,UE,1,proc,(void*)&slsch_status,0);
nr_fill_sl_indication(&sl_indication,&sl_rx_indication,NULL,proc,UE,phy_data);
//dumpsig=1;
} else {
LOG_D(NR_PHY,
LOG_I(NR_PHY,
"[UE] SLSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, "
"TBS %d) r %d\n",
slsch->frame,
......@@ -273,15 +279,16 @@ void nr_postDecode_slsch(PHY_VARS_NR_UE *UE, notifiedFIFO_elt_t *req,UE_nr_rxtx_
slsch_harq->TBS,
r);
slsch->handled = 1;
LOG_D(PHY, "SLSCH %d in error\n",rdata->ulsch_id);
slsch_status_t slsch_status;
LOG_I(NR_PHY, "SLSCH %d in error\n",rdata->ulsch_id);
slsch_status.rdata = rdata;
slsch_status.rxok = false;
nr_fill_sl_rx_indication(&sl_rx_indication,SL_NR_RX_PDU_TYPE_SLSCH,UE,1,proc,(void*)&slsch_status,0);
nr_fill_sl_indication(&sl_indication,&sl_rx_indication,NULL,proc,UE,phy_data);
// dumpsig=1;
}
slsch->last_iteration_cnt = rdata->decodeIterations;
nr_fill_sl_rx_indication(&sl_rx_indication,SL_NR_RX_PDU_TYPE_SLSCH,UE,1,proc,(void*)&slsch_status,0);
nr_fill_sl_indication(&sl_indication,&sl_rx_indication,NULL,proc,UE,phy_data);
if (UE->if_inst && UE->if_inst->sl_indication)
UE->if_inst->sl_indication(&sl_indication);
/*
if (ulsch_harq->ulsch_pdu.mcs_index == 0 && dumpsig==1) {
int off = ((ulsch_harq->ulsch_pdu.rb_size&1) == 1)? 4:0;
......@@ -631,17 +638,7 @@ void psbch_pscch_pssch_processing(PHY_VARS_NR_UE *ue,
ue->pssch_thres);
pssch_vars->DTX = 0;
notifiedFIFO_t nf;
initNotifiedFIFO(&nf);
int totalDecode = nr_slsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, ulsch->harq_pid,proc,phy_data);
while (totalDecode > 0) {
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &get_nrUE_params()->Tpool);
if (req == NULL)
break; // Tpool has been stopped
nr_postDecode_slsch(ue, proc, req);
delNotifiedFIFO_elt(req);
totalDecode--;
}
int totalDecode = nr_slsch_procedures(ue, frame_rx, nr_slot_rx, 0, proc,phy_data);
}
}
......
......@@ -618,6 +618,7 @@ typedef struct {
nr_sci_pdu_t sci_pdu_rx;
nr_sci_pdu_t sci1_pdu;
nr_sci_pdu_t sci2_pdu;
uint8_t slsch_payload[16384];
} NR_UE_MAC_INST_t;
/*@}*/
......
......@@ -85,7 +85,7 @@ bool nr_schedule_slsch(nr_sci_pdu_t *sci_pdu,nr_sci_pdu_t *sci2_pdu,uint8_t *sls
// Set SLSCH
*slsch_pdu_length = 1024;
for (uint32_t n=0;n<*slsch_pdu_length;n++) slsch_pdu[n]=(uint8_t)(n&255);
return true;
}
......@@ -575,3 +575,62 @@ uint32_t sl_determine_num_sidelink_slots(uint8_t mod_id, uint16_t *N_SSB_16frame
return N_SL_SLOTS;
}
void nr_ue_process_mac_sl_pdu(int module_idP,
sl_nr_rx_indication_t *rx_ind,
int pdu_id)
{
uint8_t *pduP = (rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.pdu;
int32_t pdu_len = (int32_t)(rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.pdu_length;
uint8_t done = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
if (!pduP){
return;
}
LOG_I(NR_MAC, "In %s : processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, pdu_id, pdu_len, rx_ind->number_pdus);
/*
while (!done && pdu_len > 0){
uint16_t mac_len = 0x0000;
uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
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);
bool ret;
switch(rx_lcid){
// MAC CE
case SL_SCH_LCID_CCCH:
// MSG4 RRC Setup 38.331
// variable length
ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n",
mac_len, pdu_len);
// Check if it is a valid CCCH message, we get all 00's messages very often
int i = 0;
for(i=0; i<(mac_subheader_len+mac_len); i++) {
if(pduP[i] != 0) {
break;
}
}
if (i == (mac_subheader_len+mac_len)) {
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
done = 1;
break;
}
if ( mac_len > 0 ) {
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_len);
for (int i = 0; i < mac_subheader_len; i++) {
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
}
for (int i = 0; i < mac_len; i++) {
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]);
}
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_len);
}
break;
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
*/
}
......@@ -3266,6 +3266,7 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
sl_ind->module_id, frame, slot,sl_ind->slot_type);
uint16_t slsch_pdu_length;
tx_config->tx_config_list[0].tx_pscch_pssch_config_pdu.slsch_payload = mac->slsch_payload;
bool schedule_slsch = nr_schedule_slsch(&mac->sci1_pdu,&mac->sci2_pdu,tx_config->tx_config_list[0].tx_pscch_pssch_config_pdu.slsch_payload,NR_SL_SCI_FORMAT_2A,&slsch_pdu_length);
if (!schedule_slsch) return false;
......
......@@ -647,9 +647,47 @@ void config_pssch_slsch_pdu_rx(sl_nr_rx_config_pssch_pdu_t *nr_sl_pssch_pdu,
nr_sl_pssch_pdu->tbslbrm = nr_compute_tbslbrm(sci_pdu->additional_mcs.val,
NRRIV2BW(sl_bwp->sl_BWP_Generic_r16->sl_BWP_r16->locationAndBandwidth,273),
nr_sl_pssch_pdu->num_layers);
/* nr_sl_pssch_pdu->tb_size = nr_compute_tbs_sl(nr_sl_pssch_pdu->mod_order,
int num_psfch_symbols=0;
if (sl_res_pool->sl_PSFCH_Config_r16 && sl_res_pool->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_Period_r16 && *sl_res_pool->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_Period_r16>0) {
num_psfch_symbols = *sl_res_pool->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_Period_r16;
if (num_psfch_symbols == 3) num_psfch_symbols++;
}
int pssch_numsym=7+*sl_bwp->sl_BWP_Generic_r16->sl_LengthSymbols_r16-num_psfch_symbols-2;
int l_subch;
convNRFRIV(sci_pdu->frequency_resource_assignment.val,
*sl_res_pool->sl_NumSubchannel_r16,
*sl_res_pool->sl_UE_SelectedConfigRP_r16->sl_MaxNumPerReserve_r16,
&l_subch,
NULL,NULL);
int subchannel_size=subch_to_rb[*sl_res_pool->sl_SubchannelSize_r16];
int nohPRB = (sl_res_pool->sl_X_Overhead_r16) ? 3*(*sl_res_pool->sl_X_Overhead_r16) : 0;
int nREDMRS = get_nREDMRS(sl_res_pool);
int pscch_numsym = pscch_tda[*sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_TimeResourcePSCCH_r16];
int pscch_numrbs = pscch_rb_table[*sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_FreqResourcePSCCH_r16];
int N_REprime = 12*pssch_numsym - nohPRB - nREDMRS;
int N_REsci1 = 12*pscch_numrbs*pscch_numsym;
AssertFatal(*sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_Scaling_r16 < 4, "Illegal index %d to alpha table\n",(int)*sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_Scaling_r16);
int sci2_beta_offset = *sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_BetaOffsets2ndSCI_r16->list.array[sci_pdu->beta_offset_indicator];
int sci2_alpha_times_100=0;
if (sl_res_pool->sl_PowerControl_r16) {
sci2_alpha_times_100=50 + (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16)*15;
if (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 == 3) sci2_alpha_times_100=100;
} else sci2_alpha_times_100 = 100;
int sci2_payload_len = nr_sci_size(sl_res_pool,sci_pdu,format2);
int N_REsci2 = get_NREsci2(sci2_alpha_times_100,
sci2_payload_len,
sci2_beta_offset,
pssch_numsym,
pscch_numsym,
pscch_numrbs,
l_subch,
subchannel_size,
nr_sl_pssch_pdu->mcs,
nr_sl_pssch_pdu->mcs_table);
int N_RE = N_REprime*l_subch*subchannel_size - N_REsci1 - N_REsci2;
nr_sl_pssch_pdu->tb_size = nr_compute_tbs_sl(nr_sl_pssch_pdu->mod_order,
nr_sl_pssch_pdu->target_coderate,
N_RE,1+(sci_pdu->number_of_dmrs_port&1))>>3; */
N_RE,1+(sci_pdu->number_of_dmrs_port&1))>>3;
}
void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pdu,
......
......@@ -1443,6 +1443,12 @@ static void handle_sl_bch(module_id_t module_id,uint8_t *const sl_mib,
return ;
}
int8_t handle_slsch(int module_idP,sl_nr_rx_indication_t *rx_ind,int pdu_id)
{
nr_ue_process_mac_sl_pdu(module_idP,rx_ind,pdu_id);
return 0;
}
void handle_sl_sci1a(module_id_t module_id,uint32_t frame, uint32_t slot, sl_nr_sci_indication_pdu_t *const sci,void *phy_data) {
......@@ -1492,6 +1498,13 @@ void sl_nr_process_rx_ind(uint16_t mod_id,
break;
case SL_NR_RX_PDU_TYPE_SLSCH:
LOG_I(NR_MAC, "%s[UE%d]SL-MAC Received SLSCH: rx_slsch_pdu:%p, rx_slsch_len %d, ack_nack %d, harq_pid %d\n",KGRN,
mod_id,rx_ind->rx_indication_body[num_pdus - 1].rx_slsch_pdu.pdu,
rx_ind->rx_indication_body[num_pdus - 1].rx_slsch_pdu.pdu_length,
rx_ind->rx_indication_body[num_pdus - 1].rx_slsch_pdu.ack_nack,
rx_ind->rx_indication_body[num_pdus - 1].rx_slsch_pdu.harq_pid);
handle_slsch(mod_id,rx_ind,0);
break;
default :
......
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