Commit 33d67f24 authored by WEI-TAI CHEN's avatar WEI-TAI CHEN

merge S1AP

parents e9ce528e 7321aab6
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -676,12 +676,17 @@ function main() {
if [ "$SIMUS_PHY" = "1" ] ; then
# lte unitary simulators compilation
echo_info "Compiling unitary tests simulators"
simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
#simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
simlist="dlsim ulsim"
for f in $simlist ; do
compilations \
lte-simulators $f \
$f $dbin/$f.$REL
done
compilations \
lte-simulators coding \
libcoding.so $dbin/libcoding.so
fi
# Core simulators
......
This diff is collapsed.
#!/bin/bash
# in those arrays, each line is:
# <file> <sha1sum of file (without line 4 which changes depending on the location of the files)> <patch to apply to file>
RRC_Rel14=(
"SystemInformation-r8-IEs.h" 4df485c5ddf2540eca271876cdc512caa19b0890 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff"
"SystemInformation-NB-r13-IEs.h" 6d91332d5c39205819b06e5e36efe62ff8e5b33b "fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff"
)
RRC_Rel10=(
"SystemInformation-r8-IEs.h" 603cd6615cff36ec7020692d72c0d6de7c4859cb "fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff"
)
X2AP_Rel11_2=(
"X2ap-CriticalityDiagnostics-IE-List.h" ae96308b37fcbcbf39da5012e42968135fc5f27b "fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff"
)
red_color="$(tput setaf 1)"
green_color="$(tput setaf 2)"
reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
}
function check_sha1()
{
local file="$1"
local target_sha1="$2"
if [ ! -f "$file" ]
then
error "$file: no such file"
fi
# we don't use the line 4 of the file
# it contains the location of the ASN1 grammar
# and this location is not the same on every
# installation (this is for *.h files, for *.c
# files it's no big deal to skip that line)
local computed_sha1=$(sed 4d "$file" | sha1sum | cut -f 1 -d ' ')
if [ "$target_sha1" != "$computed_sha1" ]
then
error "$file: wrong SHA1"
fi
}
function patch_file()
{
local patch="$1"
local file="$2"
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
if [ $? -ne 0 ]
then
error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
fi
}
function apply_patches()
{
local directory="$1"
local array=$2
local len=$3 # the length could be computed locally but the way to do it is not clear to me [CROUX]
local i
local file
local sha1
local patch
local item
for (( i = 0; i < $len; i += 3 ))
do
# special bash syntax to access the array
item=$array[$i]; file=${!item}
item=$array[$((i+1))]; sha1=${!item}
item=$array[$((i+2))]; patch=${!item}
check_sha1 "$directory/$file" "$sha1"
patch_file "$patch" "$directory/$file"
done
}
function patch_rrc()
{
local directory="$1"
local version="$2"
case "$version" in
Rel14 )
echo "patching RRC files release 14"
apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]}
;;
Rel10 )
echo "patching RRC files release 10"
apply_patches "$directory" RRC_Rel10 ${#RRC_Rel10[*]}
;;
Rel8 )
echo "patching RRC files release 8 TODO?"
;;
* )
error unknwon/unhandled RRC version \'"$version"\'
;;
esac
}
function patch_nr_rrc()
{
local directory="$1"
local version="$2"
case "$version" in
NR_Rel15 )
echo "patching NR_RRC files release 15"
apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]}
;;
* )
error unknwon/unhandled NR_RRC version \'"$version"\'
;;
esac
}
function patch_x2ap()
{
local directory="$1"
local version="$2"
case "$version" in
R11 )
echo "patching X2AP files release 11.2"
apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]}
;;
* )
error unknwon/unhandled X2AP version \'"$version"\'
;;
esac
}
function patch_s1ap()
{
local directory="$1"
local version="$2"
case "$version" in
R10 )
#nothing to do anymore (fixes went to asn1c)
;;
* )
error unknwon/unhandled S1AP version \'"$version"\'
;;
esac
}
function main()
{
if [ $# -ne 3 ]
then
echo "ERROR: pass <output directory> <module> <version>"
exit 1
fi
if [ x"$OPENAIR_DIR" = x ]
then
error "the variable OPENAIR_DIR is not set"
fi
local directory="$1"
local module="$2"
local version="$3"
case "$module" in
RRC )
#patch_rrc "$directory" "$version"
;;
NR_RRC )
#patch_nr_rrc "$directory" "$version"
;;
X2AP )
#patch_x2ap "$directory" "$version"
;;
S1AP )
#patch_s1ap "$directory" "$version"
;;
* )
error unknown module "$module"
;;
esac
exit 0
}
main "$@"
#!/bin/bash
function main()
{
mkdir -p $1
cd $1
shift
#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
#(there may be a better way...)
if [ $# -eq 1 ]; then
#asn1c does not work well with extension groups, we need the following fix:
# replace [[ by '<name> SEQUENCE {'
# and ]] by '} OPTIONAL'
#<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just
#following another [[ ]]
#
#this is what the following C program does
echo generate asnfix.c
cat << EOF > asnfix.c
/* transforms:
* '[[' to 'name SEQUENCE {'
* ']]' to '} OPTIONAL'
* name is ext1, ext2, ..., for each [[ at the same level
* levels are delimited by { and }
* -- to end of line is a comment and unprocessed
* nested [[ ]] not handled
* { and } must be balanced
* [[ and ]] can be whatever, every combination is valid
*/
#include <stdio.h>
#include <stdlib.h>
void level(int toplevel)
{
int c;
int next_name = 1;
while (1) {
c = getchar();
next:
if (c == EOF) { if (toplevel) break; abort(); }
if (c == '-') {
c = getchar();
if (c != '-') { putchar('-'); goto next; }
putchar(c); putchar(c);
while (1) {
c = getchar(); if (c == EOF) abort();
putchar(c);
if (c == '\n') break;
}
continue;
}
if (c == '[') {
c = getchar();
if (c != '[') { putchar('['); goto next; }
printf("ext%d SEQUENCE {", next_name);
next_name++;
continue;
}
if (c == ']') {
c = getchar();
if (c != ']') { putchar(']'); goto next; }
printf("} OPTIONAL");
continue;
}
putchar(c);
if (c == '}') { if (toplevel) abort(); break; }
if (c == '{') level(0);
}
}
int main(void)
{
level(1);
fflush(stdout);
return 0;
}
EOF
echo compile asnfix.c
gcc -Wall -o asnfix asnfix.c
echo run asnfix on $1
./asnfix < $1 > fixed_grammar.asn
rm -f asnfix asnfix.c
echo done with asnfix
echo running asn1c
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
rm -f fixed_grammar.asn
echo asn1c done
else
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
fi
awk '
BEGIN {
print "#ifndef __ASN1_CONSTANTS_H__"
print "#define __ASN1_CONSTANTS_H__"
}
/INTEGER ::=/ {
gsub("INTEGER ::=","")
gsub("--","//")
gsub("-1","_minus_1")
gsub("-","_")
printf("#define %s\n",$0)
}
/::=.*INTEGER.*[(]/ {
nb_fields=split($0,val,"[:=().]+");
gsub("-","_",val[1]);
printf("#define min_val_%s %s\n",val[1],val[nb_fields-2]);
printf("#define max_val_%s %s\n",val[1],val[nb_fields-1]);
}
END {
print "#endif ";
} ' $1 > asn1_constants.h
}
main "$@"
......@@ -325,8 +325,11 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
/* Increment the global message number */
message_number = itti_increment_message_number ();
#if 0
/* itti dump is disabled */
itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
#endif
if (destination_task_id != TASK_UNKNOWN) {
......@@ -421,8 +424,11 @@ int itti_try_send_msg_to_task(task_id_t destination_task_id, instance_t instance
/* Increment the global message number */
message_number = itti_increment_message_number ();
#if 0
/* itti dump is disabled */
itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
#endif
if (destination_task_id != TASK_UNKNOWN) {
......@@ -716,8 +722,11 @@ void itti_mark_task_ready(task_id_t task_id)
AssertFatal (thread_id < itti_desc.thread_max, "Thread id (%d) is out of range (%d)!\n", thread_id, itti_desc.thread_max);
#if 0
/* itti dump is disabled */
/* Register the thread in itti dump */
itti_dump_thread_use_ring_buffer();
#endif
/* Mark the thread as using LFDS queue */
lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
......@@ -848,7 +857,10 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
itti_desc.wait_tasks = 0;
itti_desc.created_tasks = 0;
itti_desc.ready_tasks = 0;
#if 0
/* itti dump is disabled */
itti_dump_init (messages_definition_xml, dump_file_name);
#endif
CHECK_INIT_RETURN(timer_init ());
......@@ -915,7 +927,10 @@ void itti_wait_tasks_end(void)
exit (0);
}
#if 0
/* itti dump is disabled */
itti_dump_exit();
#endif
}
void itti_send_terminate_message(task_id_t task_id)
......
......@@ -1451,7 +1451,9 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe)
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask) {
/* release the harq if its round is >= 'after_rounds' */
static void do_release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int after_rounds)
{
LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
......@@ -1472,11 +1474,13 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
dlsch1_harq = dlsch1->harq_processes[harq_pid];
AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n");
if (dlsch0_harq->round >= after_rounds) {
dlsch0_harq->status = SCH_IDLE;
/*if ((dlsch1_harq == NULL)||
((dlsch1_harq!=NULL)&&
(dlsch1_harq->status == SCH_IDLE)))*/
dlsch0->harq_mask &= ~(1<<harq_pid);
}
LOG_D(PHY,"Frame %d, subframe %d: Releasing harq %d for UE %x\n",frame,subframe,harq_pid,dlsch0->rnti);
}
......@@ -1496,6 +1500,7 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
dlsch1_harq = dlsch1->harq_processes[harq_pid];
AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n");
if (dlsch0_harq->round >= after_rounds) {
dlsch0_harq->status = SCH_IDLE;
if ((dlsch1_harq == NULL)||
((dlsch1_harq!=NULL)&&
......@@ -1505,6 +1510,16 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
}
}
}
}
}
static void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack)
{
/* Maximum number of DL transmissions = 4.
* TODO: get the value from configuration.
* If is_ack is true then we release immediately. The value -1 can be used for that.
*/
do_release_harq(eNB, UE_id, tb, frame, subframe, mask, is_ack ? -1 : 4);
}
int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
......@@ -1607,7 +1622,7 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 2-ulsch_harq->o_ACK[i];
// release DLSCH if needed
if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff);
release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
#if T_TRACER
/* TODO: get correct harq pid */
......@@ -1633,13 +1648,17 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = 2-ulsch_harq->o_ACK[i];
// release DLSCH if needed
if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff);
if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff);
/* TODO: review this code, it's most certainly wrong.
* We have to release the proper HARQ in case of ACK or NACK if max retransmission reached.
* Basically, call release_harq with 1 as last argument when ACK and 0 when NACK.
*/
release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
else if (M>1 && ulsch_harq->o_ACK[i] == 1) {
// spatial bundling
release_harq(eNB,UE_id,0,frame,subframe,1<<i);
release_harq(eNB,UE_id,1,frame,subframe,1<<i);
release_harq(eNB,UE_id,0,frame,subframe,1<<i, ulsch_harq->o_ACK[i] == 1);
release_harq(eNB,UE_id,1,frame,subframe,1<<i, ulsch_harq->o_ACK[i] == 1);
}
}
}
......@@ -1701,7 +1720,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0];
// release DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
#if T_TRACER
if (harq_ack[0] != 1)
......@@ -1721,8 +1740,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0];
pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1];
// release DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
}
else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt);
}
......@@ -1743,7 +1762,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
// release all bundled DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
}
else if (uci->pucch_fmt == pucch_format1b) {
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2;
......@@ -1753,8 +1772,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1];
// release all DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
}
break;
case 1: // multiplexing
......@@ -1766,7 +1785,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
// release all DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
}
else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) {
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
......@@ -1776,8 +1795,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1];
// release all DLSCH if needed
if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
}
else { // num_pucch_resources (M) > 1
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
......@@ -1788,8 +1807,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
if (uci->num_pucch_resources == 3) pdu->harq_indication_tdd_rel13.harq_data[2].multiplex.value_0 = harq_ack[2];
if (uci->num_pucch_resources == 4) pdu->harq_indication_tdd_rel13.harq_data[3].multiplex.value_0 = harq_ack[3];
// spatial-bundling in this case so release both HARQ if necessary
release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask);
release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask);
release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
}
break;
case 2: // special bundling (SR collision)
......@@ -1800,26 +1819,27 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
switch (harq_ack[0]) {
case 0:
/* TODO: release_harq here? this whole code looks suspicious */
break;
case 1: // check if M=1,4,7
if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 ||
tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) {
release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
}
break;
case 2: // check if M=2,5,8
if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 ||
tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) {
release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
}
break;
case 3: // check if M=3,6,9
if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 ||
tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) {
release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff);
release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
}
break;
}
......
......@@ -131,7 +131,7 @@ message flex_enb_config_request {
message flex_enb_config_reply {
optional flex_header header = 1;
optional uint32 eNB_id = 2; // Unique id to distinguish the eNB
optional uint64 eNB_id = 2; // Unique id to distinguish the eNB
repeated flex_cell_config cell_config = 3;
optional uint32 device_spec = 4;
}
......
......@@ -60,37 +60,124 @@
extern uint16_t sf_ahead;
void RCconfig_flexran()
{
int i;
uint16_t i;
uint16_t num_enbs;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
/* this will possibly truncate the cell id (RRC assumes int32_t).
* Both Nid_cell and enb_id are signed in RRC case, but we use unsigned for
* the bitshifting to work properly */
int32_t Nid_cell = 0;
uint16_t Nid_cell_tr = 0;
uint32_t enb_id = 0;
/*
* the only reason for all these variables is, that they are "hard-encoded"
* into the CCPARAMS_DESC macro and we need it for the Nid_cell variable ...
*/
char *frame_type, *prefix_type, *pbch_repetition, *prach_high_speed,
*pusch_hoppingMode, *pusch_enable64QAM, *pusch_groupHoppingEnabled,
*pusch_sequenceHoppingEnabled, *phich_duration, *phich_resource,
*srs_enable, *srs_ackNackST, *srs_MaxUpPts, *pusch_alpha,
*pucch_deltaF_Format1, *pucch_deltaF_Format1b, *pucch_deltaF_Format2,
*pucch_deltaF_Format2a, *pucch_deltaF_Format2b,
*rach_preamblesGroupAConfig, *rach_messagePowerOffsetGroupB, *pcch_nB;
long long int downlink_frequency;
int32_t tdd_config, tdd_config_s, eutra_band, uplink_frequency_offset,
Nid_cell_mbsfn, N_RB_DL, nb_antenna_ports, prach_root, prach_config_index,
prach_zero_correlation, prach_freq_offset, pucch_delta_shift,
pucch_nRB_CQI, pucch_nCS_AN, pucch_n1_AN, pdsch_referenceSignalPower,
pdsch_p_b, pusch_n_SB, pusch_hoppingOffset, pusch_groupAssignment,
pusch_nDMRS1, srs_BandwidthConfig, srs_SubframeConfig, pusch_p0_Nominal,
pucch_p0_Nominal, msg3_delta_Preamble, rach_numberOfRA_Preambles,
rach_sizeOfRA_PreamblesGroupA, rach_messageSizeGroupA,
rach_powerRampingStep, rach_preambleInitialReceivedTargetPower,
rach_preambleTransMax, rach_raResponseWindowSize,
rach_macContentionResolutionTimer, rach_maxHARQ_Msg3Tx,
pcch_defaultPagingCycle, bcch_modificationPeriodCoeff,
ue_TimersAndConstants_t300, ue_TimersAndConstants_t301,
ue_TimersAndConstants_t310, ue_TimersAndConstants_t311,
ue_TimersAndConstants_n310, ue_TimersAndConstants_n311,
ue_TransmissionMode;
/* get number of eNBs */
paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL);
num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
/* for eNB ID */
paramdef_t ENBParams[] = ENBPARAMS_DESC;
paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0};
/* for Nid_cell */
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
paramdef_t CCsParams[] = CCPARAMS_DESC;
paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
/* map parameter checking array instances to parameter definition array instances */
for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
}
paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
if (!RC.flexran) {
RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
AssertFatal(RC.flexran != NULL,
RC.flexran = calloc(num_enbs, sizeof(flexran_agent_info_t*));
AssertFatal(RC.flexran,
"can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
RC.nb_L1_inst * sizeof(flexran_agent_info_t*),
RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
num_enbs * sizeof(flexran_agent_info_t*),
num_enbs, sizeof(flexran_agent_info_t*));
}
/* For all agent instance, fill in the same controller configuration. */
for (i = 0; i < RC.nb_L1_inst; i++) {
for (i = 0; i < num_enbs; i++) {
RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
AssertFatal(RC.flexran[i] != NULL,
AssertFatal(RC.flexran[i],
"can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst);
sizeof(flexran_agent_info_t), i + 1, num_enbs);
/* if config says "yes", enable Agent, in all other cases it's like "no" */
RC.flexran[i]->enabled = strcmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
RC.flexran[i]->enabled = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
/* if not enabled, simply skip the rest, it is not needed anyway */
if (!RC.flexran[i]->enabled)
continue;
RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
//inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
RC.flexran[i]->node_ctrl_state = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
RC.flexran[i]->enb_id = i;
RC.flexran[i]->node_ctrl_state = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t),NULL);
/* eNB ID from configuration, as read in by RCconfig_RRC() */
if (!ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr) {
// Calculate a default eNB ID
# if defined(ENABLE_USE_MME)
enb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
# else
enb_id = i;
# endif
} else {
enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
}
/* cell ID */
sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i);
config_getlist(&CCsParamList, NULL, 0, aprefix);
if (CCsParamList.numelt > 0) {
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0);
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
Nid_cell_tr = (uint16_t) Nid_cell;
}
RC.flexran[i]->mod_id = i;
RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)enb_id) << 16) | ((uint64_t)Nid_cell_tr);
/* assume for the moment the monolithic case, i.e. agent can provide
* information for all layers */
RC.flexran[i]->capability_mask = FLEXRAN_CAP_LOPHY | FLEXRAN_CAP_HIPHY
| FLEXRAN_CAP_LOMAC | FLEXRAN_CAP_HIMAC
| FLEXRAN_CAP_RLC | FLEXRAN_CAP_PDCP
| FLEXRAN_CAP_SDAP | FLEXRAN_CAP_RRC;
}
}
......
......@@ -114,12 +114,12 @@ void *receive_thread(void *args) {
while (1) {
while (flexran_agent_msg_recv(d->enb_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) {
while (flexran_agent_msg_recv(d->mod_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) {
LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size);
// Invoke the message handler
msg=flexran_agent_handle_message(d->enb_id, data, size);
msg=flexran_agent_handle_message(d->mod_id, data, size);
free(data);
......@@ -127,7 +127,7 @@ void *receive_thread(void *args) {
if (msg != NULL){
data=flexran_agent_pack_message(msg,&size);
if (flexran_agent_msg_send(d->enb_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
if (flexran_agent_msg_send(d->mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
......@@ -191,13 +191,6 @@ int flexran_agent_start(mid_t mod_id)
return 100;
}
flexran->enb_id = mod_id;
/* assume for the moment the monolithic case, i.e. agent can provide
* information for all layers */
flexran->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1
| FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2
| FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC;
/*
* Initialize the channel container
*/
......
This diff is collapsed.
......@@ -138,12 +138,14 @@ typedef enum {
FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;
#define FLEXRAN_CAP_LOL1 0x1
#define FLEXRAN_CAP_HIL1 0x2
#define FLEXRAN_CAP_LOL2 0x4 // is: MAC
#define FLEXRAN_CAP_HIL2 0x8 // is: RLC
#define FLEXRAN_CAP_PDCP 0x16
#define FLEXRAN_CAP_RRC 0x32
#define FLEXRAN_CAP_LOPHY 1
#define FLEXRAN_CAP_HIPHY 2
#define FLEXRAN_CAP_LOMAC 4
#define FLEXRAN_CAP_HIMAC 8
#define FLEXRAN_CAP_RLC 16
#define FLEXRAN_CAP_PDCP 32
#define FLEXRAN_CAP_SDAP 64
#define FLEXRAN_CAP_RRC 128
typedef enum {
ENB_NORMAL_OPERATION = 0x0,
......@@ -159,7 +161,8 @@ typedef struct {
uint16_t remote_port;
char *cache_name;
int enb_id;
mid_t mod_id;
uint64_t agent_id;
uint8_t capability_mask;
/* lock for waiting before starting or soft-restart */
......
......@@ -423,12 +423,15 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
}
} // ul_failure_timer>0
#if 0
/* U-plane inactivity timer is disabled. Uncomment to re-enable. */
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}// time > 60s
#endif
}
void
......
......@@ -3268,8 +3268,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if (pdu[0] == 1) { // ACK
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
} else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK)
} else if (pdu[0] == 2 || pdu[0] == 4) { // NAK (treat DTX as NAK)
sched_ctl->round[CC_idP][harq_pid]++; // increment round
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
}
} else {
// one or two ACK/NAK bits
AssertFatal(num_ack_nak <= 2,
......@@ -3285,8 +3290,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if ((num_ack_nak == 2)
&& (sched_ctl->round[CC_idP][harq_pid] < 8)
&& (sched_ctl->tbcnt[CC_idP][harq_pid] == 1)
&& (pdu[0] == 2) && (pdu[1] == 2))
&& (pdu[0] == 2) && (pdu[1] == 2)) {
sched_ctl->round[CC_idP][harq_pid]++;
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
}
else if (((num_ack_nak == 2)
&& (sched_ctl->round[CC_idP][harq_pid] < 8)
&& (sched_ctl->tbcnt[0][harq_pid] == 2)
......@@ -3297,11 +3307,20 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
&& (pdu[0] == 2) && (pdu[1] == 1))) {
sched_ctl->round[CC_idP][harq_pid]++;
sched_ctl->tbcnt[CC_idP][harq_pid] = 1;
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0; /* TODO: do we have to set it to 0? */
}
} else if ((num_ack_nak == 2)
&& (sched_ctl->round[CC_idP][harq_pid] < 8)
&& (sched_ctl->tbcnt[CC_idP][harq_pid] == 2)
&& (pdu[0] == 2) && (pdu[1] == 2))
&& (pdu[0] == 2) && (pdu[1] == 2)) {
sched_ctl->round[CC_idP][harq_pid]++;
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
}
else
AssertFatal(1 == 0,
"Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n",
......@@ -3327,12 +3346,18 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
pdu[1]);
if (pdu[0] == 1)
sched_ctl->round[pCCid][harq_pid] = 8;
else
else {
sched_ctl->round[pCCid][harq_pid]++;
if (sched_ctl->round[pCCid][harq_pid] == 4)
sched_ctl->round[pCCid][harq_pid] = 8;
}
if (pdu[1] == 1)
sched_ctl->round[1 - pCCid][harq_pid] = 8;
else
else {
sched_ctl->round[1 - pCCid][harq_pid]++;
if (sched_ctl->round[1 - pCCid][harq_pid] == 4)
sched_ctl->round[1 - pCCid][harq_pid] = 8;
}
} // A=2
else if ((num_ack_nak == 3)
&& (sched_ctl->round[pCCid][harq_pid] < 8)
......@@ -3358,13 +3383,26 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
((pdu[0] == 1) && (pdu[1] == 2))) {
sched_ctl->round[pCCid][harq_pid]++;
sched_ctl->tbcnt[pCCid][harq_pid] = 1;
} else
if (sched_ctl->round[pCCid][harq_pid] == 4) {
sched_ctl->round[pCCid][harq_pid] = 8;
sched_ctl->tbcnt[pCCid][harq_pid] = 0; /* TODO: do we have to set it to 0? */
}
} else {
sched_ctl->round[pCCid][harq_pid]++;
if (sched_ctl->round[pCCid][harq_pid] == 4) {
sched_ctl->round[pCCid][harq_pid] = 8;
sched_ctl->tbcnt[pCCid][harq_pid] = 0;
}
}
if (pdu[2] == 1)
sched_ctl->round[1 - pCCid][harq_pid] = 8;
else
else {
sched_ctl->round[1 - pCCid][harq_pid]++;
if (sched_ctl->round[1 - pCCid][harq_pid] == 4) {
sched_ctl->round[1 - pCCid][harq_pid] = 8;
}
}
} // A=3 primary cell has 2 TBs
else if ((num_ack_nak == 3)
&& (sched_ctl->round[1 - pCCid][harq_pid] < 8)
......@@ -3390,13 +3428,26 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
|| ((pdu[0] == 1) && (pdu[1] >= 2))) { // one ACK
sched_ctl->round[1 - pCCid][harq_pid]++;
sched_ctl->tbcnt[1 - pCCid][harq_pid] = 1;
} else // both NAK/DTX
if (sched_ctl->round[1 - pCCid][harq_pid] == 4) {
sched_ctl->round[1 - pCCid][harq_pid] = 8;
sched_ctl->tbcnt[1 - pCCid][harq_pid] = 0;
}
} else { // both NAK/DTX
sched_ctl->round[1 - pCCid][harq_pid]++;
if (sched_ctl->round[1 - pCCid][harq_pid] == 4) {
sched_ctl->round[1 - pCCid][harq_pid] = 8;
sched_ctl->tbcnt[1 - pCCid][harq_pid] = 0;
}
}
if (pdu[2] == 1)
sched_ctl->round[pCCid][harq_pid] = 8;
else
else {
sched_ctl->round[pCCid][harq_pid]++;
if (sched_ctl->round[pCCid][harq_pid] == 4) {
sched_ctl->round[pCCid][harq_pid] = 8;
}
}
} // A=3 secondary cell has 2 TBs
#if MAX_NUM_CCs>1
else if ((num_ack_nak == 4)
......@@ -3425,8 +3476,17 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
|| ((pdu[0] == 1) && (pdu[1] >= 2))) { // one ACK
sched_ctl->round[0][harq_pid]++;
sched_ctl->tbcnt[0][harq_pid] = 1;
} else // both NAK/DTX
if (sched_ctl->round[0][harq_pid] == 4) {
sched_ctl->round[0][harq_pid] = 8;
sched_ctl->tbcnt[0][harq_pid] = 0;
}
} else { // both NAK/DTX
sched_ctl->round[0][harq_pid]++;
if (sched_ctl->round[0][harq_pid] == 4) {
sched_ctl->round[0][harq_pid] = 8;
sched_ctl->tbcnt[0][harq_pid] = 0;
}
}
if ((pdu[2] == 1) && (pdu[3] == 1)) { // both ACK
sched_ctl->round[1][harq_pid] = 8;
......@@ -3435,8 +3495,17 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
|| ((pdu[2] == 1) && (pdu[3] >= 2))) { // one ACK
sched_ctl->round[1][harq_pid]++;
sched_ctl->tbcnt[1][harq_pid] = 1;
} else // both NAK/DTX
if (sched_ctl->round[1][harq_pid] == 4) {
sched_ctl->round[1][harq_pid] = 8;
sched_ctl->tbcnt[1][harq_pid] = 0;
}
} else { // both NAK/DTX
sched_ctl->round[1][harq_pid]++;
if (sched_ctl->round[1][harq_pid] == 4) {
sched_ctl->round[1][harq_pid] = 8;
sched_ctl->tbcnt[1][harq_pid] = 0;
}
}
} // A=4 both serving cells have 2 TBs
#endif
break;
......@@ -3451,8 +3520,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if (pdu[j] == 1) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
} else if (pdu[j] == 2)
} else if (pdu[j] == 2) {
sched_ctl->round[i][harq_pid]++;
if (sched_ctl->round[i][harq_pid] == 4) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
}
}
else
AssertFatal(1 == 0,
"Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n",
......@@ -3467,13 +3541,25 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
&& (pdu[j] == 1) && (pdu[j + 1] == 2)) {
sched_ctl->round[i][harq_pid]++;
sched_ctl->tbcnt[i][harq_pid] = 1;
if (sched_ctl->round[i][harq_pid] == 4) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
}
} else if ((sched_ctl->tbcnt[i][harq_pid] == 2)
&& (pdu[j] == 2) && (pdu[j + 1] == 1)) {
sched_ctl->round[i][harq_pid]++;
sched_ctl->tbcnt[i][harq_pid] = 1;
if (sched_ctl->round[i][harq_pid] == 4) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
}
} else if ((sched_ctl->tbcnt[i][harq_pid] == 2)
&& (pdu[j] == 2) && (pdu[j + 1] == 2)) {
sched_ctl->round[i][harq_pid]++;
if (sched_ctl->round[i][harq_pid] == 4) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
}
} else
AssertFatal(1 == 0,
"Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n",
......@@ -3487,6 +3573,10 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
sched_ctl->tbcnt[i][harq_pid] = 0;
} else if (pdu[j] == 2) {
sched_ctl->round[i][harq_pid]++;
if (sched_ctl->round[i][harq_pid] == 4) {
sched_ctl->round[i][harq_pid] = 8;
sched_ctl->tbcnt[i][harq_pid] = 0;
}
} else
AssertFatal(1 == 0,
"Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n",
......
......@@ -212,6 +212,30 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
} else
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
// Program NACK for PHICH
LOG_D(MAC,
"Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n",
current_rnti, harq_pid, first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = first_rb;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
return;
}
......@@ -251,6 +275,9 @@ rx_sdu(const module_id_t enb_mod_idP,
ra[RA_id].Msg3_subframe = (ra[RA_id].Msg3_subframe + 8) % 10;
add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP);
}
/* TODO: program NACK for PHICH? */
return;
}
} else {
......@@ -1448,6 +1475,10 @@ schedule_ulsch_rnti(module_id_t module_idP,
T_INT(first_rb[CC_id]),
T_INT(rb_table[rb_table_index]), T_INT(round));
#if 0
/* This is done in rx_sdu, as it has to.
* Since the code is a bit different, let's keep this version here for review, in case of problem.
*/
// fill in NAK information
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
......@@ -1471,6 +1502,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_template->first_rb_ul[harq_pid],
UE_template->nb_rb_ul[harq_pid],
UE_template->TBS_UL[harq_pid], round);
#endif
// Add UL_config PDUs
LOG_D(MAC,
"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
......
......@@ -734,7 +734,7 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
// control channel or retransmission
/* TODO: do we have to check for retransmission? */
if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) {
if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round != 8) {
nb_rbs_required_remaining_1[CC_id][UE_id] =
nb_rbs_required[CC_id][UE_id];
} else {
......
......@@ -69,7 +69,7 @@ mac_rrc_data_req(
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t* const buffer_pP,
uint8_t *const buffer_pP,
const uint8_t mbsfn_sync_area
)
//--------------------------------------------------------------------------
......@@ -78,18 +78,13 @@ mac_rrc_data_req(
SRB_INFO *Srb_info;
uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
#ifdef DEBUG_RRC
int i;
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif
eNB_RRC_INST *rrc;
rrc_eNB_carrier_data_t *carrier;
BCCH_BCH_Message_t *mib;
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
......@@ -107,7 +102,6 @@ mac_rrc_data_req(
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -127,11 +121,9 @@ mac_rrc_data_req(
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
......@@ -141,14 +133,12 @@ mac_rrc_data_req(
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -168,11 +158,9 @@ mac_rrc_data_req(
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
......@@ -187,11 +175,12 @@ mac_rrc_data_req(
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
(void*)mib,
NULL,
(void *)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
......@@ -216,7 +205,6 @@ mac_rrc_data_req(
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -234,11 +222,9 @@ mac_rrc_data_req(
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
......@@ -254,7 +240,6 @@ mac_rrc_data_req(
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -272,11 +257,9 @@ mac_rrc_data_req(
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
......@@ -292,7 +275,6 @@ mac_rrc_data_req(
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -313,15 +295,12 @@ mac_rrc_data_req(
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
#ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
......@@ -331,7 +310,6 @@ mac_rrc_data_req(
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
// }
//else
......@@ -339,16 +317,16 @@ mac_rrc_data_req(
}
#endif //Rel10 || Rel14
#ifdef Rel14
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR) { // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
......@@ -356,8 +334,6 @@ mac_rrc_data_req(
}
#endif
return(0);
}
......@@ -370,7 +346,7 @@ mac_rrc_data_ind(
const sub_frame_t sub_frameP,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t* sduP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
)
......@@ -379,18 +355,14 @@ mac_rrc_data_ind(
SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
(void)sdu_size;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
......@@ -424,9 +396,7 @@ mac_rrc_data_ind(
}
#endif
return(0);
}
//------------------------------------------------------------------------------
......@@ -437,7 +407,7 @@ mac_eNB_get_rrc_status(
)
//------------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_idP],
rntiP);
......@@ -455,25 +425,28 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=1;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (rrc_agent_registered[Mod_instP]) {
agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
// rrc_mac_remove_ue(Mod_instP,rntiP);
// rrc_mac_remove_ue(Mod_instP,rntiP);
}
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
......@@ -482,10 +455,11 @@ void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
......@@ -503,7 +477,7 @@ void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -35,6 +35,9 @@
#include <stdlib.h>
#include <string.h>
#include "COMMON/s1ap_messages_types.h"
#include "COMMON/rrc_messages_types.h"
#include "collection/tree.h"
#include "rrc_types_NB_IoT.h"
#include "COMMON/platform_constants.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -29,7 +29,7 @@
#include <stdint.h>
#include "x2ap_common.h"
#include "X2AP-PDU.h"
#include "X2AP_X2AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
......@@ -55,29 +55,27 @@ inline void ASN_DEBUG(const char *fmt, ...)
ssize_t x2ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_initiatingMessage;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
......@@ -89,107 +87,67 @@ ssize_t x2ap_generate_initiating_message(
ssize_t x2ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_successfulOutcome;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t x2ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_unsuccessfulOutcome;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
X2ap_IE_t *x2ap_new_ie(
X2ap_ProtocolIE_ID_t id,
X2ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr)
{
X2ap_IE_t *buff;
if ((buff = malloc(sizeof(X2ap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset((void *)buff, 0, sizeof(X2ap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType_aper(&buff->value, type, sptr) < 0) {
fprintf(stderr, "Encoding of %s failed\n", type->name);
free(buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_X2ap_IE, buff) < 0) {
free(buff);
return NULL;
}
return buff;
}
void x2ap_handle_criticality(X2ap_Criticality_t criticality)
void x2ap_handle_criticality(X2AP_Criticality_t criticality)
{
}
This diff is collapsed.
......@@ -290,6 +290,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
protocol_ctxt_t ctxt;
NwGtpv1uRcT rc;
switch(pUlpApi->apiType) {
/* Here there are two type of messages handled:
......@@ -314,6 +315,12 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
gtpv1u_eNB_write_dump_socket(buffer,buffer_len);
#endif
rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack,
pUlpApi->apiInfo.recvMsgInfo.hMsg);
if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc);
}
//-----------------------
// GTPV1U->PDCP mapping
//-----------------------
......
This diff is collapsed.
......@@ -30,7 +30,7 @@
#include <stdint.h>
#include "s1ap_common.h"
#include "S1AP-PDU.h"
#include "S1AP_S1AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
......@@ -53,144 +53,6 @@ inline void ASN_DEBUG(const char *fmt, ...)
}
#endif
ssize_t s1ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
void s1ap_handle_criticality(S1AP_Criticality_t criticality)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t s1ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t s1ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
S1ap_IE_t *s1ap_new_ie(
S1ap_ProtocolIE_ID_t id,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr)
{
S1ap_IE_t *buff;
if ((buff = malloc(sizeof(S1ap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset((void *)buff, 0, sizeof(S1ap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType_aper(&buff->value, type, sptr) < 0) {
fprintf(stderr, "Encoding of %s failed\n", type->name);
free(buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_S1ap_IE, buff) < 0) {
free(buff);
return NULL;
}
return buff;
}
void s1ap_handle_criticality(S1ap_Criticality_t criticality)
{
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -20,12 +20,12 @@
*/
#include <stdint.h>
#include "s1ap_ies_defs.h"
#ifndef S1AP_ENB_DECODER_H_
#define S1AP_ENB_DECODER_H_
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
const uint32_t length) __attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_DECODER_H_ */
This diff is collapsed.
......@@ -22,7 +22,7 @@
#ifndef S1AP_ENB_ENCODER_H_
#define S1AP_ENB_ENCODER_H_
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_ENCODER_H_ */
This diff is collapsed.
This diff is collapsed.
......@@ -23,13 +23,13 @@
#define S1AP_ENB_NAS_PROCEDURES_H_
int s1ap_eNB_handle_nas_downlink(
const uint32_t assoc_id,
const uint32_t stream,
struct s1ap_message_s* message_p);
uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p);
void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
int s1ap_eNB_handle_nas_first_req(
......
......@@ -33,7 +33,6 @@
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB.h"
......@@ -46,19 +45,18 @@
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
S1AP_S1AP_PDU_t *pdu)
{
S1ap_OverloadStartIEs_t *overload_start_p;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(message_p != NULL);
overload_start_p = &message_p->msg.s1ap_OverloadStartIEs;
DevCheck(overload_start_p->overloadResponse.present ==
S1ap_OverloadResponse_PR_overloadAction,
S1ap_OverloadResponse_PR_overloadAction, 0, 0);
S1AP_OverloadStart_t *container;
S1AP_OverloadStartIEs_t *ie;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_OverloadResponse, TRUE);
DevCheck(ie->value.choice.OverloadResponse.present ==
S1AP_OverloadResponse_PR_overloadAction,
S1AP_OverloadResponse_PR_overloadAction, 0, 0);
/* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0);
......@@ -72,24 +70,20 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
*/
mme_desc_p->state = S1AP_ENB_OVERLOAD;
mme_desc_p->overload_state =
overload_start_p->overloadResponse.choice.overloadAction;
ie->value.choice.OverloadResponse.choice.overloadAction;
return 0;
}
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
S1AP_S1AP_PDU_t *pdu)
{
/* We received Overload stop message, meaning that the MME is no more
* overloaded. This is an empty message, with only message header and no
* Information Element.
*/
DevAssert(message_p != NULL);
DevAssert(pdu != NULL);
s1ap_eNB_mme_data_t *mme_desc_p;
/* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0);
......
......@@ -30,7 +30,7 @@
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
S1AP_S1AP_PDU_t *pdu);
/**
* \brief Handle an overload stop message
......@@ -40,6 +40,6 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
S1AP_S1AP_PDU_t *pdu);
#endif /* S1AP_ENB_OVERLOAD_H_ */
This diff is collapsed.
......@@ -34,13 +34,13 @@
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
S1AP_S1AP_PDU_t *pdu);
// int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
S1AP_S1AP_PDU_t *pdu);
#endif /* S1AP_ENB_TRACE_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -36,9 +36,10 @@
#include "play_scenario.h"
//------------------------------------------------------------------------------
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints)
{
asn_comp_rval_t *rv = NULL;
// no comparison for ports
if (sctp1->ppid != sctp2->ppid) {
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
......@@ -46,12 +47,14 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
return rv;
}
if (sctp1->assoc_id != sctp2->assoc_id) {
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
return rv;
}
if (sctp1->stream != sctp2->stream) {
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
rv = calloc(1, sizeof(asn_comp_rval_t));
......@@ -61,30 +64,33 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
}
}
// We do not have SSN from lower layers
// if (sctp1->ssn != sctp2->ssn) {
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
// rv = calloc(1, sizeof(asn_comp_rval_t));
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
// return rv;
// } else {
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
// }
// }
// if (sctp1->ssn != sctp2->ssn) {
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
// rv = calloc(1, sizeof(asn_comp_rval_t));
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
// return rv;
// } else {
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
// }
// }
return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints);
}
//------------------------------------------------------------------------------
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints)
{
// no comparison for ports
asn_comp_rval_t *rv = NULL;
if (sctp1->chunk_type != sctp2->chunk_type){
if (sctp1->chunk_type != sctp2->chunk_type) {
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
return rv;
}
switch (sctp1->chunk_type) {
case SCTP_CID_DATA:
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
......@@ -93,9 +99,11 @@ asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_
case SCTP_CID_INIT:
AssertFatal(0, "Not needed now");
break;
case SCTP_CID_INIT_ACK:
AssertFatal(0, "Not needed now");
break;
default:
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -145,16 +145,16 @@ int main(int argc, char *argv[])
}
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
struct s1ap_message_s message;
S1AP_S1AP_PDU_t pdu;
uint8_t *buffer;
uint32_t length;
memset(&message, 0, sizeof(struct s1ap_message_s));
memset(&pdu, 0, sizeof(pdu));
printf("Trying to decode %s procedure with asn1c decoder\n",
s1ap_test[i].procedure_name);
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
printf("Failed to decode this message\n");
} else {
......@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
printf("Trying to encode %s procedure with asn1c encoder\n",
s1ap_test[i].procedure_name);
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
printf("Failed to encode this message on MME side, trying eNB side\n");
} else {
compare_buffer(buffer, length, s1ap_test[i].buffer, s1ap_test[i].buf_len);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment