Commit 70a43df6 authored by Fang-WANG's avatar Fang-WANG

merge srb and rrc

parents 287f47bf 21f36b24
......@@ -1969,6 +1969,7 @@ set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c
)
set(L2_SRC
......
......@@ -188,7 +188,22 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) {
void print_difftimes(void) {
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
}
int create_tasks_nrue(uint32_t ue_nb) {
LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
itti_wait_ready(1);
if (ue_nb > 0) {
LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
}
itti_wait_ready(0);
return 0;
}
void exit_function(const char *file, const char *function, const int line, const char *s) {
int CC_id;
......@@ -585,6 +600,16 @@ int main( int argc, char **argv ) {
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
protocol_ctxt_t ctxt_pP = {0};
ctxt_pP.enb_flag = ENB_FLAG_NO;
ctxt_pP.rnti = 0x1234;
rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0);
while(true)
sleep(3600);
......
......@@ -391,6 +391,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
LOG_D(PHY,"%02x\n",a[i]);
LOG_D(PHY,"\n");
*/
log_dump(PHY, a, 16, LOG_DUMP_CHAR,"gNB pdsch tx frame %d %d: ", frame, slot);
if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload
......
......@@ -735,6 +735,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT);
dlsch->last_iteration_cnt = ret;
log_dump(PHY, harq_process->b, 16, LOG_DUMP_CHAR,"nrue pdsch rx frame %d %d: ", frame, nr_slot_rx );
return(ret);
}
......
......@@ -157,7 +157,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
///////////
////////////////////////////////////////////////////////////////////
log_dump(PHY, harq_process_ul_ue->a, 16, LOG_DUMP_CHAR,"nrue pusch tx frame %d %d: ", frame, slot);
/////////////////////////ULSCH scrambling/////////////////////////
///////////
......
......@@ -265,8 +265,9 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0);
log_dump(PHY, ulsch_harq->b, 16, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", ulsch_harq->frame, ulsch_harq->slot);
} else {
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
rdata->harq_pid,ulsch_harq->status, ulsch_harq->round,ulsch_harq->TBS,r);
if (ulsch_harq->round >= ulsch->Mlimit) {
......
......@@ -1016,7 +1016,9 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
return (FALSE);
}
/* check if resource indexing by pucch_resource_indicator of this set is compatible */
if ((ready_pucch_resource_id == TRUE) || (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0] != MAX_NB_OF_PUCCH_RESOURCES)) {
if ((ready_pucch_resource_id == TRUE)
|| ((mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator] != NULL)
&& (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0] != MAX_NB_OF_PUCCH_RESOURCES))) {
if (ready_pucch_resource_id == TRUE) {
current_resource_id = *resource_id;
......
......@@ -29,6 +29,7 @@
***************************************************************************/
#include "LTE_asn_constant.h"
#include "NR_asn_constant.h"
#ifndef __PLATFORM_CONSTANTS_H__
# define __PLATFORM_CONSTANTS_H__
......@@ -103,6 +104,7 @@
#define DEFAULT_RAB_ID 1
#define NB_RB_MAX (LTE_maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
#define NR_NB_RB_MAX (NR_maxDRB + 3)
#define NB_RB_MBMS_MAX (LTE_maxSessionPerPMCH*LTE_maxServiceCount)
......
......@@ -55,7 +55,7 @@
#define HALFWORD 16
#define WORD 32
//#define SIZE_OF_POINTER sizeof (void *)
static boolean_t loop_dcch_dtch = TRUE;
int nr_generate_dlsch_pdu(module_id_t module_idP,
NR_UE_sched_ctrl_t *ue_sched_ctl,
unsigned char *sdus_payload,
......@@ -393,8 +393,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
{
/* Retrieve amount of data to send for this UE */
sched_ctrl->num_total_bytes = 0;
const int lcid = DL_SCH_LCID_DTCH;
loop_dcch_dtch = BOOL_NOT(loop_dcch_dtch);
const int lcid = loop_dcch_dtch?DL_SCH_LCID_DTCH:DL_SCH_LCID_DCCH;
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
......@@ -406,6 +406,13 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
0,
0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
LOG_I(MAC,
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
frame,
slot,
lcid,
sched_ctrl->num_total_bytes);
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
......@@ -723,7 +730,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
uint16_t sdu_lengths[NB_RB_MAX] = {0};
uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES];
unsigned char sdu_lcids[NB_RB_MAX] = {0};
const int lcid = DL_SCH_LCID_DTCH;
const int lcid = loop_dcch_dtch?DL_SCH_LCID_DTCH:DL_SCH_LCID_DCCH;
if (sched_ctrl->num_total_bytes > 0) {
/* this is the data from the RLC we would like to request (e.g., only
* some bytes for first LC and some more from a second one */
......
......@@ -179,11 +179,7 @@ void nr_process_mac_pdu(
// end of MAC PDU, can ignore the rest.
break;
// MAC SDUs
case UL_SCH_LCID_SRB1:
// todo
break;
case UL_SCH_LCID_SRB2:
case UL_SCH_LCID_SRB2:
// todo
break;
case UL_SCH_LCID_SRB3:
......@@ -197,6 +193,8 @@ void nr_process_mac_pdu(
mac_subheader_len = 2;
break;
// MAC SDUs
case UL_SCH_LCID_SRB1:
case UL_SCH_LCID_DTCH:
// check if LCID is valid at current time.
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
......@@ -210,7 +208,7 @@ void nr_process_mac_pdu(
mac_subheader_len = 2;
}
LOG_D(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
LOG_I(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
int UE_id = find_nr_UE_id(module_idP, rnti);
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
......
......@@ -22,6 +22,7 @@
#include "nr_pdcp_entity.h"
#include "nr_pdcp_entity_drb_am.h"
#include "nr_pdcp_entity_srb.h"
#include "LOG/log.h"
......@@ -34,7 +35,32 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_srb(
char *buf, int size, int sdu_id),
void *deliver_pdu_data)
{
abort();
nr_pdcp_entity_srb_t *ret;
ret = calloc(1, sizeof(nr_pdcp_entity_srb_t));
if (ret == NULL) {
LOG_E(PDCP, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
ret->common.recv_pdu = nr_pdcp_entity_srb_recv_pdu;
ret->common.recv_sdu = nr_pdcp_entity_srb_recv_sdu;
ret->common.set_integrity_key = nr_pdcp_entity_srb_set_integrity_key;
ret->common.delete = nr_pdcp_entity_srb_delete;
ret->common.deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data;
ret->common.deliver_pdu = deliver_pdu;
ret->common.deliver_pdu_data = deliver_pdu_data;
ret->srb_id = rb_id;
ret->common.maximum_nr_pdcp_sn = 4095;
return (nr_pdcp_entity_t *)ret;
}
nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am(
......
......@@ -23,17 +23,18 @@
#ifndef _NR_PDCP_ENTITY_H_
#define _NR_PDCP_ENTITY_H_
#include "platform_types.h"
typedef struct nr_pdcp_entity_t {
/* functions provided by the PDCP module */
void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_pdu)(protocol_ctxt_t *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void (*delete)(struct nr_pdcp_entity_t *entity);
void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key);
/* callbacks provided to the PDCP module */
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
void (*deliver_sdu)(protocol_ctxt_t *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size);
void *deliver_sdu_data;
void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity,
......
......@@ -26,7 +26,7 @@
#include <string.h>
#include "common/utils/LOG/log.h"
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size)
void nr_pdcp_entity_drb_am_recv_pdu( protocol_ctxt_t *ctxt_pP , nr_pdcp_entity_t *_entity, char *buffer, int size)
{
nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity;
......@@ -35,7 +35,7 @@ void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int
if (!(buffer[0] & 0x80))
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
entity->common.deliver_sdu(entity->common.deliver_sdu_data,
entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+3, size-3);
}
......
......@@ -23,6 +23,7 @@
#define _NR_PDCP_ENTITY_DRB_AM_H_
#include "nr_pdcp_entity.h"
#include "platform_types.h"
typedef struct {
nr_pdcp_entity_t common;
......@@ -32,7 +33,7 @@ typedef struct {
int discard_timer; /* unit: ms, -1 means infinity */
} nr_pdcp_entity_drb_am_t;
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_pdu(protocol_ctxt_t *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key);
......
/*
* 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.1 (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
*/
#include "nr_pdcp_entity_srb.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size)
{
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
if (size < 2) abort();
entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+2, size-6);
}
void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size,
int sdu_id)
{
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
int sn;
char buf[size+6];
sn = entity->common.next_nr_pdcp_tx_sn;
entity->common.next_nr_pdcp_tx_sn++;
if (entity->common.next_nr_pdcp_tx_sn > entity->common.maximum_nr_pdcp_sn) {
entity->common.next_nr_pdcp_tx_sn = 0;
entity->common.tx_hfn++;
}
buf[0] = (sn >> 8) & 0x0f;
buf[1] = sn & 0xff;
memcpy(buf+2, buffer, size);
/* For now use padding for the MAC-I bytes (normally carrying message authentication code)
* which come after the data payload bytes (38.323, section 6.2.2.1) */
for (int i=size+2; i<size+6; i++)
buf[i] = 0x11*(i-size-1);
entity->common.deliver_pdu(entity->common.deliver_pdu_data,
(nr_pdcp_entity_t *)entity, buf, size+6, sdu_id);
}
void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key)
{
/* nothing to do */
}
void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity)
{
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
free(entity);
}
/*
* 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.1 (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
*/
#ifndef _NR_PDCP_ENTITY_SRB_H_
#define _NR_PDCP_ENTITY_SRB_H_
#include "nr_pdcp_entity.h"
typedef struct {
nr_pdcp_entity_t common;
int srb_id;
} nr_pdcp_entity_srb_t;
void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size);
void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, int sdu_id);
void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key);
void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity);
#endif /* _NR_PDCP_ENTITY_SRB_H_ */
This diff is collapsed.
......@@ -766,6 +766,78 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void srb_add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int srb_id = 1;
int channel_id = 1;//rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group;
int t_status_prohibit;
int t_poll_retransmit;
int poll_pdu;
int poll_byte;
int max_retx_threshold;
int t_reassembly;
int sn_field_length;
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
/* TODO: accept other values? */
if (logical_channel_group != 1) {
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
switch (r->present) {
case NR_RLC_Config_PR_am: {
struct NR_RLC_Config__am *am;
am = r->choice.am;
t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit);
t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit);
poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte);
max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold);
if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength);
break;
}
default:
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) {
LOG_W(RLC, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else {
nr_rlc_am = new_nr_rlc_entity_am(100000,
100000,
deliver_sdu, ue,
successful_delivery, ue,
max_retx_reached, ue,
t_poll_retransmit,
t_reassembly, t_status_prohibit,
poll_pdu, poll_byte, max_retx_threshold,
sn_field_length);
//nr_rlc_ue_add_drb_rlc_entity(ue, srb_id, nr_rlc_am);
ue->srb[srb_id-1] = nr_rlc_am;
LOG_I(RLC, "%s:%d:%s: added srb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
......@@ -834,6 +906,75 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void srb_add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
{
nr_rlc_entity_t *nr_rlc_um;
nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int srb_id = 1;
int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group;
int sn_field_length;
int t_reassembly;
// if (!(drb_id >= 1 && drb_id <= 5)) {
// LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n",
// __FILE__, __LINE__, __FUNCTION__, drb_id);
// exit(1);
// }
// if (channel_id != drb_id + 3) {
// LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n",
// __FILE__, __LINE__, __FUNCTION__);
// exit(1);
// }
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
/* TODO: accept other values? */
if (logical_channel_group != 1) {
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
switch (r->present) {
case NR_RLC_Config_PR_um_Bi_Directional: {
struct NR_RLC_Config__um_Bi_Directional *um;
um = r->choice.um_Bi_Directional;
t_reassembly = decode_t_reassembly(um->dl_UM_RLC.t_Reassembly);
if (*um->dl_UM_RLC.sn_FieldLength != *um->ul_UM_RLC.sn_FieldLength) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
sn_field_length = decode_sn_field_length_um(*um->dl_UM_RLC.sn_FieldLength);
break;
}
default:
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) {
LOG_W(RLC, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else {
nr_rlc_um = new_nr_rlc_entity_um(1000000,
1000000,
deliver_sdu, ue,
t_reassembly,
sn_field_length);
// nr_rlc_ue_add_drb_rlc_entity(ue, srb_id, nr_rlc_um);
ue->srb[srb_id-1] = nr_rlc_um;
LOG_I(RLC, "%s:%d:%s: added srb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerConfig *rlc_BearerConfig)
{
......@@ -895,7 +1036,8 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
if (srb2add_listP != NULL) {
for (i = 0; i < srb2add_listP->list.count; i++) {
add_srb(rnti, srb2add_listP->list.array[i]);
// add_srb(rnti, srb2add_listP->list.array[i]);
srb_add_drb_am(rnti, drb2add_listP->list.array[0], rlc_bearer2add_list->list.array[0]);
}
}
......
......@@ -108,8 +108,8 @@ nr_rrc_data_req(
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
* messages automatically */
if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
pdcp_run(ctxt_pP);
// if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
// pdcp_run(ctxt_pP);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
......
......@@ -68,6 +68,7 @@
#include "NR_SDAP-Config.h"
#include "NR_RRCReconfigurationComplete.h"
#include "NR_RRCReconfigurationComplete-IEs.h"
#include "NR_DLInformationTransfer.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h"
......@@ -1260,3 +1261,64 @@ int do_DLInformationTransfer_NR (void * p) {
return 0;
}
//------------------------------------------------------------------------------
uint8_t
do_NR_DLInformationTransfer(
uint8_t Mod_id,
uint8_t **buffer,
uint8_t transaction_id,
uint32_t pdu_length,
uint8_t *pdu_buffer
)
//------------------------------------------------------------------------------
{
ssize_t encoded;
NR_DL_DCCH_Message_t dl_dcch_msg;
memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t));
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
dl_dcch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_DCCH_MessageType__c1));
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer;
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer = CALLOC(1, sizeof(NR_DLInformationTransfer_t));
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->rrc_TransactionIdentifier = transaction_id;
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->criticalExtensions.present =
NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer;
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->
criticalExtensions.choice.dlInformationTransfer = CALLOC(1, sizeof(NR_DLInformationTransfer_IEs_t));
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->
criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t));
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->
criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message->buf = pdu_buffer;
dl_dcch_msg.message.choice.c1->choice.dlInformationTransfer->
criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message->size = pdu_length;
encoded = uper_encode_to_new_buffer (&asn_DEF_NR_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **)buffer);
AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n",
"DLInformationTransfer", encoded);
LOG_D(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded);
return encoded;
}
uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) {
ssize_t encoded;
NR_UL_DCCH_Message_t ul_dcch_msg;
memset(&ul_dcch_msg, 0, sizeof(NR_UL_DCCH_Message_t));
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1));
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer;
ul_dcch_msg.message.choice.c1->choice.ulInformationTransfer = CALLOC(1,sizeof(struct NR_ULInformationTransfer));
ul_dcch_msg.message.choice.c1->choice.ulInformationTransfer->criticalExtensions.present = NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer;
ul_dcch_msg.message.choice.c1->choice.ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer = CALLOC(1,sizeof(struct NR_ULInformationTransfer_IEs));
struct NR_ULInformationTransfer_IEs *ulInformationTransfer = ul_dcch_msg.message.choice.c1->choice.ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer;
ulInformationTransfer->dedicatedNAS_Message = CALLOC(1,sizeof(NR_DedicatedNAS_Message_t));
ulInformationTransfer->dedicatedNAS_Message->buf = pdu_buffer;
ulInformationTransfer->dedicatedNAS_Message->size = pdu_length;
ulInformationTransfer->lateNonCriticalExtension = NULL;
encoded = uper_encode_to_new_buffer (&asn_DEF_NR_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, (void **) buffer);
AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n",
"ULInformationTransfer",encoded);
LOG_D(NR_RRC,"ULInformationTransfer Encoded %zd bytes\n",encoded);
return encoded;
}
......@@ -402,6 +402,16 @@ rrc_gNB_generate_RRCSetup(
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
log_dump(NR_RRC, ue_p->Srb0.Tx_buffer.Payload, 16, LOG_DUMP_CHAR,"RRCSetup size: ");
nr_rrc_data_req(ctxt_pP,
DCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
ue_p->Srb0.Tx_buffer.payload_size,
ue_p->Srb0.Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
......@@ -946,7 +956,7 @@ rrc_gNB_decode_dcch(
sdu_sizeP,
0,
0);
// xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
{
for (i = 0; i < sdu_sizeP; i++) {
......@@ -1298,13 +1308,14 @@ void *rrc_gnb_task(void *args_p) {
/* Messages from MAC */
case NR_RRC_MAC_CCCH_DATA_IND:
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
// NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index,
// GNB_FLAG_YES,
// NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
// msg_p->ittiMsgHeader.lte_time.frame,
// msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index,
GNB_FLAG_YES,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %d, CC_id %d, ctxt %p, size %d\n",
ctxt.rnti,
instance,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
&ctxt,
......@@ -1324,12 +1335,17 @@ void *rrc_gnb_task(void *args_p) {
/* Messages from PDCP */
case NR_RRC_DCCH_DATA_IND:
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
// instance,
// ENB_FLAG_YES,
// RRC_DCCH_DATA_IND(msg_p).rnti,
// msg_p->ittiMsgHeader.lte_time.frame,
// msg_p->ittiMsgHeader.lte_time.slot);
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
instance,
ENB_FLAG_YES,
RRC_DCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding DCCH : ue %d, inst %d, ctxt %p, size %d\n",
ctxt.rnti,
instance,
&ctxt,
NR_RRC_DCCH_DATA_IND(msg_p).sdu_size);
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(&ctxt),
NR_RRC_DCCH_DATA_IND(msg_p).dcch_index,
......
......@@ -129,7 +129,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
*secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex;
secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync));
secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff);
secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=0x1234;//(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff);
secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL;
......
......@@ -84,11 +84,11 @@ rrc_data_req_ue(
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
message_buffer = itti_malloc (
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
TASK_RRC_UE,
TASK_PDCP_UE,
sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
message_p = itti_alloc_new_message ( TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
......
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