Commit a96aeff2 authored by Hongzhi Wang's avatar Hongzhi Wang Committed by Hongzhi Wang

adding post decoding for offload

parent 1247a02f
...@@ -166,6 +166,8 @@ struct thread_params { ...@@ -166,6 +166,8 @@ struct thread_params {
uint8_t iter_count; uint8_t iter_count;
double iter_average; double iter_average;
double bler; double bler;
struct t_nrLDPCoffload_params *p_offloadParams;
int8_t* p_out;
rte_atomic16_t nb_dequeued; rte_atomic16_t nb_dequeued;
rte_atomic16_t processing_status; rte_atomic16_t processing_status;
rte_atomic16_t burst_sz; rte_atomic16_t burst_sz;
...@@ -928,7 +930,6 @@ set_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n, ...@@ -928,7 +930,6 @@ set_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
ops[i]->ldpc_dec.op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE; ops[i]->ldpc_dec.op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
ops[i]->ldpc_dec.code_block_mode = 1; //ldpc_dec->code_block_mode; ops[i]->ldpc_dec.code_block_mode = 1; //ldpc_dec->code_block_mode;
if (hard_outputs != NULL) if (hard_outputs != NULL)
ops[i]->ldpc_dec.hard_output = ops[i]->ldpc_dec.hard_output =
hard_outputs[start_idx + i]; hard_outputs[start_idx + i];
...@@ -1240,7 +1241,7 @@ ldpc_decod_ut(struct test_op_params *op_params, int8_t* p_llr, t_nrLDPCoffload_p ...@@ -1240,7 +1241,7 @@ ldpc_decod_ut(struct test_op_params *op_params, int8_t* p_llr, t_nrLDPCoffload_p
static int static int
pmd_lcore_ldpc_dec(void *arg, t_nrLDPCoffload_params *p_offloadParams, int8_t* p_out) pmd_lcore_ldpc_dec(void *arg)
{ {
struct thread_params *tp = arg; struct thread_params *tp = arg;
uint16_t enq, deq; uint16_t enq, deq;
...@@ -1255,8 +1256,10 @@ pmd_lcore_ldpc_dec(void *arg, t_nrLDPCoffload_params *p_offloadParams, int8_t* p ...@@ -1255,8 +1256,10 @@ pmd_lcore_ldpc_dec(void *arg, t_nrLDPCoffload_params *p_offloadParams, int8_t* p
int i, j, ret; int i, j, ret;
struct rte_bbdev_info info; struct rte_bbdev_info info;
uint16_t num_to_enq; uint16_t num_to_enq;
int8_t *p_out = tp->p_out;
//struct rte_bbdev_op_data *hard_output; t_nrLDPCoffload_params *p_offloadParams = tp->p_offloadParams;
//struct rte_bbdev_op_data *hard_output;
//bool extDdr = check_bit(ldpc_cap_flags, //bool extDdr = check_bit(ldpc_cap_flags,
// RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE); // RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE);
...@@ -1407,7 +1410,7 @@ start_pmd_dec(struct active_device *ad, ...@@ -1407,7 +1410,7 @@ start_pmd_dec(struct active_device *ad,
op_params->num_to_process, op_params->num_lcores, op_params->num_to_process, op_params->num_lcores,
intr_enabled ? "Interrupt mode" : "PMD mode", intr_enabled ? "Interrupt mode" : "PMD mode",
(double)rte_get_tsc_hz() / 1000000000.0); (double)rte_get_tsc_hz() / 1000000000.0);
*/ */
/* Set number of lcores */ /* Set number of lcores */
num_lcores = (ad->nb_queues < (op_params->num_lcores)) num_lcores = (ad->nb_queues < (op_params->num_lcores))
? ad->nb_queues ? ad->nb_queues
...@@ -1428,6 +1431,8 @@ start_pmd_dec(struct active_device *ad, ...@@ -1428,6 +1431,8 @@ start_pmd_dec(struct active_device *ad,
t_params[0].op_params = op_params; t_params[0].op_params = op_params;
t_params[0].queue_id = ad->queue_ids[used_cores++]; t_params[0].queue_id = ad->queue_ids[used_cores++];
t_params[0].iter_count = 0; t_params[0].iter_count = 0;
t_params[0].p_out = p_out;
t_params[0].p_offloadParams = p_offloadParams;
RTE_LCORE_FOREACH_SLAVE(lcore_id) { RTE_LCORE_FOREACH_SLAVE(lcore_id) {
if (used_cores >= num_lcores) if (used_cores >= num_lcores)
...@@ -1438,12 +1443,15 @@ start_pmd_dec(struct active_device *ad, ...@@ -1438,12 +1443,15 @@ start_pmd_dec(struct active_device *ad,
t_params[used_cores].op_params = op_params; t_params[used_cores].op_params = op_params;
t_params[used_cores].queue_id = ad->queue_ids[used_cores]; t_params[used_cores].queue_id = ad->queue_ids[used_cores];
t_params[used_cores].iter_count = 0; t_params[used_cores].iter_count = 0;
t_params[used_cores].p_out = p_out;
t_params[used_cores].p_offloadParams = p_offloadParams;
rte_eal_remote_launch(pmd_lcore_ldpc_dec, rte_eal_remote_launch(pmd_lcore_ldpc_dec,
&t_params[used_cores++], lcore_id); &t_params[used_cores++], lcore_id);
} }
rte_atomic16_set(&op_params->sync, SYNC_START); rte_atomic16_set(&op_params->sync, SYNC_START);
ret = pmd_lcore_ldpc_dec(&t_params[0], p_offloadParams, p_out); ret = pmd_lcore_ldpc_dec(&t_params[0]);
/* Master core is always used */ /* Master core is always used */
for (used_cores = 1; used_cores < num_lcores; used_cores++) for (used_cores = 1; used_cores < num_lcores; used_cores++)
...@@ -1560,8 +1568,8 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -1560,8 +1568,8 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
{ {
t_nrLDPCoffload_params offloadParams; t_nrLDPCoffload_params offloadParams;
t_nrLDPCoffload_params* p_offloadParams = &offloadParams; t_nrLDPCoffload_params* p_offloadParams = &offloadParams;
uint32_t numIter = 0; uint32_t numIter = 0;
int ret; int ret;
int argc_re=2; int argc_re=2;
...@@ -1571,7 +1579,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -1571,7 +1579,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
test_params.num_ops=1; test_params.num_ops=1;
test_params.burst_sz=1; test_params.burst_sz=1;
test_params.num_lcores=1; test_params.num_lcores=3;
test_params.num_tests = 1; test_params.num_tests = 1;
struct active_device *ad; struct active_device *ad;
ad = &active_devs[0]; ad = &active_devs[0];
...@@ -1648,8 +1656,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -1648,8 +1656,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
} }
create_reference_ldpc_dec_op(op_params->ref_dec_op, p_offloadParams); create_reference_ldpc_dec_op(op_params->ref_dec_op, p_offloadParams);
ad->nb_queues = 1;
ad->nb_queues =1;
for (i = 0; i < ad->nb_queues; ++i) { for (i = 0; i < ad->nb_queues; ++i) {
f_ret = fill_queue_buffers(op_params, f_ret = fill_queue_buffers(op_params,
p_llr, p_llr,
......
...@@ -590,13 +590,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -590,13 +590,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
length_dec = (harq_process->B+24*harq_process->C)/harq_process->C; length_dec = (harq_process->B+24*harq_process->C)/harq_process->C;
} }
E = nr_get_E(G, harq_process->C, Qm, n_layers, 0);
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
memset(harq_process->c[r],0,Kr_bytes); memset(harq_process->c[r],0,Kr_bytes);
memcpy((&z_ol[0]),ulsch_llr+r*E,E*sizeof(int16_t)); memcpy((&z_ol[0]),ulsch_llr+r_offset,E*sizeof(short));
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
{ {
...@@ -627,21 +625,50 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -627,21 +625,50 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
#endif #endif
no_iteration_ldpc = ulsch->max_ldpc_iterations + 1; no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
} }
r_offset += E;
/*for (int k=0;k<8;k++) /*for (int k=0;k<8;k++)
{ {
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k); printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k);
} }
*/ */
bool decodeSuccess = (no_iteration_ldpc <= ulsch->max_ldpc_iterations);
memcpy(harq_process->b+offset, if (decodeSuccess) {
harq_process->c[r], memcpy(harq_process->b+offset,
Kr_bytes - (harq_process->F>>3) -((harq_process->C>1)?3:0)); harq_process->c[r],
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); Kr_bytes - (harq_process->F>>3) -((harq_process->C>1)?3:0));
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
} }
if (r==harq_process->C-1){
if (decodeSuccess) {
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for slot %d TBS %d\n",
phy_vars_gNB->Mod_id,harq_process->slot,harq_process->TBS);
harq_process->status = SCH_IDLE;
harq_process->round = 0;
ulsch->harq_mask &= ~(1 << harq_pid);
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(phy_vars_gNB,harq_process->frame, harq_process->slot, UE_id, harq_pid, 0);
} else {
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
phy_vars_gNB->Mod_id, harq_process->frame, harq_process->slot,
harq_pid,harq_process->status, harq_process->round,harq_process->TBS,r);
if (harq_process->round >= ulsch->Mlimit) {
harq_process->status = SCH_IDLE;
harq_process->round = 0;
harq_process->handled = 0;
ulsch->harq_mask &= ~(1 << harq_pid);
}
harq_process->handled = 1;
LOG_D(PHY, "ULSCH %d in error\n",UE_id);
nr_fill_indication(phy_vars_gNB,harq_process->frame, harq_process->slot, UE_id, harq_pid, 1);
}
}
}
} }
else { else {
void (*nr_processULSegment_ptr)(void*) = &nr_processULSegment; void (*nr_processULSegment_ptr)(void*) = &nr_processULSegment;
......
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