diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 372d4aef11..c453558790 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -154,6 +154,34 @@ class SSHConnection(): else: logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m') + def copy(self, ipaddress, username, password, source, destination): + logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination) + scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5) + scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + scp_spawn.sendline('yes') + scp_spawn.expect('password:') + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + pass + else: + logging.debug('1 - scp_response = ' + str(scp_response)) + sys.exit('SCP failed') + elif scp_response == 1: + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0 or scp_response == 3: + pass + else: + logging.debug('2 - scp_response = ' + str(scp_response)) + sys.exit('SCP failed') + elif scp_response == 2: + pass + else: + logging.debug('3 - scp_response = ' + str(scp_response)) + sys.exit('SCP failed') + def BuildeNB(self): if self.eNBIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.eNBSourceCodePath == '': Usage() @@ -254,7 +282,13 @@ class SSHConnection(): self.command('cd ' + self.eNBSourceCodePath, '\$', 5) # Initialize_eNB_args usually start with -O and followed by the location in repository full_config_file = self.Initialize_eNB_args.replace('-O ','') - config_path, config_file = os.path.split(full_config_file) + extIdx = full_config_file.find('.conf') + if (extIdx > 0): + extra_options = full_config_file[extIdx + 5:] + full_config_file = full_config_file[:extIdx + 5] + config_path, config_file = os.path.split(full_config_file) + else: + sys.exit('Insufficient Parameter') ci_full_config_file = config_path + '/ci-' + config_file # Make a copy and adapt to EPC / eNB IP addresses self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) @@ -264,7 +298,7 @@ class SSHConnection(): # Launch eNB with the modified config file self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) - self.command('echo "./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + '" > ./my-lte-softmodem-run.sh ', '\$', 5) + self.command('echo "./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run.sh ', '\$', 5) self.command('chmod 775 ./my-lte-softmodem-run.sh ', '\$', 5) self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '.log ./my-lte-softmodem-run.sh', '\$', 5) time.sleep(6) @@ -274,7 +308,7 @@ class SSHConnection(): loopCounter = loopCounter - 1 if (loopCounter == 0): doLoop = False - logging.debug('\u001B[1;37;43m eNB logging system did not show got sync! See with attach later \u001B[0m') + logging.debug('\u001B[1;30;43m eNB logging system did not show got sync! See with attach later \u001B[0m') self.CreateHtmlTestRow(config_file, 'eNB not showing got sync!', 0) # Not getting got sync is bypassed for the moment #sys.exit(1) @@ -668,22 +702,33 @@ class SSHConnection(): sys.exit(1) return result - def Iperf_analyzeV2Output(self, lock, UE_IPAddress, device_id, statusQueue): + def Iperf_analyzeV2Output(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): result = re.search('Server Report:', str(self.ssh.before)) if result is None: result = re.search('read failed: Connection refused', str(self.ssh.before)) - lock.acquire() - statusQueue.put(-1) - statusQueue.put(device_id) - statusQueue.put(UE_IPAddress) if result is not None: logging.debug('\u001B[1;37;41m Could not connect to iperf server! \u001B[0m') - statusQueue.put('Could not connect to iperf server!') else: logging.debug('\u001B[1;37;41m Server Report and Connection refused Not Found! \u001B[0m') - statusQueue.put('Server Report and Connection refused Not Found!') - lock.release() - return + return -1 + # Computing the requested bandwidth in float + result = re.search('-b (?P[0-9\.]+)[KMG]', str(iperf_real_options)) + if result is not None: + req_bandwidth = result.group('iperf_bandwidth') + req_bw = float(req_bandwidth) + result = re.search('-b [0-9\.]+K', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Kbits/sec' % req_bw + req_bw = req_bw * 1000 + result = re.search('-b [0-9\.]+M', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Mbits/sec' % req_bw + req_bw = req_bw * 1000000 + result = re.search('-b [0-9\.]+G', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Gbits/sec' % req_bw + req_bw = req_bw * 1000000000 + result = re.search('Server Report:\\\\r\\\\n(?:|\[ *\d+\].*) (?P[0-9\.]+ [KMG]bits\/sec) +(?P[0-9\.]+ ms) +(\d+\/..\d+) (\((?P[0-9\.]+)%\))', str(self.ssh.before)) if result is not None: bitrate = result.group('bitrate') @@ -692,10 +737,27 @@ class SSHConnection(): lock.acquire() logging.debug('\u001B[1;37;44m iperf result (' + UE_IPAddress + ') \u001B[0m') iperfStatus = True - msg = '' + msg = 'Req Bitrate : ' + req_bandwidth + '\n' + logging.debug('\u001B[1;34m Req Bitrate : ' + req_bandwidth + '\u001B[0m') if bitrate is not None: msg += 'Bitrate : ' + bitrate + '\n' logging.debug('\u001B[1;34m Bitrate : ' + bitrate + '\u001B[0m') + result = re.search('(?P[0-9\.]+) [KMG]bits/sec', str(bitrate)) + if result is not None: + actual_bw = float(str(result.group('real_bw'))) + result = re.search('[0-9\.]+ K', bitrate) + if result is not None: + actual_bw = actual_bw * 1000 + result = re.search('[0-9\.]+ M', bitrate) + if result is not None: + actual_bw = actual_bw * 1000000 + result = re.search('[0-9\.]+ G', bitrate) + if result is not None: + actual_bw = actual_bw * 1000000000 + br_loss = 100 * actual_bw / req_bw + bitperf = '%.2f ' % br_loss + msg += 'Bitrate Perf: ' + bitperf + '%\n' + logging.debug('\u001B[1;34m Bitrate Perf: ' + bitperf + '%\u001B[0m') if packetloss is not None: msg += 'Packet Loss : ' + packetloss + '%\n' logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m') @@ -714,6 +776,121 @@ class SSHConnection(): statusQueue.put(UE_IPAddress) statusQueue.put(msg) lock.release() + return 0 + + def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): + if (not os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): + lock.acquire() + statusQueue.put(-1) + statusQueue.put(device_id) + statusQueue.put(UE_IPAddress) + statusQueue.put('Could not analyze from server log') + lock.release() + return + # Computing the requested bandwidth in float + result = re.search('-b (?P[0-9\.]+)[KMG]', str(iperf_real_options)) + if result is None: + logging.debug('Iperf bandwidth Not Found!') + lock.acquire() + statusQueue.put(-1) + statusQueue.put(device_id) + statusQueue.put(UE_IPAddress) + statusQueue.put('Could not compute Iperf bandwidth!') + lock.release() + return + else: + req_bandwidth = result.group('iperf_bandwidth') + req_bw = float(req_bandwidth) + result = re.search('-b [0-9\.]+K', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Kbits/sec' % req_bw + req_bw = req_bw * 1000 + result = re.search('-b [0-9\.]+M', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Mbits/sec' % req_bw + req_bw = req_bw * 1000000 + result = re.search('-b [0-9\.]+G', str(iperf_real_options)) + if result is not None: + req_bandwidth = '%.1f Gbits/sec' % req_bw + req_bw = req_bw * 1000000000 + + server_file = open('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', 'r') + br_sum = 0.0 + ji_sum = 0.0 + pl_sum = 0 + ps_sum = 0 + row_idx = 0 + for line in server_file.readlines(): + result = re.search('(?P[0-9\.]+ [KMG]bits\/sec) +(?P[0-9\.]+ ms) +(?P[0-9]+)/ +(?P[0-9]+)', str(line)) + if result is not None: + bitrate = result.group('bitrate') + jitter = result.group('jitter') + packetlost = result.group('lostPack') + packetsent = result.group('sentPack') + br = bitrate.split(' ') + ji = jitter.split(' ') + row_idx = row_idx + 1 + curr_br = float(br[0]) + pl_sum = pl_sum + int(packetlost) + ps_sum = ps_sum + int(packetsent) + if (br[1] == 'Kbits/sec'): + curr_br = curr_br * 1000 + if (br[1] == 'Mbits/sec'): + curr_br = curr_br * 1000 * 1000 + br_sum = curr_br + br_sum + ji_sum = float(ji[0]) + ji_sum + if (row_idx > 0): + br_sum = br_sum / row_idx + ji_sum = ji_sum / row_idx + br_loss = 100 * br_sum / req_bw + if (br_sum > 1000): + br_sum = br_sum / 1000 + if (br_sum > 1000): + br_sum = br_sum / 1000 + bitrate = '%.2f Mbits/sec' % br_sum + else: + bitrate = '%.2f Kbits/sec' % br_sum + else: + bitrate = '%.2f bits/sec' % br_sum + bitperf = '%.2f ' % br_loss + bitperf += '%' + jitter = '%.2f ms' % (ji_sum) + if (ps_sum > 0): + pl = float(100 * pl_sum / ps_sum) + packetloss = '%2.1f ' % (pl) + packetloss += '%' + else: + packetloss = 'unknown' + lock.acquire() + if (br_loss < 90): + statusQueue.put(1) + else: + statusQueue.put(0) + statusQueue.put(device_id) + statusQueue.put(UE_IPAddress) + req_msg = 'Req Bitrate : ' + req_bandwidth + bir_msg = 'Bitrate : ' + bitrate + brl_msg = 'Bitrate Perf: ' + bitperf + jit_msg = 'Jitter : ' + jitter + pal_msg = 'Packet Loss : ' + packetloss + statusQueue.put(req_msg + '\n' + bir_msg + '\n' + brl_msg + '\n' + jit_msg + '\n' + pal_msg + '\n') + logging.debug('\u001B[1;37;45m iperf result (' + UE_IPAddress + ') \u001B[0m') + logging.debug('\u001B[1;35m ' + req_msg + '\u001B[0m') + logging.debug('\u001B[1;35m ' + bir_msg + '\u001B[0m') + logging.debug('\u001B[1;35m ' + brl_msg + '\u001B[0m') + logging.debug('\u001B[1;35m ' + jit_msg + '\u001B[0m') + logging.debug('\u001B[1;35m ' + pal_msg + '\u001B[0m') + lock.release() + else: + lock.acquire() + statusQueue.put(-1) + statusQueue.put(device_id) + statusQueue.put(UE_IPAddress) + statusQueue.put('Could not analyze from server log') + lock.release() + + server_file.close() + def Iperf_analyzeV3Output(self, lock, UE_IPAddress, device_id, statusQueue): result = re.search('(?P[0-9\.]+ [KMG]bits\/sec) +(?:|[0-9\.]+ ms +\d+\/\d+ \((?P[0-9\.]+)%\)) +(?:|receiver)\\\\r\\\\n(?:|\[ *\d+\] Sent \d+ datagrams)\\\\r\\\\niperf Done\.', str(self.ssh.before)) @@ -780,12 +957,18 @@ class SSHConnection(): self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) - self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue) + clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options) # Launch iperf server on EPC side self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) self.command('killall --signal SIGKILL iperf', self.EPCUserName, 5) self.close() + if (clientStatus == -1): + time.sleep(1) + if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): + os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log') + self.copy(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.') + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue): try: @@ -843,11 +1026,12 @@ class SSHConnection(): if (useIperf3): self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + clientStatus = 0 self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue) else: self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) - self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue) + clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options) self.close() self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) @@ -857,6 +1041,12 @@ class SSHConnection(): pid_iperf = result.group('pid') self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5) self.close() + if (clientStatus == -1): + time.sleep(1) + if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): + os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log') + self.copy(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.') + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) except: os.kill(os.getppid(),signal.SIGUSR1) @@ -887,17 +1077,22 @@ class SSHConnection(): sys.exit(1) else: iperf_status = True + iperf_noperf = False html_queue = SimpleQueue() while (not status_queue.empty()): count = status_queue.get() if (count < 0): iperf_status = False + if (count > 0): + iperf_noperf = True device_id = status_queue.get() ip_addr = status_queue.get() message = status_queue.get() html_cell = "
UE (" + device_id + ")\nIP Address  : " + ip_addr + "\n" + message + "
" html_queue.put(html_cell) - if (iperf_status): + if (iperf_noperf and iperf_status): + self.CreateHtmlTestRowQueue(self.iperf_args, 'PERF NOT MET', len(self.UEDevices), html_queue) + elif (iperf_status): self.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue) else: self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) @@ -1263,6 +1458,7 @@ class SSHConnection(): def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): + addOrangeBK = False self.htmlFile.write(' \n') self.htmlFile.write(' ' + SSH.testCase_id + '\n') self.htmlFile.write(' ' + SSH.desc + '\n') @@ -1272,12 +1468,16 @@ class SSHConnection(): elif (str(status) == 'KO'): self.htmlFile.write(' ' + str(status) + '\n') else: + addOrangeBK = True self.htmlFile.write(' ' + str(status) + '\n') i = 0 while (i < self.htmlUEConnected): if (i < ue_status): if (not ue_queue.empty()): - self.htmlFile.write(' ' + str(ue_queue.get()) + '\n') + if (addOrangeBK): + self.htmlFile.write(' ' + str(ue_queue.get()) + '\n') + else: + self.htmlFile.write(' ' + str(ue_queue.get()) + '\n') else: self.htmlFile.write(' -\n') else: @@ -1296,8 +1496,8 @@ def Usage(): print(' --help Show this help.') print(' --mode=[Mode]') print(' TesteNB') - print(' TerminateeNB, TerminateEPC') - print(' LogCollectBuild, LogCollecteNB, LogCollectEPC, LogCollectADB') + print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW') + print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf') print(' --eNBIPAddress=[eNB\'s IP Address]') print(' --eNBRepository=[eNB\'s Repository URL]') print(' --eNBBranch=[eNB\'s Branch Name]') diff --git a/ci-scripts/xml_files/enb_usrp210_band7.xml b/ci-scripts/xml_files/enb_usrp210_band7.xml index 7a56cf384c..b8a2439106 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7.xml @@ -21,31 +21,31 @@ --> - 010101 050101 060101 070101 040101 030101 040301 040501 040601 040602 040603 040604 040605 040641 040401 040201 030201 030111 040301 040511 040611 040612 040613 040614 040615 040651 040401 040201 030201 030121 040301 040521 040621 040622 040623 040661 040401 040201 030201 + 010101 050101 060101 070101 040101 030101 040301 040501 040601 040602 040603 040604 040605 040641 040642 040401 040201 030201 030111 040301 040511 040611 040612 040613 040614 040615 040651 040652 040401 040201 030201 030121 040301 040521 040621 040622 040623 040624 040625 040662 040661 040401 040201 030201 Build_eNB Build eNB (USRP) - -w USRP -x -c --eNB + -w USRP -c --eNB Initialize_eNB Initialize eNB (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --codingw --fepw Initialize_eNB Initialize eNB (FDD/Band7/10MHz) - -O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf + -O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --codingw --fepw Initialize_eNB Initialize eNB (FDD/Band7/20MHz) - -O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf + -O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf --codingw --fepw @@ -138,6 +138,14 @@ 50 + + Iperf + iperf (5MHz - UL/9Mbps/UDP)(60 sec)(single-ue profile) + -u -b 9M -t 60 -i 1 -R + 50 + single-ue + + Iperf iperf (10MHz - DL/10Mbps/UDP)(60 sec) @@ -182,6 +190,14 @@ 50 + + Iperf + iperf (10MHz - UL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 -i 1 -R + 50 + single-ue + + Iperf iperf (20MHz - DL/20Mbps/UDP)(60 sec) @@ -211,7 +227,7 @@ single-ue - + Iperf iperf (20MHz - DL/70Mbps/UDP)(60 sec)(unbalanced profile) -u -b 70M -t 60 -i 1 @@ -226,6 +242,14 @@ 50 + + Iperf + iperf (20MHz - UL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 -i 1 -R + 50 + single-ue + + Initialize_HSS Initialize HSS diff --git a/ci-scripts/xml_files/test_case_list_template.xml b/ci-scripts/xml_files/test_case_list_template.xml index bc06dc75ce..25519dcd03 100644 --- a/ci-scripts/xml_files/test_case_list_template.xml +++ b/ci-scripts/xml_files/test_case_list_template.xml @@ -29,13 +29,13 @@ Build_eNB Build eNB (USRP) - -w USRP -x -c --eNB + -w USRP -c --eNB Build_eNB Build eNB (USRP) - -w BLADERF -x -c --eNB + -w BLADERF -c --eNB diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 5ddce2340b..3363bd2e76 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -683,7 +683,7 @@ install_asn1c_from_source(){ # better to use a given commit than a branch in case the branch # is updated and requires modifications in the source of OAI #git checkout velichkov_s1ap_plus_option_group - git checkout ec830d70bbb014b769810355a2f321a91ccd8a58 + git checkout 73d6b23dcec9ab36605b4af884143824392134c1 autoreconf -iv ./configure make -j`nproc` diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index 1f845ce4f8..87a6e34c5d 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -27,4 +27,6 @@ check_vcd: clean: rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h _check_vcd + +cleanall: clean cd tracer && $(MAKE) clean diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 1cda8b7504..fbd3f75a0c 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -31,6 +31,12 @@ volatile int _T_freelist_head; volatile int *T_freelist_head = &_T_freelist_head; T_cache_t *T_cache; +#if BASIC_SIMULATOR +/* global variables used by T_GET_SLOT, see in T.h */ +volatile uint64_t T_next_id; +volatile uint64_t T_active_id; +#endif + static void get_message(int s) { char t; diff --git a/common/utils/T/T.h b/common/utils/T/T.h index f1aa6ecd1d..18e4a590d9 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -112,13 +112,37 @@ extern volatile int *T_freelist_head; extern T_cache_t *T_cache; extern int *T_active; /* When running the basic simulator, we may fill the T cache too fast. - * Let's not crash if it's full, just wait. + * Let's serialize write accesses to the T cache. For that, we use a + * 'ticket' mechanism. To acquire a T slot the caller needs to own the + * current active ticket. We also wait for the slot to be free if + * it is already in use. */ #if BASIC_SIMULATOR -# define T_BASIC_SIMULATOR_WAIT \ - while (T_cache[T_LOCAL_slot].busy) usleep(100) +# define T_GET_SLOT \ + do { \ + extern volatile uint64_t T_next_id; \ + extern volatile uint64_t T_active_id; \ + uint64_t id; \ + /* get a ticket */ \ + id = __sync_fetch_and_add(&T_next_id, 1); \ + /* wait for our turn */ \ + while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \ + /* this is our turn, try to acquire the slot until it's free */ \ + do { \ + T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \ + if (T_LOCAL_busy & 0x01) usleep(100); \ + } while (T_LOCAL_busy & 0x01); \ + /* check that there are still some tickets */ \ + if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \ + printf("T: reached the end of times, bye...\n"); \ + abort(); \ + } \ + /* free our ticket, which signals the next waiter that it's its turn */ \ + (void)__sync_fetch_and_add(&T_active_id, 1); \ + } while (0) #else -# define T_BASIC_SIMULATOR_WAIT /* */ +# define T_GET_SLOT \ + T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); #endif /* used at header of Tn, allocates buffer */ @@ -126,11 +150,12 @@ extern int *T_active; char *T_LOCAL_buf; \ int T_LOCAL_size = 0; \ int T_LOCAL_slot; \ + int T_LOCAL_busy; \ T_LOCAL_slot = __sync_fetch_and_add(T_freelist_head, 1) \ & (T_CACHE_SIZE - 1); \ (void)__sync_fetch_and_and(T_freelist_head, T_CACHE_SIZE - 1); \ - T_BASIC_SIMULATOR_WAIT; \ - if (T_cache[T_LOCAL_slot].busy) { \ + T_GET_SLOT; \ + if (T_LOCAL_busy & 0x01) { \ printf("%s:%d:%s: T cache is full - consider increasing its size\n", \ __FILE__, __LINE__, __FUNCTION__); \ abort(); \ @@ -142,7 +167,7 @@ extern int *T_active; #define T_COMMIT() \ T_cache[T_LOCAL_slot].length = T_LOCAL_size; \ __sync_synchronize(); \ - T_cache[T_LOCAL_slot].busy = 1; \ + (void)__sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x02); #define T_CHECK_SIZE(len, argnum) \ if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \ diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 82d2e5703c..a5c7987dc5 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -31,6 +31,10 @@ #endif typedef struct { + /* 'busy' is a bit field + * bit 0: 1 means that slot is acquired by writer + * bit 1: 1 means that slot is ready for consumption + */ volatile int busy; char buffer[T_BUFFER_MAX]; int length; diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 19d0a4d717..f8e92881a9 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -337,7 +337,7 @@ static void forward(void *_forwarder, char *buf, int size) static void wait_message(void) { - while (T_local_cache[T_busylist_head].busy == 0) usleep(1000); + while ((T_local_cache[T_busylist_head].busy & 0x02) == 0) usleep(1000); } void T_local_tracer_main(int remote_port, int wait_for_tracer, diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 5f829634ac..0254230eaf 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -330,6 +330,8 @@ typedef struct RU_t_s{ int in_synch; /// timing offset int rx_offset; + /// south out counter + int south_out_cnt; /// flag to indicate the RU is a slave to another source int is_slave; /// flag to indicate that the RU should generate the DMRS sequence in slot 2 (subframe 1) for OTA synchronization and calibration diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index af4a6de2eb..6f168b4abf 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2396,12 +2396,12 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { #endif } if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1; } else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1; } else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1; + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1; } } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 05498e4377..df52b83d72 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -386,6 +386,7 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP, UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI; break; } + break; case 2: // if ((subframeP==3)||(subframeP==8)) diff --git a/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1 index db1f1b5915..97d0a6de87 100755 --- a/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1 +++ b/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1 @@ -6881,3 +6881,201 @@ id-EDT-Session ProtocolIE-ID ::= 281 id-CNTypeRestrictions ProtocolIE-ID ::= 282 END + +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +S1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID +FROM S1AP-CommonDataTypes + + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs +FROM S1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +S1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +S1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +S1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +S1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {S1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {S1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {S1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality S1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value S1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality S1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue S1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality S1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue S1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container Lists for Protocol IE Containers +-- +-- ************************************************************** + +ProtocolIE-ContainerList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-SingleContainer {{IEsSetParam}} + +ProtocolIE-ContainerPairList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-ContainerPair {{IEsSetParam}} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality S1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue S1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {S1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {S1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id S1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality S1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value S1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 214afabd70..4871964879 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -122,7 +122,6 @@ extern int numerology; extern int fepw; extern int single_thread_flag; - extern void phy_init_RU(RU_t*); extern void phy_free_RU(RU_t*); @@ -156,8 +155,10 @@ static inline void fh_if5_south_out(RU_t *ru) { static inline void fh_if4p5_south_out(RU_t *ru) { if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx); - if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) + if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) { send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT); + ru->south_out_cnt++; + } } /*************************************************************/ @@ -1339,7 +1340,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->num_rb_dl=fp->N_RB_DL; cfg->tx_num_channels=ru->nb_tx; cfg->rx_num_channels=ru->nb_rx; - + for (i=0; inb_tx; i++) { cfg->tx_freq[i] = (double)fp->dl_CarrierFreq; @@ -1439,6 +1440,7 @@ static void* ru_stats_thread(void* param) { print_meas(&ru->compression,"compression",NULL,NULL); print_meas(&ru->transport,"transport",NULL,NULL); } + LOG_I(PHY,"ru->south_out_cnt = %d\n",ru->south_out_cnt); } } return(NULL); @@ -2568,6 +2570,7 @@ void init_RU(char *rf_config_file, clock_source_t clock_source,clock_source_t ti ru->ts_offset = 0; ru->in_synch = (ru->is_slave == 1) ? 0 : 1; ru->cmd = EMPTY; + ru->south_out_cnt= 0; // use eNB_list[0] as a reference for RU frame parameters // NOTE: multiple CC_id are not handled here yet! ru->openair0_cfg.clock_source = clock_source; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 8ff69d108c..d9428ee71e 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -944,7 +944,7 @@ int main( int argc, char **argv ) printf("Reading in command-line options\n"); - get_options (); + get_options (); if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { fprintf(stderr,"Getting configuration failed\n"); exit(-1); @@ -1133,13 +1133,6 @@ int main( int argc, char **argv ) rt_sleep_ns(10*100000000ULL); - if (nfapi_mode) { - - printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); - pthread_cond_init(&sync_cond,NULL); - pthread_mutex_init(&sync_mutex, NULL); - } - if (nfapi_mode) { printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index d6d9150d92..3f7a1d294b 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -65,9 +65,9 @@ #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n" -#define CONFIG_HLP_EXCCLK "tells hardware to use an external clock reference\n" #define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n" #define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0" +#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n" #define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n" #define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n" #define CONFIG_HLP_TADV "Set timing_advance\n" @@ -163,8 +163,8 @@ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ -{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \ {"external-timesource", CONFIG_HLP_EXTS, PARAMFLAG_BOOL, uptr:&time_source, defintval:0, TYPE_INT, 0}, \ +{"external-clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ {"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:0, TYPE_INT, 0}, \ {"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \