Merge branch 'develop' into develop-new-LMSSDR

Conflicts:
	targets/RT/USER/lte-softmodem.c
This commit is contained in:
Raymond.Knopp
2017-01-18 10:44:37 +01:00
147 changed files with 144877 additions and 139982 deletions
+16 -35
View File
@@ -1,38 +1,19 @@
job1: job1:
script: script:
- echo $PWD - date
- echo $USER - pwd
- echo $OAI_USER - echo $OAI_USER
- echo $OAI_EXTRA_ARGS - echo $OAI_PASS
- echo $NFS_SHARE_DIR - echo $OAI_TEST_CASE_GROUP
- echo $EXTERNAL_SHARE_DIR - echo $MACHINELIST
- echo $SHELL - echo $MACHINELISTGENERIC
- echo $OAI_TEST_CASE_GROUP - echo $RESULT_DIR
- echo $MACHINELIST - echo $NRUNS_LTE_SOFTMODEM
- echo $MACHINELISTGENERIC - source oaienv
- git rev-parse --abbrev-ref HEAD - rm -rf cmake_targets/autotests/log
- git_repo=`git config --get remote.origin.url` - mkdir cmake_targets/autotests/log
- git_head=`git rev-parse HEAD` - cd cmake_targets/autotests/v2
- echo $git_head - python main.py
- tmp=`git show-ref --head | grep $git_head` - date
- tmp=(${tmp///// })
- git_branch=${tmp[@]:(-1)}
- echo $git_branch
- source oaienv
- echo $OPENAIR_DIR
- NFS_TEST_RESULTS_DIR=$NFS_SHARE_DIR/$git_branch/$git_head
- EXTERNAL_SHARE_RESULTS_DIR=$EXTERNAL_SHARE_DIR/$git_branch/$git_head
- echo $NFS_TEST_RESULTS_DIR
- echo $EXTERNAL_SHARE_RESULTS_DIR
- echo $NRUNS_LTE_SOFTMODEM
- echo $TIMEOUT_CMD
- mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -c -5GRepo $git_repo -MachineList "$MACHINELIST" -MachineListGeneric "$MACHINELISTGENERIC" -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS $OAI_EXTRA_ARGS -g "$OAI_TEST_CASE_GROUP">& $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log
- python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepo $git_repo -MachineList "$MACHINELIST" -MachineListGeneric "$MACHINELISTGENERIC" -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g "$OAI_TEST_CASE_GROUP" --nrun_lte_softmodem $NRUNS_LTE_SOFTMODEM --timeout_cmd $TIMEOUT_CMD >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
- mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest.log
- mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest_cleanup.log
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR
- cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml
only: only:
- triggers - triggers
+1 -1
View File
@@ -13,7 +13,7 @@
<Timeout_execution>36000</Timeout_execution> <Timeout_execution>36000</Timeout_execution>
<TestCaseExclusionList>010141 0102+ 010301 010303 010304 010305 0104+ 015508 015511 015520 015523 015518 015519 015520 015521 015522 015523 015602 015605 015818 015819 015820 015821 015822 015823 016102 016105 016502 016505 017002 017005 018002 018005 018502 018505 025514 025517 025520 025523 025518 025519 025520 025521 025522 025523</TestCaseExclusionList> <TestCaseExclusionList>010141 0102+ 010301 010303 010304 010305 0104+ 015508 015511 015520 015523 015518 015519 015520 015521 015522 015523 015602 015605 015818 015819 015820 015821 015822 015823 016102 016105 016502 016505 017002 017005 018002 018005 018502 018505 025514 025517 025520 025523 025518 025519 025520 025521 025522 025523</TestCaseExclusionList>
<nruns_lte-softmodem>3</nruns_lte-softmodem> <nruns_lte-softmodem>3</nruns_lte-softmodem>
<MachineListGeneric>amerique mozart hutch starsky stevens calisson superserver </MachineListGeneric> <MachineListGeneric>nano mozart hutch starsky stevens calisson superserver </MachineListGeneric>
<testCase id="010101" > <testCase id="010101" >
<class>compilation</class> <class>compilation</class>
<desc>Build oaisim.Rel8</desc> <desc>Build oaisim.Rel8</desc>
@@ -0,0 +1,2 @@
sudo /opt/ltebox/tools/stop_ltebox || true
sudo /opt/ltebox/tools/start_ltebox
@@ -0,0 +1 @@
sudo /opt/ltebox/tools/stop_ltebox
@@ -0,0 +1,2 @@
sudo /opt/ltebox/tools/stop_ltebox || true
sudo /opt/hss_sim0609/starthss_real
@@ -0,0 +1,136 @@
The configuration for the bandrich in the test setup is a bit hackish.
Here come some notes explaining what we do here.
To get /dev/bandrich.data and /dev/bandrich.control (so that you don't need
to look for which /dev/ttyUSBx are used by your dongle, and always use
the same files, no matter what), add a udev file:
/etc/udev/rules.d/bandrich.rules
containing lines:
SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1a8d", ENV{ID_MODEL_ID}=="100d", ENV{ID_SERIAL_SHORT}=="357473040068155", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="bandrich.data", MODE="0666"
SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1a8d", ENV{ID_MODEL_ID}=="100d", ENV{ID_SERIAL_SHORT}=="357473040068155", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="bandrich.control", MODE="0666"
Change vendor_id/model_id/serial/interface num to match yours.
Use lsusb -v to find values.
At first we used /dev/ttyUSB2 linked to /dev/bandrich for both data (in
the wvdial configuration file) and control (in the python code, opening
/dev/bandrich the standard unix way and read and write into it, with no
special libusb commands).
But it turned out that using /dev/ttyUSB2 for data gives bad throughput
results. We tested downlink UDP at 15Mb/s but the maximum throughput for
a 5MHz cell was around 13, and we had a lot of packets lost at the iperf's
UDP level. Radio was looking fine (all packets acked correctly), so it was
not a radio problem. The dongle in a windows machine was working fine,
15Mbs/s. Using the wvdial configuration file from test setup v1 gave also
good results. The only difference was the use of /dev/ttyUSB0 instead of
/dev/ttyUSB2. Using /dev/ttyUSB0 solved the throughput issue.
But using /dev/ttyUSB0 for control in the pyton code did not work. The
output was incorrect.
So we decided to have /dev/bandrich.data linked to /dev/ttyUSB0 for data
(wvdial) and /dev/bandrich.control linked to /dev/ttyUSB2 for control
(in python code).
It may not be the correct way to go, but it seems to do the trick so far.
Your device may need some other solution.
Here, we get, as result of lsusb -v:
[SNIP]
Bus 003 Device 009: ID 1a8d:100d BandRich, Inc. 4G LTE adapter
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1a8d BandRich, Inc.
idProduct 0x100d 4G LTE adapter
bcdDevice 0.00
iManufacturer 10 BandRich, Inc.
iProduct 9 BandLuxe HSPA-LTE Adapter
iSerial 11 357473040068155
[SNIP]
You can also run:
udevadm monitor
and unplug/replug the dongle. It will print some information.
The command:
udevadm info --export-db
is also important to get the right identifier to put in ENV{}. (It also
gives the correct value.)
Here is extracted what we have for our dongle:
P: /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.2/ttyUSB2/tty/ttyUSB2
N: ttyUSB2
S: bandrich
S: serial/by-id/usb-BandRich__Inc._BandLuxe_HSPA-LTE_Adapter_357473040068155-if02-port0
S: serial/by-path/pci-0000:00:1a.0-usb-0:1.2:1.2-port0
E: DEVLINKS=/dev/bandrich /dev/serial/by-id/usb-BandRich__Inc._BandLuxe_HSPA-LTE_Adapter_357473040068155-if02-port0 /dev/serial/by-path/pci-0000:00:1a.0-usb-0:1.2:1.2-port0
E: DEVNAME=/dev/ttyUSB2
E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2:1.2/ttyUSB2/tty/ttyUSB2
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=BandLuxe_HSPA-LTE_Adapter
E: ID_MODEL_ENC=BandLuxe\x20HSPA-LTE\x20Adapter
E: ID_MODEL_FROM_DATABASE=4G LTE adapter
E: ID_MODEL_ID=100d
E: ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.2
E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_2
E: ID_REVISION=0000
E: ID_SERIAL=BandRich__Inc._BandLuxe_HSPA-LTE_Adapter_357473040068155
E: ID_SERIAL_SHORT=357473040068155
E: ID_TYPE=generic
E: ID_USB_DRIVER=option
E: ID_USB_INTERFACES=:ffffff:020600:0a0000:080650:
E: ID_USB_INTERFACE_NUM=02
E: ID_VENDOR=BandRich__Inc.
E: ID_VENDOR_ENC=BandRich\x2c\x20Inc.
E: ID_VENDOR_FROM_DATABASE=BandRich, Inc.
E: ID_VENDOR_ID=1a8d
E: MAJOR=188
E: MINOR=2
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=672068596
You can also run:
udevadm info -a -p /sys/bus/usb-serial/devices/ttyUSB0
udevadm info -a -p /sys/bus/usb-serial/devices/ttyUSB2
Note: after creating the udev files, you need to unplug/replug your
dongle for /dev/bandrich.data and /dev/bandrich.control to appear.
Note: the mode 0666 is for everyone to access the dongle (no need for
root privileges). If you prefer you can set it to 0600 (only root)
or 0660 (root and group).
Then you need to configure pppd, to get correct 'route' information when
you run wvdial.
The file /etc/ppp/peers/wvdial should have the following content:
noauth
name wvdial
usepeerdns
defaultroute
replacedefaultroute
The file wvdial.bandrich.conf has been created by copying some information
found on the Internet. Its content may not be fully correct. Adapt to your
situation. It seems to work here.
@@ -0,0 +1,2 @@
echo $SERVER_IP
timeout -s 9 20s iperf -c $SERVER_IP -i1
@@ -0,0 +1,3 @@
echo $SERVER_IP
echo $UDP_BANDWIDTH
timeout -s 9 20s iperf -c $SERVER_IP -i1 -u -b $UDP_BANDWIDTH
@@ -0,0 +1,6 @@
sudo rm -rf /tmp/oai_test_setup
mkdir /tmp/oai_test_setup
cd /tmp/oai_test_setup
git clone $REPOSITORY_URL oai
cd oai
git checkout $COMMIT_ID
@@ -0,0 +1,9 @@
cd /tmp/oai_test_setup/oai
source oaienv
cd cmake_targets
rm -rf log
mkdir -p log
echo $BUILD_ARGUMENTS
./build_oai $BUILD_ARGUMENTS
echo $BUILD_OUTPUT
ls $BUILD_OUTPUT
@@ -0,0 +1,2 @@
echo $EXEC $EXEC_ARGS
$EXEC $EXEC_ARGS
@@ -0,0 +1,8 @@
cd /tmp/oai_test_setup/oai
source oaienv
cd cmake_targets
rm -rf log
mkdir -p log
bash -c "$PRE_BUILD"
$BUILD_PROG $BUILD_ARGUMENTS
bash -c "$PRE_EXEC"
+103
View File
@@ -0,0 +1,103 @@
import sys, os, select, re, time
def quit(r):
sys.stdout.flush()
os._exit(r)
class ModemResponse:
def __init__(self, retcode, retstring):
self.ret = retcode
self.data = retstring
class Modem:
def open(self):
self.i = os.open(self.devname, os.O_RDONLY)
self.o = os.open(self.devname, os.O_WRONLY)
#clear output of modem, if any is pending (not sure of this)
while True:
(ri, ro, re) = select.select([self.i], [], [self.i], 0)
if len(ri) == 0:
break
l = os.read(self.i, 65536)
print "WARNING: modem had unread data: '" + \
l.replace('\r', '\\r') + "'"
def __init__(self, devname):
self.devname = devname
self.i = -1
self.o = -1
self.open()
def send(self, s):
print "DEBUG: SEND TO MODEM: '" + s + "'"
os.write(self.o, s+"\r")
def recv(self):
return os.read(self.i, 65536)
def wait(self):
ok = '\r\nOK\r\n'
error = '\r\nERROR\r\n'
cme_error = '\r\nCME ERROR:[^\r]*\r\n'
no_carrier = '\r\nNO CARRIER\r\n'
l = ''
while True:
l = l + self.recv()
print "DEBUG: CURRENT MODEM RESPONSE: '" + \
l.replace('\r','\\r').replace('\n','\\n') + "'"
#AT returned 'things' are "\r\nXXXX\r\n", look for that.
#Check if last one matches 'ok', 'error' or 'cme_error'.
#(Hopefully this is enough and no other reply is possible.)
#This code accepts invalid responses from modem, ie. all
#that does not fit in the 'findall' is thrashed away, maybe
#we want to do something in this case?
res = re.findall('\r\n[^\r]*\r\n', l)
if len(res) == 0:
print "DEBUG: NO MATCH: wait for more input from modem"
continue
last_res = res[len(res)-1]
print "DEBUG: CURRENT LAST LINE: '" + \
last_res.replace('\r','\\r').replace('\n','\\n')+"'"
if re.match(ok, last_res) != None:
return ModemResponse(True, l)
if ( re.match(error, last_res) != None or
re.match(cme_error, last_res) != None or
re.match(no_carrier, last_res) != None):
return ModemResponse(False, l)
#TODO purge?
#re.purge()
def modem_reset_cycle(self):
#close all
os.close(self.i)
os.close(self.o)
self.i = -1
self.o = -1
print "DEBUG: RESET CYCLE: wait for modem to go away"
#wait for file descriptor to go away
while True:
try:
test = os.open(self.devname, os.O_RDONLY)
os.close(test)
time.sleep(0.1)
except BaseException, e:
break
print "DEBUG: RESET CYCLE: modem has gone away"
print "DEBUG: RESET CYCLE: wait for modem to come back"
#wait for file descriptor to be back, try to open it over and over
#TODO: use inotify here? (it's not in basic python as it seems)
while True:
try:
test = os.open(self.devname, os.O_RDONLY)
os.close(test)
break
except BaseException, e:
time.sleep(0.1)
print "DEBUG: RESET CYCLE: modem is back"
#back to business
self.open()
@@ -0,0 +1,10 @@
#enable control+C reception (to be refined if it does not work)
stty isig intr ^C
cd /tmp/oai_test_setup/oai
source oaienv
cd cmake_targets/lte_build_oai/build
ulimit -c unlimited
sudo rm -f core
#sudo -E ./lte-softmodem -O $OPENAIR_DIR/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.conf
sudo -E ./lte-softmodem -O /tmp/enb.conf
@@ -0,0 +1,4 @@
stty isig intr ^C
#timeout -s 9 20s iperf -s -i1
iperf -s -i1
@@ -0,0 +1,4 @@
stty isig intr ^C
#timeout -s 9 20s iperf -s -i1 -u
iperf -s -i1 -u
@@ -0,0 +1,24 @@
#enable control+C reception (to be refined if it does not work)
stty isig intr ^C
#If /dev/bandrich is not present when we start the test, what to do?
#The following commented lines are an attempt at solving this.
#This is not satisfying, so we rather do nothing.
##the UE got stuck once, I had to run usb_modeswitch by hand.
##So at this point, if /dev/bandrich does not exist, maybe the UE is
##stuck for whatever reason. Let's forcefully run usb_modeswitch.
#if [ ! -e /dev/bandrich ]; then sudo usb_modeswitch -v 1a8d -p 1000 -I -W -K; true; fi
#
##wait for /dev/bandrich (TODO: use inotify?)
##may fail if the bandrich is in a bad state
#while [ ! -e /dev/bandrich ]; do sleep 1; done
cd /tmp/oai_test_setup/oai
source oaienv
cd cmake_targets/autotests/v2/actions
python start_bandrich.py
sudo wvdial -C wvdial.bandrich.conf || true
python stop_bandrich.py
@@ -0,0 +1,55 @@
import time
from modem import quit, Modem
try:
modem = Modem("/dev/bandrich.control")
#test that modem is there
print "INFO: check modem's presence"
modem.send('AT')
if modem.wait().ret != True:
print "ERROR: no modem?"
quit(1)
#activate the modem, be brutal and reset it too!
print "INFO: reset and activate the modem"
modem.send('AT+CFUN=1,1')
if modem.wait().ret != True:
print "ERROR: failed asking modem for activation"
quit(1)
#modem has gone! wait for it to pop up again
modem.modem_reset_cycle()
#wait for modem to be connected
#timeout after one minute
print "INFO: wait for modem to be connected (timeout: one minute)"
start_time = time.time()
while True:
modem.send('AT+CGATT?')
r = modem.wait()
if r.ret != True:
print "ERROR: failed checking attachment status of modem"
quit(1)
if "+CGATT: 1" in r.data:
break
if not "CGATT: 0" in r.data:
print "ERROR: bad data when checking attachment status of modem"
quit(1)
time.sleep(0.1)
if time.time() > start_time + 60:
print "ERROR: modem not connected after one minute, close modem"
modem.send('AT+CFUN=4')
r = modem.wait()
if r.ret != True:
print "ERROR: closing modem failed"
quit(1)
print "INFO: modem is connected"
except BaseException, e:
print "ERROR: " + str(e)
quit(1)
quit(0)
@@ -0,0 +1,29 @@
import time
from modem import quit, Modem
try:
modem = Modem("/dev/bandrich.control")
#test that modem is there
print "INFO: check modem's presence"
modem.send('AT')
r = modem.wait()
if r.ret != True and "NO CARRIER" not in r.data:
print "ERROR: no modem?"
quit(1)
if "NO CARRIER" in r.data:
print "WARNING: 'NO CARRIER' detected, not sure if handled correctly"
#deactivate the modem
print "INFO: deactivate the modem"
modem.send('AT+CFUN=4')
if modem.wait().ret != True:
print "ERROR: failed asking modem for deactivation"
quit(1)
except BaseException, e:
print "ERROR: " + str(e)
quit(1)
quit(0)
@@ -0,0 +1,36 @@
[Dialer Defaults]
Modem = /dev/bandrich.data
ISDN = off
Modem Type = Analog Modem
Baud = 9600
Init = ATZ
Init2 = AT+CPIN?
Init3 = AT+CGREG?
Init4 = AT+COPS?
Init5 = AT+CSQ
Init6 =
Init7 = AT+CGATT=1
Init8 =
Init9 =
Phone = *99***1#
Phone1 =
Phone2 =
Phone3 =
Phone4 =
Dial Prefix =
Dial Attempts = 1
Dial Command = ATM1L3DT
Ask Password = off
Password = ''
Username = ImaginLab
Auto Reconnect = off
Abort on Busy = off
Carrier Check = on
Check Def Route = on
Abort on No Dialtone = on
Stupid Mode = on
Idle Seconds = 0
Auto DNS = on
;Minimize = off
;Dock = off
;Do NOT edit this file by hand!
+389
View File
@@ -0,0 +1,389 @@
import threading, os, re
from utils import quickshell, log, TestFailed, do_tests
from task import Task, WAITLOG_SUCCESS
class alu_test:
def __init__(self,
epc, enb, ue,
openair,
user, password,
log_subdir,
env):
self.epc_machine = epc
self.enb_machine = enb
self.ue_machine = ue
self.openair_dir = openair
self.oai_user = user
self.oai_password = password
self.env = env
self.task_hss = None
self.task_enb = None
self.task_ue = None
self.logdir = openair + '/cmake_targets/autotests/log/' + log_subdir
quickshell('mkdir -p ' + self.logdir)
#event object used to wait for several tasks at once
self.event = threading.Event()
##########################################################################
# finish
##########################################################################
def finish(self):
#brutally kill tasks still running
#TODO: call 'wait', some processes may still be there as zombies
if self.task_hss != None and self.task_hss.alive():
self.task_hss.kill()
if self.task_enb != None and self.task_enb.alive():
self.task_enb.kill()
if self.task_ue != None and self.task_ue.alive():
self.task_ue.kill()
##########################################################################
# start_epc
##########################################################################
def start_epc(self):
#launch HSS, wait for prompt
log("INFO: ALU test: run HSS")
self.task_hss = Task("actions/alu_hss.bash",
"alu_hss",
self.epc_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/alu_hss." + self.epc_machine,
event=self.event)
self.task_hss.waitlog('S6AS_SIM-> ')
#then launch EPC, wait for connection on HSS side
log("INFO: ALU test: run EPC")
task_epc = Task("actions/alu_epc.bash",
"ALU EPC",
self.epc_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/alu_epc." + self.epc_machine)
ret = task_epc.wait()
if ret != 0:
log("ERROR: EPC start failure");
raise TestFailed()
self.task_hss.waitlog('Connected\n')
##########################################################################
# stop_epc
##########################################################################
def stop_epc(self):
#stop EPC, wait for disconnection on HSS side
log("INFO: ALU test: stop EPC")
task_epc = Task("actions/alu_epc_stop.bash",
"alu_epc_stop",
self.epc_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/alu_epc_stop." + self.epc_machine)
ret = task_epc.wait()
if ret != 0:
log("ERROR: ALU test: ALU EPC stop failed")
raise TestFailed()
self.task_hss.waitlog('Disconnected\n')
log("INFO: ALU test: stop HSS")
self.task_hss.sendnow("exit\n")
ret = self.task_hss.wait()
if ret != 0:
log("ERROR: ALU test: ALU HSS failed")
raise TestFailed()
##########################################################################
# compile_enb
##########################################################################
def compile_enb(self, build_arguments):
log("INFO: ALU test: compile softmodem")
envcomp = list(self.env)
envcomp.append('BUILD_ARGUMENTS="' + build_arguments + '"')
#we don't care about BUILD_OUTPUT but required (TODO: change that)
envcomp.append('BUILD_OUTPUT=/')
logdir = self.logdir + "/compile_log"
remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
post_action = "mkdir -p "+ logdir + \
" && sshpass -p " + self.oai_password + \
" scp -r " + self.oai_user + \
"@" + self.enb_machine + ":" + remote_files + " " + logdir + \
" || true"
task = Task("actions/compilation.bash",
"compile_softmodem",
self.enb_machine,
self.oai_user,
self.oai_password,
envcomp,
self.logdir + "/compile_softmodem." + self.enb_machine,
post_action=post_action)
ret = task.wait()
if ret != 0:
log("ERROR: softmodem compilation failure");
raise TestFailed()
task.postaction()
##########################################################################
# start_enb
##########################################################################
def start_enb(self, config_file):
#copy wanted configuration file
quickshell("sshpass -p " + self.oai_password +
" scp config/" + config_file + " " +
self.oai_user + "@" + self.enb_machine + ":/tmp/enb.conf")
#run softmodem
log("INFO: ALU test: run softmodem with configuration file " +
config_file)
self.task_enb = Task("actions/run_enb.bash",
"run_softmodem",
self.enb_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/run_softmodem." + self.enb_machine,
event=self.event)
self.task_enb.waitlog('got sync')
##########################################################################
# stop_enb
##########################################################################
def stop_enb(self):
log("INFO: ALU test: stop softmodem")
self.task_enb.sendnow("%c" % 3)
ret = self.task_enb.wait()
if ret != 0:
log("ERROR: ALU test: softmodem failed")
#not sure if we have to quit here or not
#os._exit(1)
##########################################################################
# start_bandrich_ue
##########################################################################
def start_bandrich_ue(self):
log("INFO: ALU test: start bandrich UE")
self.task_ue = Task("actions/start_bandrich.bash",
"start_bandrich",
self.ue_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/start_bandrich." + self.ue_machine,
event=self.event)
self.task_ue.waitlog("local IP address", event=self.event)
self.event.wait()
#at this point one task has died or we have the line in the log
if self.task_ue.waitlog_state != WAITLOG_SUCCESS:
log("ERROR: ALU test: bandrich UE did not connect")
raise TestFailed()
self.event.clear()
if ( not self.task_enb.alive() or
not self.task_hss.alive() or
not self.task_ue.alive()):
log("ERROR: ALU test: eNB, HSS or UE task died")
raise TestFailed()
#get bandrich UE IP
l = open(self.task_ue.logfile, "r").read()
self.bandrich_ue_ip = re.search("local IP address (.*)\n", l) \
.groups()[0]
log("INFO: ALU test: bandrich UE IP address: " + self.bandrich_ue_ip)
##########################################################################
# stop_bandrich_ue
##########################################################################
def stop_bandrich_ue(self):
log("INFO: ALU test: stop bandrich UE")
self.task_ue.sendnow("%c" % 3)
ret = self.task_ue.wait()
if ret != 0:
log("ERROR: ALU test: task bandrich UE failed")
#not sure if we have to quit here or not
#os._exit(1)
##########################################################################
# _do_traffic (internal function, do not call out of the class)
##########################################################################
def _do_traffic(self, name,
server_code, server_machine, server_ip,
client_code, client_machine,
waitlog,
server_logfile, client_logfile,
udp_bandwidth=None):
log("INFO: ALU test: run traffic: " + name)
log("INFO: ALU test: launch server")
task_traffic_server = Task("actions/" + server_code + ".bash",
server_logfile,
server_machine,
self.oai_user,
self.oai_password,
self.env,
self.logdir + "/" + server_logfile + "." + server_machine,
event=self.event)
task_traffic_server.waitlog(waitlog)
env = list(self.env)
if udp_bandwidth != None:
env.append("UDP_BANDWIDTH=" + udp_bandwidth)
env.append("SERVER_IP=" + server_ip)
log("INFO: ALU test: launch client")
task_traffic_client = Task("actions/" + client_code + ".bash",
client_logfile,
client_machine,
self.oai_user,
self.oai_password,
env,
self.logdir + "/" + client_logfile + "." + client_machine,
event=self.event)
log("INFO: ALU test: wait for client to finish (or some error)")
self.event.wait()
log("DEBUG: event.wait() done")
if ( not self.task_enb.alive() or
not self.task_hss.alive() or
not self.task_ue.alive()):
log("ERROR: unexpected task exited, test failed, kill all")
if task_traffic_client.alive():
task_traffic_client.kill()
if self.task_enb.alive():
self.task_enb.kill()
if self.task_ue.alive():
self.task_ue.kill()
ret = task_traffic_client.wait()
if ret != 0:
log("ERROR: ALU test: downlink traffic failed")
#not sure if we have to quit here or not
#os._exit(1)
#stop downlink server
#log("INFO: ALU test: stop server (kill ssh connection)")
#task_traffic_server.kill()
log("INFO: ALU test: stop server (ctrl+z then kill -9 %1)")
task_traffic_server.sendnow("%ckill -9 %%1 || true\n" % 26)
log("INFO: ALU test: wait for server to quit")
task_traffic_server.wait()
self.event.clear()
if ( not self.task_enb.alive() or
not self.task_hss.alive() or
not self.task_ue.alive()):
log("ERROR: ALU test: eNB, HSS or UE task died")
raise TestFailed()
##########################################################################
# dl_tcp
##########################################################################
def dl_tcp(self):
self._do_traffic("bandrich downlink TCP",
"server_tcp", self.ue_machine, self.bandrich_ue_ip,
"client_tcp", self.epc_machine,
"Server listening on TCP port 5001",
"bandrich_downlink_tcp_server",
"bandrich_downlink_tcp_client")
##########################################################################
# ul_tcp
##########################################################################
def ul_tcp(self):
self._do_traffic("bandrich uplink TCP",
"server_tcp", self.epc_machine, "192.172.0.1",
"client_tcp", self.ue_machine,
"Server listening on TCP port 5001",
"bandrich_uplink_tcp_server",
"bandrich_uplink_tcp_client")
##########################################################################
# dl_udp
##########################################################################
def dl_udp(self, bandwidth):
self._do_traffic("bandrich downlink UDP",
"server_udp", self.ue_machine, self.bandrich_ue_ip,
"client_udp", self.epc_machine,
"Server listening on UDP port 5001",
"bandrich_downlink_udp_server",
"bandrich_downlink_udp_client",
udp_bandwidth=bandwidth)
##########################################################################
# ul_udp
##########################################################################
def ul_udp(self, bandwidth):
self._do_traffic("bandrich uplink UDP",
"server_udp", self.epc_machine, "192.172.0.1",
"client_udp", self.ue_machine,
"Server listening on UDP port 5001",
"bandrich_uplink_udp_server",
"bandrich_uplink_udp_client",
udp_bandwidth=bandwidth)
##############################################################################
# run_b210_alu
##############################################################################
def run_b210_alu(tests, openair_dir, oai_user, oai_password, env):
if not do_tests(tests['b210']['alu']):
return
#compile eNB
alu = alu_test(epc='amerique', enb='hutch', ue='stevens',
openair=openair_dir,
user=oai_user, password=oai_password,
log_subdir='enb_tests/b210_alu/compile_enb',
env=env)
try:
alu.compile_enb("--eNB -w USRP -x -c --disable-cpu-affinity")
except BaseException, e:
log("ERROR: ALU test failed: eNB compilation failed: " + str(e))
return
#run tests
udp_dl_bandwidth = { "5" : "15M",
"10" : "30M",
"20" : "60M" }
udp_ul_bandwidth = { "5" : "7M",
"10" : "15M",
"20" : "15M" }
for bw in ('5', '10', '20'):
if do_tests(tests['b210']['alu'][bw]):
log("INFO: ALU test: run tests for bandwidth " + bw + " MHz")
ctest = tests['b210']['alu'][bw]
alu = alu_test(epc='amerique', enb='hutch', ue='stevens',
openair=openair_dir,
user=oai_user, password=oai_password,
log_subdir='enb_tests/b210_alu/' + bw,
env=env)
try:
alu.start_epc()
alu.start_enb("enb.band7.tm1.usrpb210." + bw + "MHz.conf")
if do_tests(ctest['bandrich']):
alu.start_bandrich_ue()
if do_tests(ctest['bandrich']['tcp']['dl']): alu.dl_tcp()
if do_tests(ctest['bandrich']['tcp']['ul']): alu.ul_tcp()
if do_tests(ctest['bandrich']['udp']['dl']):
alu.dl_udp(udp_dl_bandwidth[bw])
if do_tests(ctest['bandrich']['udp']['ul']):
alu.ul_udp(udp_ul_bandwidth[bw])
alu.stop_bandrich_ue()
alu.stop_enb()
alu.stop_epc()
except BaseException, e:
log("ERROR: ALU test failed: " + str(e))
alu.finish()
@@ -0,0 +1,175 @@
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "92";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -24;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -96;
pusch_alpha = "AL1";
pucch_p0_Nominal = -103;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -104;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
@@ -0,0 +1,175 @@
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "92";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 100;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -24;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -96;
pusch_alpha = "AL1";
pucch_p0_Nominal = -103;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -104;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
@@ -0,0 +1,175 @@
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "92";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -24;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -96;
pusch_alpha = "AL1";
pucch_p0_Nominal = -103;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -104;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
+104
View File
@@ -0,0 +1,104 @@
import os, subprocess, time, fcntl, termios, tty, signal, thread
from utils import log
class connection:
def __init__(self, description, host, user, password):
self.description = description
self.host = host
self.user = user
self.password = password
self.sendlock = thread.allocate_lock()
try:
(pid, fd) = os.forkpty()
except BaseException, e:
log("ERROR: forkpty for '" + description + "': " + e)
(pid, fd) = (-1, -1)
if pid == -1:
log("ERROR: creating connection for '" + description + "'")
os._exit(1)
# child process, run ssh
if pid == 0:
try:
os.execvp('sshpass', ['sshpass', '-p', password,
'ssh', user + '@' + host])
except BaseException, e:
log("ERROR: execvp for '" + description + "': " + e)
log("ERROR: execvp failed for '" + description + "'")
os._exit(1)
# parent process
# make the TTY raw to avoid getting input printed and no ^M
try:
tty.setraw(fd, termios.TCSANOW)
except BaseException, e:
log("ERROR: failed configuring TTY: " + str(e))
os._exit(1)
# try:
# fcntl.fcntl(fd, fcntl.F_SETFL,
# fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
# except:
# log("ERROR: fcntl failed for '" + description + "'")
# os._exit(1)
self.pid = pid
self.fd = fd
self.active = True
self.retcode = -1
def send(self, string):
if self.active == False:
log("ERROR: send: child is dead for '" + self.description + "'")
return -1
try:
(pid, out) = os.waitpid(self.pid, os.WNOHANG)
except BaseException, e:
log("ERROR: send: waitpid failed for '" + self.description +
"': " + str(e))
(pid, out) = (self.pid, 1)
if pid != 0:
log("ERROR: send: child process dead for '" +
self.description + "'")
try:
os.close(self.fd)
except BaseException, e:
#we don't care about errors at this point
pass
self.active = False
self.retcode = out
return -1
self.sendlock.acquire()
length = len(string)
while length != 0:
try:
ret = os.write(self.fd, string)
except BaseException, e:
log("ERROR: send fails for '" + self.description + "': " +
str(e))
os._exit(1)
if ret == 0:
log("ERROR: send: write returns 0 for '" +
self.description + "'")
os._exit(1)
length = length - ret
string = string[ret:]
self.sendlock.release()
return 0
def kill(self, signal=signal.SIGTERM):
log("INFO: kill connection '" + self.description + "'")
try:
os.kill(self.pid, signal)
except BaseException, e:
log("ERROR: connection.kill: " + str(e))
@@ -0,0 +1,79 @@
import threading, os
from utils import log
class MachineWaiterThread(threading.Thread):
def __init__(self, machine, tasks):
threading.Thread.__init__(self)
self.machine = machine
self.tasks = tasks
def run(self):
try:
for task in self.tasks:
ret = task.wait()
if ret != 0:
log("ERROR: task '" + task.description + "' failed " +
"on machine " + self.machine.name)
task.postaction()
self.machine.unbusy()
except BaseException, e:
log("ERROR: MachineWaiterThread: " + str(e))
os._exit(1)
class Machine():
def __init__(self, machine, cond):
self.name = machine
self.free = True
self.cond = cond
def busy(self, tasks):
waiter = MachineWaiterThread(self, tasks)
waiter.start()
def unbusy(self):
self.cond.acquire()
self.free = True
self.cond.notify()
self.cond.release()
class MachineList():
def __init__(self, list):
self.list = []
self.cond = threading.Condition()
for m in list:
self.list.append(Machine(m, self.cond))
def get_free_machine(self):
try:
self.cond.acquire()
while True:
free_machine = None
for m in self.list:
if m.free == True:
free_machine = m
break
if free_machine != None:
break
self.cond.wait()
free_machine.free = False
self.cond.release()
except BaseException, e:
log("ERROR: machine_list: " + str(e))
os._exit(1)
return free_machine
def wait_all_free(self):
try:
self.cond.acquire()
while True:
all_free = True
for m in self.list:
if m.free == False:
all_free = False
break
if all_free == True:
break
self.cond.wait()
self.cond.release()
except BaseException, e:
log("ERROR: machine_list: " + str(e))
os._exit(1)
+687
View File
@@ -0,0 +1,687 @@
#!/usr/bin/python
import os, re, sys, time, threading, thread
import xml.etree.ElementTree as ET
from utils import test_in_list, quickshell, log
from task import Task, WAITLOG_SUCCESS, WAITLOG_FAILURE
from machine_list import MachineList
oai_user = os.environ.get('OAI_USER')
oai_password = os.environ.get('OAI_PASS')
requested_tests = os.environ.get('OAI_TEST_CASE_GROUP')
machines = os.environ.get('MACHINELIST')
generic_machines = os.environ.get('MACHINELISTGENERIC')
result_dir = os.environ.get('RESULT_DIR')
nruns_softmodem = os.environ.get('NRUNS_LTE_SOFTMODEM')
openair_dir = os.environ.get('OPENAIR_DIR')
some_undef = False
if (oai_user == None) :
log("variable OAI_USER is not defined")
some_undef = True
if (oai_password == None) :
log("variable OAI_PASS is not defined")
some_undef = True
if (requested_tests == None) :
log("variable OAI_TEST_CASE_GROUP is not defined")
some_undef = True
if (machines == None) :
log("variable MACHINELIST is not defined")
some_undef = True
if (generic_machines == None) :
log("variable MACHINELISTGENERIC is not defined")
some_undef = True
if (result_dir == None) :
log("variable RESULT_DIR is not defined")
some_undef = True
if (nruns_softmodem == None) :
log("variable NRUNS_LTE_SOFTMODEM is not defined")
some_undef = True
if (openair_dir == None) :
log("variable OPENAIR_DIR is not defined")
some_undef = True
if (some_undef == True):
os._exit(1)
requested_tests = requested_tests .replace('"','')
machines = machines .replace('"','')
generic_machines = generic_machines .replace('"','')
xml_test_file = os.environ.get('OPENAIR_DIR') + \
"/cmake_targets/autotests/test_case_list.xml"
xmlTree = ET.parse(xml_test_file)
xmlRoot = xmlTree.getroot()
exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='')
all_tests=xmlRoot.findall('testCase')
exclusion_tests=exclusion_tests.split()
requested_tests=requested_tests.split()
#check that exclusion tests are well formatted
#(6 digits or less than 6 digits followed by +)
for test in exclusion_tests:
if (not re.match('^[0-9]{6}$', test) and
not re.match('^[0-9]{1,5}\+$', test)):
log("ERROR: exclusion test is invalidly formatted: " + test)
os._exit(1)
#check that requested tests are well formatted
#(6 digits or less than 6 digits followed by +)
#be verbose
for test in requested_tests:
if (re.match('^[0-9]{6}$', test) or
re.match('^[0-9]{1,5}\+$', test)):
log("INFO: test group/case requested: " + test)
else:
log("ERROR: requested test is invalidly formatted: " + test)
os._exit(1)
#get the list of tests to be done
todo_tests=[]
for test in all_tests:
if (test_in_list(test.get('id'), requested_tests) and
not test_in_list(test.get('id'), exclusion_tests)):
log("INFO: test will be run: " + test.get('id'))
todo_tests.append(test)
else:
log("INFO: test will be skipped: " + test.get('id'))
#get commit ID to use
commit_id = quickshell("git rev-parse --verify HEAD").replace('\n','')
if (len(commit_id) != 20*2):
log("ERROR: bad commit '" + commit_id + "'")
log("INFO: test for commit " + commit_id)
#get repository URL
repository_url = quickshell("git config remote.origin.url").replace('\n','')
log("INFO: repository URL: " + repository_url)
#prepare environment for tasks
env = []
env.append("REPOSITORY_URL=" + repository_url)
env.append("COMMIT_ID=" + commit_id)
#clone repository on all machines in the test setup
tasks=[]
for machine in machines.split():
tasks.append(Task("actions/clone_repository.bash",
"clone repository on " + machine,
machine,
oai_user,
oai_password,
env,
openair_dir + "/cmake_targets/autotests/log/clone." \
+ machine))
for task in tasks:
log("INFO: wait for task: " + task.description)
ret = task.wait()
if ret != 0 or not "TEST_SETUP_SUCCESS" in open(task.logfile).read():
log("ERROR: task failed: " + task.description)
os._exit(1)
##############################################################################
# run compilation tests #
##############################################################################
machine_list = MachineList(generic_machines.split())
for test in todo_tests:
action = test.findtext('class')
if action != 'compilation':
continue
id = test.get('id')
machine = machine_list.get_free_machine()
log("INFO: start " + action + " test " + id + " on machine " +
machine.name)
tasks = []
runenv = list(env)
runenv.append('OPENAIR_DIR=/tmp/oai_test_setup/oai')
runenv.append('BUILD_ARGUMENTS="'
+ test.findtext('compile_prog_args')
+ '"')
runenv.append('BUILD_OUTPUT="'
+ test.findtext('compile_prog_out')
.replace('\n','')
+ '"')
logdir = openair_dir +"/cmake_targets/autotests/log/"+ id +"/compile_log"
remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
post_action = "mkdir -p "+ logdir + \
" && sshpass -p " + oai_password + " scp -r " + oai_user + \
"@" + machine.name + ":" + remote_files + " " + logdir + \
" || true"
tasks.append(Task("actions/" + action + ".bash",
action + " of test " + id + " on " + machine.name,
machine.name,
oai_user,
oai_password,
runenv,
openair_dir + "/cmake_targets/autotests/log/"
+ id + "."
+ machine.name,
post_action=post_action))
machine.busy(tasks)
##############################################################################
# run execution tests #
##############################################################################
class ExecutionThread(threading.Thread):
def __init__(self, id, machine, test):
threading.Thread.__init__(self)
self.machine = machine
self.id = id
self.test = test
def run(self):
id = self.id
machine = self.machine
test = self.test
# step 1: compile
log("INFO: start compilation of test " + id + " on machine " +
machine.name)
tasks = []
runenv = list(env)
runenv.append('OPENAIR_DIR=/tmp/oai_test_setup/oai')
runenv.append('PRE_BUILD="'
+ test.findtext('pre_compile_prog')
+ '"')
runenv.append('BUILD_PROG="'
+ test.findtext('compile_prog')
+ '"')
runenv.append('BUILD_ARGUMENTS="'
+ test.findtext('compile_prog_args')
+ '"')
runenv.append('PRE_EXEC="'
+ test.findtext('pre_exec') + " "
+ test.findtext('pre_exec_args')
+ '"')
logdir = openair_dir +"/cmake_targets/autotests/log/"+ id + \
"/compile_log"
remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
post_action = "mkdir -p "+ logdir + \
" && sshpass -p " + oai_password + \
" scp -r " + oai_user + "@" + machine.name + ":" + \
remote_files + " " + logdir + \
" || true"
task = Task("actions/execution_compile.bash",
"compilation of test " + id + " on " + machine.name,
machine.name,
oai_user,
oai_password,
runenv,
openair_dir + "/cmake_targets/autotests/log/"
+ id + "_compile."
+ machine.name,
post_action=post_action)
ret = task.wait()
task.postaction()
if ret != 0:
log("ERROR: compilation of test " + id + " failed: " + str(ret))
machine.unbusy()
return
#step 2: run all tests
nruns = test.findtext('nruns')
args = test.findtext('main_exec_args')
i = 0
for arg in args.splitlines():
i = i+1
runenv2 = list(runenv)
runenv2.append('OPENAIR_TARGET=/tmp/oai_test_setup/oai/targets')
runenv2.append('EXEC="'
+ test.findtext('main_exec')
+ '"')
runenv2.append('EXEC_ARGS="' + arg + '"')
for run in range(int(nruns)):
log("INFO: start execution of test " + id + " case " +
str(i) + " run " + str(run) + " on machine " +
machine.name)
task =Task("actions/execution.bash",
"execution of test " + id + " on " + machine.name,
machine.name,
oai_user,
oai_password,
runenv2,
openair_dir + "/cmake_targets/autotests/log/"
+ id + "_case_" + str(i) + "_run_" + str(run)
+ "." + machine.name)
ret = task.wait()
if ret != 0:
log("ERROR: execution of test " +id+ " failed: " +
str(ret))
machine.unbusy()
for test in todo_tests:
action = test.findtext('class')
if action != 'execution':
continue
id = test.get('id')
machine = machine_list.get_free_machine()
ExecutionThread(id, machine, test).start()
#wait for compilation/execution tests to be finished
#log only if some compilation/execution tests are actually done
for test in todo_tests:
action = test.findtext('class')
if action == 'execution' or action == 'compilation':
log("INFO: requested compilation/execution tests " +
"have been launched, waiting for completion")
break
machine_list.wait_all_free()
##############################################################################
# run eNB softmodem tests #
##############################################################################
tests = {
'b210' : {
'alu' : {
'5' : {
'bandrich' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }},
'sony' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }}},
'10' : {
'bandrich' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }},
'sony' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }}},
'20' : {
'bandrich' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }},
'sony' : {
'tcp' : { 'ul': False, 'dl' : False },
'udp' : { 'ul': False, 'dl' : False }}}},
'openair-cn' : {}
},
'x310' : {
'alu' : {},
'openair-cn' : {}
},
'exmimo2' : {
'alu' : {},
'openair-cn' : {}
}
}
todo_tests_ids = []
for test in todo_tests:
todo_tests_ids.append(test.get('id'))
for test in todo_tests_ids:
if test=='015500':tests['b210']['alu'][ '5']['bandrich']['udp']['ul']=True
if test=='015501':tests['b210']['alu']['10']['bandrich']['udp']['ul']=True
if test=='015502':tests['b210']['alu']['20']['bandrich']['udp']['ul']=True
if test=='015503':tests['b210']['alu'][ '5']['bandrich']['udp']['dl']=True
if test=='015504':tests['b210']['alu']['10']['bandrich']['udp']['dl']=True
if test=='015505':tests['b210']['alu']['20']['bandrich']['udp']['dl']=True
if test=='015506':log('WARNING: skip test ' + test) #TODO
if test=='015507':log('WARNING: skip test ' + test) #TODO
if test=='015508':log('WARNING: skip test ' + test) #TODO
if test=='015509':log('WARNING: skip test ' + test) #TODO
if test=='015510':log('WARNING: skip test ' + test) #TODO
if test=='015511':log('WARNING: skip test ' + test) #TODO
if test=='015512':tests['b210']['alu'][ '5']['bandrich']['tcp']['ul']=True
if test=='015513':tests['b210']['alu']['10']['bandrich']['tcp']['ul']=True
if test=='015514':tests['b210']['alu']['20']['bandrich']['tcp']['ul']=True
if test=='015515':tests['b210']['alu'][ '5']['bandrich']['tcp']['dl']=True
if test=='015516':tests['b210']['alu']['10']['bandrich']['tcp']['dl']=True
if test=='015517':tests['b210']['alu']['20']['bandrich']['tcp']['dl']=True
if test=='015518':log('WARNING: skip test ' + test) #TODO
if test=='015519':log('WARNING: skip test ' + test) #TODO
if test=='015520':log('WARNING: skip test ' + test) #TODO
if test=='015521':log('WARNING: skip test ' + test) #TODO
if test=='015522':log('WARNING: skip test ' + test) #TODO
if test=='015523':log('WARNING: skip test ' + test) #TODO
if test=='015600':log('WARNING: skip test ' + test) #TODO
if test=='015601':log('WARNING: skip test ' + test) #TODO
if test=='015602':log('WARNING: skip test ' + test) #TODO
if test=='015603':log('WARNING: skip test ' + test) #TODO
if test=='015604':log('WARNING: skip test ' + test) #TODO
if test=='015605':log('WARNING: skip test ' + test) #TODO
if test=='015700':log('WARNING: skip test ' + test) #TODO
if test=='015701':log('WARNING: skip test ' + test) #TODO
if test=='015702':log('WARNING: skip test ' + test) #TODO
if test=='015703':log('WARNING: skip test ' + test) #TODO
if test=='015704':log('WARNING: skip test ' + test) #TODO
if test=='015705':log('WARNING: skip test ' + test) #TODO
if test=='015800':log('WARNING: skip test ' + test) #TODO
if test=='015801':log('WARNING: skip test ' + test) #TODO
if test=='015802':log('WARNING: skip test ' + test) #TODO
if test=='015803':log('WARNING: skip test ' + test) #TODO
if test=='015804':log('WARNING: skip test ' + test) #TODO
if test=='015805':log('WARNING: skip test ' + test) #TODO
if test=='015806':log('WARNING: skip test ' + test) #TODO
if test=='015807':log('WARNING: skip test ' + test) #TODO
if test=='015808':log('WARNING: skip test ' + test) #TODO
if test=='015809':log('WARNING: skip test ' + test) #TODO
if test=='015810':log('WARNING: skip test ' + test) #TODO
if test=='015811':log('WARNING: skip test ' + test) #TODO
if test=='015812':log('WARNING: skip test ' + test) #TODO
if test=='015813':log('WARNING: skip test ' + test) #TODO
if test=='015814':log('WARNING: skip test ' + test) #TODO
if test=='015815':log('WARNING: skip test ' + test) #TODO
if test=='015816':log('WARNING: skip test ' + test) #TODO
if test=='015817':log('WARNING: skip test ' + test) #TODO
if test=='015818':log('WARNING: skip test ' + test) #TODO
if test=='015819':log('WARNING: skip test ' + test) #TODO
if test=='015820':log('WARNING: skip test ' + test) #TODO
if test=='015821':log('WARNING: skip test ' + test) #TODO
if test=='015822':log('WARNING: skip test ' + test) #TODO
if test=='015823':log('WARNING: skip test ' + test) #TODO
if test=='016000':log('WARNING: skip test ' + test) #TODO
if test=='016001':log('WARNING: skip test ' + test) #TODO
if test=='016002':log('WARNING: skip test ' + test) #TODO
if test=='016003':log('WARNING: skip test ' + test) #TODO
if test=='016004':log('WARNING: skip test ' + test) #TODO
if test=='016005':log('WARNING: skip test ' + test) #TODO
if test=='016100':log('WARNING: skip test ' + test) #TODO
if test=='016101':log('WARNING: skip test ' + test) #TODO
if test=='016102':log('WARNING: skip test ' + test) #TODO
if test=='016103':log('WARNING: skip test ' + test) #TODO
if test=='016104':log('WARNING: skip test ' + test) #TODO
if test=='016105':log('WARNING: skip test ' + test) #TODO
if test=='016300':log('WARNING: skip test ' + test) #TODO
if test=='016301':log('WARNING: skip test ' + test) #TODO
if test=='016302':log('WARNING: skip test ' + test) #TODO
if test=='016303':log('WARNING: skip test ' + test) #TODO
if test=='016304':log('WARNING: skip test ' + test) #TODO
if test=='016305':log('WARNING: skip test ' + test) #TODO
if test=='016500':log('WARNING: skip test ' + test) #TODO
if test=='016501':log('WARNING: skip test ' + test) #TODO
if test=='016502':log('WARNING: skip test ' + test) #TODO
if test=='016503':log('WARNING: skip test ' + test) #TODO
if test=='016504':log('WARNING: skip test ' + test) #TODO
if test=='016505':log('WARNING: skip test ' + test) #TODO
if test=='017000':log('WARNING: skip test ' + test) #TODO
if test=='017001':log('WARNING: skip test ' + test) #TODO
if test=='017002':log('WARNING: skip test ' + test) #TODO
if test=='017003':log('WARNING: skip test ' + test) #TODO
if test=='017004':log('WARNING: skip test ' + test) #TODO
if test=='017005':log('WARNING: skip test ' + test) #TODO
if test=='017500':log('WARNING: skip test ' + test) #TODO
if test=='017501':log('WARNING: skip test ' + test) #TODO
if test=='017502':log('WARNING: skip test ' + test) #TODO
if test=='017503':log('WARNING: skip test ' + test) #TODO
if test=='017504':log('WARNING: skip test ' + test) #TODO
if test=='017505':log('WARNING: skip test ' + test) #TODO
if test=='018000':log('WARNING: skip test ' + test) #TODO
if test=='018001':log('WARNING: skip test ' + test) #TODO
if test=='018002':log('WARNING: skip test ' + test) #TODO
if test=='018003':log('WARNING: skip test ' + test) #TODO
if test=='018004':log('WARNING: skip test ' + test) #TODO
if test=='018005':log('WARNING: skip test ' + test) #TODO
if test=='018500':log('WARNING: skip test ' + test) #TODO
if test=='018501':log('WARNING: skip test ' + test) #TODO
if test=='018502':log('WARNING: skip test ' + test) #TODO
if test=='018503':log('WARNING: skip test ' + test) #TODO
if test=='018504':log('WARNING: skip test ' + test) #TODO
if test=='018505':log('WARNING: skip test ' + test) #TODO
if test=='025500':log('WARNING: skip test ' + test) #TODO
if test=='025501':log('WARNING: skip test ' + test) #TODO
if test=='025502':log('WARNING: skip test ' + test) #TODO
if test=='025503':log('WARNING: skip test ' + test) #TODO
if test=='025504':log('WARNING: skip test ' + test) #TODO
if test=='025505':log('WARNING: skip test ' + test) #TODO
if test=='025506':log('WARNING: skip test ' + test) #TODO
if test=='025507':log('WARNING: skip test ' + test) #TODO
if test=='025508':log('WARNING: skip test ' + test) #TODO
if test=='025509':log('WARNING: skip test ' + test) #TODO
if test=='025510':log('WARNING: skip test ' + test) #TODO
if test=='025511':log('WARNING: skip test ' + test) #TODO
if test=='025512':log('WARNING: skip test ' + test) #TODO
if test=='025513':log('WARNING: skip test ' + test) #TODO
if test=='025514':log('WARNING: skip test ' + test) #TODO
if test=='025515':log('WARNING: skip test ' + test) #TODO
if test=='025516':log('WARNING: skip test ' + test) #TODO
if test=='025517':log('WARNING: skip test ' + test) #TODO
if test=='025518':log('WARNING: skip test ' + test) #TODO
if test=='025519':log('WARNING: skip test ' + test) #TODO
if test=='025520':log('WARNING: skip test ' + test) #TODO
if test=='025521':log('WARNING: skip test ' + test) #TODO
if test=='025522':log('WARNING: skip test ' + test) #TODO
if test=='025523':log('WARNING: skip test ' + test) #TODO
if test=='025700':log('WARNING: skip test ' + test) #TODO
if test=='025701':log('WARNING: skip test ' + test) #TODO
if test=='025702':log('WARNING: skip test ' + test) #TODO
if test=='025703':log('WARNING: skip test ' + test) #TODO
if test=='025704':log('WARNING: skip test ' + test) #TODO
if test=='025705':log('WARNING: skip test ' + test) #TODO
from alu_test import run_b210_alu
#B210 ALU tests
run_b210_alu(tests, openair_dir, oai_user, oai_password, env)
#for test in todo_tests:
# action = test.findtext('class')
# if action != 'lte-softmodem':
# continue
# if not "start_ltebox" in test.findtext('EPC_main_exec'):
# continue
# id = test.get('id')
# log("INFO: Running ALU test " + id)
# logdir = openair_dir + "/cmake_targets/autotests/log/" + id
# quickshell("mkdir -p " + logdir)
# epc_machine = test.findtext('EPC')
# enb_machine = test.findtext('eNB')
# ue_machine = test.findtext('UE')
#
# #event object used to wait for several tasks at once
# event = threading.Event()
#
# #launch HSS, wait for prompt
# log("INFO: " + id + ": run HSS")
# task_hss = Task("actions/alu_hss.bash",
# "ALU HSS",
# epc_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/alu_hss." + epc_machine, event=event)
# task_hss.waitlog('S6AS_SIM-> ')
#
# #then launch EPC, wait for connection on HSS side
# log("INFO: " + id + ": run EPC")
# task = Task("actions/alu_epc.bash",
# "ALU EPC",
# epc_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/alu_epc." + epc_machine)
# ret = task.wait()
# if ret != 0:
# log("ERROR: EPC start failure");
# os._exit(1)
# task_hss.waitlog('Connected\n')
#
# #compile softmodem
# log("INFO: " + id + ": compile softmodem")
# envcomp = list(env)
# envcomp.append('BUILD_ARGUMENTS="' +
# test.findtext('eNB_compile_prog_args') + '"')
# #we don't care about BUILD_OUTPUT but it's required (TODO: change that)
# envcomp.append('BUILD_OUTPUT=/')
# task = Task("actions/compilation.bash",
# "compile softmodem",
# enb_machine,
# oai_user,
# oai_password,
# envcomp,
# logdir + "/compile_softmodem." + enb_machine)
# ret = task.wait()
# if ret != 0:
# log("ERROR: softmodem compilation failure");
# os._exit(1)
#
## #copy wanted configuration file
## quickshell("sshpass -p " + oai_password +
## " scp config/enb.band7.tm1.usrpb210.conf " +
## oai_user + "@" + enb_machine + ":/tmp/enb.conf")
#
# #run softmodem
# log("INFO: " + id + ": run softmodem")
# task_enb = Task("actions/run_enb.bash",
# "run softmodem",
# enb_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/run_softmodem." + enb_machine, event=event)
# task_enb.waitlog('got sync')
#
# #start UE
# log("INFO: " + id + ": start bandrich UE")
# task_ue = Task("actions/start_bandrich.bash",
# "start bandrich UE",
# ue_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/start_bandrich." + ue_machine, event=event)
# task_ue.waitlog("local IP address", event=event)
#
# event.wait()
#
# #at this point one task has died or we have the line in the log
# if task_ue.waitlog_state != WAITLOG_SUCCESS:
# log("ERROR: " + id + ": bandrich UE did not connect")
# os._exit(1)
#
# event.clear()
#
# if ( not task_enb.alive() or
# not task_hss.alive() or
# not task_ue.alive()):
# log("ERROR: " + id + ": eNB or UE tasks died")
# os._exit(1)
#
# #get bandrich UE IP
# l = open(task_ue.logfile, "r").read()
# ue_ip = re.search("local IP address (.*)\n", l).groups()[0]
# log("INFO: " + id + ": bandrich UE IP address: " + ue_ip)
#
# #run traffic
# log("INFO: " + id + ": run downlink TCP traffic")
#
# log("INFO: " + id + ": launch server")
# task_traffic_ue = Task("actions/downlink_bandrich.bash",
# "start iperf on bandrich UE as server",
# ue_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/downlink_bandrich." + ue_machine,
# event=event)
# task_traffic_ue.waitlog("Server listening on TCP port 5001")
#
# log("INFO: " + id + ": launch client")
# envepc = list(env)
# envepc.append("UE_IP=" + ue_ip)
# task = Task("actions/downlink_epc.bash",
# "start iperf on EPC as client",
# epc_machine,
# oai_user,
# oai_password,
# envepc,
# logdir + "/downlink_epc." + epc_machine, event=event)
# log("INFO: " + id + ": wait for client (or some error)")
#
# event.wait()
# log("DEBUG: event.wait() done")
#
# if ( not task_enb.alive() or
# not task_hss.alive() or
# not task_ue.alive()):
# log("ERROR: unexpected task exited, test failed, kill all")
# if task.alive():
# task.kill()
# if task_enb.alive():
# task_enb.kill()
# if task_ue.alive():
# task_ue.kill()
#
# ret = task.wait()
# if ret != 0:
# log("ERROR: " + id + ": downlink traffic failed")
# #not sure if we have to quit here or not
# #os._exit(1)
#
# #stop downlink server
# log("INFO: " + id + ": stop server (kill ssh connection)")
# task_traffic_ue.kill()
# log("INFO: " + id + ": wait for server to quit")
# task_traffic_ue.wait()
#
# #stop UE
# log("INFO: " + id + ": stop bandrich UE")
# task_ue.sendnow("%c" % 3)
# ret = task_ue.wait()
# if ret != 0:
# log("ERROR: " + id + ": task bandrich UE failed")
# #not sure if we have to quit here or not
# #os._exit(1)
#
# #stop softmodem
# log("INFO: " + id + ": stop softmodem")
# task_enb.sendnow("%c" % 3)
# ret = task_enb.wait()
# if ret != 0:
# log("ERROR: " + id + ": softmodem failed")
# #not sure if we have to quit here or not
# #os._exit(1)
#
# #stop EPC, wait for disconnection on HSS side
# log("INFO: " + id + ": stop EPC")
# task = Task("actions/alu_epc_stop.bash",
# "ALU EPC stop",
# epc_machine,
# oai_user,
# oai_password,
# env,
# logdir + "/alu_epc_stop." + epc_machine)
# ret = task.wait()
# if ret != 0:
# log("ERROR: " + id + ": ALU EPC stop failed")
# os._exit(1)
# task_hss.waitlog('Disconnected\n')
#
# log("INFO: " + id + ": stop HSS")
# task_hss.sendnow("exit\n")
# ret = task_hss.wait()
# if ret != 0:
# log("ERROR: " + id + ": ALU HSS failed")
# os._exit(1)
import utils
log(utils.GREEN + "GOODBYE" + utils.RESET)
#os._exit(0)
#run lte softmodem tests
+370
View File
@@ -0,0 +1,370 @@
import os, time, threading, sys, os, errno, select
from connection import connection
import utils
from utils import log
#this class is to communicate between reader and sender threads
#the reader increments a count each time it receives the prompt
#and wakes up the sender
#it also indicates when it exits so the sender can exit too
#the sender (calling get) waits for the count to be greated than passed
#argument or if reader exited
#it returns argument+1 if things okay, -1 if reader exited
class Counter:
def __init__(self):
self.count = 0
self.cond = threading.Condition()
def inc(self):
self.cond.acquire()
self.count = self.count + 1
self.cond.notify()
self.cond.release()
def set(self, value):
self.cond.acquire()
self.count = value
self.cond.notify()
self.cond.release()
def get(self, current):
self.cond.acquire()
while True:
if self.count == -1:
ret = -1
break
if self.count >= current + 1:
ret = current + 1
break
self.cond.wait()
self.cond.release()
return ret
#this class is used for the main application to wait for some specific
#output from the remote program (typically the ALU HSS prompt, indicating
#it is ready and we can proceed further)
#(too much classes...)
class ProducerConsumer:
def __init__(self):
self.count = 0
self.cond = threading.Condition()
def add(self, v):
self.cond.acquire()
self.count = self.count + v
self.cond.notify()
self.cond.release()
def set(self, v):
self.cond.acquire()
self.count = v
self.cond.notify()
self.cond.release()
def get(self, old):
self.cond.acquire()
while True:
if self.count == -1:
ret = -1
break
if self.count > old:
ret = self.count
break
self.cond.wait()
self.cond.release()
return ret
#this thread gets input from the child process of the task
#it removes the prompts it gets (be carefully to use a prompt
#that will not be output of any command otherwise you dead)
class ReaderThread(threading.Thread):
def __init__(self, fdin, logfile, prompt, prompt_counter, producer):
threading.Thread.__init__(self)
self.fdin = fdin
self.logfile = logfile
self.prompt_counter = prompt_counter
self.prompt = prompt
self.promptsize = len(prompt)
self.stack = ""
self.stacksize = 0
self.producer = producer
def run(self):
try:
outfile = open(self.logfile, "w")
except BaseException, e:
log("ERROR: ReaderThread: " + self.logfile + ": " + str(e))
os._exit(1)
while True:
try:
(a, b, c) = select.select([ self.fdin ], [], [ self.fdin ])
except BaseException, e:
log("ERROR: ReaderThread: " + self.logfile +
": select failed: " + str(e))
os._exit(1)
try:
z = os.read(self.fdin, 1024)
except OSError, e:
if e.errno == errno.EIO:
#pipe has died, quit the thread
break
else:
log("ERROR: ReaderThread: " + self.logfile +
": unhandled error: " + str(e))
except BaseException, e:
log("ERROR: ReaderThread: " + self.logfile +
": unhandled error: " + str(e))
break
try:
produced = 0
#this part is to remove the prompt
for x in z:
if x == self.prompt[self.stacksize]:
self.stack = self.stack + x
self.stacksize = self.stacksize + 1
if self.stacksize == self.promptsize:
self.prompt_counter.inc()
self.stack = ""
self.stacksize = 0
else:
outfile.write(self.stack)
outfile.write(x)
produced = produced + len(self.stack) + len(x)
self.stack = ""
self.stacksize = 0
outfile.flush()
self.producer.add(produced)
except BaseException, e:
log("ERROR: ReaderThread: " + self.logfile + ": " + str(e))
os._exit(1)
try:
outfile.close()
except BaseException, e:
log("ERROR: ReaderThread: " + self.logfile + ": " + str(e))
os._exit(1)
#close the pipe, don't care about errors
try:
os.close(self.fdin)
except:
pass
#signal sender to quit
self.prompt_counter.set(-1)
self.producer.set(-1)
class SenderQuit(Exception):
pass
#this thread sends commands to the child process of the task
#it waits for the prompt between each command
#'event' is used for the main thread to wait for one of several tasks
#to quit, meaning error or end-of-test
class SenderThread(threading.Thread):
def __init__(self, fdout, prompt_counter, connection, env, action,
description, prompt, event=None):
threading.Thread.__init__(self)
self.fdin = fdout
self.prompt_counter = prompt_counter
self.connection = connection
self.env = env
self.action = action
self.description = description
self.prompt = prompt
self.count = 0
self.event = event
self.alive = True
def wait_prompt(self):
self.count = self.prompt_counter.get(self.count)
if self.count == -1:
raise SenderQuit()
def _run(self):
self.connection.send('export PS1=' + self.prompt + '\n')
self.wait_prompt()
self.connection.send('set +o emacs\n')
self.wait_prompt()
self.connection.send('echo\n')
self.wait_prompt()
self.connection.send('echo\n')
self.wait_prompt()
self.connection.send("echo -e '" + utils.GREEN +
'---------------------------------------------'
+ utils.RESET + "'\n")
self.wait_prompt()
self.connection.send('echo\n')
self.wait_prompt()
self.connection.send("echo -n -e '" + utils.YELLOW +
"COMMANDS START: " +
utils.RESET + "'\n")
self.wait_prompt()
self.connection.send('date\n')
self.wait_prompt()
for l in self.env:
self.connection.send('export ' + l + '\n')
self.wait_prompt()
with open(self.action) as f:
for line in f:
self.connection.send("echo -n -e '" + utils.GREEN +
"RUNNING: " + utils.RESET + "'\n")
self.wait_prompt()
self.connection.send("echo '" +
line.replace('\n','')
.replace("'", "'\\''") + "'\n")
self.wait_prompt()
self.connection.send(line)
self.wait_prompt()
self.connection.send("if [ $? != 0 ]; then " +
"echo -e '" + utils.RED +
"TEST_SETUP_ERROR: " + utils.RESET +
"last command failed, exiting'; " +
"date; exit 1; fi\n")
self.wait_prompt()
self.connection.send("echo -n -e '" + utils.YELLOW +
"COMMANDS DONE: " +
utils.RESET + "'\n")
self.wait_prompt()
self.connection.send('date\n')
self.wait_prompt()
self.connection.send("echo -e '" + utils.GREEN +
"TEST_SETUP_SUCCESS" + utils.RESET + "'\n")
self.wait_prompt()
self.connection.send('exit\n')
def run(self):
try:
self._run()
except SenderQuit:
log("WARNING: '" + self.description + "' exits too early?")
pass
except BaseException, e:
log("ERROR: task failed: " + str(e))
log("ERROR: action is: " + self.action)
log("ERROR: description is: " + self.description)
os._exit(1)
self.alive = False
if self.event != None:
self.event.set()
WAITLOG_RUNNING = 0
WAITLOG_SUCCESS = 1
WAITLOG_FAILURE = 2
class WaitlogFailed(Exception):
pass
#'event' is used by main thread to wait for any of several threads to quit.
#'Task' passes it the 'SenderThread' above, which sets it when it finishes.
class Task:
def __init__(self, action, description, machine, user, password, env,
logfile, post_action = None, event=None):
self.action = action
self.description = description
self.machine = machine
self.user = user
self.password = password
self.post_action = post_action
self.producer = ProducerConsumer()
self.logfile = logfile
prompt = "__OAI_TEST_SETUP_PROMPT__:"
prompt_counter = Counter()
self.connection = connection(description, machine, user, password)
self.reader = ReaderThread(self.connection.fd, logfile, prompt,
prompt_counter, self.producer)
self.reader.start()
self.sender = SenderThread(self.connection.fd, prompt_counter,
self.connection, env, action, description,
prompt, event)
self.sender.start()
def wait(self, timeout=-1):
if self.connection.active == False:
return self.connection.retcode
try:
(pid, ret) = os.waitpid(self.connection.pid, 0)
except KeyboardInterrupt, e:
log("ERROR: ctrl+c catched! " + str(e))
os._exit(1)
except BaseException, e:
log("ERROR: " + str(e))
os._exit(1)
self.sender.join()
self.reader.join()
return ret
#this function should not be called, it is used internally by 'waitlog'
#in mode 'background thread'
#TODO: join() the thread at some point
def _waitlog_thread(self, task, s):
consumed = 0
while True:
consumed = task.producer.get(consumed)
if consumed == -1:
log("ERROR: string '" + s + "' not found in logfile " +
task.logfile)
task.waitlog_state = WAITLOG_FAILURE
task.waitlog_event.set()
return
if s in open(task.logfile).read():
task.waitlog_state = WAITLOG_SUCCESS
task.waitlog_event.set()
return
#two ways to wait for a string in the log file:
# - blocking way
# - background thread, using an Event to signal success/failure
def waitlog(self, s, event=None):
if event != None:
self.waitlog_state = WAITLOG_RUNNING
self.waitlog_event = event
self.waitlog_thread = \
threading.Thread(target=self._waitlog_thread,
args=(self, s))
self.waitlog_thread.start()
return
#TODO: optimize, do not process all the file at each wakeup
consumed = 0
while True:
consumed = self.producer.get(consumed)
if consumed == -1:
log("ERROR: string '" + s + "' not found in logfile " +
self.logfile)
raise WaitlogFailed()
if s in open(self.logfile).read():
return
def sendnow(self, x):
self.connection.send(x)
def alive(self):
return self.sender.alive
def kill(self):
self.connection.kill()
#put some error log in logfile, for verbosity
try:
f = open(self.logfile, "a+")
f.write("\n\n" + utils.RED + "TEST_SETUP_ERROR: " + utils.RESET +
"task killed by test setup\n\n");
close(f)
except BaseException, e:
pass
def postaction(self):
if self.post_action != None:
out = utils.quickshell(self.post_action)
if len(out):
log("INFO: task '" + self.description +
"' post_action '" + self.post_action + "' says: ")
for l in out.splitlines():
log("INFO: " + l)
+84
View File
@@ -0,0 +1,84 @@
import subprocess, os, thread, sys, time
#logging facitiliy
#TODO: simplify (a first version redefined stdout, then we replaced 'print'
#instead, keeping stuff as is)
class Logger:
def __init__(self, stream):
self.stream = stream
self.start_of_line = True
self.lock = thread.allocate_lock()
openair_dir = os.environ.get('OPENAIR_DIR')
if openair_dir == None:
print "FATAL: no OPENAIR_DIR"
os._exit(1)
try:
self.logfile = open(openair_dir +
"/cmake_targets/autotests/log/python.stdout", "w")
except BaseException, e:
print "FATAL: cannot create log file"
print e
os._exit(1)
def put(self, data):
self.stream.write(data)
self.logfile.write(data)
def write(self, data):
self.lock.acquire()
for c in data:
if self.start_of_line:
self.start_of_line = False
t = time.strftime("%H:%M:%S", time.localtime()) + ": "
self.stream.write(t)
self.logfile.write(t)
self.put(c)
if c == '\n':
self.start_of_line = True
self.stream.flush()
self.logfile.flush()
self.lock.release()
logger = Logger(sys.stdout)
def log(x):
logger.write(x + "\n")
#check if given test is in list
#it is in list if one of the strings in 'list' is at the beginning of 'test'
def test_in_list(test, list):
for check in list:
check=check.replace('+','')
if (test.startswith(check)):
return True
return False
#run a local command in a shell
def quickshell(command):
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
(retout, reterr) = process.communicate()
if (process.returncode != 0):
log("ERROR: shell command failed: " + command)
if len(retout):
log("ERROR: command says: ")
for l in retout.splitlines():
log("ERROR: " + l)
os._exit(1)
return retout
RED="\x1b[31m"
GREEN="\x1b[32m"
YELLOW="\x1b[33m"
RESET="\x1b[m"
#an exception raised when a test fails
class TestFailed(Exception):
pass
#this function returns True if a test in 'x' is set to True
#to be used as: if do_tests(tests['b210']['alu']) ...
def do_tests(x):
if type(x) == list:
for v in x:
if do_tests(v): return True
return False
if type(x) == dict: return do_tests(x.values())
if x == True: return True
return False
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
#WARNING: this file may not work properly, be sure to know what you
#do when using it
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.0 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
################################################################################
# file init_nas_s1
# brief loads the ue_ip module and sets up IP for the UE
# you may want to edit it to fit your settings (replace oip0 by oipX for
# instance)
# author Florian Kaltenberger
#
#######################################
LTEIF=oip0
#OPENAIR_DIR=/home/oai/svn-oai/openair4G
load_module() {
mod_name=${1##*/}
mod_name=${mod_name%.*}
if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
then
echo "module $mod_name already loaded: I remove it first"
sudo rmmod $mod_name
fi
echo loading $mod_name
sudo insmod $1
}
load_module $OPENAIR_DIR/targets/bin/ue_ip.ko
if [ "$1" = "UE" ]; then
echo "bring up oip0 interface for UE"
ifconfig oip0 up
fi
ip route flush cache
sleep 1
sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering"
sysctl -w net.ipv4.conf.all.rp_filter=0
ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
ip rule add fwmark 1 table lte
ip route add default dev $LTEIF table lte
+79
View File
@@ -1938,3 +1938,82 @@ ID = VCD_FUNCTION_RECV_IF5
DESC = VCD function RECV_IF5 DESC = VCD function RECV_IF5
GROUP = ALL:VCD:ENB:VCD_FUNCTION GROUP = ALL:VCD:ENB:VCD_FUNCTION
FORMAT = int,value FORMAT = int,value
#################
#### UE LOGS ####
#################
#general logs
ID = UE_MASTER_TICK
DESC = UE master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view
GROUP = ALL:GENERAL:UE
FORMAT = int,eNB_ID : int,frame : int,subframe
#PHY logs
ID = UE_PHY_UL_TICK
DESC = UE uplink tick - one tick per ms at start of uplink processing
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe
ID = UE_PHY_DL_TICK
DESC = UE downlink tick - one tick per ms at start of downlink processing
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe
ID = UE_PHY_DLSCH_UE_DCI
DESC = UE downlink UE specific DCI as sent by the PHY layer
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
ID = UE_PHY_DLSCH_UE_ACK
DESC = UE downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
ID = UE_PHY_DLSCH_UE_NACK
DESC = UE downlink UE NACK as seen by the PHY layer in process_HARQ_feedback
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
ID = UE_PHY_ULSCH_UE_DCI
DESC = UE uplink UE specific DCI as sent by the PHY layer
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS
ID = UE_PHY_ULSCH_UE_ACK
DESC = UE uplink UE ACK as seen by the PHY layer
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
ID = UE_PHY_ULSCH_UE_NACK
DESC = UE uplink UE NACK as seen by the PHY layer
GROUP = ALL:PHY:GRAPHIC:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
ID = UE_PHY_INPUT_SIGNAL
DESC = UE received signal in the time domain for a duration of 1ms
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,rxdata
ID = UE_PHY_DL_CHANNEL_ESTIMATE
DESC = UE channel estimation in the time domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
ID = UE_PHY_PDCCH_IQ
DESC = UE PDCCH received IQ data
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,nb_rb : int,NB_RB_DL : int,symbols_per_tti : buffer,rxdataF_comp
ID = UE_PHY_PDCCH_ENERGY
DESC = UE PDSCH 1 energy and threshold
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdcch_ch_level00 : int,pdcch_ch_level01 : int,pdcch_ch_level10: int,pdcch_ch_level11
ID = UE_PHY_PDSCH_IQ
DESC = UE PDSCH received IQ data
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
ID = UE_PHY_PDSCH_ENERGY
DESC = UE PDSCH 1 energy and threshold
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdsch_ch_level00 : int,pdsch_ch_level01 : int,pdsch_ch_level10: int,pdsch_ch_level11
ID = UE_PHY_PUSCH_TX_POWER
DESC = UE PUSCH tx power
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pusch : int,ampl: int,g_pusch: int,pl: int,nb_rb
ID = UE_PHY_PUCCH_TX_POWER
DESC = UE PDSCH 1 energy and threshold
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pucch : int,ampl: int,g_pucch: int,pl
ID = UE_PHY_MEAS
DESC = UE PHY measurements
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,rsrp : int,rssi : int,snr: int,rx_power: int,noise_power: int,w_cqi: int,freq_offset
+6 -1
View File
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
LIBS=-lX11 -lm -lpng -lXft LIBS=-lX11 -lm -lpng -lXft
all: record replay extract_config textlog enb vcd macpdu2wireshark all: record replay extract_config textlog enb ue vcd macpdu2wireshark
record: utils.o record.o database.o config.o record: utils.o record.o database.o config.o
$(CC) $(CFLAGS) -o record $^ $(LIBS) $(CC) $(CFLAGS) -o record $^ $(LIBS)
@@ -26,6 +26,11 @@ enb: utils.o enb.o database.o event.o handler.o config.o \
filter/filter.a filter/filter.a
$(CC) $(CFLAGS) -o enb $^ $(LIBS) $(CC) $(CFLAGS) -o enb $^ $(LIBS)
ue: utils.o ue.o database.o event.o handler.o config.o \
event_selector.o view/view.a gui/gui.a logger/logger.a \
filter/filter.a
$(CC) $(CFLAGS) -o ue $^ $(LIBS)
vcd: utils.o vcd.o database.o event.o handler.o config.o \ vcd: utils.o vcd.o database.o event.o handler.o config.o \
event_selector.o view/view.a gui/gui.a logger/logger.a \ event_selector.o view/view.a gui/gui.a logger/logger.a \
filter/filter.a filter/filter.a
+30
View File
@@ -349,6 +349,36 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database,
logger_add_view(l, v); logger_add_view(l, v);
e->ul_mcs_logger = l; e->ul_mcs_logger = l;
/* UE x DL PHY (truly: DCI) throughput */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
w = new_xy_plot(g, 70, 10, "DL PHY [0]", 35);
w2 = new_textarea(g, 70, 11, 64);
xy_plot_set_range(g, w, 0, 1000, 0, 100000);
xy_plot_set_tick_type(g, w, XY_PLOT_SCROLL_TICK);
widget_add_child(g, col, w2, -1);
widget_add_child(g, col, w, -1);
container_set_child_growable(g, col, w, 1);
l = new_throughputlog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe",
"ENB_PHY_DLSCH_UE_DCI", "TBS");
v = new_view_scrolltti(10, g, w, new_color(g, "#0c0c72"), w2);
logger_add_view(l, v);
/* UE x UL PHY (truly: DCI) throughput */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
w = new_xy_plot(g, 70, 10, "UL PHY [0]", 35);
w2 = new_textarea(g, 70, 11, 64);
xy_plot_set_range(g, w, 0, 1000, 0, 100000);
xy_plot_set_tick_type(g, w, XY_PLOT_SCROLL_TICK);
widget_add_child(g, col, w2, -1);
widget_add_child(g, col, w, -1);
container_set_child_growable(g, col, w, 1);
l = new_throughputlog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe",
"ENB_PHY_ULSCH_UE_DCI", "TBS");
v = new_view_scrolltti(10, g, w, new_color(g, "#0c0c72"), w2);
logger_add_view(l, v);
/* downlink/uplink UE DCIs */ /* downlink/uplink UE DCIs */
widget_add_child(g, top_container, widget_add_child(g, top_container,
new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1); new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1);
+876
View File
@@ -0,0 +1,876 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include "database.h"
#include "event.h"
#include "handler.h"
#include "logger/logger.h"
#include "view/view.h"
#include "gui/gui.h"
#include "filter/filter.h"
#include "utils.h"
#include "../T_defs.h"
#include "event_selector.h"
#include "openair_logo.h"
#include "config.h"
typedef struct {
view *phyview;
view *macview;
view *rlcview;
view *pdcpview;
view *rrcview;
view *legacy;
widget *current_ue_label;
widget *prev_ue_button;
widget *next_ue_button;
widget *pdsch_iq_ue_xy_plot;
widget *dl_estimate_ue_xy_plot;
widget *pdcch_energy_ue_xy_plot;
widget *pdsch_energy_ue_xy_plot;
widget *pdcch_iq_ue_xy_plot;
widget *dl_ul_harq_ue_label;
widget *dl_mcs_xy_plot;
widget *ul_mcs_xy_plot;
widget *pusch_power_xy_plot;
widget *pucch_power_xy_plot;
widget *phy_meas_xy_plot;
logger *pdsch_iq_ue_logger;
logger *dl_estimate_ue_logger;
logger *pdcch_iq_ue_logger;
logger *dl_dci_logger[8];
logger *dl_ack_logger[8];
logger *dl_nack_logger[8];
logger *ul_dci_logger[8];
logger *ul_dci_retransmission_logger[8];
logger *ul_ack_logger[8];
logger *ul_nack_logger[8];
logger *dl_mcs_logger;
logger *ul_mcs_logger;
logger *pusch_power_logger;
logger *pusch_ampl_logger;
logger *pucch_power_logger;
logger *pucch_ampl_logger;
logger *pdcch_energy_logger;
logger *pdsch_energy_logger;
logger *phy_meas_logger;
} ue_gui;
typedef struct {
int socket;
int *is_on;
int nevents;
pthread_mutex_t lock;
ue_gui *e;
int ue; /* what UE is displayed in the UE specific views */
void *database;
} ue_data;
void is_on_changed(void *_d)
{
ue_data *d = _d;
char t;
if (pthread_mutex_lock(&d->lock)) abort();
if (d->socket == -1) goto no_connection;
t = 1;
if (socket_send(d->socket, &t, 1) == -1 ||
socket_send(d->socket, &d->nevents, sizeof(int)) == -1 ||
socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1)
goto connection_dies;
no_connection:
if (pthread_mutex_unlock(&d->lock)) abort();
return;
connection_dies:
close(d->socket);
d->socket = -1;
if (pthread_mutex_unlock(&d->lock)) abort();
}
void usage(void)
{
printf(
"options:\n"
" -d <database file> this option is mandatory\n"
" -on <GROUP or ID> turn log ON for given GROUP or ID\n"
" -off <GROUP or ID> turn log OFF for given GROUP or ID\n"
" -ON turn all logs ON\n"
" -OFF turn all logs OFF\n"
" note: you may pass several -on/-off/-ON/-OFF,\n"
" they will be processed in order\n"
" by default, all is off\n"
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n"
" -debug-gui activate GUI debug logs\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
exit(1);
}
static void *gui_thread(void *_g)
{
gui *g = _g;
gui_loop(g);
return NULL;
}
static filter *ticktime_filter(void *database, char *event, int i, int ue)
{
/* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */
return
filter_and(
filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)),
filter_and(
filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)),
filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0))));
}
static void set_current_ue(gui *g, ue_data *e, int ue)
{
int i;
char s[256];
sprintf(s, "[UE %d] ", ue);
label_set_text(g, e->e->current_ue_label, s);
sprintf(s, "PDSCH IQ [UE %d]", ue);
xy_plot_set_title(g, e->e->pdsch_iq_ue_xy_plot, s);
sprintf(s, "DL estimated channel [UE %d]", ue);
xy_plot_set_title(g, e->e->dl_estimate_ue_xy_plot, s);
sprintf(s, "PDCCH energy [UE %d]", ue);
xy_plot_set_title(g, e->e->pdcch_energy_ue_xy_plot, s);
sprintf(s, "PDSCH energy [UE %d]", ue);
xy_plot_set_title(g, e->e->pdsch_energy_ue_xy_plot, s);
sprintf(s, "PDCCH IQ [UE %d]", ue);
xy_plot_set_title(g, e->e->pdcch_iq_ue_xy_plot, s);
sprintf(s, "DL/UL HARQ (x8) [UE %d]", ue);
label_set_text(g, e->e->dl_ul_harq_ue_label, s);
sprintf(s, "DL MCS [UE %d]", ue);
xy_plot_set_title(g, e->e->dl_mcs_xy_plot, s);
sprintf(s, "UL MCS [UE %d]", ue);
xy_plot_set_title(g, e->e->ul_mcs_xy_plot, s);
sprintf(s, "PUSCH POWER [UE %d]", ue);
xy_plot_set_title(g, e->e->pusch_power_xy_plot, s);
sprintf(s, "PUCCH POWER [UE %d]", ue);
xy_plot_set_title(g, e->e->pucch_power_xy_plot, s);
sprintf(s, "PHY Measurements [UE %d]", ue);
xy_plot_set_title(g, e->e->phy_meas_xy_plot, s);
logger_set_filter(e->e->pdsch_iq_ue_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PDSCH_IQ", "UE_ID"),
filter_int(ue)));
logger_set_filter(e->e->dl_estimate_ue_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_DL_CHANNEL_ESTIMATE", "UE_ID"),
filter_int(ue)));
logger_set_filter(e->e->pdcch_energy_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PDCCH_ENERGY", "UE_ID"),
filter_int(ue)));
logger_set_filter(e->e->pdsch_energy_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PDSCH_ENERGY", "UE_ID"),
filter_int(ue)));
logger_set_filter(e->e->phy_meas_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_MEAS", "UE_ID"),
filter_int(ue)));
/*logger_set_filter(e->pucch1_energy_ue_energy_logger,
filter_eq(
filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
filter_int(ue)));*/
/*logger_set_filter(e->e->pdcch_iq_ue_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PDCCH_IQ", "UE_ID"),
filter_int(ue)));*/
for (i = 0; i < 8; i++) {
logger_set_filter(e->e->dl_dci_logger[i],
ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i, ue));
logger_set_filter(e->e->dl_ack_logger[i],
ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i, ue));
logger_set_filter(e->e->dl_nack_logger[i],
ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i, ue));
logger_set_filter(e->e->ul_dci_logger[i],
ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i, ue));
/*logger_set_filter(e->ul_dci_retransmission_logger[i],
ticktime_filter(e->database,
"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i, ue));*/
logger_set_filter(e->e->ul_ack_logger[i],
ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i, ue));
logger_set_filter(e->e->ul_nack_logger[i],
ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i, ue));
}
logger_set_filter(e->e->dl_mcs_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_DLSCH_UE_DCI", "UE_id"),
filter_int(ue)));
logger_set_filter(e->e->ul_mcs_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_ULSCH_UE_DCI", "UE_id"),
filter_int(ue)));
logger_set_filter(e->e->pusch_power_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
filter_int(ue)));
logger_set_filter(e->e->pusch_ampl_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
filter_int(ue)));
logger_set_filter(e->e->pucch_power_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
filter_int(ue)));
logger_set_filter(e->e->pucch_ampl_logger,
filter_eq(
filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
filter_int(ue)));
}
static void click(void *private, gui *g,
char *notification, widget *w, void *notification_data)
{
int *d = notification_data;
int button = d[0];
ue_data *ed = private;
ue_gui *e = ed->e;
int ue = ed->ue;
if (button != 1) return;
if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
if (w == e->next_ue_button) ue++;
if (pthread_mutex_lock(&ed->lock)) abort();
if (ue != ed->ue) {
set_current_ue(g, ed, ue);
ed->ue = ue;
}
if (pthread_mutex_unlock(&ed->lock)) abort();
}
static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
ue_data *ed)
{
widget *main_window;
widget *top_container;
widget *line, *col;
widget *logo;
widget *input_signal_plot;
logger *input_signal_log;
view *input_signal_view;
widget *timeline_plot;
logger *timelog;
view *timeview;
view *subview;
widget *text;
view *textview;
int i;
widget *w, *w2;
view *v;
logger *l;
main_window = new_toplevel_window(g, 1200, 900, "eNB tracer");
top_container = new_container(g, VERTICAL);
widget_add_child(g, main_window, top_container, -1);
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
logo = new_image(g, openair_logo_png, openair_logo_png_len);
/* logo + prev/next UE buttons */
col = new_container(g, VERTICAL);
widget_add_child(g, col, logo, -1);
w = new_container(g, HORIZONTAL);
widget_add_child(g, col, w, -1);
w2 = new_label(g, "");
widget_add_child(g, w, w2, -1);
e->current_ue_label = w2;
/* TODO: use button widget, not label widget */
w2 = new_label(g, " [prev UE] ");
widget_add_child(g, w, w2, -1);
label_set_clickable(g, w2, 1);
e->prev_ue_button = w2;
w2 = new_label(g, " [next UE] ");
widget_add_child(g, w, w2, -1);
label_set_clickable(g, w2, 1);
e->next_ue_button = w2;
widget_add_child(g, line, col, -1);
input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20);
widget_add_child(g, line, input_signal_plot, -1);
xy_plot_set_range(g, input_signal_plot, 0, 7680*10, 20, 70);
input_signal_log = new_framelog(h, database,
"UE_PHY_INPUT_SIGNAL", "subframe", "rxdata");
/* a skip value of 10 means to process 1 frame over 10, that is
* more or less 10 frames per second
*/
framelog_set_skip(input_signal_log, 10);
input_signal_view = new_view_xy(7680*10, 10,
g, input_signal_plot, new_color(g, "#0c0c72"), XY_LOOP_MODE);
logger_add_view(input_signal_log, input_signal_view);
/* UE x PDSCH IQ data */
w = new_xy_plot(g, 55, 55, "", 50);
e->pdsch_iq_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, -500, 500, -500, 500);
l = new_iqlog(h, database, "UE_PHY_PDSCH_IQ", "nb_rb",
"N_RB_UL", "symbols_per_tti", "pusch_comp");
v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
logger_add_view(l, v);
e->pdsch_iq_ue_logger = l;
/* UE x estimated DL channel */
w = new_xy_plot(g, 280, 55, "", 50);
e->dl_estimate_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 512*10, -10, 80);
l = new_framelog(h, database,
"UE_PHY_DL_CHANNEL_ESTIMATE", "subframe", "chest_t");
//framelog_set_skip(input_signal_log, 10);
framelog_set_update_only_at_sf9(l, 0);
v = new_view_xy(512*10, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE);
logger_add_view(l, v);
e->dl_estimate_ue_logger = l;
/* PHY Meas */
w = new_xy_plot(g, 128, 55, "", 50);
e->phy_meas_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 1024*10, -130, 35);
/*l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "rssi", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->phy_meas_logger = l;*/
l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "rsrp", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
e->phy_meas_logger = l;
l = new_ticked_ttilog(h, database,"UE_PHY_DL_TICK", "frame", "subframe","UE_PHY_MEAS", "snr", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c720c"));
logger_add_view(l, v);
e->phy_meas_logger = l;
/* UE x PDSCH energy */
w = new_xy_plot(g, 128, 55, "", 50);
e->pdsch_energy_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
l = new_ttilog(h, database,
"UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
logger_add_view(l, v);
e->pdsch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
logger_add_view(l, v);
e->pdsch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
logger_add_view(l, v);
e->pdsch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
logger_add_view(l, v);
e->pdsch_energy_logger = l;
/* UE x PDCCH energy */
w = new_xy_plot(g, 128, 55, "", 50);
e->pdcch_energy_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
l = new_ttilog(h, database,
"UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
logger_add_view(l, v);
e->pdcch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
logger_add_view(l, v);
e->pdcch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
logger_add_view(l, v);
e->pdcch_energy_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
logger_add_view(l, v);
e->pdcch_energy_logger = l;
/* UE x PDCCH IQ data */
w = new_xy_plot(g, 55, 55, "", 50);
e->pdcch_iq_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, -100, 100, -100, 100);
l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
"NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
logger_add_view(l, v);
e->pdcch_iq_ue_logger = l;
/* UE x PDCCH IQ data */
/*w = new_xy_plot(g, 55, 55, "", 50);
e->pdcch_iq_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
logger_add_view(l, v);
e->pdcch_iq_ue_logger = l;*/
/* UE x DL mcs */
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
w = new_xy_plot(g, 128, 55, "", 20);
xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
e->dl_mcs_xy_plot = w;
widget_add_child(g, line, w, -1);
l = new_ticked_ttilog(h, database, "UE_PHY_DL_TICK", "frame", "subframe",
"UE_PHY_DLSCH_UE_DCI", "mcs", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
e->dl_mcs_logger = l;
/* UE x UL mcs */
w = new_xy_plot(g, 128, 55, "", 20);
xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
e->ul_mcs_xy_plot = w;
widget_add_child(g, line, w, -1);
l = new_ticked_ttilog(h, database, "UE_PHY_UL_TICK", "frame", "subframe",
"UE_PHY_ULSCH_UE_DCI", "mcs", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
e->ul_mcs_logger = l;
/* UE x PUSCH TX Power */
// line = new_container(g, HORIZONTAL);
// widget_add_child(g, top_container, line, -1);
w = new_xy_plot(g, 128, 55, "", 20);
e->pusch_power_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 1024*10, -30, 50);
l = new_ttilog(h, database,
"UE_PHY_PUSCH_TX_POWER", "frame", "subframe", "p0_pusch", 0);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
e->pusch_power_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PUSCH_TX_POWER", "frame", "subframe", "ampl", 1);
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pusch_ampl_logger = l;
/* UE x PUCCH TX Power */
// line = new_container(g, HORIZONTAL);
// widget_add_child(g, top_container, line, -1);
w = new_xy_plot(g, 128, 55, "", 20);
e->pucch_power_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 1024*10, -30, 50);
l = new_ttilog(h, database,
"UE_PHY_PUCCH_TX_POWER", "frame", "subframe", "p0_pucch", 0);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
e->pucch_power_logger = l;
l = new_ttilog(h, database,
"UE_PHY_PUCCH_TX_POWER", "frame", "subframe", "ampl", 1);
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pucch_ampl_logger = l;
/* downlink/uplink UE DCIs */
widget_add_child(g, top_container,
new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1);
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
timeline_plot = new_timeline(g, 512, 8, 5);
widget_add_child(g, line, timeline_plot, -1);
container_set_child_growable(g, line, timeline_plot, 1);
for (i = 0; i < 8; i++)
timeline_set_subline_background_color(g, timeline_plot, i,
new_color(g, i==0 || i==4 ? "#aaf" : "#eee"));
timeview = new_view_time(3600, 10, g, timeline_plot);
/* DL tick logging */
timelog = new_timelog(h, database, "UE_PHY_DL_TICK");
subview = new_subview_time(timeview, 0, new_color(g, "#77c"), 3600*1000);
logger_add_view(timelog, subview);
/* DL DCI logging */
timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_DCI");
subview = new_subview_time(timeview, 1, new_color(g, "#228"), 3600*1000);
logger_add_view(timelog, subview);
/* DL ACK */
timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_ACK");
subview = new_subview_time(timeview, 2, new_color(g, "#282"), 3600*1000);
logger_add_view(timelog, subview);
/* DL NACK */
timelog = new_timelog(h, database, "UE_PHY_DLSCH_UE_NACK");
subview = new_subview_time(timeview, 3, new_color(g, "#f22"), 3600*1000);
logger_add_view(timelog, subview);
/* UL tick logging */
timelog = new_timelog(h, database, "UE_PHY_UL_TICK");
subview = new_subview_time(timeview, 4, new_color(g, "#77c"), 3600*1000);
logger_add_view(timelog, subview);
/* UL DCI logging */
timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_DCI");
subview = new_subview_time(timeview, 5, new_color(g, "#228"), 3600*1000);
logger_add_view(timelog, subview);
/* UL retransmission without DCI logging */
//timelog = new_timelog(h,database,"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION");
//subview = new_subview_time(timeview, 5, new_color(g, "#f22"), 3600*1000);
//logger_add_view(timelog, subview);
/* UL ACK */
timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_ACK");
subview = new_subview_time(timeview, 6, new_color(g, "#282"), 3600*1000);
logger_add_view(timelog, subview);
/* UL NACK */
timelog = new_timelog(h, database, "UE_PHY_ULSCH_UE_NACK");
subview = new_subview_time(timeview, 7, new_color(g, "#f22"), 3600*1000);
logger_add_view(timelog, subview);
/* harq processes' ticktime view */
e->dl_ul_harq_ue_label = new_label(g, "");
widget_add_child(g, top_container, e->dl_ul_harq_ue_label, -1);
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
timeline_plot = new_timeline(g, 512, 2*8+2, 3);
widget_add_child(g, line, timeline_plot, -1);
container_set_child_growable(g, line, timeline_plot, 1);
for (i = 0; i < 2*8+2; i++)
timeline_set_subline_background_color(g, timeline_plot, i,
new_color(g, i==0 || i==9 ? "#ddd" : (i%9)&1 ? "#e6e6e6" : "#eee"));
timeview = new_view_ticktime(10, g, timeline_plot);
ticktime_set_tick(timeview,
new_ticklog(h, database, "UE_MASTER_TICK", "frame", "subframe"));
/* tick */
timelog = new_ticklog(h, database, "UE_MASTER_TICK", "frame", "subframe");
/* tick on DL view */
subview = new_subview_ticktime(timeview, 0, new_color(g,"#bbb"), 3600*1000);
logger_add_view(timelog, subview);
/* tick on UL view */
subview = new_subview_ticktime(timeview, 9, new_color(g,"#bbb"), 3600*1000);
logger_add_view(timelog, subview);
/* DL DCI */
for (i = 0; i < 8; i++) {
timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_DCI",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+1,
new_color(g,"#55f"), 3600*1000);
logger_add_view(timelog, subview);
e->dl_dci_logger[i] = timelog;
}
/* DL ACK */
for (i = 0; i < 8; i++) {
timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_ACK",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+1,
new_color(g,"#282"), 3600*1000);
logger_add_view(timelog, subview);
e->dl_ack_logger[i] = timelog;
}
/* DL NACK */
for (i = 0; i < 8; i++) {
timelog = new_ticklog(h, database, "UE_PHY_DLSCH_UE_NACK",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+1,
new_color(g,"#f22"), 3600*1000);
logger_add_view(timelog, subview);
e->dl_nack_logger[i] = timelog;
}
/* UL DCI/retransmission without DCI */
for (i = 0; i < 8; i++) {
/* first transmission */
timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_DCI",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#55f"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_dci_logger[i] = timelog;
/* retransmission */
timelog = new_ticklog(h, database,
"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", "frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#99f"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_dci_retransmission_logger[i] = timelog;
}
/* UL ACK */
for (i = 0; i < 8; i++) {
timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_ACK",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#282"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_ack_logger[i] = timelog;
}
/* UL NACK */
for (i = 0; i < 8; i++) {
timelog = new_ticklog(h, database, "UE_PHY_ULSCH_UE_NACK",
"frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#f22"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_nack_logger[i] = timelog;
}
#if 1
/* phy/mac/rlc/pdcp/rrc textlog */
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
container_set_child_growable(g, top_container, line, 1);
/* phy */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
container_set_child_growable(g, line, col, 1);
widget_add_child(g, col, new_label(g, "PHY"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#afa"));
widget_add_child(g, col, text, -1);
container_set_child_growable(g, col, text, 1);
textview = new_view_textlist(10000, 10, g, text);
e->phyview = textview;
/* mac */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
container_set_child_growable(g, line, col, 1);
widget_add_child(g, col, new_label(g, "MAC"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#adf"));
widget_add_child(g, col, text, -1);
container_set_child_growable(g, col, text, 1);
textview = new_view_textlist(10000, 10, g, text);
e->macview = textview;
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
container_set_child_growable(g, top_container, line, 1);
/* rlc */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
container_set_child_growable(g, line, col, 1);
widget_add_child(g, col, new_label(g, "RLC"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#aff"));
widget_add_child(g, col, text, -1);
container_set_child_growable(g, col, text, 1);
textview = new_view_textlist(10000, 10, g, text);
e->rlcview = textview;
/* pdcp */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
container_set_child_growable(g, line, col, 1);
widget_add_child(g, col, new_label(g, "PDCP"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#ed9"));
widget_add_child(g, col, text, -1);
container_set_child_growable(g, col, text, 1);
textview = new_view_textlist(10000, 10, g, text);
e->pdcpview = textview;
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
container_set_child_growable(g, top_container, line, 1);
/* rrc */
col = new_container(g, VERTICAL);
widget_add_child(g, line, col, -1);
container_set_child_growable(g, line, col, 1);
widget_add_child(g, col, new_label(g, "RRC"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#fdb"));
widget_add_child(g, col, text, -1);
container_set_child_growable(g, col, text, 1);
textview = new_view_textlist(10000, 10, g, text);
e->rrcview = textview;
/* legacy logs (LOG_I, LOG_D, ...) */
widget_add_child(g, top_container, new_label(g, "LEGACY"), -1);
text = new_textlist(g, 100, 10, new_color(g, "#eeb"));
widget_add_child(g, top_container, text, -1);
container_set_child_growable(g, top_container, text, 1);
e->legacy = new_view_textlist(10000, 10, g, text);
#endif
set_current_ue(g, ed, 0);
register_notifier(g, "click", e->prev_ue_button, click, ed);
register_notifier(g, "click", e->next_ue_button, click, ed);
}
void view_add_log(view *v, char *log, event_handler *h, void *database,
int *is_on)
{
logger *textlog;
char *name, *desc;
database_get_generic_description(database,
event_id_from_name(database, log), &name, &desc);
textlog = new_textlog(h, database, name, desc);
logger_add_view(textlog, v);
free(name);
free(desc);
on_off(database, log, is_on, 1);
}
int main(int n, char **v)
{
extern int volatile gui_logd;
char *database_filename = NULL;
void *database;
char *ip = DEFAULT_REMOTE_IP;
int port = DEFAULT_REMOTE_PORT;
char **on_off_name;
int *on_off_action;
int on_off_n = 0;
int *is_on;
int number_of_events;
int i;
event_handler *h;
gui *g;
ue_gui eg;
ue_data ue_data;
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort();
on_off_action = malloc(n * sizeof(int)); if (on_off_action == NULL) abort();
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d"))
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-on")) { if (i > n-2) usage();
on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=1; continue; }
if (!strcmp(v[i], "-off")) { if (i > n-2) usage();
on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=0; continue; }
if (!strcmp(v[i], "-ON"))
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=1; continue; }
if (!strcmp(v[i], "-OFF"))
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; }
if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; }
usage();
}
if (database_filename == NULL) {
printf("ERROR: provide a database file (-d)\n");
exit(1);
}
database = parse_database(database_filename);
load_config_file(database_filename);
number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int));
if (is_on == NULL) abort();
h = new_handler(database);
g = gui_init();
new_thread(gui_thread, g);
ue_data.ue = 0;
ue_data.e = &eg;
ue_data.database = database;
ue_main_gui(&eg, g, h, database, &ue_data);
for (i = 0; i < number_of_events; i++) {
logger *textlog;
char *name, *desc;
database_get_generic_description(database, i, &name, &desc);
if (!strncmp(name, "LEGACY_", 7)) {
textlog = new_textlog(h, database, name, desc);
logger_add_view(textlog, eg.legacy);
}
free(name);
free(desc);
}
on_off(database, "UE_MASTER_TICK", is_on, 1);
on_off(database, "UE_PHY_UL_TICK", is_on, 1);
on_off(database, "UE_PHY_DL_TICK", is_on, 1);
on_off(database, "UE_PHY_DLSCH_UE_DCI", is_on, 1);
on_off(database, "UE_PHY_DLSCH_UE_ACK", is_on, 1);
on_off(database, "UE_PHY_DLSCH_UE_NACK", is_on, 1);
on_off(database, "UE_PHY_ULSCH_UE_DCI", is_on, 1);
on_off(database, "UE_PHY_ULSCH_UE_ACK", is_on, 1);
on_off(database, "UE_PHY_ULSCH_UE_NACK", is_on, 1);
on_off(database, "UE_PHY_INPUT_SIGNAL", is_on, 1);
on_off(database, "UE_PHY_DL_CHANNEL_ESTIMATE", is_on, 1);
on_off(database, "UE_PHY_PDCCH_IQ", is_on, 1);
on_off(database, "UE_PHY_PDCCH_ENERGY", is_on, 1);
on_off(database, "UE_PHY_PDSCH_IQ", is_on, 1);
on_off(database, "UE_PHY_PDSCH_ENERGY", is_on, 1);
on_off(database, "UE_PHY_PUSCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_PUCCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_MEAS", is_on, 1);
on_off(database, "LEGACY_GROUP_INFO", is_on, 1);
on_off(database, "LEGACY_GROUP_ERROR", is_on, 1);
on_off(database, "LEGACY_GROUP_WARNING", is_on, 1);
view_add_log(eg.phyview, "UE_PHY_UL_TICK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DL_TICK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_DCI", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_NACK",h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_DCI", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_NACK", h, database, is_on);
/* deactivate those two by default, they are a bit heavy */
//on_off(database, "ENB_MAC_UE_UL_SDU_WITH_DATA", is_on, 0);
//on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 0);
for (i = 0; i < on_off_n; i++)
on_off(database, on_off_name[i], is_on, on_off_action[i]);
ue_data.socket = -1;
ue_data.is_on = is_on;
ue_data.nevents = number_of_events;
if (pthread_mutex_init(&ue_data.lock, NULL)) abort();
setup_event_selector(g, database, is_on, is_on_changed, &ue_data);
restart:
clear_remote_config();
ue_data.socket = connect_to(ip, port);
/* send the first message - activate selected traces */
is_on_changed(&ue_data);
/* read messages */
while (1) {
char v[T_BUFFER_MAX];
event e;
e = get_event(ue_data.socket, v, database);
if (e.type == -1) goto restart;
if (pthread_mutex_lock(&ue_data.lock)) abort();
handle_event(h, e);
if (pthread_mutex_unlock(&ue_data.lock)) abort();
}
return 0;
}
+2 -2
View File
@@ -81,13 +81,13 @@
#define ITTI_DEBUG_ISSUES (1<<5) #define ITTI_DEBUG_ISSUES (1<<5)
#define ITTI_DEBUG_MP_STATISTICS (1<<6) #define ITTI_DEBUG_MP_STATISTICS (1<<6)
const int itti_debug = ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS; const int itti_debug = (ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS);
/* Don't flush if using RTAI */ /* Don't flush if using RTAI */
#ifdef RTAI #ifdef RTAI
# define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0); # define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0);
#else #else
# define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout); } while(0); # define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) {fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout);} } while(0);
#endif #endif
#define ITTI_ERROR(x, args...) do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0); #define ITTI_ERROR(x, args...) do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0);
-2
View File
@@ -71,7 +71,5 @@ typedef struct {
#define INSTANCE_DEFAULT (UINT16_MAX - 1) #define INSTANCE_DEFAULT (UINT16_MAX - 1)
#define INSTANCE_ALL (UINT16_MAX) #define INSTANCE_ALL (UINT16_MAX)
typedef uint16_t instance_t;
#endif #endif
+1
View File
@@ -256,6 +256,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
&PHY_vars_UE->lte_frame_parms, &PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0], PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid], PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
frame,
subframe, subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid, PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1); num_pdcch_symbols,1);
+11 -11
View File
@@ -211,7 +211,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
fp->MBSFN_config[i].fourFrames_flag = 0; fp->MBSFN_config[i].fourFrames_flag = 0;
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %ld\n", i, LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig); fp->MBSFN_config[i].mbsfn_SubframeConfig);
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
fp->MBSFN_config[i].fourFrames_flag = 1; fp->MBSFN_config[i].fourFrames_flag = 1;
@@ -220,7 +220,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)| (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16); (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %ld\n", i, LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig); fp->MBSFN_config[i].mbsfn_SubframeConfig);
} }
} }
@@ -331,7 +331,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
fp->MBSFN_config[i].fourFrames_flag = 0; fp->MBSFN_config[i].fourFrames_flag = 0;
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %ld\n", i, LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig); fp->MBSFN_config[i].mbsfn_SubframeConfig);
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
fp->MBSFN_config[i].fourFrames_flag = 1; fp->MBSFN_config[i].fourFrames_flag = 1;
@@ -340,7 +340,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)| (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16); (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %ld\n", i, LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig); fp->MBSFN_config[i].mbsfn_SubframeConfig);
} }
} }
@@ -357,7 +357,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms; LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %d for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx); LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) { if (mbsfn_Area_idx == 0) {
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9; fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
@@ -376,7 +376,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
LTE_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms; LTE_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms;
LOG_I(PHY,"[eNB%d] Applying MBSFN_Area_id %d for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx); LOG_I(PHY,"[eNB%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) { if (mbsfn_Area_idx == 0) {
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9; fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
@@ -398,7 +398,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
physicalConfigDedicated = eNB->physicalConfigDedicated[UE_id]; physicalConfigDedicated = eNB->physicalConfigDedicated[UE_id];
if (physicalConfigDedicated != NULL) { if (physicalConfigDedicated != NULL) {
LOG_I(PHY,"[eNB %d] Frame %d: Sent physicalConfigDedicated=%p for UE %d\n",eNB->Mod_id,physicalConfigDedicated,UE_id); LOG_I(PHY,"[eNB %d] Sent physicalConfigDedicated=%p for UE %d\n",eNB->Mod_id,physicalConfigDedicated,UE_id);
LOG_D(PHY,"------------------------------------------------------------------------\n"); LOG_D(PHY,"------------------------------------------------------------------------\n");
if (physicalConfigDedicated->pdsch_ConfigDedicated) { if (physicalConfigDedicated->pdsch_ConfigDedicated) {
@@ -653,7 +653,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
int8_t UE_id = find_ue(rnti,eNB); int8_t UE_id = find_ue(rnti,eNB);
if (UE_id == -1) { if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n"); LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
return; return;
} }
@@ -725,13 +725,13 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) { if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1 carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id); LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
} else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) { } else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1 carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
// this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band // this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id); LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
} else { } else {
LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %d of SCell %d for UE %d not supported\n",Mod_id,/*eNB->frame*/0,dl_CarrierFreq_r10,CC_id,UE_id); LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %ld of SCell %d for UE %d not supported\n",Mod_id,/*eNB->frame*/0,dl_CarrierFreq_r10,CC_id,UE_id);
} }
if (physicalConfigDedicatedSCell_r10) { if (physicalConfigDedicatedSCell_r10) {
@@ -25,6 +25,7 @@
#include "defs.h" #include "defs.h"
#include "PHY/defs.h" #include "PHY/defs.h"
#include "filt96_32.h" #include "filt96_32.h"
#include "T.h"
//#define DEBUG_CH //#define DEBUG_CH
int lte_dl_channel_estimation(PHY_VARS_UE *ue, int lte_dl_channel_estimation(PHY_VARS_UE *ue,
@@ -738,6 +739,12 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
(int16_t*) ue->common_vars.dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1); (int16_t*) ue->common_vars.dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1);
} }
#if T_TRACER
T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id), T_INT(ue->Mod_id),
T_INT(ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx%1024), T_INT(ue->proc.proc_rxtx[(Ns>>1)&1].subframe_rx),
T_INT(0), T_BUFFER(&ue->common_vars.dl_ch_estimates_time[eNB_offset][0][0], 512 * 4));
#endif
return(0); return(0);
} }
@@ -32,7 +32,8 @@
#define k1 ((long long int) 1000) #define k1 ((long long int) 1000)
#define k2 ((long long int) (1024-k1)) #define k2 ((long long int) (1024-k1))
//#define DEBUG_MEAS //#define DEBUG_MEAS_RRC
//#define DEBUG_MEAS_UE
#ifdef USER_MODE #ifdef USER_MODE
void print_shorts(char *s,short *x) void print_shorts(char *s,short *x)
@@ -165,23 +166,30 @@ int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs
} }
void ue_rrc_measurements(PHY_VARS_UE *ue, void ue_rrc_measurements(PHY_VARS_UE *ue,
uint8_t subframe, uint8_t slot,
uint8_t abstraction_flag) uint8_t abstraction_flag)
{ {
int aarx,rb; uint8_t subframe = slot>>1;
int aarx,rb,n;
int16_t *rxF,*rxF_pss,*rxF_sss; int16_t *rxF,*rxF_pss,*rxF_sss;
uint16_t Nid_cell = ue->frame_parms.Nid_cell; uint16_t Nid_cell = ue->frame_parms.Nid_cell;
uint8_t eNB_offset,nu,l,nushift,k; uint8_t eNB_offset,nu,l,nushift,k;
uint16_t off; uint16_t off;
uint8_t isPss; // indicate if this is a slot for extracting PSS
uint8_t isSss; // indicate if this is a slot for extracting SSS
int32_t pss_ext[4][72]; // contain the extracted 6*12 REs for mapping the PSS
int32_t sss_ext[4][72]; // contain the extracted 6*12 REs for mapping the SSS
int32_t (*xss_ext)[72]; // point to either pss_ext or sss_ext for common calculation
int16_t *re,*im; // real and imag part of each 32-bit xss_ext[][] value
for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) { for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) {
if (eNB_offset==0) { if (eNB_offset==0) {
ue->measurements.rssi = 0; ue->measurements.rssi = 0;
ue->measurements.n0_power_tot = 0; //ue->measurements.n0_power_tot = 0;
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
if ((ue->frame_parms.frame_type == FDD) && if ((ue->frame_parms.frame_type == FDD) &&
@@ -225,16 +233,66 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]); // printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12); ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx]; ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
} }
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx)); ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} } else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
}
} }
else if ((ue->frame_parms.frame_type == TDD) && else if ((ue->frame_parms.frame_type == TDD) &&
(subframe == 0)) { // TDD SSS, compute noise in DTX REs ((slot == 2) || (slot == 12) || (slot == 1) || (slot == 11))) { // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation
#if 1 // fixing REs extraction in noise power calculation
// check if this slot has a PSS or SSS sequence
if ((slot == 2) || (slot == 12)) {
isPss = 1;
} else {
isPss = 0;
}
if ((slot == 1) || (slot == 11)) {
isSss = 1;
} else {
isSss = 0;
}
if (isPss) {
pss_only_extract(ue, pss_ext);
xss_ext = pss_ext;
}
if (isSss) {
sss_only_extract(ue, sss_ext);
xss_ext = sss_ext;
}
// calculate noise power
int num_tot=0; // number of REs totally used in calculating noise power
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
int num_per_rx=0; // number of REs used in caluclaing noise power for this RX antenna
ue->measurements.n0_power[aarx] = 0;
for (n=2; n<70; n++) { // skip the 2 REs next to PDSCH, i.e. n={0,1,70,71}
if (n==5) {n=67;}
re = (int16_t*)(&(xss_ext[aarx][n]));
im = re+1;
ue->measurements.n0_power[aarx] += (*re)*(*re) + (*im)*(*im);
num_per_rx++;
num_tot++;
}
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/(num_per_rx));
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(num_tot));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
#else
if (ue->frame_parms.Ncp==NORMAL) { if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
@@ -263,8 +321,9 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} }
} #endif
}
} }
} }
// recompute nushift with eNB_offset corresponding to adjacent eNB on which to perform channel estimation // recompute nushift with eNB_offset corresponding to adjacent eNB on which to perform channel estimation
@@ -286,7 +345,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) { for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) {
k = (nu + nushift)%6; k = (nu + nushift)%6;
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS_RRC
LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l); eNB_offset,k,l);
#endif #endif
@@ -364,7 +423,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
} }
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS_RRC
// if (slot == 0) { // if (slot == 0) {
@@ -498,10 +557,14 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot); ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot);
ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg); ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg);
ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB; ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB;
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS_UE
LOG_I(PHY,"[eNB %d] lte_ue_measurements: RSSI %d dBm, RSSI (digital) %d dB\n", LOG_D(PHY,"[eNB %d] RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
eNB_id,ue->measurements.rx_rssi_dBm[eNB_id], eNB_id,
ue->measurements.rx_power_avg_dB[eNB_id]); ue->measurements.rx_rssi_dBm[eNB_id],
ue->measurements.rx_power_avg_dB[eNB_id],
ue->measurements.wideband_cqi_avg[eNB_id],
ue->measurements.rx_power_avg[eNB_id],
ue->measurements.n0_power_avg);
#endif #endif
} }
+45 -26
View File
@@ -41,6 +41,7 @@
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#include "assertions.h" #include "assertions.h"
#include "T.h"
//#define DEBUG_DCI_ENCODING 1 //#define DEBUG_DCI_ENCODING 1
//#define DEBUG_DCI_DECODING 1 //#define DEBUG_DCI_DECODING 1
@@ -1684,6 +1685,7 @@ int32_t avgP[4];
int32_t rx_pdcch(LTE_UE_COMMON *common_vars, int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
LTE_UE_PDCCH **pdcch_vars, LTE_UE_PDCCH **pdcch_vars,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint8_t subframe, uint8_t subframe,
uint8_t eNB_id, uint8_t eNB_id,
MIMO_mode_t mimo_mode, MIMO_mode_t mimo_mode,
@@ -1754,7 +1756,10 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs); LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs);
#endif #endif
#if T_TRACER
T(T_UE_PHY_PDCCH_ENERGY, T_INT(eNB_id), T_INT(0), T_INT(frame%1024), T_INT(subframe),
T_INT(avgP[0]), T_INT(avgP[1]), T_INT(avgP[2]), T_INT(avgP[3]));
#endif
for (s=0; s<n_pdcch_symbols; s++) { for (s=0; s<n_pdcch_symbols; s++) {
pdcch_channel_compensation(pdcch_vars[eNB_id]->rxdataF_ext, pdcch_channel_compensation(pdcch_vars[eNB_id]->rxdataF_ext,
pdcch_vars[eNB_id]->dl_ch_estimates_ext, pdcch_vars[eNB_id]->dl_ch_estimates_ext,
@@ -1851,6 +1856,7 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
/*#ifdef DEBUG_PHY /*#ifdef DEBUG_PHY
write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
#endif*/ #endif*/
#ifdef MU_RECEIVER #ifdef MU_RECEIVER
} }
@@ -1858,6 +1864,12 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
} }
#if T_TRACER
T(T_UE_PHY_PDCCH_IQ, T_INT(frame_parms->N_RB_DL), T_INT(frame_parms->N_RB_DL),
T_INT(n_pdcch_symbols),
T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4));
#endif
// decode pcfich here // decode pcfich here
n_pdcch_symbols = rx_pcfich(frame_parms, n_pdcch_symbols = rx_pcfich(frame_parms,
subframe, subframe,
@@ -2651,6 +2663,7 @@ int get_nCCE_offset_l1(int *CCE_table,
void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars, void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
int do_common, int do_common,
dci_detect_mode_t mode,
uint8_t subframe, uint8_t subframe,
DCI_ALLOC_t *dci_alloc, DCI_ALLOC_t *dci_alloc,
int16_t eNB_id, int16_t eNB_id,
@@ -2692,6 +2705,11 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
return; return;
} }
if (mode == NO_DCI) {
LOG_D(PHY, "skip DCI decoding: expect no DCIs at subframe %d\n", subframe);
return;
}
if (do_common == 1) { if (do_common == 1) {
nb_candidates = (L2==4) ? 4 : 2; nb_candidates = (L2==4) ? 4 : 2;
Yk=0; Yk=0;
@@ -2842,7 +2860,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
*dci_cnt = *dci_cnt+1; *dci_cnt = *dci_cnt+1;
} else if (crc==pdcch_vars[eNB_id]->crnti) { } else if (crc==pdcch_vars[eNB_id]->crnti) {
if ((format_c == format0)&&((dci_decoded_output[0]&0x80)==0)) {// check if pdu is format 0 or 1A if ((mode&UL_DCI)&&(format_c == format0)&&((dci_decoded_output[0]&0x80)==0)) {// check if pdu is format 0 or 1A
if (*format0_found == 0) { if (*format0_found == 0) {
dci_alloc[*dci_cnt].format = format0; dci_alloc[*dci_cnt].format = format0;
*format0_found = 1; *format0_found = 1;
@@ -2923,6 +2941,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
uint8_t format1_size_bits=0,format1_size_bytes=0; uint8_t format1_size_bits=0,format1_size_bytes=0;
uint8_t format2_size_bits=0,format2_size_bytes=0; uint8_t format2_size_bits=0,format2_size_bytes=0;
uint8_t format2A_size_bits=0,format2A_size_bytes=0; uint8_t format2A_size_bits=0,format2A_size_bytes=0;
dci_detect_mode_t mode = dci_detect_mode_select(&ue->frame_parms,subframe);
switch (frame_parms->N_RB_DL) { switch (frame_parms->N_RB_DL) {
case 6: case 6:
@@ -3125,7 +3144,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// First check common search spaces at aggregation 4 (SI_RNTI, P_RNTI and RA_RNTI format 0/1A), // First check common search spaces at aggregation 4 (SI_RNTI, P_RNTI and RA_RNTI format 0/1A),
// and UE_SPEC format0 (PUSCH) too while we're at it // and UE_SPEC format0 (PUSCH) too while we're at it
dci_decoding_procedure0(pdcch_vars,1,subframe, dci_decoding_procedure0(pdcch_vars,1,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3153,7 +3172,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check common search spaces at aggregation 4 (SI_RNTI,P_RNTI and RA_RNTI and C-RNTI format 1C), // Now check common search spaces at aggregation 4 (SI_RNTI,P_RNTI and RA_RNTI and C-RNTI format 1C),
// and UE_SPEC format0 (PUSCH) too while we're at it // and UE_SPEC format0 (PUSCH) too while we're at it
dci_decoding_procedure0(pdcch_vars,1,subframe, dci_decoding_procedure0(pdcch_vars,1,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3185,7 +3204,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
#ifdef DEBUG_DCI_DECODING #ifdef DEBUG_DCI_DECODING
printf("[DCI search] doing common search/format0 aggregation 8\n"); printf("[DCI search] doing common search/format0 aggregation 8\n");
#endif #endif
dci_decoding_procedure0(pdcch_vars,1,subframe, dci_decoding_procedure0(pdcch_vars,1,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3213,7 +3232,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check common search spaces at aggregation 8 (SI_RNTI and RA_RNTI and C-RNTI format 1C), // Now check common search spaces at aggregation 8 (SI_RNTI and RA_RNTI and C-RNTI format 1C),
// and UE_SPEC format0 (PUSCH) too while we're at it // and UE_SPEC format0 (PUSCH) too while we're at it
dci_decoding_procedure0(pdcch_vars,1,subframe, dci_decoding_procedure0(pdcch_vars,1,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3246,7 +3265,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check UE_SPEC format0/1A ue_spec search spaces at aggregation 8 // Now check UE_SPEC format0/1A ue_spec search spaces at aggregation 8
// printf("[DCI search] Format 0/1A aggregation 8\n"); // printf("[DCI search] Format 0/1A aggregation 8\n");
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3275,7 +3294,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// printf("[DCI search] Format 0 aggregation 4\n"); // printf("[DCI search] Format 0 aggregation 4\n");
// Now check UE_SPEC format 0 search spaces at aggregation 4 // Now check UE_SPEC format 0 search spaces at aggregation 4
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3308,7 +3327,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// printf("[DCI search] Format 0 aggregation 2\n"); // printf("[DCI search] Format 0 aggregation 2\n");
// Now check UE_SPEC format 0 search spaces at aggregation 2 // Now check UE_SPEC format 0 search spaces at aggregation 2
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3337,7 +3356,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// printf("[DCI search] Format 0 aggregation 4\n"); // printf("[DCI search] Format 0 aggregation 4\n");
// Now check UE_SPEC format 0 search spaces at aggregation 1 // Now check UE_SPEC format 0 search spaces at aggregation 1
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3371,7 +3390,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if ((tmode < 3) || (tmode == 7)) { if ((tmode < 3) || (tmode == 7)) {
// Now check UE_SPEC format 1 search spaces at aggregation 1 // Now check UE_SPEC format 1 search spaces at aggregation 1
old_dci_cnt=dci_cnt; old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,subframe, dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3402,7 +3421,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check UE_SPEC format 1 search spaces at aggregation 2 // Now check UE_SPEC format 1 search spaces at aggregation 2
old_dci_cnt=dci_cnt; old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,subframe, dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3434,7 +3453,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check UE_SPEC format 1 search spaces at aggregation 4 // Now check UE_SPEC format 1 search spaces at aggregation 4
old_dci_cnt=dci_cnt; old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,subframe, dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3466,7 +3485,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
//#ifdef ALL_AGGREGATION //#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 1 search spaces at aggregation 8 // Now check UE_SPEC format 1 search spaces at aggregation 8
old_dci_cnt=dci_cnt; old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,subframe, dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
frame_parms, frame_parms,
@@ -3500,7 +3519,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
// Now check UE_SPEC format 2A_2A search spaces at aggregation 1 // Now check UE_SPEC format 2A_2A search spaces at aggregation 1
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3531,7 +3550,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 2 search spaces at aggregation 2 // Now check UE_SPEC format 2 search spaces at aggregation 2
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3562,7 +3581,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 2_2A search spaces at aggregation 4 // Now check UE_SPEC format 2_2A search spaces at aggregation 4
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3594,7 +3613,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
//#ifdef ALL_AGGREGATION //#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 2_2A search spaces at aggregation 8 // Now check UE_SPEC format 2_2A search spaces at aggregation 8
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3620,7 +3639,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
} else if (tmode == 4) { } else if (tmode == 4) {
// Now check UE_SPEC format 2_2A search spaces at aggregation 1 // Now check UE_SPEC format 2_2A search spaces at aggregation 1
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3651,7 +3670,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 2 search spaces at aggregation 2 // Now check UE_SPEC format 2 search spaces at aggregation 2
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3682,7 +3701,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 2_2A search spaces at aggregation 4 // Now check UE_SPEC format 2_2A search spaces at aggregation 4
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3714,7 +3733,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
//#ifdef ALL_AGGREGATION //#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 2_2A search spaces at aggregation 8 // Now check UE_SPEC format 2_2A search spaces at aggregation 8
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3743,7 +3762,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
#ifdef DEBUG_DCI_DECODING #ifdef DEBUG_DCI_DECODING
LOG_I(PHY," MU-MIMO check UE_SPEC format 1E_2A_M10PRB\n"); LOG_I(PHY," MU-MIMO check UE_SPEC format 1E_2A_M10PRB\n");
#endif #endif
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3775,7 +3794,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 1E_2A_M10PRB search spaces aggregation 2 // Now check UE_SPEC format 1E_2A_M10PRB search spaces aggregation 2
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3806,7 +3825,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
return(dci_cnt); return(dci_cnt);
// Now check UE_SPEC format 1E_2A_M10PRB search spaces aggregation 4 // Now check UE_SPEC format 1E_2A_M10PRB search spaces aggregation 4
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
@@ -3839,7 +3858,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
//#ifdef ALL_AGGREGATION //#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 1E_2A_M10PRB search spaces at aggregation 8 // Now check UE_SPEC format 1E_2A_M10PRB search spaces at aggregation 8
dci_decoding_procedure0(pdcch_vars,0, dci_decoding_procedure0(pdcch_vars,0,mode,
subframe, subframe,
dci_alloc, dci_alloc,
eNB_id, eNB_id,
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -675,12 +675,16 @@ typedef struct {
typedef struct { typedef struct {
/// HARQ process id /// HARQ process id
uint8_t harq_id; uint8_t harq_id;
/// ACK bits (after decoding) /// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack; uint8_t ack;
/// send status (for PUCCH) /// send status (for PUCCH)
uint8_t send_harq_status; uint8_t send_harq_status;
/// nCCE (for PUCCH) /// nCCE (for PUCCH)
uint8_t nCCE; uint8_t nCCE;
/// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
uint8_t vDAI_DL;
/// DAI value detected from DCI0/4. 0xff indicates not touched
uint8_t vDAI_UL;
} harq_status_t; } harq_status_t;
typedef struct { typedef struct {
@@ -118,7 +118,6 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
unsigned char exit_flag = 0,i,j,r,aa,layer; unsigned char exit_flag = 0,i,j,r,aa,layer;
int re; int re;
unsigned char bw_scaling =1; unsigned char bw_scaling =1;
uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx;
switch (N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
+21 -1
View File
@@ -159,6 +159,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_DLSCH_t *dlsch, LTE_UE_DLSCH_t *dlsch,
LTE_DL_UE_HARQ_t *harq_process, LTE_DL_UE_HARQ_t *harq_process,
uint8_t frame,
uint8_t subframe, uint8_t subframe,
uint8_t harq_pid, uint8_t harq_pid,
uint8_t is_crnti, uint8_t is_crnti,
@@ -241,6 +242,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
return(dlsch->max_turbo_iterations); return(dlsch->max_turbo_iterations);
} }
if (dlsch->harq_ack[subframe].ack != 2) {
LOG_D(PHY, "[UE %d] DLSCH @ SF%d : ACK bit is %d instead of DTX even before PDSCH is decoded!\n",
phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack);
}
if (llr8_flag == 0) { if (llr8_flag == 0) {
//#ifdef __AVX2__ //#ifdef __AVX2__
#if 0 #if 0
@@ -609,10 +615,20 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
//printf("CRC failed, segment %d\n",r); //printf("CRC failed, segment %d\n",r);
err_flag = 1; err_flag = 1;
} }
} }
int32_t frame_rx_prev = frame;
int32_t subframe_rx_prev = subframe - 1;
if (subframe_rx_prev < 0) {
frame_rx_prev--;
subframe_rx_prev += 10;
}
frame_rx_prev = frame_rx_prev%1024;
if (err_flag == 1) { if (err_flag == 1) {
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, round %d, subframe %d)\n",
phy_vars_ue->Mod_id, frame_rx_prev, subframe_rx_prev, harq_pid, harq_process->round, subframe);
dlsch->harq_ack[subframe].ack = 0; dlsch->harq_ack[subframe].ack = 0;
dlsch->harq_ack[subframe].harq_id = harq_pid; dlsch->harq_ack[subframe].harq_id = harq_pid;
dlsch->harq_ack[subframe].send_harq_status = 1; dlsch->harq_ack[subframe].send_harq_status = 1;
@@ -631,6 +647,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
return((1+dlsch->max_turbo_iterations)); return((1+dlsch->max_turbo_iterations));
} else { } else {
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, round %d, subframe %d)\n",
phy_vars_ue->Mod_id, frame_rx_prev, subframe_rx_prev, harq_pid, harq_process->round, subframe);
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
harq_process->round = 0; harq_process->round = 0;
dlsch->harq_ack[subframe].ack = 1; dlsch->harq_ack[subframe].ack = 1;
@@ -640,6 +659,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
{ {
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS); LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
} }
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
} }
@@ -35,7 +35,7 @@
#include "defs.h" #include "defs.h"
#include "extern.h" #include "extern.h"
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#include "T.h"
#ifndef USER_MODE #ifndef USER_MODE
#define NOCYGWIN_STATIC static #define NOCYGWIN_STATIC static
@@ -74,6 +74,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
PDSCH_t type, PDSCH_t type,
unsigned char eNB_id, unsigned char eNB_id,
unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
uint32_t frame,
uint8_t subframe, uint8_t subframe,
unsigned char symbol, unsigned char symbol,
unsigned char first_symbol_flag, unsigned char first_symbol_flag,
@@ -120,7 +121,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
break; break;
default: default:
LOG_E(PHY,"[UE %d][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->proc.proc_rxtx[0].frame_rx,subframe,type); LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->proc.proc_rxtx[0].frame_rx,subframe,type);
return(-1); return(-1);
break; break;
} }
@@ -297,6 +298,13 @@ int rx_pdsch(PHY_VARS_UE *ue,
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]); // avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
#if T_TRACER
if (type == PDSCH)
{
T(T_UE_PHY_PDSCH_ENERGY, T_INT(eNB_id), T_INT(0), T_INT(frame%1024), T_INT(subframe),
T_INT(avg[0]), T_INT(avg[1]), T_INT(avg[2]), T_INT(avg[3]));
}
#endif
pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1; pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1;
// + log2_approx(frame_parms->nb_antenna_ports_eNB-1) //-1 because log2_approx counts the number of bits // + log2_approx(frame_parms->nb_antenna_ports_eNB-1) //-1 because log2_approx counts the number of bits
@@ -825,6 +833,15 @@ int rx_pdsch(PHY_VARS_UE *ue,
return(-1); return(-1);
break; break;
} }
#if T_TRACER
T(T_UE_PHY_PDSCH_IQ, T_INT(eNB_id), T_INT(ue->Mod_id), T_INT(frame%1024),
T_INT(subframe), T_INT(nb_rb),
T_INT(frame_parms->N_RB_UL), T_INT(frame_parms->symbols_per_tti),
T_BUFFER(&pdsch_vars[eNB_id]->rxdataF_comp0[eNB_id][0],
2 * /* ulsch[UE_id]->harq_processes[harq_pid]->nb_rb */ frame_parms->N_RB_UL *12*frame_parms->symbols_per_tti*2));
#endif
return(0); return(0);
} }
@@ -595,7 +595,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
int use2ndpilots = (frame_parms->mode1_flag==1)?1:0; int use2ndpilots = (frame_parms->mode1_flag==1)?1:0;
uint32_t tti_offset,aa; uint32_t tti_offset; //,aa;
uint8_t re; uint8_t re;
uint8_t qam64_table_offset_re = 0; uint8_t qam64_table_offset_re = 0;
uint8_t qam64_table_offset_im = 0; uint8_t qam64_table_offset_im = 0;
+2 -1
View File
@@ -118,7 +118,8 @@ void generate_nPRS(LTE_DL_FRAME_PARMS *frame_parms)
uint16_t next = 0; uint16_t next = 0;
uint8_t ns=0; uint8_t ns=0;
uint32_t fss_pusch = frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; uint32_t fss_pucch = (frame_parms->Nid_cell) % 30;
uint32_t fss_pusch = (fss_pucch + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH) % 30;
x2 = (32*(uint32_t)(frame_parms->Nid_cell/30)) + fss_pusch; x2 = (32*(uint32_t)(frame_parms->Nid_cell/30)) + fss_pusch;
#ifdef DEBUG_GROUPHOP #ifdef DEBUG_GROUPHOP
+1 -1
View File
@@ -88,7 +88,7 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
if (ue->frame_parms.frame_type == TDD) { if (ue->frame_parms.frame_type == TDD) {
ue_rrc_measurements(ue, ue_rrc_measurements(ue,
1, 2,
0); 0);
} }
else { else {
+59 -33
View File
@@ -142,125 +142,134 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su
uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe) uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe)
{ {
uint8_t pusch_frame = 255;
if (frame_parms->frame_type == FDD) { if (frame_parms->frame_type == FDD) {
return((subframe<4) ? (frame - 1) : frame); pusch_frame = ((subframe<4) ? (frame - 1) : frame);
} else { } else {
// Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD! // Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD!
return(frame); pusch_frame = (frame);
} }
LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame);
return pusch_frame;
} }
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{ {
uint8_t pusch_subframe = 255;
if (frame_parms->frame_type == FDD) if (frame_parms->frame_type == FDD)
return(subframe<4 ? (subframe+6) : (subframe-4)); return subframe < 4 ? subframe + 6 : subframe - 4;
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
case 0: case 0:
if (subframe == 0) if (subframe == 0)
return(3); pusch_subframe = (3);
else if (subframe == 5) { else if (subframe == 5) {
return (8); pusch_subframe = (8);
} else if (subframe == 6) } else if (subframe == 6)
return (2); pusch_subframe = (2);
else if (subframe == 1) else if (subframe == 1)
return (7); pusch_subframe = (7);
else { else {
LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 1: case 1:
if (subframe == 6) if (subframe == 6)
return(2); pusch_subframe = (2);
else if (subframe == 9) else if (subframe == 9)
return (3); pusch_subframe = (3);
else if (subframe == 1) else if (subframe == 1)
return (7); pusch_subframe = (7);
else if (subframe == 4) else if (subframe == 4)
return (8); pusch_subframe = (8);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 2: case 2:
if (subframe == 8) if (subframe == 8)
return(2); pusch_subframe = (2);
else if (subframe == 3) else if (subframe == 3)
return (7); pusch_subframe = (7);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 3: case 3:
if ( (subframe == 8) || (subframe == 9) ) { if ( (subframe == 8) || (subframe == 9) ) {
return(subframe-6); pusch_subframe = (subframe-6);
} else if (subframe==0) } else if (subframe==0)
return(4); pusch_subframe = (4);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 4: case 4:
if ( (subframe == 8) || (subframe == 9) ) { if ( (subframe == 8) || (subframe == 9) ) {
return(subframe-6); pusch_subframe = (subframe-6);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 5: case 5:
if (subframe == 8) { if (subframe == 8) {
return(2); pusch_subframe = (2);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 6: case 6:
if (subframe == 6) { if (subframe == 6) {
return(2); pusch_subframe = (2);
} else if (subframe == 9) { } else if (subframe == 9) {
return(3); pusch_subframe = (3);
} else if (subframe == 0) { } else if (subframe == 0) {
return(4); pusch_subframe = (4);
} else if (subframe == 1) { } else if (subframe == 1) {
return(7); pusch_subframe = (7);
} else if (subframe == 5) { } else if (subframe == 5) {
return(8); pusch_subframe = (8);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
default:
LOG_E(PHY, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config);
pusch_subframe = (0);
} }
return(0); LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", subframe, pusch_subframe);
return pusch_subframe;
} }
int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
@@ -1110,6 +1119,16 @@ void rx_phich(PHY_VARS_UE *ue,
nseq_PHICH = ((ulsch->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) + nseq_PHICH = ((ulsch->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) +
ulsch->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH); ulsch->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH);
} else { } else {
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX %s\n",
ue->Mod_id,
harq_pid,
proc->frame_rx,
subframe,
(ulsch->harq_processes[harq_pid]->status==SCH_IDLE? "SCH_IDLE" :
(ulsch->harq_processes[harq_pid]->status==ACTIVE? "ACTIVE" :
(ulsch->harq_processes[harq_pid]->status==CBA_ACTIVE? "CBA_ACTIVE":
(ulsch->harq_processes[harq_pid]->status==DISABLED? "DISABLED" : "UNKNOWN")))));
return; return;
} }
@@ -1374,7 +1393,7 @@ void rx_phich(PHY_VARS_UE *ue,
} }
} else { } else {
//#ifdef DEBUG_PHICH //#ifdef DEBUG_PHICH
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d\n", LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d (Mlimit %d)\n",
ue->Mod_id,harq_pid, ue->Mod_id,harq_pid,
proc->frame_rx, proc->frame_rx,
subframe, subframe,
@@ -1414,7 +1433,10 @@ void rx_phich(PHY_VARS_UE *ue,
//LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round);
} }
} }
#if T_TRACER
T(T_UE_PHY_ULSCH_UE_NACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ue->Mod_id), T_INT(ulsch->rnti),
T_INT(harq_pid));
#endif
} else { //ACK } else { //ACK
if (ue->ulsch_Msg3_active[eNB_id] == 1) { if (ue->ulsch_Msg3_active[eNB_id] == 1) {
@@ -1449,7 +1471,11 @@ void rx_phich(PHY_VARS_UE *ue,
// inform MAC? // inform MAC?
ue->ulsch_Msg3_active[eNB_id] = 0; ue->ulsch_Msg3_active[eNB_id] = 0;
//LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH ACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); #if T_TRACER
T(T_UE_PHY_ULSCH_UE_ACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ue->Mod_id), T_INT(ulsch->rnti),
T_INT(harq_pid));
#endif
} }
} }
+33 -1
View File
@@ -1138,6 +1138,7 @@ void dlsch_scale_channel(int32_t **dl_ch_estimates_ext,
@param dlsch_llr Pointer to LLR values computed by dlsch_demodulation @param dlsch_llr Pointer to LLR values computed by dlsch_demodulation
@param lte_frame_parms Pointer to frame descriptor @param lte_frame_parms Pointer to frame descriptor
@param dlsch Pointer to DLSCH descriptor @param dlsch Pointer to DLSCH descriptor
@param frame Frame number
@param subframe Subframe number @param subframe Subframe number
@param num_pdcch_symbols Number of PDCCH symbols @param num_pdcch_symbols Number of PDCCH symbols
@param is_crnti indicates if PDSCH belongs to a CRNTI (necessary for parallelizing decoding threads) @param is_crnti indicates if PDSCH belongs to a CRNTI (necessary for parallelizing decoding threads)
@@ -1149,6 +1150,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
LTE_DL_FRAME_PARMS *lte_frame_parms, LTE_DL_FRAME_PARMS *lte_frame_parms,
LTE_UE_DLSCH_t *dlsch, LTE_UE_DLSCH_t *dlsch,
LTE_DL_UE_HARQ_t *harq_process, LTE_DL_UE_HARQ_t *harq_process,
uint8_t frame,
uint8_t subframe, uint8_t subframe,
uint8_t harq_pid, uint8_t harq_pid,
uint8_t is_crnti, uint8_t is_crnti,
@@ -1179,6 +1181,7 @@ int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
PDSCH_t type, PDSCH_t type,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t eNB_id_i, uint8_t eNB_id_i,
uint32_t frame,
uint8_t subframe, uint8_t subframe,
uint8_t symbol, uint8_t symbol,
uint8_t first_symbol_flag, uint8_t first_symbol_flag,
@@ -1189,11 +1192,39 @@ int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars, int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
LTE_UE_PDCCH **lte_ue_pdcch_vars, LTE_UE_PDCCH **lte_ue_pdcch_vars,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint8_t subframe, uint8_t subframe,
uint8_t eNB_id, uint8_t eNB_id,
MIMO_mode_t mimo_mode, MIMO_mode_t mimo_mode,
uint32_t high_speed_flag, uint32_t high_speed_flag,
uint8_t is_secondary_ue); uint8_t is_secondary_ue);
/*! \brief Extract PSS and SSS resource elements
@param phy_vars_ue Pointer to UE variables
@param[out] pss_ext contain the PSS signals after the extraction
@param[out] sss_ext contain the SSS signals after the extraction
@returns 0 on success
*/
int pss_sss_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72]);
/*! \brief Extract only PSS resource elements
@param phy_vars_ue Pointer to UE variables
@param[out] pss_ext contain the PSS signals after the extraction
@returns 0 on success
*/
int pss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72]);
/*! \brief Extract only SSS resource elements
@param phy_vars_ue Pointer to UE variables
@param[out] sss_ext contain the SSS signals after the extraction
@returns 0 on success
*/
int sss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t sss_ext[4][72]);
/*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix) /*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix)
@param phy_vars_ue Pointer to UE variables @param phy_vars_ue Pointer to UE variables
@param tot_metric Pointer to variable containing maximum metric under framing hypothesis (to be compared to other hypotheses @param tot_metric Pointer to variable containing maximum metric under framing hypothesis (to be compared to other hypotheses
@@ -1499,7 +1530,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
uint16_t si_rnti, uint16_t si_rnti,
uint16_t ra_rnti, uint16_t ra_rnti,
uint16_t p_rnti, uint16_t p_rnti,
uint8_t beamforming_mode); uint8_t beamforming_mode,
uint16_t tc_rnti);
int32_t generate_eNB_dlsch_params_from_dci(int frame, int32_t generate_eNB_dlsch_params_from_dci(int frame,
uint8_t subframe, uint8_t subframe,
+1
View File
@@ -555,6 +555,7 @@ void generate_pucch2x(int32_t **txdataF,
N_UL_symb = (fp->Ncp==0) ? 7 : 6; N_UL_symb = (fp->Ncp==0) ? 7 : 6;
data_ind = 0; data_ind = 0;
zptr = z; zptr = z;
nprime = 0;
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
if ((ns&1) == 0) if ((ns&1) == 0)
+27 -4
View File
@@ -146,9 +146,10 @@ int pss_ch_est(PHY_VARS_UE *ue,
} }
int pss_sss_extract(PHY_VARS_UE *ue, int _do_pss_sss_extract(PHY_VARS_UE *ue,
int32_t pss_ext[4][72], int32_t pss_ext[4][72],
int32_t sss_ext[4][72]) int32_t sss_ext[4][72],
uint8_t doPss, uint8_t doSss) // add flag to indicate extracting only PSS, only SSS, or both
{ {
@@ -191,8 +192,8 @@ int pss_sss_extract(PHY_VARS_UE *ue,
} }
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
pss_rxF_ext[i]=pss_rxF[i]; if (doPss) {pss_rxF_ext[i]=pss_rxF[i];}
sss_rxF_ext[i]=sss_rxF[i]; if (doSss) {sss_rxF_ext[i]=sss_rxF[i];}
} }
pss_rxF+=12; pss_rxF+=12;
@@ -206,6 +207,28 @@ int pss_sss_extract(PHY_VARS_UE *ue,
return(0); return(0);
} }
int pss_sss_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72])
{
return _do_pss_sss_extract(phy_vars_ue, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */);
}
int pss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72])
{
static int32_t dummy[4][72];
return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */);
}
int sss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t sss_ext[4][72])
{
static int32_t dummy[4][72];
return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */);
}
int16_t phase_re[7] = {16383, 25101, 30791, 32767, 30791, 25101, 16383}; int16_t phase_re[7] = {16383, 25101, 30791, 32767, 30791, 25101, 16383};
int16_t phase_im[7] = {-28378, -21063, -11208, 0, 11207, 21062, 28377}; int16_t phase_im[7] = {-28378, -21063, -11208, 0, 11207, 21062, 28377};
+1
View File
@@ -581,6 +581,7 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
switch(uci_format) { switch(uci_format) {
case wideband_cqi_rank1_2A: case wideband_cqi_rank1_2A:
#ifdef DEBUG_UCI #ifdef DEBUG_UCI
LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA);
switch(N_RB_DL) { switch(N_RB_DL) {
case 6: case 6:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
+14 -2
View File
@@ -190,7 +190,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
return(ulsch); return(ulsch);
} }
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %d\n",exit_flag, sizeof(LTE_UE_ULSCH_t)); LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
free_ue_ulsch(ulsch); free_ue_ulsch(ulsch);
return(NULL); return(NULL);
@@ -234,7 +234,7 @@ uint32_t ulsch_encoding(uint8_t *a,
PHY_MEASUREMENTS *meas = &ue->measurements; PHY_MEASUREMENTS *meas = &ue->measurements;
LTE_UE_ULSCH_t *ulsch=ue->ulsch[eNB_id]; LTE_UE_ULSCH_t *ulsch=ue->ulsch[eNB_id];
LTE_UE_DLSCH_t **dlsch = ue->dlsch[eNB_id]; LTE_UE_DLSCH_t **dlsch = ue->dlsch[eNB_id];
uint16_t rnti; uint16_t rnti = 0xffff;
if (!ulsch) { if (!ulsch) {
LOG_E(PHY,"Null ulsch ptr %p\n",ulsch); LOG_E(PHY,"Null ulsch ptr %p\n",ulsch);
@@ -260,6 +260,7 @@ uint32_t ulsch_encoding(uint8_t *a,
// fill CQI/PMI information // fill CQI/PMI information
if (ulsch->O>0) { if (ulsch->O>0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN);
rnti = ue->pdcch_vars[eNB_id]->crnti; rnti = ue->pdcch_vars[eNB_id]->crnti;
fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff); fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff);
@@ -271,6 +272,7 @@ uint32_t ulsch_encoding(uint8_t *a,
//LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi)); //LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi; dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_OUT);
} }
if (ulsch->O<=32) { if (ulsch->O<=32) {
@@ -469,6 +471,16 @@ uint32_t ulsch_encoding(uint8_t *a,
Q_ACK = Qprime * Q_m; Q_ACK = Qprime * Q_m;
Qprime_ACK = Qprime; Qprime_ACK = Qprime;
LOG_D(PHY,"UE (%x/%d) O_ACK %d, Mcs_initial %d, Nsymb_initial %d, beta_offset_harqack*8 %d, sum Kr %d, Qprime_ACK %d, Q_ACK %d\n",
rnti, harq_pid,
ulsch->harq_processes[harq_pid]->O_ACK,
ulsch->harq_processes[harq_pid]->Msc_initial,
ulsch->harq_processes[harq_pid]->Nsymb_initial,
ulsch->beta_offset_harqack_times8,
sumKr,
Qprime_ACK,
Q_ACK);
// Compute Q_cqi, assume O>11, p. 26 36-212 // Compute Q_cqi, assume O>11, p. 26 36-212
if (control_only_flag == 0) { if (control_only_flag == 0) {
+9 -2
View File
@@ -1,11 +1,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include "PHY/impl_defs_lte.h" #include "PHY/impl_defs_lte.h"
int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs){ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs){
FILE *calibF_fd; FILE *calibF_fd;
int i,j,l,calibF_e; int i,j,calibF_e;
calibF_fd = fopen(calibF_fname,"r"); calibF_fd = fopen(calibF_fname,"r");
@@ -14,7 +15,7 @@ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coef
for(i=0;i<nb_ant;i++){ for(i=0;i<nb_ant;i++){
for(j=0;j<nb_freq*2;j++){ for(j=0;j<nb_freq*2;j++){
fscanf(calibF_fd, "%d", &calibF_e); if (fscanf(calibF_fd, "%d", &calibF_e) != 1) abort();
tdd_calib_coeffs[i][j] = (int16_t)calibF_e; tdd_calib_coeffs[i][j] = (int16_t)calibF_e;
} }
} }
@@ -22,11 +23,15 @@ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coef
printf("%d\n",(int)tdd_calib_coeffs[1][599]); printf("%d\n",(int)tdd_calib_coeffs[1][599]);
} else } else
printf("%s not found, running with defaults\n",calibF_fname); printf("%s not found, running with defaults\n",calibF_fname);
/* TODO: what to return? is this code used at all? */
return 0;
} }
int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, int nb_ant, int nb_freq) { int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, int nb_ant, int nb_freq) {
/* TODO: what to return? is this code used at all? */
return 0;
} }
@@ -44,6 +49,8 @@ int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates,
default : default :
break; break;
} }
/* TODO: what to return? is this code used at all? */
return 0;
} }
// temporal test function // temporal test function
+2
View File
@@ -346,6 +346,8 @@ typedef struct eNB_proc_t_s {
/// Context data structure for RX/TX portion of subframe processing /// Context data structure for RX/TX portion of subframe processing
typedef struct { typedef struct {
/// index of the current UE RX/TX proc
int proc_id;
/// Component Carrier index /// Component Carrier index
uint8_t CC_id; uint8_t CC_id;
/// timestamp transmitted to HW /// timestamp transmitted to HW
+12 -2
View File
@@ -994,6 +994,8 @@ typedef struct {
uint8_t num_pdcch_symbols; uint8_t num_pdcch_symbols;
/// Allocated CRNTI for UE /// Allocated CRNTI for UE
uint16_t crnti; uint16_t crnti;
/// 1: the allocated crnti is Temporary C-RNTI / 0: otherwise
uint8_t crnti_is_temporary;
/// Total number of PDU errors (diagnostic mode) /// Total number of PDU errors (diagnostic mode)
uint32_t dci_errors; uint32_t dci_errors;
/// Total number of PDU received /// Total number of PDU received
@@ -1098,6 +1100,14 @@ typedef enum {
typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t; typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;
typedef enum {
/// do not detect any DCIs in the current subframe
NO_DCI = 0x0,
/// detect only downlink DCIs in the current subframe
UL_DCI = 0x1,
/// detect only uplink DCIs in the current subframe
DL_DCI = 0x2,
/// detect both uplink and downlink DCIs in the current subframe
UL_DL_DCI = 0x3} dci_detect_mode_t;
#endif #endif
+22 -1
View File
@@ -212,6 +212,13 @@ void prach_procedures(PHY_VARS_eNB *eNB);
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
/*! \brief Function to compute which type of DCIs to detect in the given subframe
@param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe index
@returns DCI detetion mode type (no DCIs, uplink DCIs, downlink DCIs, both uplink and downlink DCIs)
*/
dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler. /*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler.
@param Mod_id Index of eNB @param Mod_id Index of eNB
@param CC_id Component Carrier Index @param CC_id Component Carrier Index
@@ -300,6 +307,18 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
*/ */
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK); uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK);
/*! \brief Reset ACK/NACK information
@param frame_parms Pointer to DL frame parameter descriptor
@param harq_ack Pointer to dlsch_ue harq_ack status descriptor
@param subframe Subframe for UE transmission (n in 36.213)
@param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH
@returns status indicator for PUCCH/PUSCH transmission
*/
uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK);
/*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH. Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6) /*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH. Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6)
@param frame_parms Pointer to DL frame parameter descriptor @param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe for UE transmission (n in 36.213) @param subframe Subframe for UE transmission (n in 36.213)
@@ -366,6 +385,7 @@ subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch
TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2) TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
@param phy_vars_ue Pointer to UE variables @param phy_vars_ue Pointer to UE variables
@param proc Pointer to RXn-TXnp4 proc information @param proc Pointer to RXn-TXnp4 proc information
@param harq_ack Pointer to dlsch_ue harq_ack status descriptor
@param eNB_id Index of eNB @param eNB_id Index of eNB
@param b Pointer to PUCCH payload (b[0],b[1]) @param b Pointer to PUCCH payload (b[0],b[1])
@param SR 1 means there's a positive SR in parallel to ACK/NAK @param SR 1 means there's a positive SR in parallel to ACK/NAK
@@ -373,6 +393,7 @@ TDD, this routine computes the complex procedure described in Section 10.1 of 36
*/ */
uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc, UE_rxtx_proc_t *proc,
harq_status_t *harq_ack,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t *b, uint8_t *b,
uint8_t SR); uint8_t SR);
@@ -431,7 +452,7 @@ UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
@param pucch_fmt Format of PUCCH that is being transmitted @param pucch_fmt Format of PUCCH that is being transmitted
@returns Transmit power @returns Transmit power
*/ */
int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt); int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt);
/*! \brief This function implements the power control mechanism for PUCCH from 36.213. /*! \brief This function implements the power control mechanism for PUCCH from 36.213.
@param phy_vars_ue PHY variables @param phy_vars_ue PHY variables
+155 -47
View File
@@ -320,85 +320,128 @@ unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char s
} }
// This function implements table 10.1-1 of 36-213, p. 69 // This function implements table 10.1-1 of 36-213, p. 69
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms, // return the number 'Nbundled'
uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack, harq_status_t *harq_ack,
unsigned char subframe, unsigned char subframe,
unsigned char *o_ACK) unsigned char *o_ACK,
uint8_t do_reset) // 1 to reset ACK/NACK status : 0 otherwise
{ {
uint8_t status=0; uint8_t status=0;
uint8_t subframe_dl; uint8_t subframe_ul=0xff, subframe_dl0=0xff, subframe_dl1=0xff;
// printf("get_ack: SF %d\n",subframe); // printf("get_ack: SF %d\n",subframe);
if (frame_parms->frame_type == FDD) { if (frame_parms->frame_type == FDD) {
if (subframe < 4) if (subframe < 4)
subframe_dl = subframe + 6; subframe_dl0 = subframe + 6;
else else
subframe_dl = subframe - 4; subframe_dl0 = subframe - 4;
o_ACK[0] = harq_ack[subframe_dl].ack; o_ACK[0] = harq_ack[subframe_dl0].ack;
status = harq_ack[subframe_dl].send_harq_status; status = harq_ack[subframe_dl0].send_harq_status;
//printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]); //printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]);
} else { } else {
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
case 1: case 1:
if (subframe == 2) { // ACK subframes 5 (forget 6) if (subframe == 2) { // ACK subframes 5,6
o_ACK[0] = harq_ack[5].ack; subframe_ul = 6;
status = harq_ack[5].send_harq_status; subframe_dl0 = 5;
subframe_dl1 = 6;
} else if (subframe == 3) { // ACK subframe 9 } else if (subframe == 3) { // ACK subframe 9
o_ACK[0] = harq_ack[9].ack; subframe_ul = 9;
status = harq_ack[9].send_harq_status; subframe_dl0 = 9;
subframe_dl1 = 0xff;
} else if (subframe == 4) { // nothing } else if (subframe == 4) { // nothing
status = 0; subframe_ul = 0xff;
} else if (subframe == 7) { // ACK subframes 0 (forget 1) subframe_dl0 = 0xff; // invalid subframe number indicates ACK/NACK is not needed
o_ACK[0] = harq_ack[0].ack; subframe_dl1 = 0xff;
status = harq_ack[0].send_harq_status; } else if (subframe == 7) { // ACK subframes 0,1
subframe_ul = 1;
subframe_dl0 = 0;
subframe_dl1 = 1;
} else if (subframe == 8) { // ACK subframes 4 } else if (subframe == 8) { // ACK subframes 4
o_ACK[0] = harq_ack[4].ack; subframe_ul = 4;
status = harq_ack[4].send_harq_status; subframe_dl0 = 4;
subframe_dl1 = 0xff;
} else { } else {
LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); return(0);
} }
// report ACK/NACK status
o_ACK[0] = 1;
status = 0;
if ((subframe_dl0 < 10) && (harq_ack[subframe_dl0].send_harq_status)) {
o_ACK[0] &= harq_ack[subframe_dl0].ack;
status = harq_ack[subframe_dl0].send_harq_status;
}
if ((subframe_dl1 < 10) && (harq_ack[subframe_dl1].send_harq_status)) {
o_ACK[0] &= harq_ack[subframe_dl1].ack;
status = harq_ack[subframe_dl1].send_harq_status;
}
// report status = Nbundled
if (!status) {
o_ACK[0] = 0;
} else {
if (harq_ack[subframe_ul].vDAI_UL < 0xff) {
status = harq_ack[subframe_ul].vDAI_UL;
}
}
if (!do_reset && (subframe_ul < 10)) {
if ((subframe_dl0 < 10) && (subframe_dl1 < 10)) {
LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d harq_status=%d vDAI_DL=%d, dlsf#%d ACK=%d harq_status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n",
subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status,
subframe_dl0, harq_ack[subframe_dl0].ack, harq_ack[subframe_dl0].send_harq_status, harq_ack[subframe_dl0].vDAI_DL,
subframe_dl1, harq_ack[subframe_dl1].ack, harq_ack[subframe_dl1].send_harq_status, harq_ack[subframe_dl1].vDAI_DL,
o_ACK[0], status);
} else if (subframe_dl0 < 10) {
LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n",
subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status,
subframe_dl0, harq_ack[subframe_dl0].ack, harq_ack[subframe_dl0].send_harq_status, harq_ack[subframe_dl0].vDAI_DL,
o_ACK[0], status);
}else if (subframe_dl1 < 10) {
LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n",
subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status,
subframe_dl1, harq_ack[subframe_dl1].ack, harq_ack[subframe_dl1].send_harq_status, harq_ack[subframe_dl1].vDAI_DL,
o_ACK[0], status);
}
}
// reset ACK/NACK status
if (do_reset) {
LOG_D(PHY,"ul-sf#%d ACK/NACK status resetting @ dci0-sf#%d, dci1x/2x-sf#%d, dci1x/2x-sf#%d\n", subframe, subframe_ul, subframe_dl0, subframe_dl1);
if (subframe_ul < 10) {
harq_ack[subframe_ul].vDAI_UL = 0xff;
}
if (subframe_dl0 < 10) {
harq_ack[subframe_dl0].vDAI_DL = 0xff;
harq_ack[subframe_dl0].ack = 2;
harq_ack[subframe_dl0].send_harq_status = 0;
}
if (subframe_dl1 < 10) {
harq_ack[subframe_dl1].vDAI_DL = 0xff;
harq_ack[subframe_dl1].ack = 2;
harq_ack[subframe_dl1].send_harq_status = 0;
}
}
break; break;
case 3: case 3:
if (subframe == 2) { // ACK subframes 5 and 6 if (subframe == 2) { // ACK subframes 5 and 6
if (harq_ack[5].send_harq_status == 1) { subframe_dl0 = 5;
o_ACK[0] = harq_ack[5].ack; subframe_dl1 = 6;
if (harq_ack[6].send_harq_status == 1)
o_ACK[1] = harq_ack[6].ack;
} else if (harq_ack[6].send_harq_status == 1)
o_ACK[0] = harq_ack[6].ack;
status = harq_ack[5].send_harq_status + (harq_ack[6].send_harq_status<<1);
//printf("Subframe 2, TDD config 3: harq_ack[5] = %d (%d),harq_ack[6] = %d (%d)\n",harq_ack[5].ack,harq_ack[5].send_harq_status,harq_ack[6].ack,harq_ack[6].send_harq_status); //printf("Subframe 2, TDD config 3: harq_ack[5] = %d (%d),harq_ack[6] = %d (%d)\n",harq_ack[5].ack,harq_ack[5].send_harq_status,harq_ack[6].ack,harq_ack[6].send_harq_status);
} else if (subframe == 3) { // ACK subframes 7 and 8 } else if (subframe == 3) { // ACK subframes 7 and 8
if (harq_ack[7].send_harq_status == 1) { subframe_dl0 = 7;
o_ACK[0] = harq_ack[7].ack; subframe_dl1 = 8;
if (harq_ack[8].send_harq_status == 1)
o_ACK[1] = harq_ack[8].ack;
} else if (harq_ack[8].send_harq_status == 1)
o_ACK[0] = harq_ack[8].ack;
status = harq_ack[7].send_harq_status + (harq_ack[8].send_harq_status<<1);
//printf("Subframe 3, TDD config 3: harq_ack[7] = %d,harq_ack[8] = %d\n",harq_ack[7].ack,harq_ack[8].ack); //printf("Subframe 3, TDD config 3: harq_ack[7] = %d,harq_ack[8] = %d\n",harq_ack[7].ack,harq_ack[8].ack);
//printf("status %d : o_ACK (%d,%d)\n", status,o_ACK[0],o_ACK[1]); //printf("status %d : o_ACK (%d,%d)\n", status,o_ACK[0],o_ACK[1]);
} else if (subframe == 4) { // ACK subframes 9 and 0 } else if (subframe == 4) { // ACK subframes 9 and 0
if (harq_ack[9].send_harq_status == 1) { subframe_dl0 = 9;
o_ACK[0] = harq_ack[9].ack; subframe_dl1 = 0;
if (harq_ack[0].send_harq_status == 1)
o_ACK[1] = harq_ack[0].ack;
} else if (harq_ack[0].send_harq_status == 1)
o_ACK[0] = harq_ack[0].ack;
status = harq_ack[9].send_harq_status + (harq_ack[0].send_harq_status<<1);
//printf("Subframe 4, TDD config 3: harq_ack[9] = %d,harq_ack[0] = %d\n",harq_ack[9].ack,harq_ack[0].ack); //printf("Subframe 4, TDD config 3: harq_ack[9] = %d,harq_ack[0] = %d\n",harq_ack[9].ack,harq_ack[0].ack);
} else { } else {
LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n",
@@ -406,6 +449,25 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
return(0); return(0);
} }
// report ACK/NACK status
if (harq_ack[subframe_dl0].send_harq_status == 1) {
o_ACK[0] = harq_ack[subframe_dl0].ack;
if (harq_ack[subframe_dl1].send_harq_status == 1)
o_ACK[1] = harq_ack[subframe_dl1].ack;
} else if (harq_ack[subframe_dl1].send_harq_status == 1)
o_ACK[0] = harq_ack[subframe_dl1].ack;
status = harq_ack[subframe_dl0].send_harq_status + (harq_ack[subframe_dl1].send_harq_status<<1);
if (do_reset) {
// reset ACK/NACK status
harq_ack[subframe_dl0].ack = 2;
harq_ack[subframe_dl1].ack = 2;
harq_ack[subframe_dl0].send_harq_status = 0;
harq_ack[subframe_dl1].send_harq_status = 0;
}
break; break;
} }
@@ -416,6 +478,24 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
return(status); return(status);
} }
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK)
{
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, 0);
}
uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
harq_status_t *harq_ack,
unsigned char subframe,
unsigned char *o_ACK)
{
return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, 1);
}
uint8_t Np6[4]= {0,1,3,5}; uint8_t Np6[4]= {0,1,3,5};
uint8_t Np15[4]= {0,3,8,13}; uint8_t Np15[4]= {0,3,8,13};
uint8_t Np25[4]= {0,5,13,22}; uint8_t Np25[4]= {0,5,13,22};
@@ -518,6 +598,34 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
} }
} }
dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{
dci_detect_mode_t ret = 0;
static dci_detect_mode_t Table_8_2_3gpp_36_213[][10] = {
//subf0 , subf1 , subf2 , subf3 , subf4 , subf5 , subf6 , subf7 , subf8 , subf9
{UL_DL_DCI, UL_DL_DCI , NO_DCI , NO_DCI , NO_DCI , UL_DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , NO_DCI }, // tdd0
{DL_DCI , UL_DL_DCI , NO_DCI , NO_DCI , UL_DL_DCI , DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , UL_DL_DCI }, // tdd1
{DL_DCI , DL_DCI , NO_DCI , UL_DL_DCI , DL_DCI , DL_DCI , DL_DCI , NO_DCI, UL_DL_DCI , DL_DCI }, // tdd2
{UL_DL_DCI, DL_DCI , NO_DCI , NO_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , UL_DL_DCI }, // tdd3
{DL_DCI , DL_DCI , NO_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , UL_DL_DCI }, // tdd4
{DL_DCI , DL_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , DL_DCI }, // tdd5
{UL_DL_DCI, UL_DL_DCI , NO_DCI , NO_DCI , NO_DCI , UL_DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , UL_DL_DCI }}; // tdd6
DevAssert(subframe>=0 && subframe<=9);
DevAssert((frame_parms->tdd_config)>=0 && (frame_parms->tdd_config)<=6);
if (frame_parms->frame_type == FDD) {
ret = UL_DL_DCI;
} else {
ret = Table_8_2_3gpp_36_213[frame_parms->tdd_config][subframe];
}
LOG_D(PHY, "subframe %d: detect UL_DCI=%d, detect DL_DCI=%d\n", subframe, (ret & UL_DCI)>0, (ret & DL_DCI)>0);
return ret;
}
lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe) lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe)
{ {
+3 -3
View File
@@ -788,7 +788,7 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = dci_alloc->firstCCE; eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = dci_alloc->firstCCE;
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for ue DCI (PDSCH %"PRIx16") => %"PRIu8"/%u\n",eNB->Mod_id,frame,subframe, LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for ue DCI (PDSCH %"PRIx16") => %"PRIu8"\n",eNB->Mod_id,frame,subframe,
dci_alloc->rnti,eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe]); dci_alloc->rnti,eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe]);
#if defined(SMBV) #if defined(SMBV)
@@ -900,7 +900,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
int i; int i;
LOG_D(PHY, LOG_D(PHY,
"[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")\n", "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n",
eNB->Mod_id, dlsch->rnti,harq_pid, eNB->Mod_id, dlsch->rnti,harq_pid,
frame, subframe, input_buffer_length, frame, subframe, input_buffer_length,
get_G(fp, get_G(fp,
@@ -2784,7 +2784,7 @@ void do_prach(PHY_VARS_eNB *eNB) {
// wake up thread for PRACH RX // wake up thread for PRACH RX
if (pthread_mutex_lock(&proc->mutex_prach) != 0) { if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->instance_cnt_prach ); LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach);
exit_fun( "error locking mutex_prach" ); exit_fun( "error locking mutex_prach" );
return; return;
} }
+339 -99
View File
@@ -66,6 +66,8 @@ fifo_dump_emos_UE emos_dump_UE;
#include "PHY/CODING/extern.h" #include "PHY/CODING/extern.h"
#include "T.h"
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs) #define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
#define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs) #define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs)
@@ -205,9 +207,6 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
int gain_dB = power_dBm - power_max_dBm; int gain_dB = power_dBm - power_max_dBm;
double gain_lin; double gain_lin;
if (gain_dB < -20)
return(AMP/10);
gain_lin = pow(10,.1*gain_dB); gain_lin = pow(10,.1*gain_dB);
if ((nb_rb >0) && (nb_rb <= N_RB_UL)) { if ((nb_rb >0) && (nb_rb <= N_RB_UL)) {
return((int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb))); return((int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb)));
@@ -266,7 +265,7 @@ void phy_reset_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
// This flushes ALL DLSCH and ULSCH harq buffers of ALL connected eNBs...add the eNB_index later // This flushes ALL DLSCH and ULSCH harq buffers of ALL connected eNBs...add the eNB_index later
// for more flexibility // for more flexibility
uint8_t i,j,k; uint8_t i,j,k,s;
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
//[NUMBER_OF_CONNECTED_eNB_MAX][2]; //[NUMBER_OF_CONNECTED_eNB_MAX][2];
@@ -276,6 +275,13 @@ void phy_reset_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
if(ue->dlsch[i][j]) { if(ue->dlsch[i][j]) {
for(k=0; k<NUMBER_OF_HARQ_PID_MAX && ue->dlsch[i][j]->harq_processes[k]; k++) { for(k=0; k<NUMBER_OF_HARQ_PID_MAX && ue->dlsch[i][j]->harq_processes[k]; k++) {
ue->dlsch[i][j]->harq_processes[k]->status = SCH_IDLE; ue->dlsch[i][j]->harq_processes[k]->status = SCH_IDLE;
for (s=0; s<10; s++) {
// reset ACK/NACK bit to DTX for all subframes s = 0..9
ue->dlsch[i][j]->harq_ack[s].ack = 2;
ue->dlsch[i][j]->harq_ack[s].send_harq_status = 0;
ue->dlsch[i][j]->harq_ack[s].vDAI_UL = 0xff;
ue->dlsch[i][j]->harq_ack[s].vDAI_DL = 0xff;
}
} }
} }
} }
@@ -301,7 +307,9 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
// if contention resolution fails, go back to PRACH // if contention resolution fails, go back to PRACH
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH;
LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0 and State RRC_IDLE\n",Mod_id); PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[eNB_index]->crnti_is_temporary = 0;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[eNB_index]->crnti = 0;
LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id);
//mac_xface->macphy_exit(""); //mac_xface->macphy_exit("");
} }
@@ -310,8 +318,9 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
int i; int i;
LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded\n",Mod_id); LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id);
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[eNB_index]->crnti_is_temporary = 0;
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0;
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH;
@@ -337,7 +346,9 @@ void process_timing_advance_rar(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint16_t ti
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance); /* TODO: fix this log, what is 'HW timing advance'? */
/*LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance);*/
LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance);
#endif #endif
} }
@@ -728,6 +739,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id)
uint16_t get_n1_pucch(PHY_VARS_UE *ue, uint16_t get_n1_pucch(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc, UE_rxtx_proc_t *proc,
harq_status_t *harq_ack,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t *b, uint8_t *b,
uint8_t SR) uint8_t SR)
@@ -737,7 +749,8 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
uint8_t nCCE0,nCCE1,harq_ack1,harq_ack0; uint8_t nCCE0,nCCE1,harq_ack1,harq_ack0;
ANFBmode_t bundling_flag; ANFBmode_t bundling_flag;
uint16_t n1_pucch0=0,n1_pucch1=0; uint16_t n1_pucch0=0,n1_pucch1=0;
int subframe_offset; static uint8_t candidate_dl[9]; // which downlink(s) the current ACK/NACK is associating to
uint8_t last_dl=0xff; // the last downlink with valid DL-DCI. for calculating the PUCCH resource index
int sf; int sf;
int M; int M;
// clear this, important for case where n1_pucch selection is not used // clear this, important for case where n1_pucch selection is not used
@@ -775,41 +788,71 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
M=1; M=1;
// This is the offset for a particular subframe (2,3,4) => (0,2,4) // This is the offset for a particular subframe (2,3,4) => (0,2,4)
if (subframe == 2) { // ACK subframes 5 (forget 6) if (subframe == 2) { // ACK subframes 5,6
subframe_offset = 5; candidate_dl[0] = 6;
candidate_dl[1] = 5;
M=2; M=2;
} else if (subframe == 3) { // ACK subframe 9 } else if (subframe == 3) { // ACK subframe 9
subframe_offset = 9; candidate_dl[0] = 9;
} else if (subframe == 7) { // ACK subframes 0 (forget 1) } else if (subframe == 7) { // ACK subframes 0,1
subframe_offset = 0; candidate_dl[0] = 1;
candidate_dl[1] = 0;
M=2; M=2;
} else if (subframe == 8) { // ACK subframes 4 } else if (subframe == 8) { // ACK subframes 4
subframe_offset = 4; candidate_dl[0] = 4;
} else { } else {
LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal subframe %d for tdd_config %d\n",
ue->Mod_id,proc->frame_tx,subframe,frame_parms->tdd_config); ue->Mod_id,proc->frame_tx,subframe,frame_parms->tdd_config);
return(0); return(0);
} }
// checking which downlink candidate is the last downlink with valid DL-DCI
int k;
for (k=0;k<M;k++) {
if (harq_ack[candidate_dl[k]].send_harq_status>0) {
last_dl = candidate_dl[k];
break;
}
}
if (last_dl >= 10) {
LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal subframe %d for tdd_config %d\n",
ue->Mod_id,proc->frame_tx,last_dl,frame_parms->tdd_config);
return (0);
}
LOG_D(PHY,"SFN/SF %d/%d calculating n1_pucch0 from last_dl=%d\n",
proc->frame_tx%1024,
proc->subframe_tx,
last_dl);
// i=0 // i=0
nCCE0 = ue->pdcch_vars[eNB_id]->nCCE[subframe_offset]; nCCE0 = ue->pdcch_vars[eNB_id]->nCCE[last_dl];
n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN;
// set ACK/NAK to values if not DTX harq_ack0 = b[0];
if (ue->dlsch[eNB_id][0]->harq_ack[subframe_offset].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed
harq_ack0 = ue->dlsch[eNB_id][0]->harq_ack[subframe_offset].ack;
if (harq_ack0!=2) { // DTX if (harq_ack0!=2) { // DTX
if (SR == 0) { // last paragraph pg 68 from 36.213 (v8.6), m=0 if (frame_parms->frame_type == FDD ) {
b[0]=(M==2) ? 1-harq_ack0 : harq_ack0; if (SR == 0) { // last paragraph pg 68 from 36.213 (v8.6), m=0
b[1]=harq_ack0; // in case we use pucch format 1b (subframes 2,7) b[0]=(M==2) ? 1-harq_ack0 : harq_ack0;
b[1]=harq_ack0; // in case we use pucch format 1b (subframes 2,7)
ue->pucch_sel[subframe] = 0; ue->pucch_sel[subframe] = 0;
return(n1_pucch0); return(n1_pucch0);
} else { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213) } else { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213)
b[0]=harq_ack0; b[0]=harq_ack0;
return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
}
} else {
if (SR == 0) {
b[0] = harq_ack0;
b[1] = harq_ack0;
ue->pucch_sel[subframe] = 0;
return(n1_pucch0);
} else {
b[0] = harq_ack0;
b[1] = harq_ack0;
return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
}
} }
} }
@@ -823,20 +866,20 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
harq_ack1 = 2; // DTX harq_ack1 = 2; // DTX
harq_ack0 = 2; // DTX harq_ack0 = 2; // DTX
// This is the offset for a particular subframe (2,3,4) => (0,2,4) // This is the offset for a particular subframe (2,3,4) => (0,2,4)
subframe_offset = (subframe-2)<<1; last_dl = (subframe-2)<<1;
// i=0 // i=0
nCCE0 = ue->pdcch_vars[eNB_id]->nCCE[5+subframe_offset]; nCCE0 = ue->pdcch_vars[eNB_id]->nCCE[5+last_dl];
n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN;
// i=1 // i=1
nCCE1 = ue->pdcch_vars[eNB_id]->nCCE[(6+subframe_offset)%10]; nCCE1 = ue->pdcch_vars[eNB_id]->nCCE[(6+last_dl)%10];
n1_pucch1 = get_Np(frame_parms->N_RB_DL,nCCE1,1) + nCCE1 + frame_parms->pucch_config_common.n1PUCCH_AN; n1_pucch1 = get_Np(frame_parms->N_RB_DL,nCCE1,1) + nCCE1 + frame_parms->pucch_config_common.n1PUCCH_AN;
// set ACK/NAK to values if not DTX // set ACK/NAK to values if not DTX
if (ue->dlsch[eNB_id][0]->harq_ack[(6+subframe_offset)%10].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed if (ue->dlsch[eNB_id][0]->harq_ack[(6+last_dl)%10].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed
harq_ack1 = ue->dlsch[eNB_id][0]->harq_ack[(6+subframe_offset)%10].ack; harq_ack1 = ue->dlsch[eNB_id][0]->harq_ack[(6+last_dl)%10].ack;
if (ue->dlsch[eNB_id][0]->harq_ack[5+subframe_offset].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed if (ue->dlsch[eNB_id][0]->harq_ack[5+last_dl].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed
harq_ack0 = ue->dlsch[eNB_id][0]->harq_ack[5+subframe_offset].ack; harq_ack0 = ue->dlsch[eNB_id][0]->harq_ack[5+last_dl].ack;
if (harq_ack1!=2) { // n-6 // subframe 6,8,0 and maybe 5,7,9 is to be ACK/NAKed if (harq_ack1!=2) { // n-6 // subframe 6,8,0 and maybe 5,7,9 is to be ACK/NAKed
@@ -897,7 +940,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
} // switch tdd_config } // switch tdd_config
} }
LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, exit without proper return\n",proc->frame_tx); LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, exit without proper return\n", ue->Mod_id, proc->frame_tx);
return(-1); return(-1);
} }
@@ -934,7 +977,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
*/ */
#endif #endif
void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) { void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empty_subframe) {
int aa; int aa;
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
@@ -971,6 +1014,37 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) {
#else //this is the normal case #else //this is the normal case
ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance; ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance;
#endif //else EXMIMO #endif //else EXMIMO
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
if (empty_subframe)
{
//#if 1
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti));
if (overflow> 0)
memset(&ue->common_vars.txdata[aa][0],0,4*overflow);
}
/*#else
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (k=ulsch_start; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++) {
((short*)ue->common_vars.txdata[aa])[2*k] = 0;
((short*)ue->common_vars.txdata[aa])[2*k+1] = 0;
}
for (k=0; k<overflow; k++) {
((short*)ue->common_vars.txdata[aa])[2*k] = 0;
((short*)ue->common_vars.txdata[aa])[2*k+1] = 0;
}
}
#endif*/
return;
}
#endif
if ((frame_tx%100) == 0) if ((frame_tx%100) == 0)
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: ulsch_start = %d (rxoff %d, HW TA %d, timing advance %d, TA_offset %d\n", LOG_D(PHY,"[UE %d] Frame %d, subframe %d: ulsch_start = %d (rxoff %d, HW TA %d, timing advance %d, TA_offset %d\n",
ue->Mod_id,frame_tx,subframe_tx, ue->Mod_id,frame_tx,subframe_tx,
@@ -1082,7 +1156,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
frame_tx, frame_tx,
eNB_id, eNB_id,
subframe_tx); subframe_tx);
LOG_D(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,ue->prach_resources[eNB_id],UE_mac_inst[ue->Mod_id].radioResourceConfigCommon); LOG_D(PHY,"Got prach_resources for eNB %d address %p, RRCCommon %p\n",eNB_id,ue->prach_resources[eNB_id],UE_mac_inst[ue->Mod_id].radioResourceConfigCommon);
LOG_D(PHY,"Prach resources %p\n",ue->prach_resources[eNB_id]); LOG_D(PHY,"Prach resources %p\n",ue->prach_resources[eNB_id]);
} }
} }
@@ -1194,7 +1268,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
int Mod_id = ue->Mod_id; int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id; int CC_id = ue->CC_id;
uint8_t Msg3_flag=0; uint8_t Msg3_flag=0;
uint8_t ack_status=0;
uint16_t first_rb, nb_rb; uint16_t first_rb, nb_rb;
unsigned int input_buffer_length; unsigned int input_buffer_length;
int i; int i;
@@ -1202,6 +1275,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
int tx_amp; int tx_amp;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32))); uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode; uint8_t access_mode;
uint8_t Nbundled=0;
uint8_t ack_status=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN);
@@ -1245,6 +1320,49 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
} }
} }
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
uint8_t isBad = 0;
if (ue->frame_parms.N_RB_UL <= ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb) {
LOG_D(PHY,"Invalid PUSCH first_RB=%d for N_RB_UL=%d\n",
ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb,
ue->frame_parms.N_RB_UL);
isBad = 1;
}
if (ue->frame_parms.N_RB_UL < ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb) {
LOG_D(PHY,"Invalid PUSCH num_RB=%d for N_RB_UL=%d\n",
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb,
ue->frame_parms.N_RB_UL);
isBad = 1;
}
if (0 > ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb) {
LOG_D(PHY,"Invalid PUSCH first_RB=%d\n",
ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb);
isBad = 1;
}
if (0 >= ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb) {
LOG_D(PHY,"Invalid PUSCH num_RB=%d\n",
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb);
isBad = 1;
}
if (ue->frame_parms.N_RB_UL < (ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb)) {
LOG_D(PHY,"Invalid PUSCH num_RB=%d + first_RB=%d for N_RB_UL=%d\n",
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb,
ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb,
ue->frame_parms.N_RB_UL);
isBad = 1;
}
if ((0 > ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx) ||
(3 < ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx)) {
LOG_D(PHY,"Invalid PUSCH RV index=%d\n", ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx);
isBad = 1;
}
if (isBad) {
LOG_D(PHY,"Skip PUSCH generation!\n");
ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
}
}
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) { if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
ue->generate_ul_signal[eNB_id] = 1; ue->generate_ul_signal[eNB_id] = 1;
@@ -1254,7 +1372,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit); LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit);
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1)) if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1))
{ {
LOG_D(PHY,"PUSCH MAX Retransmission acheived ==> send last pusch (%d) \n"); LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n");
ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0;
} }
@@ -1263,7 +1381,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue->dlsch[eNB_id][0]->harq_ack, ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx, subframe_tx,
ue->ulsch[eNB_id]->o_ACK); ue->ulsch[eNB_id]->o_ACK);
Nbundled = ack_status;
first_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb; first_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb;
nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb;
@@ -1283,6 +1401,22 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
{ {
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 0; ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 0;
} }
#if T_TRACER
if(ue->ulsch[eNB_id]->o_ACK[0])
{
LOG_I(PHY,"PUSCH ACK\n");
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
else
{
LOG_I(PHY,"PUSCH NACK\n");
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
#endif
LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n", LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n",
Mod_id, Mod_id,
ue->ulsch[eNB_id]->rnti, ue->ulsch[eNB_id]->rnti,
@@ -1292,8 +1426,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
} }
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY, LOG_D(PHY,
"[UE %d][PUSCH %d] Frame %d subframe %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d\n", "[UE %d][PUSCH %d] Frame %d subframe %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, bundling %d\n",
Mod_id,harq_pid,frame_tx,subframe_tx, Mod_id,harq_pid,frame_tx,subframe_tx,
first_rb,nb_rb, first_rb,nb_rb,
ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,
@@ -1306,7 +1440,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2, ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2,
ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1], ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1],
ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1],
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK,
ue->ulsch[eNB_id]->bundling);
#endif #endif
@@ -1408,8 +1543,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue, ue,
harq_pid, harq_pid,
eNB_id, eNB_id,
ue->transmission_mode[eNB_id],0, ue->transmission_mode[eNB_id],0,
0)!=0) { // Nbundled, to be updated!!!! Nbundled)!=0) {
LOG_E(PHY,"ulsch_coding.c: FATAL ERROR: returning\n"); LOG_E(PHY,"ulsch_coding.c: FATAL ERROR: returning\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_tx); stop_meas(&ue->phy_proc_tx);
@@ -1443,6 +1578,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
nb_rb); nb_rb);
#else #else
tx_amp = AMP; tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
#endif #endif
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n", LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n",
Mod_id,harq_pid,frame_tx,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp); Mod_id,harq_pid,frame_tx,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp);
@@ -1569,7 +1708,8 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
int Mod_id = ue->Mod_id; int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id; int CC_id = ue->CC_id;
int tx_amp; int tx_amp;
int8_t Po_PUCCH; int16_t Po_PUCCH;
uint8_t ack_status=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_IN);
@@ -1588,6 +1728,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag) if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag)
{ {
LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx); LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
return; return;
} }
@@ -1633,18 +1774,24 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
SR_payload=0; SR_payload=0;
} }
if (get_ack(&ue->frame_parms, ack_status = get_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack, ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,pucch_ack_payload) > 0) { subframe_tx,pucch_ack_payload);
if (ack_status > 0) {
// we need to transmit ACK/NAK in this subframe // we need to transmit ACK/NAK in this subframe
ue->generate_ul_signal[eNB_id] = 1; ue->generate_ul_signal[eNB_id] = 1;
if ((frame_parms->frame_type == TDD) && (SR_payload>0)) {
format = pucch_format1b;
}
n1_pucch = get_n1_pucch(ue, n1_pucch = get_n1_pucch(ue,
proc, proc,
eNB_id, ue->dlsch[eNB_id][0]->harq_ack,
pucch_ack_payload, eNB_id,
SR_payload); pucch_ack_payload,
SR_payload);
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format);
@@ -1663,29 +1810,51 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
#else #else
tx_amp = AMP; tx_amp = AMP;
#endif #endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
if (SR_payload>0) { if (SR_payload>0) {
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
Mod_id, Mod_id,
ue->dlsch[eNB_id][0]->rnti, ue->dlsch[eNB_id][0]->rnti,
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, frame_tx % 1024, subframe_tx,
isShortenPucch, (format == pucch_format1a? "1a": (
frame_tx, subframe_tx, format == pucch_format1b? "1b" : "??")),
pucch_ack_payload[0],pucch_ack_payload[1], pucch_ack_payload[0],pucch_ack_payload[1],
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch,
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH, Po_PUCCH,
tx_amp); tx_amp);
} else { } else {
LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
Mod_id, Mod_id,
ue->dlsch[eNB_id][0]->rnti, ue->dlsch[eNB_id][0]->rnti,
frame_tx, subframe_tx, frame_tx, subframe_tx,
(format == pucch_format1a? "1a": (
format == pucch_format1b? "1b" : "??")),
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
isShortenPucch, isShortenPucch,
n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
Po_PUCCH, Po_PUCCH,
tx_amp); tx_amp);
} }
#if T_TRACER
if(pucch_ack_payload[0])
{
LOG_I(PHY,"PUCCH ACK\n");
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
else
{
LOG_I(PHY,"PUCCH NACK\n");
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(Mod_id), T_INT(ue->dlsch[eNB_id][0]->rnti),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
}
#endif
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
@@ -1729,6 +1898,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
1); 1);
#else #else
tx_amp = AMP; tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif #endif
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
Mod_id, Mod_id,
@@ -1793,6 +1966,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
1); 1);
#else #else
tx_amp = AMP; tx_amp = AMP;
#endif
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif #endif
LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (CQI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n", LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (CQI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n",
Mod_id, Mod_id,
@@ -1833,7 +2010,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
} }
ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12; ue->tx_total_RE[subframe_tx] = 12;
#if T_TRACER
T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
#endif
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH, tx_amp = get_tx_amp(Po_PUCCH,
ue->tx_power_max_dBm, ue->tx_power_max_dBm,
@@ -1869,22 +2049,29 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->generate_ul_signal[eNB_id] = 1; ue->generate_ul_signal[eNB_id] = 1;
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
} }
void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) {
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int32_t ulsch_start=0; //int32_t ulsch_start=0;
int subframe_tx = proc->subframe_tx; int subframe_tx = proc->subframe_tx;
int frame_tx = proc->frame_tx; int frame_tx = proc->frame_tx;
unsigned int aa; unsigned int aa;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
#if T_TRACER
T(T_UE_PHY_UL_TICK, T_INT(ue->Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx));
#endif
ue->generate_ul_signal[eNB_id] = 0; ue->generate_ul_signal[eNB_id] = 0;
start_meas(&ue->phy_proc_tx); start_meas(&ue->phy_proc_tx);
@@ -1978,25 +2165,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[eNB_id] == 0));
if (ue->generate_ul_signal[eNB_id] == 1 )
{
ulsch_common_procedures(ue,proc);
}
else { // no uplink so clear signal buffer instead
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case
ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
ue->hw_timing_advance-
ue->timing_advance-
ue->N_TA_offset+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
#else //this is the normal case
ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance;
#endif //else EXMIMO
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memset(&ue->common_vars.txdata[aa][ulsch_start],0,frame_parms->samples_per_tti<<2);
}
}
} // mode != PRACH } // mode != PRACH
@@ -2014,6 +2183,17 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
ue->generate_prach=0; ue->generate_prach=0;
} }
// reset DL ACK/NACK status
reset_ack(&ue->frame_parms,
ue->dlsch[eNB_id][0]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
reset_ack(&ue->frame_parms,
ue->dlsch_SI[eNB_id]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_tx); stop_meas(&ue->phy_proc_tx);
@@ -2042,7 +2222,11 @@ void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_f
} }
} }
void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) void ue_measurement_procedures(
uint16_t l, // symbol index of each slot [0..6]
PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id,
uint16_t slot, // slot index of each radio frame [0..19]
uint8_t abstraction_flag,runmode_t mode)
{ {
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
@@ -2066,6 +2250,17 @@ void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,
0, 0,
1); 1);
} }
#if T_TRACER
if(slot == 0)
T(T_UE_PHY_MEAS, T_INT(eNB_id), T_INT(ue->Mod_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx),
T_INT((int)(10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB)),
T_INT((int)ue->measurements.rx_rssi_dBm[0]),
T_INT((int)(ue->measurements.rx_power_avg_dB[0] - ue->measurements.n0_power_avg_dB)),
T_INT((int)ue->measurements.rx_power_avg_dB[0]),
T_INT((int)ue->measurements.n0_power_avg_dB),
T_INT((int)ue->measurements.wideband_cqi_avg[0]),
T_INT((int)ue->common_vars.freq_offset));
#endif
} }
if (l==(6-ue->frame_parms.Ncp)) { if (l==(6-ue->frame_parms.Ncp)) {
@@ -2074,7 +2269,7 @@ void ue_measurement_procedures(uint16_t l, PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN);
ue_rrc_measurements(ue, ue_rrc_measurements(ue,
subframe_rx, slot,
abstraction_flag); abstraction_flag);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT);
@@ -2378,7 +2573,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
} else if (((frame_tx & 0x03FF) != (proc->frame_rx & 0x03FF))) { } else if (((frame_tx & 0x03FF) != (proc->frame_rx & 0x03FF))) {
//(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) { //(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) {
LOG_D(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%1024=%d, phase %d).\n", LOG_D(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).\n",
ue->Mod_id, ue->Mod_id,
proc->frame_rx, proc->frame_rx,
subframe_rx, subframe_rx,
@@ -2482,6 +2677,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
rx_pdcch(&ue->common_vars, rx_pdcch(&ue->common_vars,
ue->pdcch_vars, ue->pdcch_vars,
&ue->frame_parms, &ue->frame_parms,
proc->frame_rx,
subframe_rx, subframe_rx,
eNB_id, eNB_id,
(ue->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, (ue->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -2587,7 +2783,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
// dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
if ((ue->UE_mode[eNB_id] > PRACH) && if ((ue->UE_mode[eNB_id] > PRACH) &&
(generate_ue_dlsch_params_from_dci(frame_rx, (generate_ue_dlsch_params_from_dci(frame_rx,
subframe_rx, subframe_rx,
@@ -2600,7 +2796,23 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
SI_RNTI, SI_RNTI,
0, 0,
P_RNTI, P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id])==0)) { ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id],
ue->pdcch_vars[eNB_id]->crnti_is_temporary? ue->pdcch_vars[eNB_id]->crnti: 0)==0)) {
// update TPC for PUCCH
if((dci_alloc_rx[i].format == format1) ||
(dci_alloc_rx[i].format == format1A) ||
(dci_alloc_rx[i].format == format2) ||
(dci_alloc_rx[i].format == format2A))
{
ue->dlsch[eNB_id][0]->g_pucch += ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->delta_PUCCH;
}
/*T(T_UE_PHY_DLSCH_UE_DCI, T_INT(eNB_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(ue->Mod_id),
T_INT(dci_alloc_rx[i].rnti), T_INT(dci_alloc_rx[i].format),
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid),
T_INT(ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->mcs),
T_INT(ue->dlsch[eNB_id][0]->harq_processes[ue->dlsch[eNB_id][0]->current_harq_pid]->TBS));*/
ue->dlsch_received[eNB_id]++; ue->dlsch_received[eNB_id]++;
@@ -2644,7 +2856,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
SI_RNTI, SI_RNTI,
0, 0,
P_RNTI, P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id])==0) { ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id],
0)==0) {
ue->dlsch_SI_received[eNB_id]++; ue->dlsch_SI_received[eNB_id]++;
@@ -2674,7 +2887,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
SI_RNTI, SI_RNTI,
0, 0,
P_RNTI, P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id])==0) { ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id],
0)==0) {
ue->dlsch_p_received[eNB_id]++; ue->dlsch_p_received[eNB_id]++;
@@ -2709,7 +2923,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
SI_RNTI, SI_RNTI,
ue->prach_resources[eNB_id]->ra_RNTI, ue->prach_resources[eNB_id]->ra_RNTI,
P_RNTI, P_RNTI,
ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id])==0) { ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id],
0)==0) {
ue->dlsch_ra_received[eNB_id]++; ue->dlsch_ra_received[eNB_id]++;
@@ -2742,6 +2957,20 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
eNB_id, eNB_id,
0)==0)) { 0)==0)) {
#if T_TRACER
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
uint8_t harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,proc->subframe_rx),
pdcch_alloc2ul_subframe(frame_parms,proc->subframe_rx));
T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), T_INT(ue->Mod_id),
T_INT(dci_alloc_rx[i].rnti), T_INT(harq_pid),
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs),
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round),
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb),
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb),
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS));
#endif
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
#endif #endif
@@ -2871,6 +3100,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
&ue->frame_parms, &ue->frame_parms,
ue->dlsch_MCH[0], ue->dlsch_MCH[0],
ue->dlsch_MCH[0]->harq_processes[0], ue->dlsch_MCH[0]->harq_processes[0],
frame_rx,
subframe_rx, subframe_rx,
0, 0,
0,1); 0,1);
@@ -2895,7 +3125,8 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
ue->dlsch_mtch_errors[sync_area][0]++; ue->dlsch_mtch_errors[sync_area][0]++;
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n",
frame_rx,subframe_rx, ue->Mod_id,
frame_rx,subframe_rx,
ue->dlsch_mcch_errors[sync_area][0], ue->dlsch_mcch_errors[sync_area][0],
ue->dlsch_mtch_errors[sync_area][0], ue->dlsch_mtch_errors[sync_area][0],
ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3,
@@ -2957,7 +3188,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
if (dlsch0 && (!dlsch1)) { if (dlsch0 && (!dlsch1)) {
harq_pid = dlsch0->current_harq_pid; harq_pid = dlsch0->current_harq_pid;
LOG_D(PHY,"[UE %d] PDSCH active in subframe %d (%d), harq_pid %d\n",ue->Mod_id,subframe_rx,harq_pid); LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d\n",ue->Mod_id,subframe_rx,harq_pid);
if ((pdsch==PDSCH) && if ((pdsch==PDSCH) &&
(ue->transmission_mode[eNB_id] == 5) && (ue->transmission_mode[eNB_id] == 5) &&
@@ -2994,6 +3225,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
pdsch, pdsch,
eNB_id, eNB_id,
eNB_id_i, eNB_id_i,
proc->frame_rx,
subframe_rx, // subframe, subframe_rx, // subframe,
m, m,
first_symbol_flag, first_symbol_flag,
@@ -3046,6 +3278,9 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo
ue->pdcch_vars[eNB_id]->crnti, ue->pdcch_vars[eNB_id]->crnti,
timing_advance); timing_advance);
// remember this c-rnti is still a tc-rnti
ue->pdcch_vars[eNB_id]->crnti_is_temporary = 1;
//timing_advance = 0; //timing_advance = 0;
process_timing_advance_rar(ue,proc,timing_advance); process_timing_advance_rar(ue,proc,timing_advance);
@@ -3174,6 +3409,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
&ue->frame_parms, &ue->frame_parms,
dlsch0, dlsch0,
dlsch0->harq_processes[harq_pid], dlsch0->harq_processes[harq_pid],
frame_rx,
subframe_rx, subframe_rx,
harq_pid, harq_pid,
pdsch==PDSCH?1:0, pdsch==PDSCH?1:0,
@@ -3233,6 +3469,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
mac_xface->ue_send_sdu(ue->Mod_id, mac_xface->ue_send_sdu(ue->Mod_id,
CC_id, CC_id,
frame_rx, frame_rx,
subframe_rx,
dlsch0->harq_processes[dlsch0->current_harq_pid]->b, dlsch0->harq_processes[dlsch0->current_harq_pid]->b,
dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS>>3, dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS>>3,
eNB_id); eNB_id);
@@ -3308,10 +3545,17 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int subframe_rx = proc->subframe_rx; int subframe_rx = proc->subframe_rx;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
#if T_TRACER
T(T_UE_PHY_DL_TICK, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx));
#endif
T(T_UE_PHY_INPUT_SIGNAL, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(0),
T_BUFFER(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti],
ue->frame_parms.samples_per_tti * 4));
start_meas(&ue->phy_proc_rx); start_meas(&ue->phy_proc_rx);
@@ -3333,7 +3577,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX (%d)\n", LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n",
(r_type == multicast_relay) ? "RN/UE" : "UE", (r_type == multicast_relay) ? "RN/UE" : "UE",
ue->Mod_id,frame_rx, subframe_rx); ue->Mod_id,frame_rx, subframe_rx);
#endif #endif
@@ -3379,7 +3623,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
stop_meas(&ue->ofdm_demod_stats); stop_meas(&ue->ofdm_demod_stats);
} }
ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode); ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode);
if ((l==pilot1) || if ((l==pilot1) ||
((pmch_flag==1)&(l==l2))) { ((pmch_flag==1)&(l==l2))) {
LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id); LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id);
@@ -3392,7 +3636,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
} }
} // for l=1..l2 } // for l=1..l2
ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode); ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode);
// If this is PMCH, call procedures and return // If this is PMCH, call procedures and return
if (pmch_flag == 1) { if (pmch_flag == 1) {
@@ -3483,7 +3727,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
stop_meas(&ue->ofdm_demod_stats); stop_meas(&ue->ofdm_demod_stats);
} }
ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode); ue_measurement_procedures(l-1,ue,proc,eNB_id,1+(subframe_rx<<1),abstraction_flag,mode);
} // for l=1..l2 } // for l=1..l2
@@ -3528,10 +3772,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT);
} }
else {
// printf("PDSCH inactive in subframe %d\n",subframe_rx-1);
ue->dlsch[eNB_id][0]->harq_ack[subframe_rx].send_harq_status = 0;
}
// do procedures for SI-RNTI // do procedures for SI-RNTI
if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) {
+2 -2
View File
@@ -34,10 +34,10 @@
#include "PHY/LTE_TRANSPORT/proto.h" #include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/extern.h" #include "PHY/extern.h"
int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt) int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt)
{ {
int8_t Po_PUCCH; int16_t Po_PUCCH;
//uint8_t harq_pid; //uint8_t harq_pid;
// P_pucch = P_opucch+ PL + h(nCQI,nHARQ) + delta_pucchF(pucch_fmt) + g(i)) // P_pucch = P_opucch+ PL + h(nCQI,nHARQ) + delta_pucchF(pucch_fmt) + g(i))
+5 -5
View File
@@ -103,13 +103,13 @@ int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rn
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid) int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid)
{ {
uint32_t Nre = ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial * uint32_t Nre = 2*ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial *
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12; ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12;
if (Nre==0) if (Nre==0)
return(0); return(0);
uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->sumKr/Nre; uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/Nre;
// Note: MPR=is the effective spectral efficiency of the PUSCH // Note: MPR=is the effective spectral efficiency of the PUSCH
// FK 20140908 sumKr is only set after the ulsch_encoding // FK 20140908 sumKr is only set after the ulsch_encoding
@@ -137,7 +137,7 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
proc->subframe_tx); proc->subframe_tx);
uint8_t nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; uint8_t nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb;
int8_t PL; int16_t PL;
// P_pusch = 10*log10(nb_rb + P_opusch(j)+ alpha(u)*PL + delta_TF(i) + f(i)) // P_pusch = 10*log10(nb_rb + P_opusch(j)+ alpha(u)*PL + delta_TF(i) + f(i))
@@ -174,8 +174,8 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
else if (ue->ulsch[eNB_id]->PHR > 40) else if (ue->ulsch[eNB_id]->PHR > 40)
ue->ulsch[eNB_id]->PHR = 40; ue->ulsch[eNB_id]->PHR = 40;
LOG_D(PHY,"[UE %d][PUSCH %d] frame %d, subframe %d: Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n", LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubframe %d.%d: nb_rb: %d, Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n",
ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx, ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx,nb_rb,
ue->ulsch[eNB_id]->Po_PUSCH, ue->ulsch[eNB_id]->Po_PUSCH,
ue->tx_power_max_dBm, ue->tx_power_max_dBm,
ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH, ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
+4
View File
@@ -3199,6 +3199,7 @@ PMI_FEEDBACK:
rx_pdcch(&UE->common_vars, rx_pdcch(&UE->common_vars,
UE->pdcch_vars, UE->pdcch_vars,
&UE->frame_parms, &UE->frame_parms,
0, // frame
subframe, subframe,
0, 0,
(UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, (UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -3405,6 +3406,7 @@ PMI_FEEDBACK:
PDSCH, PDSCH,
eNB_id, eNB_id,
eNB_id_i, eNB_id_i,
0, // frame
subframe, subframe,
m, m,
(m==UE->pdcch_vars[0]->num_pdcch_symbols)?1:0, (m==UE->pdcch_vars[0]->num_pdcch_symbols)?1:0,
@@ -3430,6 +3432,7 @@ PMI_FEEDBACK:
PDSCH, PDSCH,
eNB_id, eNB_id,
eNB_id_i, eNB_id_i,
0, // frame
subframe, subframe,
m, m,
0, 0,
@@ -3455,6 +3458,7 @@ PMI_FEEDBACK:
PDSCH, PDSCH,
eNB_id, eNB_id,
eNB_id_i, eNB_id_i,
0, // frame
subframe, subframe,
m, m,
0, 0,
+1
View File
@@ -492,6 +492,7 @@ int main(int argc, char **argv)
&UE->frame_parms, &UE->frame_parms,
UE->dlsch_MCH[0], UE->dlsch_MCH[0],
UE->dlsch_MCH[0]->harq_processes[0], UE->dlsch_MCH[0]->harq_processes[0],
trials,
subframe, subframe,
0,0,0); 0,0,0);
+1
View File
@@ -1091,6 +1091,7 @@ int main(int argc, char **argv)
rx_pdcch(&UE->common_vars, rx_pdcch(&UE->common_vars,
UE->pdcch_vars, UE->pdcch_vars,
&UE->frame_parms, &UE->frame_parms,
trial,
subframe, subframe,
0, 0,
(UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, (UE->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
+6
View File
@@ -1490,6 +1490,7 @@ int main(int argc, char **argv)
rx_pdcch(&PHY_vars_UE[UE_idx]->lte_ue_common_vars, rx_pdcch(&PHY_vars_UE[UE_idx]->lte_ue_common_vars,
PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars, PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars,
&PHY_vars_UE[UE_idx]->lte_frame_parms, &PHY_vars_UE[UE_idx]->lte_frame_parms,
frame,
subframe, subframe,
0, 0,
(PHY_vars_UE[UE_idx]->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, (PHY_vars_UE[UE_idx]->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
@@ -1534,6 +1535,7 @@ int main(int argc, char **argv)
PDSCH, PDSCH,
0, 0,
1, 1,
frame,
subframe, // subframe, subframe, // subframe,
l, // symbol l, // symbol
(l==PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0, // first_symbol_flag (l==PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0, // first_symbol_flag
@@ -1564,6 +1566,7 @@ int main(int argc, char **argv)
PDSCH, PDSCH,
0, 0,
1, 1,
frame,
subframe, // subframe, subframe, // subframe,
l, // symbol l, // symbol
0, // first_symbol_flag 0, // first_symbol_flag
@@ -1588,6 +1591,7 @@ int main(int argc, char **argv)
PDSCH, PDSCH,
0, 0,
1, 1,
frame,
subframe, // subframe, subframe, // subframe,
l, // symbol l, // symbol
0, // first_symbol_flag 0, // first_symbol_flag
@@ -1618,6 +1622,7 @@ int main(int argc, char **argv)
PDSCH, PDSCH,
0, 0,
1, 1,
frame,
subframe, // subframe, subframe, // subframe,
l, // symbol l, // symbol
0, // first_symbol_flag 0, // first_symbol_flag
@@ -1651,6 +1656,7 @@ int main(int argc, char **argv)
PHY_vars_UE[UE_idx]->lte_ue_pdsch_vars[0]->llr[0], PHY_vars_UE[UE_idx]->lte_ue_pdsch_vars[0]->llr[0],
&PHY_vars_UE[UE_idx]->lte_frame_parms, &PHY_vars_UE[UE_idx]->lte_frame_parms,
PHY_vars_UE[UE_idx]->dlsch_ue[0][0], PHY_vars_UE[UE_idx]->dlsch_ue[0][0],
frame,
subframe, subframe,
0, 0,
PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars[0]->num_pdcch_symbols); PHY_vars_UE[UE_idx]->lte_ue_pdcch_vars[0]->num_pdcch_symbols);
+9
View File
@@ -43,6 +43,13 @@ Description Contains global common definitions
#include <stddef.h> #include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
/* boolean_t is also defined in openair2/COMMON/platform_types.h
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
typedef signed char boolean_t; typedef signed char boolean_t;
#if !defined(TRUE) #if !defined(TRUE)
@@ -55,6 +62,8 @@ typedef signed char boolean_t;
#define BOOL_NOT(b) (b^TRUE) #define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
#define NAS_UE_ID_FMT "0x%06x" #define NAS_UE_ID_FMT "0x%06x"
/****************************************************************************/ /****************************************************************************/
+9
View File
@@ -40,6 +40,13 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// GENERIC TYPES // GENERIC TYPES
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* boolean_t is also defined in openair2/COMMON/commonDef.h,
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
typedef signed char boolean_t; typedef signed char boolean_t;
#if !defined(TRUE) #if !defined(TRUE)
@@ -52,6 +59,8 @@ typedef signed char boolean_t;
#define BOOL_NOT(b) (b^TRUE) #define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// GENERIC ACCESS STRATUM TYPES // GENERIC ACCESS STRATUM TYPES
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+1 -1
View File
@@ -410,7 +410,7 @@ void *eNB_app_task(void *args_p)
break; break;
case TIMER_HAS_EXPIRED: case TIMER_HAS_EXPIRED:
LOG_I(ENB_APP, " Received %s: timer_id %d\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); LOG_I(ENB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id);
if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) {
/* Restart the registration process */ /* Restart the registration process */
+2 -2
View File
@@ -183,14 +183,14 @@ rrc_mac_config_req(
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
if (logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup != NULL) { if (logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup != NULL) {
UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity]=*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup; UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity]=*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
LOG_D(MAC,"[CONFIG][UE %d] LCID %d is attached to the LCGID %d\n",Mod_idP,logicalChannelIdentity,*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup); LOG_D(MAC,"[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",Mod_idP,logicalChannelIdentity,*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup);
} }
else { else {
UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
} }
UE_mac_inst[Mod_idP].scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; UE_mac_inst[Mod_idP].scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
} else { } else {
LOG_E(MAC,"[CONFIG][UE %d] LCID %d NULL ul_SpecificParameters\n",Mod_idP,logicalChannelIdentity); LOG_E(MAC,"[CONFIG][UE %d] LCID %ld NULL ul_SpecificParameters\n",Mod_idP,logicalChannelIdentity);
mac_xface->macphy_exit("NULL ul_SpecificParameters"); mac_xface->macphy_exit("NULL ul_SpecificParameters");
} }
} }
+1 -1
View File
@@ -253,7 +253,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// check threshold // check threshold
if (UE_list->UE_sched_ctrl[i].ul_failure_timer > 200) { if (UE_list->UE_sched_ctrl[i].ul_failure_timer > 200) {
// inform RRC of failure and clear timer // inform RRC of failure and clear timer
LOG_I(MAC,"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",i,rnti,UE_list->UE_sched_ctrl[i].ul_failure_timer); LOG_I(MAC,"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",i,rnti);
mac_eNB_rrc_ul_failure(module_idP,CC_id,frameP,subframeP,rnti); mac_eNB_rrc_ul_failure(module_idP,CC_id,frameP,subframeP,rnti);
UE_list->UE_sched_ctrl[i].ul_failure_timer=0; UE_list->UE_sched_ctrl[i].ul_failure_timer=0;
UE_list->UE_sched_ctrl[i].ul_out_of_sync=1; UE_list->UE_sched_ctrl[i].ul_out_of_sync=1;
+4 -1
View File
@@ -1651,7 +1651,10 @@ fill_DLSCH_dci(
break; break;
case 3: case 3:
LOG_D(MAC,"[eNB %d] CC_id %d Adding Format 2A UE %d spec DCI for %d PRBS (rb alloc: %x) \n", /* TODO: fix log, what is 'rb alloc'? */
/*LOG_D(MAC,"[eNB %d] CC_id %d Adding Format 2A UE %d spec DCI for %d PRBS (rb alloc: %x) \n",
module_idP, CC_id, UE_id, nb_rb);*/
LOG_D(MAC,"[eNB %d] CC_id %d Adding Format 2A UE %d spec DCI for %d PRBS\n",
module_idP, CC_id, UE_id, nb_rb); module_idP, CC_id, UE_id, nb_rb);
if (PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.frame_type == TDD) { if (PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.frame_type == TDD) {
@@ -791,7 +791,8 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
default: default:
min_rb_unit=2; min_rb_unit=2;
LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n", module_id, CC_id); LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n",
module_id, frame_parms->N_RB_DL, CC_id);
break; break;
} }
+4 -4
View File
@@ -333,7 +333,7 @@ void rx_sdu(const module_id_t enb_mod_idP,
if (UE_id < 0) { if (UE_id < 0) {
memcpy(&eNB->common_channels[CC_idP].RA_template[ii].cont_res_id[0],payload_ptr,6); memcpy(&eNB->common_channels[CC_idP].RA_template[ii].cont_res_id[0],payload_ptr,6);
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %d\n", LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n",
enb_mod_idP,CC_idP,frameP,rx_lengths[i],payload_ptr-sduP); enb_mod_idP,CC_idP,frameP,rx_lengths[i],payload_ptr-sduP);
if ((UE_id=add_new_ue(enb_mod_idP,CC_idP,eNB->common_channels[CC_idP].RA_template[ii].rnti,harq_pidP)) == -1 ) { if ((UE_id=add_new_ue(enb_mod_idP,CC_idP,eNB->common_channels[CC_idP].RA_template[ii].rnti,harq_pidP)) == -1 ) {
@@ -343,7 +343,7 @@ void rx_sdu(const module_id_t enb_mod_idP,
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n",
enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id); enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id);
} else { } else {
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %d\n", LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP); enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP);
// kill RA procedure // kill RA procedure
} }
@@ -433,7 +433,7 @@ void rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1) { if (UE_id != -1) {
// adjust buffer occupancy of the correponding logical channel group // adjust buffer occupancy of the correponding logical channel group
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %d, %d\n", LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %ld, %d\n",
enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id,rx_lcids[i], enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id,rx_lcids[i],
UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]], UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]],
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]]); UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]]);
@@ -568,7 +568,7 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
} }
} }
LOG_D(MAC,"[eNB] sdu %d lcid %d tb_length %d length %d (offset now %d)\n", LOG_D(MAC,"[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n",
num_sdus,lcid,tb_length, length,mac_header_ptr-mac_header); num_sdus,lcid,tb_length, length,mac_header_ptr-mac_header);
rx_lcids[num_sdus] = lcid; rx_lcids[num_sdus] = lcid;
rx_lengths[num_sdus] = length; rx_lengths[num_sdus] = length;
+4 -4
View File
@@ -127,11 +127,11 @@ int mac_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, ui
UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST)); UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST));
if (UE_mac_inst == NULL) { if (UE_mac_inst == NULL) {
LOG_C(MAC,"[MAIN] Can't ALLOCATE %d Bytes for %d UE_MAC_INST with size %d \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST)); LOG_C(MAC,"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST));
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n"); mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n");
} }
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst); LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);
bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST)); bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
@@ -148,10 +148,10 @@ int mac_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, ui
eNB_mac_inst = (eNB_MAC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST)); eNB_mac_inst = (eNB_MAC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST));
if (eNB_mac_inst == NULL) { if (eNB_mac_inst == NULL) {
LOG_D(MAC,"[MAIN] can't ALLOCATE %d Bytes for %d eNB_MAC_INST with size %d \n",NB_eNB_INST*sizeof(eNB_MAC_INST*),NB_eNB_INST,sizeof(eNB_MAC_INST)); LOG_D(MAC,"[MAIN] can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",NB_eNB_INST*sizeof(eNB_MAC_INST*),NB_eNB_INST,sizeof(eNB_MAC_INST));
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for eNB \n"); mac_xface->macphy_exit("[MAC][MAIN] not enough memory for eNB \n");
} else { } else {
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d eNB_MAC_INST @ %p\n",sizeof(eNB_MAC_INST),NB_eNB_INST,eNB_mac_inst); LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",sizeof(eNB_MAC_INST),NB_eNB_INST,eNB_mac_inst);
bzero(eNB_mac_inst,NB_eNB_INST*sizeof(eNB_MAC_INST)); bzero(eNB_mac_inst,NB_eNB_INST*sizeof(eNB_MAC_INST));
} }
} else { } else {
+1 -1
View File
@@ -402,7 +402,7 @@ void ue_decode_si(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_in
void ue_decode_p(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_index, void *pdu, uint16_t len); void ue_decode_p(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_index, void *pdu, uint16_t len);
void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index); void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, sub_frame_t subframe, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
#ifdef Rel10 #ifdef Rel10
+15 -15
View File
@@ -189,7 +189,7 @@ unsigned char *parse_header(unsigned char *mac_header,
} }
#ifdef DEBUG_HEADER_PARSING #ifdef DEBUG_HEADER_PARSING
LOG_D(MAC,"[UE] sdu %d lcid %d length %d (offset now %d)\n", LOG_D(MAC,"[UE] sdu %d lcid %d length %d (offset now %ld)\n",
num_sdus,lcid,length,mac_header_ptr-mac_header); num_sdus,lcid,length,mac_header_ptr-mac_header);
#endif #endif
rx_lcids[num_sdus] = lcid; rx_lcids[num_sdus] = lcid;
@@ -229,7 +229,7 @@ unsigned char *parse_header(unsigned char *mac_header,
} }
#ifdef DEBUG_HEADER_PARSING #ifdef DEBUG_HEADER_PARSING
LOG_D(MAC,"[UE] ce %d lcid %d (offset now %d)\n",num_ces,lcid,mac_header_ptr-mac_header); LOG_D(MAC,"[UE] ce %d lcid %d (offset now %ld)\n",num_ces,lcid,mac_header_ptr-mac_header);
#endif #endif
} }
} }
@@ -333,6 +333,7 @@ ue_send_sdu(
module_id_t module_idP, module_id_t module_idP,
uint8_t CC_id, uint8_t CC_id,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP,
uint8_t* sdu, uint8_t* sdu,
uint16_t sdu_len, uint16_t sdu_len,
uint8_t eNB_index uint8_t eNB_index
@@ -365,7 +366,7 @@ ue_send_sdu(
#endif #endif
#if defined(ENABLE_MAC_PAYLOAD_DEBUG) #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC,"[eNB %d] First 32 bytes of DLSCH : \n"); LOG_T(MAC,"[UE %d] First 32 bytes of DLSCH : \n", module_idP);
for (i=0; i<32; i++) { for (i=0; i<32; i++) {
LOG_T(MAC,"%x.",sdu[i]); LOG_T(MAC,"%x.",sdu[i]);
@@ -385,7 +386,7 @@ ue_send_sdu(
module_idP,frameP,payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4],payload_ptr[5]); module_idP,frameP,payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4],payload_ptr[5]);
if (UE_mac_inst[module_idP].RA_active == 1) { if (UE_mac_inst[module_idP].RA_active == 1) {
LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n"); LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n", module_idP, frameP);
UE_mac_inst[module_idP].RA_active=0; UE_mac_inst[module_idP].RA_active=0;
// check if RA procedure has finished completely (no contention) // check if RA procedure has finished completely (no contention)
tx_sdu = &UE_mac_inst[module_idP].CCCH_pdu.payload[3]; tx_sdu = &UE_mac_inst[module_idP].CCCH_pdu.payload[3];
@@ -401,7 +402,7 @@ ue_send_sdu(
return; return;
} }
LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing contention resolution timer\n"); LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing contention resolution timer\n", module_idP, frameP);
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
mac_xface->ra_succeeded(module_idP,CC_id,eNB_index); mac_xface->ra_succeeded(module_idP,CC_id,eNB_index);
} }
@@ -451,7 +452,7 @@ ue_send_sdu(
#endif #endif
mac_rrc_data_ind(module_idP, mac_rrc_data_ind(module_idP,
CC_id, CC_id,
frameP,0, // unknown subframe frameP,subframeP,
UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].crnti,
CCCH, CCCH,
(uint8_t*)payload_ptr, (uint8_t*)payload_ptr,
@@ -741,7 +742,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
mcch_period = 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9); mcch_period = 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
LOG_D(MAC, LOG_D(MAC,
"[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d,mac sched period (%d,%d))\n", "[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d,mac sched period (%d,%ld))\n",
module_idP,frameP, subframe,i,UE_mac_inst[module_idP].num_active_mbsfn_area, module_idP,frameP, subframe,i,UE_mac_inst[module_idP].num_active_mbsfn_area,
j,UE_mac_inst[module_idP].num_sf_allocation_pattern,mbsfn_period,mcch_period, j,UE_mac_inst[module_idP].num_sf_allocation_pattern,mbsfn_period,mcch_period,
mch_scheduling_period,UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset); mch_scheduling_period,UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset);
@@ -1053,7 +1054,7 @@ unsigned char generate_ulsch_header(uint8_t *mac_header,
last_size=1; last_size=1;
*((POWER_HEADROOM_CMD *)ce_ptr)=(*power_headroom); *((POWER_HEADROOM_CMD *)ce_ptr)=(*power_headroom);
ce_ptr+=sizeof(POWER_HEADROOM_CMD); ce_ptr+=sizeof(POWER_HEADROOM_CMD);
LOG_D(MAC, "phr header size %d\n",sizeof(POWER_HEADROOM_CMD)); LOG_D(MAC, "phr header size %zu\n",sizeof(POWER_HEADROOM_CMD));
} }
if (crnti) { if (crnti) {
@@ -1249,7 +1250,7 @@ unsigned char generate_ulsch_header(uint8_t *mac_header,
} }
#ifdef DEBUG_HEADER_PARSING #ifdef DEBUG_HEADER_PARSING
LOG_T(MAC," [UE %d] header : ", crnti); LOG_T(MAC," [UE] header : ");
for (i=0; i<((unsigned char*)mac_header_ptr - mac_header); i++) { for (i=0; i<((unsigned char*)mac_header_ptr - mac_header); i++) {
LOG_T(MAC,"%2x.",mac_header[i]); LOG_T(MAC,"%2x.",mac_header[i]);
@@ -1886,8 +1887,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
ulsch_buffer[payload_offset+sdu_length_total+j] = (char)(taus()&0xff); ulsch_buffer[payload_offset+sdu_length_total+j] = (char)(taus()&0xff);
} }
} }
LOG_D(MAC,"[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", LOG_D(MAC,"[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", module_idP);
module_idP,payload_offset, sdu_length_total);
UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
@@ -1900,7 +1900,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
// Reset ReTx BSR Timer // Reset ReTx BSR Timer
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer);
LOG_D(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", LOG_D(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", module_idP,
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF);
// Reset Periodic Timer except when BSR is truncated // Reset Periodic Timer except when BSR is truncated
@@ -1909,7 +1909,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer);
LOG_D(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n", LOG_D(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n",
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF); module_idP, UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF);
} }
@@ -1922,7 +1922,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
if (opt_enabled) { if (opt_enabled) {
trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0); trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0);
LOG_D(OPT,"[UE %d][ULSCH] Frame %d trace pdu for rnti %x with size %d\n", LOG_D(OPT,"[UE %d][ULSCH] Frame %d subframe %d trace pdu for rnti %x with size %d\n",
module_idP, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, UE_mac_inst[module_idP].crnti, buflen); module_idP, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, UE_mac_inst[module_idP].crnti, buflen);
} }
} }
@@ -2064,7 +2064,7 @@ ue_scheduler(
//return(RRC_OK); //return(RRC_OK);
} }
LOG_I(MAC,"Frame %d: Contention resolution timer %d/%d\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt, LOG_I(MAC,"Frame %d: Contention resolution timer %d/%ld\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt,
((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)); ((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3));
UE_mac_inst[module_idP].RA_contention_resolution_cnt++; UE_mac_inst[module_idP].RA_contention_resolution_cnt++;
+26 -18
View File
@@ -28,6 +28,8 @@
*/ */
#define PDCP_C #define PDCP_C
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
#ifndef USER_MODE #ifndef USER_MODE
#include <rtai_fifos.h> #include <rtai_fifos.h>
#endif #endif
@@ -160,7 +162,7 @@ boolean_t pdcp_data_req(
if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP); LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP);
pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP); pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP, __func__);
if (pdcp_pdu_p != NULL) { if (pdcp_pdu_p != NULL) {
memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP); memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP);
@@ -201,7 +203,7 @@ boolean_t pdcp_data_req(
/* /*
* Allocate a new block for the new PDU (i.e. PDU header and SDU payload) * Allocate a new block for the new PDU (i.e. PDU header and SDU payload)
*/ */
pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
if (pdcp_pdu_p != NULL) { if (pdcp_pdu_p != NULL) {
/* /*
@@ -255,12 +257,12 @@ boolean_t pdcp_data_req(
* Validate incoming sequence number, there might be a problem with PDCP initialization * Validate incoming sequence number, there might be a problem with PDCP initialization
*/ */
if (current_sn > pdcp_calculate_max_seq_num_for_given_size(pdcp_p->seq_num_size)) { if (current_sn > pdcp_calculate_max_seq_num_for_given_size(pdcp_p->seq_num_size)) {
LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Generated sequence number (%lu) is greater than a sequence number could ever be!\n"\ LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Generated sequence number (%"PRIu16") is greater than a sequence number could ever be!\n"\
"There must be a problem with PDCP initialization, ignoring this PDU...\n", "There must be a problem with PDCP initialization, ignoring this PDU...\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p),
current_sn); current_sn);
free_mem_block(pdcp_pdu_p); free_mem_block(pdcp_pdu_p, __func__);
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -510,7 +512,7 @@ pdcp_data_ind(
PROTOCOL_CTXT_FMT"Could not get PDCP instance key 0x%"PRIx64"\n", PROTOCOL_CTXT_FMT"Could not get PDCP instance key 0x%"PRIx64"\n",
PROTOCOL_CTXT_ARGS(ctxt_pP), PROTOCOL_CTXT_ARGS(ctxt_pP),
key); key);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
return FALSE; return FALSE;
} }
@@ -567,7 +569,7 @@ pdcp_data_ind(
PROTOCOL_PDCP_CTXT_FMT"Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n", PROTOCOL_PDCP_CTXT_FMT"Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
sdu_buffer_sizeP); sdu_buffer_sizeP);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
@@ -598,7 +600,7 @@ pdcp_data_ind(
*/ */
#if 0 #if 0
LOG_D(PDCP, "Ignoring PDU...\n"); LOG_D(PDCP, "Ignoring PDU...\n");
free_mem_block(sdu_buffer); free_mem_block(sdu_buffer, __func__);
return FALSE; return FALSE;
#else #else
//LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n"); //LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n");
@@ -645,9 +647,9 @@ pdcp_data_ind(
rb_id, rb_id,
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len, sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]); (uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
// free_mem_block(new_sdu); // free_mem_block(new_sdu, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
} else { } else {
@@ -722,7 +724,7 @@ pdcp_data_ind(
ctime, ctime,
(const char*)(&sdu_buffer_pP->data[payload_offset]), (const char*)(&sdu_buffer_pP->data[payload_offset]),
sdu_buffer_sizeP - payload_offset ) == 0 ) { sdu_buffer_sizeP - payload_offset ) == 0 ) {
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
@@ -739,7 +741,7 @@ pdcp_data_ind(
if (otg_enabled==1) { if (otg_enabled==1) {
LOG_D(OTG,"Discarding received packed\n"); LOG_D(OTG,"Discarding received packed\n");
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
@@ -794,7 +796,7 @@ pdcp_data_ind(
#endif #endif
if (FALSE == packet_forwarded) { if (FALSE == packet_forwarded) {
new_sdu_p = get_free_mem_block(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t)); new_sdu_p = get_free_mem_block(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t), __func__);
if (new_sdu_p) { if (new_sdu_p) {
if (pdcp_p->rlc_mode == RLC_MODE_AM ) { if (pdcp_p->rlc_mode == RLC_MODE_AM ) {
@@ -806,6 +808,7 @@ pdcp_data_ind(
*/ */
memset(new_sdu_p->data, 0, sizeof (pdcp_data_ind_header_t)); memset(new_sdu_p->data, 0, sizeof (pdcp_data_ind_header_t));
((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size = sdu_buffer_sizeP - payload_offset; ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size = sdu_buffer_sizeP - payload_offset;
AssertFatal((sdu_buffer_sizeP - payload_offset >= 0), "invalid PDCP SDU size!");
// Here there is no virtualization possible // Here there is no virtualization possible
// set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
@@ -820,6 +823,11 @@ pdcp_data_ind(
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id - oai_emulation.info.first_enb_local; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id - oai_emulation.info.first_enb_local;
#endif #endif
} }
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
static uint32_t pdcp_inst = 0;
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = pdcp_inst++;
LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size);
#endif
memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \ memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \
&sdu_buffer_pP->data[payload_offset], \ &sdu_buffer_pP->data[payload_offset], \
@@ -828,7 +836,7 @@ pdcp_data_ind(
/* Print octets of incoming data in hexadecimal form */ /* Print octets of incoming data in hexadecimal form */
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n", LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
sdu_buffer_sizeP - payload_offset + sizeof(pdcp_data_ind_header_t), sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
sdu_buffer_sizeP - payload_offset); sdu_buffer_sizeP - payload_offset);
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); //util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); //util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
@@ -856,7 +864,7 @@ pdcp_data_ind(
#endif #endif
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
@@ -1206,7 +1214,7 @@ rrc_pdcp_config_asn1_req (
} }
if (lc_id == 1 || lc_id == 2) { if (lc_id == 1 || lc_id == 2) {
LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %d is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id); LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %ld is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id);
continue; continue;
} }
@@ -1304,7 +1312,7 @@ rrc_pdcp_config_asn1_req (
break; break;
default: default:
LOG_W(PDCP,"[MOD_id %u/%u][RB %u] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n", LOG_W(PDCP,PROTOCOL_PDCP_CTXT_FMT"[RB %ld] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), drb_id); PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), drb_id);
break; break;
} }
@@ -1337,7 +1345,7 @@ rrc_pdcp_config_asn1_req (
h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
if (h_rc != HASH_TABLE_OK) { if (h_rc != HASH_TABLE_OK) {
LOG_E(PDCP, PROTOCOL_CTXT_FMT" PDCP REMOVE FAILED drb_id %u\n", LOG_E(PDCP, PROTOCOL_CTXT_FMT" PDCP REMOVE FAILED drb_id %ld\n",
PROTOCOL_CTXT_ARGS(ctxt_pP), PROTOCOL_CTXT_ARGS(ctxt_pP),
drb_id); drb_id);
continue; continue;
@@ -1741,7 +1749,7 @@ rrc_pdcp_config_req (
pdcp_p->cipheringAlgorithm, pdcp_p->cipheringAlgorithm,
pdcp_p->integrityProtAlgorithm ); pdcp_p->integrityProtAlgorithm );
} else { } else {
LOG_W(PDCP,"[%s %d] bad security mode %d", security_modeP); LOG_W(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), security_modeP);
} }
break; break;
@@ -44,7 +44,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block *mb; mem_block *mb;
mb = get_free_mem_block (sizeof (struct cpdcp_primitive)); mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__);
((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ; ((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP;
+91 -10
View File
@@ -31,6 +31,7 @@
#define PDCP_FIFO_C #define PDCP_FIFO_C
#define PDCP_DEBUG 1 #define PDCP_DEBUG 1
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
#ifndef OAI_EMU #ifndef OAI_EMU
extern int otg_enabled; extern int otg_enabled;
@@ -40,6 +41,7 @@ extern int otg_enabled;
#include "pdcp_primitives.h" #include "pdcp_primitives.h"
#ifdef USER_MODE #ifdef USER_MODE
#include <pthread.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -59,6 +61,7 @@ extern int otg_enabled;
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_tx.h"
#include "UTIL/FIFO/pad_list.h" #include "UTIL/FIFO/pad_list.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "platform_constants.h" #include "platform_constants.h"
#include "msc.h" #include "msc.h"
@@ -88,6 +91,21 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
# include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_task.h"
#endif #endif
/* Prevent de-queueing the same PDCP SDU from the queue twice
* by multiple threads. This has happened in TDD when thread-odd
* is flushing a PDCP SDU after UE_RX() processing; whereas
* thread-even is at a special-subframe, skips the UE_RX() process
* and goes straight to the PDCP SDU flushing. The 2nd flushing
* dequeues the same SDU again causing unexpected behavior.
*
* comment out the MACRO below to disable this protection
*/
#define PDCP_SDU_FLUSH_LOCK
#ifdef PDCP_SDU_FLUSH_LOCK
static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER;
#endif
pdcp_data_req_header_t pdcp_read_header_g; pdcp_data_req_header_t pdcp_read_header_g;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -95,6 +113,42 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//#if defined(PDCP_USE_NETLINK) && defined(LINUX)
int ret = 0;
//#endif
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
#define THREAD_NAME_LEN 16
static char threadname[THREAD_NAME_LEN];
ret = pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN);
if (ret != 0)
{
perror("pthread_getname_np : ");
exit_fun("Error getting thread name");
}
#undef THREAD_NAME_LEN
#endif
#ifdef PDCP_SDU_FLUSH_LOCK
ret = pthread_mutex_trylock(&mtex);
if (ret == EBUSY) {
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_W(PDCP, "[%s] at SFN/SF=%d/%d wait for PDCP FIFO to be unlocked\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe);
#endif
if (pthread_mutex_lock(&mtex)) {
exit_fun("PDCP_SDU_FLUSH_LOCK lock error!");
}
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_I(PDCP, "[%s] at SFN/SF=%d/%d PDCP FIFO is unlocked\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe);
#endif
} else if (ret != 0) {
exit_fun("PDCP_SDU_FLUSH_LOCK trylock error!");
}
#endif
mem_block_t *sdu_p = list_get_head (&pdcp_sdu_list); mem_block_t *sdu_p = list_get_head (&pdcp_sdu_list);
int bytes_wrote = 0; int bytes_wrote = 0;
int pdcp_nb_sdu_sent = 0; int pdcp_nb_sdu_sent = 0;
@@ -103,15 +157,19 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
//MessageDef *message_p = NULL; //MessageDef *message_p = NULL;
#endif #endif
#if defined(PDCP_USE_NETLINK) && defined(LINUX) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH, 1 );
int ret = 0;
#endif
while (sdu_p && cont) { while (sdu_p && cont) {
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_D(PDCP, "[%s] SFN/SF=%d/%d inst=%d size=%d\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe,
((pdcp_data_ind_header_t*) sdu_p->data)->inst,
((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
#else
#if ! defined(OAI_EMU) #if ! defined(OAI_EMU)
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
#endif #endif
#endif
#if defined(LINK_ENB_PDCP_TO_GTPV1U) #if defined(LINK_ENB_PDCP_TO_GTPV1U)
@@ -126,7 +184,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t *)(sdu_p->data))->data_size); ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size);
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
@@ -175,6 +233,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
if (!pdcp_output_header_bytes_to_write) { // continue with sdu if (!pdcp_output_header_bytes_to_write) { // continue with sdu
pdcp_output_sdu_bytes_to_write = ((pdcp_data_ind_header_t *) sdu_p->data)->data_size; pdcp_output_sdu_bytes_to_write = ((pdcp_data_ind_header_t *) sdu_p->data)->data_size;
AssertFatal(pdcp_output_sdu_bytes_to_write >= 0, "invalid data_size!");
#ifdef PDCP_USE_RT_FIFO #ifdef PDCP_USE_RT_FIFO
bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
@@ -184,7 +243,11 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
#ifdef LINUX #ifdef LINUX
memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write; nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE, pdcp_output_sdu_bytes_to_write);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 1 );
ret = sendmsg(nas_sock_fd,&nas_msg_tx,0); ret = sendmsg(nas_sock_fd,&nas_msg_tx,0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 0 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR, ret );
if (ret<0) { if (ret<0) {
LOG_E(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); LOG_E(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno);
@@ -238,17 +301,22 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id); ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id);
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
} else {
LOG_D(PDCP, "1 skip free_mem_block: pdcp_output_sdu_bytes_to_write = %d\n", pdcp_output_sdu_bytes_to_write);
AssertFatal(pdcp_output_sdu_bytes_to_write > 0, "pdcp_output_sdu_bytes_to_write cannot be negative!");
} }
} else { } else {
LOG_W(PDCP, "RADIO->IP SEND SDU CONGESTION!\n"); LOG_W(PDCP, "2: RADIO->IP SEND SDU CONGESTION!\n");
} }
} else { } else {
LOG_W(PDCP, "RADIO->IP SEND SDU CONGESTION!\n"); LOG_W(PDCP, "3: RADIO->IP SEND SDU CONGESTION!\n");
} }
} else {
LOG_D(PDCP, "4 skip free_mem_block: bytes_wrote = %d\n", bytes_wrote);
} }
} else { } else {
// continue writing sdu // continue writing sdu
@@ -266,15 +334,20 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
if (!pdcp_output_sdu_bytes_to_write) { // OK finish with this SDU if (!pdcp_output_sdu_bytes_to_write) { // OK finish with this SDU
//PRINT_RB_SEND_OUTPUT_SDU ("[PDCP] RADIO->IP SEND SDU\n"); //PRINT_RB_SEND_OUTPUT_SDU ("[PDCP] RADIO->IP SEND SDU\n");
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
// LOG_D(PDCP, "rb sent a sdu from rab\n"); // LOG_D(PDCP, "rb sent a sdu from rab\n");
} else {
LOG_D(PDCP, "5 skip free_mem_block: pdcp_output_sdu_bytes_to_write = %d\n", pdcp_output_sdu_bytes_to_write);
} }
} else {
LOG_D(PDCP, "6 skip free_mem_block: bytes_wrote = %d\n", bytes_wrote);
} }
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH, 0 );
#ifdef PDCP_USE_RT_FIFO #ifdef PDCP_USE_RT_FIFO
@@ -295,6 +368,10 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
#endif //PDCP_USE_RT_FIFO #endif //PDCP_USE_RT_FIFO
#ifdef PDCP_SDU_FLUSH_LOCK
if (pthread_mutex_unlock(&mtex)) exit_fun("PDCP_SDU_FLUSH_LOCK unlock error!");
#endif
return pdcp_nb_sdu_sent; return pdcp_nb_sdu_sent;
} }
@@ -429,7 +506,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
int rlc_data_req_flag = 3; int rlc_data_req_flag = 3;
while ((len > 0) && (rlc_data_req_flag !=0)) { while ((len > 0) && (rlc_data_req_flag !=0)) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len<=0) { if (len<=0) {
// nothing in pdcp NAS socket // nothing in pdcp NAS socket
@@ -497,7 +577,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
ctxt.enb_flag = ctxt_cpy.enb_flag; ctxt.enb_flag = ctxt_cpy.enb_flag;
#ifdef PDCP_DEBUG #ifdef PDCP_DEBUG
LOG_I(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id);
#endif #endif
if (ctxt_cpy.enb_flag) { if (ctxt_cpy.enb_flag) {
@@ -707,6 +787,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
} }
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
} }
return len; return len;
+1 -1
View File
@@ -62,7 +62,7 @@ void util_print_hex_octets(comp_name_t component, unsigned char* data, unsigned
*/ */
if (octet_index != 0 && (octet_index + 1) % 16 == 0) { if (octet_index != 0 && (octet_index + 1) % 16 == 0) {
LOG_T(component, " |\n"); LOG_T(component, " |\n");
LOG_T(component, " %03d |", octet_index); LOG_T(component, " %03lu |", octet_index);
} }
} }
+4 -4
View File
@@ -223,7 +223,7 @@ void config_req_rlc_am_asn1 (
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p)); PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p));
LOG_D(RLC, LOG_D(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d), RLC-AM NOT CONFIGURED\n", PROTOCOL_RLC_AM_CTXT_FMT"ILLEGAL CONFIG_REQ (max_retx_threshold=%ld poll_pdu=%ld poll_byte=%ld t_poll_retransmit=%ld t_reord=%ld t_status_prohibit=%ld), RLC-AM NOT CONFIGURED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
config_am_pP->ul_AM_RLC.maxRetxThreshold, config_am_pP->ul_AM_RLC.maxRetxThreshold,
config_am_pP->ul_AM_RLC.pollPDU, config_am_pP->ul_AM_RLC.pollPDU,
@@ -523,7 +523,7 @@ rlc_am_rx (
switch (rlc->protocol_state) { switch (rlc->protocol_state) {
case RLC_NULL_STATE: case RLC_NULL_STATE:
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", arg_pP); LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc));
list_free (&data_indP.data); list_free (&data_indP.data);
break; break;
@@ -532,7 +532,7 @@ rlc_am_rx (
break; break;
default: default:
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", rlc, rlc->protocol_state); LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state);
} }
} }
@@ -1280,7 +1280,7 @@ rlc_am_data_req (
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented); l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented);
l_rlc_p->stat_tx_pdcp_sdu_discarded += 1; l_rlc_p->stat_tx_pdcp_sdu_discarded += 1;
l_rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size; l_rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
free_mem_block (sdu_pP); free_mem_block (sdu_pP, __func__);
#if STOP_ON_IP_TRAFFIC_OVERLOAD #if STOP_ON_IP_TRAFFIC_OVERLOAD
AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n", AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
@@ -42,7 +42,7 @@ void rlc_am_free_in_sdu(
{ {
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) { if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block); free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
rlcP->input_sdus[index_in_bufferP].mem_block = NULL; rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
rlcP->nb_sdu_no_segmented -= 1; rlcP->nb_sdu_no_segmented -= 1;
rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0; rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
@@ -81,7 +81,7 @@ rlc_am_free_in_sdu_data(
{ {
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) { if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block); free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
rlcP->input_sdus[index_in_bufferP].mem_block = NULL; rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0; rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
rlcP->nb_sdu_no_segmented -= 1; rlcP->nb_sdu_no_segmented -= 1;
+5 -5
View File
@@ -54,11 +54,11 @@ rlc_am_init(
// rlc_pP->pdu_retrans_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t))); // rlc_pP->pdu_retrans_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
rlc_pP->pdu_retrans_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof( rlc_pP->pdu_retrans_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(
rlc_am_tx_data_pdu_management_t))); rlc_am_tx_data_pdu_management_t)));
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] input_sdus[] = %p element size=%d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] input_sdus[] = %p element size=%zu\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->input_sdus, rlc_pP->input_sdus,
sizeof(rlc_am_tx_sdu_management_t)); sizeof(rlc_am_tx_sdu_management_t));
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] pdu_retrans_buffer[] = %p element size=%d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] pdu_retrans_buffer[] = %p element size=%zu\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->pdu_retrans_buffer, rlc_pP->pdu_retrans_buffer,
sizeof(rlc_am_tx_data_pdu_management_t)); sizeof(rlc_am_tx_data_pdu_management_t));
@@ -152,7 +152,7 @@ rlc_am_cleanup(
if (rlc_pP->output_sdu_in_construction != NULL) { if (rlc_pP->output_sdu_in_construction != NULL) {
free_mem_block(rlc_pP->output_sdu_in_construction); free_mem_block(rlc_pP->output_sdu_in_construction, __func__);
rlc_pP->output_sdu_in_construction = NULL; rlc_pP->output_sdu_in_construction = NULL;
} }
@@ -161,7 +161,7 @@ rlc_am_cleanup(
if (rlc_pP->input_sdus != NULL) { if (rlc_pP->input_sdus != NULL) {
for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) { for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) {
if (rlc_pP->input_sdus[i].mem_block != NULL) { if (rlc_pP->input_sdus[i].mem_block != NULL) {
free_mem_block(rlc_pP->input_sdus[i].mem_block); free_mem_block(rlc_pP->input_sdus[i].mem_block, __func__);
rlc_pP->input_sdus[i].mem_block = NULL; rlc_pP->input_sdus[i].mem_block = NULL;
} }
} }
@@ -175,7 +175,7 @@ rlc_am_cleanup(
if (rlc_pP->pdu_retrans_buffer != NULL) { if (rlc_pP->pdu_retrans_buffer != NULL) {
for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) { for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) { if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) {
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block); free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block, __func__);
rlc_pP->pdu_retrans_buffer[i].mem_block = NULL; rlc_pP->pdu_retrans_buffer[i].mem_block = NULL;
} }
} }
@@ -55,7 +55,7 @@ rlc_am_reassembly (
lengthP); lengthP);
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE); rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
assert(rlc_pP->output_sdu_in_construction != NULL); assert(rlc_pP->output_sdu_in_construction != NULL);
} }
@@ -197,7 +197,7 @@ rlc_am_send_sdu (
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n", LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id); //msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
//free_mem_block (rlc_pP->output_sdu_in_construction); //free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
AssertFatal(3==4, AssertFatal(3==4,
PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes", PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -397,5 +397,5 @@ rlc_am_reassemble_pdu(
} }
} }
free_mem_block(tb_pP); free_mem_block(tb_pP, __func__);
} }
@@ -346,7 +346,7 @@ rlc_am_receive_process_data_pdu (
if (rlc_am_rx_list_insert_pdu(ctxt_pP, rlc_pP,tb_pP) < 0) { if (rlc_am_rx_list_insert_pdu(ctxt_pP, rlc_pP,tb_pP) < 0) {
rlc_pP->stat_rx_data_pdu_dropped += 1; rlc_pP->stat_rx_data_pdu_dropped += 1;
rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP; rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP;
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
rlc_pP->status_requested = 1; rlc_pP->status_requested = 1;
@@ -437,12 +437,12 @@ rlc_am_receive_process_data_pdu (
} else { } else {
rlc_pP->stat_rx_data_pdu_out_of_window += 1; rlc_pP->stat_rx_data_pdu_out_of_window += 1;
rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP; rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP;
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
rlc_pP->status_requested = 1; rlc_pP->status_requested = 1;
} }
} else { } else {
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
} }
} }
@@ -143,7 +143,7 @@ void rlc_am_ack_pdu (
if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) { if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) {
//if (mb_pP != NULL) { //if (mb_pP != NULL) {
free_mem_block(mb_p); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -235,7 +235,7 @@ void rlc_am_ack_pdu (
snP); snP);
if (mb_p != NULL) { if (mb_p != NULL) {
free_mem_block(mb_p); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
} }
@@ -275,7 +275,7 @@ mem_block_t* rlc_am_retransmit_get_copy (
rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->pdu_retrans_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE]; rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->pdu_retrans_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req); int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size); mem_block_t* mb_copy = get_free_mem_block(size, __func__);
memcpy(mb_copy->data, mb_original_p->data, size); memcpy(mb_copy->data, mb_original_p->data, size);
rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
@@ -343,7 +343,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block;
if (mb_original_p != NULL) { if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req)); mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_info_t pdu_info; rlc_am_pdu_info_t pdu_info;
@@ -646,7 +646,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// fill the segment pdu_p with Lis and data // fill the segment pdu_p with Lis and data
//--------------------------------------------------------------- //---------------------------------------------------------------
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n",
test_num_li); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), test_num_li);
if (test_num_li > 0) { if (test_num_li > 0) {
pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | 0x04; // set E bit pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | 0x04; // set E bit
@@ -678,12 +678,12 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
*sizeP = *sizeP - 1; *sizeP = *sizeP - 1;
} }
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RB %u][RE-SEGMENT] ADD LI %d\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD LI %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_li_list[fill_num_li]); test_li_list[fill_num_li]);
} }
} else { } else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RB %u][RE-SEGMENT] ADD NO LI\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD NO LI\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
fill_payload_p = (uint8_t*)e_li_sub_segment; fill_payload_p = (uint8_t*)e_li_sub_segment;
} }
@@ -62,7 +62,6 @@ rlc_am_rx_list_insert_pdu(
if (pdu_info_previous_cursor_p->sn == pdu_info_p->sn) { if (pdu_info_previous_cursor_p->sn == pdu_info_p->sn) {
if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) { if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n", LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
ctxt_pP->frame,
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__, __LINE__,
pdu_info_p->sn); pdu_info_p->sn);
@@ -197,7 +197,7 @@ void rlc_am_segment_10 (
data_pdu_size); data_pdu_size);
} }
if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
LOG_C(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_C(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus); RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
@@ -366,7 +366,7 @@ void rlc_am_segment_10 (
// free SDU // free SDU
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
//rlc_pP->nb_sdu -= 1; //rlc_pP->nb_sdu -= 1;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
@@ -445,7 +445,7 @@ void rlc_am_segment_10 (
sdu_mngt_p->sdu_remaining_size = 0; sdu_mngt_p->sdu_remaining_size = 0;
rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
//rlc_pP->nb_sdu -= 1; //rlc_pP->nb_sdu -= 1;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
@@ -370,7 +370,7 @@ rlc_am_receive_process_control_pdu(
*first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP); *first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
free_mem_block(tb_pP); free_mem_block(tb_pP, __func__);
rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL); rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -730,7 +730,7 @@ end_push_nack:
__LINE__, __LINE__,
pdu_size); pdu_size);
#endif #endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size); tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size); memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size; //estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]); ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
+5 -5
View File
@@ -516,7 +516,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
mem_block_t *sdu; mem_block_t *sdu;
sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_am_data_req_alloc)); sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_am_data_req_alloc), __func__);
if (sdu != NULL) { if (sdu != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
@@ -561,7 +561,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
*tx_packetsP = *tx_packetsP + 1; *tx_packetsP = *tx_packetsP + 1;
if (*drop_countP == 0) { if (*drop_countP == 0) {
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size); tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
if (tb_dst != NULL) { if (tb_dst != NULL) {
((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0; ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0;
@@ -585,7 +585,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
*dropped_tx_packetsP = *dropped_tx_packetsP + 1; *dropped_tx_packetsP = *dropped_tx_packetsP + 1;
} }
free_mem_block(tb_src); free_mem_block(tb_src, __func__);
if (data_indP->no_tb > 0) { if (data_indP->no_tb > 0) {
printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb); printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb);
@@ -673,13 +673,13 @@ void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si
assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i); assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i);
g_send_id_read_index[rb_idP] += 1; g_send_id_read_index[rb_idP] += 1;
free_mem_block(sduP); free_mem_block(sduP, __func__);
return; return;
} }
} }
printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP); printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP);
free_mem_block(sduP); free_mem_block(sduP, __func__);
assert(1==2); assert(1==2);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+5 -5
View File
@@ -51,7 +51,7 @@ rlc_tm_send_sdu (
length_in_bytes = (length_in_bitsP + 7) >> 3; length_in_bytes = (length_in_bitsP + 7) >> 3;
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes); rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes, __func__);
} }
if ((rlc_pP->output_sdu_in_construction)) { if ((rlc_pP->output_sdu_in_construction)) {
@@ -97,7 +97,7 @@ rlc_tm_no_segment (
sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data)); sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data));
if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE))) { if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE, __func__))) {
LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP)); PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP));
return; return;
@@ -116,7 +116,7 @@ rlc_tm_no_segment (
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer); list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3); rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3);
free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer;
rlc_pP->nb_sdu -= 1; rlc_pP->nb_sdu -= 1;
@@ -142,7 +142,7 @@ rlc_tm_rx (
((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p; ((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p;
rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size); rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size);
free_mem_block (tb_p); free_mem_block (tb_p, __func__);
} }
} }
@@ -235,6 +235,6 @@ rlc_tm_data_req (
rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP; rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer; rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
} else { } else {
free_mem_block (sdu_pP); free_mem_block (sdu_pP, __func__);
} }
} }
+4 -4
View File
@@ -82,7 +82,7 @@ void rlc_tm_init (
rlcP->size_input_sdus_buffer = 16; rlcP->size_input_sdus_buffer = 16;
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) { if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *)); rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data); rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *)); memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
} }
@@ -114,17 +114,17 @@ rlc_tm_cleanup (
if (rlcP->input_sdus_alloc) { if (rlcP->input_sdus_alloc) {
for (index = 0; index < rlcP->size_input_sdus_buffer; index++) { for (index = 0; index < rlcP->size_input_sdus_buffer; index++) {
if (rlcP->input_sdus[index]) { if (rlcP->input_sdus[index]) {
free_mem_block (rlcP->input_sdus[index]); free_mem_block (rlcP->input_sdus[index], __func__);
} }
} }
free_mem_block (rlcP->input_sdus_alloc); free_mem_block (rlcP->input_sdus_alloc, __func__);
rlcP->input_sdus_alloc = NULL; rlcP->input_sdus_alloc = NULL;
} }
// RX SIDE // RX SIDE
if ((rlcP->output_sdu_in_construction)) { if ((rlcP->output_sdu_in_construction)) {
free_mem_block (rlcP->output_sdu_in_construction); free_mem_block (rlcP->output_sdu_in_construction, __func__);
} }
memset(rlcP, 0, sizeof(rlc_tm_entity_t)); memset(rlcP, 0, sizeof(rlc_tm_entity_t));
@@ -150,7 +150,7 @@ void config_req_rlc_um_asn1 (
break; break;
default: default:
LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID UL sn_FieldLength %d, RLC NOT CONFIGURED\n", LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID UL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
rlc_p->rb_id, rlc_p->rb_id,
ul_rlc_pP->sn_FieldLength); ul_rlc_pP->sn_FieldLength);
@@ -178,7 +178,7 @@ void config_req_rlc_um_asn1 (
break; break;
default: default:
LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID DL sn_FieldLength %d, RLC NOT CONFIGURED\n", LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID DL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
rlc_p->rb_id, rlc_p->rb_id,
dl_rlc_pP->sn_FieldLength); dl_rlc_pP->sn_FieldLength);
@@ -197,7 +197,7 @@ void config_req_rlc_um_asn1 (
if (dl_rlc_pP->t_Reordering<T_Reordering_spare1) { if (dl_rlc_pP->t_Reordering<T_Reordering_spare1) {
t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering]; t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering];
} else { } else {
LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID T_Reordering %d, RLC NOT CONFIGURED\n", LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID T_Reordering %ld, RLC NOT CONFIGURED\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
rlc_p->rb_id, rlc_p->rb_id,
dl_rlc_pP->t_Reordering); dl_rlc_pP->t_Reordering);
@@ -334,13 +334,13 @@ rlc_um_cleanup (
list_free (&rlc_pP->pdus_from_mac_layer); list_free (&rlc_pP->pdus_from_mac_layer);
if ((rlc_pP->output_sdu_in_construction)) { if ((rlc_pP->output_sdu_in_construction)) {
free_mem_block (rlc_pP->output_sdu_in_construction); free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
} }
if (rlc_pP->dar_buffer) { if (rlc_pP->dar_buffer) {
for (index = 0; index < 1024; index++) { for (index = 0; index < 1024; index++) {
if (rlc_pP->dar_buffer[index]) { if (rlc_pP->dar_buffer[index]) {
free_mem_block (rlc_pP->dar_buffer[index]); free_mem_block (rlc_pP->dar_buffer[index], __func__);
} }
} }
+55 -9
View File
@@ -130,6 +130,7 @@ int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_liP,
unsigned int e2 = 0; unsigned int e2 = 0;
unsigned int li2 = 0; unsigned int li2 = 0;
*num_li_pP = 0; *num_li_pP = 0;
int pdu_size = *data_size_pP;
while ((continue_loop)) { while ((continue_loop)) {
//msg("[RLC_UM] e_liP->b1 = %02X\n", e_liP->b1); //msg("[RLC_UM] e_liP->b1 = %02X\n", e_liP->b1);
@@ -147,13 +148,39 @@ int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_liP,
*data_size_pP = *data_size_pP - li2 - 1; *data_size_pP = *data_size_pP - li2 - 1;
*num_li_pP = *num_li_pP +1; *num_li_pP = *num_li_pP +1;
if (!(*data_size_pP >= 0)) LOG_E(RLC, "Invalid data_size=%d! (pdu_size=%d loop=%d e1=%d e2=%d li2=%d e_liP=%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x)\n",
*data_size_pP, pdu_size, continue_loop, e1, e2, li2,
(e_liP-(continue_loop-1)+0)->b1,
(e_liP-(continue_loop-1)+0)->b2,
(e_liP-(continue_loop-1)+0)->b3,
(e_liP-(continue_loop-1)+1)->b1,
(e_liP-(continue_loop-1)+1)->b2,
(e_liP-(continue_loop-1)+1)->b3,
(e_liP-(continue_loop-1)+2)->b1,
(e_liP-(continue_loop-1)+2)->b2,
(e_liP-(continue_loop-1)+2)->b3);
// AssertFatal(*data_size_pP >= 0, "Invalid data_size!");
if (e2 == 0) { if (e2 == 0) {
continue_loop = 0; continue_loop = 0;
} else { } else {
e_liP++; e_liP++;
continue_loop++;
} }
} else { } else {
if (!(*data_size_pP >= 0)) LOG_E(RLC, "Invalid data_size=%d! (pdu_size=%d loop=%d e1=%d li1=%d e_liP=%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x)\n",
*data_size_pP, pdu_size, continue_loop, e1, li1,
(e_liP-(continue_loop-1)+0)->b1,
(e_liP-(continue_loop-1)+0)->b2,
(e_liP-(continue_loop-1)+0)->b3,
(e_liP-(continue_loop-1)+1)->b1,
(e_liP-(continue_loop-1)+1)->b2,
(e_liP-(continue_loop-1)+1)->b3,
(e_liP-(continue_loop-1)+2)->b1,
(e_liP-(continue_loop-1)+2)->b2,
(e_liP-(continue_loop-1)+2)->b3);
continue_loop = 0; continue_loop = 0;
// AssertFatal(*data_size_pP >= 0, "Invalid data_size!");
} }
if (*num_li_pP >= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) { if (*num_li_pP >= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
@@ -162,7 +189,15 @@ int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_liP,
} }
*data_ppP = *data_ppP + (((*num_li_pP*3) +1) >> 1); *data_ppP = *data_ppP + (((*num_li_pP*3) +1) >> 1);
return 0; if (*data_size_pP > 0) {
return 0;
} else if (*data_size_pP == 0) {
LOG_W(RLC, "Last RLC SDU size is zero!\n");
return -1;
} else {
LOG_W(RLC, "Last RLC SDU size is negative %d!\n", *data_size_pP);
return -1;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
@@ -273,6 +308,9 @@ rlc_um_try_reassembly(
__LINE__); __LINE__);
#endif #endif
} }
AssertFatal(size >= 0, "invalid size!");
AssertFatal((e==0) || (e==1), "invalid e!");
AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!");
if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) { if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
switch (fi) { switch (fi) {
@@ -362,8 +400,9 @@ rlc_um_try_reassembly(
break; break;
default: default:
AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n", AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
fi,
__FILE__, __FILE__,
__LINE__); __LINE__);
} }
@@ -504,8 +543,9 @@ rlc_um_try_reassembly(
// data_p is already ok, done by last loop above // data_p is already ok, done by last loop above
rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
} else { } else {
AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" SHOULD NOT GO HERE (%s:%u)\n", AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
size,
__FILE__, __FILE__,
__LINE__); __LINE__);
//rlc_pP->stat_rx_data_pdu_dropped += 1; //rlc_pP->stat_rx_data_pdu_dropped += 1;
@@ -534,6 +574,12 @@ rlc_um_try_reassembly(
__LINE__); __LINE__);
#endif #endif
} }
} else {
rlc_pP->stat_rx_data_pdu_dropped += 1;
rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size;
rlc_pP->reassembly_missing_sn_detected = 1;
LOG_W(RLC, "[SN %d] Bad RLC header! Discard this RLC PDU (size=%d)\n", sn, size);
} }
} }
@@ -544,7 +590,7 @@ rlc_um_try_reassembly(
__FILE__, __FILE__,
__LINE__); __LINE__);
#endif #endif
free_mem_block(rlc_pP->dar_buffer[sn]); free_mem_block(rlc_pP->dar_buffer[sn], __func__);
rlc_pP->dar_buffer[sn] = NULL; rlc_pP->dar_buffer[sn] = NULL;
} else { } else {
rlc_pP->last_reassemblied_missing_sn = sn; rlc_pP->last_reassemblied_missing_sn = sn;
@@ -618,7 +664,7 @@ rlc_um_start_timer_reordering(
rlc_pP->t_reordering.ms_time_out); rlc_pP->t_reordering.ms_time_out);
#endif #endif
} else { } else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] NOT STARTED, CAUSE CONFIGURED 0 ms\n", LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[T-REORDERING] NOT STARTED, CAUSE CONFIGURED 0 ms\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
} }
} }
@@ -957,7 +1003,7 @@ rlc_um_receive_process_dar (
} else if (rlc_pP->rx_sn_length == 5) { } else if (rlc_pP->rx_sn_length == 5) {
sn = pdu_pP->b1 & 0x1F; sn = pdu_pP->b1 & 0x1F;
} else { } else {
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
} }
RLC_UM_MUTEX_LOCK(&rlc_pP->lock_dar_buffer, ctxt_pP, rlc_pP); RLC_UM_MUTEX_LOCK(&rlc_pP->lock_dar_buffer, ctxt_pP, rlc_pP);
@@ -982,7 +1028,7 @@ rlc_um_receive_process_dar (
#endif #endif
rlc_pP->stat_rx_data_pdu_out_of_window += 1; rlc_pP->stat_rx_data_pdu_out_of_window += 1;
rlc_pP->stat_rx_data_bytes_out_of_window += tb_sizeP; rlc_pP->stat_rx_data_bytes_out_of_window += tb_sizeP;
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
pdu_mem_pP = NULL; pdu_mem_pP = NULL;
RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer); RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
@@ -1001,7 +1047,7 @@ rlc_um_receive_process_dar (
//discard the PDU //discard the PDU
rlc_pP->stat_rx_data_pdus_duplicate += 1; rlc_pP->stat_rx_data_pdus_duplicate += 1;
rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP; rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP;
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
pdu_mem_pP = NULL; pdu_mem_pP = NULL;
RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer); RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
@@ -1017,7 +1063,7 @@ rlc_um_receive_process_dar (
sn); sn);
#endif #endif
mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn); mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn);
free_mem_block(pdu); free_mem_block(pdu, __func__);
} }
rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn); rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn);
@@ -69,7 +69,7 @@ rlc_um_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
// msg("[RLC_UM_LITE] Getting mem_block ...\n"); // msg("[RLC_UM_LITE] Getting mem_block ...\n");
rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size); rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size, __func__);
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
} }
@@ -83,7 +83,7 @@ rlc_um_display_rx_window(
LOG_T(RLC, "\n"); LOG_T(RLC, "\n");
} }
LOG_T(RLC, "%s%s| %04d |", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO, sn); LOG_T(RLC, "%s%s| %04lu |", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO, sn);
} }
strcpy(color, RLC_FG_COLOR_DEFAULT); strcpy(color, RLC_FG_COLOR_DEFAULT);
@@ -115,7 +115,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
#endif #endif
} }
if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
#if TRACE_RLC_UM_SEGMENT #if TRACE_RLC_UM_SEGMENT
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
@@ -291,7 +291,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
@@ -356,7 +356,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
@@ -380,7 +380,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
@@ -503,7 +503,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
#endif #endif
} }
if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
#if TRACE_RLC_UM_SEGMENT #if TRACE_RLC_UM_SEGMENT
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
@@ -679,7 +679,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
@@ -743,7 +743,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
@@ -765,7 +765,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
} }

Some files were not shown because too many files have changed in this diff Show More