Commit 00ba6b6b authored by Hongzhi Wang's avatar Hongzhi Wang Committed by Hongzhi Wang

add offload on cmdline and bugfix

parent a96aeff2
......@@ -843,16 +843,6 @@ fill_queue_buffers(struct test_op_params *op_params,int8_t* p_llr, uint32_t data
}
bool loopback = op_params->ref_dec_op->ldpc_dec.op_flags &
RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK;
bool llr_comp = op_params->ref_dec_op->ldpc_dec.op_flags &
RTE_BBDEV_LDPC_LLR_COMPRESSION;
ldpc_llr_decimals = capabilities->cap.ldpc_dec.llr_decimals;
ldpc_llr_size = capabilities->cap.ldpc_dec.llr_size;
ldpc_cap_flags = capabilities->cap.ldpc_dec.capability_flags;
if (!loopback && !llr_comp)
ldpc_input_llr_scaling(*queue_ops[DATA_INPUT], n,
ldpc_llr_size, ldpc_llr_decimals);
return 0;
}
......@@ -925,7 +915,7 @@ set_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
ops[i]->ldpc_dec.q_m = p_offloadParams->Qm;
ops[i]->ldpc_dec.n_filler = p_offloadParams->F;
ops[i]->ldpc_dec.n_cb = p_offloadParams->n_cb;
ops[i]->ldpc_dec.iter_max = 8;
ops[i]->ldpc_dec.iter_max = 20;
ops[i]->ldpc_dec.rv_index = p_offloadParams->rv;
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;
......@@ -998,7 +988,7 @@ check_enc_status_and_ordering(struct rte_bbdev_enc_op *op,
*/
static int
validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
retrieve_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
struct rte_bbdev_dec_op *ref_op, const int vector_mask,
int8_t* p_out)
{
......@@ -1310,7 +1300,7 @@ pmd_lcore_ldpc_dec(void *arg)
mbuf_reset(
ops_enq[j]->ldpc_dec.harq_combined_output.data);
}
start_time = rte_rdtsc_precise();
//start_time = rte_rdtsc_precise();
for (enq = 0, deq = 0; enq < num_ops;) {
num_to_enq = burst_sz;
......@@ -1332,7 +1322,7 @@ pmd_lcore_ldpc_dec(void *arg)
queue_id, &ops_deq[deq], enq - deq);
}
total_time += rte_rdtsc_precise() - start_time;
// total_time += rte_rdtsc_precise() - start_time;
}
tp->iter_count = 0;
......@@ -1342,20 +1332,20 @@ pmd_lcore_ldpc_dec(void *arg)
tp->iter_count);
}
ret = validate_ldpc_dec_op(ops_deq, num_ops, ref_op,
ret = retrieve_ldpc_dec_op(ops_deq, num_ops, ref_op,
tp->op_params->vector_mask, p_out);
TEST_ASSERT_SUCCESS(ret, "Validation failed!");
rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
double tb_len_bits = calc_ldpc_dec_TB_size(ref_op);
/*double tb_len_bits = calc_ldpc_dec_TB_size(ref_op);
tp->ops_per_sec = ((double)num_ops * TEST_REPETITIONS) /
((double)total_time / (double)rte_get_tsc_hz());
tp->mbps = (((double)(num_ops * TEST_REPETITIONS * tb_len_bits)) /
1000000.0) / ((double)total_time /
(double)rte_get_tsc_hz());
*/
return TEST_SUCCESS;
}
......@@ -1402,7 +1392,7 @@ start_pmd_dec(struct active_device *ad,
struct rte_bbdev_info info;
uint16_t num_lcores;
rte_bbdev_info_get(ad->dev_id, &info);
//rte_bbdev_info_get(ad->dev_id, &info);
/*printf("+ ------------------------------------------------------- +\n");
printf("== start pmd dec\ndev: %s, nb_queues: %u, burst size: %u, num ops: %u, num_lcores: %u, itr mode: %s, GHz: %lg\n",
......@@ -1437,7 +1427,6 @@ start_pmd_dec(struct active_device *ad,
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
if (used_cores >= num_lcores)
break;
t_params[used_cores].dev_id = ad->dev_id;
t_params[used_cores].lcore_id = lcore_id;
t_params[used_cores].op_params = op_params;
......@@ -1486,7 +1475,6 @@ start_pmd_dec(struct active_device *ad,
tp->mbps /= TEST_REPETITIONS;
ret |= (int)rte_atomic16_read(&tp->processing_status);
/* Wait for slave lcores operations */
for (used_cores = 1; used_cores < num_lcores; used_cores++) {
tp = &t_params[used_cores];
......@@ -1579,7 +1567,7 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
test_params.num_ops=1;
test_params.burst_sz=1;
test_params.num_lcores=3;
test_params.num_lcores=1;
test_params.num_tests = 1;
struct active_device *ad;
ad = &active_devs[0];
......@@ -1654,7 +1642,6 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
}
cap++;
}
create_reference_ldpc_dec_op(op_params->ref_dec_op, p_offloadParams);
ad->nb_queues = 1;
for (i = 0; i < ad->nb_queues; ++i) {
......
......@@ -403,7 +403,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
int8_t llrProcBuf[22*384];
int ret = 0;
int i,j;
int8_t enable_ldpc_offload = 1;
int8_t enable_ldpc_offload = phy_vars_gNB->ldpc_offload_flag;
int16_t z_ol [68*384];
int8_t l_ol [68*384];
__m128i *pv_ol128 = (__m128i*)&z_ol;
......@@ -598,7 +598,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
{
pl_ol128[j] = _mm_packs_epi16(pv_ol128[i],pv_ol128[i+1]);
pl_ol128[j] = _mm_packs_epi16(_mm_slli_epi16(pv_ol128[i],1),_mm_slli_epi16(pv_ol128[i+1],1));
}
ret = nrLDPC_decoder_offload(p_decParams,
......@@ -639,9 +639,16 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
harq_process->c[r],
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));
harq_process->processedSegments=r+1;
}
if (r==harq_process->C-1){
else {
if ( harq_process->C != harq_process->processedSegments ) {
LOG_I(PHY,"uplink segment error %d/%d\n",r,harq_process->C);
LOG_D(PHY, "ULSCH %d in error\n",ULSCH_id);
harq_process->processedSegments=harq_process->C;
}
}
if (harq_process->processedSegments==harq_process->C){
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);
......@@ -650,7 +657,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
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);
nr_fill_indication(phy_vars_gNB,harq_process->frame, harq_process->slot, ULSCH_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",
......@@ -664,9 +671,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
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);
LOG_D(PHY, "ULSCH %d in error\n",ULSCH_id);
nr_fill_indication(phy_vars_gNB,harq_process->frame, harq_process->slot, ULSCH_id, harq_pid, 1);
}
ulsch->last_iteration_cnt = no_iteration_ldpc;
}
}
}
......
......@@ -829,7 +829,7 @@ typedef struct PHY_VARS_gNB_s {
double N0;
unsigned char first_run_I0_measurements;
int ldpc_offload_flag;
unsigned char is_secondary_gNB; // primary by default
unsigned char is_init_sync; /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
......
......@@ -308,7 +308,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
uint8_t l, number_dmrs_symbols = 0;
uint32_t G;
uint16_t start_symbol, number_symbols, nb_re_dmrs;
uint8_t enable_ldpc_offload = 1;
uint8_t enable_ldpc_offload = gNB->ldpc_offload_flag;
start_symbol = pusch_pdu->start_symbol_index;
number_symbols = pusch_pdu->nr_of_symbols;
......
......@@ -311,6 +311,7 @@ int main(int argc, char **argv)
//float eff_tp_check = 0.7;
uint8_t snrRun;
int prb_inter = 0;
int ldpc_offload_flag = 0;
int enable_ptrs = 0;
int modify_dmrs = 0;
......@@ -344,7 +345,7 @@ int main(int argc, char **argv)
/* initialize the sin-cos table */
InitSinLUT();
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:o:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
printf("handling optarg %c\n",c);
switch (c) {
......@@ -456,6 +457,10 @@ int main(int argc, char **argv)
case 'n':
n_trials = atoi(optarg);
break;
case 'o':
ldpc_offload_flag = atoi(optarg);
break;
case 'p':
extended_prefix_flag = 1;
......@@ -604,6 +609,7 @@ int main(int argc, char **argv)
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
printf("-m MCS value\n");
printf("-n Number of trials to simulate\n");
printf("-o ldpc offload flag\n");
printf("-p Use extended prefix mode\n");
printf("-t Delay spread for multipath channel\n");
printf("-u Set the numerology\n");
......@@ -805,7 +811,8 @@ int main(int argc, char **argv)
unsigned char harq_pid = 0;
gNB->ldpc_offload_flag = ldpc_offload_flag;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req));
......
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