Commit 57c545d4 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/use-ubsan' into integration_2022_wk30

parents c663688f ab364748
...@@ -271,6 +271,12 @@ if (SANITIZE_ADDRESS) ...@@ -271,6 +271,12 @@ if (SANITIZE_ADDRESS)
# wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead. # wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead.
endif () endif ()
add_boolean_option(SANITIZE_UNDEFINED False "enable the undefined behavior sanitizer (UBSan)")
if (SANITIZE_UNDEFINED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
endif ()
add_definitions("-DASN_DISABLE_OER_SUPPORT") add_definitions("-DASN_DISABLE_OER_SUPPORT")
######################### #########################
......
...@@ -171,8 +171,12 @@ Options: ...@@ -171,8 +171,12 @@ Options:
Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes
--ninja --ninja
Tell cmake to use the Ninja build system. Without, will generate make files Tell cmake to use the Ninja build system. Without, will generate make files
--sanitize
Shortcut for usage of --sanitize-address --sanitize-undefined
--sanitize-address | -fsanitize=address --sanitize-address | -fsanitize=address
Enable the address sanitizer on all targets Enable the address sanitizer on all targets
--sanitize-undefined | -fsanitize=undefined
Enable the undefined behavior sanitizer on all targets
--ittiSIM --ittiSIM
Makes the itti simulator Makes the itti simulator
-h | --help -h | --help
...@@ -451,10 +455,16 @@ function main() { ...@@ -451,10 +455,16 @@ function main() {
CMAKE_CMD="$CMAKE_CMD -GNinja" CMAKE_CMD="$CMAKE_CMD -GNinja"
MAKE_CMD=ninja MAKE_CMD=ninja
shift;; shift;;
--sanitize)
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True -DSANITIZE_UNDEFINED=True"
shift;;
--sanitize-address | -fsanitize=address) --sanitize-address | -fsanitize=address)
grep -sq "Ubuntu 18.04" /etc/os-release && echo_error "Bug in OS with this option, see CMakeLists.txt" grep -sq "Ubuntu 18.04" /etc/os-release && echo_error "Bug in OS with this option, see CMakeLists.txt"
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True" CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True"
shift;; shift;;
--sanitize-undefined | -fundefined=address)
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_UNDEFINED=True"
shift;;
--ittiSIM) --ittiSIM)
ittiSIM=1 ittiSIM=1
CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True" CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True"
......
...@@ -62,7 +62,7 @@ typedef struct time_stats { ...@@ -62,7 +62,7 @@ typedef struct time_stats {
oai_cputime_t in; /*!< \brief time at measure starting point */ oai_cputime_t in; /*!< \brief time at measure starting point */
oai_cputime_t diff; /*!< \brief average difference between time at starting point and time at endpoint*/ oai_cputime_t diff; /*!< \brief average difference between time at starting point and time at endpoint*/
oai_cputime_t p_time; /*!< \brief absolute process duration */ oai_cputime_t p_time; /*!< \brief absolute process duration */
oai_cputime_t diff_square; /*!< \brief process duration square */ double diff_square; /*!< \brief process duration square */
oai_cputime_t max; /*!< \brief maximum difference between time at starting point and time at endpoint*/ oai_cputime_t max; /*!< \brief maximum difference between time at starting point and time at endpoint*/
int trials; /*!< \brief number of start point - end point iterations */ int trials; /*!< \brief number of start point - end point iterations */
int meas_flag; /*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */ int meas_flag; /*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */
...@@ -156,7 +156,7 @@ static inline void stop_meas(time_stats_t *ts) { ...@@ -156,7 +156,7 @@ static inline void stop_meas(time_stats_t *ts) {
ts->diff += (out-ts->in); ts->diff += (out-ts->in);
/// process duration is the difference between two clock points /// process duration is the difference between two clock points
ts->p_time = (out-ts->in); ts->p_time = (out-ts->in);
ts->diff_square += (out-ts->in)*(out-ts->in); ts->diff_square += ((double)out-ts->in)*((double)out-ts->in);
if ((out-ts->in) > ts->max) if ((out-ts->in) > ts->max)
ts->max = out-ts->in; ts->max = out-ts->in;
......
...@@ -87,7 +87,7 @@ typedef struct { ...@@ -87,7 +87,7 @@ typedef struct {
// N_CCE is L, or number of CCEs for DCI // N_CCE is L, or number of CCEs for DCI
int N_CCE; int N_CCE;
uint8_t payloadSize; uint8_t payloadSize;
uint8_t payloadBits[16]; uint8_t payloadBits[16] __attribute__((aligned(16))); // will be cast as uint64
//fapi_nr_dci_pdu_rel15_t dci; //fapi_nr_dci_pdu_rel15_t dci;
} fapi_nr_dci_indication_pdu_t; } fapi_nr_dci_indication_pdu_t;
......
...@@ -738,7 +738,7 @@ typedef struct { ...@@ -738,7 +738,7 @@ typedef struct {
// The total DCI length (in bits) including padding bits [TS38.212 sec 7.3.1] Range 0->DCI_PAYLOAD_BYTE_LEN*8 // The total DCI length (in bits) including padding bits [TS38.212 sec 7.3.1] Range 0->DCI_PAYLOAD_BYTE_LEN*8
uint16_t PayloadSizeBits; uint16_t PayloadSizeBits;
// DCI payload, where the actual size is defined by PayloadSizeBits. The bit order is as following bit0-bit7 are mapped to first byte of MSB - LSB // DCI payload, where the actual size is defined by PayloadSizeBits. The bit order is as following bit0-bit7 are mapped to first byte of MSB - LSB
uint8_t Payload[DCI_PAYLOAD_BYTE_LEN]; uint8_t Payload[DCI_PAYLOAD_BYTE_LEN] __attribute__((aligned(32)));
} nfapi_nr_dl_dci_pdu_t; } nfapi_nr_dl_dci_pdu_t;
......
...@@ -814,7 +814,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, ...@@ -814,7 +814,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
llr_t *s1,*s2,*yp1,*yp2,*yp; llr_t *s1,*s2,*yp1,*yp2,*yp;
unsigned int i,j,iind;//,pi; unsigned int i,j,iind;//,pi;
unsigned char iteration_cnt=0; unsigned char iteration_cnt=0;
unsigned int crc,oldcrc,crc_len; unsigned int crc, crc_len;
uint8_t temp; uint8_t temp;
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
__m128i *yp128; __m128i *yp128;
...@@ -1233,8 +1233,8 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, ...@@ -1233,8 +1233,8 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
} }
// check the CRC // check the CRC
oldcrc= *((unsigned int *)(&decoded_bytes[(n>>3)-crc_len])); uint32_t oldcrc;
memcpy(&oldcrc, &decoded_bytes[(n >> 3) - crc_len], crc_len);
switch (crc_type) { switch (crc_type) {
case CRC24_A: case CRC24_A:
oldcrc&=0x00ffffff; oldcrc&=0x00ffffff;
......
...@@ -244,11 +244,11 @@ crc16 (unsigned char * inptr, int bitlen) ...@@ -244,11 +244,11 @@ crc16 (unsigned char * inptr, int bitlen)
while (octetlen-- > 0) { while (octetlen-- > 0) {
crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16); crc = (crc << 8) ^ (((uint32_t)crc16Table[(*inptr++) ^ (crc >> 24)]) << 16);
} }
if (resbit > 0) if (resbit > 0)
crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); crc = (crc << resbit) ^ (((uint32_t)crc16Table[(*inptr) >> (8 - resbit) ^ (crc >> (32 - resbit))]) << 16);
return crc; return crc;
} }
......
...@@ -961,7 +961,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -961,7 +961,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1028,7 +1029,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1028,7 +1029,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1096,7 +1098,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1096,7 +1098,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1163,7 +1166,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1163,7 +1166,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1230,7 +1234,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1230,7 +1234,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1297,7 +1302,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1297,7 +1302,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1364,7 +1370,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1364,7 +1370,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1431,7 +1438,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1431,7 +1438,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1498,7 +1506,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1498,7 +1506,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1593,7 +1602,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1593,7 +1602,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1660,7 +1670,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1660,7 +1670,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1727,7 +1738,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1727,7 +1738,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1794,7 +1806,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1794,7 +1806,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1861,7 +1874,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1861,7 +1874,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
...@@ -1928,7 +1942,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu ...@@ -1928,7 +1942,8 @@ static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBu
// If no error pcRes should be 0 // If no error pcRes should be 0
// Only use valid CNs // Only use valid CNs
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem))); if (Mrem)
pcResSum |= (pcRes&(0xFFFFFFFF>>(32-Mrem)));
// If PC failed we can stop here // If PC failed we can stop here
if (pcResSum > 0) if (pcResSum > 0)
......
...@@ -532,9 +532,12 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { ...@@ -532,9 +532,12 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) {
} }
// FIXME: this function is compting PRB outside the range, so I FORCED in the range
// I can't understand the 3GPP spec, see below note
uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
int offset; int offset;
int ret=-1;
switch (N_RB_DL) { switch (N_RB_DL) {
...@@ -545,16 +548,16 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -545,16 +548,16 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
switch (vrb) { switch (vrb) {
case 0: // even: 0->0, 1->2, odd: 0->3, 1->5 case 0: // even: 0->0, 1->2, odd: 0->3, 1->5
case 1: case 1:
return ((3*odd_slot) + 2*(vrb&3))%6; ret= ((3*odd_slot) + 2*(vrb&3))%6;
break; break;
case 2: // even: 2->3, 3->5, odd: 2->0, 3->2 case 2: // even: 2->3, 3->5, odd: 2->0, 3->2
case 3: case 3:
return ((3*odd_slot) + 2*(vrb&3) + 5)%6; ret= ((3*odd_slot) + 2*(vrb&3) + 5)%6;
break; break;
case 4: // even: 4->1, odd: 4->4 case 4: // even: 4->1, odd: 4->4
return ((3*odd_slot) + 1)%6; ret= ((3*odd_slot) + 1)%6;
case 5: // even: 5->4, odd: 5->1 case 5: // even: 5->4, odd: 5->1
return ((3*odd_slot) + 4)%6; ret= ((3*odd_slot) + 4)%6;
break; break;
} }
break; break;
...@@ -562,88 +565,90 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -562,88 +565,90 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
case 15: case 15:
if (vrb<12) { if (vrb<12) {
if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11 if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11
return(((7*odd_slot) + 4*(vrb&3) + (vrb>>2))%14) + 14*(vrb/14); ret= (((7*odd_slot) + 4*(vrb&3) + (vrb>>2))%14) + 14*(vrb/14);
else if (vrb < 12) // even: 2->7, 3->11, 6->8, 7->12, 10->9, 11->13 else if (vrb < 12) // even: 2->7, 3->11, 6->8, 7->12, 10->9, 11->13
return (((7*odd_slot) + 4*(vrb&3) + (vrb>>2) +13 )%14) + 14*(vrb/14); ret= (((7*odd_slot) + 4*(vrb&3) + (vrb>>2) +13 )%14) + 14*(vrb/14);
} }
if (vrb==12) if (vrb==12)
return (3+(7*odd_slot)) % 14; ret= (3+(7*odd_slot)) % 14;
if (vrb==13) if (vrb==13)
return (10+(7*odd_slot)) % 14; ret= (10+(7*odd_slot)) % 14;
return 14; ret= 14;
break; break;
// Formula in TS 36.211, chap 6.2.3.2
// Fix me: returns a PRB number > 24 when vrb is 24
case 25: case 25:
return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24); ret= (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24);
break; break;
case 50: // P=3 case 50: // P=3
if (Ngap==0) { if (Ngap==0) {
// Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27 // Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27
if (vrb>=23) if (vrb>=23)
offset=4; offset=4;
else else
offset=0; offset=0;
if (vrb<44) { if (vrb<44) {
if ((vrb&3)>=2) if ((vrb&3)>=2)
return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2) + 45)%46; ret= offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2) + 45)%46;
else else
return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2))%46; ret= offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2))%46;
} }
if (vrb==44) // even: 44->11, odd: 45->34 if (vrb==44) // even: 44->11, odd: 45->34
return offset+((23*odd_slot) + 22-12+1); ret= offset+((23*odd_slot) + 22-12+1);
if (vrb==45) // even: 45->10, odd: 45->33 if (vrb==45) // even: 45->10, odd: 45->33
return offset+((23*odd_slot) + 22+12); ret= offset+((23*odd_slot) + 22+12);
if (vrb==46) if (vrb==46)
return offset+46+((23*odd_slot) + 23-12+1) % 46; ret= offset+46+((23*odd_slot) + 23-12+1) % 46;
if (vrb==47) if (vrb==47)
return offset+46+((23*odd_slot) + 23+12) % 46; ret= offset+46+((23*odd_slot) + 23+12) % 46;
if (vrb==48) if (vrb==48)
return offset+46+((23*odd_slot) + 23-12+1) % 46; ret= offset+46+((23*odd_slot) + 23-12+1) % 46;
if (vrb==49) if (vrb==49)
return offset+46+((23*odd_slot) + 23+12) % 46; ret= offset+46+((23*odd_slot) + 23+12) % 46;
} }
else { else {
// Nrow=6,Nnull=6,NVRBDL=18,Ngap1= 27 // Nrow=6,Nnull=6,NVRBDL=18,Ngap1= 27
if (vrb>=9) if (vrb>=9)
offset=18; offset=18;
else else
offset=0; offset=0;
if (vrb<12) { if (vrb<12) {
if ((vrb&3)>=2) if ((vrb&3)>=2)
return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18; ret= offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18;
else else
return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2))%18; ret= offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2))%18;
} }
else { else {
return offset+((9*odd_slot) + 12*(vrb&1)+(vrb>>1) )%18 + 18*(vrb/18); ret= offset+((9*odd_slot) + 12*(vrb&1)+(vrb>>1) )%18 + 18*(vrb/18);
} }
} }
break; break;
case 75: case 75:
// Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0 // Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0
if (Ngap ==0) { if (Ngap ==0) {
return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64); ret= ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64);
} else { } else {
// Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0
return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); ret= ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32);
} }
break; break;
case 100: case 100:
// Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0 // Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0
if (Ngap ==0) { if (Ngap ==0) {
return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96); ret= ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96);
} else { } else {
// Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0
return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); ret= ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32);
} }
break; break;
default: default:
LOG_E(PHY,"Unknown N_RB_DL %d\n",N_RB_DL); LOG_E(PHY,"Unknown N_RB_DL %d\n",N_RB_DL);
return 0; ret= 0;
} }
return 0; return ret%N_RB_DL;
} }
...@@ -677,7 +682,7 @@ void generate_RIV_tables(void) ...@@ -677,7 +682,7 @@ void generate_RIV_tables(void)
// printf("RIV %d (%d) : first_rb %d NBRB %d\n",RIV,localRIV2alloc_LUT25[RIV],RBstart,Lcrbs); // printf("RIV %d (%d) : first_rb %d NBRB %d\n",RIV,localRIV2alloc_LUT25[RIV],RBstart,Lcrbs);
localRIV2alloc_LUT6[RIV] = alloc0; localRIV2alloc_LUT6[RIV] = alloc0;
distRIV2alloc_even_LUT6[RIV] = allocdist0_0_even; distRIV2alloc_even_LUT6[RIV] = allocdist0_0_even;
distRIV2alloc_odd_LUT6[RIV] = allocdist0_0_odd; distRIV2alloc_odd_LUT6[RIV] = allocdist0_0_odd;
RIV2nb_rb_LUT6[RIV] = Lcrbs; RIV2nb_rb_LUT6[RIV] = Lcrbs;
RIV2first_rb_LUT6[RIV] = RBstart; RIV2first_rb_LUT6[RIV] = RBstart;
...@@ -693,15 +698,14 @@ void generate_RIV_tables(void) ...@@ -693,15 +698,14 @@ void generate_RIV_tables(void)
nVRB = Lcrbs-1+RBstart; nVRB = Lcrbs-1+RBstart;
//printf("RBstart %d, len %d --> ",RBstart,Lcrbs); //printf("RBstart %d, len %d --> ",RBstart,Lcrbs);
alloc0 |= (1<<nVRB); alloc0 |= (1<<nVRB);
allocdist0_0_even |= (1<<get_prb(25,0,nVRB,0)); allocdist0_0_even |= 1U << get_prb(25, 0, nVRB, 0);
allocdist0_0_odd |= (1<<get_prb(25,1,nVRB,0)); allocdist0_0_odd |= 1U << get_prb(25, 1, nVRB, 0);
//printf("alloc 0 %x, allocdist0_even %x, allocdist0_odd %x\n",alloc0,allocdist0_0_even,allocdist0_0_odd); //printf("alloc 0 %x, allocdist0_even %x, allocdist0_odd %x\n",alloc0,allocdist0_0_even,allocdist0_0_odd);
RIV=computeRIV(25,RBstart,Lcrbs); RIV=computeRIV(25,RBstart,Lcrbs);
if (RIV>RIV_max25) if (RIV>RIV_max25)
RIV_max25 = RIV;; RIV_max25 = RIV;
localRIV2alloc_LUT25[RIV] = alloc0; localRIV2alloc_LUT25[RIV] = alloc0;
distRIV2alloc_even_LUT25[RIV] = allocdist0_0_even; distRIV2alloc_even_LUT25[RIV] = allocdist0_0_even;
...@@ -730,37 +734,37 @@ void generate_RIV_tables(void) ...@@ -730,37 +734,37 @@ void generate_RIV_tables(void)
if (nVRB<32) if (nVRB<32)
alloc0 |= (1<<nVRB); alloc0 |= 1U << nVRB;
else else
alloc1 |= (1<<(nVRB-32)); alloc1 |= 1U << (nVRB - 32);
// Distributed Gap1, even slot // Distributed Gap1, even slot
nVRB_even_dist = get_prb(50,0,nVRB,0); nVRB_even_dist = get_prb(50,0,nVRB,0);
if (nVRB_even_dist<32) if (nVRB_even_dist<32)
allocdist0_0_even |= (1<<nVRB_even_dist); allocdist0_0_even |= 1U << nVRB_even_dist;
else else
allocdist1_0_even |= (1<<(nVRB_even_dist-32)); allocdist1_0_even |= 1U << (nVRB_even_dist - 32);
// Distributed Gap1, odd slot // Distributed Gap1, odd slot
nVRB_odd_dist = get_prb(50,1,nVRB,0); nVRB_odd_dist = get_prb(50,1,nVRB,0);
if (nVRB_odd_dist<32) if (nVRB_odd_dist<32)
allocdist0_0_odd |= (1<<nVRB_odd_dist); allocdist0_0_odd |= (1U <<nVRB_odd_dist);
else else
allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); allocdist1_0_odd |= (1U <<(nVRB_odd_dist-32));
// Distributed Gap2, even slot // Distributed Gap2, even slot
nVRB_even_dist = get_prb(50,0,nVRB,1); nVRB_even_dist = get_prb(50,0,nVRB,1);
if (nVRB_even_dist<32) if (nVRB_even_dist<32)
allocdist0_1_even |= (1<<nVRB_even_dist); allocdist0_1_even |= 1U << nVRB_even_dist;
else else
allocdist1_1_even |= (1<<(nVRB_even_dist-32)); allocdist1_1_even |= 1U << (nVRB_even_dist - 32);
// Distributed Gap2, odd slot // Distributed Gap2, odd slot
nVRB_odd_dist = get_prb(50,1,nVRB,1); nVRB_odd_dist = get_prb(50,1,nVRB,1);
if (nVRB_odd_dist<32) if (nVRB_odd_dist<32)
allocdist0_1_odd |= (1<<nVRB_odd_dist); allocdist0_1_odd |= 1U << nVRB_odd_dist;
else else
allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); allocdist1_1_odd |= 1U << (nVRB_odd_dist - 32);
RIV=computeRIV(50,RBstart,Lcrbs); RIV=computeRIV(50,RBstart,Lcrbs);
...@@ -811,13 +815,13 @@ void generate_RIV_tables(void) ...@@ -811,13 +815,13 @@ void generate_RIV_tables(void)
nVRB = Lcrbs-1+RBstart; nVRB = Lcrbs-1+RBstart;
if (nVRB<32) if (nVRB<32)
alloc0 |= (1<<nVRB); alloc0 |= 1U << nVRB;
else if (nVRB<64) else if (nVRB<64)
alloc1 |= (1<<(nVRB-32)); alloc1 |= 1U << (nVRB - 32);
else if (nVRB<96) else if (nVRB<96)
alloc2 |= (1<<(nVRB-64)); alloc2 |= 1U << (nVRB - 64);
else else
alloc3 |= (1<<(nVRB-96)); alloc3 |= 1U << (nVRB - 96);
// Distributed Gap1, even slot // Distributed Gap1, even slot
nVRB_even_dist = get_prb(100,0,nVRB,0); nVRB_even_dist = get_prb(100,0,nVRB,0);
...@@ -825,15 +829,14 @@ void generate_RIV_tables(void) ...@@ -825,15 +829,14 @@ void generate_RIV_tables(void)
// if ((RBstart==0) && (Lcrbs<=8)) // if ((RBstart==0) && (Lcrbs<=8))
// printf("nVRB %d => nVRB_even_dist %d\n",nVRB,nVRB_even_dist); // printf("nVRB %d => nVRB_even_dist %d\n",nVRB,nVRB_even_dist);
if (nVRB_even_dist<32) if (nVRB_even_dist<32)
allocdist0_0_even |= (1<<nVRB_even_dist); allocdist0_0_even |= 1U << nVRB_even_dist;
else if (nVRB_even_dist<64) else if (nVRB_even_dist<64)
allocdist1_0_even |= (1<<(nVRB_even_dist-32)); allocdist1_0_even |= 1U << (nVRB_even_dist - 32);
else if (nVRB_even_dist<96) else if (nVRB_even_dist<96)
allocdist2_0_even |= (1<<(nVRB_even_dist-64)); allocdist2_0_even |= 1U << (nVRB_even_dist - 64);
else else
allocdist3_0_even |= (1<<(nVRB_even_dist-96)); allocdist3_0_even |= 1U << (nVRB_even_dist - 96);
/* if ((RBstart==0) && (Lcrbs<=8)) /* if ((RBstart==0) && (Lcrbs<=8))
printf("rballoc =>(%08x.%08x.%08x.%08x)\n", printf("rballoc =>(%08x.%08x.%08x.%08x)\n",
allocdist0_0_even, allocdist0_0_even,
...@@ -845,38 +848,37 @@ void generate_RIV_tables(void) ...@@ -845,38 +848,37 @@ void generate_RIV_tables(void)
// Distributed Gap1, odd slot // Distributed Gap1, odd slot
nVRB_odd_dist = get_prb(100,1,nVRB,0); nVRB_odd_dist = get_prb(100,1,nVRB,0);
if (nVRB_odd_dist<32) if (nVRB_odd_dist<32)
allocdist0_0_odd |= (1<<nVRB_odd_dist); allocdist0_0_odd |= 1U << nVRB_odd_dist;
else if (nVRB_odd_dist<64) else if (nVRB_odd_dist<64)
allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); allocdist1_0_odd |= 1U << (nVRB_odd_dist - 32);
else if (nVRB_odd_dist<96) else if (nVRB_odd_dist<96)
allocdist2_0_odd |= (1<<(nVRB_odd_dist-64)); allocdist2_0_odd |= 1U << (nVRB_odd_dist - 64);
else else
allocdist3_0_odd |= (1<<(nVRB_odd_dist-96)); allocdist3_0_odd |= 1U << (nVRB_odd_dist - 96);
// Distributed Gap2, even slot // Distributed Gap2, even slot
nVRB_even_dist = get_prb(100,0,nVRB,1); nVRB_even_dist = get_prb(100,0,nVRB,1);
if (nVRB_even_dist<32) if (nVRB_even_dist<32)
allocdist0_1_even |= (1<<nVRB_even_dist); allocdist0_1_even |= 1U << nVRB_even_dist;
else if (nVRB_even_dist<64) else if (nVRB_even_dist<64)
allocdist1_1_even |= (1<<(nVRB_even_dist-32)); allocdist1_1_even |= 1U << (nVRB_even_dist - 32);
else if (nVRB_even_dist<96) else if (nVRB_even_dist<96)
allocdist2_1_even |= (1<<(nVRB_even_dist-64)); allocdist2_1_even |= 1U << (nVRB_even_dist - 64);
else else
allocdist3_1_even |= (1<<(nVRB_even_dist-96)); allocdist3_1_even |= 1U << (nVRB_even_dist - 96);
// Distributed Gap2, odd slot // Distributed Gap2, odd slot
nVRB_odd_dist = get_prb(100,1,nVRB,1); nVRB_odd_dist = get_prb(100,1,nVRB,1);
if (nVRB_odd_dist<32) if (nVRB_odd_dist<32)
allocdist0_1_odd |= (1<<nVRB_odd_dist); allocdist0_1_odd |= 1U << nVRB_odd_dist;
else if (nVRB_odd_dist<64) else if (nVRB_odd_dist<64)
allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); allocdist1_1_odd |= 1U << (nVRB_odd_dist - 32);
else if (nVRB_odd_dist<96) else if (nVRB_odd_dist<96)
allocdist2_1_odd |= (1<<(nVRB_odd_dist-64)); allocdist2_1_odd |= 1U << (nVRB_odd_dist - 64);
else else
allocdist3_1_odd |= (1<<(nVRB_odd_dist-96)); allocdist3_1_odd |= 1U << (nVRB_odd_dist - 96);
RIV=computeRIV(100,RBstart,Lcrbs); RIV=computeRIV(100,RBstart,Lcrbs);
......
...@@ -288,7 +288,7 @@ static void TPencode(void * arg) { ...@@ -288,7 +288,7 @@ static void TPencode(void * arg) {
LTE_DL_eNB_HARQ_t *hadlsch=rdata->dlsch->harq_processes[harq_pid]; LTE_DL_eNB_HARQ_t *hadlsch=rdata->dlsch->harq_processes[harq_pid];
if ( rdata-> round == 0) { if ( rdata-> round == 0) {
uint8_t tmp[96+12+3+3*6144]; uint8_t tmp[96+12+3+3*6144] __attribute__((aligned(32)));
memset(tmp,LTE_NULL, TURBO_SIMD_SOFTBITS); memset(tmp,LTE_NULL, TURBO_SIMD_SOFTBITS);
start_meas(rdata->te_stats); start_meas(rdata->te_stats);
encoder(rdata->input, encoder(rdata->input,
......
...@@ -1272,14 +1272,6 @@ uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb); ...@@ -1272,14 +1272,6 @@ uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb);
@return Transport block size */ @return Transport block size */
uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb); uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb);
/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type
@param N_RB_DL number of PRB on DL
@param indicator for even/odd slot
@param vrb vrb index
@param Ngap Gap indicator
*/
uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap);
/* \brief Return prb for a given vrb index /* \brief Return prb for a given vrb index
@param vrb_type VRB type (0=localized,1=distributed) @param vrb_type VRB type (0=localized,1=distributed)
@param rb_alloc_dci rballoc field from DCI @param rb_alloc_dci rballoc field from DCI
......
...@@ -90,7 +90,7 @@ typedef struct { ...@@ -90,7 +90,7 @@ typedef struct {
/// Redundancy-version of the current sub-frame /// Redundancy-version of the current sub-frame
uint8_t rvidx; uint8_t rvidx;
/// Turbo-code outputs (36-212 V8.6 2009-03, p.12 /// Turbo-code outputs (36-212 V8.6 2009-03, p.12
uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))]; uint8_t *d[MAX_NUM_ULSCH_SEGMENTS];
/// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17)
uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144]; uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
......
...@@ -71,6 +71,7 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) { ...@@ -71,6 +71,7 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) { for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
if (ulsch->harq_processes[i]->c[r]) { if (ulsch->harq_processes[i]->c[r]) {
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
free16(ulsch->harq_processes[i]->d[r],0);
ulsch->harq_processes[i]->c[r] = NULL; ulsch->harq_processes[i]->c[r] = NULL;
} }
} }
...@@ -86,7 +87,7 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) { ...@@ -86,7 +87,7 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) {
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) { LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) {
LTE_UE_ULSCH_t *ulsch; LTE_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,j,r; unsigned char exit_flag = 0;
unsigned char bw_scaling =1; unsigned char bw_scaling =1;
switch (N_RB_UL) { switch (N_RB_UL) {
...@@ -113,7 +114,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) { ...@@ -113,7 +114,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) {
memset(ulsch,0,sizeof(LTE_UE_ULSCH_t)); memset(ulsch,0,sizeof(LTE_UE_ULSCH_t));
ulsch->Mlimit = 4; ulsch->Mlimit = 4;
for (i=0; i<8; i++) { for (int i=0; i<8; i++) {
ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t)); ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t));
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]); // printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
...@@ -129,15 +130,11 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) { ...@@ -129,15 +130,11 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) {
} }
if (abstraction_flag==0) { if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) { for (int r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
ulsch->harq_processes[i]->c[r] = (unsigned char *)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case ulsch->harq_processes[i]->c[r] = malloc16_clear(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case
AssertFatal(ulsch->harq_processes[i]->c[r], "");
if (ulsch->harq_processes[i]->c[r]) ulsch->harq_processes[i]->d[r] = malloc16_clear(96+3+(3*6144));
memset(ulsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+768); AssertFatal(ulsch->harq_processes[i]->d[r], "");
else {
LOG_E(PHY,"Can't get c\n");
exit_flag=2;
}
} }
} }
...@@ -148,15 +145,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) { ...@@ -148,15 +145,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) {
exit_flag=3; exit_flag=3;
} }
} }
if (!exit_flag)
if ((abstraction_flag == 0) && (exit_flag==0)) {
for (i=0; i<8; i++)
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++)
ulsch->harq_processes[i]->d[r][j] = LTE_NULL;
return(ulsch);
} else if (abstraction_flag==1)
return(ulsch); return(ulsch);
} }
...@@ -191,7 +180,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -191,7 +180,7 @@ uint32_t ulsch_encoding(uint8_t *a,
uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0; uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0;
// uint32_t E; // uint32_t E;
uint8_t ack_parity; uint8_t ack_parity;
uint32_t i,q,j,iprime,j2; uint32_t q,j,iprime,j2;
uint16_t o_RCC; uint16_t o_RCC;
uint8_t o_flip[8]; uint8_t o_flip[8];
uint32_t wACK_idx; uint32_t wACK_idx;
...@@ -327,6 +316,8 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -327,6 +316,8 @@ uint32_t ulsch_encoding(uint8_t *a,
#endif #endif
// offset=0; // offset=0;
start_meas(te_stats); start_meas(te_stats);
for (int z=0; z<96; z++)
ulsch->harq_processes[harq_pid]->d[r][z] = LTE_NULL;
encoder(ulsch->harq_processes[harq_pid]->c[r], encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3, Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96], &ulsch->harq_processes[harq_pid]->d[r][96],
...@@ -539,8 +530,6 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -539,8 +530,6 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->q); ulsch->q);
} }
i=0;
// Do RI coding // Do RI coding
if (ulsch->O_RI == 1) { if (ulsch->O_RI == 1) {
switch (Q_m) { switch (Q_m) {
...@@ -691,7 +680,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -691,7 +680,7 @@ uint32_t ulsch_encoding(uint8_t *a,
j=0; j=0;
for (i=0; i<Qprime_RI; i++) { for (int i=0; i<Qprime_RI; i++) {
r = Rmux_prime - 1 - (i>>2); r = Rmux_prime - 1 - (i>>2);
for (q=0; q<Q_m; q++) { for (q=0; q<Q_m; q++) {
...@@ -725,7 +714,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -725,7 +714,7 @@ uint32_t ulsch_encoding(uint8_t *a,
} }
*/ */
for (i=0; i<Qprime_CQI; i++) { for (int i=0; i<Qprime_CQI; i++) {
while (y[Q_m*j] != LTE_NULL) j++; while (y[Q_m*j] != LTE_NULL) j++;
for (q=0; q<Q_m; q++) { for (q=0; q<Q_m; q++) {
...@@ -788,7 +777,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -788,7 +777,7 @@ uint32_t ulsch_encoding(uint8_t *a,
j=0; j=0;
for (i=0; i<Qprime_ACK; i++) { for (int i=0; i<Qprime_ACK; i++) {
r = Rmux_prime - 1 - (i>>2); r = Rmux_prime - 1 - (i>>2);
for (q=0; q<Q_m; q++) { for (q=0; q<Q_m; q++) {
...@@ -808,7 +797,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -808,7 +797,7 @@ uint32_t ulsch_encoding(uint8_t *a,
switch (Q_m) { switch (Q_m) {
case 2: case 2:
for (i=0; i<Cmux; i++) for (int i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) { for (r=0; r<Rmux_prime; r++) {
yptr=&y[((r*Cmux)+i)<<1]; yptr=&y[((r*Cmux)+i)<<1];
ulsch->h[j++] = *yptr++; ulsch->h[j++] = *yptr++;
...@@ -818,7 +807,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -818,7 +807,7 @@ uint32_t ulsch_encoding(uint8_t *a,
break; break;
case 4: case 4:
for (i=0; i<Cmux; i++) for (int i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) { for (r=0; r<Rmux_prime; r++) {
yptr = &y[((r*Cmux)+i)<<2]; yptr = &y[((r*Cmux)+i)<<2];
ulsch->h[j++] = *yptr++; ulsch->h[j++] = *yptr++;
...@@ -830,7 +819,7 @@ uint32_t ulsch_encoding(uint8_t *a, ...@@ -830,7 +819,7 @@ uint32_t ulsch_encoding(uint8_t *a,
break; break;
case 6: case 6:
for (i=0; i<Cmux; i++) for (int i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) { for (r=0; r<Rmux_prime; r++) {
yptr = &y[((r*Cmux)+i)*6]; yptr = &y[((r*Cmux)+i)*6];
ulsch->h[j++] = *yptr++; ulsch->h[j++] = *yptr++;
......
...@@ -226,10 +226,11 @@ void nr_modulation(uint32_t *in, ...@@ -226,10 +226,11 @@ void nr_modulation(uint32_t *in,
i *= 24; i *= 24;
bit_cnt = i * 8; bit_cnt = i * 8;
while (bit_cnt < length) { while (bit_cnt < length) {
x = *((uint32_t*)(in_bytes+i)); uint32_t xx;
x1 = x&4095; memcpy(&xx, in_bytes+i, sizeof(xx));
x1 = xx & 4095;
out64[j++] = nr_64qam_mod_table[x1]; out64[j++] = nr_64qam_mod_table[x1];
x1 = (x>>12)&4095; x1 = (xx >> 12) & 4095;
out64[j++] = nr_64qam_mod_table[x1]; out64[j++] = nr_64qam_mod_table[x1];
i += 3; i += 3;
bit_cnt += 24; bit_cnt += 24;
......
...@@ -162,7 +162,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb ...@@ -162,7 +162,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
measurements->n0_subband_power[aarx][rb]=0; measurements->n0_subband_power[aarx][rb]=0;
} }
int offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; int offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe if ((gNB->rb_mask_ul[s][rb >> 5] & (1U << (rb & 31))) == 0) { // check that rb was not used in this subframe
nb_symb[rb]++; nb_symb[rb]++;
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
int offset = offset0 + (s*frame_parms->ofdm_symbol_size); int offset = offset0 + (s*frame_parms->ofdm_symbol_size);
......
...@@ -123,7 +123,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -123,7 +123,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
rel15->dlDmrsSymbPos); rel15->dlDmrsSymbPos);
n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity; n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity;
} }
int16_t mod_ptrs[n_ptrs<<1] __attribute__ ((aligned(16)));
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
...@@ -302,12 +301,14 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -302,12 +301,14 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
/* calculate if current symbol is PTRS symbols */ /* calculate if current symbol is PTRS symbols */
ptrs_idx = 0; ptrs_idx = 0;
int16_t *mod_ptrs = NULL;
if(rel15->pduBitmap & 0x1) { if(rel15->pduBitmap & 0x1) {
ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos); ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos);
if(ptrs_symbol) { if(ptrs_symbol) {
/* PTRS QPSK Modulation for each OFDM symbol in a slot */ /* PTRS QPSK Modulation for each OFDM symbol in a slot */
LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs);
int16_t mod_ptrsBuf[n_ptrs<<1] __attribute__ ((aligned(16)));
mod_ptrs =mod_ptrsBuf;
nr_modulation(pdsch_dmrs[l][rel15->SCID], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); nr_modulation(pdsch_dmrs[l][rel15->SCID], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs);
} }
} }
......
...@@ -466,88 +466,87 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -466,88 +466,87 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
if (cpumeas(CPUMEAS_GETSTATE)) if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and zero forcing %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and zero forcing %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
/* Store the valid DL RE's */ /* Store the valid DL RE's */
pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = nb_re_pdsch; pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = nb_re_pdsch;
if(dlsch0_harq->status == ACTIVE) { if(dlsch0_harq->status == ACTIVE) {
startSymbIdx = dlsch0_harq->start_symbol; startSymbIdx = dlsch0_harq->start_symbol;
nbSymb = dlsch0_harq->nb_symbols; nbSymb = dlsch0_harq->nb_symbols;
pduBitmap = dlsch0_harq->pduBitmap; pduBitmap = dlsch0_harq->pduBitmap;
} }
if(dlsch1_harq) { if(dlsch1_harq) {
startSymbIdx = dlsch1_harq->start_symbol; startSymbIdx = dlsch1_harq->start_symbol;
nbSymb = dlsch1_harq->nb_symbols; nbSymb = dlsch1_harq->nb_symbols;
pduBitmap = dlsch1_harq->pduBitmap; pduBitmap = dlsch1_harq->pduBitmap;
} }
/* Check for PTRS bitmap and process it respectively */ /* Check for PTRS bitmap and process it respectively */
if((pduBitmap & 0x1) && (type == PDSCH)) { if((pduBitmap & 0x1) && (type == PDSCH)) {
nr_pdsch_ptrs_processing(ue, nr_pdsch_ptrs_processing(ue,
pdsch_vars, pdsch_vars,
frame_parms, frame_parms,
dlsch0_harq, dlsch0_harq,
dlsch1_harq, dlsch1_harq,
gNB_id, gNB_id,
nr_slot_rx, nr_slot_rx,
symbol, symbol,
(nb_rb_pdsch*12), (nb_rb_pdsch*12),
dlsch[0]->rnti,rx_type); dlsch[0]->rnti,rx_type);
pdsch_vars[gNB_id]->dl_valid_re[symbol-1] -= pdsch_vars[gNB_id]->ptrs_re_per_slot[0][symbol]; pdsch_vars[gNB_id]->dl_valid_re[symbol-1] -= pdsch_vars[gNB_id]->ptrs_re_per_slot[0][symbol];
} }
/* at last symbol in a slot calculate LLR's for whole slot */ /* at last symbol in a slot calculate LLR's for whole slot */
if(symbol == (startSymbIdx + nbSymb -1)) { if(symbol == (startSymbIdx + nbSymb -1)) {
for(uint8_t i =startSymbIdx; i < (startSymbIdx+nbSymb);i++) { for(uint8_t i =startSymbIdx; i < (startSymbIdx+nbSymb);i++) {
/* re evaluating the first symbol flag as LLR's are done in symbol loop */ /* re evaluating the first symbol flag as LLR's are done in symbol loop */
if(i == startSymbIdx && i < 3) { if(i == startSymbIdx && i < 3) {
first_symbol_flag =1; first_symbol_flag =1;
}
else {
first_symbol_flag=0;
}
/* Calculate LLR's for each symbol */
nr_dlsch_llr(pdsch_vars, frame_parms,
rxdataF_comp_ptr, dl_ch_mag_ptr,
dlsch0_harq, dlsch1_harq,
rx_type, harq_pid,
gNB_id, gNB_id_i,
first_symbol_flag,
i, nb_rb_pdsch,
codeword_TB0, codeword_TB1,
pdsch_vars[gNB_id]->dl_valid_re[i-1],
nr_slot_rx, beamforming_mode);
} }
else {
int dmrs_type = dlsch[0]->harq_processes[harq_pid]->dmrsConfigType; first_symbol_flag=0;
uint8_t nb_re_dmrs;
uint16_t dmrs_len = get_num_dmrs(dlsch[0]->harq_processes[harq_pid]->dlDmrsSymbPos);
if (dmrs_type==NFAPI_NR_DMRS_TYPE1) {
nb_re_dmrs = 6*dlsch[0]->harq_processes[harq_pid]->n_dmrs_cdm_groups;
} else {
nb_re_dmrs = 4*dlsch[0]->harq_processes[harq_pid]->n_dmrs_cdm_groups;
} }
dlsch[0]->harq_processes[harq_pid]->G = nr_get_G(dlsch[0]->harq_processes[harq_pid]->nb_rb, /* Calculate LLR's for each symbol */
dlsch[0]->harq_processes[harq_pid]->nb_symbols, nr_dlsch_llr(pdsch_vars, frame_parms,
nb_re_dmrs, rxdataF_comp_ptr, dl_ch_mag_ptr,
dmrs_len, dlsch0_harq, dlsch1_harq,
dlsch[0]->harq_processes[harq_pid]->Qm, rx_type, harq_pid,
dlsch[0]->harq_processes[harq_pid]->Nl); gNB_id, gNB_id_i,
nr_dlsch_layer_demapping(pdsch_vars[gNB_id]->llr, first_symbol_flag,
dlsch[0]->harq_processes[harq_pid]->Nl, i, nb_rb_pdsch,
dlsch[0]->harq_processes[harq_pid]->Qm, codeword_TB0, codeword_TB1,
dlsch[0]->harq_processes[harq_pid]->G, pdsch_vars[gNB_id]->dl_valid_re[i-1],
codeword_TB0, nr_slot_rx, beamforming_mode);
codeword_TB1, }
pdsch_vars[gNB_id]->layer_llr);
int dmrs_type = dlsch[0]->harq_processes[harq_pid]->dmrsConfigType;
uint8_t nb_re_dmrs;
uint16_t dmrs_len = get_num_dmrs(dlsch[0]->harq_processes[harq_pid]->dlDmrsSymbPos);
if (dmrs_type==NFAPI_NR_DMRS_TYPE1) {
nb_re_dmrs = 6*dlsch[0]->harq_processes[harq_pid]->n_dmrs_cdm_groups;
} else {
nb_re_dmrs = 4*dlsch[0]->harq_processes[harq_pid]->n_dmrs_cdm_groups;
} }
dlsch[0]->harq_processes[harq_pid]->G = nr_get_G(dlsch[0]->harq_processes[harq_pid]->nb_rb,
dlsch[0]->harq_processes[harq_pid]->nb_symbols,
nb_re_dmrs,
dmrs_len,
dlsch[0]->harq_processes[harq_pid]->Qm,
dlsch[0]->harq_processes[harq_pid]->Nl);
nr_dlsch_layer_demapping(pdsch_vars[gNB_id]->llr,
dlsch[0]->harq_processes[harq_pid]->Nl,
dlsch[0]->harq_processes[harq_pid]->Qm,
dlsch[0]->harq_processes[harq_pid]->G,
codeword_TB0,
codeword_TB1,
pdsch_vars[gNB_id]->layer_llr);
}
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
if (cpumeas(CPUMEAS_GETSTATE)) if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
// Please keep it: useful for debugging // Please keep it: useful for debugging
#ifdef DEBUG_PDSCH_RX #ifdef DEBUG_PDSCH_RX
char filename[50]; char filename[50];
uint8_t aa = 0; uint8_t aa = 0;
......
...@@ -573,7 +573,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -573,7 +573,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size); LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size);
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) { for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start; rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start;
gNB->rb_mask_ul[symbol][rb2>>5] |= (1<<(rb2&31)); gNB->rb_mask_ul[symbol][rb2 >> 5] |= 1U << (rb2 & 31);
} }
} }
} }
......
...@@ -1321,8 +1321,7 @@ int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_ ...@@ -1321,8 +1321,7 @@ int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_
//uint8_t half_frame_index = fp->half_frame_bit; //uint8_t half_frame_index = fp->half_frame_bit;
//uint8_t i_ssb = fp->ssb_index; //uint8_t i_ssb = fp->ssb_index;
uint8_t Lmax = fp->Lmax; uint8_t Lmax = fp->Lmax;
if ((config->ssb_table.ssb_period > 0) && !(frame % (1 << (config->ssb_table.ssb_period - 1)))) {
if (!(frame%(1<<(config->ssb_table.ssb_period-1)))){
if(Lmax <= 8) { if(Lmax <= 8) {
if(slot <=3 && (((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000)) if(slot <=3 && (((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000))
......
...@@ -512,12 +512,16 @@ int main(int argc, char **argv) { ...@@ -512,12 +512,16 @@ int main(int argc, char **argv) {
int re; int re;
int s,Kr,Kr_bytes; int s,Kr,Kr_bytes;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
double s_re0[30720*2],s_im0[30720*2],r_re0[30720*2],r_im0[30720*2]; double *tmpTX[4], *tmpRX[4] ;
double s_re1[30720*2],s_im1[30720*2],r_re1[30720*2],r_im1[30720*2]; for (int i = 0; i < 4; i++) {
double *s_re[NB_ANTENNAS_TX]= {s_re0,s_re1}; tmpTX[i] = malloc(30720 * NB_ANTENNAS_TX * sizeof(*tmpTX));
double *s_im[NB_ANTENNAS_TX]= {s_im0,s_im1}; tmpRX[i] = malloc(30720 * NB_ANTENNAS_RX * sizeof(*tmpRX));
double *r_re[NB_ANTENNAS_RX]= {r_re0,r_re1}; }
double *r_im[NB_ANTENNAS_RX]= {r_im0,r_im1}; double *s_re[NB_ANTENNAS_TX] = {tmpTX[0], tmpTX[1]};
double *s_im[NB_ANTENNAS_TX] = {tmpTX[2], tmpTX[3]};
double *r_re[NB_ANTENNAS_RX] = {tmpRX[0], tmpRX[1]};
double *r_im[NB_ANTENNAS_RX] = {tmpRX[2], tmpRX[3]};
uint8_t transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2; uint8_t transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2;
int eNB_id = 0; int eNB_id = 0;
unsigned char round; unsigned char round;
......
...@@ -358,7 +358,7 @@ int main(int argc, char **argv) { ...@@ -358,7 +358,7 @@ int main(int argc, char **argv) {
unsigned short input_buffer_length; unsigned short input_buffer_length;
unsigned int ret; unsigned int ret;
unsigned int coded_bits_per_codeword,nsymb; unsigned int coded_bits_per_codeword,nsymb;
unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[5]= {0,0,0,0,0},round_trials[4]= {0,0,0,0}; unsigned int tx_lev = 0, tx_lev_dB = 0, trials, errs[6] = {0}, round_trials[4] = {0};
FILE *bler_fd=NULL; FILE *bler_fd=NULL;
char bler_fname[512]; char bler_fname[512];
FILE *time_meas_fd=NULL; FILE *time_meas_fd=NULL;
...@@ -387,7 +387,6 @@ int main(int argc, char **argv) { ...@@ -387,7 +387,6 @@ int main(int argc, char **argv) {
double cpu_freq_GHz; double cpu_freq_GHz;
int iter_trials; int iter_trials;
uint32_t UL_alloc_pdu; uint32_t UL_alloc_pdu;
int s,Kr,Kr_bytes;
int dump_perf=0; int dump_perf=0;
static int dump_table =0; static int dump_table =0;
double effective_rate=0.0; double effective_rate=0.0;
...@@ -1233,20 +1232,21 @@ int main(int argc, char **argv) { ...@@ -1233,20 +1232,21 @@ int main(int argc, char **argv) {
if (n_frames==1) { if (n_frames==1) {
printf("ULSCH errors found o_ACK[0]= %d\n",eNB->ulsch[0]->harq_processes[harq_pid]->o_ACK[0]); printf("ULSCH errors found o_ACK[0]= %d\n",eNB->ulsch[0]->harq_processes[harq_pid]->o_ACK[0]);
#ifdef DUMP_EACH_VALUE
int Kr_bytes;
for (s=0; s<eNB->ulsch[0]->harq_processes[harq_pid]->C; s++) { for (s=0; s<eNB->ulsch[0]->harq_processes[harq_pid]->C; s++) {
if (s<eNB->ulsch[0]->harq_processes[harq_pid]->Cminus) if (s<eNB->ulsch[0]->harq_processes[harq_pid]->Cminus)
Kr = eNB->ulsch[0]->harq_processes[harq_pid]->Kminus; Kr_bytes = eNB->ulsch[0]->harq_processes[harq_pid]->Kminus;
else else
Kr = eNB->ulsch[0]->harq_processes[harq_pid]->Kplus; Kr_bytes = eNB->ulsch[0]->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr_bytes >> 3;
Kr_bytes = Kr>>3;
printf("Decoded_output (Segment %d):\n",s); printf("Decoded_output (Segment %d):\n",s);
for (i=0; i<Kr_bytes; i++) for (i=0; i<Kr_bytes; i++)
printf("%d : %x (%x)\n",i,eNB->ulsch[0]->harq_processes[harq_pid]->c[s][i], printf("%d : %x (%x)\n",i,eNB->ulsch[0]->harq_processes[harq_pid]->c[s][i],
eNB->ulsch[0]->harq_processes[harq_pid]->c[s][i]^UE->ulsch[0]->harq_processes[harq_pid]->c[s][i]); eNB->ulsch[0]->harq_processes[harq_pid]->c[s][i]^UE->ulsch[0]->harq_processes[harq_pid]->c[s][i]);
} }
#endif
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round); dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
round=5; round=5;
......
...@@ -1142,7 +1142,7 @@ int main(int argc, char **argv) ...@@ -1142,7 +1142,7 @@ int main(int argc, char **argv)
Sched_INFO.frame = frame; Sched_INFO.frame = frame;
Sched_INFO.slot = slot; Sched_INFO.slot = slot;
Sched_INFO.DL_req = &gNB_mac->DL_req[0]; Sched_INFO.DL_req = &gNB_mac->DL_req[0];
Sched_INFO.UL_tti_req = gNB_mac->UL_tti_req_ahead[slot]; Sched_INFO.UL_tti_req = gNB_mac->UL_tti_req_ahead[0];
Sched_INFO.UL_dci_req = NULL; Sched_INFO.UL_dci_req = NULL;
Sched_INFO.TX_req = &gNB_mac->TX_req[0]; Sched_INFO.TX_req = &gNB_mac->TX_req[0];
pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx);
......
...@@ -190,7 +190,7 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -190,7 +190,7 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
cfg->ssb_table.ssb_subcarrier_offset = mac->ssb_subcarrier_offset; cfg->ssb_table.ssb_subcarrier_offset = mac->ssb_subcarrier_offset;
if (mac->frequency_range == FR1){ if (mac->frequency_range == FR1){
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst.inOneGroup.buf[0]<<24; cfg->ssb_table.ssb_mask_list[0].ssb_mask = ((uint32_t) scc->ssb_PositionsInBurst.inOneGroup.buf[0]) << 24;
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
} }
else{ else{
...@@ -353,7 +353,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -353,7 +353,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
break; break;
case 2 : case 2 :
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24; cfg->ssb_table.ssb_mask_list[0].ssb_mask = ((uint32_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]) << 24;
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
break; break;
case 3 : case 3 :
......
...@@ -257,13 +257,6 @@ void get_bwp_info(NR_UE_MAC_INST_t *mac, ...@@ -257,13 +257,6 @@ void get_bwp_info(NR_UE_MAC_INST_t *mac,
NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id); NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id);
uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
uint8_t dci_format,
uint8_t dci_length,
uint16_t rnti,
uint64_t *dci_pdu,
dci_pdu_rel15_t *nr_pdci_info_extracted);
NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(const NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon); NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(const NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon);
NR_PDSCH_TimeDomainResourceAllocationList_t *choose_dl_tda_list(NR_PDSCH_Config_t *pdsch_Config,NR_PDSCH_ConfigCommon_t *pdsch_ConfigCommon); NR_PDSCH_TimeDomainResourceAllocationList_t *choose_dl_tda_list(NR_PDSCH_Config_t *pdsch_Config,NR_PDSCH_ConfigCommon_t *pdsch_ConfigCommon);
......
...@@ -134,6 +134,13 @@ const initial_pucch_resource_t initial_pucch_resource[16] = { ...@@ -134,6 +134,13 @@ const initial_pucch_resource_t initial_pucch_resource[16] = {
}; };
static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
uint8_t dci_format,
uint8_t dci_length,
uint16_t rnti,
uint64_t *dci_pdu,
dci_pdu_rel15_t *nr_pdci_info_extracted);
void nr_ue_init_mac(module_id_t module_idP) { void nr_ue_init_mac(module_id_t module_idP) {
int i; int i;
...@@ -985,7 +992,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -985,7 +992,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
if (dci->tpc == 3) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 3; if (dci->tpc == 3) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 3;
// Sanity check for pucch_resource_indicator value received to check for false DCI. // Sanity check for pucch_resource_indicator value received to check for false DCI.
valid = 0; valid = 0;
if (mac->ULbwp[ul_bwp_id-1] && if (ul_bwp_id > 0 &&
mac->ULbwp[ul_bwp_id-1] &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated && mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config && mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup&& mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup&&
...@@ -1512,13 +1520,12 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1512,13 +1520,12 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
NR_BWP_UplinkCommon_t *initialUplinkBWP; NR_BWP_UplinkCommon_t *initialUplinkBWP;
if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP; if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP;
else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP;
NR_BWP_Uplink_t *ubwp = mac->ULbwp[bwp_id-1]; if (mac->cg && bwp_id > 1 && mac->ULbwp[bwp_id - 1] &&
if (mac->cg && ubwp &&
mac->cg->spCellConfig && mac->cg->spCellConfig &&
mac->cg->spCellConfig->spCellConfigDedicated && mac->cg->spCellConfig->spCellConfigDedicated &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) {
scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing; scs = mac->ULbwp[bwp_id - 1]->bwp_Common->genericParameters.subcarrierSpacing;
} }
else else
scs = initialUplinkBWP->genericParameters.subcarrierSpacing; scs = initialUplinkBWP->genericParameters.subcarrierSpacing;
...@@ -2340,17 +2347,16 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, ...@@ -2340,17 +2347,16 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac,
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id; NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
NR_PUCCH_Config_t *pucch_Config = NULL; NR_PUCCH_Config_t *pucch_Config = NULL;
int scs; int scs;
NR_BWP_Uplink_t *ubwp = mac->ULbwp[bwp_id-1];
NR_BWP_UplinkCommon_t *initialUplinkBWP; NR_BWP_UplinkCommon_t *initialUplinkBWP;
if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP; if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP;
else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP;
if (mac->cg && ubwp && if (mac->cg && bwp_id && mac->ULbwp[bwp_id - 1] &&
mac->cg->spCellConfig && mac->cg->spCellConfig &&
mac->cg->spCellConfig->spCellConfigDedicated && mac->cg->spCellConfig->spCellConfigDedicated &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) {
scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing; scs = mac->ULbwp[bwp_id - 1]->bwp_Common->genericParameters.subcarrierSpacing;
} }
else else
scs = initialUplinkBWP->genericParameters.subcarrierSpacing; scs = initialUplinkBWP->genericParameters.subcarrierSpacing;
...@@ -2732,7 +2738,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ ...@@ -2732,7 +2738,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){
} }
uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
uint8_t dci_format, uint8_t dci_format,
uint8_t dci_size, uint8_t dci_size,
uint16_t rnti, uint16_t rnti,
......
...@@ -118,12 +118,13 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { ...@@ -118,12 +118,13 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
// Get K2 from RRC configuration // Get K2 from RRC configuration
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : NULL; NR_PUSCH_Config_t *pusch_config= ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) { if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) {
pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup; pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup;
} }
else if (mac->ULbwp[ul_bwp_id-1] && else if (ul_bwp_id > 0 &&
mac->ULbwp[ul_bwp_id-1] &&
mac->ULbwp[ul_bwp_id-1]->bwp_Common&& mac->ULbwp[ul_bwp_id-1]->bwp_Common&&
mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon&& mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon&&
mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup && mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup &&
...@@ -169,7 +170,7 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl ...@@ -169,7 +170,7 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
// Calculate the index of the UL slot in mac->ul_config_request list. This is // Calculate the index of the UL slot in mac->ul_config_request list. This is
// based on the TDD pattern (slot configuration period) and number of UL+mixed // based on the TDD pattern (slot configuration period) and number of UL+mixed
// slots in the period. TS 38.213 Sec 11.1 // slots in the period. TS 38.213 Sec 11.1
int mu = mac->ULbwp[ul_bwp_id-1] ? int mu = ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ?
mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing : mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
const int n = nr_slots_per_frame[mu]; const int n = nr_slots_per_frame[mu];
...@@ -205,7 +206,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con ...@@ -205,7 +206,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
srs_config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; srs_config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup;
} }
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id-1] ? NR_PUSCH_Config_t *pusch_Config = ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ?
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup :
(ubwpd? (ubwpd?
ubwpd->pusch_Config->choice.setup: ubwpd->pusch_Config->choice.setup:
...@@ -361,7 +362,7 @@ void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_ ...@@ -361,7 +362,7 @@ void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP)
ubwpd = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; ubwpd = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : (ubwpd?ubwpd->pusch_Config->choice.setup:NULL); NR_PUSCH_Config_t *pusch_Config = ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : (ubwpd?ubwpd->pusch_Config->choice.setup:NULL);
AssertFatal(pusch_Config!=NULL,"pusch_Config shouldn't be null\n"); AssertFatal(pusch_Config!=NULL,"pusch_Config shouldn't be null\n");
long transformPrecoder; long transformPrecoder;
...@@ -581,7 +582,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -581,7 +582,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
if (rar_grant) { if (rar_grant) {
// Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0 // Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0
NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id-1]; NR_BWP_Uplink_t *ubwp = ul_bwp_id > 0 ? mac->ULbwp[ul_bwp_id - 1] : NULL;
NR_BWP_UplinkDedicated_t *ibwp; NR_BWP_UplinkDedicated_t *ibwp;
int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype; int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype;
NR_PUSCH_Config_t *pusch_Config=NULL; NR_PUSCH_Config_t *pusch_Config=NULL;
...@@ -839,11 +840,15 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -839,11 +840,15 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
mappingtype, add_pos, dmrslength, mappingtype, add_pos, dmrslength,
pusch_config_pdu->start_symbol_index, pusch_config_pdu->start_symbol_index,
mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position); mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position);
if (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) { if (ul_bwp_id > 0 &&
if (*dci_format != NR_UL_DCI_FORMAT_0_1) { mac->ULbwp[ul_bwp_id - 1] &&
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled &&
} *dci_format != NR_UL_DCI_FORMAT_0_1) {
} else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled)) { pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
} else if (*dci_format == NR_UL_DCI_FORMAT_0_0 ||
(ul_bwp_id > 0 &&
mac->ULbwp[ul_bwp_id-1] &&
pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled)) {
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
} }
...@@ -859,7 +864,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -859,7 +864,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
else N_PRB_oh = 0; else N_PRB_oh = 0;
/* PTRS */ /* PTRS */
if (mac->ULbwp[ul_bwp_id-1] && if (ul_bwp_id > 0 &&
mac->ULbwp[ul_bwp_id-1] &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated && mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config && mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config &&
mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup && mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup &&
...@@ -1093,9 +1099,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -1093,9 +1099,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
dcireq.dl_config_req = mac->dl_config_request; dcireq.dl_config_req = mac->dl_config_request;
fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data); fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) {
LOG_D(NR_MAC,"1# scheduled_response transmitted, %d, %d\n", rx_frame, rx_slot); LOG_D(NR_MAC,"1# scheduled_response transmitted, %d, %d\n", rx_frame, rx_slot);
mac->if_module->scheduled_response(&scheduled_response); mac->if_module->scheduled_response(&scheduled_response);
}
} }
else { else {
// this is for Msg2/Msg4 // this is for Msg2/Msg4
...@@ -1564,15 +1571,14 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, ...@@ -1564,15 +1571,14 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
int delta = 0; int delta = 0;
NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id-1];
// Get the numerology to calculate the Tx frame and slot // Get the numerology to calculate the Tx frame and slot
int mu = ubwp ? int mu = ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ?
ubwp->bwp_Common->genericParameters.subcarrierSpacing : mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ubwp ? NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1] ?
ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList:
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
// k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1 // k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1
// PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon // PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon
......
...@@ -360,7 +360,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts, ...@@ -360,7 +360,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts,
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0;
break; break;
case 2 : case 2 :
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24; cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = ((uint32_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]) << 24;
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0;
break; break;
case 3 : case 3 :
......
...@@ -1349,6 +1349,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1349,6 +1349,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
header->L = htons(bufEnd-buf); header->L = htons(bufEnd-buf);
dlsch_total_bytes += bufEnd-buf; dlsch_total_bytes += bufEnd-buf;
for (; ((intptr_t)buf) % 4; buf++)
*buf = lrand48() & 0xff;
for (; buf < bufEnd - 3; buf += 4) { for (; buf < bufEnd - 3; buf += 4) {
uint32_t *buf32 = (uint32_t *)buf; uint32_t *buf32 = (uint32_t *)buf;
*buf32 = lrand48(); *buf32 = lrand48();
......
...@@ -1320,11 +1320,11 @@ nr_rrc_ue_process_masterCellGroup( ...@@ -1320,11 +1320,11 @@ nr_rrc_ue_process_masterCellGroup(
//TODO (perform SCell addition/modification as specified in 5.3.5.5.9) //TODO (perform SCell addition/modification as specified in 5.3.5.5.9)
} }
if( cellGroupConfig->ext2->bh_RLC_ChannelToReleaseList_r16 != NULL){ if(cellGroupConfig->ext2 != NULL && cellGroupConfig->ext2->bh_RLC_ChannelToReleaseList_r16 != NULL){
//TODO (perform the BH RLC channel addition/modification as specified in 5.3.5.5.11) //TODO (perform the BH RLC channel addition/modification as specified in 5.3.5.5.11)
} }
if( cellGroupConfig->ext2->bh_RLC_ChannelToAddModList_r16 != NULL){ if(cellGroupConfig->ext2 != NULL && cellGroupConfig->ext2->bh_RLC_ChannelToAddModList_r16 != NULL){
//TODO (perform the BH RLC channel addition/modification as specified in 5.3.5.5.11) //TODO (perform the BH RLC channel addition/modification as specified in 5.3.5.5.11)
} }
} }
......
...@@ -859,7 +859,7 @@ sctp_eNB_accept_associations( ...@@ -859,7 +859,7 @@ sctp_eNB_accept_associations(
struct sctp_cnx_list_elm_s *sctp_cnx) struct sctp_cnx_list_elm_s *sctp_cnx)
{ {
int client_sd; int client_sd;
struct sockaddr saddr; struct sockaddr_in6 saddr;
socklen_t saddr_size; socklen_t saddr_size;
DevAssert(sctp_cnx != NULL); DevAssert(sctp_cnx != NULL);
...@@ -868,14 +868,14 @@ sctp_eNB_accept_associations( ...@@ -868,14 +868,14 @@ sctp_eNB_accept_associations(
/* There is a new client connecting. Accept it... /* There is a new client connecting. Accept it...
*/ */
if ((client_sd = accept(sctp_cnx->sd, &saddr, &saddr_size)) < 0) { if ((client_sd = accept(sctp_cnx->sd, (struct sockaddr*)&saddr, &saddr_size)) < 0) {
SCTP_ERROR("[%d] accept failed: %s:%d\n", sctp_cnx->sd, strerror(errno), errno); SCTP_ERROR("[%d] accept failed: %s:%d\n", sctp_cnx->sd, strerror(errno), errno);
} else { } else {
struct sctp_cnx_list_elm_s *new_cnx; struct sctp_cnx_list_elm_s *new_cnx;
uint16_t port; uint16_t port;
/* This is an ipv6 socket */ /* This is an ipv6 socket */
port = ((struct sockaddr_in6*)&saddr)->sin6_port; port = saddr.sin6_port;
/* Contrary to BSD, client socket does not inherit O_NONBLOCK option */ /* Contrary to BSD, client socket does not inherit O_NONBLOCK option */
if (fcntl(client_sd, F_SETFL, O_NONBLOCK) < 0) { if (fcntl(client_sd, F_SETFL, O_NONBLOCK) < 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