Commit 1327efee authored by mir's avatar mir

Merge branch 'pkt_seg_demo' into bearer-control

parents fe63f1b1 09c3eb9b
......@@ -1188,7 +1188,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
rrc->um_on_default_drb = *(GNBParamList.paramarray[i][GNB_UMONDEFAULTDRB_IDX].uptr);
rrc->um_on_default_drb = 1; // *(GNBParamList.paramarray[i][GNB_UMONDEFAULTDRB_IDX].uptr);
if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {
} else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
......
......@@ -626,7 +626,11 @@ static void pf_dl(module_id_t module_id,
/* Calculate coeff */
const NR_bler_options_t *bo = &mac->dl_bler;
const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28;
const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table);
int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table);
if(max_mcs > 10)
max_mcs = 10;
if (bo->harq_round_max == 1)
sched_pdsch->mcs = max_mcs;
else
......
......@@ -32,6 +32,14 @@
#include "openair2/RRC/NR/nr_rrc_proto.h"
#include <stdint.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
/* from OAI */
#include "oai_asn1.h"
#include "nr_pdcp_oai_api.h"
......@@ -932,6 +940,8 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
{
if (drb2add_list != NULL) {
for (int i = 0; i < drb2add_list->list.count; i++) {
// assert(drb2add_list->list.count == rlc_bearer2add_list->list.count );
add_drb(enb_flag, rntiMaybeUEid, reestablish_ue_id, drb2add_list->list.array[i], rlc_bearer2add_list->list.array[i]->rlc_Config, security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kUPenc, kUPint);
}
} else
......
......@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "nr_rlc_pdu.h"
......@@ -480,6 +481,12 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
if (pdu_header_size + 1 > size)
return 0;
// mir Save BW when using TCP Cubic
if(pdu_header_size + sdu->size > size ){
return 0;
}
entity->tx_list = entity->tx_list->next;
if (entity->tx_list == NULL)
entity->tx_end = NULL;
......@@ -496,8 +503,11 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
if (pdu_size > size) {
nr_rlc_sdu_segment_t *next_sdu;
next_sdu = resegment(sdu, entity, size);
if (next_sdu == NULL)
printf("resegmenting \n");
if (next_sdu == NULL){
printf("next_sdu == NULL \n");
return 0;
}
/* put the second SDU back at the head of the TX list */
next_sdu->next = entity->tx_list;
entity->tx_list = next_sdu;
......@@ -511,11 +521,20 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
}
/* update tx_next if the SDU is an SDU segment and is the last */
if (!sdu->is_first && sdu->is_last)
if (!sdu->is_first && sdu->is_last){
printf("Updating the SN \n");
entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus;
}
ret = serialize_sdu(entity, sdu, buffer, size);
//uint8_t* a = (uint8_t*) buffer;
//uint8_t* b = (uint8_t*)(buffer+1);
//uint8_t* c = (uint8_t*)(buffer+2);
//uint8_t* d = (uint8_t*)(buffer+3);
//printf("a %u b %u c %u d %u \n",*a, *b, *c, *d);
entity->tx_size -= sdu->size;
entity->common.stats.txpdu_pkts++;
......@@ -525,8 +544,11 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
/* set time_of_arrival to 0 so as to update stats only once */
sdu->sdu->time_of_arrival = 0;
// sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
double av = time_average_get_average(entity->common.txsdu_avg_time_to_tx, time_average_now() );
printf("Average time in the RLC SDU %lf us \n", av);
}
nr_rlc_free_sdu_segment(sdu);
......@@ -595,8 +617,8 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity,
entity->common.bstatus.tx_size += compute_pdu_header_size(entity, sdu)
+ sdu->size;
if (entity->common.avg_time_is_on)
sdu->sdu->time_of_arrival = time_average_now();
// if (entity->common.avg_time_is_on)
sdu->sdu->time_of_arrival = time_average_now();
}
/*************************************************************************/
......
......@@ -100,8 +100,9 @@ void CU_update_UP_DL_tunnel(e1ap_bearer_setup_req_t *const req, instance_t insta
}
}
static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
rrc_gNB_ue_context_t *ue_context_p,
static
int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
rrc_gNB_ue_context_t *ue_context_p,
e1ap_bearer_setup_req_t *const req,
NR_DRB_ToAddModList_t *DRB_configList,
instance_t instance)
......@@ -110,6 +111,7 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0};
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
LOG_W(NR_RRC, "recreate existing tunnels, while adding new ones\n");
printf("UE->nb_of_pdusessions %d\n ", UE->nb_of_pdusessions );
for (int i = 0; i < UE->nb_of_pdusessions; i++) {
rrc_pdu_session_param_t *pdu = UE->pduSession + i;
create_tunnel_req.pdusession_id[i] = pdu->param.pdusession_id;
......@@ -158,31 +160,46 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
(UE->integrity_algorithm << 4) | UE->ciphering_algorithm,
kUPenc,
kUPint,
get_softmodem_params()->sa ? UE->masterCellGroup->rlc_BearerToAddModList : NULL);
rlc_bearer2add_list);
return ret;
}
static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const req, instance_t instance, uint8_t xid)
static NR_SRB_ToAddModList_t **generateSRB2_confList(gNB_RRC_UE_t *ue, NR_SRB_ToAddModList_t *SRB_configList, uint8_t xid)
{
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
SRB_configList2 = &ue->SRB_configList2[xid];
if (*SRB_configList2 == NULL) {
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
NR_SRB_ToAddMod_t *SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2;
asn1cSeqAdd(&(*SRB_configList2)->list, SRB2_config);
asn1cSeqAdd(&SRB_configList->list, SRB2_config);
}
return SRB_configList2;
}
static
void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const req, instance_t instance, uint8_t xid)
{
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[instance], req->rnti);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
protocol_ctxt_t ctxt = {0};
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rnti, 0, 0, 0);
// mir
if(UE->DRB_configList != NULL && get_softmodem_params()->sa){
assert(UE->DRB_configList->list.count == UE->masterCellGroup->rlc_BearerToAddModList->list.count);
}
fill_DRB_configList(&ctxt, ue_context_p, xid);
e1ap_bearer_setup_resp_t resp = {0};
resp.numPDUSessions = req->numPDUSessions;
for (int i = 0; i < resp.numPDUSessions; ++i) {
resp.pduSession[i].numDRBSetup = req->pduSession[i].numDRB2Setup;
for (int j = 0; j < req->pduSession[i].numDRB2Setup; j++) {
DRB_nGRAN_to_setup_t *req_drb = req->pduSession[i].DRBnGRanList + j;
DRB_nGRAN_setup_t *resp_drb = resp.pduSession[i].DRBnGRanList + j;
resp_drb->id = req_drb->id;
resp_drb->numQosFlowSetup = req_drb->numQosFlow2Setup;
for (int k = 0; k < resp_drb->numQosFlowSetup; k++)
resp_drb->qosFlows[k].id = req_drb->qosFlows[k].id;
}
// mir
if(UE->DRB_configList != NULL && get_softmodem_params()->sa){
assert(UE->DRB_configList->list.count == UE->masterCellGroup->rlc_BearerToAddModList->list.count);
}
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
......
......@@ -731,7 +731,7 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins
{
protocol_ctxt_t ctxt={0};
ngap_pdusession_setup_req_t* msg=&NGAP_PDUSESSION_SETUP_REQ(msg_p);
ngap_pdusession_setup_req_t* msg = &NGAP_PDUSESSION_SETUP_REQ(msg_p);
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], msg->gNB_ue_ngap_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rnti, 0, 0, 0);
......@@ -777,7 +777,7 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins
pdu->confidentialityProtectionIndication = rrc->security.do_drb_ciphering ? E1AP_ConfidentialityProtectionIndication_required : E1AP_ConfidentialityProtectionIndication_not_needed;
pdu->teId = session->gtp_teid;
memcpy(&pdu->tlAddress, session->upf_addr.buffer, 4); // Fixme: dirty IPv4 target
pdu->numDRB2Setup = 1; // One DRB per PDU Session. TODO: Remove hardcoding
pdu->numDRB2Setup = 2; // One DRB per PDU Session. TODO: Remove hardcoding
for (int j=0; j < pdu->numDRB2Setup; j++) {
DRB_nGRAN_to_setup_t *drb = pdu->DRBnGRanList + j;
......
......@@ -14,6 +14,7 @@ gNBs =
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) });
nr_cellid = 12345678L;
min_rxtxtime=6;
////////// Physical parameters:
......
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