Commit 11441023 authored by Laurent THOMAS's avatar Laurent THOMAS

fix polar race condition

parent ae803b53
......@@ -86,6 +86,7 @@ check_supported_distribution() {
"ubuntu20.04") return 0 ;;
"ubuntu20.10") return 0 ;;
"ubuntu21.04") return 0 ;;
"ubuntu21.10") return 0 ;;
esac
return 1
}
......
......@@ -268,7 +268,7 @@ int8_t polar_decoder(double *input,
if (decoderIterationCheck==0) {
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
return(-1);
polarReturn(-1);
}
nonFrozenBit++;
......@@ -301,7 +301,8 @@ int8_t polar_decoder(double *input,
* Return bits.
*/
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
return(0);
polarReturn 0;
}
int8_t polar_decoder_dci(double *input,
......@@ -532,7 +533,7 @@ int8_t polar_decoder_dci(double *input,
if (decoderIterationCheck==0) {
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
return(-1);
polarReturn -1;
}
nonFrozenBit++;
......@@ -565,7 +566,8 @@ int8_t polar_decoder_dci(double *input,
* Return bits.
*/
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
return(0);
polarReturn 0;
}
void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
......@@ -705,5 +707,6 @@ uint32_t polar_decoder_int16(int16_t *input,
rxcrc,polarParams->payloadBits);
#endif
out[0]=Ar;
return(crc^rxcrc);
polarReturn crc^rxcrc;
}
......@@ -81,6 +81,7 @@ struct nrPolar_params {
//messageType: 0=PBCH, 1=DCI, -1=UCI
struct nrPolar_params *nextPtr __attribute__((aligned(16)));
bool busy;
uint32_t idx;
uint8_t n_max;
uint8_t i_il;
......@@ -344,4 +345,11 @@ static inline void nr_polar_deinterleaver(uint8_t *input,
for (int i=0; i<size; i++) output[pattern[i]]=input[i];
}
void delete_decoder_tree(t_nrPolar_params *);
#define polarReturn \
pthread_mutex_lock(&PolarListMutex); \
currentPtr->busy=false; \
pthread_mutex_unlock(&PolarListMutex); \
return
#endif
......@@ -60,10 +60,10 @@ void polar_encoder(uint32_t *in,
*/
//Calculate CRC.
nr_matrix_multiplication_uint8_1D_uint8_2D(polarParams->nr_polar_A,
polarParams->crc_generator_matrix,
polarParams->nr_polar_crc,
polarParams->payloadBits,
polarParams->crcParityBits);
polarParams->crc_generator_matrix,
polarParams->nr_polar_crc,
polarParams->payloadBits,
polarParams->crcParityBits);
for (uint8_t i = 0; i < polarParams->crcParityBits; i++)
polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
......@@ -153,6 +153,9 @@ void polar_encoder(uint32_t *in,
#endif
nr_byte2bit_uint8_32(polarParams->nr_polar_E, polarParams->encoderLength, out);
polarReturn;
}
void polar_encoder_dci(uint32_t *in,
......@@ -256,6 +259,7 @@ void polar_encoder_dci(uint32_t *in,
printf("\n[polar_encoder_dci] out: ");
for (int i = 0; i < outputInd; i++) printf("[%d]->0x%08x\t", i, out[i]);
#endif
polarReturn;
}
static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
......@@ -698,4 +702,7 @@ void polar_encoder_fast(uint64_t *A,
}
memset((void*)out,0,polarParams->encoderLength>>3);
polar_rate_matching(polarParams,(void *)D, out);
polarReturn;
}
This diff is collapsed.
......@@ -147,7 +147,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
}
void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
double *s_re[2],double *s_im[2],double *r_re[2],double *r_im[2],FILE *csv_fd) {
double *s_re[NB_ANTENNAS_TX],double *s_im[[NB_ANTENNAS_TX],double *r_re[NB_ANTENNAS_RX],double *r_im[NB_ANTENNAS_RX],FILE *csv_fd) {
int i,u;
int aa,aarx,aatx;
double channelx,channely;
......
......@@ -340,10 +340,10 @@ int main(int argc, char **argv) {
double s_re1[30720],s_im1[30720],r_re1[30720],r_im1[30720];
double r_re2[30720],r_im2[30720];
double r_re3[30720],r_im3[30720];
double *s_re[2]= {s_re0,s_re1};
double *s_im[2]= {s_im0,s_im1};
double *r_re[4]= {r_re0,r_re1,r_re2,r_re3};
double *r_im[4]= {r_im0,r_im1,r_im2,r_im3};
double *s_re[NB_ANTENNAS_TX]= {s_re0,s_re1, NULL, NULL};
double *s_im[NB_ANTENNAS_TX]= {s_im0,s_im1, NULL, NULL};
double *r_re[NB_ANTENNAS_RX]= {r_re0,r_re1,r_re2,r_re3};
double *r_im[NB_ANTENNAS_RX]= {r_im0,r_im1,r_im2,r_im3};
double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
double iqim=0.0;
int cqi_error,cqi_errors,ack_errors,cqi_crc_falsepositives,cqi_crc_falsenegatives;
......
......@@ -1096,7 +1096,8 @@ static int _nas_message_decrypt(
"Unknown security header type %u", security_header_type);
LOG_FUNC_RETURN (0);
};
LOG_FUNC_RETURN (0);
}
/****************************************************************************
......
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