dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel;
+ F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t));
+
+ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress);
+
+ OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204",
+ strlen("1204"));
+
+ dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel;
+
+ ASN_SEQUENCE_ADD(&drbs_modified_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item);
+ }
+
+ /* ADD */
+ drbs_modified_item_ies->value.choice.DRBs_Modified_Item = drbs_modified_item;
+ ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Modified_List.list,
+ drbs_modified_item_ies);
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+ /* mandatory */
+ /* c7. SRBs_FailedToBeSetupMod_List */
+ ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List;
+ ie->criticality = F1AP_Criticality_reject;
+ ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List;
+
+ for (i=0;
+ i<1;
+ i++) {
+ //
+ F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *srbs_failedToBeSetupMod_item_ies;
+ srbs_failedToBeSetupMod_item_ies = (F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t));
+ srbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_Item;
+ srbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore;
+ srbs_failedToBeSetupMod_item_ies->value.present = F1AP_SRBs_FailedToBeSetupMod_ItemIEs__value_PR_SRBs_FailedToBeSetupMod_Item;
+
+ /* 9.1 SRBs_FailedToBeSetupMod_Item */
+ F1AP_SRBs_FailedToBeSetupMod_Item_t srbs_failedToBeSetupMod_item;
+ memset((void *)&srbs_failedToBeSetupMod_item, 0, sizeof(F1AP_SRBs_FailedToBeSetupMod_Item_t));
+
+ /* - sRBID */
+ srbs_failedToBeSetupMod_item.sRBID = 50L;
+
+ srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t));
+ srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork;
+ srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id;
+
+ /* ADD */
+ srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item;
+ ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list,
+ srbs_failedToBeSetupMod_item_ies);
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+ /* mandatory */
+ /* c8. DRBs_FailedToBeSetupMod_List */
+ ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List;
+ ie->criticality = F1AP_Criticality_reject;
+ ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List;
+
+ for (i=0;
+ i<1;
+ i++) {
+ //
+ F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *drbs_failedToBeSetupMod_item_ies;
+ drbs_failedToBeSetupMod_item_ies = (F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t));
+ drbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_Item;
+ drbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_reject;
+ drbs_failedToBeSetupMod_item_ies->value.present = F1AP_DRBs_FailedToBeSetupMod_ItemIEs__value_PR_DRBs_FailedToBeSetupMod_Item;
+
+ /* 10.1 DRBs_ToBeSetupMod_Item */
+ F1AP_DRBs_FailedToBeSetupMod_Item_t drbs_failedToBeSetupMod_item;
+ memset((void *)&drbs_failedToBeSetupMod_item, 0, sizeof(F1AP_DRBs_FailedToBeSetupMod_Item_t));
+
+ /* dRBID */
+ drbs_failedToBeSetupMod_item.dRBID = 30L;
+
+ drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t));
+ drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork;
+ drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id;
+
+ /* ADD */
+ drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item;
+ ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list,
+ drbs_failedToBeSetupMod_item_ies);
+
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+
+ /* mandatory */
+ /* c9. SCell_FailedtoSetupMod_List */
+ ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List;
+ ie->criticality = F1AP_Criticality_ignore;
+ ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List;
+
+ for (i=0;
+ i<1;
+ i++) {
+ //
+ F1AP_SCell_FailedtoSetupMod_ItemIEs_t *scell_failedtoSetupMod_item_ies;
+ scell_failedtoSetupMod_item_ies = (F1AP_SCell_FailedtoSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetupMod_ItemIEs_t));
+ scell_failedtoSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_Item;
+ scell_failedtoSetupMod_item_ies->criticality = F1AP_Criticality_ignore;
+ scell_failedtoSetupMod_item_ies->value.present = F1AP_SCell_FailedtoSetupMod_ItemIEs__value_PR_SCell_FailedtoSetupMod_Item;
+
+ /* 8.1 SCell_ToBeSetup_Item */
+ F1AP_SCell_FailedtoSetupMod_Item_t scell_failedtoSetupMod_item;
+ memset((void *)&scell_failedtoSetupMod_item, 0, sizeof(F1AP_SCell_FailedtoSetupMod_Item_t));
+
+ /* - sCell_ID */
+ F1AP_NRCGI_t nRCGI;
+ MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i],
+ &nRCGI.pLMN_Identity);
+
+ NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity);
+
+ scell_failedtoSetupMod_item.sCell_ID = nRCGI;
+
+ scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t));
+ scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork;
+ scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id;
+
+ /* ADD */
+ scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item;
+ ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list,
+ scell_failedtoSetupMod_item_ies);
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+ /* mandatory */
+ /* c10. DRBs_FailedToBeModified_List */
+ ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List;
+ ie->criticality = F1AP_Criticality_reject;
+ ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List;
+
+ for (i=0;
+ i<1;
+ i++) {
+ //
+ F1AP_DRBs_FailedToBeModified_ItemIEs_t *drbs_failedToBeModified_item_ies;
+ drbs_failedToBeModified_item_ies = (F1AP_DRBs_FailedToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeModified_ItemIEs_t));
+ drbs_failedToBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_Item;
+ drbs_failedToBeModified_item_ies->criticality = F1AP_Criticality_reject;
+ drbs_failedToBeModified_item_ies->value.present = F1AP_DRBs_FailedToBeModified_ItemIEs__value_PR_DRBs_FailedToBeModified_Item;
+
+ /* 13.1 DRBs_FailedToBeModified_Item */
+ F1AP_DRBs_FailedToBeModified_Item_t drbs_failedToBeModified_item;
+ memset((void *)&drbs_failedToBeModified_item, 0, sizeof(F1AP_DRBs_FailedToBeModified_Item_t));
+
+ /* dRBID */
+ drbs_failedToBeModified_item.dRBID = 30L;
+
+ drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t));
+ drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork;
+ drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id;
+
+ /* ADD */
+ drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item;
+ ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list,
+ drbs_failedToBeModified_item_ies);
+
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
+ // /* */
+ /* c11. CriticalityDiagnostics */
+ if (0) {
+ ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
+ ie->criticality = F1AP_Criticality_ignore;
+ ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics;
+
+ // dummy value
+ /* optional */
+ /* procedureCode */
+ if (0) {
+ ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t));
+ ie->value.choice.CriticalityDiagnostics.procedureCode = 0L;
+ }
+
+ /* optional */
+ /* triggeringMessage */
+ if (0) {
+ ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t));
+ ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome;
+ }
+
+ /* optional */
+ /* procedureCriticality */
+ if (0) {
+ ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t));
+ ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject;
+ }
+
+ /* optional */
+ /* transactionID */
+ if (0) {
+ ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t));
+ ie->value.choice.CriticalityDiagnostics.transactionID = 0L;
+ }
+
+ /* optional */
+ /* F1AP_CriticalityDiagnostics_IE_List */
+ if (0) {
+ for (i=0;
+ i<0;
+ i++) {
+
+ F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));;
+ criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject;
+ criticalityDiagnostics_ie_item->iE_ID = 0L;
+ criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood;
+
+ ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list,
+ criticalityDiagnostics_ie_item);
+ }
+ }
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+ }
+
+ /* encode */
+ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
+ LOG_E(F1AP, "Failed to encode F1 setup request\n");
+ return -1;
+ }
+
+ //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
+ return 0;
+
+}
+
+int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance) {
+ AssertFatal(1==0,"Not implemented yet\n");
+}
+
+int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance) {
+ AssertFatal(1==0,"Not implemented yet\n");
+}
+
+int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance,
+ uint32_t assoc_id,
+ uint32_t stream,
+ F1AP_F1AP_PDU_t *pdu) {
+ AssertFatal(1==0,"Not implemented yet\n");
+}
diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h
new file mode 100644
index 0000000000..2bb3ca95b9
--- /dev/null
+++ b/openair2/F1AP/f1ap_du_ue_context_management.h
@@ -0,0 +1,97 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_du_ue_context_management.h
+ * \brief f1ap ue context management for DU
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#ifndef F1AP_DU_UE_CONTEXT_MANAGEMENT_H_
+#define F1AP_DU_UE_CONTEXT_MANAGEMENT_H_
+
+/*
+ * UE Context Setup
+ */
+int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
+ uint32_t assoc_id,
+ uint32_t stream,
+ F1AP_F1AP_PDU_t *pdu);
+int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance);
+int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance);
+
+
+/*
+ * UE Context Release Request (gNB-DU initiated)
+ */
+int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
+ f1ap_ue_context_release_req_t *req);
+
+
+/*
+ * UE Context Release Command (gNB-CU initiated)
+ */
+int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
+ uint32_t assoc_id,
+ uint32_t stream,
+ F1AP_F1AP_PDU_t *pdu);
+
+/*
+ * UE Context Release Complete (gNB-DU initiated)
+ */
+int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
+ f1ap_ue_context_release_cplt_t *cplt);
+
+
+/*
+ * UE Context Modification (gNB-CU initiated)
+ */
+int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance,
+ uint32_t assoc_id,
+ uint32_t stream,
+ F1AP_F1AP_PDU_t *pdu);
+int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance);
+int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance);
+
+
+/*
+ * UE Context Modification Required (gNB-DU initiated)
+ */
+int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance);
+int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance,
+ uint32_t assoc_id,
+ uint32_t stream,
+ F1AP_F1AP_PDU_t *pdu);
+
+/*
+ * UE Inactivity Notification
+ */
+
+/*
+ * Notify
+ */
+
+#endif /* F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ */
diff --git a/openair2/F1AP/f1ap_du_warning_message_transmission.c b/openair2/F1AP/f1ap_du_warning_message_transmission.c
new file mode 100644
index 0000000000..b6bbedba2f
--- /dev/null
+++ b/openair2/F1AP/f1ap_du_warning_message_transmission.c
@@ -0,0 +1,31 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_du_interface_management.h
+ * \brief f1ap interface management for DU
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
\ No newline at end of file
diff --git a/openair2/F1AP/f1ap_du_warning_message_transmission.h b/openair2/F1AP/f1ap_du_warning_message_transmission.h
new file mode 100644
index 0000000000..b6bbedba2f
--- /dev/null
+++ b/openair2/F1AP/f1ap_du_warning_message_transmission.h
@@ -0,0 +1,31 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_du_interface_management.h
+ * \brief f1ap interface management for DU
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
\ No newline at end of file
diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c
new file mode 100644
index 0000000000..e448690139
--- /dev/null
+++ b/openair2/F1AP/f1ap_encoder.c
@@ -0,0 +1,376 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_encoder.c
+ * \brief f1ap pdu encode procedures
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include "f1ap_common.h"
+#include "f1ap_encoder.h"
+
+int asn1_encoder_xer_print = 0;
+
+/*
+static inline int f1ap_encode_initiating(f1ap_message *message,
+ uint8_t **buffer,
+ uint32_t *len);
+
+static inline int f1ap_encode_successfull_outcome(f1ap_message *message,
+ uint8_t **buffer, uint32_t *len);
+
+static inline int f1ap_encode_unsuccessfull_outcome(f1ap_message *message,
+ uint8_t **buffer, uint32_t *len);
+
+static inline int f1ap_encode_f1_setup_request(
+ F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs, uint8_t **buffer, uint32_t *length);
+
+static inline int f1ap_encode_trace_failure(F1ap_TraceFailureIndicationIEs_t
+ *trace_failure_ies_p, uint8_t **buffer,
+ uint32_t *length);
+
+static inline int f1ap_encode_initial_context_setup_response(
+ F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
+ uint8_t **buffer,
+ uint32_t *length);
+
+static inline
+int f1ap_encode_ue_context_release_complete(
+ F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs,
+ uint8_t **buffer,
+ uint32_t *length);
+
+static inline
+int f1ap_encode_ue_context_release_request(
+ F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs,
+ uint8_t **buffer,
+ uint32_t *length);
+ */
+
+int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length)
+{
+ ssize_t encoded;
+ DevAssert(pdu != NULL);
+ DevAssert(buffer != NULL);
+ DevAssert(length != NULL);
+
+ if (asn1_encoder_xer_print) {
+ LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT START ----------------- \n");
+ xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
+ LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n");
+ }
+
+ encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer);
+
+ if (encoded < 0) {
+ LOG_E(F1AP, "Failed to encode F1AP message\n");
+ return -1;
+ }
+
+ *length = encoded;
+
+ return encoded;
+}
+
+/*
+static inline
+int f1ap_encode_initiating(f1ap_message *f1ap_message_p,
+ uint8_t **buffer, uint32_t *len)
+{
+ int ret = -1;
+ MessageDef *message_p;
+ char *message_string = NULL;
+ size_t message_string_size;
+ MessagesIds message_id;
+
+ DevAssert(f1ap_message_p != NULL);
+
+ message_string = calloc(10000, sizeof(char));
+
+ f1ap_string_total_size = 0;
+
+ switch(f1ap_message_p->procedureCode) {
+ case F1ap_ProcedureCode_id_F1Setup:
+ ret = f1ap_encode_f1_setup_request(
+ &f1ap_message_p->msg.f1ap_F1SetupRequestIEs, buffer, len);
+ //f1ap_xer_print_f1ap_f1setuprequest(f1ap_xer__print2sp, message_string, f1ap_message_p);
+ message_id = F1AP_F1_SETUP_LOG;
+ break;
+
+ case F1ap_ProcedureCode_id_UEContextReleaseRequest:
+ ret = f1ap_encode_ue_context_release_request(
+ &f1ap_message_p->msg.f1ap_UEContextReleaseRequestIEs, buffer, len);
+ //f1ap_xer_print_f1ap_uecontextreleaserequest(f1ap_xer__print2sp,
+ // message_string, f1ap_message_p);
+ message_id = F1AP_UE_CONTEXT_RELEASE_REQ_LOG;
+ break;
+
+
+ default:
+ F1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
+ (int)f1ap_message_p->procedureCode);
+ return ret;
+ break;
+ }
+
+ message_string_size = strlen(message_string);
+
+ message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText));
+ message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size;
+ memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+
+ free(message_string);
+
+ return ret;
+}
+
+static inline
+int f1ap_encode_successfull_outcome(f1ap_message *f1ap_message_p,
+ uint8_t **buffer, uint32_t *len)
+{
+ int ret = -1;
+ MessageDef *message_p;
+ char *message_string = NULL;
+ size_t message_string_size;
+ MessagesIds message_id;
+
+ DevAssert(f1ap_message_p != NULL);
+
+ message_string = calloc(10000, sizeof(char));
+
+ f1ap_string_total_size = 0;
+ message_string_size = strlen(message_string);
+
+
+ switch(f1ap_message_p->procedureCode) {
+ case F1ap_ProcedureCode_id_InitialContextSetup:
+ ret = f1ap_encode_initial_context_setup_response(
+ &f1ap_message_p->msg.f1ap_InitialContextSetupResponseIEs, buffer, len);
+
+ f1ap_xer_print_f1ap_initialcontextsetupresponse(f1ap_xer__print2sp, message_string, f1ap_message_p);
+ message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
+ message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText));
+ message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size;
+ memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size);
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ free(message_string);
+ break;
+
+ case F1ap_ProcedureCode_id_UEContextRelease:
+ ret = f1ap_encode_ue_context_release_complete(
+ &f1ap_message_p->msg.f1ap_UEContextReleaseCompleteIEs, buffer, len);
+ f1ap_xer_print_f1ap_uecontextreleasecomplete(f1ap_xer__print2sp, message_string, f1ap_message_p);
+ message_id = F1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
+ message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText));
+ message_p->ittiMsg.f1ap_ue_context_release_complete_log.size = message_string_size;
+ memcpy(&message_p->ittiMsg.f1ap_ue_context_release_complete_log.text, message_string, message_string_size);
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ free(message_string);
+ break;
+
+ default:
+ F1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
+ (int)f1ap_message_p->procedureCode);
+ return ret;
+ break;
+ }
+
+
+ return ret;
+}
+
+static inline
+int f1ap_encode_unsuccessfull_outcome(f1ap_message *f1ap_message_p,
+ uint8_t **buffer, uint32_t *len)
+{
+ int ret = -1;
+ MessageDef *message_p;
+ char *message_string = NULL;
+ size_t message_string_size;
+ MessagesIds message_id;
+
+ DevAssert(f1ap_message_p != NULL);
+
+ message_string = calloc(10000, sizeof(char));
+
+ f1ap_string_total_size = 0;
+
+ switch(f1ap_message_p->procedureCode) {
+ case F1ap_ProcedureCode_id_InitialContextSetup:
+ // ret = f1ap_encode_f1ap_initialcontextsetupfailureies(
+ // &f1ap_message_p->ittiMsg.f1ap_InitialContextSetupFailureIEs, buffer, len);
+ f1ap_xer_print_f1ap_initialcontextsetupfailure(f1ap_xer__print2sp, message_string, f1ap_message_p);
+ message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
+ break;
+
+ default:
+ F1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
+ (int)f1ap_message_p->procedureCode);
+ return ret;
+ break;
+ }
+
+ message_string_size = strlen(message_string);
+
+ message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText));
+ message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size;
+ memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+
+ free(message_string);
+
+ return ret;
+}
+
+static inline
+int f1ap_encode_f1_setup_request(
+ F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs,
+ uint8_t **buffer,
+ uint32_t *length)
+{
+ F1ap_F1SetupRequest_t f1SetupRequest;
+ F1ap_F1SetupRequest_t *f1SetupRequest_p = &f1SetupRequest;
+
+ memset((void *)f1SetupRequest_p, 0, sizeof(f1SetupRequest));
+
+ if (f1ap_encode_f1ap_f1setuprequesties(f1SetupRequest_p, f1SetupRequestIEs) < 0) {
+ return -1;
+ }
+
+ return f1ap_generate_initiating_message(buffer,
+ length,
+ F1ap_ProcedureCode_id_F1Setup,
+ F1ap_Criticality_reject,
+ &asn_DEF_F1ap_F1SetupRequest,
+ f1SetupRequest_p);
+}
+
+static inline
+int f1ap_encode_trace_failure(
+ F1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p,
+ uint8_t **buffer,
+ uint32_t *length)
+{
+ F1ap_TraceFailureIndication_t trace_failure;
+ F1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure;
+
+ memset((void *)trace_failure_p, 0, sizeof(trace_failure));
+
+ if (f1ap_encode_f1ap_tracefailureindicationies(
+ trace_failure_p, trace_failure_ies_p) < 0) {
+ return -1;
+ }
+
+ return f1ap_generate_initiating_message(buffer,
+ length,
+ F1ap_ProcedureCode_id_TraceFailureIndication,
+ F1ap_Criticality_reject,
+ &asn_DEF_F1ap_TraceFailureIndication,
+ trace_failure_p);
+}
+
+static inline
+int f1ap_encode_initial_context_setup_response(
+ F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
+ uint8_t **buffer,
+ uint32_t *length)
+{
+ F1ap_InitialContextSetupResponse_t initial_context_setup_response;
+ F1ap_InitialContextSetupResponse_t *initial_context_setup_response_p =
+ &initial_context_setup_response;
+
+ memset((void *)initial_context_setup_response_p, 0,
+ sizeof(initial_context_setup_response));
+
+ if (f1ap_encode_f1ap_initialcontextsetupresponseies(
+ initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) {
+ return -1;
+ }
+
+ return f1ap_generate_successfull_outcome(buffer,
+ length,
+ F1ap_ProcedureCode_id_InitialContextSetup,
+ F1ap_Criticality_reject,
+ &asn_DEF_F1ap_InitialContextSetupResponse,
+ initial_context_setup_response_p);
+}
+
+static inline
+int f1ap_encode_ue_context_release_complete(
+ F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs,
+ uint8_t **buffer,
+ uint32_t *length)
+{
+ F1ap_UEContextReleaseComplete_t ue_context_release_complete;
+ F1ap_UEContextReleaseComplete_t *ue_context_release_complete_p =
+ &ue_context_release_complete;
+
+ memset((void *)ue_context_release_complete_p, 0,
+ sizeof(ue_context_release_complete));
+
+ if (f1ap_encode_f1ap_uecontextreleasecompleteies(
+ ue_context_release_complete_p, f1ap_UEContextReleaseCompleteIEs) < 0) {
+ return -1;
+ }
+
+ return f1ap_generate_successfull_outcome(buffer,
+ length,
+ F1ap_ProcedureCode_id_UEContextRelease,
+ F1ap_Criticality_reject,
+ &asn_DEF_F1ap_UEContextReleaseComplete,
+ ue_context_release_complete_p);
+}
+
+static inline
+int f1ap_encode_ue_context_release_request(
+ F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs,
+ uint8_t **buffer,
+ uint32_t *length)
+{
+ F1ap_UEContextReleaseRequest_t ue_context_release_request;
+ F1ap_UEContextReleaseRequest_t *ue_context_release_request_p =
+ &ue_context_release_request;
+
+ memset((void *)ue_context_release_request_p, 0,
+ sizeof(ue_context_release_request));
+
+ if (f1ap_encode_f1ap_uecontextreleaserequesties(
+ ue_context_release_request_p, f1ap_UEContextReleaseRequestIEs) < 0) {
+ return -1;
+ }
+
+ return f1ap_generate_initiating_message(buffer,
+ length,
+ F1ap_ProcedureCode_id_UEContextReleaseRequest,
+ F1ap_Criticality_reject,
+ &asn_DEF_F1ap_UEContextReleaseRequest,
+ ue_context_release_request_p);
+}
+*/
diff --git a/openair2/F1AP/f1ap_encoder.h b/openair2/F1AP/f1ap_encoder.h
new file mode 100644
index 0000000000..695245d39b
--- /dev/null
+++ b/openair2/F1AP/f1ap_encoder.h
@@ -0,0 +1,39 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_encoder.h
+ * \brief f1ap pdu encode procedures
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#ifndef F1AP_ENCODER_H_
+#define F1AP_ENCODER_H_
+
+int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length)
+__attribute__ ((warn_unused_result));
+
+#endif /* F1AP_ENCODER_H_ */
diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c
new file mode 100644
index 0000000000..a5b6a09963
--- /dev/null
+++ b/openair2/F1AP/f1ap_handlers.c
@@ -0,0 +1,127 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_handlers.c
+ * \brief f1ap messages handlers
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include "f1ap_common.h"
+#include "f1ap_handlers.h"
+#include "f1ap_decoder.h"
+#include "f1ap_cu_interface_management.h"
+#include "f1ap_du_interface_management.h"
+#include "f1ap_cu_rrc_message_transfer.h"
+#include "f1ap_du_rrc_message_transfer.h"
+#include "f1ap_cu_ue_context_management.h"
+#include "f1ap_du_ue_context_management.h"
+
+extern f1ap_setup_req_t *f1ap_du_data_from_du;
+
+/* Handlers matrix. Only f1 related procedure present here */
+f1ap_message_decoded_callback f1ap_messages_callback[][3] = {
+
+
+ { 0, 0, 0 }, /* Reset */
+ { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */
+ { 0, 0, 0 }, /* ErrorIndication */
+ { 0, 0, 0 }, /* gNBDUConfigurationUpdate */
+ { 0, 0, 0 }, /* gNBCUConfigurationUpdate */
+ { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */
+ { DU_handle_UE_CONTEXT_RELEASE_COMMAND, CU_handle_UE_CONTEXT_RELEASE_COMPLETE, 0 }, /* UEContextRelease */
+ { 0, 0, 0 }, /* UEContextModification */
+ { 0, 0, 0 }, /* UEContextModificationRequired */
+ { 0, 0, 0 }, /* UEMobilityCommand */
+ { CU_handle_UE_CONTEXT_RELEASE_REQUEST, 0, 0 }, /* UEContextReleaseRequest */
+ { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */
+ { DU_handle_DL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* DLRRCMessageTransfer */
+ { CU_handle_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* ULRRCMessageTransfer */
+ { 0, 0, 0 }, /* privateMessage */
+ { 0, 0, 0 }, /* UEInactivityNotification */
+ { 0, 0, 0 }, /* GNBDUResourceCoordination */
+ { 0, 0, 0 }, /* SystemInformationDeliveryCommand */
+ { 0, 0, 0 }, /* Paging */
+ { 0, 0, 0 }, /* Notify */
+ { 0, 0, 0 }, /* WriteReplaceWarning */
+ { 0, 0, 0 }, /* PWSCancel */
+ { 0, 0, 0 }, /* PWSRestartIndication */
+ { 0, 0, 0 }, /* PWSFailureIndication */
+};
+
+const char *f1ap_direction2String(int f1ap_dir) {
+static const char *f1ap_direction_String[] = {
+ "", /* Nothing */
+ "Initiating message", /* initiating message */
+ "Successfull outcome", /* successfull outcome */
+ "UnSuccessfull outcome", /* successfull outcome */
+};
+return(f1ap_direction_String[f1ap_dir]);
+}
+
+int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
+ const uint8_t * const data, const uint32_t data_length)
+{
+ F1AP_F1AP_PDU_t pdu;
+ int ret;
+
+ DevAssert(data != NULL);
+
+ memset(&pdu, 0, sizeof(pdu));
+
+ if (f1ap_decode_pdu(&pdu, data, data_length) < 0) {
+ LOG_E(F1AP, "Failed to decode PDU\n");
+ return -1;
+ }
+
+ /* Checking procedure Code and direction of message */
+ if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof(
+ f1ap_message_decoded_callback))
+ || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) {
+ LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
+ assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present);
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
+ return -1;
+ }
+
+ /* No handler present.
+ * This can mean not implemented or no procedure for eNB (wrong direction).
+ */
+ if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
+ LOG_E(F1AP, "[SCTP %d] No handler for procedureCode %ld in %s\n",
+ assoc_id, pdu.choice.initiatingMessage->procedureCode,
+ f1ap_direction2String(pdu.present - 1));
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
+ return -1;
+ }
+
+ /* Calling the right handler */
+ LOG_I(F1AP, "Calling handler with instance %d\n",instance);
+ ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])
+ (instance, assoc_id, stream, &pdu);
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
+ return ret;
+}
diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h
new file mode 100644
index 0000000000..631249a324
--- /dev/null
+++ b/openair2/F1AP/f1ap_handlers.h
@@ -0,0 +1,39 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_handlers.h
+ * \brief f1ap messages handlers
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#ifndef F1AP_HANDLERS_H_
+#define F1AP_HANDLERS_H_
+
+int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
+ const uint8_t * const data, const uint32_t data_length);
+
+#endif /* F1AP_HANDLERS_H_ */
diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c
new file mode 100644
index 0000000000..fa8951536a
--- /dev/null
+++ b/openair2/F1AP/f1ap_itti_messaging.c
@@ -0,0 +1,73 @@
+/*
+ * 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 "f1ap_common.h"
+#include "f1ap_itti_messaging.h"
+
+void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream)
+{
+ MessageDef *message_p;
+ sctp_data_req_t *sctp_data_req;
+
+ message_p = itti_alloc_new_message(TASK_CU_F1, SCTP_DATA_REQ);
+
+ sctp_data_req = &message_p->ittiMsg.sctp_data_req;
+
+ sctp_data_req->assoc_id = assoc_id;
+ sctp_data_req->buffer = buffer;
+ sctp_data_req->buffer_length = buffer_length;
+ sctp_data_req->stream = stream;
+
+ itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+}
+
+void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream)
+{
+ MessageDef *message_p;
+ sctp_data_req_t *sctp_data_req;
+
+ message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_DATA_REQ);
+
+ sctp_data_req = &message_p->ittiMsg.sctp_data_req;
+
+ sctp_data_req->assoc_id = assoc_id;
+ sctp_data_req->buffer = buffer;
+ sctp_data_req->buffer_length = buffer_length;
+ sctp_data_req->stream = stream;
+
+ LOG_I(F1AP, "Sending ITTI message to SCTP Task\n");
+ itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+}
+
+void f1ap_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id)
+{
+ MessageDef *message_p = NULL;
+ sctp_close_association_t *sctp_close_association_p = NULL;
+
+ message_p = itti_alloc_new_message(TASK_S1AP, SCTP_CLOSE_ASSOCIATION);
+ sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
+ sctp_close_association_p->assoc_id = assoc_id;
+
+ itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+}
+
diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h
new file mode 100644
index 0000000000..66c59a72e7
--- /dev/null
+++ b/openair2/F1AP/f1ap_itti_messaging.h
@@ -0,0 +1,35 @@
+/*
+ * 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 F1AP_ITTI_MESSAGING_H_
+#define F1AP_ITTI_MESSAGING_H_
+
+void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream);
+
+void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream);
+
+void f1ap_eNB_itti_send_sctp_close_association(instance_t instance,
+ int32_t assoc_id);
+
+
+#endif /* F1AP_ITTI_MESSAGING_H_ */
diff --git a/openair2/F1AP/f1ap_messaging.c b/openair2/F1AP/f1ap_messaging.c
new file mode 100644
index 0000000000..fb189eaed3
--- /dev/null
+++ b/openair2/F1AP/f1ap_messaging.c
@@ -0,0 +1,66 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_messaging.c
+ * \brief f1ap procedures
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#include "f1ap_common.h"
+#include "f1ap_messaging.h"
+
+// void f1ap_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+// uint32_t buffer_length, uint16_t stream)
+// {
+// MessageDef *message_p;
+// sctp_data_req_t *sctp_data_req;
+
+// message_p = itti_alloc_new_message(TASK_F1AP, SCTP_DATA_REQ);
+
+// sctp_data_req = &message_p->ittiMsg.sctp_data_req;
+
+// sctp_data_req->assoc_id = assoc_id;
+// sctp_data_req->buffer = buffer;
+// sctp_data_req->buffer_length = buffer_length;
+// sctp_data_req->stream = stream;
+
+// itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+// }
+
+// void f1ap_send_sctp_close_association(instance_t instance, int32_t assoc_id)
+// {
+// MessageDef *message_p = NULL;
+// sctp_close_association_t *sctp_close_association_p = NULL;
+
+// message_p = itti_alloc_new_message(TASK_F1AP, SCTP_CLOSE_ASSOCIATION);
+// sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
+// sctp_close_association_p->assoc_id = assoc_id;
+
+// itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+// }
+
diff --git a/openair2/F1AP/f1ap_messaging.h b/openair2/F1AP/f1ap_messaging.h
new file mode 100644
index 0000000000..9ad0388d01
--- /dev/null
+++ b/openair2/F1AP/f1ap_messaging.h
@@ -0,0 +1,44 @@
+/*
+ * 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
+ */
+
+/*! \file f1ap_messaging.h
+ * \brief f1ap procedures
+ * \author EURECOM/NTUST
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#ifndef F1AP_MESSAGING_H_
+#define F1AP_MESSAGING_H_
+
+void f1ap_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream);
+
+void f1ap_send_sctp_close_association(instance_t instance,
+ int32_t assoc_id);
+
+
+#endif /* F1AP_MESSAGING_H_ */
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index 312edea2c1..73d73c3556 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -760,7 +760,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
sib1_v13ext
#endif
) {
-
+
int i;
int UE_id = -1;
@@ -822,60 +822,42 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext;
}
#endif
- if (radioResourceConfigCommon != NULL) {
- LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n");
- LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
- LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
- LOG_I(MAC,
- "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
- LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
- LOG_I(MAC,
- "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
- groupHoppingEnabled);
- LOG_I(MAC,
- "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
- groupAssignmentPUSCH);
- LOG_I(MAC,
- "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
- sequenceHoppingEnabled);
- LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n",
- radioResourceConfigCommon->
- pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
-
- AssertFatal(radioResourceConfigCommon->
- rach_ConfigCommon.maxHARQ_Msg3Tx > 0,
- "radioResourceconfigCommon %d == 0\n",
- (int) radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
-
- RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
- RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon_BR = radioResourceConfigCommon_BR;
- if (ul_CarrierFreq > 0) RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq;
- if (ul_Bandwidth) RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = *ul_Bandwidth;
- else RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.dl_Bandwidth;
-
- config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon,
+ AssertFatal(radioResourceConfigCommon != NULL, "radioResourceConfigCommon is null\n");
+ LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n");
+ LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
+ LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n",
+ radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
+
+ AssertFatal(radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx > 0,
+ "radioResourceconfigCommon %d == 0\n",
+ (int) radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
+
+ RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
+ RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon_BR = radioResourceConfigCommon_BR;
+ if (ul_CarrierFreq > 0) RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq;
+ if (ul_Bandwidth) RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = *ul_Bandwidth;
+ else RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.dl_Bandwidth;
+
+ config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- radioResourceConfigCommon_BR,
+ radioResourceConfigCommon_BR,
#endif
- NULL, ul_Bandwidth, additionalSpectrumEmission,
- mbsfn_SubframeConfigList);
-
-
- }
+ NULL, ul_Bandwidth, additionalSpectrumEmission,
+ mbsfn_SubframeConfigList);
+
} // mib != NULL
if (mobilityControlInfo !=NULL){
@@ -896,7 +878,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
if (logicalChannelConfig != NULL) { // check for eMTC specific things
UE_id = find_UE_id(Mod_idP, rntiP);
- if (UE_id<0) {
+ if (UE_id<0) {
LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP);
return(-1);
}
@@ -905,10 +887,10 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
UE_list->UE_template[CC_idP][UE_id].lcgidpriority[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->priority;
} else UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = 0;
}
-
+
if (physicalConfigDedicated != NULL) {
UE_id = find_UE_id(Mod_idP, rntiP);
- if (UE_id<0) {
+ if (UE_id<0) {
LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP);
return(-1);
}
@@ -920,7 +902,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if (sCellToAddMod_r10 != NULL) {
- if (UE_id<0) {
+ if (UE_id<0) {
LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP);
return(-1);
}
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 0ec0f6a723..2416fab7f1 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -132,7 +132,7 @@
/*!\brief size of buffer status report table */
#define BSR_TABLE_SIZE 64
/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
-#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23)
+#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23)
/*!\brief maximum number of resource block groups */
#define N_RBG_MAX 25 // for 20MHz channel BW
/*!\brief minimum value for channel quality indicator */
@@ -140,9 +140,9 @@
/*!\brief maximum value for channel quality indicator */
#define MAX_CQI_VALUE 15
/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */
-#define MAX_SUPPORTED_BW 4
+#define MAX_SUPPORTED_BW 4
/*!\brief CQI values range from 1 to 15 (4 bits) */
-#define CQI_VALUE_RANGE 16
+#define CQI_VALUE_RANGE 16
/*!\brief value for indicating BSR Timer is not running */
#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
@@ -157,16 +157,16 @@
#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE)
/*!\brief maximum number of slices / groups */
-#define MAX_NUM_SLICES 4
+#define MAX_NUM_SLICES 4
-/*
- * eNB part
- */
+/*
+ * eNB part
+ */
-/*
- * UE/ENB common part
- */
+/*
+ * UE/ENB common part
+ */
/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */
typedef struct {
uint8_t RAPID:6;
@@ -306,18 +306,18 @@ typedef struct {
uint8_t stop_sf_LSB:8;
} __attribute__((__packed__))MSI_ELEMENT;
#endif
-/*! \brief Values of CCCH LCID for DLSCH */
+/*! \brief Values of CCCH LCID for DLSCH */
#define CCCH_LCHANID 0
/*!\brief Values of BCCH logical channel (fake)*/
-#define BCCH 3 // SI
+#define BCCH 3 // SI
/*!\brief Values of PCCH logical channel (fake)*/
-#define PCCH 4 // Paging
+#define PCCH 4 // Paging
/*!\brief Values of PCCH logical channel (fake) */
-#define MIBCH 5 // MIB
+#define MIBCH 5 // MIB
/*!\brief Values of BCCH SIB1_BR logical channel (fake) */
-#define BCCH_SIB1_BR 6 // SIB1_BR
+#define BCCH_SIB1_BR 6 // SIB1_BR
/*!\brief Values of BCCH SIB_BR logical channel (fake) */
-#define BCCH_SI_BR 7 // SI-BR
+#define BCCH_SI_BR 7 // SI-BR
/*!\brief Value of CCCH / SRB0 logical channel */
#define CCCH 0 // srb0
/*!\brief DCCH / SRB1 logical channel */
@@ -327,9 +327,9 @@ typedef struct {
/*!\brief DTCH DRB1 logical channel */
#define DTCH 3 // LCID
/*!\brief MCCH logical channel */
-#define MCCH 4
+#define MCCH 4
/*!\brief MTCH logical channel */
-#define MTCH 1
+#define MTCH 1
// DLSCH LCHAN ID
/*!\brief LCID of UE contention resolution identity for DLSCH*/
#define UE_CONT_RES 28
@@ -441,20 +441,20 @@ typedef struct {
} eNB_DLSCH_INFO;
/*! \brief eNB overall statistics */
typedef struct {
- /// num BCCH PDU per CC
+ /// num BCCH PDU per CC
uint32_t total_num_bcch_pdu;
- /// BCCH buffer size
+ /// BCCH buffer size
uint32_t bcch_buffer;
- /// total BCCH buffer size
+ /// total BCCH buffer size
uint32_t total_bcch_buffer;
/// BCCH MCS
uint32_t bcch_mcs;
- /// num CCCH PDU per CC
+ /// num CCCH PDU per CC
uint32_t total_num_ccch_pdu;
- /// BCCH buffer size
+ /// BCCH buffer size
uint32_t ccch_buffer;
- /// total BCCH buffer size
+ /// total BCCH buffer size
uint32_t total_ccch_buffer;
/// BCCH MCS
uint32_t ccch_mcs;
@@ -481,22 +481,22 @@ typedef struct {
uint32_t total_dlsch_bytes_tx;
//
uint32_t total_dlsch_pdus_tx;
-
+
// here for RX
//
uint32_t ulsch_bitrate;
//
uint32_t ulsch_bytes_rx;
//
- uint64_t ulsch_pdus_rx;
+ uint64_t ulsch_pdus_rx;
uint32_t total_ulsch_bitrate;
//
uint32_t total_ulsch_bytes_rx;
//
uint32_t total_ulsch_pdus_rx;
-
-
+
+
/// MAC agent-related stats
/// total number of scheduling decisions
int sched_decisions;
@@ -600,9 +600,9 @@ typedef struct {
uint32_t rbs_used_retx_rx;
/// total rb used for a new uplink transmission
uint32_t total_rbs_used_rx;
- /// normalized rx power
+ /// normalized rx power
int32_t normalized_rx_power;
- /// target rx power
+ /// target rx power
int32_t target_rx_power;
/// num rx pdu
@@ -613,7 +613,7 @@ typedef struct {
// uint32_t tti_goodput[NB_RB_MAX];
/// errors
uint32_t num_errors_rx;
-
+
uint64_t overhead_bytes_rx;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t total_overhead_bytes_rx;
@@ -732,12 +732,12 @@ typedef struct {
uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
/// maximum creation time of the downlink buffer head across all LCID
uint32_t dl_buffer_head_sdu_creation_time_max;
- /// a flag indicating that the downlink head SDU is segmented
+ /// a flag indicating that the downlink head SDU is segmented
uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
/// size of remaining size to send for the downlink head SDU
uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
- /// total uplink buffer size
+ /// total uplink buffer size
uint32_t ul_total_buffer;
/// uplink buffer creation time for each LCID
uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
@@ -797,7 +797,7 @@ typedef struct {
uint16_t priority[MAX_NUM_LCID];
// resource scheduling information
-
+
/// Current DL harq round per harq_pid on each CC
uint8_t round[MAX_NUM_CCs][10];
/// Current Active TBs per harq_pid on each CC
@@ -813,7 +813,7 @@ typedef struct {
int32_t context_active_timer;
int32_t cqi_req_timer;
int32_t ul_inactivity_timer;
- int32_t ul_failure_timer;
+ int32_t ul_failure_timer;
int32_t ul_scheduled;
int32_t ra_pdcch_order_sent;
int32_t ul_out_of_sync;
@@ -943,25 +943,25 @@ typedef struct {
uint8_t sb_size;
uint8_t nb_active_sb;
} SBMAP_CONF;
-/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
+/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
typedef struct {
/// Dedicated information for UEs
struct PhysicalConfigDedicated *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
- /// DLSCH pdu
+ /// DLSCH pdu
DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX];
/// DCI template and MAC connection parameters for UEs
UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
/// DCI template and MAC connection for RA processes
int pCC_id[NUMBER_OF_UE_MAX];
- /// sorted downlink component carrier for the scheduler
+ /// sorted downlink component carrier for the scheduler
int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
- /// number of downlink active component carrier
+ /// number of downlink active component carrier
int numactiveCCs[NUMBER_OF_UE_MAX];
- /// sorted uplink component carrier for the scheduler
+ /// sorted uplink component carrier for the scheduler
int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
- /// number of uplink active component carrier
+ /// number of uplink active component carrier
int numactiveULCCs[NUMBER_OF_UE_MAX];
- /// number of downlink active component carrier
+ /// number of downlink active component carrier
uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX];
/// eNB to UE statistics
eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
@@ -976,7 +976,7 @@ typedef struct {
boolean_t active[NUMBER_OF_UE_MAX];
} UE_list_t;
-/*! \brief eNB common channels */
+/*! \brief eNB common channels */
typedef struct {
int physCellId;
int p_eNB;
@@ -986,7 +986,7 @@ typedef struct {
BCCH_BCH_Message_t *mib;
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR;
+ RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR;
#endif
TDD_Config_t *tdd_Config;
SchedulingInfoList_t *schedulingInfoList;
@@ -1043,7 +1043,7 @@ typedef struct {
BCCH_PDU BCCH_BR_pdu[20];
#endif
} COMMON_channels_t;
-/*! \brief top level eNB MAC structure */
+/*! \brief top level eNB MAC structure */
typedef struct eNB_MAC_INST_s {
/// Ethernet parameters for northbound midhaul interface
eth_params_t eth_params_n;
@@ -1076,7 +1076,7 @@ typedef struct eNB_MAC_INST_s {
nfapi_ul_config_request_t UL_req[MAX_NUM_CCs];
/// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests
nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
- /// Preallocated HI_DCI0 pdu list
+ /// Preallocated HI_DCI0 pdu list
nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU];
/// NFAPI HI/DCI0 Config Request Structure
nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs];
@@ -1097,29 +1097,29 @@ typedef struct eNB_MAC_INST_s {
/// eNB stats
eNB_STATS eNB_stats[MAX_NUM_CCs];
// MAC function execution peformance profiler
- /// processing time of eNB scheduler
+ /// processing time of eNB scheduler
time_stats_t eNB_scheduler;
- /// processing time of eNB scheduler for SI
+ /// processing time of eNB scheduler for SI
time_stats_t schedule_si;
/// processing time of eNB scheduler for Random access
time_stats_t schedule_ra;
- /// processing time of eNB ULSCH scheduler
+ /// processing time of eNB ULSCH scheduler
time_stats_t schedule_ulsch;
/// processing time of eNB DCI generation
time_stats_t fill_DLSCH_dci;
/// processing time of eNB MAC preprocessor
time_stats_t schedule_dlsch_preprocessor;
- /// processing time of eNB DLSCH scheduler
+ /// processing time of eNB DLSCH scheduler
time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
- /// processing time of eNB MCH scheduler
+ /// processing time of eNB MCH scheduler
time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
} eNB_MAC_INST;
-/*
- * UE part
- */
+/*
+ * UE part
+ */
typedef enum {
TYPE0,
@@ -1311,25 +1311,25 @@ typedef struct {
uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area
#endif
//#ifdef CBA
- /// CBA RNTI for each group
+ /// CBA RNTI for each group
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
- /// last SFN for CBA channel access
+ /// last SFN for CBA channel access
uint8_t cba_last_access[NUM_MAX_CBA_GROUP];
//#endif
- /// total UE scheduler processing time
+ /// total UE scheduler processing time
time_stats_t ue_scheduler; // total
- /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation
- time_stats_t tx_ulsch_sdu;
+ /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation
+ time_stats_t tx_ulsch_sdu;
/// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser
- time_stats_t rx_dlsch_sdu ;
- /// UE query for MCH subframe processing time
+ time_stats_t rx_dlsch_sdu ;
+ /// UE query for MCH subframe processing time
time_stats_t ue_query_mch;
- /// UE MCH rx processing time
+ /// UE MCH rx processing time
time_stats_t rx_mch_sdu;
- /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind)
- time_stats_t rx_si;
- /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind)
- time_stats_t rx_p;
+ /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind)
+ time_stats_t rx_si;
+ /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind)
+ time_stats_t rx_p;
} UE_MAC_INST;
/*! \brief ID of the neighboring cells used for HO*/
typedef struct {
@@ -1340,6 +1340,3 @@ typedef struct {
#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
-
-
-
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 42f09dc90f..ab2856c40c 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -404,20 +404,23 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
// check threshold
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) {
// note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311)
- // inform RRC of failure and clear timer
- LOG_I(MAC,
- "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
- UE_id, rnti);
- mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
+ if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) {
+ MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ);
+ F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti;
+ F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK;
+ F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure
+ F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL;
+ F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0;
+ itti_send_msg_to_task(TASK_DU_F1, module_idP, m);
+ } else {
+ // inform RRC of failure and clear timer
+ LOG_I(MAC,
+ "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
+ UE_id, rnti);
+ mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
+ }
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1;
-
- //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
- if (rrc_agent_registered[module_idP]) {
- LOG_W(MAC, "notify flexran Agent of UE state change\n");
- agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
- rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
- }
}
} // ul_failure_timer>0
}
@@ -695,16 +698,13 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
}
- if (RC.flexran[module_idP]->enabled)
- flexran_agent_send_update_stats(module_idP);
-
// Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
if(cc[CC_id].tdd_Config == NULL || !(is_UL_sf(&cc[CC_id],subframeP)))
allocate_CCEs(module_idP, CC_id, frameP, subframeP, 2);
}
- if (mac_agent_registered[module_idP] && subframeP == 9) {
+ if (flexran_agent_get_mac_xface(module_idP) && subframeP == 9) {
flexran_agent_slice_update(module_idP);
}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 2ebb45e68e..79d791c558 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -153,7 +153,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
ul_req_body->number_of_pdus++;
- } // if (ra->rach_resource_type>0) {
+ } // if (ra->rach_resource_type>0) {
else
#endif
{
@@ -252,7 +252,7 @@ void generate_Msg2(module_id_t module_idP,
{
eNB_MAC_INST *mac = RC.mac[module_idP];
COMMON_channels_t *cc = mac->common_channels;
-
+
uint8_t *vrb_map = NULL;
int first_rb = 0;
int N_RB_DL = 0;
@@ -260,25 +260,25 @@ void generate_Msg2(module_id_t module_idP,
nfapi_dl_config_request_pdu_t *dl_config_pdu = NULL;
nfapi_tx_request_pdu_t *TX_req = NULL;
nfapi_dl_config_request_body_t *dl_req_body = NULL;
-
+
vrb_map = cc[CC_idP].vrb_map;
dl_req_body = &mac->DL_req[CC_idP].dl_config_request_body;
dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
-
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- int rmax = 0;
- int rep = 0;
- int reps = 0;
- int num_nb = 0;
+ int rmax = 0;
+ int rep = 0;
+ int reps = 0;
+ int num_nb = 0;
first_rb = 0;
struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
- uint16_t absSF = (10 * frameP) + subframeP;
- uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
+ uint16_t absSF = (10 * frameP) + subframeP;
+ uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
if (absSF > absSF_Msg2) {
return; // we're not ready yet
@@ -289,18 +289,18 @@ void generate_Msg2(module_id_t module_idP,
prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
switch (prach_ParametersListCE_r13->list.count) {
- case 4:
- p[3] = prach_ParametersListCE_r13->list.array[3];
- case 3:
- p[2] = prach_ParametersListCE_r13->list.array[2];
- case 2:
- p[1] = prach_ParametersListCE_r13->list.array[1];
- case 1:
- p[0] = prach_ParametersListCE_r13->list.array[0];
- break;
- default:
- AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", (int) prach_ParametersListCE_r13->list.count);
- break;
+ case 4:
+ p[3] = prach_ParametersListCE_r13->list.array[3];
+ case 3:
+ p[2] = prach_ParametersListCE_r13->list.array[2];
+ case 2:
+ p[1] = prach_ParametersListCE_r13->list.array[1];
+ case 1:
+ p[0] = prach_ParametersListCE_r13->list.array[0];
+ break;
+ default:
+ AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", (int) prach_ParametersListCE_r13->list.count);
+ break;
}
}
@@ -348,7 +348,7 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg2_narrowband;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
@@ -396,15 +396,15 @@ void generate_Msg2(module_id_t module_idP,
if (ra->msg2_mpdcch_repetition_cnt > 0) { // we're in a stream of repetitions
if ((ra->msg2_mpdcch_repetition_cnt == reps) && (ra->msg2_mpdcch_done == 0)) { // this is the last mpdcch repetition
- ra->msg2_mpdcch_done = 1;
+ ra->msg2_mpdcch_done = 1;
- if (cc[CC_idP].tdd_Config == NULL) { // FDD case
+ if (cc[CC_idP].tdd_Config == NULL) { // FDD case
// wait 2 subframes for PDSCH transmission
if (subframeP > 7)
ra->Msg2_frame = (frameP + 1) & 1023;
else
ra->Msg2_frame = frameP;
- ra->Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
+ ra->Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, programmed Msg2 for %d.%d\n",
module_idP,
@@ -441,11 +441,11 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_idP];
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->RA_rnti;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; // QPSK
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_idP].p_eNB == 1) ? 0 : 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
@@ -459,14 +459,14 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_idP].p_eNB == 1) ? 1 : 2;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
/* Rel10 fields */
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
/* Rel13 fields */
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
dl_req_body->number_pdu++;
@@ -477,7 +477,7 @@ void generate_Msg2(module_id_t module_idP,
get_Msg3alloc (&cc[CC_idP], subframeP, frameP, &ra->Msg3_frame, &ra->Msg3_subframe);
add_msg3 (module_idP, CC_idP, ra, frameP, subframeP);
- ra->state = WAITMSG3;
+ ra->state = WAITMSG3;
/* DL request */
LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n",
@@ -487,7 +487,7 @@ void generate_Msg2(module_id_t module_idP,
mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
TX_req = &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
- TX_req->pdu_length = 7; // This should be changed if we have more than 1 preamble
+ TX_req->pdu_length = 7; // This should be changed if we have more than 1 preamble
TX_req->pdu_index = mac->pdu_index[CC_idP]++;
TX_req->num_segments = 1;
TX_req->segments[0].segment_length = 7;
@@ -618,7 +618,7 @@ generate_Msg4(module_id_t module_idP,
sub_frame_t subframeP,
RA_t * ra)
//------------------------------------------------------------------------------
-{
+{
eNB_MAC_INST *mac = RC.mac[module_idP];
COMMON_channels_t *cc = mac->common_channels;
UE_list_t *UE_list = &(mac->UE_list);
@@ -633,7 +633,7 @@ generate_Msg4(module_id_t module_idP,
uint8_t lcid = 0;
uint8_t offset = 0;
uint8_t *vrb_map = NULL;
-
+
nfapi_dl_config_request_pdu_t *dl_config_pdu = NULL;
nfapi_ul_config_request_pdu_t *ul_config_pdu = NULL;
nfapi_tx_request_pdu_t *TX_req = NULL;
@@ -643,9 +643,9 @@ generate_Msg4(module_id_t module_idP,
nfapi_ul_config_request_body_t *ul_req_body = NULL;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- int rmax = 0;
- int rep = 0;
- int reps = 0;
+ int rmax = 0;
+ int rep = 0;
+ int reps = 0;
first_rb = 0;
@@ -672,29 +672,29 @@ generate_Msg4(module_id_t module_idP,
AssertFatal (prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count, "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
switch (prach_ParametersListCE_r13->list.count) {
- case 4:
- p[3] = prach_ParametersListCE_r13->list.array[3];
- n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
+ case 4:
+ p[3] = prach_ParametersListCE_r13->list.array[3];
+ n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
- pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+ pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
- case 3:
- p[2] = prach_ParametersListCE_r13->list.array[2];
- n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
+ case 3:
+ p[2] = prach_ParametersListCE_r13->list.array[2];
+ n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
- pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
- case 2:
- p[1] = prach_ParametersListCE_r13->list.array[1];
- n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
+ pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
+ case 2:
+ p[1] = prach_ParametersListCE_r13->list.array[1];
+ n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
- pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
- case 1:
- p[0] = prach_ParametersListCE_r13->list.array[0];
- n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
+ pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
+ case 1:
+ p[0] = prach_ParametersListCE_r13->list.array[0];
+ n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
- pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
- break;
- default:
+ pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
+ break;
+ default:
AssertFatal(1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", prach_ParametersListCE_r13->list.count);
}
}
@@ -754,7 +754,7 @@ generate_Msg4(module_id_t module_idP,
// rmax from SIB2 information
rmax = 1<rach_resource_type - 1]->mpdcch_NumRepetition_RA_r13;
-
+
// choose r3 by default for Msg4 (this is ok from table 9.1.5-3 for rmax = >=4, if we choose rmax <4 it has to be less
rep = 0;
@@ -765,14 +765,15 @@ generate_Msg4(module_id_t module_idP,
if ((ra->msg4_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
// Get RRCConnectionSetup for Piggyback
- ra->msg4_rrc_sdu_length = mac_rrc_data_req (module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
- &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
-
+ ra->msg4_rrc_sdu_length = mac_rrc_data_req (module_idP, CC_idP, frameP, CCCH,
+ UE_RNTI(module_idP, UE_id), 1, // 1 transport block
+ &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
+
AssertFatal (ra->msg4_rrc_sdu_length > 0, "[MAC][eNB Scheduler] CCCH not allocated\n");
-
-
+
+
LOG_D (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d, dl_req->num_pdu %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, ra->msg4_rrc_sdu_length,dl_req_body->number_pdu);
-
+
// MPDCCH configuration for Msg4
ra->msg4_mpdcch_done=0;
memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
@@ -782,7 +783,7 @@ generate_Msg4(module_id_t module_idP,
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg2_narrowband;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
@@ -826,7 +827,7 @@ generate_Msg4(module_id_t module_idP,
ra->msg4_TBsize = get_TBS_DL(dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs,
6);
} //repetition_count==0 && SF condition met
-
+
if ((ra->msg4_mpdcch_repetition_cnt > 0)&&
(ra->msg4_mpdcch_done==0)) { // we're in a stream of repetitions
LOG_D(MAC,"SFN.SF %d.%d : msg4 mpdcch repetition number %d/%d\n",
@@ -851,13 +852,13 @@ generate_Msg4(module_id_t module_idP,
}
// mpdcch_repetition_count == reps
else if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
-
+
// Program PDSCH
-
+
LOG_D (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP, ra->rach_resource_type - 1, ra->rnti);
-
-
+
+
dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
@@ -883,21 +884,21 @@ generate_Msg4(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_idP].p_eNB == 1) ? 1 : 2;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
-
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-
+
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
dl_req_body->number_pdu++;
-
+
ra->state = WAITMSG4ACK;
-
+
lcid = 0;
-
+
UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
AssertFatal((ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header)>=0,
@@ -909,7 +910,7 @@ generate_Msg4(module_id_t module_idP,
msg4_padding = 0;
msg4_post_padding = ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header - 1;
}
-
+
LOG_D (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
module_idP, CC_idP, frameP, subframeP, ra->msg4_TBsize, ra->msg4_rrc_sdu_length, msg4_header, msg4_padding, msg4_post_padding);
DevAssert (UE_id != UE_INDEX_INVALID); // FIXME not sure how to gracefully return
@@ -922,9 +923,9 @@ generate_Msg4(module_id_t module_idP,
ra->cont_res_id, // contention res id
msg4_padding, // no padding
msg4_post_padding);
-
+
memcpy ((void *) &mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0][(unsigned char) offset], &cc[CC_idP].CCCH_pdu.payload[0], ra->msg4_rrc_sdu_length);
-
+
// DL request
mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
TX_req = &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
@@ -934,7 +935,7 @@ generate_Msg4(module_id_t module_idP,
TX_req->segments[0].segment_length = ra->msg4_TBsize;
TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0];
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
-
+
// Program ACK/NAK for Msg4 PDSCH
int absSF = (frameP * 10) + subframeP;
// see Section 10.2 from 36.213
@@ -942,7 +943,7 @@ generate_Msg4(module_id_t module_idP,
AssertFatal (reps == 1, "Have to handle programming of ACK when PDSCH repetitions is > 1\n");
ul_req_body = &mac->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body;
ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
-
+
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
@@ -966,72 +967,74 @@ generate_Msg4(module_id_t module_idP,
ul_req_body->number_of_pdus++;
T (T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT (module_idP), T_INT (CC_idP), T_INT (ra->rnti), T_INT (frameP), T_INT (subframeP),
T_INT (0 /*harq_pid always 0? */ ), T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].payload[0], ra->msg4_TBsize));
-
+
if (opt_enabled == 1) {
trace_pdu (1, (uint8_t *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], ra->msg4_rrc_sdu_length, UE_id, 3, UE_RNTI (module_idP, UE_id), mac->frame, mac->subframe, 0, 0);
LOG_D (OPT, "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", module_idP, CC_idP, frameP, UE_RNTI (module_idP, UE_id), ra->msg4_rrc_sdu_length);
}
- } // Msg4 frame/subframe
- } // rach_resource_type > 0
+ } // Msg4 frame/subframe
+ } // rach_resource_type > 0
else
#endif
{
// This is normal LTE case
- LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
+ LOG_I(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
// Get RRCConnectionSetup for Piggyback
/*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
&cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case*/
- rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
- &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
+ // check if there's data on the CCCH to send with Msg4
+ rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH,
+ UE_RNTI(module_idP,UE_id),1, // 1 transport block
+ &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
- LOG_D(MAC,
+ if (rrc_sdu_length > 0) {
+ LOG_D(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n",
module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);
-
- AssertFatal(rrc_sdu_length > 0,
- "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length);
-
-
-
- LOG_D(MAC,
- "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
+
+ // AssertFatal(rrc_sdu_length > 0,
+ // "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length);
+
+
+
+ LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP, ra->rnti);
-
+
/// Choose first 4 RBs for Msg4, should really check that these are free!
first_rb = 0;
-
+
vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1;
vrb_map[first_rb + 2] = 1;
vrb_map[first_rb + 3] = 1;
-
-
+
+
// Compute MCS/TBS for 3 PRB (coded on 4 vrb)
msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
-
+
if ((rrc_sdu_length + msg4_header) <= 22) {
- ra->msg4_mcs = 4;
- ra->msg4_TBsize = 22;
+ ra->msg4_mcs = 4;
+ ra->msg4_TBsize = 22;
} else if ((rrc_sdu_length + msg4_header) <= 28) {
- ra->msg4_mcs = 5;
- ra->msg4_TBsize = 28;
+ ra->msg4_mcs = 5;
+ ra->msg4_TBsize = 28;
} else if ((rrc_sdu_length + msg4_header) <= 32) {
- ra->msg4_mcs = 6;
- ra->msg4_TBsize = 32;
+ ra->msg4_mcs = 6;
+ ra->msg4_TBsize = 32;
} else if ((rrc_sdu_length + msg4_header) <= 41) {
- ra->msg4_mcs = 7;
- ra->msg4_TBsize = 41;
+ ra->msg4_mcs = 7;
+ ra->msg4_TBsize = 41;
} else if ((rrc_sdu_length + msg4_header) <= 49) {
- ra->msg4_mcs = 8;
- ra->msg4_TBsize = 49;
+ ra->msg4_mcs = 8;
+ ra->msg4_TBsize = 49;
} else if ((rrc_sdu_length + msg4_header) <= 57) {
- ra->msg4_mcs = 9;
- ra->msg4_TBsize = 57;
+ ra->msg4_mcs = 9;
+ ra->msg4_TBsize = 57;
}
-
+
fill_nfapi_dl_dci_1A(dl_config_pdu, 4, // aggregation_level
ra->rnti, // rnti
1, // rnti_type, CRNTI
@@ -1042,7 +1045,7 @@ generate_Msg4(module_id_t module_idP,
1, // ndi
0, // rv
0); // vrb_flag
-
+
LOG_D(MAC,
"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
frameP, subframeP, dl_req_body->number_pdu,
@@ -1096,7 +1099,9 @@ generate_Msg4(module_id_t module_idP,
msg4_padding, msg4_post_padding);
DevAssert(UE_id != UE_INDEX_INVALID); // FIXME not sure how to gracefully return
// CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
- offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1, //num_sdus
+ int num_sdus = rrc_sdu_length > 0 ? 1 : 0;
+ offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0],
+ num_sdus, //num_sdus
(unsigned short *) &rrc_sdu_length, //
&lcid, // sdu_lcid
255, // no drx
@@ -1178,6 +1183,21 @@ generate_Msg4(module_id_t module_idP,
set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
}
} // CCE Allocation feasible
+ }
+ else {
+ LOG_I(MAC,
+ "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Delaying Msg4 for RRC Piggyback (RNTI %x)\n",
+ module_idP, CC_idP, frameP, subframeP, ra->rnti);
+ ra->Msg4_subframe ++;
+ ra->Msg4_delay_cnt++;
+ if (ra->Msg4_delay_cnt==10) cancel_ra_proc(module_idP, CC_idP, frameP, ra->rnti);
+
+ if (ra->Msg4_subframe == 10) {
+ ra->Msg4_frame++;
+ ra->Msg4_frame&=1023;
+ ra->Msg4_subframe = 0;
+ }
+ }
} // msg4 frame/subframe
} // else rach_resource_type
}
@@ -1476,6 +1496,7 @@ initiate_ra_proc(module_id_t module_idP,
LOG_D(MAC, "Frame %d, Subframe %d: Activating RA process %d\n",
frameP, subframeP, i);
ra[i].state = MSG2;
+ ra[i].Msg4_delay_cnt=0;
ra[i].timing_offset = timing_offset;
ra[i].preamble_subframe = subframeP;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 339d4102aa..d49ebbb264 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -193,7 +193,7 @@ schedule_SIB1_BR(module_id_t module_idP,
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
- bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
+ bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 0xFFFF, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
"schedulingInfoSIB1_BR_r13 %d > 18\n",
@@ -310,7 +310,6 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
-
int8_t bcch_sdu_length;
int CC_id;
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -348,7 +347,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
AssertFatal(schedulingInfoList_BR_r13->list.count==schedulingInfoList->list.count,
"schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
- schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count);
+ schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count);
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
"si_WindowLength_BR_r13 %d > %d\n",
@@ -368,130 +367,140 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
// cycle through SIB list
for (i=0;ilist.count;i++) {
- long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
- long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
- long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
+ long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
+ long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
+ long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
- // check if the SI is to be scheduled now
- int period_in_sf = 80<>1) + (k&1))&3;
-
- if ((sf_mod_period < si_WindowLength_BR_r13) &&
- ((frameP&(((1<= 0) && (si_Periodicity < 25)) {
+ // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
+ period_in_sf = 80 << ((int) si_Periodicity);
+ } else if (si_Periodicity < 0) {
+ period_in_sf = 80;
+ } else if (si_Periodicity > 24) {
+ period_in_sf = 80 << 24;
+ }
+ int sf_mod_period = absSF % period_in_sf;
+ int k = sf_mod_period & 3;
+ // Note: definition of k and rvidx from 36.321 section 5.3.1
+ rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
- bcch_sdu_length = mac_rrc_data_req(module_idP,
- CC_id,
- frameP,
- BCCH_SI_BR+i,1,
- &cc->BCCH_BR_pdu[i+1].payload[0],
- 0); // not used in this case
-
- AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SI-BR %d\n",i);
-
- if (bcch_sdu_length > 0) {
- AssertFatal(bcch_sdu_length <= (si_TBS_r13>>3),
- "RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
- bcch_sdu_length,(int)(si_TBS_r13>>3),(int)schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
+ if ((sf_mod_period < si_WindowLength_BR_r13)
+ && ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled
- // allocate all 6 PRBs in narrowband for SIB1_BR
-
- // check that SIB1 didn't take this narrowband
- if (vrb_map[first_rb] > 0) continue;
-
- first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13-1);
- vrb_map[first_rb] = 1;
- vrb_map[first_rb+1] = 1;
- vrb_map[first_rb+2] = 1;
- vrb_map[first_rb+4] = 1;
- vrb_map[first_rb+5] = 1;
-
- if ((frameP&1023) < 200)
- LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
- module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
- sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
- bcch_sdu_length);
+ bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 0xFFFF, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case
+ AssertFatal(bcch_sdu_length > 0,
+ "RRC returned 0 bytes for SI-BR %d\n", i);
-
- dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13>>3;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL,first_rb,6);
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB==1 ) ? 0 : 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB==1 ) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // Rel10 fields (for PDSCH starting symbol)
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
- // Rel13 fields
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
-
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
- dl_req->number_pdu++;
-
- // Program TX Request
- TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
- TX_req->pdu_length = bcch_sdu_length;
- TX_req->pdu_index = eNB->pdu_index[CC_id]++;
- TX_req->num_segments = 1;
- TX_req->segments[0].segment_length = bcch_sdu_length;
- TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i+1].payload;
- eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
-
- if (opt_enabled == 1) {
- trace_pdu(1,
- &cc->BCCH_BR_pdu[i+1].payload[0],
- bcch_sdu_length,
- 0xffff,
- 4,
- 0xffff,
- eNB->frame,
- eNB->subframe,
- 0,
- 0);
- LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
- module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
- }
- if (cc->tdd_Config!=NULL) { //TDD
- LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
- frameP,i,
- CC_id,
- bcch_sdu_length);
- } else {
- LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
- frameP,i,
- CC_id,
- bcch_sdu_length);
- }
- }
- } // scheduling in current frame/subframe
- } //for SI List
- } // eMTC is activated
- } // CC_id
+ if (bcch_sdu_length > 0) {
+ AssertFatal(bcch_sdu_length <= (si_TBS_r13 >> 3),
+ "RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
+ bcch_sdu_length,
+ (int) (si_TBS_r13 >> 3),
+ (int) schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
+
+ // allocate all 6 PRBs in narrowband for SIB1_BR
+
+ // check that SIB1 didn't take this narrowband
+ if (vrb_map[first_rb] > 0) continue;
+
+ first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13 - 1);
+ vrb_map[first_rb] = 1;
+ vrb_map[first_rb + 1] = 1;
+ vrb_map[first_rb + 2] = 1;
+ vrb_map[first_rb + 4] = 1;
+ vrb_map[first_rb + 5] = 1;
+
+ if ((frameP&1023) < 200)
+ LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
+ module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
+ sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
+ bcch_sdu_length);
+
+
+ //// Rel10 fields (for PDSCH starting symbol)
+ //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ //// Rel13 fields
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+ //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
+ //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
+ //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
+
+ //// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+ //dl_req->number_pdu++;
+ // dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13>>3;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL,first_rb,6);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB==1 ) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB==1 ) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // Rel10 fields (for PDSCH starting symbol)
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ // Rel13 fields
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
+
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+ dl_req->number_pdu++;
+
+ // Program TX Request
+ TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = bcch_sdu_length;
+ TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = bcch_sdu_length;
+ TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i+1].payload;
+ eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+
+ if (opt_enabled == 1) {
+ trace_pdu(DIRECTION_DOWNLINK,
+ &cc->BCCH_BR_pdu[i + 1].payload[0],
+ bcch_sdu_length,
+ 0xffff,
+ WS_SI_RNTI,
+ 0xffff, eNB->frame, eNB->subframe, 0,
+ 0);
+ LOG_D(OPT, "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+ module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
+ }
+ if (cc->tdd_Config != NULL) { //TDD
+ LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
+ frameP, i, CC_id, bcch_sdu_length);
+ } else {
+ LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
+ frameP, i, CC_id, bcch_sdu_length);
+ }
+ }
+ } // scheduling in current frame/subframe
+ } //for SI List
+ } // eMTC is activated
+ } // CC_id
return;
}
#endif
@@ -518,7 +527,7 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_req = &dl_config_request->dl_config_request_body;
cc = &eNB->common_channels[CC_id];
- mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
+ mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 0xFFFF, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
@@ -605,7 +614,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
- bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 0); // not used in this case
+ bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 0xFFFF,1, &cc->BCCH_pdu.payload[0], 0); // not used in this case
if (bcch_sdu_length > 0) {
LOG_D(MAC, "[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n", module_idP, frameP, CC_id, bcch_sdu_length);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index f848207b7b..274b169bf6 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -88,7 +88,7 @@ add_ue_dlsch_info(module_id_t module_idP,
//------------------------------------------------------------------------------
int
-schedule_next_dlue(module_id_t module_idP,
+schedule_next_dlue(module_id_t module_idP,
int CC_id,
sub_frame_t subframeP)
//------------------------------------------------------------------------------
@@ -174,10 +174,10 @@ generate_dlsch_header(unsigned char *mac_header,
last_size = 1;
// msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
((TIMING_ADVANCE_CMD *) ce_ptr)->R = 0;
- AssertFatal(timing_advance_cmd < 64, "timing_advance_cmd %d > 63\n",
+ AssertFatal(timing_advance_cmd < 64, "timing_advance_cmd %d > 63\n",
timing_advance_cmd);
((TIMING_ADVANCE_CMD *) ce_ptr)->TA = timing_advance_cmd; //(timing_advance_cmd+31)&0x3f;
- LOG_D(MAC, "timing advance =%d (%d)\n",
+ LOG_D(MAC, "timing advance =%d (%d)\n",
timing_advance_cmd,
((TIMING_ADVANCE_CMD *) ce_ptr)->TA);
ce_ptr += sizeof(TIMING_ADVANCE_CMD);
@@ -203,14 +203,14 @@ generate_dlsch_header(unsigned char *mac_header,
mac_header_ptr->LCID = UE_CONT_RES;
last_size = 1;
LOG_T(MAC, "[eNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
- ue_cont_res_id[0],
- ue_cont_res_id[1],
+ ue_cont_res_id[0],
+ ue_cont_res_id[1],
ue_cont_res_id[2],
- ue_cont_res_id[3],
- ue_cont_res_id[4],
+ ue_cont_res_id[3],
+ ue_cont_res_id[4],
ue_cont_res_id[5]);
- memcpy(ce_ptr,
- ue_cont_res_id,
+ memcpy(ce_ptr,
+ ue_cont_res_id,
6);
ce_ptr += 6;
// msg("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
@@ -220,7 +220,7 @@ generate_dlsch_header(unsigned char *mac_header,
for (i = 0; i < num_sdus; i++) {
LOG_T(MAC, "[eNB] Generate DLSCH header num sdu %d len sdu %d\n",
- num_sdus,
+ num_sdus,
sdu_lengths[i]);
if (first_element > 0) {
@@ -295,7 +295,7 @@ generate_dlsch_header(unsigned char *mac_header,
if ((ce_ptr - mac_header_control_elements) > 0) {
// printf("Copying %d bytes for control elements\n",ce_ptr-mac_header_control_elements);
- memcpy((void *) mac_header_ptr,
+ memcpy((void *) mac_header_ptr,
mac_header_control_elements,
ce_ptr - mac_header_control_elements);
mac_header_ptr += (unsigned char) (ce_ptr - mac_header_control_elements);
@@ -424,9 +424,9 @@ schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, in
for (i = 0; i < sli->n_dl; i++) {
// Run each enabled slice-specific schedulers one by one
- sli->dl[i].sched_cb(module_idP,
- i,
- frameP,
+ sli->dl[i].sched_cb(module_idP,
+ i,
+ frameP,
subframeP,
mbsfn_flag/*, dl_info*/);
}
@@ -512,7 +512,7 @@ schedule_ue_spec(module_id_t module_idP,
long dl_Bandwidth;
start_meas(&eNB->schedule_dlsch);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,
VCD_FUNCTION_IN);
// for TDD: check that we have to act here, otherwise return
@@ -570,7 +570,7 @@ schedule_ue_spec(module_id_t module_idP,
for (CC_id = 0, eNB_stats = &eNB->eNB_stats[0]; CC_id < nb_mac_CC; CC_id++, eNB_stats++) {
dl_Bandwidth = cc[CC_id].mib->message.dl_Bandwidth;
N_RB_DL[CC_id] = to_prb(dl_Bandwidth);
- min_rb_unit[CC_id] = get_min_rb_unit(module_idP,
+ min_rb_unit[CC_id] = get_min_rb_unit(module_idP,
CC_id);
// get number of PRBs less those used by common channels
total_nb_available_rb[CC_id] = N_RB_DL[CC_id];
@@ -590,7 +590,7 @@ schedule_ue_spec(module_id_t module_idP,
// CALLING Pre_Processor for downlink scheduling
// (Returns estimation of RBs required by each UE and the allocation on sub-band)
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
VCD_FUNCTION_IN);
start_meas(&eNB->schedule_dlsch_preprocessor);
dlsch_scheduler_pre_processor(module_idP,
@@ -600,7 +600,7 @@ schedule_ue_spec(module_id_t module_idP,
mbsfn_flag,
eNB->slice_info.rballoc_sub);
stop_meas(&eNB->schedule_dlsch_preprocessor);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
VCD_FUNCTION_OUT);
//RC.mac[module_idP]->slice_info.slice_counter--;
@@ -642,7 +642,7 @@ schedule_ue_spec(module_id_t module_idP,
ue_template = &UE_list->UE_template[CC_id][UE_id];
if (ue_template->rach_resource_type > 0) continue_flag = 1;
-
+
if (&(UE_list->eNB_UE_stats[CC_id][UE_id]) == NULL) {
LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n");
continue_flag = 1;
@@ -651,20 +651,20 @@ schedule_ue_spec(module_id_t module_idP,
}
if (continue_flag != 1) {
- switch (get_tmode(module_idP,
- CC_id,
+ switch (get_tmode(module_idP,
+ CC_id,
UE_id)) {
case 1:
case 2:
case 7:
- aggregation = get_aggregation(get_bw_index(module_idP,
+ aggregation = get_aggregation(get_bw_index(module_idP,
CC_id),
ue_sched_ctrl->dl_cqi[CC_id],
format1);
break;
case 3:
- aggregation = get_aggregation(get_bw_index(module_idP,
+ aggregation = get_aggregation(get_bw_index(module_idP,
CC_id),
ue_sched_ctrl->dl_cqi[CC_id],
format2A);
@@ -679,11 +679,11 @@ schedule_ue_spec(module_id_t module_idP,
/* if (continue_flag != 1 */
if (ue_sched_ctrl->pre_nb_available_rbs[CC_id] == 0 || // no RBs allocated
- CCE_allocation_infeasible(module_idP,
- CC_id,
- 1,
- subframeP,
- aggregation,
+ CCE_allocation_infeasible(module_idP,
+ CC_id,
+ 1,
+ subframeP,
+ aggregation,
rnti)) {
LOG_D(MAC, "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
module_idP,
@@ -759,13 +759,13 @@ schedule_ue_spec(module_id_t module_idP,
}
LOG_D(MAC, "[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n",
- module_idP,
- frameP, UE_id,
- CC_id,
- rnti,
+ module_idP,
+ frameP, UE_id,
+ CC_id,
+ rnti,
harq_pid,
round,
- nb_available_rb,
+ nb_available_rb,
ue_sched_ctrl->dl_cqi[CC_id],
eNB_UE_stats->dlsch_mcs1,
eNB_UE_stats->rrc_status);
@@ -774,20 +774,20 @@ schedule_ue_spec(module_id_t module_idP,
if (round != 8) {
// get freq_allocation
nb_rb = ue_template->nb_rb[harq_pid];
- TBS = get_TBS_DL(ue_template->oldmcs1[harq_pid],
+ TBS = get_TBS_DL(ue_template->oldmcs1[harq_pid],
nb_rb);
if (nb_rb <= nb_available_rb) {
if (cc[CC_id].tdd_Config != NULL) {
ue_template->DAI++;
- update_ul_dci(module_idP,
- CC_id,
+ update_ul_dci(module_idP,
+ CC_id,
rnti,
- ue_template->DAI,
+ ue_template->DAI,
subframeP);
LOG_D(MAC, "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
- CC_id,
- subframeP,
+ CC_id,
+ subframeP,
UE_id,
ue_template->DAI);
}
@@ -830,18 +830,18 @@ schedule_ue_spec(module_id_t module_idP,
case 2:
case 7:
default:
- LOG_D(MAC, "retransmission DL_REQ: rnti:%x\n",
+ LOG_D(MAC, "retransmission DL_REQ: rnti:%x\n",
rnti);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void *) dl_config_pdu,
- 0,
+ memset((void *) dl_config_pdu,
+ 0,
sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level =
- get_aggregation(get_bw_index(module_idP,
+ get_aggregation(get_bw_index(module_idP,
CC_id),
ue_sched_ctrl->dl_cqi[CC_id],
format1);
@@ -858,37 +858,37 @@ schedule_ue_spec(module_id_t module_idP,
if (cc[CC_id].tdd_Config != NULL) {
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (ue_template->DAI - 1) & 3;
LOG_D(MAC, "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n",
- module_idP,
- CC_id,
- harq_pid,
+ module_idP,
+ CC_id,
+ harq_pid,
round,
ue_template->DAI - 1,
ue_template->oldmcs1[harq_pid]);
} else {
LOG_D(MAC, "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n",
- module_idP,
- CC_id,
- harq_pid,
+ module_idP,
+ CC_id,
+ harq_pid,
round,
ue_template->oldmcs1[harq_pid]);
}
- if (!CCE_allocation_infeasible(module_idP,
- CC_id,
- 1,
+ if (!CCE_allocation_infeasible(module_idP,
+ CC_id,
+ 1,
subframeP,
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
rnti)) {
dl_req->number_dci++;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
- fill_nfapi_dlsch_config(eNB,
- dl_req,
- TBS,
- -1, // retransmission, no pdu_index
- rnti,
+ fill_nfapi_dlsch_config(eNB,
+ dl_req,
+ TBS,
+ -1, // retransmission, no pdu_index
+ rnti,
0, // type 0 allocation from 7.1.6 in 36.213
0, // virtual_resource_block_assignment_flag, unused here
0, // resource_block_coding, to be filled in later
@@ -908,30 +908,30 @@ schedule_ue_spec(module_id_t module_idP,
cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode
0, //number of PRBs treated as one subband, not used here
0); // number of beamforming vectors, not used here
-
+
LOG_D(MAC, "Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n",
- eNB->pdu_index[CC_id],
+ eNB->pdu_index[CC_id],
round);
- program_dlsch_acknak(module_idP,
- CC_id,
- UE_id,
- frameP,
+ program_dlsch_acknak(module_idP,
+ CC_id,
+ UE_id,
+ frameP,
subframeP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
// No TX request for retransmission (check if null request for FAPI)
} else {
LOG_W(MAC, "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d\%x, infeasible CCE allocation\n",
- frameP,
- subframeP,
- UE_id,
+ frameP,
+ subframeP,
+ UE_id,
rnti);
}
}
- add_ue_dlsch_info(module_idP,
- CC_id, UE_id,
- subframeP,
- S_DL_SCHEDULED,
+ add_ue_dlsch_info(module_idP,
+ CC_id, UE_id,
+ subframeP,
+ S_DL_SCHEDULED,
rnti);
//eNB_UE_stats->dlsch_trials[round]++;
eNB_UE_stats->num_retransmission += 1;
@@ -941,16 +941,16 @@ schedule_ue_spec(module_id_t module_idP,
} else {
LOG_D(MAC,
"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
- module_idP,
- frameP,
- CC_id,
+ module_idP,
+ frameP,
+ CC_id,
UE_id);
}
} else { /* This is a potentially new SDU opportunity */
rlc_status.bytes_in_buffer = 0;
// Now check RLC information to compute number of required RBs
// get maximum TBS size for RLC request
- TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
+ TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
nb_available_rb);
// add the length for all the control elements (timing adv, drx, etc) : header + payload
@@ -972,13 +972,13 @@ schedule_ue_spec(module_id_t module_idP,
// RLC data on DCCH
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
- rlc_status = mac_rlc_status_ind(module_idP,
- rnti,
- module_idP,
- frameP,
- subframeP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
+ rlc_status = mac_rlc_status_ind(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
DCCH,
TBS - ta_len - header_length_total - sdu_length_total - 3
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
@@ -990,17 +990,17 @@ schedule_ue_spec(module_id_t module_idP,
if (rlc_status.bytes_in_buffer > 0) {
LOG_D(MAC, "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
- module_idP,
- frameP,
- subframeP,
+ module_idP,
+ frameP,
+ subframeP,
CC_id,
TBS - ta_len - header_length_total - sdu_length_total - 3);
- sdu_lengths[0] = mac_rlc_data_req(module_idP,
- rnti,
- module_idP,
- frameP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
+ sdu_lengths[0] = mac_rlc_data_req(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
DCCH,
TBS, //not used
(char *)&dlsch_buffer[0]
@@ -1014,8 +1014,8 @@ schedule_ue_spec(module_id_t module_idP,
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) {
uint16_t release_total = 0;
- for (release_num = 0, release_ctrl = &rrc_release_info.RRC_release_ctrl[0];
- release_num < NUMBER_OF_UE_MAX;
+ for (release_num = 0, release_ctrl = &rrc_release_info.RRC_release_ctrl[0];
+ release_num < NUMBER_OF_UE_MAX;
release_num++, release_ctrl++) {
if(release_ctrl->flag > 0) {
release_total++;
@@ -1074,18 +1074,18 @@ schedule_ue_spec(module_id_t module_idP,
}
}
- T(T_ENB_MAC_UE_DL_SDU,
+ T(T_ENB_MAC_UE_DL_SDU,
T_INT(module_idP),
- T_INT(CC_id),
- T_INT(rnti),
+ T_INT(CC_id),
+ T_INT(rnti),
T_INT(frameP),
- T_INT(subframeP),
- T_INT(harq_pid),
+ T_INT(subframeP),
+ T_INT(harq_pid),
T_INT(DCCH),
T_INT(sdu_lengths[0]));
LOG_D(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
sdu_lengths[0]);
sdu_length_total = sdu_lengths[0];
sdu_lcids[0] = DCCH;
@@ -1098,11 +1098,11 @@ schedule_ue_spec(module_id_t module_idP,
num_sdus = 1;
#ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes :",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
sdu_lengths[0]);
for (j = 0; j < sdu_lengths[0]; ++j) {
- LOG_T(MAC, "%x ",
+ LOG_T(MAC, "%x ",
dlsch_buffer[j]);
}
LOG_T(MAC, "\n");
@@ -1112,13 +1112,13 @@ schedule_ue_spec(module_id_t module_idP,
// RLC data on DCCH1
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
- rlc_status = mac_rlc_status_ind(module_idP,
- rnti,
- module_idP,
- frameP,
- subframeP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
+ rlc_status = mac_rlc_status_ind(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
DCCH + 1,
TBS - ta_len - header_length_total - sdu_length_total - 3
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
@@ -1133,11 +1133,11 @@ schedule_ue_spec(module_id_t module_idP,
LOG_D(MAC, "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
module_idP, frameP, CC_id,
TBS - ta_len - header_length_total - sdu_length_total - 3);
- sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP,
- rnti,
- module_idP,
- frameP,
- ENB_FLAG_YES,
+ sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
MBMS_FLAG_NO, DCCH + 1,
TBS, //not used
(char *) &dlsch_buffer[sdu_length_total]
@@ -1146,14 +1146,14 @@ schedule_ue_spec(module_id_t module_idP,
, 0
#endif
);
- T(T_ENB_MAC_UE_DL_SDU,
+ T(T_ENB_MAC_UE_DL_SDU,
T_INT(module_idP),
- T_INT(CC_id),
- T_INT(rnti),
+ T_INT(CC_id),
+ T_INT(rnti),
T_INT(frameP),
- T_INT(subframeP),
+ T_INT(subframeP),
T_INT(harq_pid),
- T_INT(DCCH + 1),
+ T_INT(DCCH + 1),
T_INT(sdu_lengths[num_sdus]));
sdu_lcids[num_sdus] = DCCH1;
sdu_length_total += sdu_lengths[num_sdus];
@@ -1166,11 +1166,11 @@ schedule_ue_spec(module_id_t module_idP,
num_sdus++;
#ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC, "[eNB %d][DCCH1] CC_id %d Got %d bytes :",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
sdu_lengths[num_sdus]);
for (j = 0; j < sdu_lengths[num_sdus]; ++j) {
- LOG_T(MAC, "%x ",
+ LOG_T(MAC, "%x ",
dlsch_buffer[j]);
}
LOG_T(MAC, "\n");
@@ -1291,13 +1291,13 @@ schedule_ue_spec(module_id_t module_idP,
if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs
// (can happen if N_RB_DL is odd)
- TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
+ TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
nb_available_rb);
nb_rb = nb_available_rb;
break;
}
- TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
+ TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
nb_rb);
}
@@ -1327,26 +1327,26 @@ schedule_ue_spec(module_id_t module_idP,
// decrease mcs until TBS falls below required length
while ((TBS > sdu_length_total + header_length_total + ta_len) && (mcs > 0)) {
mcs--;
- TBS = get_TBS_DL(mcs,
+ TBS = get_TBS_DL(mcs,
nb_rb);
}
// if we have decreased too much or we don't have enough RBs, increase MCS
- while (TBS < sdu_length_total + header_length_total + ta_len &&
+ while (TBS < sdu_length_total + header_length_total + ta_len &&
((ue_sched_ctrl->dl_pow_off[CC_id] > 0 && mcs < 28) || (ue_sched_ctrl->dl_pow_off[CC_id] == 0 && mcs <= 15))) {
mcs++;
- TBS = get_TBS_DL(mcs,
+ TBS = get_TBS_DL(mcs,
nb_rb);
}
LOG_D(MAC, "dlsch_mcs before and after the rate matching = (%d, %d)\n",
- eNB_UE_stats->dlsch_mcs1,
+ eNB_UE_stats->dlsch_mcs1,
mcs);
#ifdef DEBUG_eNB_SCHEDULER
LOG_D(MAC, "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
- module_idP,
- CC_id,
- mcs, TBS,
+ module_idP,
+ CC_id,
+ mcs, TBS,
nb_rb);
// msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n",
// TBS, sdu_length_total, offset, TBS-sdu_length_total-offset);
@@ -1363,31 +1363,31 @@ schedule_ue_spec(module_id_t module_idP,
offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
num_sdus, //num_sdus
sdu_lengths, //
- sdu_lcids,
+ sdu_lcids,
255, // no drx
ta_update, // timing advance
NULL, // contention res id
- padding,
+ padding,
post_padding);
//#ifdef DEBUG_eNB_SCHEDULER
if (ta_update != 31) {
- LOG_D(MAC,
+ LOG_D(MAC,
"[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_length %d\n",
- module_idP,
- frameP,
- UE_id,
+ module_idP,
+ frameP,
+ UE_id,
CC_id,
- sdu_length_total,
- num_sdus,
+ sdu_length_total,
+ num_sdus,
sdu_lengths[0],
- sdu_lcids[0],
- offset,
- ta_update,
+ sdu_lcids[0],
+ offset,
+ ta_update,
padding,
- post_padding,
- mcs,
- TBS,
+ post_padding,
+ mcs,
+ TBS,
nb_rb,
header_length_total);
}
@@ -1396,15 +1396,15 @@ schedule_ue_spec(module_id_t module_idP,
#ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
for (i = 0; i < 16; i++) {
- LOG_T(MAC, "%x.",
+ LOG_T(MAC, "%x.",
dlsch_buffer[i]);
}
LOG_T(MAC, "\n");
#endif
// cycle through SDUs and place in dlsch_buffer
dlsch_pdu = &UE_list->DLSCH_pdu[CC_id][0][UE_id];
- memcpy(&dlsch_pdu->payload[0][offset],
- dlsch_buffer,
+ memcpy(&dlsch_pdu->payload[0][offset],
+ dlsch_buffer,
sdu_length_total);
// memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
@@ -1416,39 +1416,39 @@ schedule_ue_spec(module_id_t module_idP,
if (opt_enabled == 1) {
trace_pdu(DIRECTION_DOWNLINK,
(uint8_t *) dlsch_pdu->payload[0],
- TBS,
- module_idP,
+ TBS,
+ module_idP,
WS_C_RNTI,
- UE_RNTI(module_idP,
- UE_id),
+ UE_RNTI(module_idP,
+ UE_id),
eNB->frame,
- eNB->subframe,
- 0,
+ eNB->subframe,
+ 0,
0);
LOG_D(OPT, "[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
frameP,
- UE_RNTI(module_idP,
- UE_id),
+ UE_RNTI(module_idP,
+ UE_id),
TBS);
}
- T(T_ENB_MAC_UE_DL_PDU_WITH_DATA,
+ T(T_ENB_MAC_UE_DL_PDU_WITH_DATA,
T_INT(module_idP),
- T_INT(CC_id),
- T_INT(rnti),
+ T_INT(CC_id),
+ T_INT(rnti),
T_INT(frameP),
- T_INT(subframeP),
+ T_INT(subframeP),
T_INT(harq_pid),
- T_BUFFER(dlsch_pdu->payload[0],
+ T_BUFFER(dlsch_pdu->payload[0],
TBS));
ue_template->nb_rb[harq_pid] = nb_rb;
- add_ue_dlsch_info(module_idP,
- CC_id,
- UE_id,
- subframeP,
- S_DL_SCHEDULED,
+ add_ue_dlsch_info(module_idP,
+ CC_id,
+ UE_id,
+ subframeP,
+ S_DL_SCHEDULED,
rnti);
// store stats
eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total;
@@ -1465,8 +1465,8 @@ schedule_ue_spec(module_id_t module_idP,
if (cc[CC_id].tdd_Config != NULL) { // TDD
ue_template->DAI++;
- update_ul_dci(module_idP,
- CC_id,
+ update_ul_dci(module_idP,
+ CC_id,
rnti,
ue_template->DAI,
subframeP);
@@ -1474,7 +1474,7 @@ schedule_ue_spec(module_id_t module_idP,
// do PUCCH power control
// this is the normalized RX power
- // unit is not dBm, it's special from nfapi
+ // unit is not dBm, it's special from nfapi
// converting to dBm: ToDo: Noise power hard coded to 30
normalized_rx_power = (((5 * ue_sched_ctrl->pucch1_snr[CC_id]) - 640) / 10) + 30;
target_rx_power= (eNB->puCch10xSnr / 10) + 30;
@@ -1498,12 +1498,12 @@ schedule_ue_spec(module_id_t module_idP,
}
LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
- module_idP,
- frameP,
- subframeP,
- harq_pid,
+ module_idP,
+ frameP,
+ subframeP,
+ harq_pid,
tpc,
- normalized_rx_power,
+ normalized_rx_power,
target_rx_power);
} // Po_PUCCH has been updated
else {
@@ -1514,16 +1514,16 @@ schedule_ue_spec(module_id_t module_idP,
}
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void *) dl_config_pdu,
- 0,
+ memset((void *) dl_config_pdu,
+ 0,
sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level =
- get_aggregation(get_bw_index(module_idP,
- CC_id),
- ue_sched_ctrl->dl_cqi[CC_id],
+ get_aggregation(get_bw_index(module_idP,
+ CC_id),
+ ue_sched_ctrl->dl_cqi[CC_id],
format1);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti;
@@ -1541,27 +1541,27 @@ schedule_ue_spec(module_id_t module_idP,
if (cc[CC_id].tdd_Config != NULL) { //TDD
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (ue_template->DAI - 1) & 3;
LOG_D(MAC, "[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
harq_pid,
(ue_template->DAI - 1),
mcs);
} else {
LOG_D(MAC, "[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n",
- module_idP,
- CC_id,
- harq_pid,
+ module_idP,
+ CC_id,
+ harq_pid,
mcs);
}
LOG_D(MAC, "Checking feasibility pdu %d (new sdu)\n",
dl_req->number_pdu);
- if (!CCE_allocation_infeasible(module_idP,
- CC_id,
- 1,
+ if (!CCE_allocation_infeasible(module_idP,
+ CC_id,
+ 1,
subframeP,
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
rnti)) {
ue_sched_ctrl->round[CC_id][harq_pid] = 0;
dl_req->number_dci++;
@@ -1571,11 +1571,11 @@ schedule_ue_spec(module_id_t module_idP,
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
// Toggle NDI for next time
LOG_D(MAC, "CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
- CC_id,
- frameP,
- subframeP,
- UE_id,
- rnti,
+ CC_id,
+ frameP,
+ subframeP,
+ UE_id,
+ rnti,
harq_pid,
ue_template->oldNDI[harq_pid]);
ue_template->oldNDI[harq_pid] = 1 - ue_template->oldNDI[harq_pid];
@@ -1584,15 +1584,15 @@ schedule_ue_spec(module_id_t module_idP,
AssertFatal(ue_template->physicalConfigDedicated != NULL, "physicalConfigDedicated is NULL\n");
AssertFatal(ue_template->physicalConfigDedicated->pdsch_ConfigDedicated != NULL,
"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n");
- fill_nfapi_dlsch_config(eNB,
- dl_req,
- TBS,
- eNB->pdu_index[CC_id],
- rnti,
+ fill_nfapi_dlsch_config(eNB,
+ dl_req,
+ TBS,
+ eNB->pdu_index[CC_id],
+ rnti,
0, // type 0 allocation from 7.1.6 in 36.213
0, // virtual_resource_block_assignment_flag, unused here
0, // resource_block_coding, to be filled in later
- getQm(mcs),
+ getQm(mcs),
0, // redundancy version
1, // transport blocks
0, // transport block to codeword swap flag
@@ -1601,33 +1601,33 @@ schedule_ue_spec(module_id_t module_idP,
1, // number of subbands
// uint8_t codebook_index,
4, // UE category capacity
- ue_template->physicalConfigDedicated->pdsch_ConfigDedicated->p_a,
+ ue_template->physicalConfigDedicated->pdsch_ConfigDedicated->p_a,
0, // delta_power_offset for TM5
0, // ngap
0, // nprb
cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode
0, //number of PRBs treated as one subband, not used here
0); // number of beamforming vectors, not used here
-
+
eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body,
(frameP * 10) + subframeP,
- TBS,
+ TBS,
eNB->pdu_index[CC_id],
dlsch_pdu->payload[0]);
LOG_D(MAC, "Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",
eNB->pdu_index[CC_id]);
eNB->pdu_index[CC_id]++;
- program_dlsch_acknak(module_idP,
- CC_id,
+ program_dlsch_acknak(module_idP,
+ CC_id,
UE_id,
- frameP,
+ frameP,
subframeP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
} else {
LOG_W(MAC, "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n",
- frameP,
- subframeP,
- UE_id,
+ frameP,
+ subframeP,
+ UE_id,
rnti);
}
} else { // There is no data from RLC or MAC header, so don't schedule
@@ -1635,26 +1635,26 @@ schedule_ue_spec(module_id_t module_idP,
}
if (cc[CC_id].tdd_Config != NULL) { // TDD
- set_ul_DAI(module_idP,
- UE_id,
- CC_id,
- frameP,
+ set_ul_DAI(module_idP,
+ UE_id,
+ CC_id,
+ frameP,
subframeP);
}
} // UE_id loop
} // CC_id loop
- fill_DLSCH_dci(module_idP,
- frameP,
- subframeP,
+ fill_DLSCH_dci(module_idP,
+ frameP,
+ subframeP,
mbsfn_flag);
stop_meas(&eNB->schedule_dlsch);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,
VCD_FUNCTION_OUT);
}
//------------------------------------------------------------------------------
-void
+void
dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
int frameP,
sub_frame_t subframeP,
@@ -1680,7 +1680,7 @@ dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
uint16_t (*nb_rbs_remaining)[MAX_MOBILES_PER_ENB];
uint16_t (*nb_rbs_required)[MAX_MOBILES_PER_ENB];
uint8_t (*MIMO_mode_indicator)[N_RBG_MAX];
-
+
// Initialize the free RBGs map
// free_rbgs_map[CC_id][rbg] = -1 if RBG is allocated,
// otherwise it contains the id of the slice it belongs to.
@@ -1718,14 +1718,14 @@ dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
}
}
- slice_priority_sort(Mod_id,
+ slice_priority_sort(Mod_id,
slice_sorted_list);
// MULTIPLEXING
// This part is an adaptation of dlsch_scheduler_pre_processor_allocate() code
for (CC_id = 0; CC_id < nb_mac_CC; ++CC_id) {
N_RB_DL = to_prb(eNB->common_channels[CC_id].mib->message.dl_Bandwidth);
- min_rb_unit = get_min_rb_unit(Mod_id,
+ min_rb_unit = get_min_rb_unit(Mod_id,
CC_id);
for (i = 0; i < sli->n_dl; ++i) {
@@ -1754,9 +1754,9 @@ dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
// Sort UE again
// (UE list gets sorted every time pre_processor is called so it is probably dirty at this point)
// FIXME: There is only one UE_list for all slices, so it must be sorted again each time we use it
- sort_UEs(Mod_id,
- slice_idx,
- frameP,
+ sort_UEs(Mod_id,
+ slice_idx,
+ frameP,
subframeP);
nb_rbs_remaining = sli->pre_processor_results[slice_idx].nb_rbs_remaining;
nb_rbs_required = sli->pre_processor_results[slice_idx].nb_rbs_required;
@@ -1765,8 +1765,8 @@ dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
// Allocation
for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
- tm = get_tmode(Mod_id,
- CC_id,
+ tm = get_tmode(Mod_id,
+ CC_id,
UE_id);
for (rbg = 0; rbg < N_RBG[CC_id]; ++rbg) {
@@ -1825,7 +1825,7 @@ dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id,
void dlsch_scheduler_qos_multiplexing(module_id_t Mod_id, int frameP, sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
- // int UE_id;
+ // int UE_id;
int CC_id, i;
// UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
slice_info_t *sli = &RC.mac[Mod_id]->slice_info;
@@ -1835,9 +1835,9 @@ void dlsch_scheduler_qos_multiplexing(module_id_t Mod_id, int frameP, sub_frame_
for (i = 0; i < sli->n_dl; i++) {
// Sort UE again
// FIXME: There is only one UE_list for all slices, so it must be sorted again each time we use it
- sort_UEs(Mod_id,
- (uint8_t)i,
- frameP,
+ sort_UEs(Mod_id,
+ (uint8_t)i,
+ frameP,
subframeP);
/*
for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
@@ -1858,7 +1858,7 @@ void dlsch_scheduler_qos_multiplexing(module_id_t Mod_id, int frameP, sub_frame_
*/
void
schedule_ue_spec_br(module_id_t module_idP,
- frame_t frameP,
+ frame_t frameP,
sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
@@ -1877,7 +1877,7 @@ schedule_ue_spec_br(module_id_t module_idP,
uint16_t rnti = 0;
uint16_t padding = 0;
uint16_t post_padding = 0;
- uint16_t sdu_length_total = 0;
+ uint16_t sdu_length_total = 0;
mac_rlc_status_resp_t rlc_status;
rrc_eNB_ue_context_t *ue_contextP = NULL;
@@ -1909,10 +1909,10 @@ schedule_ue_spec_br(module_id_t module_idP,
struct LTE_PUCCH_ConfigCommon_v1310 *ext4_pucch = NULL;
LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
struct LTE_N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13 = NULL;
- int pucchreps[4] = { 1, 1, 1, 1 };
- int n1pucchan[4] = { 0, 0, 0, 0 };
- uint32_t ackNAK_absSF;
- int first_rb;
+ int pucchreps[4] = { 1, 1, 1, 1 };
+ int n1pucchan[4] = { 0, 0, 0, 0 };
+ uint32_t ackNAK_absSF;
+ int first_rb;
dl_req = &(mac->DL_req[CC_id].dl_config_request_body);
dl_config_pdu = &(dl_req->dl_config_pdu_list[dl_req->number_pdu]);
@@ -1938,26 +1938,26 @@ schedule_ue_spec_br(module_id_t module_idP,
AssertFatal (prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count, "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
switch (prach_ParametersListCE_r13->list.count) {
- case 4:
- n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
- AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
- pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+ case 4:
+ n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
+ pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
- case 3:
- n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
- AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
- pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
- case 2:
- n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
- AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
- pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
- case 1:
- n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
- AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
- pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
- break;
- default:
- AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", prach_ParametersListCE_r13->list.count);
+ case 3:
+ n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
+ pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
+ case 2:
+ n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
+ pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
+ case 1:
+ n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
+ pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
+ break;
+ default:
+ AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", prach_ParametersListCE_r13->list.count);
}
}
@@ -1976,7 +1976,7 @@ schedule_ue_spec_br(module_id_t module_idP,
if (UE_template->rach_resource_type == 0) {
continue;
}
-
+
uint8_t rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
if (rrc_status < RRC_CONNECTED) {
@@ -1988,10 +1988,10 @@ schedule_ue_spec_br(module_id_t module_idP,
AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
- AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
@@ -2000,11 +2000,11 @@ schedule_ue_spec_br(module_id_t module_idP,
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
- "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
- "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
-
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+
/* Simple scheduler for 1 repetition, 1 HARQ */
if (subframeP == 5) { // MPDCCH
if (round_DL < 8) LOG_D(MAC, "MPDCCH round_DL = %d in frame %d subframe %d\n", round_DL, frameP, subframeP);
@@ -2040,13 +2040,13 @@ schedule_ue_spec_br(module_id_t module_idP,
LOG_D(MAC, "Calling mac_rlc_status_ind for DCCH\n");
rlc_status = mac_rlc_status_ind(module_idP,
- rnti,
- module_idP,
- frameP,
- subframeP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- DCCH,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
(TBS-ta_len-header_len_dcch),
0,
0); // transport block set size
@@ -2055,19 +2055,19 @@ schedule_ue_spec_br(module_id_t module_idP,
if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit
LOG_D(MAC, "[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
- module_idP,
+ module_idP,
frameP,
CC_id,
TBS-header_len_dcch);
sdu_lengths[0] = mac_rlc_data_req(module_idP,
- rnti,
- module_idP,
- frameP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- DCCH,
- TBS, //not used
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
+ TBS, //not used
(char *)&dlsch_buffer[0],
0,
0);
@@ -2097,42 +2097,42 @@ schedule_ue_spec_br(module_id_t module_idP,
sdu_length_total = 0;
}
}
-
+
/* Check for DCCH1 and update header information (assume 2 byte sub-header) */
if (TBS - ta_len-header_len_dcch - sdu_length_total > 0) {
rlc_status = mac_rlc_status_ind(module_idP,
- rnti,
- module_idP,
- frameP,
- subframeP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
DCCH + 1,
(TBS-ta_len-header_len_dcch-sdu_length_total),
0,
0); // transport block set size less allocations for timing advance and DCCH SDU
- sdu_lengths[num_sdus] = 0;
-
+ sdu_lengths[num_sdus] = 0;
+
if (rlc_status.bytes_in_buffer > 0) {
LOG_D(MAC,"[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
- module_idP,
+ module_idP,
frameP,
CC_id,
TBS-header_len_dcch - sdu_length_total);
sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP,
- rnti,
- module_idP,
- frameP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- DCCH+1,
- TBS, //not used
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH+1,
+ TBS, //not used
(char *)&dlsch_buffer[sdu_length_total],
0,
0);
-
+
T(T_ENB_MAC_UE_DL_SDU,
T_INT(module_idP),
T_INT(CC_id),
@@ -2148,8 +2148,8 @@ schedule_ue_spec_br(module_id_t module_idP,
header_len_dcch += 2;
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1] += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] += sdu_lengths[num_sdus];
- num_sdus++;
- }
+ num_sdus++;
+ }
}
/* Assume the max dtch header size, and adjust it later */
@@ -2162,27 +2162,27 @@ schedule_ue_spec_br(module_id_t module_idP,
header_len_dtch += 3;
header_len_dtch_last = 3;
- LOG_D(MAC,"[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
+ LOG_D(MAC,"[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
module_idP,
frameP,
lcid,
TBS,
TBS - ta_len-header_len_dcch - sdu_length_total - header_len_dtch);
-
+
if (TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch > 0) { // NN: > 2 ?
- rlc_status = mac_rlc_status_ind(module_idP,
- rnti,
- module_idP,
- frameP,
- subframeP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- lcid,
+ rlc_status = mac_rlc_status_ind(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch,
0,
0);
-
- if (rlc_status.bytes_in_buffer > 0) {
+
+ if (rlc_status.bytes_in_buffer > 0) {
/* RRC inactivity LTE-M */
/* Reset RRC inactivity timer after uplane activity */
ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti);
@@ -2202,15 +2202,15 @@ schedule_ue_spec_br(module_id_t module_idP,
TBS - header_len_dcch - sdu_length_total - header_len_dtch,
lcid,
header_len_dtch);
-
- sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
- rnti,
- module_idP,
- frameP,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- lcid,
- TBS, //not used
+
+ sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ TBS, //not used
(char*) &dlsch_buffer[sdu_length_total],
0,
0);
@@ -2230,56 +2230,56 @@ schedule_ue_spec_br(module_id_t module_idP,
sdu_lengths[num_sdus],
lcid);
- sdu_lcids[num_sdus] = lcid;
- sdu_length_total += sdu_lengths[num_sdus];
+ sdu_lcids[num_sdus] = lcid;
+ sdu_length_total += sdu_lengths[num_sdus];
- if (sdu_lengths[num_sdus] < 128) {
- header_len_dtch--;
- header_len_dtch_last--;
- }
+ if (sdu_lengths[num_sdus] < 128) {
+ header_len_dtch--;
+ header_len_dtch_last--;
+ }
- num_sdus++;
+ num_sdus++;
} else { // no data for this LCID
header_len_dtch -= 3;
- }
+ }
} else { // no TBS left
header_len_dtch -= 3;
- break;
- }
+ break;
+ }
} // for loop LCID
if (header_len_dtch == 0) {
header_len_dtch_last = 0;
- }
+ }
/* There is at least one SDU */
if ((sdu_length_total + header_len_dcch + header_len_dtch) > 0) {
/* Now compute number of required RBs for total sdu length */
/* Assume RAH format 2 */
/* Adjust header lengths */
- header_len_dcch_tmp = header_len_dcch;
- header_len_dtch_tmp = header_len_dtch;
+ header_len_dcch_tmp = header_len_dcch;
+ header_len_dtch_tmp = header_len_dtch;
if (header_len_dtch == 0) {
header_len_dcch = (header_len_dcch > 0) ? 1 : 0; // remove length field
- } else {
+ } else {
header_len_dtch_last -= 1; // now use it to find how many bytes has to be removed for the last MAC SDU
header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last : header_len_dtch; // remove length field for the last SDU
- }
+ }
- mcs = 9;
+ mcs = 9;
/* Decrease mcs until TBS falls below required length */
- while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) {
- mcs--;
- TBS = get_TBS_DL(mcs,6);
- }
+ while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) {
+ mcs--;
+ TBS = get_TBS_DL(mcs,6);
+ }
/* If we have decreased too much or we don't have enough RBs, increase MCS */
- while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
- mcs++;
- TBS = get_TBS_DL(mcs,6);
- }
+ while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
+ mcs++;
+ TBS = get_TBS_DL(mcs,6);
+ }
LOG_D(MAC, "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
module_idP,
@@ -2287,35 +2287,35 @@ schedule_ue_spec_br(module_id_t module_idP,
mcs,
TBS,
6);
-
- if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
- padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
- post_padding = 0;
- } else {
- padding = 0;
+
+ if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
+ padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
+ post_padding = 0;
+ } else {
+ padding = 0;
/* Adjust the header len */
if (header_len_dtch == 0) {
- header_len_dcch = header_len_dcch_tmp;
+ header_len_dcch = header_len_dcch_tmp;
} else { // if ((header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2)))
- header_len_dtch = header_len_dtch_tmp;
- }
+ header_len_dtch = header_len_dtch_tmp;
+ }
post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header
- }
+ }
- offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
- num_sdus, //num_sdus
- sdu_lengths, //
- sdu_lcids,
- 255, // no drx
- ta_update, // timing advance
- NULL, // contention res id
- padding,
- post_padding);
+ offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+ num_sdus, //num_sdus
+ sdu_lengths, //
+ sdu_lcids,
+ 255, // no drx
+ ta_update, // timing advance
+ NULL, // contention res id
+ padding,
+ post_padding);
- if (ta_update != 31) {
+ if (ta_update != 31) {
LOG_D(MAC,"[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
module_idP,
frameP,
@@ -2334,17 +2334,17 @@ schedule_ue_spec_br(module_id_t module_idP,
6,
header_len_dcch,
header_len_dtch);
- }
+ }
/* Cycle through SDUs and place in dlsch_buffer */
memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
-
+
/* Fill remainder of DLSCH with random data */
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char)(taus()&0xff);
- }
+ }
- if (opt_enabled == 1) {
+ if (opt_enabled == 1) {
trace_pdu(1,
(uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
TBS,
@@ -2356,13 +2356,13 @@ schedule_ue_spec_br(module_id_t module_idP,
0,
0);
- LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
+ LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
module_idP,
CC_id,
frameP,
UE_RNTI(module_idP, UE_id),
TBS);
- }
+ }
T(T_ENB_MAC_UE_DL_PDU_WITH_DATA,
T_INT(module_idP),
@@ -2375,10 +2375,10 @@ schedule_ue_spec_br(module_id_t module_idP,
/* Do PUCCH power control */
/* This is the normalized RX power */
- /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
+ /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
normalized_rx_power = (5 * ue_sched_ctl->pucch1_snr[CC_id]-640) / 10 + 30;
target_rx_power = mac->puCch10xSnr / 10 + 30;
-
+
/* This assumes accumulated tpc */
/* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */
int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
@@ -2386,21 +2386,21 @@ schedule_ue_spec_br(module_id_t module_idP,
if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || // normal case
((framex10psubframe > (frameP * 10 + subframeP)) &&
(((10240 - framex10psubframe +frameP * 10 + subframeP) >= 10)))) { // frame wrap-around
- if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) {
- ue_sched_ctl->pucch1_cqi_update[CC_id] = 0;
-
+ if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) {
+ ue_sched_ctl->pucch1_cqi_update[CC_id] = 0;
+
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP;
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP;
-
+
if (normalized_rx_power > (target_rx_power + 4)) {
- tpc = 0; //-1
+ tpc = 0; //-1
} else if (normalized_rx_power<(target_rx_power - 4)) {
- tpc = 2; //+1
- } else {
- tpc = 1; //0
- }
-
- LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
+ tpc = 2; //+1
+ } else {
+ tpc = 1; //0
+ }
+
+ LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
module_idP,
frameP,
subframeP,
@@ -2412,75 +2412,75 @@ schedule_ue_spec_br(module_id_t module_idP,
tpc = 1; // 0
}
} else { // time to do TPC update
- tpc = 1; //0
- }
+ tpc = 1; //0
+ }
- // Toggle NDI in first round
+ // Toggle NDI in first round
UE_template->oldNDI[harq_pid] = 1 - UE_template->oldNDI[harq_pid];
- ue_sched_ctl->round[CC_id][harq_pid] = 0;
+ ue_sched_ctl->round[CC_id][harq_pid] = 0;
round_DL = 0;
} // if ((sdu_length_total + header_len_dcch + header_len_dtch) > 0)
- }
-
+ }
+
if (round_DL < 8) {
/* Fill in MDPDCCH */
- memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 11 : 10;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = epdcch_setconfig_r11->transmissionType_r11;
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = epdcch_setconfig_r11->transmissionType_r11;
AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
-
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 4; // t-CRNTI
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = rnti;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | ((epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1)<<5);
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 4; // t-CRNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | ((epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1)<<5);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = mcs; // adjust according to size of RAR, 208 bits with N1A_PRB=3
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = rvseq[round_DL&3];
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = UE_template->oldNDI[harq_pid];
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
- dl_req->number_pdu++;
- UE_template->mcs[harq_pid] = dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs;
- }
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = UE_template->oldNDI[harq_pid];
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+ dl_req->number_pdu++;
+ UE_template->mcs[harq_pid] = dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs;
+ }
} else if ((subframeP == 7) && (round_DL < 8)) { // DLSCH
LOG_D(MAC, "DLSCH round_DL = %d in frame %d subframe %d\n", round_DL, frameP, subframeP);
-
- int absSF = (frameP * 10) + subframeP;
-
+
+ int absSF = (frameP * 10) + subframeP;
+
/* Have to check that MPDCCH was generated */
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating DLSCH (ce_level %d RNTI %x)\n",
module_idP,
@@ -2494,72 +2494,72 @@ schedule_ue_spec_br(module_id_t module_idP,
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_dlsch_pdu));
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_id];
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV (to_prb (cc[CC_id].mib->message.dl_Bandwidth), first_rb, 6); // check that this isn't getRIV(6,0,6)
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_id].p_eNB == 1) ? 0 : 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize (cc[CC_id].mib->message.dl_Bandwidth); // ignored
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_id].p_eNB == 1) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
- dl_req->number_pdu++;
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV (to_prb (cc[CC_id].mib->message.dl_Bandwidth), first_rb, 6); // check that this isn't getRIV(6,0,6)
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_id].p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize (cc[CC_id].mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_id].p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req->number_pdu++;
- // DL request
- mac->TX_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
- TX_req = &mac->TX_req[CC_id].tx_request_body.tx_pdu_list[mac->TX_req[CC_id].tx_request_body.number_of_pdus];
+ // DL request
+ mac->TX_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
+ TX_req = &mac->TX_req[CC_id].tx_request_body.tx_pdu_list[mac->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = get_TBS_DL(UE_template->mcs[harq_pid], 6);
- TX_req->pdu_index = mac->pdu_index[CC_id]++;
- TX_req->num_segments = 1;
- TX_req->segments[0].segment_length = TX_req->pdu_length;
- TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0];
- mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
+ TX_req->pdu_index = mac->pdu_index[CC_id]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = TX_req->pdu_length;
+ TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0];
+ mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
- ackNAK_absSF = absSF + 4;
- ul_req = &mac->UL_req_tmp[CC_id][ackNAK_absSF % 10].ul_config_request_body;
- ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
-
- ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
- ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = rnti;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[UE_template->rach_resource_type - 1];
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
+ ackNAK_absSF = absSF + 4;
+ ul_req = &mac->UL_req_tmp[CC_id][ackNAK_absSF % 10].ul_config_request_body;
+ ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
- if (cc[CC_id].tdd_Config == NULL) { // FDD case
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 = n1pucchan[UE_template->rach_resource_type - 1];
- // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
- // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
- // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
- // Delta_ARO = 0 from Table 10.1.2.1-1
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.harq_size = 1; // 1-bit ACK/NAK
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.number_of_pucch_resources = 1;
+ ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+ ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = rnti;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[UE_template->rach_resource_type - 1];
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
+
+ if (cc[CC_id].tdd_Config == NULL) { // FDD case
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 = n1pucchan[UE_template->rach_resource_type - 1];
+ // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
+ // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
+ // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
+ // Delta_ARO = 0 from Table 10.1.2.1-1
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.harq_size = 1; // 1-bit ACK/NAK
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.number_of_pucch_resources = 1;
} else {
- AssertFatal (1 == 0, "PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
+ AssertFatal (1 == 0, "PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
}
ul_req->number_of_pdus++;
@@ -2572,7 +2572,7 @@ schedule_ue_spec_br(module_id_t module_idP,
T_INT (subframeP),
T_INT (0 /* harq_pid always 0? */ ),
T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0], TX_req->pdu_length));
-
+
if (opt_enabled == 1) {
trace_pdu(1,
(uint8_t *) mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0],
@@ -2591,7 +2591,7 @@ schedule_ue_spec_br(module_id_t module_idP,
frameP,
rnti,
TX_req->pdu_length);
- }
+ }
} // end else if ((subframeP == 7) && (round_DL < 8))
} // end loop on UE_id
}
@@ -2600,8 +2600,8 @@ schedule_ue_spec_br(module_id_t module_idP,
//------------------------------------------------------------------------------
void
fill_DLSCH_dci(module_id_t module_idP,
- frame_t frameP,
- sub_frame_t subframeP,
+ frame_t frameP,
+ sub_frame_t subframeP,
int *mbsfn_flagP)
//------------------------------------------------------------------------------
{
@@ -2625,11 +2625,11 @@ fill_DLSCH_dci(module_id_t module_idP,
UE_TEMPLATE *ue_template;
start_meas(&eNB->fill_DLSCH_dci);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
VCD_FUNCTION_IN);
for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) {
- LOG_D(MAC, "Doing fill DCI for CC_id %d\n",
+ LOG_D(MAC, "Doing fill DCI for CC_id %d\n",
CC_id);
if (mbsfn_flagP[CC_id] > 0)
@@ -2642,8 +2642,8 @@ fill_DLSCH_dci(module_id_t module_idP,
// UE specific DCIs
for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
dlsch_info = &eNB_dlsch_info[module_idP][CC_id][UE_id];
- LOG_T(MAC, "CC_id %d, UE_id: %d => status %d\n",
- CC_id,
+ LOG_T(MAC, "CC_id %d, UE_id: %d => status %d\n",
+ CC_id,
UE_id,
dlsch_info->status);
@@ -2670,16 +2670,16 @@ fill_DLSCH_dci(module_id_t module_idP,
if (dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE &&
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti &&
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1) {
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,
- N_RB_DL,
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,
+ N_RB_DL,
N_RBG,
rballoc_sub);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0;
} else if (dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE &&
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti &&
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type == 0) {
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,
- N_RB_DL,
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,
+ N_RB_DL,
N_RBG,
rballoc_sub);
}
@@ -2689,14 +2689,14 @@ fill_DLSCH_dci(module_id_t module_idP,
}
stop_meas(&eNB->fill_DLSCH_dci);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
VCD_FUNCTION_OUT);
}
//------------------------------------------------------------------------------
unsigned char *get_dlsch_sdu(module_id_t module_idP,
- int CC_id,
- frame_t frameP,
+ int CC_id,
+ frame_t frameP,
rnti_t rntiP,
uint8_t TBindex)
//------------------------------------------------------------------------------
@@ -2706,16 +2706,16 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP,
if (rntiP == SI_RNTI) {
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n",
- module_idP,
- CC_id,
+ module_idP,
+ CC_id,
frameP);
return ((unsigned char *) &eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
}
if (rntiP == P_RNTI) {
- LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get PCH sdu for PCCH \n",
- module_idP,
- CC_id,
+ LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get PCH sdu for PCCH \n",
+ module_idP,
+ CC_id,
frameP);
return ((unsigned char *) &eNB->common_channels[CC_id].PCCH_pdu.payload[0]);
}
@@ -2724,18 +2724,18 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP,
if (UE_id != -1) {
LOG_D(MAC, "[eNB %d] Frame %d: CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",
- module_idP,
- frameP,
- CC_id,
- rntiP,
+ module_idP,
+ frameP,
+ CC_id,
+ rntiP,
UE_id);
return ((unsigned char *) &eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
- }
+ }
LOG_E(MAC, "[eNB %d] Frame %d: CC_id %d UE with RNTI %x does not exist\n",
- module_idP,
- frameP,
- CC_id,
+ module_idP,
+ frameP,
+ CC_id,
rntiP);
return NULL;
}
@@ -2744,15 +2744,15 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP,
//------------------------------------------------------------------------------
void
update_ul_dci(module_id_t module_idP,
- uint8_t CC_idP,
- rnti_t rntiP,
- uint8_t daiP,
+ uint8_t CC_idP,
+ rnti_t rntiP,
+ uint8_t daiP,
sub_frame_t subframe)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
-
+
if (cc->tdd_Config != NULL) { // TDD
nfapi_hi_dci0_request_t *HI_DCI0_req = &eNB->HI_DCI0_req[CC_idP][subframe];
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0];
@@ -2835,10 +2835,10 @@ set_ue_dai(sub_frame_t subframeP,
return;
}
-void
-schedule_PCH(module_id_t module_idP,
- frame_t frameP,
- sub_frame_t subframeP)
+void
+schedule_PCH(module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP)
{
/* DCI:format 1A/1C P-RNTI:0xFFFE */
/* PDU:eNB_rrc_inst[Mod_idP].common_channels[CC_id].PCCH_pdu.payload */
@@ -2892,25 +2892,26 @@ schedule_PCH(module_id_t module_idP,
pcch_sdu_length = mac_rrc_data_req(module_idP,
CC_id,
frameP,
- PCCH,
+ PCCH,
+ 0xFFFE,
1,
&cc->PCCH_pdu.payload[0],
i); // used for ue index
if (pcch_sdu_length == 0) {
- LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH not active(size = 0 byte)\n",
- module_idP,
- frameP,
+ LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH not active(size = 0 byte)\n",
+ module_idP,
+ frameP,
subframeP);
continue;
}
- LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n",
+ LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n",
module_idP,
- frameP,
- subframeP,
- CC_id,
- i,
+ frameP,
+ subframeP,
+ CC_id,
+ i,
pcch_sdu_length);
#ifdef FORMAT1C
@@ -3006,9 +3007,9 @@ schedule_PCH(module_id_t module_idP,
} else {
/* unexpected: pcch sdb size is over max value*/
LOG_E(MAC,"[eNB %d] Frame %d : PCCH->PCH CC_id %d, Received %d bytes is over max length(256) \n",
- module_idP,
+ module_idP,
frameP,
- CC_id,
+ CC_id,
pcch_sdu_length);
return;
}
@@ -3092,8 +3093,8 @@ schedule_PCH(module_id_t module_idP,
#endif
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void *) dl_config_pdu,
- 0,
+ memset((void *) dl_config_pdu,
+ 0,
sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
@@ -3107,8 +3108,8 @@ schedule_PCH(module_id_t module_idP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 1;
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(n_rb_dl,
- first_rb,
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(n_rb_dl,
+ first_rb,
4);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
#endif
@@ -3118,13 +3119,13 @@ schedule_PCH(module_id_t module_idP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
- if (!CCE_allocation_infeasible(module_idP,
- CC_id,
- 0,
- subframeP,
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ if (!CCE_allocation_infeasible(module_idP,
+ CC_id,
+ 0,
+ subframeP,
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
P_RNTI)) {
- LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n",
+ LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n",
frameP,
subframeP);
dl_req->number_dci++;
@@ -3143,13 +3144,13 @@ schedule_PCH(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFE;
#ifdef FORMAT1C
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 3; // format 1C
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_vrb_dl / n_rb_step,
- first_rb / n_rb_step,
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_vrb_dl / n_rb_step,
+ first_rb / n_rb_step,
Lcrbs / n_rb_step);
#else
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_rb_dl,
- first_rb,
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_rb_dl,
+ first_rb,
4);
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
#endif
@@ -3192,9 +3193,9 @@ schedule_PCH(module_id_t module_idP,
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
} else {
LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",
- module_idP,
- CC_id,
- frameP,
+ module_idP,
+ CC_id,
+ frameP,
subframeP);
continue;
}
@@ -3211,10 +3212,10 @@ schedule_PCH(module_id_t module_idP,
0,
0);
LOG_D(OPT,"[eNB %d][PCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
- module_idP,
- frameP,
- CC_id,
- 0xffff,
+ module_idP,
+ frameP,
+ CC_id,
+ 0xffff,
pcch_sdu_length);
}
@@ -3224,16 +3225,16 @@ schedule_PCH(module_id_t module_idP,
eNB->eNB_stats[CC_id].pcch_mcs = mcs;
//paging first_rb log
LOG_D(MAC,"[eNB %d] Frame %d subframe %d PCH: paging_ue_index %d pcch_sdu_length %d mcs %d first_rb %d\n",
- module_idP,
- frameP,
- subframeP,
- ue_pf_po->ue_index_value,
- pcch_sdu_length,
- mcs,
+ module_idP,
+ frameP,
+ subframeP,
+ ue_pf_po->ue_index_value,
+ pcch_sdu_length,
+ mcs,
first_rb);
pthread_mutex_lock(&ue_pf_po_mutex);
- memset(ue_pf_po,
- 0,
+ memset(ue_pf_po,
+ 0,
sizeof(UE_PF_PO_t));
pthread_mutex_unlock(&ue_pf_po_mutex);
}
@@ -3245,10 +3246,10 @@ schedule_PCH(module_id_t module_idP,
return;
}
-static int
-slice_priority_compare(const void *_a,
- const void *_b,
- void *_c)
+static int
+slice_priority_compare(const void *_a,
+ const void *_b,
+ void *_c)
{
const int slice_id1 = *(const int *) _a;
const int slice_id2 = *(const int *) _b;
@@ -3262,9 +3263,9 @@ slice_priority_compare(const void *_a,
return 1;
}
-void
-slice_priority_sort(module_id_t Mod_id,
- int slice_list[MAX_NUM_SLICES])
+void
+slice_priority_sort(module_id_t Mod_id,
+ int slice_list[MAX_NUM_SLICES])
{
int i;
int n_dl = RC.mac[Mod_id]->slice_info.n_dl;
@@ -3272,10 +3273,10 @@ slice_priority_sort(module_id_t Mod_id,
slice_list[i] = i;
}
- qsort_r(slice_list,
- n_dl,
+ qsort_r(slice_list,
+ n_dl,
sizeof(int),
- slice_priority_compare,
+ slice_priority_compare,
&Mod_id);
return;
}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index db98335527..4657493e59 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -841,6 +841,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
#ifdef DEBUG_eNB_SCHEDULER
int k;
#endif
+
start_meas(&eNB->schedule_dlsch);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
@@ -1219,8 +1220,8 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
}
add_ue_dlsch_info(module_idP,
- CC_id,
- UE_id,
+ CC_id,
+ UE_id,
subframeP,
S_DL_SCHEDULED,
rnti);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index 649f763f42..faf36026d6 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -542,7 +542,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
module_idP, CC_id, frameP, subframeP, i, j);
- mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0],
+ mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0],
i); // this is the mbsfn sync area index
if (mcch_sdu_length > 0) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
index 881359f274..2f566c0d7a 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
@@ -169,7 +169,7 @@ schedule_ue_spec_phy_test(
1, // number of subbands
// uint8_t codebook_index,
4, // UE category capacity
- LTE_PDSCH_ConfigDedicated__p_a_dB0,
+ LTE_PDSCH_ConfigDedicated__p_a_dB0,
0, // delta_power_offset for TM5
0, // ngap
0, // nprb
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 579449ac15..1488209dd7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -64,9 +64,9 @@ extern RAN_CONTEXT_t RC;
extern uint8_t nfapi_mode;
//------------------------------------------------------------------------------
-int
-choose(int n,
- int k)
+int
+choose(int n,
+ int k)
//------------------------------------------------------------------------------
{
int res = 1;
@@ -90,10 +90,10 @@ choose(int n,
//------------------------------------------------------------------------------
// Patented algorithm from Yang et al, US Patent 2009, "Channel Quality Indexing and Reverse Indexing"
-void reverse_index(int N,
- int M,
- int r,
- int *v)
+void reverse_index(int N,
+ int M,
+ int r,
+ int *v)
//------------------------------------------------------------------------------
{
int BaseValue = 0;
@@ -106,7 +106,7 @@ void reverse_index(int N,
i = M;
while (i > 0 && r > 0) {
- IncreaseValue = choose(N - M + 1 - sumV - v[i - 1] + i - 2,
+ IncreaseValue = choose(N - M + 1 - sumV - v[i - 1] + i - 2,
i - 1);
ThresholdValue = BaseValue + IncreaseValue;
@@ -123,7 +123,7 @@ void reverse_index(int N,
//------------------------------------------------------------------------------
int
-to_prb(int dl_Bandwidth)
+to_prb(int dl_Bandwidth)
//------------------------------------------------------------------------------
{
int prbmap[6] = { 6, 15, 25, 50, 75, 100 };
@@ -132,8 +132,8 @@ to_prb(int dl_Bandwidth)
}
//------------------------------------------------------------------------------
-int
-to_rbg(int dl_Bandwidth)
+int
+to_rbg(int dl_Bandwidth)
//------------------------------------------------------------------------------
{
int rbgmap[6] = { 6, 8, 13, 17, 19, 25 };
@@ -142,8 +142,8 @@ to_rbg(int dl_Bandwidth)
}
//------------------------------------------------------------------------------
-int
-get_phich_resource_times6(COMMON_channels_t *cc)
+int
+get_phich_resource_times6(COMMON_channels_t *cc)
//------------------------------------------------------------------------------
{
int phichmap[4] = { 1, 3, 6, 12 };
@@ -156,10 +156,10 @@ get_phich_resource_times6(COMMON_channels_t *cc)
}
//------------------------------------------------------------------------------
-uint16_t
-mac_computeRIV(uint16_t N_RB_DL,
- uint16_t RBstart,
- uint16_t Lcrbs)
+uint16_t
+mac_computeRIV(uint16_t N_RB_DL,
+ uint16_t RBstart,
+ uint16_t Lcrbs)
//------------------------------------------------------------------------------
{
if (Lcrbs <= (1 + (N_RB_DL >> 1))) {
@@ -169,8 +169,8 @@ mac_computeRIV(uint16_t N_RB_DL,
}
//------------------------------------------------------------------------------
-uint8_t
-getQm(uint8_t mcs)
+uint8_t
+getQm(uint8_t mcs)
//------------------------------------------------------------------------------
{
if (mcs < 10) return (2);
@@ -184,7 +184,7 @@ get_Msg3alloc(COMMON_channels_t *cc,
sub_frame_t current_subframe,
frame_t current_frame,
frame_t *frame,
- sub_frame_t *subframe)
+ sub_frame_t *subframe)
//------------------------------------------------------------------------------
{
// Fill in other TDD Configuration!!!!
@@ -295,8 +295,8 @@ void
get_Msg3allocret(COMMON_channels_t *cc,
sub_frame_t current_subframe,
frame_t current_frame,
- frame_t *frame,
- sub_frame_t *subframe)
+ frame_t *frame,
+ sub_frame_t *subframe)
//------------------------------------------------------------------------------
{
int subframeAssignment;
@@ -338,9 +338,9 @@ get_Msg3allocret(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint8_t
-subframe2harqpid(COMMON_channels_t *cc,
+subframe2harqpid(COMMON_channels_t *cc,
frame_t frame,
- sub_frame_t subframe)
+ sub_frame_t subframe)
//------------------------------------------------------------------------------
{
uint8_t ret = 255;
@@ -413,8 +413,8 @@ subframe2harqpid(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint8_t
get_Msg3harqpid(COMMON_channels_t *cc,
- frame_t frame,
- sub_frame_t current_subframe)
+ frame_t frame,
+ sub_frame_t current_subframe)
//------------------------------------------------------------------------------
{
uint8_t ul_subframe = 0;
@@ -492,16 +492,16 @@ get_Msg3harqpid(COMMON_channels_t *cc,
}
}
- return (subframe2harqpid(cc,
- ul_frame,
+ return (subframe2harqpid(cc,
+ ul_frame,
ul_subframe));
}
//------------------------------------------------------------------------------
uint32_t
-pdcchalloc2ulframe(COMMON_channels_t *ccP,
- uint32_t frame,
- uint8_t n)
+pdcchalloc2ulframe(COMMON_channels_t *ccP,
+ uint32_t frame,
+ uint8_t n)
//------------------------------------------------------------------------------
{
uint32_t ul_frame = (frame + (n >= 6 ? 1 : 0));
@@ -519,8 +519,8 @@ pdcchalloc2ulframe(COMMON_channels_t *ccP,
}
}
}
- LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n",
- frame,
+ LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n",
+ frame,
n,
ul_frame);
@@ -528,9 +528,9 @@ pdcchalloc2ulframe(COMMON_channels_t *ccP,
}
//------------------------------------------------------------------------------
-uint8_t
-pdcchalloc2ulsubframe(COMMON_channels_t *ccP,
- uint8_t n)
+uint8_t
+pdcchalloc2ulsubframe(COMMON_channels_t *ccP,
+ uint8_t n)
//------------------------------------------------------------------------------
{
uint8_t ul_subframe;
@@ -544,16 +544,16 @@ pdcchalloc2ulsubframe(COMMON_channels_t *ccP,
else
ul_subframe = ((n + 4) % 10);
- LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n",
- n,
+ LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n",
+ n,
ul_subframe);
return ul_subframe;
}
//------------------------------------------------------------------------------
-int
-is_UL_sf(COMMON_channels_t *ccP,
- sub_frame_t subframeP)
+int
+is_UL_sf(COMMON_channels_t *ccP,
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
// if FDD return dummy value
@@ -621,9 +621,9 @@ is_UL_sf(COMMON_channels_t *ccP,
}
//------------------------------------------------------------------------------
-int
-is_S_sf(COMMON_channels_t *ccP,
- sub_frame_t subframeP)
+int
+is_S_sf(COMMON_channels_t *ccP,
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
// if FDD return dummy value
@@ -649,9 +649,9 @@ is_S_sf(COMMON_channels_t *ccP,
}
//------------------------------------------------------------------------------
-uint8_t
-ul_subframe2_k_phich(COMMON_channels_t *cc,
- sub_frame_t ul_subframe)
+uint8_t
+ul_subframe2_k_phich(COMMON_channels_t *cc,
+ sub_frame_t ul_subframe)
//------------------------------------------------------------------------------
{
if(cc->tdd_Config) { //TODO fill other tdd config
@@ -678,9 +678,9 @@ ul_subframe2_k_phich(COMMON_channels_t *cc,
}
//------------------------------------------------------------------------------
-uint16_t
-get_pucch1_absSF(COMMON_channels_t *cc,
- uint16_t dlsch_absSF)
+uint16_t
+get_pucch1_absSF(COMMON_channels_t *cc,
+ uint16_t dlsch_absSF)
//------------------------------------------------------------------------------
{
uint16_t sf, f, nextf;
@@ -688,7 +688,7 @@ get_pucch1_absSF(COMMON_channels_t *cc,
if (tdd_Config == NULL) { //FDD n+4
return (dlsch_absSF + 4) % 10240;
- }
+ }
sf = dlsch_absSF % 10;
f = dlsch_absSF / 10;
@@ -768,16 +768,16 @@ get_pucch1_absSF(COMMON_channels_t *cc,
tdd_Config->subframeAssignment);
return 0;
}
-
+
AssertFatal(1 == 0, "Shouldn't get here\n");
}
//------------------------------------------------------------------------------
void
-get_srs_pos(COMMON_channels_t *cc,
+get_srs_pos(COMMON_channels_t *cc,
uint16_t isrs,
- uint16_t *psrsPeriodicity,
- uint16_t *psrsOffset)
+ uint16_t *psrsPeriodicity,
+ uint16_t *psrsOffset)
//------------------------------------------------------------------------------
{
if (cc->tdd_Config) { // TDD
@@ -844,9 +844,9 @@ get_srs_pos(COMMON_channels_t *cc,
void
get_csi_params(COMMON_channels_t *cc,
struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic,
- uint16_t *Npd,
- uint16_t *N_OFFSET_CQI,
- int *H)
+ uint16_t *Npd,
+ uint16_t *N_OFFSET_CQI,
+ int *H)
//------------------------------------------------------------------------------
{
AssertFatal(cqi_ReportPeriodic != NULL, "cqi_ReportPeriodic is null!\n");
@@ -924,10 +924,10 @@ get_csi_params(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint8_t
-get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,
+get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,
uint8_t tmode,
uint8_t ri,
- LTE_CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic)
+ LTE_CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic)
//------------------------------------------------------------------------------
{
int Ntab[6] = { 0, 4, 7, 9, 10, 13 };
@@ -1046,11 +1046,11 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint8_t
-get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,
+get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,
int CC_idP,
- COMMON_channels_t *cc,
+ COMMON_channels_t *cc,
uint8_t tmode,
- struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic)
+ struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic)
//------------------------------------------------------------------------------
{
int no_pmi = 0;
@@ -1077,7 +1077,7 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,
break;
}
- if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI ||
+ if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI ||
sched_ctl->feedback_cnt[CC_idP] == 0) {
// send wideband report every opportunity if wideband reporting mode is selected, else every H opportunities
if (no_pmi == 1) return 4;
@@ -1086,8 +1086,8 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,
if (cc->p_eNB == 4 && ri == 1) return 8;
if (cc->p_eNB == 4 && ri == 2) return 11;
AssertFatal(1 == 0, "illegal combination p %d, ri %d, no_pmi %d\n",
- cc->p_eNB,
- ri,
+ cc->p_eNB,
+ ri,
no_pmi);
} else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) {
if (no_pmi == 1 || ri == 1) return (4 + Ltab[cc->mib->message.dl_Bandwidth]);
@@ -1111,11 +1111,11 @@ fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
uint8_t mcs,
uint8_t ndi,
uint8_t rv,
- uint8_t vrb_flag)
+ uint8_t vrb_flag)
//------------------------------------------------------------------------------
{
memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
-
+
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
@@ -1136,12 +1136,12 @@ fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
//------------------------------------------------------------------------------
void
-program_dlsch_acknak(module_id_t module_idP,
- int CC_idP,
+program_dlsch_acknak(module_id_t module_idP,
+ int CC_idP,
int UE_idP,
- frame_t frameP,
+ frame_t frameP,
sub_frame_t subframeP,
- uint8_t cce_idx)
+ uint8_t cce_idx)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -1155,8 +1155,8 @@ program_dlsch_acknak(module_id_t module_idP,
nfapi_ul_config_harq_information *harq_information = NULL;
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 2, 0))
struct LTE_PhysicalConfigDedicated__ext2 *ext2 = UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2;
- if (ext2 &&
- ext2->pucch_ConfigDedicated_v1020 &&
+ if (ext2 &&
+ ext2->pucch_ConfigDedicated_v1020 &&
ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 &&
*ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 == LTE_PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true)
use_simultaneous_pucch_pusch = 1;
@@ -1164,22 +1164,22 @@ program_dlsch_acknak(module_id_t module_idP,
#endif
// pucch1 and pusch feedback is similar, namely in n+k subframes from now
// This is used in the following "if/else" condition to check if there isn't or is already an UL grant in n+k
- int16_t ul_absSF = get_pucch1_absSF(&cc[CC_idP],
+ int16_t ul_absSF = get_pucch1_absSF(&cc[CC_idP],
subframeP + (10 * frameP));
- if ((ul_config_pdu = has_ul_grant(module_idP,
- CC_idP,
- ul_absSF,
+ if ((ul_config_pdu = has_ul_grant(module_idP,
+ CC_idP,
+ ul_absSF,
rnti)) == NULL) {
// no UL grant so
// Program ACK/NAK alone Format 1a/b or 3
ul_req = &eNB->UL_req_tmp[CC_idP][ul_absSF % 10].ul_config_request_body;
ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
// Do PUCCH
- fill_nfapi_uci_acknak(module_idP,
- CC_idP,
- rnti,
- subframeP + (10 * frameP),
+ fill_nfapi_uci_acknak(module_idP,
+ CC_idP,
+ rnti,
+ subframeP + (10 * frameP),
cce_idx);
} else {
/* there is already an existing UL grant so update it if needed
@@ -1193,7 +1193,7 @@ program_dlsch_acknak(module_id_t module_idP,
harq_information = &ul_config_pdu->ulsch_uci_harq_pdu.harq_information;
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
LOG_D(MAC, "Frame %d, Subframe %d: Switched UCI HARQ to ULSCH UCI HARQ\n",
- frameP,
+ frameP,
subframeP);
} else {
// Convert it to an NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE
@@ -1205,7 +1205,7 @@ program_dlsch_acknak(module_id_t module_idP,
ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks
= ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet
LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH HARQ\n",
- frameP,
+ frameP,
subframeP);
}
@@ -1291,28 +1291,28 @@ program_dlsch_acknak(module_id_t module_idP,
}
if (ulsch_harq_information) {
- fill_nfapi_ulsch_harq_information(module_idP,
- CC_idP,
- rnti,
- ulsch_harq_information,
+ fill_nfapi_ulsch_harq_information(module_idP,
+ CC_idP,
+ rnti,
+ ulsch_harq_information,
subframeP);
}
if (harq_information) {
- fill_nfapi_harq_information(module_idP,
- CC_idP,
- rnti,
- harq_information,
+ fill_nfapi_harq_information(module_idP,
+ CC_idP,
+ rnti,
+ harq_information,
cce_idx);
}
return;
}
//------------------------------------------------------------------------------
-uint8_t
-get_V_UL_DAI(module_id_t module_idP,
- int CC_idP,
+uint8_t
+get_V_UL_DAI(module_id_t module_idP,
+ int CC_idP,
uint16_t rntiP,
- sub_frame_t subframeP)
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframeP].hi_dci0_request_body;
@@ -1334,7 +1334,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
int CC_idP,
uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information *harq_information,
- sub_frame_t subframeP)
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -1347,10 +1347,10 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
AssertFatal(UE_list != NULL, "UE_list is null\n");
LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated;
- AssertFatal(physicalConfigDedicated != NULL, "physicalConfigDedicated for rnti %x is null\n",
+ AssertFatal(physicalConfigDedicated != NULL, "physicalConfigDedicated for rnti %x is null\n",
rntiP);
- struct LTE_PUSCH_ConfigDedicated *puschConfigDedicated = physicalConfigDedicated->pusch_ConfigDedicated;
+ struct LTE_PUSCH_ConfigDedicated *puschConfigDedicated = physicalConfigDedicated->pusch_ConfigDedicated;
AssertFatal(puschConfigDedicated != NULL, "physicalConfigDedicated->puschConfigDedicated for rnti %x is null\n",
rntiP);
@@ -1388,9 +1388,9 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
harq_information_rel10->harq_size = 1;
else {
if (harq_information_rel10->ack_nack_mode == 1)
- harq_information_rel10->harq_size = get_V_UL_DAI(module_idP,
- CC_idP,
- rntiP,
+ harq_information_rel10->harq_size = get_V_UL_DAI(module_idP,
+ CC_idP,
+ rntiP,
subframeP);
else
harq_information_rel10->harq_size = 1;
@@ -1403,9 +1403,9 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
harq_information_rel10->harq_size = 2;
} else {
if (harq_information_rel10->ack_nack_mode == 1)
- harq_information_rel10->harq_size = get_V_UL_DAI(module_idP,
- CC_idP,
- rntiP,
+ harq_information_rel10->harq_size = get_V_UL_DAI(module_idP,
+ CC_idP,
+ rntiP,
subframeP);
else
harq_information_rel10->harq_size = 2;
@@ -1417,7 +1417,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
}
//------------------------------------------------------------------------------
-uint8_t
+uint8_t
Np[6][4] = {
{0, 1, 3, 5},
{0, 3, 8, 13},
@@ -1430,10 +1430,10 @@ Np[6][4] = {
// This is part of the PUCCH allocation procedure (see Section 10.1 36.213)
//------------------------------------------------------------------------------
-uint16_t
+uint16_t
getNp(int dl_Bandwidth,
uint8_t nCCE,
- uint8_t plus1)
+ uint8_t plus1)
//------------------------------------------------------------------------------
{
AssertFatal(dl_Bandwidth < 6, "dl_Bandwidth %d>5\n", dl_Bandwidth);
@@ -1453,27 +1453,27 @@ fill_nfapi_harq_information(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
nfapi_ul_config_harq_information *harq_information,
- uint8_t cce_idxP)
+ uint8_t cce_idxP)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
UE_list_t *UE_list = &eNB->UE_list;
- int UE_id = find_UE_id(module_idP,
+ int UE_id = find_UE_id(module_idP,
rntiP);
AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
AssertFatal(UE_list != NULL, "UE_list is null\n");
harq_information->harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
harq_information->harq_information_rel11.num_ant_ports = 1;
-
+
LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated;
struct LTE_PUCCH_ConfigDedicated *pucch_ConfigDedicated = NULL;
if (physicalConfigDedicated != NULL) pucch_ConfigDedicated = physicalConfigDedicated->pucch_ConfigDedicated;
- switch (get_tmode(module_idP,
- CC_idP,
+ switch (get_tmode(module_idP,
+ CC_idP,
UE_id)) {
case 1:
case 2:
@@ -1494,7 +1494,7 @@ fill_nfapi_harq_information(module_id_t module_idP,
}
harq_information->harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
- harq_information->harq_information_rel10_tdd.n_pucch_1_0
+ harq_information->harq_information_rel10_tdd.n_pucch_1_0
= getNp(cc->mib->message.dl_Bandwidth, cce_idxP, 0) + cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1;
} else {
@@ -1540,7 +1540,7 @@ fill_nfapi_uci_acknak(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
uint16_t absSFP,
- uint8_t cce_idxP)
+ uint8_t cce_idxP)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -1550,24 +1550,24 @@ fill_nfapi_uci_acknak(module_id_t module_idP,
nfapi_ul_config_request_body_t *ul_req_body = &ul_req->ul_config_request_body;
nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
-
+
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_uci_harq_pdu));
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = rntiP;
- fill_nfapi_harq_information(module_idP,
+ fill_nfapi_harq_information(module_idP,
CC_idP,
rntiP,
- &ul_config_pdu->uci_harq_pdu.harq_information,
+ &ul_config_pdu->uci_harq_pdu.harq_information,
cce_idxP);
LOG_D(MAC, "Filled in UCI HARQ request for rnti %x SF %d.%d acknakSF %d.%d, cce_idxP %d-> n1_pucch %d\n",
- rntiP,
- absSFP / 10,
- absSFP % 10,
+ rntiP,
+ absSFP / 10,
+ absSFP % 10,
ackNAK_absSF / 10,
- ackNAK_absSF % 10,
+ ackNAK_absSF % 10,
cce_idxP,
ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0);
@@ -1595,7 +1595,7 @@ fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
uint8_t transport_block_to_codeword_swap_flag,
uint8_t transmission_scheme,
uint8_t number_of_layers,
- uint8_t number_of_subbands,
+ uint8_t number_of_subbands,
// uint8_t codebook_index,
uint8_t ue_category_capacity,
uint8_t pa,
@@ -1604,7 +1604,7 @@ fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
uint8_t nprb,
uint8_t transmission_mode,
uint8_t num_bf_prb_per_subband,
- uint8_t num_bf_vector)
+ uint8_t num_bf_vector)
//------------------------------------------------------------------------------
{
nfapi_dl_config_request_pdu_t *dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
@@ -1646,13 +1646,13 @@ fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,
uint16_t absSF,
uint16_t pdu_length,
int16_t pdu_index,
- uint8_t *pdu)
+ uint8_t *pdu)
//------------------------------------------------------------------------------
{
nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
-
+
LOG_D(MAC, "Filling TX_req %d for pdu length %d\n",
- tx_req_body->number_of_pdus,
+ tx_req_body->number_of_pdus,
pdu_length);
TX_req->pdu_length = pdu_length;
@@ -1686,7 +1686,7 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pd
uint8_t ul_tx_mode,
uint8_t current_tx_nb,
uint8_t n_srs,
- uint16_t size)
+ uint16_t size)
{
uint8_t ri_size = 0;
@@ -1737,7 +1737,7 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pd
nfapi_ul_config_cqi_ri_information_rel9_t *ri_information = &ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9;
int max_ri = (1 << ri_information->aperiodic_cqi_pmi_ri_report.cc[0].ri_size);
for (int ri = 0; ri < max_ri; ri++) {
- ri_information->aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri]
+ ri_information->aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri]
= get_dl_cqi_pmi_size_pusch(cc,
tmode,
1 + ri,
@@ -1752,11 +1752,11 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pd
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
//------------------------------------------------------------------------------
void
-fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *ul_config_pdu,
+fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *ul_config_pdu,
uint8_t ue_type,
uint16_t total_number_of_repetitions,
uint16_t repetition_number,
- uint16_t initial_transmission_sf_io)
+ uint16_t initial_transmission_sf_io)
//------------------------------------------------------------------------------
{
// Re13 fields
@@ -1769,8 +1769,8 @@ fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *ul_config_pd
}
//------------------------------------------------------------------------------
-int
-get_numnarrowbands(long dl_Bandwidth)
+int
+get_numnarrowbands(long dl_Bandwidth)
//------------------------------------------------------------------------------
{
int nb_tab[6] = { 1, 2, 4, 8, 12, 16 };
@@ -1779,8 +1779,8 @@ get_numnarrowbands(long dl_Bandwidth)
}
//------------------------------------------------------------------------------
-int
-get_numnarrowbandbits(long dl_Bandwidth)
+int
+get_numnarrowbandbits(long dl_Bandwidth)
//------------------------------------------------------------------------------
{
int nbbits_tab[6] = { 0, 1, 2, 3, 4, 4 };
@@ -1790,24 +1790,24 @@ get_numnarrowbandbits(long dl_Bandwidth)
//This implements the frame/subframe condition for first subframe of MPDCCH transmission (Section 9.1.5 36.213, Rel 13/14)
//------------------------------------------------------------------------------
-int
+int
startSF_fdd_RA_times2[8] = { 2, 3, 4, 5, 8, 10, 16, 20 };
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-int
+int
startSF_tdd_RA[7] = { 1, 2, 4, 5, 8, 10, 20 };
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
-mpdcch_sf_condition(eNB_MAC_INST *eNB,
- int CC_id,
+mpdcch_sf_condition(eNB_MAC_INST *eNB,
+ int CC_id,
frame_t frameP,
- sub_frame_t subframeP,
+ sub_frame_t subframeP,
int rmax,
- MPDCCH_TYPES_t mpdcch_type,
- int UE_id)
+ MPDCCH_TYPES_t mpdcch_type,
+ int UE_id)
//------------------------------------------------------------------------------
{
struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = eNB->common_channels[CC_id].radioResourceConfigCommon_BR-> ext4->prach_ConfigCommon_v1310;
@@ -1866,9 +1866,9 @@ mpdcch_sf_condition(eNB_MAC_INST *eNB,
}
//------------------------------------------------------------------------------
-int
-narrowband_to_first_rb(COMMON_channels_t *cc,
- int nb_index)
+int
+narrowband_to_first_rb(COMMON_channels_t *cc,
+ int nb_index)
//------------------------------------------------------------------------------
{
switch (cc->mib->message.dl_Bandwidth) {
@@ -1906,7 +1906,7 @@ narrowband_to_first_rb(COMMON_channels_t *cc,
#endif
//------------------------------------------------------------------------------
-void
+void
init_ue_sched_info(void)
//------------------------------------------------------------------------------
{
@@ -1931,9 +1931,9 @@ init_ue_sched_info(void)
}
//------------------------------------------------------------------------------
-unsigned char
-get_ue_weight(module_id_t module_idP,
- int CC_idP,
+unsigned char
+get_ue_weight(module_id_t module_idP,
+ int CC_idP,
int ue_idP)
//------------------------------------------------------------------------------
{
@@ -1941,8 +1941,8 @@ get_ue_weight(module_id_t module_idP,
}
//------------------------------------------------------------------------------
-int
-find_UE_id(module_id_t mod_idP,
+int
+find_UE_id(module_id_t mod_idP,
rnti_t rntiP)
//------------------------------------------------------------------------------
{
@@ -1961,9 +1961,9 @@ find_UE_id(module_id_t mod_idP,
}
//------------------------------------------------------------------------------
-int
-find_RA_id(module_id_t mod_idP,
- int CC_idP,
+int
+find_RA_id(module_id_t mod_idP,
+ int CC_idP,
rnti_t rntiP)
//------------------------------------------------------------------------------
{
@@ -1973,8 +1973,8 @@ find_RA_id(module_id_t mod_idP,
for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) {
LOG_D(MAC, "Checking RA_id %d for %x : state %d\n",
- RA_id,
- rntiP,
+ RA_id,
+ rntiP,
ra[RA_id].state);
if (ra[RA_id].state != IDLE && ra[RA_id].rnti == rntiP)
@@ -1985,8 +1985,8 @@ find_RA_id(module_id_t mod_idP,
}
//------------------------------------------------------------------------------
-int
-UE_num_active_CC(UE_list_t *listP,
+int
+UE_num_active_CC(UE_list_t *listP,
int ue_idP)
//------------------------------------------------------------------------------
{
@@ -1994,25 +1994,23 @@ UE_num_active_CC(UE_list_t *listP,
}
//------------------------------------------------------------------------------
-int
-UE_PCCID(module_id_t mod_idP,
+int
+UE_PCCID(module_id_t mod_idP,
int ue_idP)
//------------------------------------------------------------------------------
{
- if (!RC.mac || !RC.mac[mod_idP]) return 0;
-
return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]);
}
//------------------------------------------------------------------------------
-rnti_t
-UE_RNTI(module_id_t mod_idP,
+rnti_t
+UE_RNTI(module_id_t mod_idP,
int ue_idP)
//------------------------------------------------------------------------------
{
if (!RC.mac || !RC.mac[mod_idP]) return 0;
- rnti_t rnti = RC.mac[mod_idP]->UE_list.UE_template[UE_PCCID(mod_idP,
+ rnti_t rnti = RC.mac[mod_idP]->UE_list.UE_template[UE_PCCID(mod_idP,
ue_idP)][ue_idP].rnti;
if (rnti > 0) {
@@ -2025,13 +2023,11 @@ UE_RNTI(module_id_t mod_idP,
}
//------------------------------------------------------------------------------
-boolean_t
-is_UE_active(module_id_t mod_idP,
+boolean_t
+is_UE_active(module_id_t mod_idP,
int ue_idP)
//------------------------------------------------------------------------------
{
- if (!RC.mac || !RC.mac[mod_idP]) return 0;
-
return (RC.mac[mod_idP]->UE_list.active[ue_idP]);
}
@@ -2039,7 +2035,7 @@ is_UE_active(module_id_t mod_idP,
unsigned char
get_aggregation(uint8_t bw_index,
uint8_t cqi,
- uint8_t dci_fmt)
+ uint8_t dci_fmt)
//------------------------------------------------------------------------------
{
unsigned char aggregation = 3;
@@ -2080,28 +2076,28 @@ get_aggregation(uint8_t bw_index,
cqi,
bw_index,
dci_fmt);
-
+
return 1 << aggregation;
}
//------------------------------------------------------------------------------
-void
-dump_ue_list(UE_list_t *listP,
- int ul_flag)
+void
+dump_ue_list(UE_list_t *listP,
+ int ul_flag)
//------------------------------------------------------------------------------
{
int j;
if (ul_flag == 0) {
for (j = listP->head; j >= 0; j = listP->next[j]) {
- LOG_T(MAC, "node %d => %d\n",
- j,
+ LOG_T(MAC, "node %d => %d\n",
+ j,
listP->next[j]);
}
} else {
for (j = listP->head_ul; j >= 0; j = listP->next_ul[j]) {
- LOG_T(MAC, "node %d => %d\n",
- j,
+ LOG_T(MAC, "node %d => %d\n",
+ j,
listP->next_ul[j]);
}
}
@@ -2109,15 +2105,15 @@ dump_ue_list(UE_list_t *listP,
}
//------------------------------------------------------------------------------
-int
-add_new_ue(module_id_t mod_idP,
- int cc_idP,
- rnti_t rntiP,
+int
+add_new_ue(module_id_t mod_idP,
+ int cc_idP,
+ rnti_t rntiP,
int harq_pidP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, uint8_t rach_resource_type
#endif
- )
+ )
//------------------------------------------------------------------------------
{
int UE_id;
@@ -2125,10 +2121,10 @@ add_new_ue(module_id_t mod_idP,
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
LOG_D(MAC, "[eNB %d, CC_id %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",
- mod_idP,
- cc_idP,
- rntiP,
- UE_list->avail,
+ mod_idP,
+ cc_idP,
+ rntiP,
+ UE_list->avail,
UE_list->num_UEs);
dump_ue_list(UE_list, 0);
@@ -2139,7 +2135,7 @@ add_new_ue(module_id_t mod_idP,
UE_id = i;
memset(&UE_list->UE_template[cc_idP][UE_id], 0, sizeof(UE_TEMPLATE));
-
+
UE_list->UE_template[cc_idP][UE_id].rnti = rntiP;
UE_list->UE_template[cc_idP][UE_id].configured = FALSE;
UE_list->numactiveCCs[UE_id] = 1;
@@ -2157,10 +2153,10 @@ add_new_ue(module_id_t mod_idP,
UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type;
#endif
- memset((void *) &UE_list->UE_sched_ctrl[UE_id],
+ memset((void *) &UE_list->UE_sched_ctrl[UE_id],
0,
sizeof(UE_sched_ctrl));
- memset((void *) &UE_list->eNB_UE_stats[cc_idP][UE_id],
+ memset((void *) &UE_list->eNB_UE_stats[cc_idP][UE_id],
0,
sizeof(eNB_UE_STATS));
UE_list->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
@@ -2179,25 +2175,25 @@ add_new_ue(module_id_t mod_idP,
eNB_ulsch_info[mod_idP][cc_idP][UE_id].status = S_UL_WAITING;
eNB_dlsch_info[mod_idP][cc_idP][UE_id].status = S_DL_WAITING;
LOG_D(MAC, "[eNB %d] Add UE_id %d on Primary CC_id %d: rnti %x\n",
- mod_idP,
- UE_id,
- cc_idP,
+ mod_idP,
+ UE_id,
+ cc_idP,
rntiP);
- dump_ue_list(UE_list,
+ dump_ue_list(UE_list,
0);
return (UE_id);
}
// printf("MAC: cannot add new UE for rnti %x\n", rntiP);
LOG_E(MAC, "error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
- dump_ue_list(UE_list,
+ dump_ue_list(UE_list,
0);
return -1;
}
//------------------------------------------------------------------------------
-int
-rrc_mac_remove_ue(module_id_t mod_idP,
+int
+rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP)
//------------------------------------------------------------------------------
{
@@ -2209,7 +2205,7 @@ rrc_mac_remove_ue(module_id_t mod_idP,
eNB_UE_STATS *ue_stats;
if (UE_id == -1) {
- LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n",
+ LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n",
rntiP);
return 0;
}
@@ -2218,7 +2214,7 @@ rrc_mac_remove_ue(module_id_t mod_idP,
UE_id);
LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",
UE_id,
- pCC_id,
+ pCC_id,
rntiP);
dump_ue_list(UE_list,
0);
@@ -2281,12 +2277,12 @@ rrc_mac_remove_ue(module_id_t mod_idP,
eNB_dlsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
// check if this has an RA process active
- if (find_RA_id(mod_idP,
- pCC_id,
+ if (find_RA_id(mod_idP,
+ pCC_id,
rntiP) != -1) {
- cancel_ra_proc(mod_idP,
- pCC_id,
- 0,
+ cancel_ra_proc(mod_idP,
+ pCC_id,
+ 0,
rntiP);
}
@@ -2319,10 +2315,10 @@ rrc_mac_remove_ue(module_id_t mod_idP,
}
//------------------------------------------------------------------------------
-int
-prev(UE_list_t *listP,
- int nodeP,
- int ul_flag)
+int
+prev(UE_list_t *listP,
+ int nodeP,
+ int ul_flag)
//------------------------------------------------------------------------------
{
int j;
@@ -2350,32 +2346,32 @@ prev(UE_list_t *listP,
}
LOG_E(MAC, "error in prev(), could not find previous to %d in UE_list %s, should never happen, Dumping UE list\n",
- nodeP,
+ nodeP,
(ul_flag == 0) ? "DL" : "UL");
- dump_ue_list(listP,
+ dump_ue_list(listP,
ul_flag);
return -1;
}
//------------------------------------------------------------------------------
-void
-swap_UEs(UE_list_t *listP,
- int nodeiP,
- int nodejP,
- int ul_flag)
+void
+swap_UEs(UE_list_t *listP,
+ int nodeiP,
+ int nodejP,
+ int ul_flag)
//------------------------------------------------------------------------------
{
int prev_i, prev_j, next_i, next_j;
- LOG_T(MAC, "Swapping UE %d,%d\n",
- nodeiP,
+ LOG_T(MAC, "Swapping UE %d,%d\n",
+ nodeiP,
nodejP);
- dump_ue_list(listP,
+ dump_ue_list(listP,
ul_flag);
- prev_i = prev(listP,
- nodeiP,
+ prev_i = prev(listP,
+ nodeiP,
ul_flag);
- prev_j = prev(listP,
- nodejP,
+ prev_j = prev(listP,
+ nodejP,
ul_flag);
AssertFatal((prev_i >= 0) && (prev_j >= 0), "swap_UEs: problem");
@@ -2388,9 +2384,9 @@ swap_UEs(UE_list_t *listP,
}
LOG_T(MAC, "[%s] next_i %d, next_i, next_j %d, head %d \n",
- (ul_flag == 0) ? "DL" : "UL",
- next_i,
- next_j,
+ (ul_flag == 0) ? "DL" : "UL",
+ next_i,
+ next_j,
listP->head);
if (ul_flag == 0) {
@@ -2419,12 +2415,12 @@ swap_UEs(UE_list_t *listP,
listP->next[nodeiP] = next_j;
if (nodeiP == listP->head) {
- LOG_T(MAC, "changing head to %d\n",
+ LOG_T(MAC, "changing head to %d\n",
nodejP);
listP->head = nodejP;
listP->next[prev_j] = nodeiP;
} else if (nodejP == listP->head) {
- LOG_D(MAC, "changing head to %d\n",
+ LOG_D(MAC, "changing head to %d\n",
nodeiP);
listP->head = nodeiP;
listP->next[prev_i] = nodejP;
@@ -2459,12 +2455,12 @@ swap_UEs(UE_list_t *listP,
listP->next_ul[nodeiP] = next_j;
if (nodeiP == listP->head_ul) {
- LOG_T(MAC, "[UL]changing head to %d\n",
+ LOG_T(MAC, "[UL]changing head to %d\n",
nodejP);
listP->head_ul = nodejP;
listP->next_ul[prev_j] = nodeiP;
} else if (nodejP == listP->head_ul) {
- LOG_T(MAC, "[UL]changing head to %d\n",
+ LOG_T(MAC, "[UL]changing head to %d\n",
nodeiP);
listP->head_ul = nodeiP;
listP->next_ul[prev_i] = nodejP;
@@ -2476,7 +2472,7 @@ swap_UEs(UE_list_t *listP,
}
LOG_T(MAC, "After swap\n");
- dump_ue_list(listP,
+ dump_ue_list(listP,
ul_flag);
return;
}
@@ -2484,9 +2480,9 @@ swap_UEs(UE_list_t *listP,
// This has to be updated to include BSR information
//------------------------------------------------------------------------------
uint8_t
-UE_is_to_be_scheduled(module_id_t module_idP,
- int CC_id,
- uint8_t UE_id)
+UE_is_to_be_scheduled(module_id_t module_idP,
+ int CC_id,
+ uint8_t UE_id)
//------------------------------------------------------------------------------
{
UE_TEMPLATE *UE_template = &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id];
@@ -2499,24 +2495,24 @@ UE_is_to_be_scheduled(module_id_t module_idP,
rnti_t ue_rnti = UE_RNTI(module_idP,
UE_id);
LOG_D(MAC, "[eNB %d][PUSCH] Checking UL requirements UE %d/%x\n",
- module_idP,
- UE_id,
+ module_idP,
+ UE_id,
ue_rnti);
if (UE_template->scheduled_ul_bytes < UE_template->estimated_ul_buffer ||
UE_template->ul_SR > 0 || // uplink scheduling request
(UE_sched_ctl->ul_inactivity_timer > 20 && UE_sched_ctl->ul_scheduled == 0) || // every 2 frames when RRC_CONNECTED
- (UE_sched_ctl->ul_inactivity_timer > 10 &&
- UE_sched_ctl->ul_scheduled == 0 &&
- mac_eNB_get_rrc_status(module_idP,
+ (UE_sched_ctl->ul_inactivity_timer > 10 &&
+ UE_sched_ctl->ul_scheduled == 0 &&
+ mac_eNB_get_rrc_status(module_idP,
ue_rnti) < RRC_CONNECTED)) { // every Frame when not RRC_CONNECTED
LOG_D(MAC, "[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 estimated size %d, SR %d)\n",
- module_idP,
- UE_id,
+ module_idP,
+ UE_id,
ue_rnti,
UE_template->ul_buffer_info[LCGID0], UE_template->ul_SR);
return 1;
- }
+ }
return 0;
}
@@ -2524,7 +2520,7 @@ UE_is_to_be_scheduled(module_id_t module_idP,
uint8_t
get_tmode(module_id_t module_idP,
int CC_idP,
- int UE_idP)
+ int UE_idP)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -2537,8 +2533,8 @@ get_tmode(module_id_t module_idP,
return (cc->p_eNB);
}
- AssertFatal(physicalConfigDedicated->antennaInfo != NULL,
- "antennaInfo (mod_id %d) is null for CCId %d, UEid %d, physicalConfigDedicated %p\n",
+ AssertFatal(physicalConfigDedicated->antennaInfo != NULL,
+ "antennaInfo (mod_id %d) is null for CCId %d, UEid %d, physicalConfigDedicated %p\n",
module_idP,
CC_idP,
UE_idP,
@@ -2565,10 +2561,10 @@ get_tmode(module_id_t module_idP,
//------------------------------------------------------------------------------
int8_t
-get_ULharq(module_id_t module_idP,
- int CC_idP,
+get_ULharq(module_id_t module_idP,
+ int CC_idP,
uint16_t frameP,
- uint8_t subframeP)
+ uint8_t subframeP)
//------------------------------------------------------------------------------
{
int8_t ret = -1;
@@ -2636,16 +2632,16 @@ get_ULharq(module_id_t module_idP,
}
AssertFatal(ret != -1, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t) ret,
- frameP,
+ frameP,
subframeP);
return ret;
}
//------------------------------------------------------------------------------
-uint16_t
-getRIV(uint16_t N_RB_DL,
- uint16_t RBstart,
- uint16_t Lcrbs)
+uint16_t
+getRIV(uint16_t N_RB_DL,
+ uint16_t RBstart,
+ uint16_t Lcrbs)
//------------------------------------------------------------------------------
{
uint16_t RIV;
@@ -2660,10 +2656,10 @@ getRIV(uint16_t N_RB_DL,
//------------------------------------------------------------------------------
uint32_t
-allocate_prbs(int UE_id,
- unsigned char nb_rb,
+allocate_prbs(int UE_id,
+ unsigned char nb_rb,
int N_RB_DL,
- uint32_t *rballoc)
+ uint32_t *rballoc)
//------------------------------------------------------------------------------
{
int i;
@@ -2695,7 +2691,7 @@ allocate_prbs(int UE_id,
//------------------------------------------------------------------------------
int
get_bw_index(module_id_t module_id,
- uint8_t CC_id)
+ uint8_t CC_id)
//------------------------------------------------------------------------------
{
int bw_index = 0;
@@ -2733,7 +2729,7 @@ get_bw_index(module_id_t module_id,
//------------------------------------------------------------------------------
int
get_min_rb_unit(module_id_t module_id,
- uint8_t CC_id)
+ uint8_t CC_id)
//------------------------------------------------------------------------------
{
int min_rb_unit = 0;
@@ -2770,21 +2766,21 @@ get_min_rb_unit(module_id_t module_id,
//------------------------------------------------------------------------------
uint32_t
-allocate_prbs_sub(int nb_rb,
- int N_RB_DL,
- int N_RBG,
- uint8_t *rballoc)
+allocate_prbs_sub(int nb_rb,
+ int N_RB_DL,
+ int N_RBG,
+ uint8_t *rballoc)
//------------------------------------------------------------------------------
{
int check = 0; //check1=0,check2=0;
uint32_t rballoc_dci = 0;
//uint8_t number_of_subbands=13;
LOG_T(MAC, "*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n",
- rballoc[3],
- rballoc[2],
- rballoc[1],
- rballoc[0],
- nb_rb,
+ rballoc[3],
+ rballoc[2],
+ rballoc[1],
+ rballoc[0],
+ nb_rb,
N_RBG);
while (nb_rb > 0 && check < N_RBG) {
@@ -2825,15 +2821,15 @@ allocate_prbs_sub(int nb_rb,
}
// rballoc_dci = (rballoc_dci)&(0x1fff);
- LOG_T(MAC, "*********RBALLOC : %x\n",
+ LOG_T(MAC, "*********RBALLOC : %x\n",
rballoc_dci);
// exit(-1);
return rballoc_dci;
}
//------------------------------------------------------------------------------
-int
-get_subbandsize(uint8_t dl_Bandwidth)
+int
+get_subbandsize(uint8_t dl_Bandwidth)
//------------------------------------------------------------------------------
{
uint8_t ss[6] = { 6, 4, 4, 6, 8, 8 };
@@ -2843,8 +2839,8 @@ get_subbandsize(uint8_t dl_Bandwidth)
}
//------------------------------------------------------------------------------
-int
-get_nb_subband(int N_RB_DL)
+int
+get_nb_subband(int N_RB_DL)
//------------------------------------------------------------------------------
{
int nb_sb = 0;
@@ -2882,17 +2878,17 @@ get_nb_subband(int N_RB_DL)
return nb_sb;
}
/*
-void
-init_CCE_table(int module_idP,
- int CC_idP)
+void
+init_CCE_table(int module_idP,
+ int CC_idP)
{
- memset(RC.mac[module_idP]->CCE_table[CC_idP],
- 0,
+ memset(RC.mac[module_idP]->CCE_table[CC_idP],
+ 0,
800 * sizeof(int));
}
*/
-void
-init_CCE_table(int *CCE_table)
+void
+init_CCE_table(int *CCE_table)
{
memset(CCE_table, 0, 800 * sizeof(int));
}
@@ -2903,8 +2899,8 @@ get_nCCE_offset(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
- const unsigned short rnti,
- const unsigned char subframe)
+ const unsigned short rnti,
+ const unsigned char subframe)
//------------------------------------------------------------------------------
{
int search_space_free, m, nb_candidates = 0, l, i;
@@ -2944,7 +2940,7 @@ get_nCCE_offset(int *CCE_table,
}
return -1;
- }
+ }
// Find first available in ue specific search space
// according to procedure in Section 9.1.1 of 36.213 (v. 8.6)
// compute Yk
@@ -2967,17 +2963,17 @@ get_nCCE_offset(int *CCE_table,
break;
default:
- DevParam(L,
- nCCE,
+ DevParam(L,
+ nCCE,
rnti);
break;
}
LOG_D(MAC, "rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",
- rnti,
- Yk,
- nCCE,
- nCCE / L,
+ rnti,
+ Yk,
+ nCCE,
+ nCCE / L,
nb_candidates);
for (m = 0; m < nb_candidates; m++) {
@@ -3005,11 +3001,11 @@ get_nCCE_offset(int *CCE_table,
//------------------------------------------------------------------------------
void
-dump_CCE_table(int *CCE_table,
+dump_CCE_table(int *CCE_table,
const int nCCE,
- const unsigned short rnti,
- const int subframe,
- int L)
+ const unsigned short rnti,
+ const int subframe,
+ int L)
//------------------------------------------------------------------------------
{
int nb_candidates = 0, i;
@@ -3020,7 +3016,7 @@ dump_CCE_table(int *CCE_table,
printf("%1d.", CCE_table[i]);
if ((i & 7) == 7)
- printf("\n CCE %d: ",
+ printf("\n CCE %d: ",
i);
}
@@ -3047,19 +3043,19 @@ dump_CCE_table(int *CCE_table,
break;
}
- LOG_I(PHY, "rnti %x, Yk*L = %u, nCCE %d (nCCE/L %d),nb_cand*L %d\n",
+ LOG_I(PHY, "rnti %x, Yk*L = %u, nCCE %d (nCCE/L %d),nb_cand*L %d\n",
rnti,
- Yk * L,
- nCCE,
- nCCE / L,
+ Yk * L,
+ nCCE,
+ nCCE / L,
nb_candidates * L);
}
//------------------------------------------------------------------------------
uint16_t
-getnquad(COMMON_channels_t *cc,
- uint8_t num_pdcch_symbols,
- uint8_t mi)
+getnquad(COMMON_channels_t *cc,
+ uint8_t num_pdcch_symbols,
+ uint8_t mi)
//------------------------------------------------------------------------------
{
uint16_t Nreg = 0;
@@ -3106,21 +3102,21 @@ getnquad(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint16_t
-getnCCE(COMMON_channels_t *cc,
- uint8_t num_pdcch_symbols,
- uint8_t mi)
+getnCCE(COMMON_channels_t *cc,
+ uint8_t num_pdcch_symbols,
+ uint8_t mi)
//------------------------------------------------------------------------------
{
AssertFatal(cc != NULL, "cc is null\n");
- return (getnquad(cc,
- num_pdcch_symbols,
+ return (getnquad(cc,
+ num_pdcch_symbols,
mi) / 9);
}
//------------------------------------------------------------------------------
-uint8_t
-getmi(COMMON_channels_t *cc,
- int subframe)
+uint8_t
+getmi(COMMON_channels_t *cc,
+ int subframe)
//------------------------------------------------------------------------------
{
AssertFatal(cc != NULL, "cc is null\n");
@@ -3178,26 +3174,26 @@ getmi(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
uint16_t
-get_nCCE_max(COMMON_channels_t *cc,
- int num_pdcch_symbols,
- int subframe)
+get_nCCE_max(COMMON_channels_t *cc,
+ int num_pdcch_symbols,
+ int subframe)
//------------------------------------------------------------------------------
{
AssertFatal(cc != NULL, "cc is null\n");
- return (getnCCE(cc,
- num_pdcch_symbols,
- getmi(cc,
+ return (getnCCE(cc,
+ num_pdcch_symbols,
+ getmi(cc,
subframe)));
}
// Allocate the CCEs
//------------------------------------------------------------------------------
int
-allocate_CCEs(int module_idP,
- int CC_idP,
- frame_t frameP,
- sub_frame_t subframeP,
- int test_onlyP)
+allocate_CCEs(int module_idP,
+ int CC_idP,
+ frame_t frameP,
+ sub_frame_t subframeP,
+ int test_onlyP)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -3223,9 +3219,9 @@ allocate_CCEs(int module_idP,
nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body;
LOG_D(MAC, "Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",
- subframeP,
- test_onlyP,
- DL_req->number_pdu,
+ subframeP,
+ test_onlyP,
+ DL_req->number_pdu,
DL_req->number_dci,
HI_DCI0_req->number_of_dci);
DL_req->number_pdcch_ofdm_symbols = 1;
@@ -3238,17 +3234,17 @@ try_again:
for (i = 0, idci = 0; i < DL_req->number_pdu; i++) {
dl_config_pduLoop = &dl_config_pdu[i];
// allocate DL common DCIs first
- if (dl_config_pduLoop->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE &&
+ if (dl_config_pduLoop->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE &&
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type == 2) {
LOG_D(MAC, "Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
- idci,
+ idci,
DL_req->number_dci + HI_DCI0_req->number_of_dci,
- DL_req->number_dci,
+ DL_req->number_dci,
HI_DCI0_req->number_of_dci,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
- nCCE,
- nCCE_max,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ nCCE,
+ nCCE_max,
DL_req->number_pdcch_ofdm_symbols);
if (nCCE + (dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
@@ -3264,8 +3260,8 @@ try_again:
// number of CCEs left can potentially hold this allocation
fCCE = get_nCCE_offset(CCE_table,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
- nCCE_max,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ nCCE_max,
1,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP);
@@ -3273,7 +3269,7 @@ try_again:
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC, "subframe %d: Dropping Allocation for RNTI %x\n",
- subframeP,
+ subframeP,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti);
for (j = 0; j <= i; j++) {
@@ -3286,7 +3282,7 @@ try_again:
HI_DCI0_req->number_of_dci,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.dci_format,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
nCCE, nCCE_max, DL_req->number_pdcch_ofdm_symbols);
}
//dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<L);
@@ -3307,9 +3303,9 @@ try_again:
if ((test_onlyP%2) == 0) {
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
LOG_D(MAC, "Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",
- subframeP,
- test_onlyP,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ subframeP,
+ test_onlyP,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
fCCE);
}
@@ -3323,13 +3319,13 @@ try_again:
// allocate UL DCIs
if (hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) {
LOG_D(MAC, "Trying to allocate format 0 DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
- idci,
+ idci,
DL_req->number_dci + HI_DCI0_req->number_of_dci,
- DL_req->number_dci,
+ DL_req->number_dci,
HI_DCI0_req->number_of_dci,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.rnti,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level,
- nCCE, nCCE_max,
+ nCCE, nCCE_max,
DL_req->number_pdcch_ofdm_symbols);
if (nCCE + hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level > nCCE_max) {
@@ -3346,15 +3342,15 @@ try_again:
// number of CCEs left can potentially hold this allocation
fCCE = get_nCCE_offset(CCE_table,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level,
- nCCE_max,
+ nCCE_max,
0,
- hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.rnti,
+ hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.rnti,
subframeP);
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC, "subframe %d: Dropping Allocation for RNTI %x\n",
- subframeP,
+ subframeP,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.rnti);
for (j = 0; j <= i; j++) {
@@ -3367,7 +3363,7 @@ try_again:
HI_DCI0_req->number_of_dci,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.rnti,
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.dci_format,
- hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level,
+ hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level,
nCCE, nCCE_max, DL_req->number_pdcch_ofdm_symbols);
}
//dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<L);
@@ -3383,13 +3379,13 @@ try_again:
// the allocation is feasible, rnti rule passes
nCCE += hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.aggregation_level;
- LOG_D(MAC, "Allocating at nCCE %d\n",
+ LOG_D(MAC, "Allocating at nCCE %d\n",
fCCE);
if ((test_onlyP%2) == 0) {
hi_dci0_pduLoop->dci_pdu.dci_pdu_rel8.cce_index = fCCE;
- LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
- subframeP,
+ LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
+ subframeP,
test_onlyP);
}
@@ -3403,12 +3399,12 @@ try_again:
if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
&& (dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type == 1)) {
LOG_D(MAC, "Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
- idci,
+ idci,
DL_req->number_dci + HI_DCI0_req->number_of_dci,
DL_req->number_dci, HI_DCI0_req->number_of_dci,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
- nCCE,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ nCCE,
nCCE_max,
DL_req->number_pdcch_ofdm_symbols);
@@ -3416,7 +3412,7 @@ try_again:
if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
return -1;
- LOG_D(MAC, "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
+ LOG_D(MAC, "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
DL_req->number_pdcch_ofdm_symbols);
DL_req->number_pdcch_ofdm_symbols++;
nCCE_max = get_nCCE_max(cc, DL_req->number_pdcch_ofdm_symbols, subframeP);
@@ -3425,8 +3421,8 @@ try_again:
// number of CCEs left can potentially hold this allocation
fCCE = get_nCCE_offset(CCE_table,
- dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
- nCCE_max,
+ dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
+ nCCE_max,
0,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP);
@@ -3434,7 +3430,7 @@ try_again:
if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_I(MAC, "subframe %d: Dropping Allocation for RNTI %x\n",
- subframeP,
+ subframeP,
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.rnti);
for (j = 0; j <= i; j++) {
@@ -3465,13 +3461,13 @@ try_again:
// the allocation is feasible, rnti rule passes
nCCE += dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level;
- LOG_D(MAC, "Allocating at nCCE %d\n",
+ LOG_D(MAC, "Allocating at nCCE %d\n",
fCCE);
if ((test_onlyP%2) == 0) {
dl_config_pduLoop->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
- LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
- subframeP,
+ LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
+ subframeP,
test_onlyP);
}
@@ -3499,9 +3495,9 @@ try_again:
//------------------------------------------------------------------------------
nfapi_ul_config_request_pdu_t *
has_ul_grant(module_id_t module_idP,
- int CC_idP,
- uint16_t absSFP,
- uint16_t rnti)
+ int CC_idP,
+ uint16_t absSFP,
+ uint16_t rnti)
//------------------------------------------------------------------------------
{
nfapi_ul_config_request_body_t *ul_req = &RC.mac[module_idP]->UL_req_tmp[CC_idP][absSFP % 10].ul_config_request_body;
@@ -3509,15 +3505,15 @@ has_ul_grant(module_id_t module_idP,
uint8_t pdu_type;
LOG_D(MAC, "Checking for rnti %x UL grant in subframeP %d (num pdu %d)\n",
- rnti,
- absSFP % 10,
+ rnti,
+ absSFP % 10,
ul_req->number_of_pdus);
for (int i = 0; i < ul_req->number_of_pdus; i++, ul_config_pdu++) {
pdu_type = ul_config_pdu->pdu_type;
- LOG_D(MAC, "PDU %d : type %d,rnti %x\n",
+ LOG_D(MAC, "PDU %d : type %d,rnti %x\n",
i,
- pdu_type,
+ pdu_type,
rnti);
if (pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE && ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)
@@ -3571,9 +3567,9 @@ boolean_t
CCE_allocation_infeasible(int module_idP,
int CC_idP,
int format_flag,
- int subframe,
- int aggregation,
- int rnti)
+ int subframe,
+ int aggregation,
+ int rnti)
//------------------------------------------------------------------------------
{
nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
@@ -3619,10 +3615,10 @@ CCE_allocation_infeasible(int module_idP,
}
//------------------------------------------------------------------------------
-void
-get_retransmission_timing(LTE_TDD_Config_t *tdd_Config,
+void
+get_retransmission_timing(LTE_TDD_Config_t *tdd_Config,
frame_t *frameP,
- sub_frame_t *subframeP)
+ sub_frame_t *subframeP)
//------------------------------------------------------------------------------
{
if (tdd_Config == NULL) {
@@ -3633,8 +3629,8 @@ get_retransmission_timing(LTE_TDD_Config_t *tdd_Config,
} else {
switch (tdd_Config->subframeAssignment) { //TODO fill in other TDD configs
default:
- printf("%s:%d: TODO\n",
- __FILE__,
+ printf("%s:%d: TODO\n",
+ __FILE__,
__LINE__);
abort();
break;
@@ -3649,7 +3645,7 @@ get_retransmission_timing(LTE_TDD_Config_t *tdd_Config,
*frameP = (*frameP + (*subframeP / 10)) % 1024;
*subframeP %= 10;
} else {
- AssertFatal(2 == 1, "Illegal dl subframe %d for tdd config %ld\n",
+ AssertFatal(2 == 1, "Illegal dl subframe %d for tdd config %ld\n",
*subframeP,
tdd_Config->subframeAssignment);
}
@@ -3662,7 +3658,7 @@ get_retransmission_timing(LTE_TDD_Config_t *tdd_Config,
//------------------------------------------------------------------------------
uint8_t
get_dl_subframe_count(int tdd_config_sfa,
- sub_frame_t subframeP)
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
uint8_t tdd1[10] = {1, -1, -1, -1, 2, 3, -1, -1, -1, 4}; // special subframes 1,6 are excluded
@@ -3679,7 +3675,7 @@ get_dl_subframe_count(int tdd_config_sfa,
uint8_t
frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config,
int abs_frameP,
- sub_frame_t subframeP)
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
int harq_pid;
@@ -3688,7 +3684,7 @@ frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config,
if (tdd_Config) {
switch(tdd_Config->subframeAssignment) { //TODO fill in other tdd config
case 1:
- count = get_dl_subframe_count(tdd_Config->subframeAssignment,
+ count = get_dl_subframe_count(tdd_Config->subframeAssignment,
subframeP);
harq_pid = (((frame_cnt * 1024 + abs_frameP) * 4) - 1 + count) % 7;//4 dl subframe in a frame
@@ -3713,14 +3709,14 @@ frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config,
}
//------------------------------------------------------------------------------
-unsigned char
+unsigned char
ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,
- unsigned char subframe)
+ unsigned char subframe)
//------------------------------------------------------------------------------
{
if (tdd_Config == NULL) {
return 1;
- }
+ }
switch (tdd_Config->subframeAssignment) {
case 1:
return 1; // don't ACK special subframe for now
@@ -3742,13 +3738,13 @@ ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,
case 3:
if (subframe == 2) { // ACK subframes 5 and 6
return 2; // should be 3
- }
+ }
if (subframe == 3) { // ACK subframes 7 and 8
return 2; // To be updated
- }
+ }
if (subframe == 4) { // ACK subframes 9 and 0
return 2;
- }
+ }
AssertFatal(1==0,"illegal subframe %d for tdd_config %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3757,10 +3753,10 @@ ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,
case 4:
if (subframe == 2) { // ACK subframes 0,4 and 5
return 3; // should be 4
- }
+ }
if (subframe == 3) { // ACK subframes 6,7,8 and 9
return 4;
- }
+ }
AssertFatal(1==0,"illegal subframe %d for tdd_config %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3769,7 +3765,7 @@ ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,
case 5:
if (subframe == 2) { // ACK subframes 0,3,4,5,6,7,8 and 9
return 8; // should be 3
- }
+ }
AssertFatal(1==0,"illegal subframe %d for tdd_config %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3780,15 +3776,15 @@ ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,
}
//------------------------------------------------------------------------------
-unsigned char
+unsigned char
ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
unsigned char subframe,
- unsigned char ACK_index)
+ unsigned char ACK_index)
//------------------------------------------------------------------------------
{
if (tdd_Config == NULL) {
return ((subframe < 4) ? subframe + 6 : subframe - 4);
- }
+ }
switch (tdd_Config->subframeAssignment) {
case 3:
@@ -3798,10 +3794,10 @@ ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
}
if (subframe == 3) { // ACK subframes 7 and 8
return (7 + ACK_index); // To be updated
- }
+ }
if (subframe == 4) { // ACK subframes 9 and 0
return ((9 + ACK_index) % 10);
- }
+ }
AssertFatal(1==0, "illegal subframe %d for tdd_config->subframeAssignment %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3813,10 +3809,10 @@ ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
// return(1); TBC
if (ACK_index == 2) return 0;
return (4 + ACK_index);
- }
+ }
if (subframe == 3) { // ACK subframes 6, 7 8 and 9
return (6 + ACK_index); // To be updated
- }
+ }
AssertFatal(1 == 0, "illegal subframe %d for tdd_config %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3825,7 +3821,7 @@ ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
case 1:
if (subframe == 2) { // ACK subframes 5 and 6
return (5 + ACK_index);
- }
+ }
if (subframe == 3) { // ACK subframe 9
return 9; // To be updated
}
@@ -3834,7 +3830,7 @@ ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
}
if (subframe == 8) { // ACK subframe 4
return 4; // To be updated
- }
+ }
AssertFatal(1 == 0, "illegal subframe %d for tdd_config %ld\n",
subframe,
tdd_Config->subframeAssignment);
@@ -3845,13 +3841,13 @@ ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,
//------------------------------------------------------------------------------
void
-extract_harq(module_id_t mod_idP,
- int CC_idP,
+extract_harq(module_id_t mod_idP,
+ int CC_idP,
int UE_id,
- frame_t frameP,
+ frame_t frameP,
sub_frame_t subframeP,
- void *harq_indication,
- int format)
+ void *harq_indication,
+ int format)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[mod_idP];
@@ -3874,17 +3870,17 @@ extract_harq(module_id_t mod_idP,
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated;
- if (physicalConfigDedicated != NULL && physicalConfigDedicated->pucch_ConfigDedicated != NULL &&
- physicalConfigDedicated->ext7 != NULL && physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13 != NULL &&
+ if (physicalConfigDedicated != NULL && physicalConfigDedicated->pucch_ConfigDedicated != NULL &&
+ physicalConfigDedicated->ext7 != NULL && physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13 != NULL &&
((physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUCCH_r13 && format == 0) ||
(physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUSCH_r13 && format == 1))) {
spatial_bundling = 1;
}
-#endif
-
+#endif
+
for (i = 0; i < numCC; i++) {
- tmode[i] = get_tmode(mod_idP,
- i,
+ tmode[i] = get_tmode(mod_idP,
+ i,
UE_id);
}
if (cc->tdd_Config) {
@@ -3894,7 +3890,7 @@ extract_harq(module_id_t mod_idP,
switch (harq_indication_tdd->mode) {
case 0: // Format 1a/b bundling
- AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n",
+ AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n",
numCC);
int M = ul_ACK_subframe2M(cc->tdd_Config,
subframeP);
@@ -3944,10 +3940,10 @@ extract_harq(module_id_t mod_idP,
if (ra[ra_i].rnti == rnti && ra[ra_i].state == WAITMSG4ACK) {
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
- LOG_I(RRC, "put UE %x into freeList\n",
+ LOG_I(RRC, "put UE %x into freeList\n",
rnti);
- put_UE_in_freelist(mod_idP,
- rnti,
+ put_UE_in_freelist(mod_idP,
+ rnti,
1);
}
}
@@ -3965,15 +3961,15 @@ extract_harq(module_id_t mod_idP,
subframeP);
if (num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
- cancel_ra_proc(mod_idP,
- CC_idP,
- frameP,
+ cancel_ra_proc(mod_idP,
+ CC_idP,
+ frameP,
ra[ra_i].rnti);
} else {
if(sched_ctl->round[CC_idP][harq_pid] == 7) {
- cancel_ra_proc(mod_idP,
- CC_idP,
- frameP,
+ cancel_ra_proc(mod_idP,
+ CC_idP,
+ frameP,
ra[ra_i].rnti);
}
}
@@ -4009,7 +4005,7 @@ extract_harq(module_id_t mod_idP,
switch (harq_indication_fdd->mode) {
case 0: // Format 1a/b (10.1.2.1)
- AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n",
+ AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n",
numCC);
if (tmode[0] == 1 || tmode[0] == 2 || tmode[0] == 5 || tmode[0] == 6 || tmode[0] == 7) { // NOTE: have to handle the case of TM9-10 with 1 antenna port
@@ -4023,27 +4019,27 @@ extract_harq(module_id_t mod_idP,
// So if nfapi_mode == 2(VNF), this function don't check assertion to avoid process exit.
if (nfapi_mode != 2) {
AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
- harq_pid,
- UE_id,
+ harq_pid,
+ UE_id,
rnti);
} else {
if (sched_ctl->round[CC_idP][harq_pid] == 8) {
LOG_E(MAC,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
- harq_pid,
- UE_id,
+ harq_pid,
+ UE_id,
rnti);
return;
}
}
AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
- pdu[0],
- harq_pid,
- UE_id,
+ pdu[0],
+ harq_pid,
+ UE_id,
rnti);
- LOG_D(MAC, "Received %d for harq_pid %d\n",
- pdu[0],
+ LOG_D(MAC, "Received %d for harq_pid %d\n",
+ pdu[0],
harq_pid);
RA_t *ra = &eNB->common_channels[CC_idP].ra[0];
@@ -4058,15 +4054,15 @@ extract_harq(module_id_t mod_idP,
subframeP);
if (pdu[0] == 1) {
- cancel_ra_proc(mod_idP,
- CC_idP,
- frameP,
+ cancel_ra_proc(mod_idP,
+ CC_idP,
+ frameP,
ra[ra_i].rnti);
} else {
if (sched_ctl->round[CC_idP][harq_pid] == 7) {
- cancel_ra_proc(mod_idP,
- CC_idP,
- frameP,
+ cancel_ra_proc(mod_idP,
+ CC_idP,
+ frameP,
ra[ra_i].rnti);
}
}
@@ -4092,10 +4088,10 @@ extract_harq(module_id_t mod_idP,
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)) {
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
- LOG_I(RRC, "put UE %x into freeList\n",
+ LOG_I(RRC, "put UE %x into freeList\n",
rnti);
- put_UE_in_freelist(mod_idP,
- rnti,
+ put_UE_in_freelist(mod_idP,
+ rnti,
1);
}
}
@@ -4150,11 +4146,11 @@ extract_harq(module_id_t mod_idP,
AssertFatal(1 == 0, "Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n",
num_ack_nak,
sched_ctl->round[CC_idP][harq_pid],
- sched_ctl->round[CC_idP][harq_pid],
+ sched_ctl->round[CC_idP][harq_pid],
pdu[0],
- pdu[1],
- harq_pid,
- UE_id,
+ pdu[1],
+ harq_pid,
+ UE_id,
rnti);
}
@@ -4204,14 +4200,14 @@ extract_harq(module_id_t mod_idP,
AssertFatal(pdu[2] <= 3, "pdu[2] %d is not ACK/NAK/DTX\n",
pdu[2]);
AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 2, "sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",
- pCCid,
- harq_pid,
- UE_id,
+ pCCid,
+ harq_pid,
+ UE_id,
rnti);
AssertFatal(sched_ctl->tbcnt[1 - pCCid][harq_pid] == 1, "sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",
- 1 - pCCid,
- harq_pid,
- UE_id,
+ 1 - pCCid,
+ harq_pid,
+ UE_id,
rnti);
if (pdu[0] == 1 && pdu[1] == 1) { // both ACK
@@ -4255,14 +4251,14 @@ extract_harq(module_id_t mod_idP,
AssertFatal(pdu[2] <= 3, "pdu[2] %d is not ACK/NAK/DTX\n",
pdu[2]);
AssertFatal(sched_ctl->tbcnt[1 - pCCid][harq_pid] == 2, "sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",
- 1 - pCCid,
- harq_pid,
- UE_id,
+ 1 - pCCid,
+ harq_pid,
+ UE_id,
rnti);
AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 1, "sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",
- pCCid,
- harq_pid,
- UE_id,
+ pCCid,
+ harq_pid,
+ UE_id,
rnti);
if (pdu[0] == 1 && pdu[1] == 1) { // both ACK
@@ -4310,12 +4306,12 @@ extract_harq(module_id_t mod_idP,
AssertFatal(pdu[3] <= 3, "pdu[3] %d is not ACK/NAK/DTX\n",
pdu[3]);
AssertFatal(sched_ctl->tbcnt[0][harq_pid] == 2, "sched_ctl->tbcnt[0][%d] != 2 for UE %d/%x\n",
- harq_pid,
- UE_id,
+ harq_pid,
+ UE_id,
rnti);
AssertFatal(sched_ctl->tbcnt[1][harq_pid] == 2, "sched_ctl->tbcnt[1][%d] != 2 for UE %d/%x\n",
- harq_pid,
- UE_id,
+ harq_pid,
+ UE_id,
rnti);
if (pdu[0] == 1 && pdu[1] == 1) { // both ACK
@@ -4381,10 +4377,10 @@ extract_harq(module_id_t mod_idP,
}
} else
AssertFatal(1 == 0, "Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n",
- i,
- harq_pid,
- pdu[j],
- UE_id,
+ i,
+ harq_pid,
+ pdu[j],
+ UE_id,
rnti);
j++;
@@ -4417,12 +4413,12 @@ extract_harq(module_id_t mod_idP,
}
} else
AssertFatal(1 == 0, "Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n",
- i,
+ i,
harq_pid,
sched_ctl->tbcnt[i][harq_pid],
- pdu[j],
- pdu[j + 1],
- UE_id,
+ pdu[j],
+ pdu[j + 1],
+ UE_id,
rnti);
j += 2;
@@ -4439,17 +4435,17 @@ extract_harq(module_id_t mod_idP,
}
} else {
AssertFatal(1 == 0, "Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n",
- pdu[j],
- i,
- harq_pid,
- UE_id,
+ pdu[j],
+ i,
+ harq_pid,
+ UE_id,
rnti);
}
j++;
} else {
AssertFatal(1 == 0, "Illegal value for spatial_bundling %d\n",
spatial_bundling);
- }
+ }
}
}
@@ -4469,13 +4465,13 @@ extract_harq(module_id_t mod_idP,
//------------------------------------------------------------------------------
void
-extract_pucch_csi(module_id_t mod_idP,
- int CC_idP,
+extract_pucch_csi(module_id_t mod_idP,
+ int CC_idP,
int UE_id,
- frame_t frameP,
+ frame_t frameP,
sub_frame_t subframeP,
- uint8_t *pdu,
- uint8_t length)
+ uint8_t *pdu,
+ uint8_t length)
//------------------------------------------------------------------------------
{
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
@@ -4486,12 +4482,12 @@ extract_pucch_csi(module_id_t mod_idP,
uint8_t Jtab[6] = { 0, 2, 2, 3, 4, 4 };
int feedback_cnt;
- AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",
+ AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",
UE_id);
- AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL, "cqi_ReportConfig is null for UE %d\n",
+ AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL, "cqi_ReportConfig is null for UE %d\n",
UE_id);
- struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic;
- AssertFatal(cqi_ReportPeriodic != NULL, "cqi_ReportPeriodic is null for UE %d\n",
+ struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic;
+ AssertFatal(cqi_ReportPeriodic != NULL, "cqi_ReportPeriodic is null for UE %d\n",
UE_id);
// determine feedback mode
AssertFatal(cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_NOTHING, "cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_NOTHING!\n");
@@ -4501,10 +4497,10 @@ extract_pucch_csi(module_id_t mod_idP,
int H, K, bandwidth_part, L, Lmask;
int ri = sched_ctl->periodic_ri_received[CC_idP];
- get_csi_params(cc,
- cqi_ReportPeriodic,
- &Npd,
- &N_OFFSET_CQI,
+ get_csi_params(cc,
+ cqi_ReportPeriodic,
+ &Npd,
+ &N_OFFSET_CQI,
&H);
K = (H - 1) / Jtab[cc->mib->message.dl_Bandwidth];
L = Ltab[cc->mib->message.dl_Bandwidth];
@@ -4514,8 +4510,8 @@ extract_pucch_csi(module_id_t mod_idP,
if (feedback_cnt > 0) bandwidth_part = (feedback_cnt - 1) % K;
else bandwidth_part = 0;
- switch (get_tmode(mod_idP,
- CC_idP,
+ switch (get_tmode(mod_idP,
+ CC_idP,
UE_id)) {
case 1:
case 2:
@@ -4536,7 +4532,7 @@ extract_pucch_csi(module_id_t mod_idP,
break;
}
- if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI ||
+ if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI ||
feedback_cnt == 0) {
// Note: This implements only Tables: 5.3.3.1-1,5.3.3.1-1A and 5.3.3.1-2 from 36.213 (1,2,4 antenna ports Wideband CQI/PMI)
if (no_pmi == 1) { // get spatial_diffcqi if needed
@@ -4562,8 +4558,8 @@ extract_pucch_csi(module_id_t mod_idP,
sched_ctl->periodic_wideband_pmi[CC_idP] = (pdu[0] >> 7) & 0xF;
} else
AssertFatal(1 == 0, "illegal combination p %d, ri %d, no_pmi %d\n",
- cc->p_eNB,
- ri,
+ cc->p_eNB,
+ ri,
no_pmi);
} else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) {
// This is Table 5.2.3.3.2-2 for 36.213
@@ -4581,13 +4577,13 @@ extract_pucch_csi(module_id_t mod_idP,
//------------------------------------------------------------------------------
void
-extract_pusch_csi(module_id_t mod_idP,
- int CC_idP,
+extract_pusch_csi(module_id_t mod_idP,
+ int CC_idP,
int UE_id,
- frame_t frameP,
+ frame_t frameP,
sub_frame_t subframeP,
- uint8_t *pdu,
- uint8_t length)
+ uint8_t *pdu,
+ uint8_t length)
//------------------------------------------------------------------------------
{
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
@@ -4601,13 +4597,13 @@ extract_pusch_csi(module_id_t mod_idP,
int i;
uint64_t p = *(uint64_t *) pdu;
int curbyte, curbit;
- AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",
+ AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",
UE_id);
- AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL, "cqi_ReportConfig is null for UE %d\n",
+ AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL, "cqi_ReportConfig is null for UE %d\n",
UE_id);
- LTE_CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic
+ LTE_CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic
= UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
- AssertFatal(cqi_ReportModeAperiodic != NULL, "cqi_ReportModeAperiodic is null for UE %d\n",
+ AssertFatal(cqi_ReportModeAperiodic != NULL, "cqi_ReportModeAperiodic is null for UE %d\n",
UE_id);
int N = Ntab[cc->mib->message.dl_Bandwidth];
int tmode = get_tmode(mod_idP, CC_idP, UE_id);
@@ -4684,9 +4680,9 @@ extract_pusch_csi(module_id_t mod_idP,
diffcqi0 = (uint8_t) (p & 0x03);
p >>= 2;
r = (uint8_t) (p & ((1 >> Ltab_uesel[bw]) - 1));
- reverse_index(Ntab_uesel[bw],
- Mtab_uesel[bw],
- r,
+ reverse_index(Ntab_uesel[bw],
+ Mtab_uesel[bw],
+ r,
v);
for (m = 0; m < Mtab_uesel[bw]; m++) {
@@ -4715,9 +4711,9 @@ extract_pusch_csi(module_id_t mod_idP,
r = (uint8_t) (p & ((1 >> Ltab_uesel[bw]) - 1));
p >>= Ltab_uesel[bw];
- reverse_index(Ntab_uesel[bw],
- Mtab_uesel[bw],
- r,
+ reverse_index(Ntab_uesel[bw],
+ Mtab_uesel[bw],
+ r,
v);
if (ri == 1 && cc->p_eNB == 2) {
@@ -4870,14 +4866,14 @@ extract_pusch_csi(module_id_t mod_idP,
//------------------------------------------------------------------------------
void
-cqi_indication(module_id_t mod_idP,
- int CC_idP,
+cqi_indication(module_id_t mod_idP,
+ int CC_idP,
frame_t frameP,
- sub_frame_t subframeP,
+ sub_frame_t subframeP,
rnti_t rntiP,
- nfapi_cqi_indication_rel9_t *rel9,
+ nfapi_cqi_indication_rel9_t *rel9,
uint8_t *pdu,
- nfapi_ul_cqi_information_t *ul_cqi_information)
+ nfapi_ul_cqi_information_t *ul_cqi_information)
//------------------------------------------------------------------------------
{
int UE_id = find_UE_id(mod_idP, rntiP);
@@ -4891,35 +4887,35 @@ cqi_indication(module_id_t mod_idP,
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
if (UE_id >= 0) {
- LOG_D(MAC,"%s() UE_id:%d channel:%d cqi:%d\n",
- __FUNCTION__,
- UE_id,
- ul_cqi_information->channel,
+ LOG_D(MAC,"%s() UE_id:%d channel:%d cqi:%d\n",
+ __FUNCTION__,
+ UE_id,
+ ul_cqi_information->channel,
ul_cqi_information->ul_cqi);
if (ul_cqi_information->channel == 0) { // PUCCH
// extract pucch csi information before changing RI information
- extract_pucch_csi(mod_idP,
- CC_idP,
- UE_id,
- frameP,
+ extract_pucch_csi(mod_idP,
+ CC_idP,
+ UE_id,
+ frameP,
subframeP,
pdu, rel9->length);
memcpy((void *) sched_ctl->periodic_ri_received,
- (void *) rel9->ri,
+ (void *) rel9->ri,
rel9->number_of_cc_reported);
// SNR for PUCCH2
sched_ctl->pucch2_snr[CC_idP] = ul_cqi_information->ul_cqi;
} else { //PUSCH
memcpy((void *) sched_ctl->aperiodic_ri_received,
- (void *) rel9->ri,
+ (void *) rel9->ri,
rel9->number_of_cc_reported);
- extract_pusch_csi(mod_idP,
- CC_idP,
- UE_id,
- frameP,
+ extract_pusch_csi(mod_idP,
+ CC_idP,
+ UE_id,
+ frameP,
subframeP,
- pdu,
+ pdu,
rel9->length);
LOG_D(MAC,"Frame %d Subframe %d update CQI:%d\n",
frameP,
@@ -4938,19 +4934,19 @@ cqi_indication(module_id_t mod_idP,
//------------------------------------------------------------------------------
void
-SR_indication(module_id_t mod_idP,
- int cc_idP,
+SR_indication(module_id_t mod_idP,
+ int cc_idP,
frame_t frameP,
- sub_frame_t subframeP,
- rnti_t rntiP,
- uint8_t ul_cqi)
+ sub_frame_t subframeP,
+ rnti_t rntiP,
+ uint8_t ul_cqi)
//------------------------------------------------------------------------------
{
- T(T_ENB_MAC_SCHEDULING_REQUEST,
- T_INT(mod_idP),
+ T(T_ENB_MAC_SCHEDULING_REQUEST,
+ T_INT(mod_idP),
T_INT(cc_idP),
- T_INT(frameP),
- T_INT(subframeP),
+ T_INT(frameP),
+ T_INT(subframeP),
T_INT(rntiP));
int UE_id = find_UE_id(mod_idP, rntiP);
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
@@ -4958,11 +4954,11 @@ SR_indication(module_id_t mod_idP,
if (UE_id != -1) {
if (mac_eNB_get_rrc_status(mod_idP, UE_RNTI(mod_idP, UE_id)) < RRC_CONNECTED) {
LOG_D(MAC, "[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",
- mod_idP,
- rntiP,
- frameP,
- subframeP,
- UE_id,
+ mod_idP,
+ rntiP,
+ frameP,
+ subframeP,
+ UE_id,
cc_idP);
}
UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
@@ -4973,11 +4969,11 @@ SR_indication(module_id_t mod_idP,
// AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP);
// AssertError(0, 0, "Frame %d: find_UE_id(%u,rnti %d) not found\n", frameP, enb_mod_idP, rntiP);
LOG_D(MAC, "[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d (unknown UEid) on CC_id %d\n",
- mod_idP,
- rntiP,
- frameP,
- subframeP,
- UE_id,
+ mod_idP,
+ rntiP,
+ frameP,
+ subframeP,
+ UE_id,
cc_idP);
}
return;
@@ -4985,11 +4981,11 @@ SR_indication(module_id_t mod_idP,
//------------------------------------------------------------------------------
void
-UL_failure_indication(module_id_t mod_idP,
- int cc_idP,
+UL_failure_indication(module_id_t mod_idP,
+ int cc_idP,
frame_t frameP,
- rnti_t rntiP,
- sub_frame_t subframeP)
+ rnti_t rntiP,
+ sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
int UE_id = find_UE_id(mod_idP, rntiP);
@@ -4997,12 +4993,12 @@ UL_failure_indication(module_id_t mod_idP,
if (UE_id != -1) {
LOG_D(MAC, "[eNB %d][UE %d/%x] Frame %d subframeP %d Signaling UL Failure for UE %d on CC_id %d (timer %d)\n",
- mod_idP,
- UE_id,
- rntiP,
- frameP,
- subframeP,
- UE_id,
+ mod_idP,
+ UE_id,
+ rntiP,
+ frameP,
+ subframeP,
+ UE_id,
cc_idP,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
@@ -5011,19 +5007,19 @@ UL_failure_indication(module_id_t mod_idP,
// AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP);
// AssertError(0, 0, "Frame %d: find_UE_id(%u,rnti %d) not found\n", frameP, enb_mod_idP, rntiP);
LOG_W(MAC, "[eNB %d][SR %x] Frame %d subframeP %d Signaling UL Failure for UE %d (unknown UEid) on CC_id %d\n",
- mod_idP,
- rntiP,
- frameP,
- subframeP,
- UE_id,
+ mod_idP,
+ rntiP,
+ frameP,
+ subframeP,
+ UE_id,
cc_idP);
}
}
//------------------------------------------------------------------------------
-static int
+static int
nack_or_dtx_reported(COMMON_channels_t *cc,
- nfapi_harq_indication_pdu_t *harq_pdu)
+ nfapi_harq_indication_pdu_t *harq_pdu)
//------------------------------------------------------------------------------
{
int i;
@@ -5036,7 +5032,7 @@ nack_or_dtx_reported(COMMON_channels_t *cc,
return 1;
}
return 0;
- }
+ }
nfapi_harq_indication_fdd_rel13_t *hi = &harq_pdu->harq_indication_fdd_rel13;
for (i = 0; i < hi->number_of_ack_nack; hi++) {
@@ -5048,11 +5044,11 @@ nack_or_dtx_reported(COMMON_channels_t *cc,
//------------------------------------------------------------------------------
void
-harq_indication(module_id_t mod_idP,
- int CC_idP,
+harq_indication(module_id_t mod_idP,
+ int CC_idP,
frame_t frameP,
sub_frame_t subframeP,
- nfapi_harq_indication_pdu_t *harq_pdu)
+ nfapi_harq_indication_pdu_t *harq_pdu)
//------------------------------------------------------------------------------
{
rnti_t rnti = harq_pdu->rx_ue_information.rnti;
@@ -5061,7 +5057,7 @@ harq_indication(module_id_t mod_idP,
int UE_id = find_UE_id(mod_idP, rnti);
if (UE_id == -1) {
- LOG_W(MAC, "harq_indication: UE %x not found\n",
+ LOG_W(MAC, "harq_indication: UE %x not found\n",
rnti);
return;
}
@@ -5071,33 +5067,33 @@ harq_indication(module_id_t mod_idP,
COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
// extract HARQ Information
LOG_D(MAC, "Frame %d, subframe %d: Received harq indication (%d) from UE %d/%x, ul_cqi %d\n",
- frameP,
- subframeP,
- channel,
- UE_id,
- rnti,
+ frameP,
+ subframeP,
+ channel,
+ UE_id,
+ rnti,
ul_cqi);
if (cc->tdd_Config) {
- extract_harq(mod_idP,
- CC_idP,
- UE_id,
- frameP,
+ extract_harq(mod_idP,
+ CC_idP,
+ UE_id,
+ frameP,
subframeP,
(void *) &harq_pdu->harq_indication_tdd_rel13,
channel);
}
else {
- extract_harq(mod_idP,
- CC_idP,
- UE_id,
- frameP,
+ extract_harq(mod_idP,
+ CC_idP,
+ UE_id,
+ frameP,
subframeP,
(void *) &harq_pdu->harq_indication_fdd_rel13,
channel);
}
/* don't care about cqi reporting if NACK/DTX is there */
- if (channel == 0 && !nack_or_dtx_reported(cc,
+ if (channel == 0 && !nack_or_dtx_reported(cc,
harq_pdu)) {
sched_ctl->pucch1_snr[CC_idP] = ul_cqi;
sched_ctl->pucch1_cqi_update[CC_idP] = 1;
@@ -5107,26 +5103,26 @@ harq_indication(module_id_t mod_idP,
// Flexran Slicing functions
//------------------------------------------------------------------------------
-uint16_t
-nb_rbs_allowed_slice(float rb_percentage,
- int total_rbs)
+uint16_t
+nb_rbs_allowed_slice(float rb_percentage,
+ int total_rbs)
//------------------------------------------------------------------------------
{
return (uint16_t) floor(rb_percentage * total_rbs);
}
//------------------------------------------------------------------------------
-int
-ue_dl_slice_membership(module_id_t mod_id,
- int UE_id,
- int slice_idx)
+int
+ue_dl_slice_membership(module_id_t mod_id,
+ int UE_id,
+ int slice_idx)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[mod_id];
if (slice_idx < 0 || slice_idx >= eNB->slice_info.n_dl) {
LOG_W(MAC, "out of range slice index %d (slice ID %d)\n",
- slice_idx,
+ slice_idx,
eNB->slice_info.dl[slice_idx].id);
return 0;
}
@@ -5135,17 +5131,17 @@ ue_dl_slice_membership(module_id_t mod_id,
}
//------------------------------------------------------------------------------
-int
-ue_ul_slice_membership(module_id_t mod_id,
- int UE_id,
- int slice_idx)
+int
+ue_ul_slice_membership(module_id_t mod_id,
+ int UE_id,
+ int slice_idx)
//------------------------------------------------------------------------------
{
eNB_MAC_INST *eNB = RC.mac[mod_id];
if (slice_idx < 0 || slice_idx >= eNB->slice_info.n_ul) {
LOG_W(MAC, "out of range slice index %d (slice ID %d)\n",
- slice_idx,
+ slice_idx,
eNB->slice_info.dl[slice_idx].id);
return 0;
}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index d86622ec52..efe60be84f 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -97,8 +97,8 @@ rx_sdu(const module_id_t enb_mod_idP,
const rnti_t rntiP,
uint8_t *sduP,
const uint16_t sdu_lenP,
- const uint16_t timing_advance,
- const uint8_t ul_cqi)
+ const uint16_t timing_advance,
+ const uint8_t ul_cqi)
//-----------------------------------------------------------------------------
{
int current_rnti = 0;
@@ -137,24 +137,24 @@ rx_sdu(const module_id_t enb_mod_idP,
if (opt_enabled == 1) {
trace_pdu(DIRECTION_UPLINK, sduP, sdu_lenP, 0, WS_C_RNTI, current_rnti, frameP, subframeP, 0, 0);
-
+
LOG_D(OPT, "[eNB %d][ULSCH] Frame %d rnti %x with size %d\n",
- enb_mod_idP,
- frameP,
- current_rnti,
+ enb_mod_idP,
+ frameP,
+ current_rnti,
sdu_lenP);
}
if (UE_id != -1) {
LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
- enb_mod_idP,
- harq_pid,
+ enb_mod_idP,
+ harq_pid,
CC_idP,
frameP,
subframeP,
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
- current_rnti,
- UE_id,
+ current_rnti,
+ UE_id,
ul_cqi);
AssertFatal(UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] < 8, "round >= 8\n");
@@ -188,8 +188,8 @@ rx_sdu(const module_id_t enb_mod_idP,
} else { // sduP == NULL => error
LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x\n",
- enb_mod_idP,
- harq_pid,
+ enb_mod_idP,
+ harq_pid,
CC_idP,
frameP,
subframeP,
@@ -230,8 +230,8 @@ rx_sdu(const module_id_t enb_mod_idP,
/* Program NACK for PHICH */
LOG_D(MAC, "Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n",
- current_rnti,
- harq_pid,
+ current_rnti,
+ harq_pid,
first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = NULL;
@@ -240,9 +240,9 @@ rx_sdu(const module_id_t enb_mod_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;
@@ -260,7 +260,7 @@ rx_sdu(const module_id_t enb_mod_idP,
} else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti
RA_t *ra = (RA_t *) &(mac->common_channels[CC_idP].ra[RA_id]);
-
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (ra->rach_resource_type > 0) {
harq_pid = 0;
@@ -272,20 +272,20 @@ rx_sdu(const module_id_t enb_mod_idP,
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",
- enb_mod_idP,
- harq_pid,
- CC_idP,
+ enb_mod_idP,
+ harq_pid,
+ CC_idP,
ra->msg3_round,
- current_rnti,
- RA_id,
+ current_rnti,
+ RA_id,
ul_cqi);
first_rb = ra->msg3_first_rb;
if (sduP == NULL) { // we've got an error on Msg3
LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
- enb_mod_idP,
- CC_idP,
+ enb_mod_idP,
+ CC_idP,
RA_id,
ra->msg3_round,
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
@@ -298,12 +298,12 @@ rx_sdu(const module_id_t enb_mod_idP,
/* Prepare handling of retransmission */
get_Msg3allocret(&mac->common_channels[CC_idP],
- ra->Msg3_subframe,
+ ra->Msg3_subframe,
ra->Msg3_frame,
- &ra->Msg3_frame,
+ &ra->Msg3_frame,
&ra->Msg3_subframe);
// prepare handling of retransmission
-
+
add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP);
}
@@ -312,7 +312,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
} else {
LOG_W(MAC, "Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n", current_rnti);
-
+
return;
}
@@ -320,35 +320,35 @@ rx_sdu(const module_id_t enb_mod_idP,
if (payload_ptr == NULL) {
LOG_E(MAC,"[eNB %d][PUSCH %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n",
- enb_mod_idP,
- harq_pid,
+ enb_mod_idP,
+ harq_pid,
CC_idP,
- current_rnti,
+ current_rnti,
UE_id);
return;
}
- T(T_ENB_MAC_UE_UL_PDU,
- T_INT(enb_mod_idP),
+ T(T_ENB_MAC_UE_UL_PDU,
+ T_INT(enb_mod_idP),
T_INT(CC_idP),
- T_INT(current_rnti),
- T_INT(frameP),
+ T_INT(current_rnti),
+ T_INT(frameP),
T_INT(subframeP),
- T_INT(harq_pid),
- T_INT(sdu_lenP),
- T_INT(num_ce),
+ T_INT(harq_pid),
+ T_INT(sdu_lenP),
+ T_INT(num_ce),
T_INT(num_sdu));
-
- T(T_ENB_MAC_UE_UL_PDU_WITH_DATA,
- T_INT(enb_mod_idP),
+
+ T(T_ENB_MAC_UE_UL_PDU_WITH_DATA,
+ T_INT(enb_mod_idP),
T_INT(CC_idP),
- T_INT(current_rnti),
- T_INT(frameP),
+ T_INT(current_rnti),
+ T_INT(frameP),
T_INT(subframeP),
- T_INT(harq_pid),
- T_INT(sdu_lenP),
- T_INT(num_ce),
+ T_INT(harq_pid),
+ T_INT(sdu_lenP),
+ T_INT(num_ce),
T_INT(num_sdu),
T_BUFFER(sduP, sdu_lenP));
@@ -358,14 +358,14 @@ rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1) {
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0;
}
-
+
/* Control element */
for (int i = 0; i < num_ce; i++) {
- T(T_ENB_MAC_UE_UL_CE,
- T_INT(enb_mod_idP),
+ T(T_ENB_MAC_UE_UL_CE,
+ T_INT(enb_mod_idP),
T_INT(CC_idP),
- T_INT(current_rnti),
- T_INT(frameP),
+ T_INT(current_rnti),
+ T_INT(frameP),
T_INT(subframeP),
T_INT(rx_ces[i]));
@@ -379,11 +379,11 @@ rx_sdu(const module_id_t enb_mod_idP,
}
LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n",
- enb_mod_idP,
- CC_idP,
+ enb_mod_idP,
+ CC_idP,
rx_ces[i],
UE_list->UE_template[CC_idP][UE_id].phr_info);
-
+
UE_list->UE_template[CC_idP][UE_id].phr_info_configured = 1;
UE_list->UE_sched_ctrl[UE_id].phr_received = 1;
}
@@ -392,19 +392,19 @@ rx_sdu(const module_id_t enb_mod_idP,
break;
- case CRNTI:
+ case CRNTI:
old_rnti = (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1];
old_UE_id = find_UE_id(enb_mod_idP, old_rnti);
LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
- enb_mod_idP,
- frameP,
- subframeP,
- CC_idP,
- rx_ces[i],
+ enb_mod_idP,
+ frameP,
+ subframeP,
+ CC_idP,
+ rx_ces[i],
i,
- num_ce,
- old_rnti,
+ num_ce,
+ old_rnti,
old_UE_id);
/* Receiving CRNTI means that the current rnti has to go away */
@@ -449,6 +449,7 @@ rx_sdu(const module_id_t enb_mod_idP,
mac_rrc_data_ind(enb_mod_idP,
CC_idP,
frameP, subframeP,
+ UE_id,
old_rnti,
DCCH,
(uint8_t *) payload_ptr,
@@ -504,15 +505,15 @@ rx_sdu(const module_id_t enb_mod_idP,
lcgid = (payload_ptr[0] >> 6);
LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
- enb_mod_idP,
- CC_idP,
- rx_ces[i],
+ enb_mod_idP,
+ CC_idP,
+ rx_ces[i],
lcgid,
payload_ptr[0] & 0x3f);
if (UE_id != -1) {
int bsr = 0;
-
+
bsr = payload_ptr[0] & 0x3f;
lcgid_updated[lcgid] = 1;
@@ -536,8 +537,8 @@ rx_sdu(const module_id_t enb_mod_idP,
if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED) {
LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : estimated_ul_buffer = %d (lcg increment %d)\n",
- enb_mod_idP,
- CC_idP,
+ enb_mod_idP,
+ CC_idP,
rx_ces[i],
UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer,
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]);
@@ -548,7 +549,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
payload_ptr += 1; // sizeof(SHORT_BSR)
-
+
break;
case LONG_BSR:
@@ -574,9 +575,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3];
-
- LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = %u LCGID2 = %u LCGID3 = %u\n",
- enb_mod_idP,
+
+ LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = %u LCGID2 = %u LCGID3 = %u\n",
+ enb_mod_idP,
CC_idP,
rx_ces[i],
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0],
@@ -585,12 +586,12 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]);
if (crnti_rx == 1) {
- LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received CRNTI.\n",
+ LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received CRNTI.\n",
enb_mod_idP,
- CC_idP,
+ CC_idP,
rx_ces[i]);
}
-
+
for(int lcgid = 0; lcgid <= LCGID3; lcgid++) {
if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid] == 0) {
UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] = 0;
@@ -605,8 +606,8 @@ rx_sdu(const module_id_t enb_mod_idP,
default:
LOG_E(MAC, "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n",
- enb_mod_idP,
- CC_idP,
+ enb_mod_idP,
+ CC_idP,
rx_ces[i]);
break;
@@ -616,48 +617,48 @@ rx_sdu(const module_id_t enb_mod_idP,
for (int i = 0; i < num_sdu; i++) {
LOG_D(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",
- i,
- rx_lcids[i],
+ i,
+ rx_lcids[i],
rx_lengths[i]);
- T(T_ENB_MAC_UE_UL_SDU,
- T_INT(enb_mod_idP),
+ T(T_ENB_MAC_UE_UL_SDU,
+ T_INT(enb_mod_idP),
T_INT(CC_idP),
- T_INT(current_rnti),
- T_INT(frameP),
+ T_INT(current_rnti),
+ T_INT(frameP),
T_INT(subframeP),
T_INT(rx_lcids[i]),
T_INT(rx_lengths[i]));
-
- T(T_ENB_MAC_UE_UL_SDU_WITH_DATA,
- T_INT(enb_mod_idP),
+
+ T(T_ENB_MAC_UE_UL_SDU_WITH_DATA,
+ T_INT(enb_mod_idP),
T_INT(CC_idP),
- T_INT(current_rnti),
- T_INT(frameP),
+ T_INT(current_rnti),
+ T_INT(frameP),
T_INT(subframeP),
- T_INT(rx_lcids[i]),
- T_INT(rx_lengths[i]),
+ T_INT(rx_lcids[i]),
+ T_INT(rx_lengths[i]),
T_BUFFER(payload_ptr, rx_lengths[i]));
switch (rx_lcids[i]) {
case CCCH:
if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) {
LOG_E(MAC, "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n",
- enb_mod_idP,
- CC_idP,
- frameP,
+ enb_mod_idP,
+ CC_idP,
+ frameP,
rx_lengths[i],
- CCCH_PAYLOAD_SIZE_MAX,
+ CCCH_PAYLOAD_SIZE_MAX,
sdu_lenP);
break;
}
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
- enb_mod_idP,
- CC_idP,
- frameP,
- payload_ptr[0], payload_ptr[1], payload_ptr[2], payload_ptr[3], payload_ptr[4], payload_ptr[5],
+ enb_mod_idP,
+ CC_idP,
+ frameP,
+ payload_ptr[0], payload_ptr[1], payload_ptr[2], payload_ptr[3], payload_ptr[4], payload_ptr[5],
current_rnti);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 1);
@@ -669,20 +670,20 @@ rx_sdu(const module_id_t enb_mod_idP,
RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]);
LOG_D(MAC, "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n",
- enb_mod_idP,
- CC_idP,
- RA_id,
+ enb_mod_idP,
+ CC_idP,
+ RA_id,
ra->rnti,
- current_rnti,
+ current_rnti,
ra->state);
if (UE_id < 0) {
memcpy(&(ra->cont_res_id[0]), payload_ptr, 6);
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n",
- enb_mod_idP,
- CC_idP,
- frameP,
+ enb_mod_idP,
+ CC_idP,
+ frameP,
rx_lengths[i],
payload_ptr - sduP);
@@ -692,26 +693,26 @@ rx_sdu(const module_id_t enb_mod_idP,
#endif
)) == -1) {
LOG_E(MAC,"[MAC][eNB] Max user count reached\n");
-
+
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // send Connection Reject ???
-
+
break;
// kill RA proc
} else {
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n",
- enb_mod_idP,
- CC_idP,
- frameP,
+ enb_mod_idP,
+ CC_idP,
+ frameP,
ra->rnti,
UE_id);
}
} else {
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
- enb_mod_idP,
- CC_idP,
- frameP,
+ enb_mod_idP,
+ CC_idP,
+ frameP,
UE_id,
- rx_lengths[i],
+ rx_lengths[i],
payload_ptr - sduP);
// kill RA proc
}
@@ -719,6 +720,7 @@ rx_sdu(const module_id_t enb_mod_idP,
mac_rrc_data_ind(enb_mod_idP,
CC_idP,
frameP, subframeP,
+ UE_id,
current_rnti,
CCCH,
(uint8_t *) payload_ptr,
@@ -749,7 +751,7 @@ rx_sdu(const module_id_t enb_mod_idP,
// TODO need to be complete for other tdd configs.
}
} else {
- /* Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now,
+ /* Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now,
* Check if this is ok for BL/CE, or if the rule is different
*/
ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
@@ -762,7 +764,7 @@ rx_sdu(const module_id_t enb_mod_idP,
break;
case DCCH:
-
+
case DCCH1:
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
@@ -855,10 +857,10 @@ rx_sdu(const module_id_t enb_mod_idP,
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL);
UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1;
UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i];
-
+
/* Clear uplane_inactivity_timer */
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
-
+
/* Reset RRC inactivity timer after uplane activity */
ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], current_rnti);
if (ue_contextP != NULL) {
@@ -897,17 +899,17 @@ rx_sdu(const module_id_t enb_mod_idP,
/* Program ACK for PHICH */
LOG_D(MAC, "Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",
- current_rnti,
- harq_pid,
+ current_rnti,
+ harq_pid,
first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP);
-
+
hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10];
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 +
+ 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));
@@ -945,8 +947,8 @@ rx_sdu(const module_id_t enb_mod_idP,
/*
* Return the BSR table index corresponding to the number of bytes in input
*/
-uint32_t
-bytes_to_bsr_index(int32_t nbytes)
+uint32_t
+bytes_to_bsr_index(int32_t nbytes)
//-----------------------------------------------------------------------------
{
uint32_t i = 0;
@@ -967,12 +969,12 @@ bytes_to_bsr_index(int32_t nbytes)
* Add ue info in eNB_ulsch_info[module_idP][CC_id][UE_id] struct
*/
void
-add_ue_ulsch_info(module_id_t module_idP,
- int CC_id,
+add_ue_ulsch_info(module_id_t module_idP,
+ int CC_id,
int UE_id,
- sub_frame_t subframeP,
- UE_ULSCH_STATUS status)
-//-----------------------------------------------------------------------------
+ sub_frame_t subframeP,
+ UE_ULSCH_STATUS status)
+//-----------------------------------------------------------------------------
{
eNB_ulsch_info[module_idP][CC_id][UE_id].rnti = UE_RNTI(module_idP, UE_id);
eNB_ulsch_info[module_idP][CC_id][UE_id].subframe = subframeP;
@@ -991,7 +993,7 @@ parse_ulsch_header(unsigned char *mac_header,
unsigned char *rx_ces,
unsigned char *rx_lcids,
unsigned short *rx_lengths,
- unsigned short tb_length)
+ unsigned short tb_length)
//-----------------------------------------------------------------------------
{
unsigned char not_done = 1;
@@ -1032,16 +1034,16 @@ parse_ulsch_header(unsigned char *mac_header,
}
LOG_D(MAC, "[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n",
- num_sdus,
- lcid,
- tb_length,
+ num_sdus,
+ lcid,
+ tb_length,
length,
mac_header_ptr - mac_header);
-
+
rx_lcids[num_sdus] = lcid;
rx_lengths[num_sdus] = length;
num_sdus++;
-
+
} else { // This is a control element subheader POWER_HEADROOM, BSR and CRNTI
if (lcid == SHORT_PADDING) {
mac_header_ptr++;
@@ -1082,16 +1084,16 @@ set_msg3_subframe(module_id_t mod_id,
int CC_id,
int frame, // Not used, remove?
int subframe, // Not used, remove?
- int rnti,
+ int rnti,
int Msg3_frame, // Not used, remove?
- int Msg3_subframe)
+ int Msg3_subframe)
//-----------------------------------------------------------------------------
{
int RA_id = 0;
/* Init */
RA_id = find_RA_id(mod_id, CC_id, rnti); // state == WAITMSG3 instead of state != IDLE (?)
-
+
if (RA_id != -1) {
RC.mac[mod_id]->common_channels[CC_id].ra[RA_id].Msg3_subframe = Msg3_subframe;
} else {
@@ -1106,9 +1108,9 @@ set_msg3_subframe(module_id_t mod_id,
* Main function called for uplink scheduling (DCI0).
*/
void
-schedule_ulsch(module_id_t module_idP,
+schedule_ulsch(module_id_t module_idP,
frame_t frameP,
- sub_frame_t subframeP)
+ sub_frame_t subframeP)
//-----------------------------------------------------------------------------
{
uint16_t first_rb[NFAPI_CC_MAX];
@@ -1216,7 +1218,7 @@ schedule_ulsch(module_id_t module_idP,
return;
break;
-
+
default:
return;
}
@@ -1247,9 +1249,9 @@ schedule_ulsch(module_id_t module_idP,
/* From Louis-Adrien to François:
* The comment bloc below is to configure with a command line.
* I took it from the equivalent part in the fairRR scheduler (around line 2578 in eNB_scheduler_fairRR.c).
- * As said in the meeting, it seems to work only for small TBS.
+ * As said in the meeting, it seems to work only for small TBS.
* The cause of false RA still present with this fix is to investigate.
- *
+ *
* Note: in the get_prach_prb_offset() function below, the last argument is frameP in eNB_scheduler_fairRR.c
* I think it should be sched_frame instead. This parameter has only impacts in case TDD and preamble format 4.
* To confirm.
@@ -1258,14 +1260,14 @@ schedule_ulsch(module_id_t module_idP,
int start_rb = 0;
int nb_rb = 6;
LTE_DL_FRAME_PARMS *frame_parms = &(RC.eNB[module_idP][CC_id]->frame_parms);
-
+
if (is_prach_subframe(frame_parms, sched_frame, sched_subframe) == 1) {
- start_rb = get_prach_prb_offset(frame_parms,
+ start_rb = get_prach_prb_offset(frame_parms,
frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
0, // tdd_mapindex
sched_frame); // Nf
-
+
first_rb[CC_id] = start_rb + nb_rb;
}
*/
@@ -1274,14 +1276,14 @@ schedule_ulsch(module_id_t module_idP,
* Check if RA (Msg3) is active in this subframeP, if so skip the PRB used for Msg3
* Msg3 is using 1 PRB so we need to increase first_rb accordingly
* Not sure about the break (can there be more than 1 active RA procedure per CC_id and per subframe?)
- */
+ */
for (int ra_index = 0; ra_index < NB_RA_PROC_MAX; ra_index++, ra_ptr++) {
if ((ra_ptr->state == WAITMSG3) && (ra_ptr->Msg3_subframe == sched_subframe)) {
if (first_rb[CC_id] < ra_ptr->msg3_first_rb + ra_ptr->msg3_nb_rb) {
first_rb[CC_id] = ra_ptr->msg3_first_rb + ra_ptr->msg3_nb_rb;
}
- /* Louis-Adrien: I couldn't find an interdiction of multiple Msg3 scheduling
- * on the same time resources. Also the performance improvement of breaking is low,
+ /* Louis-Adrien: I couldn't find an interdiction of multiple Msg3 scheduling
+ * on the same time resources. Also the performance improvement of breaking is low,
* since we will loop until the end, most of the time.
* I'm letting the break as a reminder, in case of misunderstanding the spec.
*/
@@ -1308,8 +1310,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
int slice_idx,
frame_t frameP,
sub_frame_t subframeP,
- unsigned char sched_subframeP,
- uint16_t *first_rb)
+ unsigned char sched_subframeP,
+ uint16_t *first_rb)
//-----------------------------------------------------------------------------
{
rnti_t rnti = -1;
@@ -1324,7 +1326,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
uint32_t cshift = 0;
uint32_t ndi = 0;
uint32_t tpc = 0;
- int32_t normalized_rx_power = 0;
+ int32_t normalized_rx_power = 0;
int32_t target_rx_power = 0;
int32_t framex10psubframe = 0;
static int32_t tpc_accumulated = 0;
@@ -1347,7 +1349,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
sli = &(mac->slice_info);
memset(first_rb_slice, 0, NFAPI_CC_MAX * sizeof(int));
memset(n_rb_ul_tab, 0, NFAPI_CC_MAX * sizeof(int));
- sched_frame = frameP;
+ sched_frame = frameP;
if (sched_subframeP < subframeP) {
sched_frame++;
@@ -1390,9 +1392,9 @@ schedule_ulsch_rnti(module_id_t module_idP,
// don't schedule if Msg5 is not received yet
if (UE_list->UE_template[UE_PCCID(module_idP, UE_id)][UE_id].configured == FALSE) {
LOG_D(MAC, "[eNB %d] frame %d, subframe %d, UE %d: not configured, skipping UE scheduling \n",
- module_idP,
- frameP,
- subframeP,
+ module_idP,
+ frameP,
+ subframeP,
UE_id);
continue;
@@ -1402,9 +1404,9 @@ schedule_ulsch_rnti(module_id_t module_idP,
if (rnti == NOT_A_RNTI) {
LOG_W(MAC, "[eNB %d] frame %d, subframe %d, UE %d: no RNTI \n",
- module_idP,
- frameP,
- subframeP,
+ module_idP,
+ frameP,
+ subframeP,
UE_id);
continue;
@@ -1418,11 +1420,11 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* Be sure that there are some free RBs */
if (first_rb_slice[CC_id] >= n_rb_ul_tab[CC_id] - 1) {
LOG_W(MAC, "[eNB %d] frame %d, subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
- module_idP,
- frameP,
- subframeP,
- UE_id,
- rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ UE_id,
+ rnti,
CC_id);
continue;
@@ -1432,15 +1434,15 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* This test seems to be way too long, can we provide an optimization? */
if (CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, aggregation, rnti)) {
LOG_W(MAC, "[eNB %d] frame %d, subframe %d, UE %d/%x CC %d: not enough CCE\n",
- module_idP,
- frameP,
- subframeP,
- UE_id,
- rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ UE_id,
+ rnti,
CC_id);
continue;
- }
+ }
/* UE is active and can be scheduled, setting up struct */
UE_template_ptr = &(UE_list->UE_template[CC_id][UE_id]);
@@ -1448,47 +1450,47 @@ schedule_ulsch_rnti(module_id_t module_idP,
harq_pid = subframe2harqpid(&cc[CC_id], sched_frame, sched_subframeP);
round_index = UE_sched_ctrl_ptr->round_UL[CC_id][harq_pid];
- AssertFatal(round_index < 8, "round %d > 7 for UE %d/%x\n",
+ AssertFatal(round_index < 8, "round %d > 7 for UE %d/%x\n",
round_index,
UE_id,
rnti);
LOG_D(MAC, "[eNB %d] frame %d subframe %d (sched_frame %d, sched_subframe %d), Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n",
- module_idP,
- frameP,
- subframeP,
- sched_frame,
- sched_subframeP,
- harq_pid,
- UE_id,
+ module_idP,
+ frameP,
+ subframeP,
+ sched_frame,
+ sched_subframeP,
+ harq_pid,
+ UE_id,
rnti,
- CC_id,
- aggregation,
+ CC_id,
+ aggregation,
n_rb_ul_tab[CC_id]);
/* Seems unused, only for debug */
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * 10) + subframeP] = UE_template_ptr->estimated_ul_buffer;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO, UE_template_ptr->estimated_ul_buffer);
- /*
- * If there is information on bsr of DCCH, DTCH or if there is UL_SR,
- * or if there is a packet to retransmit, or we want to schedule a periodic feedback
+ /*
+ * If there is information on bsr of DCCH, DTCH or if there is UL_SR,
+ * or if there is a packet to retransmit, or we want to schedule a periodic feedback
*/
/* Shouldn't this test be done earlier?? */
if (UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0 || round_index > 0) {
LOG_D(MAC, "[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
- module_idP,
- harq_pid,
- frameP,
- subframeP,
- UE_id,
+ module_idP,
+ harq_pid,
+ frameP,
+ subframeP,
+ UE_id,
rnti,
- round_index,
+ round_index,
UE_template_ptr->ul_SR,
UE_sched_ctrl_ptr->ul_inactivity_timer,
UE_sched_ctrl_ptr->ul_failure_timer,
UE_sched_ctrl_ptr->cqi_req_timer);
-
+
// reset the scheduling request
UE_template_ptr->ul_SR = 0;
status = mac_eNB_get_rrc_status(module_idP, rnti);
@@ -1526,7 +1528,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
if(cqi_req == 1) {
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
- }
+ }
}
} else {
UE_sched_ctrl_ptr->cqi_req_flag = 0;
@@ -1548,12 +1550,12 @@ schedule_ulsch_rnti(module_id_t module_idP,
/*
* This assumes accumulated tpc
* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
- */
+ */
framex10psubframe = (UE_template_ptr->pusch_tpc_tx_frame * 10) + UE_template_ptr->pusch_tpc_tx_subframe;
if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || // normal case
((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) { //frame wrap-around
-
+
UE_template_ptr->pusch_tpc_tx_frame = frameP;
UE_template_ptr->pusch_tpc_tx_subframe = subframeP;
@@ -1572,12 +1574,12 @@ schedule_ulsch_rnti(module_id_t module_idP,
if (tpc != 1) {
LOG_D(MAC, "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
- module_idP,
- frameP,
- subframeP,
- harq_pid,
+ module_idP,
+ frameP,
+ subframeP,
+ harq_pid,
tpc,
- tpc_accumulated,
+ tpc_accumulated,
normalized_rx_power,
target_rx_power);
}
@@ -1599,8 +1601,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
}
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template_ptr->mcs_UL[harq_pid];
-
- while (((rb_table[rb_table_index] > (n_rb_ul_tab[CC_id] - first_rb_slice[CC_id])) ||
+
+ while (((rb_table[rb_table_index] > (n_rb_ul_tab[CC_id] - first_rb_slice[CC_id])) ||
(rb_table[rb_table_index] > 45)) && (rb_table_index > 0)) {
rb_table_index--;
}
@@ -1609,18 +1611,18 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index];
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template_ptr->TBS_UL[harq_pid];
UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_TBS += UE_template_ptr->TBS_UL[harq_pid];
-
- T(T_ENB_MAC_UE_UL_SCHEDULE,
+
+ T(T_ENB_MAC_UE_UL_SCHEDULE,
T_INT(module_idP),
- T_INT(CC_id),
- T_INT(rnti),
+ T_INT(CC_id),
+ T_INT(rnti),
T_INT(frameP),
- T_INT(subframeP),
+ T_INT(subframeP),
T_INT(harq_pid),
T_INT(UE_template_ptr->mcs_UL[harq_pid]),
T_INT(first_rb_slice[CC_id]),
T_INT(rb_table[rb_table_index]),
- T_INT(UE_template_ptr->TBS_UL[harq_pid]),
+ T_INT(UE_template_ptr->TBS_UL[harq_pid]),
T_INT(ndi));
/* Store information for possible retransmission */
@@ -1634,21 +1636,21 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* Adjust scheduled UL bytes by TBS, wait for UL sdus to do final update */
LOG_D(MAC, "[eNB %d] CC_id %d UE %d/%x : adjusting scheduled_ul_bytes, old %d, TBS %d\n",
- module_idP,
- CC_id,
- UE_id,
+ module_idP,
+ CC_id,
+ UE_id,
rnti,
UE_template_ptr->scheduled_ul_bytes,
UE_template_ptr->TBS_UL[harq_pid]);
UE_template_ptr->scheduled_ul_bytes += UE_template_ptr->TBS_UL[harq_pid];
- LOG_D(MAC, "scheduled_ul_bytes, new %d\n",
+ LOG_D(MAC, "scheduled_ul_bytes, new %d\n",
UE_template_ptr->scheduled_ul_bytes);
/* Cyclic shift for DM-RS */
cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
-
+
/* Save it for a potential retransmission */
UE_template_ptr->cshift[harq_pid] = cshift;
@@ -1679,44 +1681,44 @@ schedule_ulsch_rnti(module_id_t module_idP,
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
LOG_D(MAC, "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
- harq_pid,
- frameP,
- subframeP,
- UE_id,
+ harq_pid,
+ frameP,
+ subframeP,
+ UE_id,
rnti,
- sched_frame,
+ sched_frame,
sched_subframeP);
-
+
ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0; ul_req_index < ul_req_tmp_body->number_of_pdus; ul_req_index++) {
if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE &&
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) {
-
+
dlsch_flag = 1;
-
+
LOG_D(MAC, "Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",
frameP,
subframeP,
rnti,
ul_req_index);
-
+
break;
}
}
/* Add UL_config PDUs */
- fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
- cqi_req,
- cc,
- UE_template_ptr->physicalConfigDedicated,
- get_tmode(module_idP, CC_id, UE_id),
- mac->ul_handle,
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
+ cqi_req,
+ cc,
+ UE_template_ptr->physicalConfigDedicated,
+ get_tmode(module_idP, CC_id, UE_id),
+ mac->ul_handle,
rnti,
first_rb_slice[CC_id], // resource_block_start
rb_table[rb_table_index], // number_of_resource_blocks
- UE_template_ptr->mcs_UL[harq_pid],
+ UE_template_ptr->mcs_UL[harq_pid],
cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
0, // frequency_hopping_bits
@@ -1731,8 +1733,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/* This is a BL/CE UE allocation */
if (UE_template_ptr->rach_resource_type > 0) {
- fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
- UE_template_ptr->rach_resource_type > 2 ? 2 : 1,
+ fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
+ UE_template_ptr->rach_resource_type > 2 ? 2 : 1,
1, // total_number_of_repetitions
1, // repetition_number
(frameP * 10) + subframeP);
@@ -1768,14 +1770,14 @@ schedule_ulsch_rnti(module_id_t module_idP,
add_ue_ulsch_info(module_idP, CC_id, UE_id, subframeP, S_UL_SCHEDULED);
- LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n",
- module_idP,
- CC_id,
- frameP,
- subframeP,
+ LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n",
+ module_idP,
+ CC_id,
+ frameP,
+ subframeP,
UE_id);
-
- LOG_D(MAC, "[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n",
+
+ LOG_D(MAC, "[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n",
harq_pid,
frameP,
subframeP,
@@ -1784,33 +1786,33 @@ schedule_ulsch_rnti(module_id_t module_idP,
cqi_req,
UE_id,
rnti);
-
+
/* Increment first rb for next UE allocation */
first_rb_slice[CC_id] += rb_table[rb_table_index];
} else { // round_index > 0 => retransmission
T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION,
- T_INT(module_idP),
- T_INT(CC_id),
+ T_INT(module_idP),
+ T_INT(CC_id),
T_INT(rnti),
- T_INT(frameP),
- T_INT(subframeP),
+ T_INT(frameP),
+ T_INT(subframeP),
T_INT(harq_pid),
T_INT(UE_template_ptr->mcs_UL[harq_pid]),
T_INT(first_rb_slice[CC_id]),
- T_INT(rb_table[rb_table_index]),
+ T_INT(rb_table[rb_table_index]),
T_INT(round_index));
/* 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",
- harq_pid,
+ harq_pid,
frameP,
- subframeP,
- UE_id,
+ subframeP,
+ UE_id,
rnti,
- sched_frame,
+ sched_frame,
sched_subframeP);
-
+
ul_req_index = 0;
dlsch_flag = 0;
@@ -1819,27 +1821,27 @@ schedule_ulsch_rnti(module_id_t module_idP,
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) {
dlsch_flag = 1;
-
+
LOG_D(MAC, "Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",
frameP,
subframeP,
rnti,
ul_req_index);
-
+
break;
}
}
- fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
- cqi_req,
- cc,
- UE_template_ptr->physicalConfigDedicated,
- get_tmode(module_idP, CC_id, UE_id),
- mac->ul_handle,
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
+ cqi_req,
+ cc,
+ UE_template_ptr->physicalConfigDedicated,
+ get_tmode(module_idP, CC_id, UE_id),
+ mac->ul_handle,
rnti,
UE_template_ptr->first_rb_ul[harq_pid], // resource_block_start
UE_template_ptr->nb_rb_ul[harq_pid], // number_of_resource_blocks
- UE_template_ptr->mcs_UL[harq_pid],
+ UE_template_ptr->mcs_UL[harq_pid],
cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
0, // frequency_hopping_bits
@@ -1855,8 +1857,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* This is a BL/CE UE allocation */
if (UE_template_ptr->rach_resource_type > 0) {
- fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
- UE_template_ptr->rach_resource_type > 2 ? 2 : 1,
+ fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index],
+ UE_template_ptr->rach_resource_type > 2 ? 2 : 1,
1, // total_number_of_repetitions
1, // repetition_number
(frameP * 10) + subframeP);
@@ -1884,7 +1886,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
}
fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information, subframeP);
-
+
} else {
ul_req_tmp_body->number_of_pdus++;
}
@@ -1903,7 +1905,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
sched_frame,
sched_subframeP,
cqi_req);
- } // end of round > 0
+ } // end of round > 0
} // UE_is_to_be_scheduled
} // loop over all active CC_ids
} // loop over UE_ids
@@ -1915,10 +1917,10 @@ schedule_ulsch_rnti(module_id_t module_idP,
* default ULSCH scheduler for LTE-M
*/
void schedule_ulsch_rnti_emtc(module_id_t module_idP,
- frame_t frameP,
- sub_frame_t subframeP,
- unsigned char sched_subframeP,
- int *emtc_active)
+ frame_t frameP,
+ sub_frame_t subframeP,
+ unsigned char sched_subframeP,
+ int *emtc_active)
//-----------------------------------------------------------------------------
{
int UE_id = -1;
@@ -1931,7 +1933,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
int32_t normalized_rx_power = 0;
int32_t target_rx_power = -90;
int n = 0;
- int CC_id = 0;
+ int CC_id = 0;
int N_RB_UL = 0;
int sched_frame = frameP;
int rvidx_tab[4] = {0,2,3,1};
@@ -1989,8 +1991,8 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
/* Loop over all active UL CC_ids for this UE */
for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
/* This is the actual CC_id in the list */
- CC_id = UE_list->ordered_ULCCids[n][UE_id];
- N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
+ CC_id = UE_list->ordered_ULCCids[n][UE_id];
+ N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
UE_template = &(UE_list->UE_template[CC_id][UE_id]);
UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
@@ -2016,7 +2018,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->estimated_ul_buffer;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO, UE_template->estimated_ul_buffer);
-
+
//if ((UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0) && (subframeP == 5)) {
if ((UE_template->ul_SR > 0 || round_UL > 0 || status < RRC_CONNECTED) && (subframeP == 5)) {
/*
@@ -2025,7 +2027,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
* or if there is a packet to retransmit,
* or we want to schedule a periodic feedback every frame
*/
-
+
LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round_UL %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
module_idP,
harq_pid,
@@ -2037,42 +2039,42 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_template->ul_SR,
UE_sched_ctrl->ul_inactivity_timer,
UE_sched_ctrl->ul_failure_timer,
- UE_sched_ctrl->cqi_req_timer);
+ UE_sched_ctrl->cqi_req_timer);
/* Reset the scheduling request */
emtc_active[CC_id] = 1;
- UE_template->ul_SR = 0;
- status = mac_eNB_get_rrc_status(module_idP,rnti);
- cqi_req = 0;
+ UE_template->ul_SR = 0;
+ status = mac_eNB_get_rrc_status(module_idP,rnti);
+ cqi_req = 0;
/* Power control: compute the expected ULSCH RX power (for the stats) */
/* This is the normalized RX power and this should be constant (regardless of mcs) */
- normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
- target_rx_power = 178;
+ normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
+ target_rx_power = 178;
/* This assumes accumulated tpc */
/* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */
int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe;
if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || // normal case
((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) // frame wrap-around
- {
+ {
UE_template->pusch_tpc_tx_frame = frameP;
UE_template->pusch_tpc_tx_subframe = subframeP;
if (normalized_rx_power > (target_rx_power + 4)) {
- tpc = 0; //-1
- UE_sched_ctrl->tpc_accumulated[CC_id]--;
+ tpc = 0; //-1
+ UE_sched_ctrl->tpc_accumulated[CC_id]--;
} else if (normalized_rx_power < (target_rx_power - 4)) {
- tpc = 2; //+1
- UE_sched_ctrl->tpc_accumulated[CC_id]++;
+ tpc = 2; //+1
+ UE_sched_ctrl->tpc_accumulated[CC_id]++;
+ } else {
+ tpc = 1; //0
+ }
} else {
- tpc = 1; //0
- }
- } else {
tpc = 1; //0
- }
+ }
if (tpc != 1) {
- LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
+ LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
module_idP,
frameP,
subframeP,
@@ -2081,14 +2083,14 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_sched_ctrl->tpc_accumulated[CC_id],
normalized_rx_power,
target_rx_power);
- }
+ }
/* New transmission */
if (round_UL == 0) {
ndi = 1 - UE_template->oldNDI_UL[harq_pid];
-
+
UE_template->oldNDI_UL[harq_pid] = ndi;
- UE_template->mcs_UL[harq_pid] = 4;
+ UE_template->mcs_UL[harq_pid] = 4;
UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], 6);
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power;
@@ -2097,7 +2099,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid];
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += 6;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid];
-
+
T(T_ENB_MAC_UE_UL_SCHEDULE,
T_INT(module_idP),
T_INT(CC_id),
@@ -2112,7 +2114,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
T_INT(ndi));
/* Store for possible retransmission */
- UE_template->nb_rb_ul[harq_pid] = 6;
+ UE_template->nb_rb_ul[harq_pid] = 6;
UE_sched_ctrl->ul_scheduled |= (1 << harq_pid);
if (UE_id == UE_list->head) {
@@ -2120,33 +2122,33 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
}
/* Adjust total UL buffer status by TBS, wait for UL sdus to do final update */
- UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid];
+ UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid];
- LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes);
+ LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes);
/* Cyclic shift for DMRS */
cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
/* save it for a potential retransmission */
- UE_template->cshift[harq_pid] = cshift;
+ UE_template->cshift[harq_pid] = cshift;
AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
- AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
- AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
- LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
- AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
+ AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
- "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
- "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS MPDCCH Narrowband %d\n",
harq_pid,
@@ -2163,51 +2165,51 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci + hi_dci0_req->number_of_hi]);
memset((void*) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t));
- hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
- hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
+ hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; // already set above...
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB = 3
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off,
- "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
- hi_dci0_req->number_of_dci++;
+ hi_dci0_req->number_of_dci++;
LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG. Request for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS mpdcch narrowband %d\n",
harq_pid,
@@ -2219,42 +2221,42 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
sched_subframeP,
(int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1);
- fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
- cqi_req,
- cc,
- UE_template->physicalConfigDedicated,
- get_tmode(module_idP,CC_id,UE_id),
- eNB->ul_handle,
- rnti,
- UE_template->first_rb_ul[harq_pid], // resource_block_start
- UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
- UE_template->mcs_UL[harq_pid],
- cshift, // cyclic_shift_2_for_drms
- 0, // frequency_hopping_enabled_flag
- 0, // frequency_hopping_bits
- UE_template->oldNDI_UL[harq_pid], // new_data_indication
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ cqi_req,
+ cc,
+ UE_template->physicalConfigDedicated,
+ get_tmode(module_idP,CC_id,UE_id),
+ eNB->ul_handle,
+ rnti,
+ UE_template->first_rb_ul[harq_pid], // resource_block_start
+ UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
+ UE_template->mcs_UL[harq_pid],
+ cshift, // cyclic_shift_2_for_drms
+ 0, // frequency_hopping_enabled_flag
+ 0, // frequency_hopping_bits
+ UE_template->oldNDI_UL[harq_pid], // new_data_indication
rvidx_tab[round_UL&3], // redundancy_version
- harq_pid, // harq_process_number
- 0, // ul_tx_mode
- 0, // current_tx_nb
- 0, // n_srs
- UE_template->TBS_UL[harq_pid]
- );
+ harq_pid, // harq_process_number
+ 0, // ul_tx_mode
+ 0, // current_tx_nb
+ 0, // n_srs
+ UE_template->TBS_UL[harq_pid]
+ );
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
UE_template->rach_resource_type > 2 ? 2 : 1,
1, // total_number_of_repetitions
1, // repetition_number
(frameP * 10) + subframeP);
-
- ul_req_tmp->number_of_pdus++;
- eNB->ul_handle++;
- add_ue_ulsch_info(module_idP,
- CC_id,
- UE_id,
- subframeP,
- S_UL_SCHEDULED);
+ ul_req_tmp->number_of_pdus++;
+ eNB->ul_handle++;
+
+ add_ue_ulsch_info(module_idP,
+ CC_id,
+ UE_id,
+ subframeP,
+ S_UL_SCHEDULED);
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n",
module_idP,
@@ -2280,22 +2282,22 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n");
AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
- AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
- AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
- LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
- AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
+ AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
- "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
- "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d,UESS MPDCCH Narrowband %d\n",
harq_pid,
@@ -2310,87 +2312,87 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb(cc, epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]);
-
+
memset((void*) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t));
- hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
- hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
+ hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL,
- "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off,
- "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = rvidx_tab[round_UL&3];
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = harq_pid;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
- hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = harq_pid;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
- hi_dci0_req->number_of_dci++;
+ hi_dci0_req->number_of_dci++;
- fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
- cqi_req,
- cc,
- UE_template->physicalConfigDedicated,
- get_tmode(module_idP,CC_id,UE_id),
- eNB->ul_handle,
- rnti,
- UE_template->first_rb_ul[harq_pid], // resource_block_start
- UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
- UE_template->mcs_UL[harq_pid],
- cshift, // cyclic_shift_2_for_drms
- 0, // frequency_hopping_enabled_flag
- 0, // frequency_hopping_bits
- UE_template->oldNDI_UL[harq_pid], // new_data_indication
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ cqi_req,
+ cc,
+ UE_template->physicalConfigDedicated,
+ get_tmode(module_idP,CC_id,UE_id),
+ eNB->ul_handle,
+ rnti,
+ UE_template->first_rb_ul[harq_pid], // resource_block_start
+ UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
+ UE_template->mcs_UL[harq_pid],
+ cshift, // cyclic_shift_2_for_drms
+ 0, // frequency_hopping_enabled_flag
+ 0, // frequency_hopping_bits
+ UE_template->oldNDI_UL[harq_pid], // new_data_indication
rvidx_tab[round_UL&3], // redundancy_version
- harq_pid, // harq_process_number
- 0, // ul_tx_mode
- 0, // current_tx_nb
- 0, // n_srs
- UE_template->TBS_UL[harq_pid]
- );
+ harq_pid, // harq_process_number
+ 0, // ul_tx_mode
+ 0, // current_tx_nb
+ 0, // n_srs
+ UE_template->TBS_UL[harq_pid]
+ );
- fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
- UE_template->rach_resource_type>2 ? 2 : 1,
- 1, //total_number_of_repetitions
- 1, //repetition_number
+ fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ UE_template->rach_resource_type>2 ? 2 : 1,
+ 1, //total_number_of_repetitions
+ 1, //repetition_number
(frameP * 10) + subframeP);
-
- ul_req_tmp->number_of_pdus++;
- eNB->ul_handle++;
- }
- } // UE_is_to_be_scheduled
+
+ ul_req_tmp->number_of_pdus++;
+ eNB->ul_handle++;
+ }
+ } // UE_is_to_be_scheduled
} // ULCCs
} // loop over UE_id
}
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index 5aefdf14e7..fc457c2ee7 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -82,6 +82,7 @@
* @{
*/
+#define MAX_MAC_INST 16
#define BCCH_PAYLOAD_SIZE_MAX 128
#define CCCH_PAYLOAD_SIZE_MAX 128
#define PCCH_PAYLOAD_SIZE_MAX 128
@@ -1010,6 +1011,8 @@ typedef struct {
sub_frame_t Msg3_subframe;
/// Frame where Msg3 is to be sent
frame_t Msg3_frame;
+ /// Delay cnt for Msg4 transmission (waiting for RRC message piggyback)
+ int Msg4_delay_cnt;
/// Subframe where Msg4 is to be sent
sub_frame_t Msg4_subframe;
/// Frame where Msg4 is to be sent
@@ -1098,13 +1101,13 @@ typedef struct {
int avail;
int num_UEs;
boolean_t active[MAX_MOBILES_PER_ENB];
-
+
/// Sorting criteria for the UE list in the MAC preprocessor
uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
uint16_t first_rb_offset[NFAPI_CC_MAX][MAX_NUM_SLICES];
-
+
int assoc_dl_slice_idx[MAX_MOBILES_PER_ENB];
- int assoc_ul_slice_idx[MAX_MOBILES_PER_ENB];
+ int assoc_ul_slice_idx[MAX_MOBILES_PER_ENB];
} UE_list_t;
/*! \brief deleting control information*/
diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h
index d29debb2a3..8943a21d60 100644
--- a/openair2/LAYER2/MAC/mac_proto.h
+++ b/openair2/LAYER2/MAC/mac_proto.h
@@ -1222,7 +1222,7 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
- uint16_t absSFP,
+ uint16_t absSFP,
uint8_t cce_idxP);
void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t * dl_config_pdu,
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 88c7db83c0..89756e7baa 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -460,10 +460,10 @@ void decode_slice_positioning(module_id_t Mod_idP,
// This fuction sorts the UE in order their dlsch buffer and CQI
-void
-sort_UEs(module_id_t Mod_idP,
- int slice_idx,
- int frameP,
+void
+sort_UEs(module_id_t Mod_idP,
+ int slice_idx,
+ int frameP,
sub_frame_t subframeP)
{
int i;
@@ -1196,9 +1196,9 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
// Initialize scheduling information for all active UEs
memset(&sli->pre_processor_results[slice_idx], 0, sizeof(sli->pre_processor_results[slice_idx]));
// FIXME: After the memset above, some of the resets in reset() are redundant
- dlsch_scheduler_pre_processor_reset(Mod_id,
- slice_idx,
- frameP,
+ dlsch_scheduler_pre_processor_reset(Mod_id,
+ slice_idx,
+ frameP,
subframeP,
min_rb_unit,
nb_rbs_required,
@@ -1207,37 +1207,37 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
mbsfn_flag); // FIXME: Not sure if useful
// STATUS
// Store the DLSCH buffer for each logical channel
- store_dlsch_buffer(Mod_id,
- slice_idx,
- frameP,
+ store_dlsch_buffer(Mod_id,
+ slice_idx,
+ frameP,
subframeP);
// Calculate the number of RBs required by each UE on the basis of logical channel's buffer
- assign_rbs_required(Mod_id,
- slice_idx,
- frameP,
- subframeP,
- nb_rbs_required,
+ assign_rbs_required(Mod_id,
+ slice_idx,
+ frameP,
+ subframeP,
+ nb_rbs_required,
min_rb_unit);
// Sorts the user on the basis of dlsch logical channel buffer and CQI
- sort_UEs(Mod_id,
- slice_idx,
- frameP,
+ sort_UEs(Mod_id,
+ slice_idx,
+ frameP,
subframeP);
// ACCOUNTING
// This procedure decides the number of RBs to allocate
- dlsch_scheduler_pre_processor_accounting(Mod_id,
- slice_idx,
- frameP,
+ dlsch_scheduler_pre_processor_accounting(Mod_id,
+ slice_idx,
+ frameP,
subframeP,
min_rb_unit,
nb_rbs_required,
nb_rbs_accounted);
// POSITIONING
// This procedure does the main allocation of the RBs
- dlsch_scheduler_pre_processor_positioning(Mod_id,
+ dlsch_scheduler_pre_processor_positioning(Mod_id,
slice_idx,
min_rb_unit,
nb_rbs_required,
@@ -1249,7 +1249,7 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
// SHARING
// If there are available RBs left in the slice, allocate them to the highest priority UEs
if (eNB->slice_info.intraslice_share_active) {
- dlsch_scheduler_pre_processor_intraslice_sharing(Mod_id,
+ dlsch_scheduler_pre_processor_intraslice_sharing(Mod_id,
slice_idx,
min_rb_unit,
nb_rbs_required,
@@ -1304,25 +1304,25 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
int N_RBG = to_rbg(cc->mib->message.dl_Bandwidth);
if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0) {
- LOG_D(MAC, "******************DL Scheduling Information for UE%d ************************\n",
+ LOG_D(MAC, "******************DL Scheduling Information for UE%d ************************\n",
UE_id);
- LOG_D(MAC, "dl power offset UE%d = %d \n",
- UE_id,
+ LOG_D(MAC, "dl power offset UE%d = %d \n",
+ UE_id,
ue_sched_ctl->dl_pow_off[CC_id]);
- LOG_D(MAC, "***********RB Alloc for every subband for UE%d ***********\n",
+ LOG_D(MAC, "***********RB Alloc for every subband for UE%d ***********\n",
UE_id);
for (j = 0; j < N_RBG; j++) {
//PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[UE_id] = rballoc_sub_UE[CC_id][UE_id][UE_id];
- LOG_D(MAC, "RB Alloc for UE%d and Subband%d = %d\n",
- UE_id, j,
+ LOG_D(MAC, "RB Alloc for UE%d and Subband%d = %d\n",
+ UE_id, j,
ue_sched_ctl->rballoc_sub_UE[CC_id][j]);
}
//PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id];
LOG_D(MAC, "[eNB %d][SLICE %d]Total RBs allocated for UE%d = %d\n",
- Mod_id,
- eNB->slice_info.dl[slice_idx].id,
+ Mod_id,
+ eNB->slice_info.dl[slice_idx].id,
UE_id,
ue_sched_ctl->pre_nb_available_rbs[CC_id]);
}
@@ -1628,7 +1628,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
sub_frame_t subframeP,
unsigned char sched_subframeP,
uint16_t *first_rb) {
- int UE_id;
+ int UE_id;
uint16_t n;
uint8_t CC_id, harq_pid;
uint16_t nb_allocated_rbs[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
@@ -1679,16 +1679,16 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
for (UE_id = UE_list->head_ul; UE_id >= 0; UE_id = UE_list->next_ul[UE_id]) {
if (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 0) continue;
- LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x\n",
+ LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x\n",
UE_id,
rntiTable[UE_id]);
for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
// This is the actual CC_id in the list
CC_id = UE_list->ordered_ULCCids[n][UE_id];
- LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x CCid %d\n",
- UE_id,
- rntiTable[UE_id],
+ LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x CCid %d\n",
+ UE_id,
+ rntiTable[UE_id],
CC_id);
/*
if((mac_xface->get_nCCE_max(module_idP,CC_id,3,subframeP) - nCCE_to_be_used[CC_id]) > (1<max_rbs_allowed_slice_uplink[CC_id][slice_idx] =
nb_rbs_allowed_slice(sli->ul[slice_idx].pct, N_RB_UL);
first_rb_offset = UE_list->first_rb_offset[CC_id][slice_idx];
- available_rbs =
+ available_rbs =
cmin(ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_idx], N_RB_UL - first_rb[CC_id] - first_rb_offset);
if (available_rbs < 0)
@@ -1715,18 +1715,18 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
} else {
average_rbs_per_user[CC_id] = 1;
LOG_W(MAC, "[eNB %d] frame %d subframe %d: UE %d CC %d: can't get average rb per user (should not be here)\n",
- module_idP,
- frameP,
- subframeP,
- UE_id,
+ module_idP,
+ frameP,
+ subframeP,
+ UE_id,
CC_id);
}
if (total_ue_count[CC_id] > 0) {
LOG_D(MAC, "[eNB %d] Frame %d subframe %d: total ue to be scheduled %d\n",
- module_idP,
- frameP,
- subframeP,
+ module_idP,
+ frameP,
+ subframeP,
total_ue_count[CC_id]);
}
}
@@ -1754,9 +1754,9 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
total_allocated_rbs[CC_id] += nb_allocated_rbs[CC_id][UE_id];
LOG_D(MAC, "In ulsch_preprocessor: assigning %d RBs for UE %d/%x CCid %d, harq_pid %d\n",
- nb_allocated_rbs[CC_id][UE_id],
- UE_id,
- rntiTable[UE_id],
+ nb_allocated_rbs[CC_id][UE_id],
+ UE_id,
+ rntiTable[UE_id],
CC_id,
harq_pid);
}
@@ -1781,7 +1781,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
total_remaining_rbs[CC_id]++;
}
- while (UE_template->pre_allocated_nb_rb_ul[slice_idx] > 0 &&
+ while (UE_template->pre_allocated_nb_rb_ul[slice_idx] > 0 &&
nb_allocated_rbs[CC_id][UE_id] < UE_template->pre_allocated_nb_rb_ul[slice_idx] &&
total_remaining_rbs[CC_id] > 0) {
nb_allocated_rbs[CC_id][UE_id] = cmin(nb_allocated_rbs[CC_id][UE_id] + 1, UE_template->pre_allocated_nb_rb_ul[slice_idx]);
@@ -1791,12 +1791,12 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
UE_template->pre_allocated_nb_rb_ul[slice_idx] = nb_allocated_rbs[CC_id][UE_id];
LOG_D(MAC, "******************UL Scheduling Information for UE%d CC_id %d ************************\n",
- UE_id,
+ UE_id,
CC_id);
LOG_D(MAC, "[eNB %d] total RB allocated for UE%d CC_id %d = %d\n",
- module_idP,
- UE_id,
- CC_id,
+ module_idP,
+ UE_id,
+ CC_id,
UE_template->pre_allocated_nb_rb_ul[slice_idx]);
}
}
@@ -1805,10 +1805,10 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
}
void
-assign_max_mcs_min_rb(module_id_t module_idP,
- int slice_idx,
+assign_max_mcs_min_rb(module_id_t module_idP,
+ int slice_idx,
int frameP,
- sub_frame_t subframeP,
+ sub_frame_t subframeP,
uint16_t *first_rb) {
int i;
uint16_t n, UE_id;
@@ -1840,9 +1840,9 @@ assign_max_mcs_min_rb(module_id_t module_idP,
// This is the actual CC_id in the list
CC_id = UE_list->ordered_ULCCids[n][UE_id];
AssertFatal(CC_id < RC.nb_mac_CC[module_idP], "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u",
- CC_id,
- NFAPI_CC_MAX,
- n,
+ CC_id,
+ NFAPI_CC_MAX,
+ n,
UE_id,
UE_list->numactiveULCCs[UE_id]);
UE_template = &UE_list->UE_template[CC_id][UE_id];
@@ -1871,12 +1871,12 @@ assign_max_mcs_min_rb(module_id_t module_idP,
}
first_rb_offset = UE_list->first_rb_offset[CC_id][slice_idx];
- available_rbs =
+ available_rbs =
cmin(ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_idx], N_RB_UL - first_rb[CC_id] - first_rb_offset);
- while (tbs < bits_to_schedule &&
- rb_table[rb_table_index] < available_rbs &&
- UE_template->phr_info - tx_power > 0 &&
+ while (tbs < bits_to_schedule &&
+ rb_table[rb_table_index] < available_rbs &&
+ UE_template->phr_info - tx_power > 0 &&
rb_table_index < 32) {
rb_table_index++;
tbs = get_TBS_UL(UE_template->pre_assigned_mcs_ul, rb_table[rb_table_index]) << 3;
@@ -1895,10 +1895,10 @@ assign_max_mcs_min_rb(module_id_t module_idP,
UE_template->pre_allocated_rb_table_index_ul = rb_table_index;
UE_template->pre_allocated_nb_rb_ul[slice_idx] = rb_table[rb_table_index];
LOG_D(MAC, "[eNB %d] frame %d subframe %d: for UE %d CC %d: pre-assigned mcs %d, pre-allocated rb_table[%d]=%d RBs (phr %d, tx power %d)\n",
- module_idP,
- frameP,
- subframeP,
- UE_id,
+ module_idP,
+ frameP,
+ subframeP,
+ UE_id,
CC_id,
UE_template->pre_assigned_mcs_ul,
UE_template->pre_allocated_rb_table_index_ul,
@@ -1981,12 +1981,12 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params) {
return 0;
}
-void
-sort_ue_ul(module_id_t module_idP,
- int slice_idx,
- int frameP,
- sub_frame_t subframeP,
- rnti_t *rntiTable)
+void
+sort_ue_ul(module_id_t module_idP,
+ int slice_idx,
+ int frameP,
+ sub_frame_t subframeP,
+ rnti_t *rntiTable)
{
int i;
int list[MAX_MOBILES_PER_ENB];
@@ -1997,8 +1997,8 @@ sort_ue_ul(module_id_t module_idP,
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
rntiTable[i] = UE_RNTI(module_idP, i);
// Valid element and is not the actual CC_id in the list
- if (UE_list->active[i] == TRUE &&
- rntiTable[i] != NOT_A_RNTI &&
+ if (UE_list->active[i] == TRUE &&
+ rntiTable[i] != NOT_A_RNTI &&
UE_list->UE_sched_ctrl[i].ul_out_of_sync != 1 &&
ue_ul_slice_membership(module_idP, i, slice_idx)) {
list[list_size++] = i; // Add to list
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 99736939c4..b72f26780c 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -48,6 +48,7 @@
#include "platform_constants.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "msc.h"
+#include "common/ngran_types.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "UTIL/OSA/osa_defs.h"
@@ -58,6 +59,11 @@
# include "gtpv1u_eNB_task.h"
# include "gtpv1u.h"
+#include "ENB_APP/enb_config.h"
+#ifndef UETARGET
+#include "LAYER2/PROTO_AGENT/proto_agent.h"
+#endif
+
extern int otg_enabled;
extern uint8_t nfapi_mode;
#include "common/ran_context.h"
@@ -184,10 +190,22 @@ boolean_t pdcp_data_req(
sdu_buffer_sizeP);
LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP);
}
+#ifndef UETARGET
+ if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ /* currently, there is no support to send also the source/destinationL2Id */
+ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP,
+ confirmP, sdu_buffer_sizeP, pdcp_pdu_p);
+ /* assume good status */
+ rlc_status = RLC_OP_STATUS_OK;
- rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p
- ,NULL, NULL
- );
+ } else
+#endif
+ {
+ rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP,
+ confirmP, sdu_buffer_sizeP, pdcp_pdu_p
+ ,NULL, NULL
+ );
+ }
} else {
rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES;
LOG_E(PDCP,PROTOCOL_CTXT_FMT" PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n",
@@ -346,38 +364,129 @@ boolean_t pdcp_data_req(
*/
LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size,
"[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP);
- LOG_D(PDCP, "Before rlc_data_req 2, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP);
- rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p
- ,sourceL2Id
- ,destinationL2Id
+
+ if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1))
+ {
+
+#ifndef UETARGET
+ LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
+ rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
+
+ if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ /* currently, there is no support to send also the source/destinationL2Id */
+ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP,
+ confirmP, pdcp_pdu_size, pdcp_pdu_p);
+ /* assume good status */
+ rlc_status = RLC_OP_STATUS_OK;
+ ret = TRUE;
+ LOG_D(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n",
+ ctxt_pP->rnti, rb_idP, pdcp_pdu_size);
+
+ } else if (NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)){
+ LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
+ ret=FALSE;
+ } else
+#endif
+ {
+ rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP,
+ confirmP, pdcp_pdu_size, pdcp_pdu_p, sourceL2Id,
+ destinationL2Id
);
- }
+ switch (rlc_status) {
+ case RLC_OP_STATUS_OK:
+ LOG_D(PDCP, "Data sending request over RLC succeeded!\n");
+ ret=TRUE;
+ break;
- switch (rlc_status) {
- case RLC_OP_STATUS_OK:
- LOG_D(PDCP, "Data sending request over RLC succeeded!\n");
- ret=TRUE;
- break;
+ case RLC_OP_STATUS_BAD_PARAMETER:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
+ ret= FALSE;
+ break;
- case RLC_OP_STATUS_BAD_PARAMETER:
- LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
- ret= FALSE;
- break;
+ case RLC_OP_STATUS_INTERNAL_ERROR:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
+ ret= FALSE;
+ break;
- case RLC_OP_STATUS_INTERNAL_ERROR:
- LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
- ret= FALSE;
- break;
+ case RLC_OP_STATUS_OUT_OF_RESSOURCES:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
+ ret= FALSE;
+ break;
- case RLC_OP_STATUS_OUT_OF_RESSOURCES:
- LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
- ret= FALSE;
- break;
+ default:
+ LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
+ ret= FALSE;
+ break;
+ } // switch case
+ } /* end if node_type is CU */
+ }
+ else // SRB
+ {
- default:
- LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
- ret= FALSE;
- break;
+#ifndef UETARGET
+ if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ // DL transfer
+ MessageDef *message_p;
+ // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created
+ message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE);
+ F1AP_DL_RRC_MESSAGE (message_p).rrc_container = &pdcp_pdu_p->data[0] ;
+ F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = pdcp_pdu_size;
+ F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
+ F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
+ F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
+ F1AP_DL_RRC_MESSAGE (message_p).rnti = ctxt_pP->rnti;
+ F1AP_DL_RRC_MESSAGE (message_p).srb_id = rb_idP;
+ F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
+ F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
+ itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
+ //CU_send_DL_RRC_MESSAGE_TRANSFER(ctxt_pP->module_id, message_p);
+ LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
+ ret=TRUE;
+
+ } else
+#endif
+ {
+ rlc_status = rlc_data_req(ctxt_pP
+ , srb_flagP
+ , MBMS_FLAG_NO
+ , rb_idP
+ , muiP
+ , confirmP
+ , pdcp_pdu_size
+ , pdcp_pdu_p
+#ifdef Rel14
+ ,NULL
+ ,NULL
+#endif
+ );
+ switch (rlc_status) {
+ case RLC_OP_STATUS_OK:
+ LOG_D(PDCP, "Data sending request over RLC succeeded!\n");
+ ret=TRUE;
+ break;
+
+ case RLC_OP_STATUS_BAD_PARAMETER:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
+ ret= FALSE;
+ break;
+
+ case RLC_OP_STATUS_INTERNAL_ERROR:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
+ ret= FALSE;
+ break;
+
+ case RLC_OP_STATUS_OUT_OF_RESSOURCES:
+ LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
+ ret= FALSE;
+ break;
+
+ default:
+ LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
+ ret= FALSE;
+ break;
+ } // switch case
+ }
+ }
}
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
@@ -610,13 +719,13 @@ pdcp_data_ind(
}
security_ok = pdcp_validate_security(ctxt_pP,
- pdcp_p,
- srb_flagP,
- rb_idP,
- pdcp_header_len,
+ pdcp_p,
+ srb_flagP,
+ rb_idP,
+ pdcp_header_len,
rx_hfn_for_count,
pdcp_sn_for_count,
- sdu_buffer_pP->data,
+ sdu_buffer_pP->data,
sdu_buffer_sizeP - pdcp_tailer_len) == 0;
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
@@ -679,106 +788,35 @@ pdcp_data_ind(
payload_offset=pdcp_header_len;// PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE;
switch (pdcp_p->rlc_mode) {
- case RLC_MODE_AM: {
- /* process as described in 36.323 5.1.2.1.2 */
- int reordering_window;
+ case RLC_MODE_AM: {
+ /* process as described in 36.323 5.1.2.1.2 */
+ int reordering_window;
- if (pdcp_p->seq_num_size == 7)
- reordering_window = REORDERING_WINDOW_SN_7BIT;
- else
- reordering_window = REORDERING_WINDOW_SN_12BIT;
-
- if (sequence_number - pdcp_p->last_submitted_pdcp_rx_sn > reordering_window ||
- (pdcp_p->last_submitted_pdcp_rx_sn - sequence_number >= 0 &&
- pdcp_p->last_submitted_pdcp_rx_sn - sequence_number < reordering_window)) {
- /* TODO: specs say to decipher and do header decompression */
- LOG_W(PDCP,
- PROTOCOL_PDCP_CTXT_FMT"discard PDU, out of\n",
- PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
- LOG_W(PDCP, "Ignoring PDU...\n");
- free_mem_block(sdu_buffer_pP, __func__);
- /* TODO: indicate integrity verification failure to upper layer */
- return FALSE;
- } else if (pdcp_p->next_pdcp_rx_sn - sequence_number > reordering_window) {
- pdcp_p->rx_hfn++;
- rx_hfn_for_count = pdcp_p->rx_hfn;
- pdcp_sn_for_count = sequence_number;
- pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
- } else if (sequence_number - pdcp_p->next_pdcp_rx_sn >= reordering_window) {
- rx_hfn_for_count = pdcp_p->rx_hfn - 1;
- pdcp_sn_for_count = sequence_number;
- } else if (sequence_number >= pdcp_p->next_pdcp_rx_sn) {
- rx_hfn_for_count = pdcp_p->rx_hfn;
- pdcp_sn_for_count = sequence_number;
- pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
-
- if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
- pdcp_p->next_pdcp_rx_sn = 0;
- pdcp_p->rx_hfn++;
- }
- } else { /* sequence_number < pdcp_p->next_pdcp_rx_sn */
- rx_hfn_for_count = pdcp_p->rx_hfn;
- pdcp_sn_for_count = sequence_number;
- }
-
- if (pdcp_p->security_activated == 1) {
- if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
- start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
- } else {
- start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
- }
-
- security_ok = pdcp_validate_security(ctxt_pP,
- pdcp_p,
- srb_flagP,
- rb_idP,
- pdcp_header_len,
- rx_hfn_for_count,
- pdcp_sn_for_count,
- sdu_buffer_pP->data,
- sdu_buffer_sizeP - pdcp_tailer_len) == 0;
-
- if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
- stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
- } else {
- stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
- }
- } else {
- security_ok = 1;
- }
-
- if (security_ok == 0) {
- LOG_W(PDCP,
- PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/AM PDU\n",
- PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
- LOG_W(PDCP, "Ignoring PDU...\n");
- free_mem_block(sdu_buffer_pP, __func__);
- /* TODO: indicate integrity verification failure to upper layer */
- return FALSE;
- }
-
- /* TODO: specs say we have to store this PDU in a list and then deliver
- * stored packets to upper layers according to a well defined
- * procedure. The code below that deals with delivery is today
- * too complex to do this properly, so we only send the current
- * received packet. This is not correct and has to be fixed
- * some day.
- * In the meantime, let's pretend the last submitted PDCP SDU
- * is the current one.
- * TODO: we also have to deal with re-establishment PDU (control PDUs)
- * that contain no SDU.
- */
- pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
- break;
- } /* case RLC_MODE_AM */
-
- case RLC_MODE_UM:
-
- /* process as described in 36.323 5.1.2.1.3 */
- if (sequence_number < pdcp_p->next_pdcp_rx_sn) {
- pdcp_p->rx_hfn++;
- }
+ if (pdcp_p->seq_num_size == 7)
+ reordering_window = REORDERING_WINDOW_SN_7BIT;
+ else
+ reordering_window = REORDERING_WINDOW_SN_12BIT;
+ if (sequence_number - pdcp_p->last_submitted_pdcp_rx_sn > reordering_window ||
+ (pdcp_p->last_submitted_pdcp_rx_sn - sequence_number >= 0 &&
+ pdcp_p->last_submitted_pdcp_rx_sn - sequence_number < reordering_window)) {
+ /* TODO: specs say to decipher and do header decompression */
+ LOG_W(PDCP,
+ PROTOCOL_PDCP_CTXT_FMT"discard PDU, out of\n",
+ PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
+ LOG_W(PDCP, "Ignoring PDU...\n");
+ free_mem_block(sdu_buffer_pP, __func__);
+ /* TODO: indicate integrity verification failure to upper layer */
+ return FALSE;
+ } else if (pdcp_p->next_pdcp_rx_sn - sequence_number > reordering_window) {
+ pdcp_p->rx_hfn++;
+ rx_hfn_for_count = pdcp_p->rx_hfn;
+ pdcp_sn_for_count = sequence_number;
+ pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
+ } else if (sequence_number - pdcp_p->next_pdcp_rx_sn >= reordering_window) {
+ rx_hfn_for_count = pdcp_p->rx_hfn - 1;
+ pdcp_sn_for_count = sequence_number;
+ } else if (sequence_number >= pdcp_p->next_pdcp_rx_sn) {
rx_hfn_for_count = pdcp_p->rx_hfn;
pdcp_sn_for_count = sequence_number;
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
@@ -787,48 +825,119 @@ pdcp_data_ind(
pdcp_p->next_pdcp_rx_sn = 0;
pdcp_p->rx_hfn++;
}
+ } else { /* sequence_number < pdcp_p->next_pdcp_rx_sn */
+ rx_hfn_for_count = pdcp_p->rx_hfn;
+ pdcp_sn_for_count = sequence_number;
+ }
- if (pdcp_p->security_activated == 1) {
- if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
- start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
- } else {
- start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
- }
+ if (pdcp_p->security_activated == 1) {
+ if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+ start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
+ } else {
+ start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
+ }
- security_ok = pdcp_validate_security(ctxt_pP,
- pdcp_p,
- srb_flagP,
- rb_idP,
- pdcp_header_len,
- rx_hfn_for_count,
- pdcp_sn_for_count,
- sdu_buffer_pP->data,
- sdu_buffer_sizeP - pdcp_tailer_len) == 0;
+ security_ok = pdcp_validate_security(ctxt_pP,
+ pdcp_p,
+ srb_flagP,
+ rb_idP,
+ pdcp_header_len,
+ rx_hfn_for_count,
+ pdcp_sn_for_count,
+ sdu_buffer_pP->data,
+ sdu_buffer_sizeP - pdcp_tailer_len) == 0;
- if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
- stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
- } else {
- stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
- }
+ if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+ stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
+ } else {
+ stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
+ }
+ } else {
+ security_ok = 1;
+ }
+
+ if (security_ok == 0) {
+ LOG_W(PDCP,
+ PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/AM PDU\n",
+ PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
+ LOG_W(PDCP, "Ignoring PDU...\n");
+ free_mem_block(sdu_buffer_pP, __func__);
+ /* TODO: indicate integrity verification failure to upper layer */
+ return FALSE;
+ }
+
+ /* TODO: specs say we have to store this PDU in a list and then deliver
+ * stored packets to upper layers according to a well defined
+ * procedure. The code below that deals with delivery is today
+ * too complex to do this properly, so we only send the current
+ * received packet. This is not correct and has to be fixed
+ * some day.
+ * In the meantime, let's pretend the last submitted PDCP SDU
+ * is the current one.
+ * TODO: we also have to deal with re-establishment PDU (control PDUs)
+ * that contain no SDU.
+ */
+ pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
+ break;
+ } /* case RLC_MODE_AM */
+
+ case RLC_MODE_UM:
+
+ /* process as described in 36.323 5.1.2.1.3 */
+ if (sequence_number < pdcp_p->next_pdcp_rx_sn) {
+ pdcp_p->rx_hfn++;
+ }
+
+ rx_hfn_for_count = pdcp_p->rx_hfn;
+ pdcp_sn_for_count = sequence_number;
+ pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
+
+ if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
+ pdcp_p->next_pdcp_rx_sn = 0;
+ pdcp_p->rx_hfn++;
+ }
+
+ if (pdcp_p->security_activated == 1) {
+ if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+ start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
+ } else {
+ start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
+ }
+
+ security_ok = pdcp_validate_security(ctxt_pP,
+ pdcp_p,
+ srb_flagP,
+ rb_idP,
+ pdcp_header_len,
+ rx_hfn_for_count,
+ pdcp_sn_for_count,
+ sdu_buffer_pP->data,
+ sdu_buffer_sizeP - pdcp_tailer_len) == 0;
+
+ if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+ stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
} else {
- security_ok = 1;
+ stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
}
+ } else {
+ security_ok = 1;
+ }
- if (security_ok == 0) {
- LOG_W(PDCP,
- PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/UM PDU\n",
- PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
- LOG_W(PDCP, "Ignoring PDU...\n");
- free_mem_block(sdu_buffer_pP, __func__);
- /* TODO: indicate integrity verification failure to upper layer */
- return FALSE;
- }
+ if (security_ok == 0) {
+ LOG_W(PDCP,
+ PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/UM PDU\n",
+ PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
+ LOG_W(PDCP, "Ignoring PDU...\n");
+ free_mem_block(sdu_buffer_pP, __func__);
+ /* TODO: indicate integrity verification failure to upper layer */
+ return FALSE;
+ }
- break;
+ break;
- default:
- LOG_E(PDCP, "bad RLC mode, cannot happen.\n");
- exit(1);
+ default:
+ LOG_E(PDCP, "bad RLC mode, cannot happen.\n");
+ exit(1);
} /* switch (pdcp_p->rlc_mode) */
} else { /* MBMS_flagP == 0 */
payload_offset=0;
@@ -857,32 +966,37 @@ pdcp_data_ind(
*/
if (LINK_ENB_PDCP_TO_GTPV1U) {
- if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) {
- MSC_LOG_TX_MESSAGE(
- MSC_PDCP_ENB,
- MSC_GTPU_ENB,
- NULL,0,
- "0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u",
- ctxt_pP->rnti,
- rb_id + 4,
- sdu_buffer_sizeP - payload_offset);
- //LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset);
- gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
- sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX);
- AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
- memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset);
- message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ);
- AssertFatal(message_p != NULL, "OUT OF MEMORY");
- GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
- GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = sdu_buffer_sizeP - payload_offset;
- GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
- GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti;
- GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
- itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
- packet_forwarded = TRUE;
- }
+ if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) {
+ LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u\n",
+ ctxt_pP->rnti,
+ rb_id + 4,
+ sdu_buffer_sizeP - payload_offset );
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_PDCP_ENB,
+ MSC_GTPU_ENB,
+ NULL,0,
+ "0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u",
+ ctxt_pP->rnti,
+ rb_id + 4,
+ sdu_buffer_sizeP - payload_offset);
+ //LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset);
+ gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
+ sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX);
+ AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
+ memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset);
+ message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ);
+ AssertFatal(message_p != NULL, "OUT OF MEMORY");
+ GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
+ GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = sdu_buffer_sizeP - payload_offset;
+ GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
+ GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti;
+ GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
+ itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
+ packet_forwarded = TRUE;
+ }
} else {
- packet_forwarded = FALSE;
+ packet_forwarded = FALSE;
}
#ifdef MBMS_MULTICAST_OUT
@@ -921,28 +1035,28 @@ pdcp_data_ind(
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id;
if (EPC_MODE_ENABLED) {
- /* for the UE compiled in S1 mode, we need 1 here
- * for the UE compiled in noS1 mode, we need 0
- * TODO: be sure of this
- */
- if (nfapi_mode == 3) {
+ /* for the UE compiled in S1 mode, we need 1 here
+ * for the UE compiled in noS1 mode, we need 0
+ * TODO: be sure of this
+ */
+ if (nfapi_mode == 3) {
#ifdef UESIM_EXPANSION
if (UE_NAS_USE_TUN) {
((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id;
} else {
- ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 0;
+ ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 0;
}
#else
- ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id;
+ ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id;
#endif
} else { // nfapi_mode
if (UE_NAS_USE_TUN) {
((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id;
- } else {
- ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 1;
- }
+ } else {
+ ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 1;
+ }
} // nfapi_mode
}
} else {
@@ -951,9 +1065,9 @@ pdcp_data_ind(
}
if( LOG_DEBUGFLAG(DEBUG_PDCP) ) {
- static uint32_t pdcp_inst = 0;
- ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = pdcp_inst++;
- LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size);
+ static uint32_t pdcp_inst = 0;
+ ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = pdcp_inst++;
+ LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size);
}
memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)],
@@ -969,27 +1083,34 @@ pdcp_data_ind(
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
- /*
- * Update PDCP statistics
- * XXX Following two actions are identical, is there a merge error?
- */
+#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
+ /* This was an "orphan else" in tag 2019.w07 and discovered during merge.
+ * Commenting so it could be reintegrated. */
+ //else {
+ // AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n",
+ // PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
+ //}
- for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB; pdcp_uid++) {
- if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ) {
- break;
- }
- }
-
- Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
- Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
- Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
- Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
- Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
- Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
- Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
- Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
+#endif
}
+ /* Update PDCP statistics */
+ for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB;pdcp_uid++){
+ if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){
+ break;
+ }
+ }
+
+ Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+ Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+ Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
+ Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
+
+ Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
+ Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
+ Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
+ Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
+
free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) {
@@ -1051,6 +1172,8 @@ void pdcp_update_stats(const protocol_ctxt_t *const ctxt_pP) {
}
}
}
+
+
//-----------------------------------------------------------------------------
void
pdcp_run (
@@ -1173,6 +1296,41 @@ pdcp_run (
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
}
+void pdcp_init_stats_UE(module_id_t mod, uint16_t uid)
+{
+ Pdcp_stats_tx_window_ms[mod][uid] = 100;
+ Pdcp_stats_rx_window_ms[mod][uid] = 100;
+
+ for (int i = 0; i < NB_RB_MAX; ++i) {
+ Pdcp_stats_tx_bytes[mod][uid][i] = 0;
+ Pdcp_stats_tx_bytes_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_bytes_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_tx[mod][uid][i] = 0;
+ Pdcp_stats_tx_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_sn[mod][uid][i] = 0;
+ Pdcp_stats_tx_throughput_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_aiat[mod][uid][i] = 0;
+ Pdcp_stats_tx_aiat_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_aiat_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_tx_iat[mod][uid][i] = 0;
+
+ Pdcp_stats_rx[mod][uid][i] = 0;
+ Pdcp_stats_rx_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_bytes[mod][uid][i] = 0;
+ Pdcp_stats_rx_bytes_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_bytes_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_sn[mod][uid][i] = 0;
+ Pdcp_stats_rx_goodput_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_aiat[mod][uid][i] = 0;
+ Pdcp_stats_rx_aiat_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_aiat_tmp_w[mod][uid][i] = 0;
+ Pdcp_stats_rx_iat[mod][uid][i] = 0;
+ Pdcp_stats_rx_outoforder[mod][uid][i] = 0;
+ }
+}
+
void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) {
int i, ue_flag=1; //, ret=-1; to be decied later
@@ -1190,6 +1348,7 @@ void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) {
pdcp_enb[ctxt_pP->module_id].uid[i]=i;
pdcp_enb[ctxt_pP->module_id].num_ues++;
printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti);
+ pdcp_init_stats_UE(ctxt_pP->module_id, i);
// ret=1;
break;
}
@@ -2142,9 +2301,8 @@ void pdcp_layer_init(void)
memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
-
- for (i =0; i< MAX_NUM_CCs ; i ++) {
- for (j=0; j< MAX_MOBILES_PER_ENB; j++) {
+ for (i = 0; i < MAX_eNB; i++) {
+ for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
Pdcp_stats_tx_window_ms[i][j]=100;
Pdcp_stats_rx_window_ms[i][j]=100;
}
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index cf8d1a1fd6..ce62893170 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -26,7 +26,7 @@
* \version 1.0
*/
-/** @defgroup _pdcp PDCP
+/** @defgroup _pdcp PDCP
* @ingroup _oai2
* @{
*/
@@ -76,39 +76,39 @@ extern int pdcp_instance_cnt;
#define PROTOCOL_PDCP_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] "
#define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
- (pDCP_Pp->is_srb) ? "SRB" : "DRB",\
- pDCP_Pp->rb_id
+ (pDCP_Pp->is_srb) ? "SRB" : "DRB",\
+ pDCP_Pp->rb_id
int init_pdcp_thread(void);
void cleanup_pdcp_thread(void);
-uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
-uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB];
+uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
-uint32_t Pdcp_stats_rx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
-uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB];
+uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
+uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX];
void pdcp_update_perioidical_stats(const protocol_ctxt_t *const ctxt_pP);
@@ -121,12 +121,12 @@ typedef struct pdcp_enb_s {
uint16_t uid[MAX_MOBILES_PER_ENB];
rnti_t rnti[MAX_MOBILES_PER_ENB];
uint16_t num_ues;
-
+
uint64_t sfn;
frame_t frame;
sub_frame_t subframe;
-
-} pdcp_enb_t;
+
+} pdcp_enb_t;
pdcp_enb_t pdcp_enb[MAX_NUM_CCs];
@@ -151,7 +151,7 @@ typedef struct pdcp_s {
boolean_t is_ue;
boolean_t is_srb;
- /* Configured security algorithms */
+ /* Configured security algorithms */
uint8_t cipheringAlgorithm;
uint8_t integrityProtAlgorithm;
@@ -239,13 +239,13 @@ typedef struct pdcp_mbms_s {
*/
boolean_t pdcp_data_req(
protocol_ctxt_t *ctxt_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_id,
- const mui_t muiP,
- const confirm_t confirmP, \
- const sdu_size_t sdu_buffer_size,
+ const srb_flag_t srb_flagP,
+ const rb_id_t rb_id,
+ const mui_t muiP,
+ const confirm_t confirmP, \
+ const sdu_size_t sdu_buffer_size,
unsigned char *const sdu_buffer,
- const pdcp_transmission_mode_t mode
+ const pdcp_transmission_mode_t mode
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t *const sourceL2Id
,const uint32_t *const destinationL2Id
@@ -267,10 +267,10 @@ boolean_t pdcp_data_req(
*/
boolean_t pdcp_data_ind(
const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_id,
- const sdu_size_t sdu_buffer_size,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_id,
+ const sdu_size_t sdu_buffer_size,
mem_block_t *const sdu_buffer);
/*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t)
@@ -285,10 +285,10 @@ boolean_t pdcp_data_ind(
*/
void rrc_pdcp_config_req (
const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const uint32_t actionP,
- const rb_id_t rb_idP,
- const uint8_t security_modeP);
+ const srb_flag_t srb_flagP,
+ const uint32_t actionP,
+ const rb_id_t rb_idP,
+ const uint8_t security_modeP);
/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer.
@@ -306,17 +306,17 @@ void rrc_pdcp_config_req (
*/
boolean_t rrc_pdcp_config_asn1_req (
const protocol_ctxt_t *const ctxt_pP,
- LTE_SRB_ToAddModList_t *const srb2add_list,
- LTE_DRB_ToAddModList_t *const drb2add_list,
- LTE_DRB_ToReleaseList_t *const drb2release_list,
- const uint8_t security_modeP,
- uint8_t *const kRRCenc,
- uint8_t *const kRRCint,
- uint8_t *const kUPenc
+ LTE_SRB_ToAddModList_t *const srb2add_list,
+ LTE_DRB_ToAddModList_t *const drb2add_list,
+ LTE_DRB_ToReleaseList_t *const drb2release_list,
+ const uint8_t security_modeP,
+ uint8_t *const kRRCenc,
+ uint8_t *const kRRCint,
+ uint8_t *const kUPenc
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
+ ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
#endif
- ,rb_id_t *const defaultDRB
+ ,rb_id_t *const defaultDRB
);
/*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode)
@@ -341,20 +341,20 @@ boolean_t rrc_pdcp_config_asn1_req (
*/
boolean_t pdcp_config_req_asn1 (
const protocol_ctxt_t *const ctxt_pP,
- pdcp_t *const pdcp_pP,
- const srb_flag_t srb_flagP,
- const rlc_mode_t rlc_mode,
- const uint32_t action,
- const uint16_t lc_id,
- const uint16_t mch_id,
- const rb_id_t rb_id,
- const uint8_t rb_sn,
- const uint8_t rb_report,
- const uint16_t header_compression_profile,
- const uint8_t security_mode,
- uint8_t *const kRRCenc,
- uint8_t *const kRRCint,
- uint8_t *const kUPenc);
+ pdcp_t *const pdcp_pP,
+ const srb_flag_t srb_flagP,
+ const rlc_mode_t rlc_mode,
+ const uint32_t action,
+ const uint16_t lc_id,
+ const uint16_t mch_id,
+ const rb_id_t rb_id,
+ const uint8_t rb_sn,
+ const uint8_t rb_report,
+ const uint16_t header_compression_profile,
+ const uint8_t security_mode,
+ uint8_t *const kRRCenc,
+ uint8_t *const kRRCint,
+ uint8_t *const kUPenc);
/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function (for RRC) to add a new UE in PDCP module
@@ -362,9 +362,9 @@ boolean_t pdcp_config_req_asn1 (
* \return A status about the processing, OK or error code.
*/
void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP);
-
+
/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP)
-* \brief Function for RRC to remove UE from PDCP module hashtable
+* \brief Function for RRC to remove UE from PDCP module hashtable
* \param[in] ctxt_pP Running context.
* \return A status about the processing, OK or error code.
*/
@@ -449,26 +449,26 @@ struct sockaddr_in pdcp_sin;
void pdcp_pc5_socket_init(void);
typedef struct {
- rb_id_t rb_id;
- sdu_size_t data_size;
- signed int inst;
- ip_traffic_type_t traffic_type;
- uint32_t sourceL2Id;
- uint32_t destinationL2Id;
+ rb_id_t rb_id;
+ sdu_size_t data_size;
+ signed int inst;
+ ip_traffic_type_t traffic_type;
+ uint32_t sourceL2Id;
+ uint32_t destinationL2Id;
} __attribute__((__packed__)) pc5s_header_t;
//new PC5S-message
typedef struct {
- unsigned char bytes[PC5_SIGNALLING_PAYLOAD_SIZE];
+ unsigned char bytes[PC5_SIGNALLING_PAYLOAD_SIZE];
} __attribute__((__packed__)) PC5SignallingMessage ;
//example of PC5-S messages
typedef struct {
- pc5s_header_t pc5s_header;
- union {
- uint8_t status;
- PC5SignallingMessage pc5_signalling_message;
- } pc5sPrimitive;
+ pc5s_header_t pc5s_header;
+ union {
+ uint8_t status;
+ PC5SignallingMessage pc5_signalling_message;
+ } pc5sPrimitive;
} __attribute__((__packed__)) sidelink_pc5s_element;
@@ -513,33 +513,33 @@ sdu_size_t pdcp_input_sdu_size_read;
sdu_size_t pdcp_input_sdu_remaining_size_to_read;
#define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \
- ((hash_key_t)mODULE_iD | \
- (((hash_key_t)(rNTI)) << 8) | \
- (((hash_key_t)(iS_eNB)) << 24) | \
- (((hash_key_t)(rB_iD)) << 25) | \
- (((hash_key_t)(iS_sRB)) << 33) | \
- (((hash_key_t)(0x55)) << 34))
+ ((hash_key_t)mODULE_iD | \
+ (((hash_key_t)(rNTI)) << 8) | \
+ (((hash_key_t)(iS_eNB)) << 24) | \
+ (((hash_key_t)(rB_iD)) << 25) | \
+ (((hash_key_t)(iS_sRB)) << 33) | \
+ (((hash_key_t)(0x55)) << 34))
// hash key to the same PDCP as indexed by PDCP_COLL_KEY_VALUE(... rB_iD, iS_sRB=0) where rB_iD
// is the default DRB ID. The hidden code 0x55 indicates the key is indexed by (rB_iD,is_sRB)
// whereas the hidden code 0xaa indicates the key is for default DRB only
#define PDCP_COLL_KEY_DEFAULT_DRB_VALUE(mODULE_iD, rNTI, iS_eNB) \
- ((hash_key_t)mODULE_iD | \
- (((hash_key_t)(rNTI)) << 8) | \
- (((hash_key_t)(iS_eNB)) << 24) | \
- (((hash_key_t)(0xff)) << 25) | \
- (((hash_key_t)(0x00)) << 33) | \
- (((hash_key_t)(0xaa)) << 34))
+ ((hash_key_t)mODULE_iD | \
+ (((hash_key_t)(rNTI)) << 8) | \
+ (((hash_key_t)(iS_eNB)) << 24) | \
+ (((hash_key_t)(0xff)) << 25) | \
+ (((hash_key_t)(0x00)) << 33) | \
+ (((hash_key_t)(0xaa)) << 34))
// service id max val is maxServiceCount = 16 (asn1_constants.h)
#define PDCP_COLL_KEY_MBMS_VALUE(mODULE_iD, rNTI, iS_eNB, sERVICE_ID, sESSION_ID) \
- ((hash_key_t)mODULE_iD | \
- (((hash_key_t)(rNTI)) << 8) | \
- (((hash_key_t)(iS_eNB)) << 24) | \
- (((hash_key_t)(sERVICE_ID)) << 32) | \
- (((hash_key_t)(sESSION_ID)) << 37) | \
- (((hash_key_t)(0x0000000000000001)) << 63))
+ ((hash_key_t)mODULE_iD | \
+ (((hash_key_t)(rNTI)) << 8) | \
+ (((hash_key_t)(iS_eNB)) << 24) | \
+ (((hash_key_t)(sERVICE_ID)) << 32) | \
+ (((hash_key_t)(sESSION_ID)) << 37) | \
+ (((hash_key_t)(0x0000000000000001)) << 63))
extern hash_table_t *pdcp_coll_p;
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 4ac866cd66..7324a7c7ea 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -106,16 +106,16 @@ void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) {
//-----------------------------------------------------------------------------
int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
mem_block_t *sdu_p;
- int pdcp_nb_sdu_sent = 0;
+ int pdcp_nb_sdu_sent = 0;
int ret=0;
while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) {
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
- int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
+ int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
int sizeToWrite= sizeof (pdcp_data_ind_header_t) +
((pdcp_data_ind_header_t *) sdu_p->data)->data_size;
- if (rb_id == 10) { //hardcoded for PC5-Signaling
+ if (rb_id == 10) { //hardcoded for PC5-Signaling
if( LOG_DEBUGFLAG(DEBUG_PDCP) ) {
debug_pdcp_pc5s_sdu((sidelink_pc5s_element *)&(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),
"pdcp_fifo_flush_sdus received aPC5S message");
@@ -134,12 +134,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
} // PDCP_USE_NETLINK
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
- list_remove_head (&pdcp_sdu_list);
- free_mem_block (sdu_p, __func__);
+ list_remove_head (&pdcp_sdu_list);
+ free_mem_block (sdu_p, __func__);
pdcp_nb_sdu_sent ++;
- }
+ }
- return pdcp_nb_sdu_sent;
+ return pdcp_nb_sdu_sent;
}
//-----------------------------------------------------------------------------
@@ -147,24 +147,24 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
pdcp_data_req_header_t pdcp_read_header_g;
if (UE_NAS_USE_TUN || ENB_NAS_USE_TUN) {
- protocol_ctxt_t ctxt = *ctxt_pP;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
+ protocol_ctxt_t ctxt = *ctxt_pP;
+ hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
+ hashtable_rc_t h_rc;
pdcp_t *pdcp_p = NULL;
- int len;
- rb_id_t rab_id = DEFAULT_RAB_ID;
+ int len;
+ rb_id_t rab_id = DEFAULT_RAB_ID;
- do {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
+ do {
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
len = read(UE_NAS_USE_TUN?nas_sock_fd[ctxt_pP->module_id]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
- if (len<=0) continue;
+ if (len<=0) continue;
if (UE_NAS_USE_TUN) {
- key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
- h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
+ key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
+ h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
} else {
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
ctxt.enb_flag=ENB_FLAG_YES;
@@ -176,594 +176,594 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
- if (h_rc == HASH_TABLE_OK) {
- LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
- ctxt.frame, ctxt.instance, len, rab_id);
+ if (h_rc == HASH_TABLE_OK) {
+ LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
+ ctxt.frame, ctxt.instance, len, rab_id);
LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %u]\n",
- ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
- ctxt.rnti, rab_id);
- MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL, 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- ctxt.instance, rab_id, rab_id, len);
- pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
- PDCP_TRANSMISSION_MODE_DATA
- , NULL, NULL
- );
- } else {
- MSC_LOG_RX_DISCARDED_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- ctxt.instance, rab_id, rab_id, len);
- LOG_D(PDCP,
+ ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
+ ctxt.rnti, rab_id);
+ MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL, 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ ctxt.instance, rab_id, rab_id, len);
+ pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
+ PDCP_TRANSMISSION_MODE_DATA
+ , NULL, NULL
+ );
+ } else {
+ MSC_LOG_RX_DISCARDED_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ ctxt.instance, rab_id, rab_id, len);
+ LOG_D(PDCP,
"[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
- ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
- ctxt.rnti, rab_id, key);
- }
- } while (len > 0);
+ ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
+ ctxt.rnti, rab_id, key);
+ }
+ } while (len > 0);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
- return len;
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
+ return len;
} else { /* UE_NAS_USE_TUN */
if (PDCP_USE_NETLINK) {
- protocol_ctxt_t ctxt_cpy = *ctxt_pP;
- protocol_ctxt_t ctxt;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
+ protocol_ctxt_t ctxt_cpy = *ctxt_pP;
+ protocol_ctxt_t ctxt;
+ hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
+ hashtable_rc_t h_rc;
struct pdcp_netlink_element_s *data_p = NULL;
- /* avoid gcc warnings */
- (void)data_p;
- module_id_t ue_id = 0;
+ /* avoid gcc warnings */
+ (void)data_p;
+ module_id_t ue_id = 0;
pdcp_t *pdcp_p = NULL;
//TTN for D2D (PC5S)
- int prose_addr_len;
- char send_buf[BUFSIZE], receive_buf[BUFSIZE];
- //int optval;
- int bytes_received;
- sidelink_pc5s_element *sl_pc5s_msg_recv = NULL;
- sidelink_pc5s_element *sl_pc5s_msg_send = NULL;
- //uint32_t sourceL2Id;
- //uint32_t groupL2Id;
- //module_id_t module_id = 0;
- pc5s_header_t *pc5s_header;
+ int prose_addr_len;
+ char send_buf[BUFSIZE], receive_buf[BUFSIZE];
+ //int optval;
+ int bytes_received;
+ sidelink_pc5s_element *sl_pc5s_msg_recv = NULL;
+ sidelink_pc5s_element *sl_pc5s_msg_send = NULL;
+ //uint32_t sourceL2Id;
+ //uint32_t groupL2Id;
+ //module_id_t module_id = 0;
+ pc5s_header_t *pc5s_header;
static unsigned char pdcp_read_state_g =0;
- int len = 1;
- int msg_len;
- rb_id_t rab_id = 0;
- int rlc_data_req_flag = 3;
+ int len = 1;
+ int msg_len;
+ rb_id_t rab_id = 0;
+ int rlc_data_req_flag = 3;
//TTN for D2D (PC5S)
- prose_addr_len = sizeof(prose_pdcp_addr);
- // receive a message from ProSe App
- memset(receive_buf, 0, BUFSIZE);
- bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
- (struct sockaddr *) &prose_pdcp_addr, (socklen_t *)&prose_addr_len);
+ prose_addr_len = sizeof(prose_pdcp_addr);
+ // receive a message from ProSe App
+ memset(receive_buf, 0, BUFSIZE);
+ bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
+ (struct sockaddr *) &prose_pdcp_addr, (socklen_t *)&prose_addr_len);
- // if (bytes_received < 0){
- // LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
- // exit(EXIT_FAILURE);
- // }
- if (bytes_received > 0) {
- pc5s_header = calloc(1, sizeof(pc5s_header_t));
- memcpy((void *)pc5s_header, (void *)receive_buf, sizeof(pc5s_header_t));
+ // if (bytes_received < 0){
+ // LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
+ // exit(EXIT_FAILURE);
+ // }
+ if (bytes_received > 0) {
+ pc5s_header = calloc(1, sizeof(pc5s_header_t));
+ memcpy((void *)pc5s_header, (void *)receive_buf, sizeof(pc5s_header_t));
if (pc5s_header->traffic_type == TRAFFIC_PC5S_SESSION_INIT) {
- //send reply to ProSe app
- LOG_D(PDCP,"Received a request to open PDCP socket and establish a new PDCP session ... send response to ProSe App \n");
- memset(send_buf, 0, BUFSIZE);
- sl_pc5s_msg_send = calloc(1, sizeof(sidelink_pc5s_element));
- sl_pc5s_msg_send->pc5s_header.traffic_type = TRAFFIC_PC5S_SESSION_INIT;
- sl_pc5s_msg_send->pc5sPrimitive.status = 1;
- memcpy((void *)send_buf, (void *)sl_pc5s_msg_send, sizeof(sidelink_pc5s_element));
- int prose_addr_len = sizeof(prose_pdcp_addr);
- int bytes_sent = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr, prose_addr_len);
+ //send reply to ProSe app
+ LOG_D(PDCP,"Received a request to open PDCP socket and establish a new PDCP session ... send response to ProSe App \n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_pc5s_msg_send = calloc(1, sizeof(sidelink_pc5s_element));
+ sl_pc5s_msg_send->pc5s_header.traffic_type = TRAFFIC_PC5S_SESSION_INIT;
+ sl_pc5s_msg_send->pc5sPrimitive.status = 1;
+ memcpy((void *)send_buf, (void *)sl_pc5s_msg_send, sizeof(sidelink_pc5s_element));
+ int prose_addr_len = sizeof(prose_pdcp_addr);
+ int bytes_sent = sendto(pdcp_pc5_sockfd, (char *)send_buf, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr, prose_addr_len);
- if (bytes_sent < 0) {
+ if (bytes_sent < 0) {
LOG_E(PDCP, "ERROR: Failed to send to ProSe App\n");
exit(EXIT_FAILURE);
- }
- } else if (pc5s_header->traffic_type == TRAFFIC_PC5S_SIGNALLING) { //if containing PC5-S message -> send to other UE
- LOG_D(PDCP,"Received PC5-S message ... send to the other UE\n");
- LOG_D(PDCP,"Received PC5-S message, traffic_type: %d)\n", pc5s_header->traffic_type);
- LOG_D(PDCP,"Received PC5-S message, rbid: %d)\n", pc5s_header->rb_id);
- LOG_D(PDCP,"Received PC5-S message, data_size: %d)\n", pc5s_header->data_size);
- LOG_D(PDCP,"Received PC5-S message, inst: %d)\n", pc5s_header->inst);
- LOG_D(PDCP,"Received PC5-S message,sourceL2Id: 0x%08x\n)\n", pc5s_header->sourceL2Id);
- LOG_D(PDCP,"Received PC5-S message,destinationL1Id: 0x%08x\n)\n", pc5s_header->destinationL2Id);
+ }
+ } else if (pc5s_header->traffic_type == TRAFFIC_PC5S_SIGNALLING) { //if containing PC5-S message -> send to other UE
+ LOG_D(PDCP,"Received PC5-S message ... send to the other UE\n");
+ LOG_D(PDCP,"Received PC5-S message, traffic_type: %d)\n", pc5s_header->traffic_type);
+ LOG_D(PDCP,"Received PC5-S message, rbid: %d)\n", pc5s_header->rb_id);
+ LOG_D(PDCP,"Received PC5-S message, data_size: %d)\n", pc5s_header->data_size);
+ LOG_D(PDCP,"Received PC5-S message, inst: %d)\n", pc5s_header->inst);
+ LOG_D(PDCP,"Received PC5-S message,sourceL2Id: 0x%08x\n)\n", pc5s_header->sourceL2Id);
+ LOG_D(PDCP,"Received PC5-S message,destinationL1Id: 0x%08x\n)\n", pc5s_header->destinationL2Id);
#ifdef OAI_EMU
- // overwrite function input parameters, because only one netlink socket for all instances
- if (pc5s_header->inst < oai_emulation.info.nb_enb_local) {
+ // overwrite function input parameters, because only one netlink socket for all instances
+ if (pc5s_header->inst < oai_emulation.info.nb_enb_local) {
ctxt.frame = ctxt_cpy.frame;
ctxt.enb_flag = ENB_FLAG_YES;
ctxt.module_id = pc5s_header.inst + oai_emulation.info.first_enb_local;
ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pc5s_header->rb_id / LTE_maxDRB + oai_emulation.info.first_ue_local];
rab_id = pc5s_header->rb_id % LTE_maxDRB;
- } else {
+ } else {
ctxt.frame = ctxt_cpy.frame;
ctxt.enb_flag = ENB_FLAG_NO;
ctxt.module_id = pc5s_header->inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
rab_id = pc5s_header->rb_id % LTE_maxDRB;
- }
+ }
- CHECK_CTXT_ARGS(&ctxt);
- AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB);
- /*LGpdcp_read_header.inst = (pc5s_header.inst >= oai_emulation.info.nb_enb_local) ? \
- pc5s_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
- pc5s_header.inst + oai_emulation.info.first_enb_local;*/
+ CHECK_CTXT_ARGS(&ctxt);
+ AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB);
+ /*LGpdcp_read_header.inst = (pc5s_header.inst >= oai_emulation.info.nb_enb_local) ? \
+ pc5s_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
+ pc5s_header.inst + oai_emulation.info.first_enb_local;*/
#else // OAI_EMU
- /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
- // pc5s_header.inst = 0;
- //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
- ctxt.frame = ctxt_cpy.frame;
- ctxt.enb_flag = ctxt_cpy.enb_flag;
- LOG_I(PDCP, "[PDCP] pc5s_header->rb_id = %d\n", pc5s_header->rb_id);
+ /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
+ // pc5s_header.inst = 0;
+ //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
+ ctxt.frame = ctxt_cpy.frame;
+ ctxt.enb_flag = ctxt_cpy.enb_flag;
+ LOG_I(PDCP, "[PDCP] pc5s_header->rb_id = %d\n", pc5s_header->rb_id);
- if (ctxt_cpy.enb_flag) {
+ if (ctxt_cpy.enb_flag) {
ctxt.module_id = 0;
rab_id = pc5s_header->rb_id % LTE_maxDRB;
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index];
- } else {
+ } else {
ctxt.module_id = 0;
rab_id = pc5s_header->rb_id % LTE_maxDRB;
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
+ }
+
+#endif
+
+ //UE
+ if (!ctxt.enb_flag) {
+ if (rab_id != 0) {
+ if (rab_id == UE_IP_DEFAULT_RAB_ID) {
+ LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
+ ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
+ key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
+ h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
+ LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+ (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+ } else {
+ rab_id = rab_id % LTE_maxDRB;
+ LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
+ ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
+ key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
+ h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
+ LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+ (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+ }
+
+ if (h_rc == HASH_TABLE_OK) {
+ rab_id = pdcp_p->rb_id;
+ LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
+ ctxt.frame,
+ pc5s_header->inst,
+ bytes_received,
+ pc5s_header->rb_id);
+ LOG_I(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
+ ctxt.frame,
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ pc5s_header->data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ rab_id,
+ pc5s_header->data_size);
+ pdcp_data_req(
+ &ctxt,
+ SRB_FLAG_NO,
+ rab_id,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pc5s_header->data_size,
+ (unsigned char *)receive_buf,
+ PDCP_TRANSMISSION_MODE_DATA,
+ &pc5s_header->sourceL2Id,
+ &pc5s_header->destinationL2Id
+ );
+ } else {
+ MSC_LOG_RX_DISCARDED_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ rab_id,
+ pc5s_header->data_size);
+ LOG_D(PDCP,
+ "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
+ ctxt.frame,
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ pc5s_header->data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id,
+ key);
+ }
+ } else { //if (rab_id == 0)
+ LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
+ LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+ ctxt.frame,
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ pc5s_header->data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ DEFAULT_RAB_ID);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pc5s_header->inst,
+ pc5s_header->rb_id,
+ DEFAULT_RAB_ID,
+ pc5s_header->data_size);
+ pdcp_data_req (
+ &ctxt,
+ SRB_FLAG_NO,
+ DEFAULT_RAB_ID,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pc5s_header->data_size,
+ (unsigned char *)receive_buf,
+ PDCP_TRANSMISSION_MODE_DATA,
+ &pc5s_header->sourceL2Id,
+ &pc5s_header->destinationL2Id
+ );
+ }
+ }
+
+ free (sl_pc5s_msg_recv);
+ free (sl_pc5s_msg_send);
+ }
+ }
+
+ while ((len > 0) && (rlc_data_req_flag !=0)) {
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
+ len = recvmsg(nas_sock_fd[0], &nas_msg_rx, 0);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
+
+ if (len<=0) {
+ // nothing in pdcp NAS socket
+ //LOG_D(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
+ } else {
+ msg_len = len;
+
+ for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
+ NLMSG_OK (nas_nlh_rx, msg_len);
+ nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, msg_len)) {
+ if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) {
+ LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n");
+ //return;
+ }
+
+ if (nas_nlh_rx->nlmsg_type == NLMSG_ERROR) {
+ LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_ERROR\n");
+ }
+
+ if (pdcp_read_state_g == 0) {
+ if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
+ pdcp_read_state_g = 1; //get
+ memcpy((void *)&pdcp_read_header_g, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
+ LOG_D(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %u data_size %d, source L2Id 0x%08x, destination L2Id 0x%08x\n",
+ pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size,pdcp_read_header_g.sourceL2Id, pdcp_read_header_g.destinationL2Id );
+ } else {
+ LOG_E(PDCP, "[PDCP][NETLINK] WRONG size %d should be sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n",
+ nas_nlh_rx->nlmsg_len);
+ }
+ } else {
+ pdcp_read_state_g = 0;
+ // print_active_requests()
+ LOG_D(PDCP, "[PDCP][NETLINK] Something in socket, length %zu\n",
+ nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
+#ifdef OAI_EMU
+
+ // overwrite function input parameters, because only one netlink socket for all instances
+ if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
+ ctxt.frame = ctxt_cpy.frame;
+ ctxt.enb_flag = ENB_FLAG_YES;
+ ctxt.module_id = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;
+ ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / LTE_maxDRB + oai_emulation.info.first_ue_local];
+ rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
+ } else {
+ ctxt.frame = ctxt_cpy.frame;
+ ctxt.enb_flag = ENB_FLAG_NO;
+ ctxt.module_id = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
+ ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
+ rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
+ }
+
+ CHECK_CTXT_ARGS(&ctxt);
+ AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB);
+#else // OAI_EMU
+ /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
+ // pdcp_read_header_g.inst = 0;
+ //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
+ ctxt.frame = ctxt_cpy.frame;
+ ctxt.enb_flag = ctxt_cpy.enb_flag;
+ LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d, source L2Id = 0x%08x, destination L2Id = 0x%08x \n", pdcp_read_header_g.rb_id, pdcp_read_header_g.sourceL2Id,
+ pdcp_read_header_g.destinationL2Id);
+
+ if (ctxt_cpy.enb_flag) {
+ ctxt.module_id = 0;
+ rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
+ ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB];
+ } else {
+ if (nfapi_mode == 3) {
+#ifdef UESIM_EXPANSION
+ ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
+#else
+ ctxt.module_id = pdcp_read_header_g.inst;
+#endif
+ } else {
+ ctxt.module_id = 0;
+ }
+
+ rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
+ ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
}
#endif
- //UE
- if (!ctxt.enb_flag) {
+ if (ctxt.enb_flag) {
if (rab_id != 0) {
- if (rab_id == UE_IP_DEFAULT_RAB_ID) {
- LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
- ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
- key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
- h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
- LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
- (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
- } else {
- rab_id = rab_id % LTE_maxDRB;
- LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
- ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
- key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
- h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
- LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
- (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
- }
-
- if (h_rc == HASH_TABLE_OK) {
- rab_id = pdcp_p->rb_id;
- LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
- ctxt.frame,
- pc5s_header->inst,
- bytes_received,
- pc5s_header->rb_id);
- LOG_I(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
- ctxt.frame,
- pc5s_header->inst,
- pc5s_header->rb_id,
- pc5s_header->data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id);
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pc5s_header->inst,
- pc5s_header->rb_id,
- rab_id,
- pc5s_header->data_size);
- pdcp_data_req(
- &ctxt,
- SRB_FLAG_NO,
- rab_id,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pc5s_header->data_size,
- (unsigned char *)receive_buf,
- PDCP_TRANSMISSION_MODE_DATA,
- &pc5s_header->sourceL2Id,
- &pc5s_header->destinationL2Id
- );
- } else {
- MSC_LOG_RX_DISCARDED_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pc5s_header->inst,
- pc5s_header->rb_id,
- rab_id,
- pc5s_header->data_size);
- LOG_D(PDCP,
- "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
- ctxt.frame,
- pc5s_header->inst,
- pc5s_header->rb_id,
- pc5s_header->data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id,
- key);
- }
- } else { //if (rab_id == 0)
- LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
- LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
- ctxt.frame,
- pc5s_header->inst,
- pc5s_header->rb_id,
- pc5s_header->data_size,
- ctxt.module_id,
- ctxt.rnti,
- DEFAULT_RAB_ID);
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pc5s_header->inst,
- pc5s_header->rb_id,
- DEFAULT_RAB_ID,
- pc5s_header->data_size);
- pdcp_data_req (
- &ctxt,
- SRB_FLAG_NO,
- DEFAULT_RAB_ID,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pc5s_header->data_size,
- (unsigned char *)receive_buf,
- PDCP_TRANSMISSION_MODE_DATA,
- &pc5s_header->sourceL2Id,
- &pc5s_header->destinationL2Id
- );
- }
- }
-
- free (sl_pc5s_msg_recv);
- free (sl_pc5s_msg_send);
- }
- }
-
- while ((len > 0) && (rlc_data_req_flag !=0)) {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
- len = recvmsg(nas_sock_fd[0], &nas_msg_rx, 0);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
-
- if (len<=0) {
- // nothing in pdcp NAS socket
- //LOG_D(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
- } else {
- msg_len = len;
-
- for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
- NLMSG_OK (nas_nlh_rx, msg_len);
- nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, msg_len)) {
- if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) {
- LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n");
- //return;
- }
-
- if (nas_nlh_rx->nlmsg_type == NLMSG_ERROR) {
- LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_ERROR\n");
- }
-
- if (pdcp_read_state_g == 0) {
- if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
- pdcp_read_state_g = 1; //get
- memcpy((void *)&pdcp_read_header_g, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
- LOG_D(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %u data_size %d, source L2Id 0x%08x, destination L2Id 0x%08x\n",
- pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size,pdcp_read_header_g.sourceL2Id, pdcp_read_header_g.destinationL2Id );
- } else {
- LOG_E(PDCP, "[PDCP][NETLINK] WRONG size %d should be sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n",
- nas_nlh_rx->nlmsg_len);
- }
- } else {
- pdcp_read_state_g = 0;
- // print_active_requests()
- LOG_D(PDCP, "[PDCP][NETLINK] Something in socket, length %zu\n",
- nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
-#ifdef OAI_EMU
-
- // overwrite function input parameters, because only one netlink socket for all instances
- if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
- ctxt.frame = ctxt_cpy.frame;
- ctxt.enb_flag = ENB_FLAG_YES;
- ctxt.module_id = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;
- ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / LTE_maxDRB + oai_emulation.info.first_ue_local];
- rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
- } else {
- ctxt.frame = ctxt_cpy.frame;
- ctxt.enb_flag = ENB_FLAG_NO;
- ctxt.module_id = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
- ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
- rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
- }
-
- CHECK_CTXT_ARGS(&ctxt);
- AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB);
-#else // OAI_EMU
- /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
- // pdcp_read_header_g.inst = 0;
- //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
- ctxt.frame = ctxt_cpy.frame;
- ctxt.enb_flag = ctxt_cpy.enb_flag;
- LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d, source L2Id = 0x%08x, destination L2Id = 0x%08x \n", pdcp_read_header_g.rb_id, pdcp_read_header_g.sourceL2Id,
- pdcp_read_header_g.destinationL2Id);
-
- if (ctxt_cpy.enb_flag) {
- ctxt.module_id = 0;
- rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
- ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB];
- } else {
- if (nfapi_mode == 3) {
-#ifdef UESIM_EXPANSION
- ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
-#else
- ctxt.module_id = pdcp_read_header_g.inst;
-#endif
- } else {
- ctxt.module_id = 0;
- }
-
- rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
- ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
- }
-
-#endif
-
- if (ctxt.enb_flag) {
- if (rab_id != 0) {
- rab_id = rab_id % LTE_maxDRB;
- key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
+ rab_id = rab_id % LTE_maxDRB;
+ key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
- if (h_rc == HASH_TABLE_OK) {
- LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- len,
- nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
- pdcp_read_header_g.rb_id);
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- rab_id,
- pdcp_read_header_g.data_size);
- LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %u][RB %u]\n",
- ctxt_cpy.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id);
- pdcp_data_req(&ctxt,
- SRB_FLAG_NO,
- rab_id,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
- PDCP_TRANSMISSION_MODE_DATA
- ,NULL, NULL
- );
- } else {
- LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE, DROPPED\n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id);
+ if (h_rc == HASH_TABLE_OK) {
+ LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ len,
+ nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
+ pdcp_read_header_g.rb_id);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ rab_id,
+ pdcp_read_header_g.data_size);
+ LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %u][RB %u]\n",
+ ctxt_cpy.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id);
+ pdcp_data_req(&ctxt,
+ SRB_FLAG_NO,
+ rab_id,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ PDCP_TRANSMISSION_MODE_DATA
+ ,NULL, NULL
+ );
+ } else {
+ LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE, DROPPED\n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id);
+ }
+ } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast
+ // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
+ //#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
+ for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) {
+ if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) {
+ ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id];
+ LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ DEFAULT_RAB_ID);
+ pdcp_data_req (
+ &ctxt,
+ SRB_FLAG_NO,
+ DEFAULT_RAB_ID,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ PDCP_TRANSMISSION_MODE_DATA
+ ,NULL, NULL
+ );
+ }
+ }
}
- } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast
- // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
- //#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
- for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) {
- if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) {
- ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id];
- LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- DEFAULT_RAB_ID);
- pdcp_data_req (
- &ctxt,
- SRB_FLAG_NO,
- DEFAULT_RAB_ID,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
- PDCP_TRANSMISSION_MODE_DATA
- ,NULL, NULL
- );
- }
- }
- }
- } else { // enb_flag
- if (rab_id != 0) {
- if (rab_id == UE_IP_DEFAULT_RAB_ID) {
- LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
- ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
- key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
+ } else { // enb_flag
+ if (rab_id != 0) {
+ if (rab_id == UE_IP_DEFAULT_RAB_ID) {
+ LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
+ ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
+ key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
- LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
- (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
- } else {
- rab_id = rab_id % LTE_maxDRB;
- LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
- ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
- key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
+ LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+ (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+ } else {
+ rab_id = rab_id % LTE_maxDRB;
+ LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
+ ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
+ key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
- LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
- (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
- }
+ LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+ (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+ }
- if (h_rc == HASH_TABLE_OK) {
- rab_id = pdcp_p->rb_id;
- LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- len,
- nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
- pdcp_read_header_g.rb_id);
- LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id);
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- rab_id,
- pdcp_read_header_g.data_size);
+ if (h_rc == HASH_TABLE_OK) {
+ rab_id = pdcp_p->rb_id;
+ LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ len,
+ nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
+ pdcp_read_header_g.rb_id);
+ LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ rab_id,
+ pdcp_read_header_g.data_size);
if(nfapi_mode == 3) {
- pdcp_data_req(
- &ctxt,
- SRB_FLAG_NO,
- rab_id,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ pdcp_data_req(
+ &ctxt,
+ SRB_FLAG_NO,
+ rab_id,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
NULL,
NULL
- );
+ );
} else {
- pdcp_data_req(
- &ctxt,
- SRB_FLAG_NO,
- rab_id,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ pdcp_data_req(
+ &ctxt,
+ SRB_FLAG_NO,
+ rab_id,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
&pdcp_read_header_g.sourceL2Id,
&pdcp_read_header_g.destinationL2Id
- );
- }
- } else {
- MSC_LOG_RX_DISCARDED_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,
- 0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- rab_id,
- pdcp_read_header_g.data_size);
- LOG_D(PDCP,
- "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- rab_id,
- key);
- }
- } else {
- LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
- LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
- ctxt.frame,
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- pdcp_read_header_g.data_size,
- ctxt.module_id,
- ctxt.rnti,
- DEFAULT_RAB_ID);
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
- NULL,0,
- MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- pdcp_read_header_g.inst,
- pdcp_read_header_g.rb_id,
- DEFAULT_RAB_ID,
- pdcp_read_header_g.data_size);
+ );
+ }
+ } else {
+ MSC_LOG_RX_DISCARDED_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,
+ 0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ rab_id,
+ pdcp_read_header_g.data_size);
+ LOG_D(PDCP,
+ "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ rab_id,
+ key);
+ }
+ } else {
+ LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
+ LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+ ctxt.frame,
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ pdcp_read_header_g.data_size,
+ ctxt.module_id,
+ ctxt.rnti,
+ DEFAULT_RAB_ID);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
+ NULL,0,
+ MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ pdcp_read_header_g.inst,
+ pdcp_read_header_g.rb_id,
+ DEFAULT_RAB_ID,
+ pdcp_read_header_g.data_size);
if(nfapi_mode == 3) {
- pdcp_data_req (
- &ctxt,
- SRB_FLAG_NO,
- DEFAULT_RAB_ID,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ pdcp_data_req (
+ &ctxt,
+ SRB_FLAG_NO,
+ DEFAULT_RAB_ID,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
NULL,
NULL
- );
+ );
} else {
- pdcp_data_req (
- &ctxt,
- SRB_FLAG_NO,
- DEFAULT_RAB_ID,
- RLC_MUI_UNDEFINED,
- RLC_SDU_CONFIRM_NO,
- pdcp_read_header_g.data_size,
- (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+ pdcp_data_req (
+ &ctxt,
+ SRB_FLAG_NO,
+ DEFAULT_RAB_ID,
+ RLC_MUI_UNDEFINED,
+ RLC_SDU_CONFIRM_NO,
+ pdcp_read_header_g.data_size,
+ (unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
&pdcp_read_header_g.sourceL2Id,
&pdcp_read_header_g.destinationL2Id
- );
+ );
+ }
}
- }
- }
+ }
}
- }
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
+ }
}
- return len;
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
+ }
+
+ return len;
} else { /* PDCP_USE_NETLINK */
- return 0;
+ return 0;
} // else PDCP_USE_NETLINK
} /* #else UE_NAS_USE_TUN */
}
@@ -790,36 +790,37 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const ctxt_pP)
}
}
+
//TTN for D2D (PC5S)
void
pdcp_pc5_socket_init() {
- //pthread_attr_t attr;
- //struct sched_param sched_param;
- int optval; // flag value for setsockopt
- //int n; // message byte size
- //create PDCP socket
- pdcp_pc5_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ //pthread_attr_t attr;
+ //struct sched_param sched_param;
+ int optval; // flag value for setsockopt
+ //int n; // message byte size
+ //create PDCP socket
+ pdcp_pc5_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (pdcp_pc5_sockfd < 0) {
- LOG_E(PDCP,"[pdcp_pc5_socket_init] Error opening socket %d (%d:%s)\n",pdcp_pc5_sockfd,errno, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ LOG_E(PDCP,"[pdcp_pc5_socket_init] Error opening socket %d (%d:%s)\n",pdcp_pc5_sockfd,errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
- optval = 1;
- setsockopt(pdcp_pc5_sockfd, SOL_SOCKET, SO_REUSEADDR,
+ optval = 1;
+ setsockopt(pdcp_pc5_sockfd, SOL_SOCKET, SO_REUSEADDR,
(const void *)&optval, sizeof(int));
- fcntl(pdcp_pc5_sockfd,F_SETFL,O_NONBLOCK);
- bzero((char *) &pdcp_sin, sizeof(pdcp_sin));
- pdcp_sin.sin_family = AF_INET;
- pdcp_sin.sin_addr.s_addr = htonl(INADDR_ANY);
- pdcp_sin.sin_port = htons(PDCP_SOCKET_PORT_NO);
+ fcntl(pdcp_pc5_sockfd,F_SETFL,O_NONBLOCK);
+ bzero((char *) &pdcp_sin, sizeof(pdcp_sin));
+ pdcp_sin.sin_family = AF_INET;
+ pdcp_sin.sin_addr.s_addr = htonl(INADDR_ANY);
+ pdcp_sin.sin_port = htons(PDCP_SOCKET_PORT_NO);
- // associate the parent socket with a port
- if (bind(pdcp_pc5_sockfd, (struct sockaddr *) &pdcp_sin,
- sizeof(pdcp_sin)) < 0) {
- LOG_E(PDCP,"[pdcp_pc5_socket_init] ERROR: Failed on binding the socket\n");
- exit(1);
- }
+ // associate the parent socket with a port
+ if (bind(pdcp_pc5_sockfd, (struct sockaddr *) &pdcp_sin,
+ sizeof(pdcp_sin)) < 0) {
+ LOG_E(PDCP,"[pdcp_pc5_socket_init] ERROR: Failed on binding the socket\n");
+ exit(1);
+ }
}
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
index 1528373e98..a18713fbb6 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
@@ -228,8 +228,8 @@ pdcp_validate_security(
" Security: failed MAC-I Algo %X UE %"PRIx16" ",
pdcp_pP->integrityProtAlgorithm,
ctxt_pP->rnti);
- LOG_E(PDCP, "[OSA][RB %d] %s failed to validate MAC-I of incoming PDU\n",
- rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB");
+ LOG_E(PDCP, "[OSA][RB %d] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
+ rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return -1;
}
diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c
new file mode 100644
index 0000000000..78467d68f0
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c
@@ -0,0 +1,177 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ENB_APP/enb_paramdef.h"
+#include "LAYER2/PROTO_AGENT/proto_agent.h"
+#define BUF_MAX 1400
+
+int recv_client = 0;
+FILE *output;
+
+void usage(char *prg_name)
+{
+ fprintf(stderr, "usage: %s \n", prg_name);
+ fprintf(stderr, " - is stdin\n");
+ fprintf(stderr, " received packets are written to stdout\n");
+}
+
+long uelapsed(struct timeval *s, struct timeval *e)
+{
+ return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec);
+}
+
+boolean_t
+pdcp_data_ind(
+ const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP,
+ const sdu_size_t sdu_buffer_sizeP,
+ mem_block_t* const sdu_buffer_pP
+)
+{
+ fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout);
+ fflush(stdout);
+ free_mem_block(sdu_buffer_pP, __func__);
+ /* cannot free because of const */
+ //free(ctxt_pP);
+ recv_client = 1;
+ return 0;
+}
+
+void close_proto_agent(void)
+{
+ proto_agent_stop(0);
+}
+
+int main(int argc, char *argv[])
+{
+ const cudu_params_t params = {
+ .local_ipv4_address = "192.168.12.45",
+ .local_port = 6464,
+ .remote_ipv4_address = "192.168.12.45",
+ .remote_port = 6465
+ };
+
+ protocol_ctxt_t p;
+ memset(&p, 0, sizeof p);
+ mem_block_t mem;
+ char s[BUF_MAX];
+ size_t size, totsize = 0;
+ struct timeval t_start, t_end;
+ FILE *f;
+
+ if (argc != 2) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ if (strcmp(argv[1], "-") == 0) {
+ f = stdin;
+ } else {
+ f = fopen(argv[1], "r");
+ }
+ if (!f) {
+ fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
+ return 2;
+ }
+
+ pool_buffer_init();
+ if (proto_agent_start(0, ¶ms) != 0) {
+ fprintf(stderr, "error on proto_agent_start()\n");
+ fclose(f);
+ return 3;
+ }
+ atexit(close_proto_agent);
+
+ /* wait for first packet of client */
+ while (!recv_client) sleep(1);
+ fprintf(stderr, "reading file\n");
+
+ /* now send back at the same time */
+ gettimeofday(&t_start, NULL);
+ while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
+ usleep(10);
+ totsize += size;
+ mem.data = &s[0];
+ proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem);
+ }
+ gettimeofday(&t_end, NULL);
+ fclose(f);
+ long us = uelapsed(&t_start, &t_end);
+ fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n",
+ totsize, us / 1000, ((float) totsize ) / us,
+ ((float) totsize) / us * 8);
+ fprintf(stderr, "check files using 'diff afile bfile'\n");
+
+ /* give some time in case the other direction is slower */
+ sleep(5);
+ return 0;
+}
+
+/*
+ *********************************************************
+ * arbitrary functions, needed for linking (used or not) *
+ *********************************************************
+ */
+
+rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP,
+ const mui_t muiP,
+ confirm_t confirmP,
+ sdu_size_t sdu_sizeP,
+ mem_block_t *sdu_pP
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,const uint32_t * const sourceL2Id
+ ,const uint32_t * const destinationL2Id
+#endif
+ )
+{
+ fprintf(stderr, "This should never be called on the CU\n");
+ exit(1);
+}
+
+pthread_t new_thread(void *(*f)(void *), void *b) {
+ pthread_t t;
+ pthread_attr_t att;
+
+ if (pthread_attr_init(&att)){
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+ if (pthread_create(&t, &att, f, b)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
+
+ return t;
+}
+
+int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format)
+{
+ return 0;
+}
+
+int config_get(paramdef_t *params,int numparams, char *prefix)
+{
+ return 0;
+}
+
+int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
+{
+ return 0;
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c
new file mode 100644
index 0000000000..9ff7662ab1
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/du_test.c
@@ -0,0 +1,169 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ENB_APP/enb_paramdef.h"
+#include "LAYER2/PROTO_AGENT/proto_agent.h"
+
+#define BUF_MAX 1400
+
+void usage(char *prg_name)
+{
+ fprintf(stderr, "usage: %s \n", prg_name);
+ fprintf(stderr, " - is stdin\n");
+ fprintf(stderr, " received packets are written to stdout\n");
+}
+
+long uelapsed(struct timeval *s, struct timeval *e)
+{
+ return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec);
+}
+
+
+rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP,
+ const mui_t muiP,
+ confirm_t confirmP,
+ sdu_size_t sdu_sizeP,
+ mem_block_t *sdu_pP
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,const uint32_t * const sourceL2Id
+ ,const uint32_t * const destinationL2Id
+#endif
+ )
+{
+ fwrite(sdu_pP->data, sdu_sizeP, 1, stdout);
+ fflush(stdout);
+ free_mem_block(sdu_pP, __func__);
+ //free(ctxt_pP);
+ return 0;
+}
+
+void close_proto_agent(void)
+{
+ proto_agent_stop(0);
+}
+
+int main(int argc, char *argv[])
+{
+ const cudu_params_t params = {
+ .local_ipv4_address = "192.168.12.45",
+ .local_port = 6465,
+ .remote_ipv4_address = "192.168.12.45",
+ .remote_port = 6464
+ };
+
+ protocol_ctxt_t p;
+ memset(&p, 0, sizeof p);
+ mem_block_t mem;
+ char s[BUF_MAX];
+ size_t size, totsize = 0;
+ struct timeval t_start, t_end;
+ FILE *f;
+
+ if (argc != 2) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ if (strcmp(argv[1], "-") == 0) {
+ f = stdin;
+ } else {
+ f = fopen(argv[1], "r");
+ }
+ if (!f) {
+ fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
+ return 2;
+ }
+
+ pool_buffer_init();
+ if (proto_agent_start(0, ¶ms) != 0) {
+ fprintf(stderr, "error on proto_agent_start()\n");
+ fclose(f);
+ return 3;
+ }
+ atexit(close_proto_agent);
+
+ gettimeofday(&t_start, NULL);
+ while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
+ usleep(10);
+ totsize += size;
+ mem.data = &s[0];
+ proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem);
+ }
+ gettimeofday(&t_end, NULL);
+ fclose(f);
+ long us = uelapsed(&t_start, &t_end);
+ fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n",
+ totsize, us / 1000, ((float) totsize ) / us,
+ ((float) totsize) / us * 8);
+ fprintf(stderr, "check files using 'diff afile bfile'\n");
+
+ /* wait, we are possibly receiving data */
+ sleep(5);
+ return 0;
+}
+
+/*
+ *********************************************************
+ * arbitrary functions, needed for linking (used or not) *
+ *********************************************************
+ */
+
+boolean_t
+pdcp_data_ind(
+ const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP,
+ const sdu_size_t sdu_buffer_sizeP,
+ mem_block_t* const sdu_buffer_pP
+)
+{
+ fprintf(stderr, "This should never be called on the DU\n");
+ exit(1);
+}
+
+pthread_t new_thread(void *(*f)(void *), void *b) {
+ pthread_t t;
+ pthread_attr_t att;
+
+ if (pthread_attr_init(&att)){
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+ if (pthread_create(&t, &att, f, b)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
+
+ return t;
+}
+
+int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format)
+{
+ return 0;
+}
+
+int config_get(paramdef_t *params,int numparams, char *prefix)
+{
+ return 0;
+}
+
+int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
+{
+ return 0;
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c
new file mode 100644
index 0000000000..4b2c0218ea
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent.h
+ * \brief top level enb agent receive thread and itti task
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+#define _GNU_SOURCE
+#include "proto_agent_common.h"
+#include "common/utils/LOG/log.h"
+#include "proto_agent.h"
+#include "assertions.h"
+#include "proto_agent_net_comm.h"
+#include "proto_agent_async.h"
+
+#include
+
+#define ENB_AGENT_MAX 9
+
+proto_agent_instance_t proto_agent[MAX_DU];
+
+pthread_t new_thread(void *(*f)(void *), void *b);
+
+Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args);
+
+#define TEST_MOD 0
+
+#define ECHO
+
+/* Server side function; upon a new connection
+ reception, sends the hello packets
+*/
+int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p)
+{
+ int channel_id;
+
+ // RS: CUDU does not work!
+ //DevAssert(p->local_interface);
+ //DevAssert(p->local_ipv4_address);
+ //DevAssert(p->local_port > 1024); // "unprivileged" port
+ //DevAssert(p->remote_ipv4_address);
+ //DevAssert(p->remote_port > 1024); // "unprivileged" port
+
+ proto_agent[mod_id].mod_id = mod_id;
+ proto_agent[mod_id].exit = 0;
+
+ /* Initialize the channel container */
+
+ /* TODO only initialize the first time */
+ proto_agent_init_channel_container();
+
+ /*Create the async channel info*/
+ proto_agent_async_channel_t *channel_info;
+ channel_info = proto_agent_async_channel_info(mod_id, p->local_ipv4_address, p->local_port,
+ p->remote_ipv4_address, p->remote_port);
+ if (!channel_info) goto error;
+
+ /* Create a channel using the async channel info */
+ channel_id = proto_agent_create_channel((void *) channel_info,
+ proto_agent_async_msg_send,
+ proto_agent_async_msg_recv,
+ proto_agent_async_release);
+ if (channel_id <= 0) goto error;
+
+ proto_agent_channel_t *channel = proto_agent_get_channel(channel_id);
+ if (!channel) goto error;
+ proto_agent[mod_id].channel = channel;
+
+ /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */
+ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX);
+
+ // Code for sending the HELLO/ECHO_REQ message once a connection is established
+ //uint8_t *msg = NULL;
+ //Protocol__FlexsplitMessage *init_msg=NULL;
+
+ //if (udp == 0)
+ //{
+ // // If the comm is not UDP, allow the server to send the first packet over the channel
+ // //printf( "Proto agent Server: Calling the echo_request packet constructor\n");
+ // msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg);
+ // if (msg_flag != 0)
+ // goto error;
+ //
+ // int msgsize = 0;
+ // if (init_msg != NULL)
+ // msg = proto_agent_pack_message(init_msg, &msgsize);
+
+ // if (msg!= NULL)
+ // {
+ // LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n");
+ // proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info);
+ // }
+ // /* After sending the message, wait for any replies;
+ // the server thread blocks until it reads any data
+ // over the channel
+ // */
+
+ //}
+
+ proto_agent[mod_id].recv_thread = new_thread(proto_agent_receive, &proto_agent[mod_id]);
+
+ fprintf(stderr, "[PROTO_AGENT] server started at port %s:%d\n", p->local_ipv4_address, p->local_port);
+ return 0;
+
+error:
+ LOG_E(PROTO_AGENT, "there was an error\n");
+ return 1;
+
+}
+
+void proto_agent_stop(mod_id_t mod_id)
+{
+ if (!proto_agent[mod_id].channel) return;
+ /* unlock the independent read thread proto_agent_receive() */
+ proto_agent[mod_id].exit = 1;
+ proto_agent_async_msg_recv_unlock(proto_agent[mod_id].channel->channel_info);
+ proto_agent_async_release(proto_agent[mod_id].channel);
+ proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id);
+ free(proto_agent[mod_id].channel);
+ proto_agent[mod_id].channel = NULL;
+ LOG_W(PROTO_AGENT, "server stopped\n");
+}
+
+//void
+//proto_agent_send_hello(void)
+//{
+// uint8_t *msg = NULL;
+// Protocol__FlexsplitMessage *init_msg=NULL;
+// int msg_flag = 0;
+//
+//
+// //printf( "PDCP agent: Calling the HELLO packet constructor\n");
+// msg_flag = proto_agent_hello(proto_agent[TEST_MOD].mod_id, NULL, &init_msg);
+//
+// int msgsize = 0;
+// if (msg_flag == 0)
+// {
+// proto_agent_serialize_message(init_msg, &msg, &msgsize);
+// }
+//
+// LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n");
+// proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]);
+//}
+
+
+void
+proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP, const mui_t muiP,
+ confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP)
+{
+ uint8_t *msg = NULL;
+ Protocol__FlexsplitMessage *init_msg=NULL;
+ int msg_flag = 0;
+ int msgsize = 0;
+ mod_id_t mod_id = ctxt_pP->module_id;
+ data_req_args args;
+
+ DevAssert(proto_agent[mod_id].channel);
+ DevAssert(proto_agent[mod_id].channel->channel_info);
+
+ args.ctxt = ctxt_pP;
+ args.srb_flag = srb_flagP;
+ args.MBMS_flag = MBMS_flagP;
+ args.rb_id = rb_idP;
+ args.mui = muiP;
+ args.confirm = confirmP;
+ args.sdu_size = sdu_sizeP;
+ args.sdu_p = sdu_pP;
+
+ msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) &args, &init_msg);
+ if (msg_flag != 0 || !init_msg) goto error;
+
+ msg = proto_agent_pack_message(init_msg, &msgsize);
+ if (!msg) goto error;
+
+ proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info);
+
+ free_mem_block(sdu_pP, __func__);
+
+ return;
+error:
+ LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n");
+ return;
+
+}
+
+
+void
+proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP)
+{
+ uint8_t *msg = NULL;
+ Protocol__FlexsplitMessage *init_msg = NULL;
+ int msg_flag = 0;
+ int msgsize = 0;
+ mod_id_t mod_id = ctxt_pP->module_id;
+ data_req_args args;
+
+ DevAssert(proto_agent[mod_id].channel);
+ DevAssert(proto_agent[mod_id].channel->channel_info);
+
+ args.ctxt = ctxt_pP;
+ args.srb_flag = srb_flagP;
+ args.MBMS_flag = MBMS_flagP;
+ args.rb_id = rb_idP;
+ args.sdu_size = sdu_sizeP;
+ args.sdu_p = sdu_pP;
+
+ msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) &args, &init_msg);
+ if (msg_flag != 0 || !init_msg) goto error;
+
+ msg = proto_agent_pack_message(init_msg, &msgsize);
+ if (!msg) goto error;
+
+ proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info);
+
+ free_mem_block(sdu_pP, __func__);
+
+ return;
+
+error:
+ LOG_E(PROTO_AGENT, "there was an error in %s\n", __func__);
+ return;
+
+}
+
+void *
+proto_agent_receive(void *args)
+{
+ proto_agent_instance_t *inst = args;
+ void *data = NULL;
+ int size;
+ int priority;
+ err_code_t err_code;
+
+ pthread_setname_np(pthread_self(), "proto_rx");
+ Protocol__FlexsplitMessage *msg;
+ uint8_t *ser_msg;
+
+ while (1) {
+
+ msg = NULL;
+ ser_msg = NULL;
+
+ if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) < 0){
+ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
+ goto error;
+ }
+ if (inst->exit) break;
+
+ LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority);
+
+ msg = proto_agent_handle_message(inst->mod_id, data, size);
+ if (!msg) {
+ LOG_D(PROTO_AGENT, "msg to send back is NULL\n");
+ continue;
+ }
+
+ ser_msg = proto_agent_pack_message(msg, &size);
+ if (!ser_msg) {
+ continue;
+ }
+
+ LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n");
+ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){
+ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
+ goto error;
+ }
+ LOG_D(PROTO_AGENT, "sent message with size %d\n", size);
+
+ }
+
+ return NULL;
+
+error:
+ LOG_E(PROTO_AGENT, "proto_agent_receive(): error %d occured\n",err_code);
+ return NULL;
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h
new file mode 100644
index 0000000000..0c5cd3fa8d
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h
@@ -0,0 +1,58 @@
+
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file proto_agent.h
+ * \brief top level protocol agent
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+#ifndef PROTO_AGENT_H_
+#define PROTO_AGENT_H_
+#include "ENB_APP/enb_config.h" // for enb properties
+#include "proto_agent_common.h"
+
+
+void * proto_agent_receive(void *args);
+
+int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p);
+void proto_agent_stop(mod_id_t mod_id);
+
+void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP,
+ sdu_size_t sdu_sizeP, mem_block_t *sdu_pP);
+
+void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP,
+ const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP);
+
+#endif
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
new file mode 100644
index 0000000000..eef697c5bb
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+
+#include "proto_agent_async.h"
+#include "proto_agent_defs.h"
+
+
+#include "common/utils/LOG/log.h"
+
+proto_agent_async_channel_t *
+proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port,
+ const char* peer_ip, uint16_t peer_port)
+{
+ proto_agent_async_channel_t *channel;
+ channel = malloc(sizeof(proto_agent_async_channel_t));
+
+ if (channel == NULL)
+ goto error;
+
+ channel->enb_id = mod_id;
+ channel->link = new_link_udp_server(bind_ip, bind_port);
+
+ if (channel->link == NULL) goto error;
+
+ channel->send_queue = new_message_queue();
+ if (channel->send_queue == NULL) goto error;
+ channel->receive_queue = new_message_queue();
+ if (channel->receive_queue == NULL) goto error;
+
+ channel->manager = create_link_manager(channel->send_queue,
+ channel->receive_queue,
+ channel->link);
+ /* manually set remote IP&port for UDP server remote end */
+ channel->manager->peer_port = peer_port;
+ channel->manager->peer_addr = peer_ip;
+
+ if (channel->manager == NULL) goto error;
+
+ return channel;
+
+ error:
+ if (channel)
+ free(channel);
+ LOG_E(PROTO_AGENT, "error creating proto_agent_async_channel_t\n");
+ return NULL;
+}
+
+int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info)
+{
+ proto_agent_async_channel_t *channel = channel_info;
+ return message_put(channel->send_queue, data, size, priority);
+}
+
+int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info)
+{
+ proto_agent_async_channel_t *channel = channel_info;
+ return message_get(channel->receive_queue, data, priority);
+}
+
+void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel) {
+ message_get_unlock(channel->receive_queue);
+}
+
+void proto_agent_async_release(proto_agent_channel_t *channel)
+{
+ proto_agent_async_channel_t *channel_info = channel->channel_info;
+
+ destroy_link_manager(channel_info->manager);
+
+ destroy_message_queue(channel_info->send_queue);
+ destroy_message_queue(channel_info->receive_queue);
+
+ close_link(channel_info->link);
+ free(channel_info);
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h
new file mode 100644
index 0000000000..27030924cd
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_async.h
+ * \brief channel implementation for async interface
+ * \author Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+#ifndef PROTO_AGENT_ASYNC_H_
+#define PROTO_AGENT_ASYNC_H_
+
+#include "proto_agent_net_comm.h"
+
+typedef struct proto_agent_async_channel_s {
+ mod_id_t enb_id;
+ socket_link_t *link;
+ message_queue_t *send_queue;
+ message_queue_t *receive_queue;
+ link_manager_t *manager;
+} proto_agent_async_channel_t;
+
+proto_agent_async_channel_t *
+proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port,
+ const char *peer_ip, uint16_t peer_port);
+
+int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info);
+
+int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info);
+
+/* unlocks a running proto_agent_async_msg_recv() */
+void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel);
+
+void proto_agent_async_release(proto_agent_channel_t *channel);
+
+
+#endif /*PROTO_AGENT_ASYNC_H_*/
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
new file mode 100644
index 0000000000..1eca32b162
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
@@ -0,0 +1,792 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file proto_agent_common.c
+ * \brief common primitives for all agents
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+#include
+#include
+#include
+
+#include "PHY/phy_extern.h"
+#include "proto_agent_common.h"
+#include "common/utils/LOG/log.h"
+
+#include "RRC/LTE/rrc_extern.h"
+#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
+#include "rrc_eNB_UE_context.h"
+
+/*
+ * message primitives
+ */
+
+// Function to fill in the dl_data header (32bits) with the appropriate fields (doing bitwise operations)
+void fill_dl_data_header(int pdu_type, int spare, int seq_no, uint32_t *header)
+{
+ uint32_t type = pdu_type;
+ uint32_t spare_ = spare;
+ uint32_t seq = seq_no;
+ type = type << 28;
+ spare_ = spare_ << 24;
+ *header = (type | spare_);
+ *header = (*header | seq);
+ return;
+}
+
+
+// Function to retrieve data from the dl_data header (32bits) (doing bitwise operations)
+void read_dl_data_header(int *pdu_type, int *spare, int *seqno, uint32_t header)
+{
+ *pdu_type = header;
+ *spare = header;
+ *seqno = header;
+ *pdu_type = *pdu_type >> 28;
+ *spare = *spare << 4;
+ *spare = *spare >> 28;
+ *seqno = *seqno << 8;
+ *seqno = *seqno >> 8;
+ return;
+}
+
+int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size)
+{
+ *size = protocol__f1u_message__get_packed_size(msg);
+
+ *buf = malloc(*size);
+ if (!(*buf))
+ goto error;
+
+ protocol__f1u_message__pack(msg, *buf);
+
+ return 0;
+
+ error:
+ LOG_E(F1U, "an error occured\n");
+ return -1;
+
+}
+
+int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg)
+{
+ *msg = protocol__f1u_message__unpack(NULL, size, data);
+ if (*msg == NULL)
+ goto error;
+
+ return 0;
+
+ error:
+ LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDataHeader **header)
+{
+ *header = malloc(sizeof(Protocol__DlDataHeader));
+ if(*header == NULL)
+ goto error;
+
+ protocol__dl_data_header__init(*header);
+ LOG_D(F1U, "Initialized the DL Data User header\n");
+
+ fill_dl_data_header(pdu_type, 0, f1u_sn, &(*header)->fields);
+ return 0;
+
+ error:
+ LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int f1u_dl_data(const void *params, Protocol__F1uMessage **msg)
+{
+ // Initialize the PDCP params
+ dl_data_args *args = (dl_data_args *)params;
+
+ Protocol__DlDataHeader *header;
+
+ if (f1u_dl_data_create_header(args->pdu_type, args->sn, &header) != 0)
+ goto error;
+
+
+ Protocol__DlUserData *dl_data = NULL;
+
+ *msg = malloc(sizeof(Protocol__DlUserData));
+
+ if(*msg == NULL)
+ goto error;
+
+
+ // FIXME: Is the following used? It seems to be overwritten by the function
+ // protocol__dl_user_data__init() anyway
+ //dl_data = *msg;
+
+ protocol__dl_user_data__init(dl_data);
+
+
+ // Copy data to the bytes structure
+ dl_data->pdu.data = malloc(args->sdu_size);
+ dl_data->pdu.len = args->sdu_size;
+ memcpy(dl_data->pdu.data, args->sdu_p, args->sdu_size);
+
+ dl_data->frame = args->frame;
+ dl_data->subframe = args->subframe;
+ dl_data->rnti = args->rnti;
+
+ dl_data->header = header;
+
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(*msg != NULL)
+ free(*msg);
+ LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size)
+{
+ *size = protocol__flexsplit_message__get_packed_size(msg);
+
+ *buf = malloc(*size);
+ if (!(*buf))
+ goto error;
+
+ protocol__flexsplit_message__pack(msg, *buf);
+
+ return 0;
+
+ error:
+ LOG_E(MAC, "an error occured\n");
+ return -1;
+}
+
+/* We assume that the buffer size is equal to the message size.
+ Should be chekced durint Tx/Rx */
+int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg)
+{
+ *msg = protocol__flexsplit_message__unpack(NULL, size, data);
+ if (*msg == NULL)
+ goto error;
+
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header)
+{
+ *header = malloc(sizeof(Protocol__FspHeader));
+ if(*header == NULL)
+ goto error;
+
+ protocol__fsp_header__init(*header);
+ LOG_D(PROTO_AGENT, "Initialized the PROTOBUF message header\n");
+ (*header)->version = FLEXSPLIT_VERSION;
+ LOG_D(PROTO_AGENT, "Set the vversion to FLEXSPLIT_VERSION\n");
+
+ (*header)->has_version = 1;
+ (*header)->type = type;
+ (*header)->has_type = 1;
+ (*header)->xid = xid;
+ (*header)->has_xid = 1;
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ return 1;
+}
+
+int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ Protocol__FspCtxt *ctxt = NULL;
+ Protocol__FspRlcPdu *pdu = NULL;
+ Protocol__FspRlcData *rlc_data = NULL;
+ Protocol__FspRlcDataReq *data_req = NULL;
+
+ // Initialize the PDCP params
+ data_req_args *args = (data_req_args *)params;
+
+ // Create the protobuf header
+ Protocol__FspHeader *header;
+ xid_t xid = mod_id;
+ LOG_D(PROTO_AGENT, "creating the data_req message\n");
+
+ if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0)
+ goto error;
+
+ /* Begin constructing the messages. They are defined as follows:
+ * 1) fspRlcPdu is storing the bytes of the packet
+ * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
+ * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
+ */
+
+ ctxt = malloc(sizeof(Protocol__FspCtxt));
+ pdu = malloc(sizeof(Protocol__FspRlcPdu));
+ rlc_data = malloc(sizeof(Protocol__FspRlcData));
+ data_req = malloc(sizeof(Protocol__FspRlcDataReq));
+
+ protocol__fsp_ctxt__init(ctxt);
+ protocol__fsp_rlc_pdu__init(pdu);
+ protocol__fsp_rlc_data__init(rlc_data);
+ protocol__fsp_rlc_data_req__init(data_req);
+
+ // Copy data to the RlcPdu structure
+ pdu->fsp_pdu_data.data = malloc(args->sdu_size);
+ pdu->fsp_pdu_data.len = args->sdu_size;
+
+ memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size);
+ pdu->has_fsp_pdu_data = 1;
+
+ // Copy data to the ctxt structure
+ ctxt->fsp_mod_id = args->ctxt->module_id;
+ ctxt->fsp_enb_flag = args->ctxt->enb_flag;
+ ctxt->fsp_instance = args->ctxt->instance;
+ ctxt->fsp_rnti = args->ctxt->rnti;
+ ctxt->fsp_frame = args->ctxt->frame;
+ ctxt->fsp_subframe = args->ctxt->subframe;
+ ctxt->fsp_enb_index = args->ctxt->eNB_index;
+
+ ctxt->has_fsp_mod_id = 1;
+ ctxt->has_fsp_enb_flag = 1;
+ ctxt->has_fsp_instance = 1;
+ ctxt->has_fsp_rnti = 1;
+ ctxt->has_fsp_frame = 1;
+ ctxt->has_fsp_subframe = 1;
+ ctxt->has_fsp_enb_index = 1;
+
+ rlc_data->fsp_ctxt = ctxt;
+ rlc_data->fsp_srb_flag = args->srb_flag;
+ rlc_data->fsp_mbms_flag = args->MBMS_flag;
+ rlc_data->fsp_rb_id = args->rb_id;
+ rlc_data->fsp_muip = args->mui;
+ rlc_data->fsp_confirm = args->confirm;
+ rlc_data->fsp_sdu_buffer_size = args->sdu_size;
+ rlc_data->fsp_pdu = pdu;
+
+ rlc_data->has_fsp_srb_flag = 1;
+ rlc_data->has_fsp_mbms_flag = 1;
+ rlc_data->has_fsp_rb_id = 1;
+ rlc_data->has_fsp_muip = 1;
+ rlc_data->has_fsp_confirm = 1;
+ rlc_data->has_fsp_sdu_buffer_size = 1;
+
+ // Up to here, everything is a signle message that is packed inside another. The final data_req
+ // will be created later, after the setting of all variables
+
+ data_req->header = header;
+ data_req->enb_id = mod_id;
+ data_req->has_enb_id = 1;
+ data_req->pdcp_data = rlc_data;
+
+ *msg = malloc(sizeof(Protocol__FlexsplitMessage));
+
+ if(*msg == NULL)
+ goto error;
+
+ protocol__flexsplit_message__init(*msg);
+
+ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG;
+ (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
+ (*msg)->has_msg_dir = 1;
+ (*msg)->data_req_msg = data_req;
+
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(pdu!=NULL)
+ free(pdu);
+ if(rlc_data!=NULL)
+ free(rlc_data);
+ if(data_req!= NULL)
+ free(data_req);
+ if(*msg != NULL)
+ free(*msg);
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
+ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG)
+ goto error;
+
+ free(msg->data_req_msg->header);
+ free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data);
+ free(msg->data_req_msg->pdcp_data->fsp_pdu);
+ free(msg->data_req_msg->pdcp_data->fsp_ctxt);
+ free(msg->data_req_msg->pdcp_data);
+ free(msg->data_req_msg);
+ free(msg);
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ rlc_op_status_t result = 0;
+ //printf("PROTO_AGENT: handling the data_req_ack message\n");
+ Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
+ Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack;
+ result = data_ack->result;
+ //printf("PROTO_AGENT: ACK RESULT IS %u\n", result);
+ ack_result = result;
+ return 0;
+
+}
+
+
+int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ rlc_op_status_t result = 0;
+
+ Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
+ Protocol__FspRlcDataReq *data_req = input->data_req_msg;
+
+ Protocol__FspCtxt *ctxt = NULL;
+ Protocol__FspRlcData *rlc_data = NULL;
+
+ rlc_data = data_req->pdcp_data;
+ ctxt = rlc_data->fsp_ctxt;
+
+ protocol_ctxt_t ctxt_pP;
+ srb_flag_t srb_flagP = 0;
+ rb_id_t rb_idP = 0;
+ mui_t muiP = 0;
+ confirm_t confirmP = 0;
+ MBMS_flag_t flag_MBMS = 0;
+ sdu_size_t pdcp_pdu_size = 0;
+ mem_block_t *pdcp_pdu_p = NULL;
+
+ // Create a new protocol context for handling the packet
+ ctxt_pP.module_id = ctxt->fsp_mod_id;
+ ctxt_pP.enb_flag = ctxt->fsp_enb_flag;
+ ctxt_pP.instance = ctxt->fsp_instance;
+ ctxt_pP.rnti = ctxt->fsp_rnti;
+ ctxt_pP.frame = ctxt->fsp_frame;
+ ctxt_pP.subframe = ctxt->fsp_subframe;
+ ctxt_pP.eNB_index = ctxt->fsp_enb_index;
+
+ srb_flagP = rlc_data->fsp_srb_flag;
+ flag_MBMS = rlc_data->fsp_mbms_flag;
+ rb_idP = rlc_data->fsp_rb_id;
+ muiP = rlc_data->fsp_muip;
+ confirmP = rlc_data->fsp_confirm;
+ pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len;
+ pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
+ if (!pdcp_pdu_p) goto error;
+ memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
+
+ result = rlc_data_req(&ctxt_pP
+ ,srb_flagP
+ ,flag_MBMS
+ ,rb_idP
+ ,muiP
+ ,confirmP
+ ,pdcp_pdu_size
+ ,pdcp_pdu_p
+ #ifdef Rel14
+ ,NULL
+ ,NULL
+ #endif
+ );
+
+ return result;
+
+ error:
+ if (pdcp_pdu_p)
+ free_mem_block(pdcp_pdu_p, __func__);
+ LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+
+}
+
+int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg)
+{
+ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG)
+ goto error;
+
+ free(msg->data_ind_msg->header);
+ free(msg->data_ind_msg->rlc_data->fsp_pdu->fsp_pdu_data.data);
+ free(msg->data_ind_msg->rlc_data->fsp_pdu);
+ free(msg->data_ind_msg->rlc_data->fsp_ctxt);
+ free(msg->data_ind_msg->rlc_data);
+ free(msg->data_ind_msg);
+ free(msg);
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ Protocol__FspCtxt *ctxt = NULL;
+ Protocol__FspRlcPdu *pdu = NULL;
+ Protocol__FspRlcData *rlc_data = NULL;
+ Protocol__FspPdcpDataInd *data_ind = NULL;
+
+ // Initialize the PDCP params
+ data_req_args *args = (data_req_args *)params;
+
+ // Create the protobuf header
+ Protocol__FspHeader *header;
+ xid_t xid = mod_id;
+ LOG_D(PROTO_AGENT, "creating the data_ind message\n");
+
+ if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0)
+ goto error;
+
+ /* Begin constructing the messages. They are defined as follows:
+ * 1) fspRlcPdu is storing the bytes of the packet
+ * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
+ * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
+ */
+
+ ctxt = malloc(sizeof(Protocol__FspCtxt));
+ pdu = malloc(sizeof(Protocol__FspRlcPdu));
+ rlc_data = malloc(sizeof(Protocol__FspRlcData));
+ data_ind = malloc(sizeof(Protocol__FspPdcpDataInd));
+
+ protocol__fsp_ctxt__init(ctxt);
+ protocol__fsp_rlc_pdu__init(pdu);
+ protocol__fsp_rlc_data__init(rlc_data);
+ protocol__fsp_pdcp_data_ind__init(data_ind);
+
+ // Copy data to the RlcPdu structure
+ pdu->fsp_pdu_data.data = malloc(args->sdu_size);
+ pdu->fsp_pdu_data.len = args->sdu_size;
+
+ memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size);
+ pdu->has_fsp_pdu_data = 1;
+
+ // Copy data to the ctxt structure
+ ctxt->fsp_mod_id = args->ctxt->module_id;
+ ctxt->fsp_enb_flag = args->ctxt->enb_flag;
+ ctxt->fsp_instance = args->ctxt->instance;
+ ctxt->fsp_rnti = args->ctxt->rnti;
+ ctxt->fsp_frame = args->ctxt->frame;
+ ctxt->fsp_subframe = args->ctxt->subframe;
+ ctxt->fsp_enb_index = args->ctxt->eNB_index;
+
+ ctxt->has_fsp_mod_id = 1;
+ ctxt->has_fsp_enb_flag = 1;
+ ctxt->has_fsp_instance = 1;
+ ctxt->has_fsp_rnti = 1;
+ ctxt->has_fsp_frame = 1;
+ ctxt->has_fsp_subframe = 1;
+ ctxt->has_fsp_enb_index = 1;
+
+ rlc_data->fsp_ctxt = ctxt;
+ rlc_data->fsp_srb_flag = args->srb_flag;
+ rlc_data->fsp_mbms_flag = args->MBMS_flag;
+ rlc_data->fsp_rb_id = args->rb_id;
+
+ rlc_data->fsp_sdu_buffer_size = args->sdu_size;
+ rlc_data->fsp_pdu = pdu;
+ rlc_data->has_fsp_srb_flag = 1;
+ rlc_data->has_fsp_mbms_flag = 1;
+ rlc_data->has_fsp_rb_id = 1;
+ rlc_data->has_fsp_sdu_buffer_size = 1;
+
+ // Up to here, everything is a signle message that is packed inside another. The final data_req
+ // will be created later, after the setting of all variables
+
+ data_ind->header = header;
+ data_ind->enb_id = mod_id;
+ data_ind->has_enb_id = 1;
+ data_ind->rlc_data = rlc_data;
+
+
+ *msg = malloc(sizeof(Protocol__FlexsplitMessage));
+
+ if(*msg == NULL)
+ goto error;
+
+ protocol__flexsplit_message__init(*msg);
+ LOG_D(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG);
+
+ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG;
+ (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
+ (*msg)->has_msg_dir = 1;
+ (*msg)->data_ind_msg = data_ind; //data_req;
+
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(pdu!=NULL)
+ free(pdu);
+ if(rlc_data!=NULL)
+ free(rlc_data);
+ if(data_ind!= NULL)
+ free(data_ind);
+ if(*msg != NULL)
+ free(*msg);
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+
+int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ boolean_t result = 0;
+
+ Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
+ Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg;
+ Protocol__FspCtxt *ctxt = NULL;
+ Protocol__FspRlcData *rlc_data = NULL;
+
+ rlc_data = data_ind->rlc_data;
+ ctxt = rlc_data->fsp_ctxt;
+
+ protocol_ctxt_t ctxt_pP;
+ srb_flag_t srb_flagP = 0;
+ rb_id_t rb_idP = 0;
+ sdu_size_t pdcp_pdu_size = 0;
+ MBMS_flag_t flag_MBMS = 0;
+ mem_block_t *pdcp_pdu_p = NULL;
+
+ // Create a new protocol context for handling the packet
+ ctxt_pP.module_id = ctxt->fsp_mod_id;
+ ctxt_pP.enb_flag = ctxt->fsp_enb_flag;
+ ctxt_pP.instance = ctxt->fsp_instance;
+ ctxt_pP.rnti = ctxt->fsp_rnti;
+ ctxt_pP.frame = ctxt->fsp_frame;
+ ctxt_pP.subframe = ctxt->fsp_subframe;
+ ctxt_pP.eNB_index = ctxt->fsp_enb_index;
+
+ srb_flagP = rlc_data->fsp_srb_flag;
+ flag_MBMS = rlc_data->fsp_mbms_flag;
+ rb_idP = rlc_data->fsp_rb_id;
+ pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len;
+ pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
+ if (!pdcp_pdu_p) goto error;
+
+ memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
+
+// if (xid == 1)
+// pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p);
+// else if (xid == 0) // FIXME: USE a preprocessed definition
+ LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP);
+ result = pdcp_data_ind(&ctxt_pP,
+ srb_flagP,
+ flag_MBMS,
+ rb_idP,
+ pdcp_pdu_size,
+ pdcp_pdu_p);
+
+ return result;
+
+ error:
+ if (pdcp_pdu_p)
+ free_mem_block(pdcp_pdu_p, __func__);
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ Protocol__FspHeader *header;
+ Protocol__FspHello *hello_msg = NULL;
+
+ /*TODO: Need to set random xid or xid from received hello message*/
+ xid_t xid = mod_id;
+ if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0)
+ goto error;
+
+ LOG_D(PROTO_AGENT, "creating the HELLO message\n");
+ hello_msg = malloc(sizeof(Protocol__FspHello));
+ if(hello_msg == NULL)
+ goto error;
+ protocol__fsp_hello__init(hello_msg);
+ hello_msg->header = header;
+
+ *msg = malloc(sizeof(Protocol__FlexsplitMessage));
+ if(*msg == NULL)
+ goto error;
+
+ protocol__flexsplit_message__init(*msg);
+ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG;
+ (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME;
+ (*msg)->has_msg_dir = 1;
+ (*msg)->hello_msg = hello_msg;
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(hello_msg!=NULL)
+ free(hello_msg);
+ if(*msg != NULL)
+ free(*msg);
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+
+int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg)
+{
+ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG)
+ goto error;
+
+ free(msg->hello_msg->header);
+ free(msg->hello_msg);
+ free(msg);
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__FlexsplitMessage **msg)
+{
+ Protocol__FspHeader *header;
+ Protocol__FspEchoRequest *echo_request_msg = NULL;
+
+ xid_t xid = mod_id;
+ if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0)
+ goto error;
+ LOG_D(PROTO_AGENT, "creating the echo request message\n");
+
+ echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest));
+ if(echo_request_msg == NULL)
+ goto error;
+
+ protocol__fsp_echo_request__init(echo_request_msg);
+ echo_request_msg->header = header;
+
+ *msg = malloc(sizeof(Protocol__FlexsplitMessage));
+ if(*msg == NULL)
+ goto error;
+ protocol__flexsplit_message__init(*msg);
+
+ LOG_D(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG);
+ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG;
+ (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE;
+ (*msg)->has_msg_dir = 1;
+ (*msg)->echo_request_msg = echo_request_msg;
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(echo_request_msg != NULL)
+ free(echo_request_msg);
+ if(*msg != NULL)
+ free(*msg);
+ return -1;
+}
+
+int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg)
+{
+ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG)
+ goto error;
+
+ free(msg->echo_request_msg->header);
+ free(msg->echo_request_msg);
+ free(msg);
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
+{
+ xid_t xid;
+ Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
+ Protocol__FspEchoRequest *echo_req = input->echo_request_msg;
+ Protocol__FspEchoReply *echo_reply_msg = NULL;
+ xid = (echo_req->header)->xid;
+
+ LOG_D(PROTO_AGENT, "creating the echo reply message\n");
+ Protocol__FspHeader *header;
+ if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0)
+ goto error;
+
+ echo_reply_msg = malloc(sizeof(Protocol__FspEchoReply));
+ if(echo_reply_msg == NULL)
+ goto error;
+ protocol__fsp_echo_reply__init(echo_reply_msg);
+ echo_reply_msg->header = header;
+
+ *msg = malloc(sizeof(Protocol__FlexsplitMessage));
+ if(*msg == NULL)
+ goto error;
+ protocol__flexsplit_message__init(*msg);
+ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG;
+ (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME;
+ (*msg)->has_msg_dir = 1;
+ (*msg)->echo_reply_msg = echo_reply_msg;
+ return 0;
+
+ error:
+ if(header != NULL)
+ free(header);
+ if(echo_reply_msg != NULL)
+ free(echo_reply_msg);
+ if(*msg != NULL)
+ free(*msg);
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
+
+int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) {
+ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG)
+ goto error;
+
+ free(msg->echo_reply_msg->header);
+ free(msg->echo_reply_msg);
+ free(msg);
+ return 0;
+
+ error:
+ LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+ return -1;
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h
new file mode 100644
index 0000000000..70e6b2a84e
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_common.h
+ * \brief common message primitves and utilities
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+
+
+#ifndef PROTO_AGENT_COMMON_H_
+#define PROTO_AGENT_COMMON_H_
+
+#include
+
+#include "flexsplit.pb-c.h"
+
+// Do not need these
+//#include "stats_messages.pb-c.h"
+//#include "stats_common.pb-c.h"
+
+#include "proto_agent_defs.h"
+//#include "ENB_APP/enb_config.h"
+#include "UTIL/MEM/mem_block.h"
+
+//#include "LAYER2/MAC/extern.h"
+//#include "LAYER2/RLC/rlc.h"
+
+# include "tree.h"
+# include "intertask_interface.h"
+
+#define FLEXSPLIT_VERSION 0
+
+typedef int (*proto_agent_message_decoded_callback)(
+ mod_id_t mod_id,
+ const void *params,
+ Protocol__FlexsplitMessage **msg
+);
+
+typedef int (*proto_agent_message_destruction_callback)(
+ Protocol__FlexsplitMessage *msg
+);
+
+
+uint32_t ack_result;
+
+/**********************************
+ * progRAN protocol messages helper
+ * functions and generic handlers
+ **********************************/
+
+int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size);
+int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg);
+
+uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size);
+
+err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg);
+
+int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header);
+
+int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg);
+int proto_agent_echo_request(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg);
+int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg);
+
+int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg);
+int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg);
+int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+
+int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+
+
+int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
+
+
+Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
+ uint8_t *data,
+ int size);
+
+Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args);
+
+typedef struct _data_req_args data_req_args;
+typedef struct _dl_data_args dl_data_args;
+
+struct _data_req_args{
+ const protocol_ctxt_t* ctxt;
+ srb_flag_t srb_flag;
+ MBMS_flag_t MBMS_flag;
+ rb_id_t rb_id;
+ mui_t mui;
+ confirm_t confirm;
+ sdu_size_t sdu_size;
+ mem_block_t *sdu_p;
+};
+
+struct _dl_data_args{
+ uint8_t pdu_type;
+ uint32_t sn;
+ frame_t frame;
+ sub_frame_t subframe;
+ rnti_t rnti;
+ sdu_size_t sdu_size;
+ mem_block_t *sdu_p;
+};
+
+
+#endif
+
+
+
+
+
+
+
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h
new file mode 100644
index 0000000000..08c91e7085
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2016 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_defs.h
+ * \brief enb agent common definitions
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+#ifndef PROTO_AGENT_DEFS_H_
+#define PROTO_AGENT_DEFS_H_
+
+#include
+#include
+#include
+#include
+
+#include "openairinterface5g_limits.h"
+#include "UTIL/ASYNC_IF/link_manager.h"
+
+#define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1"
+#define DEFAULT_PROTO_AGENT_PORT 2210
+#define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache"
+
+typedef enum {
+
+ PROTO_AGENT_DEFAULT=0,
+
+ ENB_AGENT_PHY=1,
+ ENB_AGENT_MAC=2,
+ ENB_AGENT_RLC=3,
+ ENB_AGENT_PDCP=4,
+ ENB_AGENT_RRC=5,
+ ENB_AGENT_S1AP=6,
+ ENB_AGENT_GTP=7,
+ ENB_AGENT_X2AP=8,
+
+ ENB_AGENT_MAX=9,
+
+} proto_agent_id_t;
+
+/*
+typedef enum {
+ ENB_AGENT_ACTION_NONE = 0x0,
+
+ ENB_AGENT_ACTION_SEND = 0x1,
+
+ ENB_AGENT_ACTION_APPLY = 0x2,
+
+ ENB_AGENT_ACTION_CLEAR = 0x4,
+
+ ENB_AGENT_ACTION_WRITE = 0x8,
+
+ ENB_AGENT_ACTION_FILTER = 0x10,
+
+ ENB_AGENT_ACTION_PREPROCESS = 0x20,
+
+ ENB_AGENT_ACTION_METER = 0x40,
+
+ ENB_AGENT_ACTION_MAX = 0x7f,
+} agent_action_t;
+*/
+/*
+typedef enum {
+
+ RAN_LTE_OAI= 0,
+
+ RAN_NAME_MAX = 0x7f,
+} ran_name_t;
+*/
+typedef uint8_t xid_t;
+typedef uint8_t mod_id_t; // module or enb id
+typedef uint8_t lcid_t;
+typedef int32_t err_code_t;
+
+typedef struct {
+ /* general info */
+
+ /* stats */
+
+ uint32_t total_rx_msg;
+ uint32_t total_tx_msg;
+
+ uint32_t rx_msg[NUMBER_OF_eNB_MAX];
+ uint32_t tx_msg[NUMBER_OF_eNB_MAX];
+
+} proto_agent_info_t;
+
+/* forward declaration */
+struct proto_agent_channel_s;
+
+typedef struct proto_agent_instance_s {
+ mod_id_t mod_id;
+ proto_agent_info_t agent_info;
+ struct proto_agent_channel_s *channel;
+ pthread_t recv_thread;
+ uint8_t exit;
+} proto_agent_instance_t;
+
+#endif
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c
new file mode 100644
index 0000000000..cb65da2803
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_handler.c
+ * \brief enb agent tx and rx message handler
+ * \author Navid Nikaein and Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+
+#include "proto_agent_common.h"
+#include "common/utils/LOG/log.h"
+#include "assertions.h"
+
+proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = {
+ {proto_agent_hello, 0, 0}, /* agent hello */
+ {proto_agent_echo_reply, 0, 0}, /* echo */
+ {0, just_print, 0}, /* just print */
+ {proto_agent_pdcp_data_req_process, proto_agent_pdcp_data_req_process, 0}, /* PDCP data REQ */
+ {0, proto_agent_get_ack_result, 0}, /* get ACK result */
+ {proto_agent_pdcp_data_ind_process, proto_agent_pdcp_data_ind_process, 0}, /* PDCP data IND */
+ {0, just_print, 0}, /* just print */
+};
+
+proto_agent_message_destruction_callback proto_message_destruction_callback[] = {
+ proto_agent_destroy_hello,
+ proto_agent_destroy_echo_request,
+ proto_agent_destroy_echo_reply,
+ proto_agent_destroy_pdcp_data_req,
+ 0,
+ proto_agent_destroy_pdcp_data_ind,
+ 0,
+};
+
+//static const char *proto_agent_direction2String[] = {
+// "", /* not_set */
+// "originating message", /* originating message */
+// "successfull outcome", /* successfull outcome */
+// "unsuccessfull outcome", /* unsuccessfull outcome */
+//};
+
+
+Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
+ uint8_t *data,
+ int size){
+
+ Protocol__FlexsplitMessage *decoded_message = NULL;
+ Protocol__FlexsplitMessage *reply_message = NULL;
+ err_code_t err_code;
+ DevAssert(data != NULL);
+
+ LOG_D(PROTO_AGENT, "Deserializing message with size %u \n", size);
+ if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) {
+ err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING;
+ goto error;
+ }
+ /* after deserialization, we don't need the original data memory anymore */
+ free(data);
+ Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message;
+ if (header->has_type)
+ {
+ LOG_D(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir);
+ }
+
+ if ((decoded_message->msg_case > sizeof(proto_agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) ||
+ (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME))
+ {
+ err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED;
+ LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n");
+ goto error;
+ }
+
+
+ err_code = ((*proto_agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message));
+
+ if ( err_code < 0 )
+ {
+ LOG_I(PROTO_AGENT, "decoded_message case : %d, direction : %d \n", decoded_message->msg_case-1, decoded_message->msg_dir-1);
+ goto error;
+ }
+
+ protocol__flexsplit_message__free_unpacked(decoded_message, NULL);
+ LOG_D(PROTO_AGENT,"Returning REPLY message after the callback\n");
+ return reply_message;
+
+ error:
+ LOG_E(PROTO_AGENT,"errno %d occured\n",err_code);
+ return NULL;
+}
+
+
+
+uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size)
+{
+ uint8_t *buffer;
+ err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR;
+
+ if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) {
+ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING;
+ goto error;
+ }
+
+ if (proto_message_destruction_callback[msg->msg_case-1])
+ err_code = ((*proto_message_destruction_callback[msg->msg_case-1])(msg));
+
+ DevAssert(buffer !=NULL);
+
+ LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size);
+ return buffer;
+
+ error :
+ LOG_E(PROTO_AGENT,"errno %d occured\n",err_code);
+
+ return NULL;
+}
+
+err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg) {
+ return ((*proto_message_destruction_callback[msg->msg_case-1])(msg));
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
new file mode 100644
index 0000000000..f64a58f8e1
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2016 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_net_comm.c
+ * \brief enb agent network interface abstraction
+ * \author Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+
+#include "proto_agent_net_comm.h"
+#include "common/utils/LOG/log.h"
+
+proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX];
+proto_agent_channel_instance_t channel_instance;
+int proto_agent_channel_id = 0;
+
+int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) {
+ int i;
+
+ if (channel == NULL) {
+ return -1;
+ }
+
+ if (agent_id == ENB_AGENT_MAX) {
+ for (i = 0; i < ENB_AGENT_MAX; i++) {
+ proto_channel[mod_id][i] = channel;
+ }
+ } else {
+ proto_channel[mod_id][agent_id] = channel;
+ }
+ return 0;
+}
+
+void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) {
+ int i;
+
+ if (agent_id == ENB_AGENT_MAX) {
+ for (i = 0; i < ENB_AGENT_MAX; i++) {
+ proto_channel[mod_id][i] = NULL;
+ }
+ } else {
+ proto_channel[mod_id][agent_id] = NULL;
+ }
+}
+
+int proto_agent_create_channel(void *channel_info,
+ int (*msg_send)(void *data, int size, int priority, void *channel_info),
+ int (*msg_recv)(void **data, int *priority, void *channel_info),
+ void (*release)(proto_agent_channel_t *channel)) {
+
+ int channel_id = ++proto_agent_channel_id;
+ proto_agent_channel_t *channel = (proto_agent_channel_t *) malloc(sizeof(proto_agent_channel_t));
+ channel->channel_id = channel_id;
+ channel->channel_info = channel_info;
+ channel->msg_send = msg_send;
+ channel->msg_recv = msg_recv;
+ channel->release = release;
+
+ /*element should be a real pointer*/
+ RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel);
+
+ LOG_D(PROTO_AGENT, "Created a new channel with id 0x%x\n", channel->channel_id);
+
+ return channel_id;
+}
+
+int proto_agent_destroy_channel(int channel_id) {
+ int i, j;
+
+ /*Check to see if channel exists*/
+ struct proto_agent_channel_s *e = NULL;
+ struct proto_agent_channel_s search;
+ memset(&search, 0, sizeof(struct proto_agent_channel_s));
+
+ e = RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search);
+
+ if (e == NULL) {
+ return -1;
+ }
+
+ /*Unregister the channel from all agents*/
+ for (i = 0; i < NUMBER_OF_eNB_MAX; i++) {
+ for (j = 0; j < ENB_AGENT_MAX; j++) {
+ if (proto_channel[i][j] != NULL) {
+ if (proto_channel[i][j]->channel_id == e->channel_id) {
+ proto_channel[i][j] = NULL;
+ }
+ }
+ }
+ }
+
+ /*Remove the channel from the tree and free memory*/
+ RB_REMOVE(proto_agent_channel_map, &channel_instance.proto_agent_head, e);
+ e->release(e);
+ free(e);
+
+ return 0;
+}
+
+err_code_t proto_agent_init_channel_container(void) {
+ int i, j;
+ LOG_D(PROTO_AGENT, "init RB tree for channel container\n");
+
+ RB_INIT(&channel_instance.proto_agent_head);
+
+ for (i = 0; i < NUMBER_OF_eNB_MAX; i++) {
+ for (j = 0; j < ENB_AGENT_MAX; j++) {
+ proto_channel[i][j] = NULL;
+ }
+ }
+
+ return 0;
+}
+
+RB_GENERATE(proto_agent_channel_map,proto_agent_channel_s, entry, proto_agent_compare_channel);
+
+int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b) {
+ if (a->channel_id < b->channel_id) return -1;
+ if (a->channel_id > b->channel_id) return 1;
+
+ // equal timers
+ return 0;
+}
+
+proto_agent_channel_t * proto_agent_get_channel(int channel_id) {
+
+ struct proto_agent_channel_s search;
+ memset(&search, 0, sizeof(struct proto_agent_channel_s));
+ search.channel_id = channel_id;
+
+ return RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search);
+
+}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h
new file mode 100644
index 0000000000..c956bf48b1
--- /dev/null
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2016 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+
+/*! \file enb_agent_net_comm.h
+ * \brief enb agent network interface abstraction
+ * \autho Xenofon Foukas
+ * \date 2016
+ * \version 0.1
+ */
+#ifndef PROTO_AGENT_NET_COMM_H_
+#define PROTO_AGENT_NET_COMM_H_
+
+#include "proto_agent_defs.h"
+
+#include "tree.h"
+#define ENB_AGENT_MAX 9
+
+/* forward declaration */
+struct proto_agent_async_channel_s;
+
+/*Channel related information used for Tx/Rx of protocol messages*/
+typedef struct proto_agent_channel_s {
+ RB_ENTRY(proto_agent_channel_s) entry;
+ int channel_id;
+ struct proto_agent_async_channel_s *channel_info;
+ /*Callbacks for channel message Tx and Rx*/
+ int (*msg_send)(void *data, int size, int priority, void *channel_info);
+ int (*msg_recv)(void **data, int *priority, void *channel_info);
+ void (*release)(struct proto_agent_channel_s *channel);
+} proto_agent_channel_t;
+
+typedef struct proto_agent_channel_instance_s{
+ RB_HEAD(proto_agent_channel_map, proto_agent_channel_s) proto_agent_head;
+} proto_agent_channel_instance_t;
+
+
+/*Register a channel to an agent. Use ENB_AGENT_MAX to register the
+ *same channel to all agents*/
+int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id);
+
+/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/
+void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id);
+
+/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
+int proto_agent_create_channel(void *channel_info,
+ int (*msg_send)(void *data, int size, int priority, void *channel_info),
+ int (*msg_recv)(void **data, int *priority, void *channel_info),
+ void (*release)(proto_agent_channel_t *channel));
+
+/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
+int proto_agent_destroy_channel(int channel_id);
+
+/*Return an agent communication channel based on its id*/
+proto_agent_channel_t * proto_agent_get_channel(int channel_id);
+
+/*Should be called before performing any channel operations*/
+err_code_t proto_agent_init_channel_container(void);
+
+int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b);
+
+/* RB_PROTOTYPE is for .h files */
+RB_PROTOTYPE(proto_agent_channel_map, proto_agent_channel_s, entry, proto_agent_compare_channel);
+
+#endif /*ENB_AGENT_COMM_H_*/
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
index 33ab7965e5..30173b62ff 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
@@ -40,7 +40,6 @@
#include "LTE_UL-AM-RLC.h"
#include "LTE_DL-AM-RLC.h"
-
//-----------------------------------------------------------------------------
uint32_t
rlc_am_get_status_pdu_buffer_occupancy(
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
index 75213116a7..c6a5ca7213 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
@@ -65,7 +65,7 @@
(rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
rLC_Pp->rb_id
-#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %"PRIx16" %s %02u]"
+#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]"
#define PROTOCOL_RLC_AM_MSC_ARGS(CTXT_Pp, rLC_Pp) \
CTXT_Pp->rnti,\
(rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
@@ -79,13 +79,13 @@
if (pmtl_rc != 0){\
if (pmtl_rc == EBUSY) {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
- "0 "PROTOCOL_RLC_AM_MSC_FMT" Warning try lock %s busy",\
+ "0 " PROTOCOL_RLC_AM_MSC_FMT " Warning try lock %s busy",\
PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\
#mUTEX);\
pthread_mutex_lock(mUTEX);\
} else {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
- "0 "PROTOCOL_RLC_AM_MSC_FMT" Error try lock %s %d",\
+ "0 " PROTOCOL_RLC_AM_MSC_FMT " Error try lock %s %d",\
PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\
#mUTEX, pmtl_rc);\
}\
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
index f2f91ff68e..fc6e449acf 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
@@ -56,7 +56,7 @@
rLC_Pp->rb_id,\
__FUNCTION__
-#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %"PRIx16" %s %02u]"
+#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]"
#define PROTOCOL_RLC_UM_MSC_ARGS(CTXT_Pp, rLC_Pp) \
CTXT_Pp->rnti,\
(rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\
@@ -69,13 +69,13 @@
if (pmtl_rc != 0){\
if (pmtl_rc == EBUSY) {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
- "0 "PROTOCOL_RLC_UM_MSC_FMT" Warning try lock %s busy",\
+ "0 " PROTOCOL_RLC_UM_MSC_FMT " Warning try lock %s busy",\
PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\
#mUTEX);\
pthread_mutex_lock(mUTEX);\
} else {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
- "0 "PROTOCOL_RLC_UM_MSC_FMT" Error try lock %s %d",\
+ "0 " PROTOCOL_RLC_UM_MSC_FMT " Error try lock %s %d",\
PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\
#mUTEX, pmtl_rc);\
}\
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index 38d78f18fd..96803652e8 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -37,6 +37,9 @@
#include "targets/COMMON/openairinterface5g_limits.h"
#include "assertions.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
extern boolean_t pdcp_data_ind(
const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
@@ -49,6 +52,10 @@ extern boolean_t pdcp_data_ind(
//#define TRACE_RLC_PAYLOAD 1
#define DEBUG_RLC_DATA_REQ 1
+
+
+#include "proto_agent.h"
+
//-----------------------------------------------------------------------------
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP)
//-----------------------------------------------------------------------------
@@ -323,6 +330,8 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
#endif
) {
//-----------------------------------------------------------------------------
+
+
mem_block_t *new_sdu_p = NULL;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_union_t *rlc_union_p = NULL;
@@ -596,13 +605,28 @@ void rlc_data_ind (
T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
#endif
- pdcp_data_ind (
- ctxt_pP,
- srb_flagP,
- MBMS_flagP,
- rb_idP,
- sdu_sizeP,
- sdu_pP);
+
+#ifndef UETARGET
+ const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
+ AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
+ "Can't be CU, bad node type %d\n", type);
+
+ if (NODE_IS_DU(type)) {
+ if (srb_flagP == 1) {
+ MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
+ F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti;
+ F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP;
+ F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data;
+ F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP;
+ itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
+ } else {
+ proto_agent_send_pdcp_data_ind (ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
+ }
+ } else
+#endif
+ { // case monolithic eNodeB or UE
+ pdcp_data_ind(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
+ }
}
//-----------------------------------------------------------------------------
void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP,
@@ -647,12 +671,12 @@ rlc_module_init (void) {
}
}
- for (k=0; k < RLC_MAX_MBMS_LC; k++) {
+ for (k=0; k < RLC_MAX_MBMS_LC; k++) {
rlc_mbms_lcid2service_session_id_eNB[0][k].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[0][k].session_id = 0;
- }
+ }
- for (k=0; k < NB_RB_MBMS_MAX; k++) {
+ for (k=0; k < NB_RB_MBMS_MAX; k++) {
rlc_mbms_rbid2lcid_eNB[0][k] = RLC_LC_UNALLOCATED;
}
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index d4ec487c85..b539970704 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -261,12 +261,12 @@ void mac_rlc_data_ind (
#ifdef DEBUG_MAC_INTERFACE
if (num_tbP) {
- LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n",
+ LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n",
PROTOCOL_CTXT_ARGS(&ctxt),
channel_idP,
RLC_MAX_LC,
NB_RB_MAX,
- num_tbP);
+ tb_sizeP);
}
#endif // DEBUG_MAC_INTERFACE
@@ -293,7 +293,7 @@ void mac_rlc_data_ind (
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
- //AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
+ //AssertFatal (0 , "%s RLC not configured lcid %u ! (h_rc %d)\n", __FUNCTION__,channel_idP,h_rc);
}
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
diff --git a/openair2/LAYER2/RLC/rlc_primitives.h b/openair2/LAYER2/RLC/rlc_primitives.h
index eb7b9ae005..bb83852775 100644
--- a/openair2/LAYER2/RLC/rlc_primitives.h
+++ b/openair2/LAYER2/RLC/rlc_primitives.h
@@ -202,4 +202,5 @@ struct crlc_primitive {
struct crlc_status_ind c_status_ind;
} primitive;
};
+
#endif
diff --git a/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h b/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h
new file mode 100644
index 0000000000..75ccc9fcdd
--- /dev/null
+++ b/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h
@@ -0,0 +1,16 @@
+
+#ifndef __PROTO_AGENT_RLC_PRIMITIVES_H__
+#define __PROTO_AGENT_RLC_PRIMITIVES_H__
+
+#include "RRC/LTE/rrc_defs.h"
+#include "LAYER2/PROTO_AGENT/proto_agent.h"
+// PROTO AGENT
+pthread_t async_server_thread;
+int async_server_thread_finalize (void);
+void async_server_thread_init (void);
+
+pthread_mutex_t async_server_lock;
+pthread_cond_t async_server_notify;
+int async_server_shutdown;
+
+#endif
diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c
index 50c8ac58b4..2251344c47 100644
--- a/openair2/LAYER2/openair2_proc.c
+++ b/openair2/LAYER2/openair2_proc.c
@@ -622,3 +622,4 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) {
}
#endif
+
diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c
index 5089a28d94..658ae19aba 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c
@@ -120,7 +120,7 @@ int ue_ip_netlink_init(void)
&nasmesh_mutex, // NULL
THIS_MODULE);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
-
+
if (nas_nl_sk == NULL) {
diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index 28055bfc2d..8d08b956cf 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -39,7 +39,7 @@ void handle_rach(UL_IND_t *UL_info) {
);
}
-#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n");
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c
index 0c961d9fbb..8d625fbdc5 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.c
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.c
@@ -72,7 +72,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
pdu->rx_indication_rel8.length = buflen;
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
- // ulsch_buffer is necessary to keep its value.
+ // ulsch_buffer is necessary to keep its value.
//pdu->data = ulsch_buffer;
pdu->data = malloc(buflen);
memcpy(pdu->data,ulsch_buffer,buflen);
@@ -181,7 +181,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
// change for mutiple UE's simulation.
// pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock(&fill_ul_mutex.rach_mutex);
-
+
// memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4.
// UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
index 2e1d050387..270436b029 100644
--- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
+++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
@@ -39,6 +39,7 @@ mac_rrc_data_req(
const int CC_idP,
const frame_t frameP,
const rb_id_t srb_idP,
+ const rnti_t rntiP,
const uint8_t nb_tbP,
uint8_t* const buffer_pP,
const uint8_t mbsfn_sync_areaP
@@ -47,14 +48,15 @@ mac_rrc_data_req(
/*int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
- const int CC_idP,
+ const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
+ const int UE_id,
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_area
+ const uint8_t mbsfn_sync_areaP
);
int8_t
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index 736b16422b..027a629992 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -282,7 +282,7 @@ rrc_rx_tx(
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
rrc_t310_expiration (ctxt_pP, enb_indexP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
+ LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
return RRC_PHY_RESYNCH;
}
@@ -358,7 +358,7 @@ rrc_rx_tx(
}
if (ue_context_p->ue_context.ue_release_timer>0) {
ue_context_p->ue_context.ue_release_timer++;
- if (ue_context_p->ue_context.ue_release_timer >=
+ if (ue_context_p->ue_context.ue_release_timer >=
ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC,"Removing UE %x instance (release timer %d)\n",ue_context_p->ue_context.rnti,ue_context_p->ue_context.ue_release_timer);
ue_to_be_removed = ue_context_p;
@@ -493,4 +493,3 @@ binary_search_float(
return first;
}
-
diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c
index 5929ac6689..7bfeb43b53 100644
--- a/openair2/RRC/LTE/L2_interface.c
+++ b/openair2/RRC/LTE/L2_interface.c
@@ -42,7 +42,8 @@
#endif
#include "flexran_agent_extern.h"
-
+#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
+#include "f1ap_du_rrc_message_transfer.h"
extern RAN_CONTEXT_t RC;
@@ -53,6 +54,7 @@ mac_rrc_data_req(
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
+ const rnti_t rnti,
const uint8_t Nb_tb,
uint8_t *const buffer_pP,
const uint8_t mbsfn_sync_area
@@ -139,14 +141,14 @@ mac_rrc_data_req(
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
- LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
- if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
- LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
- return -1;
- }
+ struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
- Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
+ if (ue_context_p == NULL) return(0);
+ eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
+ LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti);
+
+ Srb_info=&ue_p->Srb0;
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
@@ -219,6 +221,7 @@ mac_rrc_data_req(
return(0);
}
+
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_ind(
@@ -226,6 +229,7 @@ mac_rrc_data_ind(
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
+ const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
@@ -238,7 +242,25 @@ mac_rrc_data_ind(
)
//--------------------------------------------------------------------------
{
- SRB_INFO *Srb_info;
+
+
+ if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) {
+ LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n",
+ module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
+
+ /* do ITTI message */
+ DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
+ module_idP,
+ CC_id,
+ UE_id,
+ rntiP,
+ sduP,
+ sdu_lenP
+ );
+ return(0);
+ }
+
+ //SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
@@ -249,16 +271,17 @@ mac_rrc_data_ind(
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
- 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);
+ LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %d\n", module_idP, srb_idP);
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
ctxt.brOption = brOption;
-#endif
+#endif
+ /*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
- }
+ }*/
+ if (sdu_lenP > 0) rrc_eNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id);
}
if((srb_idP & RAB_OFFSET) == DCCH) {
@@ -315,11 +338,9 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
} 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);
+ if (flexran_agent_get_rrc_xface(Mod_instP)) {
+ flexran_agent_get_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);
diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c
index c8553b5970..c17318d601 100644
--- a/openair2/RRC/LTE/L2_interface_common.c
+++ b/openair2/RRC/LTE/L2_interface_common.c
@@ -44,6 +44,8 @@
//#define RRC_DATA_REQ_DEBUG
//#define DEBUG_RRC 1
+extern RAN_CONTEXT_t RC;
+
//------------------------------------------------------------------------------
uint8_t
rrc_data_req(
@@ -94,6 +96,8 @@ rrc_data_req(
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
+ //memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP);
+
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
@@ -103,6 +107,15 @@ rrc_data_req(
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ctxt_pP->instance,
message_p);
+ LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n");
+#ifndef UETARGET
+ /* 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 (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
+ pdcp_run(ctxt_pP);
+#endif
+
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h
index b576a7e933..9cbef536fc 100644
--- a/openair2/RRC/LTE/rrc_defs.h
+++ b/openair2/RRC/LTE/rrc_defs.h
@@ -16,7 +16,7 @@
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
+ * conmnc_digit_lengtht@openairinterface.org
*/
/*! \file RRC/LTE/defs.h
@@ -36,6 +36,7 @@
#include
#include "collection/tree.h"
+#include "common/ngran_types.h"
#include "rrc_types.h"
//#include "PHY/phy_defs.h"
#include "LAYER2/RLC/rlc.h"
@@ -663,8 +664,10 @@ typedef struct {
uint32_t N_RB_DL;
uint32_t pbch_repetition;
LTE_BCCH_BCH_Message_t mib;
+ LTE_BCCH_BCH_Message_t *mib_DU;
LTE_BCCH_DL_SCH_Message_t siblock1;
LTE_BCCH_DL_SCH_Message_t siblock1_BR;
+ LTE_BCCH_DL_SCH_Message_t *siblock1_DU;
LTE_BCCH_DL_SCH_Message_t systemInformation;
LTE_BCCH_DL_SCH_Message_t systemInformation_BR;
// SystemInformation_t systemInformation;
@@ -691,14 +694,17 @@ typedef struct {
LTE_SystemInformationBlockType21_r14_t *sib21;
// End - TTN
SRB_INFO SI;
- SRB_INFO Srb0;
uint8_t *paging[MAX_MOBILES_PER_ENB];
uint32_t sizeof_paging[MAX_MOBILES_PER_ENB];
} rrc_eNB_carrier_data_t;
+
typedef struct eNB_RRC_INST_s {
/// southbound midhaul configuration
+ ngran_node_t node_type;
eth_params_t eth_params_s;
+ char *node_name;
+ uint32_t node_id;
rrc_eNB_carrier_data_t carrier[MAX_NUM_CCs];
uid_allocator_t uid_allocator; // for rrc_ue_head
RB_HEAD(rrc_ue_tree_s, rrc_eNB_ue_context_s) rrc_ue_head; // ue_context tree key search by rnti
@@ -720,6 +726,10 @@ typedef struct eNB_RRC_INST_s {
//RRC configuration
RrcConfigurationReq configuration;
+
+ /// NR cell id
+ uint64_t nr_cellid;
+
// other RAN parameters
int srb1_timer_poll_retransmit;
int srb1_poll_pdu;
@@ -728,6 +738,11 @@ typedef struct eNB_RRC_INST_s {
int srb1_timer_reordering;
int srb1_timer_status_prohibit;
int srs_enable[MAX_NUM_CCs];
+ int cell_info_configured;
+ pthread_mutex_t cell_info_mutex;
+ uint16_t sctp_in_streams;
+ uint16_t sctp_out_streams;
+
} eNB_RRC_INST;
#define MAX_UE_CAPABILITY_SIZE 255
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index fbc5d8f256..f330399901 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -123,8 +123,6 @@ openair_rrc_on(
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
- rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
}
}
@@ -144,301 +142,368 @@ init_SI(
LTE_SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL;
#endif
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t *) malloc16(4);
- // copy basic parameters
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].eutra_band = configuration->eutra_band[CC_id];
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].N_RB_DL = configuration->N_RB_DL[CC_id];
+ eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id];
+ rrc_eNB_carrier_data_t *carrier=&rrc->carrier[CC_id];
+
+ carrier->MIB = (uint8_t*) malloc16(4);
+ carrier->sizeof_SIB1 = 0;
+ carrier->sizeof_SIB23 = 0;
+ carrier->SIB1 = (uint8_t*) malloc16(32);
+
+ AssertFatal(carrier->SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+
+ LOG_I(RRC,"[eNB %d] Node type %d \n ", ctxt_pP->module_id, rrc->node_type);
+ if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
+ // copy basic Cell parameters
+ carrier->physCellId = configuration->Nid_cell[CC_id];
+ carrier->p_eNB = configuration->nb_antenna_ports[CC_id];
+ carrier->Ncp = configuration->prefix_type[CC_id];
+ carrier->dl_CarrierFreq = configuration->downlink_frequency[CC_id];
+ carrier->ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
+ carrier->eutra_band = configuration->eutra_band[CC_id];
+ carrier->N_RB_DL = configuration->N_RB_DL[CC_id];
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id];
+ carrier->pbch_repetition = configuration->pbch_repetition[CC_id];
+ LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
#endif
- LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
- configuration->N_RB_DL[CC_id],
- (int)configuration->radioresourceconfig[CC_id].phich_resource,
- (int)configuration->radioresourceconfig[CC_id].phich_duration);
+
+ LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
+ (int)configuration->N_RB_DL[CC_id],
+ (int)configuration->radioresourceconfig[CC_id].phich_resource,
+ (int)configuration->radioresourceconfig[CC_id].phich_duration);
+
+ carrier->sizeof_MIB = do_MIB(&rrc->carrier[CC_id],
+ configuration->N_RB_DL[CC_id],
+ configuration->radioresourceconfig[CC_id].phich_resource,
+ configuration->radioresourceconfig[CC_id].phich_duration,
+ 0
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
+ ,configuration->schedulingInfoSIB1_BR_r13[CC_id]
#endif
- do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
- configuration->N_RB_DL[CC_id],
- (int)configuration->radioresourceconfig[CC_id].phich_resource,
- (int)configuration->radioresourceconfig[CC_id].phich_duration,
- 0
+ );
+
+
+ carrier->sizeof_SIB1 = do_SIB1(&rrc->carrier[CC_id],
+ ctxt_pP->module_id,
+ CC_id
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,configuration->schedulingInfoSIB1_BR_r13[CC_id]
+ ,FALSE
#endif
- );
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0;
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0;
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t *) malloc16(32);
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
+ , configuration
+ );
+
+ AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,FALSE
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = 0;
+
+ if (configuration->schedulingInfoSIB1_BR_r13[CC_id] > 0) {
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_BR = (uint8_t *) malloc16(32);
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
+ ctxt_pP->module_id,
+ CC_id, TRUE, configuration);
+ }
#endif
- , configuration
- );
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
-#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = 0;
- if (configuration->schedulingInfoSIB1_BR_r13[CC_id]>0) {
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_BR = (uint8_t *) malloc16(32);
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
- ,TRUE
- , configuration
- );
}
-
-#endif
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t *) malloc16(64);
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB");
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23(
- ctxt_pP->module_id,
- CC_id
+ if (!NODE_IS_DU(rrc->node_type)) {
+ carrier->SIB23 = (uint8_t*) malloc16(64);
+ AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB");
+ carrier->sizeof_SIB23 = do_SIB23(ctxt_pP->module_id,
+ CC_id
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,FALSE
+ ,FALSE
#endif
- , configuration
- );
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255");
+ , configuration
+ );
+
+ LOG_I(RRC,"do_SIB23, size %d \n ", carrier->sizeof_SIB23);
+
+ AssertFatal(carrier->sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255");
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23_BR = 0;
-
+ carrier->sizeof_SIB23_BR = 0;
if (configuration->schedulingInfoSIB1_BR_r13[CC_id]>0) {
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23_BR = (uint8_t *) malloc16(64);
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23_BR!=NULL,"cannot allocate memory for SIB");
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23_BR = do_SIB23(
- ctxt_pP->module_id,
- CC_id,
- TRUE,
- configuration
- );
+ carrier->SIB23_BR = (uint8_t*) malloc16(64);
+ AssertFatal(carrier->SIB23_BR!=NULL,"cannot allocate memory for SIB");
+ carrier->sizeof_SIB23_BR = do_SIB23(ctxt_pP->module_id, CC_id, TRUE, configuration);
}
-
+
#endif
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- pusch_ConfigBasic.n_SB);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- pusch_ConfigBasic.hoppingMode);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- pusch_ConfigBasic.pusch_HoppingOffset);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- pusch_ConfigBasic.enable64QAM);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
- LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- ul_ReferenceSignalsPUSCH.cyclicShift);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
+ LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
-
- if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) {
- for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) {
- // SIB 2
- // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count);
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- i,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count);
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0);
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2)
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset);
+
+ if (carrier->MBMS_flag > 0) {
+ for (i = 0; i < carrier->sib2->mbsfn_SubframeConfigList->list.count; i++) {
+ // SIB 2
+ // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ i,
+ carrier->sib2->mbsfn_SubframeConfigList->list.count);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2)
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset);
+ }
+
+ // SIB13
+ for (i = 0; i < carrier->sib13->mbsfn_AreaInfoList_r9.list.count; i++) {
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ i,
+ carrier->sib13->mbsfn_AreaInfoList_r9.list.count);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9);
+ }
+ } else memset((void *)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13));
+
+ //TTN - SIB 18
+ if (configuration->SL_configured > 0) {
+ for (int j = 0; j < carrier->sib18->commConfig_r12->commRxPool_r12.list.count; j++) {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ j+1,
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.count);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
+ }
+
+ //TTN - SIB 19
+ for (int j = 0; j < carrier->sib19->discConfig_r12->discRxPool_r12.list.count; j++) {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ j+1,
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.count);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
+ }
}
-
- // SIB13
- for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) {
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- i,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count);
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9);
- }
- } else memset((void *)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13));
-
- //TTN - SIB 18
- if (configuration->SL_configured>0) {
- for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count; j++) {
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- j+1,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
- }
-
- for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count; j++) {
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- j+1,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
- }
- }
-
#endif // (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ }
+
LOG_D(RRC,
PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) &&
- (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) {
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v8.9)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v9.2)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v11.3)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v12.5)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v13.10)\n");
- sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
- // Basic Asserts for CE_level0 PRACH configuration
- LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR = &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon;
- struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach=radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
- LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
- AssertFatal(prach_ParametersListCE_r13->list.count>0,"prach_ParametersListCE_r13 is empty\n");
- LTE_PRACH_ParametersCE_r13_t *p = prach_ParametersListCE_r13->list.array[0];
- AssertFatal(p->prach_StartingSubframe_r13 != NULL, "prach_StartingSubframe_r13 celevel0 is null\n");
- AssertFatal((1<numRepetitionPerPreambleAttempt_r13)<=(2<<*p->prach_StartingSubframe_r13),
- "prachce0->numReptitionPerPreambleAttempt_r13 %d > prach_StartingSubframe_r13 %d\n",
- 1<numRepetitionPerPreambleAttempt_r13,
- 2<<*p->prach_StartingSubframe_r13);
- }
+ // LTE-M stuff here (take out CU-DU for now)
+ if (NODE_IS_MONOLITHIC(rrc->node_type)) {
+ if ((carrier->mib.message.schedulingInfoSIB1_BR_r13>0) &&
+ (carrier->sib1_BR!=NULL)) {
+ AssertFatal(carrier->sib1_BR->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v8.9)\n");
+ AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v9.2)\n");
+ AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v11.3)\n");
+ AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v12.5)\n");
+ AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v13.10)\n");
+ sib1_v13ext = carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
+
+ // Basic Asserts for CE_level0 PRACH configuration
+ LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR = &carrier[CC_id].sib2_BR->radioResourceConfigCommon;
+ struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach=radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+ LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+ AssertFatal(prach_ParametersListCE_r13->list.count>0,"prach_ParametersListCE_r13 is empty\n");
+ LTE_PRACH_ParametersCE_r13_t *p = prach_ParametersListCE_r13->list.array[0];
+ AssertFatal(p->prach_StartingSubframe_r13 != NULL, "prach_StartingSubframe_r13 celevel0 is null\n");
+ AssertFatal((1<numRepetitionPerPreambleAttempt_r13)<=(2<<*p->prach_StartingSubframe_r13),
+ "prachce0->numReptitionPerPreambleAttempt_r13 %d > prach_StartingSubframe_r13 %d\n",
+ 1<numRepetitionPerPreambleAttempt_r13,
+ 2<<*p->prach_StartingSubframe_r13);
+ }
+
+ }
#endif
- LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n");
- rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq,
+ /*
+ if (rrc->node_type == ngran_eNB_DU) {
+ LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB_DU\n");
+
+ rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
+ carrier->physCellId,
+ carrier->p_eNB,
+ carrier->Ncp,
+ carrier->sib1->freqBandIndicator,
+ carrier->dl_CarrierFreq,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition,
+ carrier->pbch_repetition,
#endif
- 0, // rnti
- (LTE_BCCH_BCH_Message_t *)
- &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib,
- (LTE_RadioResourceConfigCommonSIB_t *) &
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon,
+ 0, // rnti
+ (BCCH_BCH_Message_t *)
+ &carrier->mib,
+ (RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) &
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon,
+ (RadioResourceConfigCommonSIB_t *) NULL,
#endif
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ (struct PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (SCellToAddMod_r10_t *)NULL,
+ //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- (LTE_MAC_MainConfig_t *) NULL, 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *) NULL,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config,
- NULL,
- &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth,
- &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission,
- (LTE_MBSFN_SubframeConfigList_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList
+ (MeasObjectToAddMod_t **) NULL,
+ (MAC_MainConfig_t *) NULL, 0,
+ (struct LogicalChannelConfig *)NULL,
+ (MeasGapConfig_t *) NULL,
+ carrier->sib1->tdd_Config,
+ NULL,
+ &carrier->sib1->schedulingInfoList,
+ carrier->ul_CarrierFreq,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag,
- (LTE_MBSFN_AreaInfoList_r9_t *) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9,
- (LTE_PMCH_InfoList_r9_t *) NULL
+ ,
+ carrier->MBMS_flag,
+ NULL,
+ (PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- sib1_v13ext
+ ,
+ NULL
#endif
- );
+ );
+ }
+ else
+ */
+ if (NODE_IS_MONOLITHIC(rrc->node_type)) {
+ LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB\n");
+
+ rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
+ carrier->physCellId,
+ carrier->p_eNB,
+ carrier->Ncp,
+ carrier->sib1->freqBandIndicator,
+ carrier->dl_CarrierFreq,
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ carrier->pbch_repetition,
+#endif
+ 0, // rnti
+ (LTE_BCCH_BCH_Message_t *) &carrier->mib,
+ (LTE_RadioResourceConfigCommonSIB_t *) &carrier->sib2->radioResourceConfigCommon,
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ (LTE_RadioResourceConfigCommonSIB_t *) &carrier->sib2_BR->radioResourceConfigCommon,
+#endif
+ (struct LTE_PhysicalConfigDedicated *)NULL,
+#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ (LTE_MAC_MainConfig_t *) NULL, 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *) NULL,
+ carrier->sib1->tdd_Config,
+ NULL,
+ &carrier->sib1->schedulingInfoList,
+ carrier->ul_CarrierFreq,
+ carrier->sib2->freqInfo.ul_Bandwidth,
+ &carrier->sib2->freqInfo.additionalSpectrumEmission,
+ (LTE_MBSFN_SubframeConfigList_t*) carrier->sib2->mbsfn_SubframeConfigList
+#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+ ,
+ carrier->MBMS_flag,
+ (LTE_MBSFN_AreaInfoList_r9_t*) & carrier->sib13->mbsfn_AreaInfoList_r9,
+ (LTE_PMCH_InfoList_r9_t *) NULL
+#endif
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+ ,
+ sib1_v13ext
+#endif
+ );
+ }
+
+ /* set flag to indicate that cell information is configured. This is required
+ * in DU to trigger F1AP_SETUP procedure */
+ pthread_mutex_lock(&rrc->cell_info_mutex);
+ rrc->cell_info_configured=1;
+ pthread_mutex_unlock(&rrc->cell_info_mutex);
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
@@ -452,6 +517,8 @@ init_MCCH(
{
int sync_area = 0;
// initialize RRC_eNB_INST MCCH entry
+ eNB_RRC_INST *rrc = RC.rrc[enb_mod_idP];
+
RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE =
malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t *));
@@ -488,38 +555,40 @@ init_MCCH(
// call mac_config_req with appropriate structure from ASN.1 description
// LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]);
// LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]);
- rrc_mac_config_req_eNB(enb_mod_idP, CC_id,
- 0,0,0,0,0,
+ if (NODE_IS_MONOLITHIC(rrc->node_type)) {
+ rrc_mac_config_req_eNB(enb_mod_idP, CC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ 0,
#endif
- 0,//rnti
- (LTE_BCCH_BCH_Message_t *)NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ 0,//rnti
+ (LTE_BCCH_BCH_Message_t *)NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#endif
- (struct LTE_PhysicalConfigDedicated *)NULL,
- (LTE_SCellToAddMod_r10_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
//(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
- (LTE_MeasObjectToAddMod_t **) NULL,
- (LTE_MAC_MainConfig_t *) NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *) NULL,
- (LTE_TDD_Config_t *) NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
- ,
- 0,
- (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
- (LTE_PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ (LTE_MAC_MainConfig_t *) NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *) NULL,
+ (LTE_TDD_Config_t *) NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
+ ,
+ 0,
+ (LTE_MBSFN_AreaInfoList_r9_t *) NULL,
+ (LTE_PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,
+ (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
- );
+ );
+ }
//LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9);
}
@@ -548,16 +617,19 @@ static void init_MBMS(
NULL // key encryption
, &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
,NULL);
- rrc_rlc_config_asn1_req(&ctxt,
- NULL, // LTE_SRB_ToAddModList
- NULL, // LTE_DRB_ToAddModList
- NULL, // DRB_ToReleaseList
- &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
+
+ if (!NODE_IS_CU(RC.rrc[enb_mod_idP]->node_type)) {
+ rrc_rlc_config_asn1_req(&ctxt,
+ NULL, // LTE_SRB_ToAddModList
+ NULL, // LTE_DRB_ToAddModList
+ NULL, // DRB_ToReleaseList
+ &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,0, 0
+ ,0, 0
#endif
- );
- //rrc_mac_config_req();
+ );
+ }
+ //rrc_mac_config_req();
}
}
#endif
@@ -692,6 +764,7 @@ rrc_eNB_get_next_free_ue_context(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
return NULL;
}
+ return(ue_context_p);
}
//-----------------------------------------------------------------------------
@@ -846,30 +919,36 @@ rrc_eNB_free_UE(
return;
}
- if (EPC_MODE_ENABLED) {
- if ((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) {
- LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n",
- enb_mod_idP,
- rnti);
- rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21);
- // send cause 21: radio connection with ue lost
- /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
- * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before
- * triggering the S1 UE Context Release Request procedure in order to allow the UE to perform the NAS recovery
- * procedure, see TS 23.401 [17].
- */
- return;
- }
+ if(EPC_MODE_ENABLED) {
+ if (!NODE_IS_DU(RC.rrc[enb_mod_idP]->node_type)) {
+ if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) {
+ LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n",
+ enb_mod_idP,
+ rnti);
+ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP,
+ ue_context_pP,
+ S1AP_CAUSE_RADIO_NETWORK,
+ 21); // send cause 21: radio connection with ue lost
+ /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
+ * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before
+ * triggering the S1 UE Context Release Request procedure in order to allow the UE to perform the NAS recovery
+ * procedure, see TS 23.401 [17].
+ */
+ return;
+ }
- if((ue_context_pP->ue_context.ue_rrc_inactivity_timer >= RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres) &&
- (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED) &&
- (RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres > 0)) {
- LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 20, user inactivity\n",
- enb_mod_idP,
- rnti);
- rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 20);
- // send cause 20: user inactivity
- return;
+ if((ue_context_pP->ue_context.ue_rrc_inactivity_timer >= RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres) &&
+ (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED) &&
+ (RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres > 0)) {
+ LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 20, user inactivity\n",
+ enb_mod_idP,
+ rnti);
+ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP,
+ ue_context_pP,
+ S1AP_CAUSE_RADIO_NETWORK,
+ 20); // send cause 20: user inactivity
+ return;
+ }
}
}
@@ -967,9 +1046,9 @@ void release_UE_in_freeList(module_id_t mod_id) {
}
}
- if (rrc_agent_registered[mod_id]) {
- agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change(mod_id,
- rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+ if (flexran_agent_get_rrc_xface(mod_id)) {
+ flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change(
+ mod_id, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
for(j = 0; j < 10; j++) {
@@ -997,13 +1076,23 @@ void release_UE_in_freeList(module_id_t mod_id) {
}
}
- rrc_mac_remove_ue(mod_id,rnti);
- rrc_rlc_remove_ue(&ctxt);
- pdcp_remove_UE(&ctxt);
+ if (!NODE_IS_CU(RC.rrc[mod_id]->node_type)) {
+ rrc_mac_remove_ue(mod_id,rnti);
+ rrc_rlc_remove_ue(&ctxt);
+ pdcp_remove_UE(&ctxt);
+ }
+ else {
+ MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
+ itti_send_msg_to_task(TASK_CU_F1, mod_id, m);
+ }
if(remove_UEContext) {
- ue_context_pP = rrc_eNB_get_ue_context(
- RC.rrc[mod_id],rnti);
+ ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[mod_id],rnti);
if(ue_context_pP) {
rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id],
@@ -1086,14 +1175,18 @@ rrc_eNB_generate_SecurityModeCommand(
ue_context_pP->ue_context.rnti,
rrc_eNB_mui,
size);
- rrc_data_req(
- ctxt_pP,
- DCCH,
- rrc_eNB_mui++,
- SDU_CONFIRM_NO,
- size,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
+
+ if (!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n");
+
+ rrc_data_req(ctxt_pP,
+ DCCH,
+ rrc_eNB_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+ }
}
//-----------------------------------------------------------------------------
@@ -1153,26 +1246,29 @@ rrc_eNB_generate_RRCConnectionReject(
{
T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+
+ eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
+ ue_p->Srb0.Tx_buffer.payload_size =
do_RRCConnectionReject(ctxt_pP->module_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+ (uint8_t*) ue_p->Srb0.Tx_buffer.Payload);
+
LOG_DUMPMSG(RRC,DEBUG_RRC,
- (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ (char *)(ue_p->Srb0.Tx_buffer.Payload),
+ ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRCConnectionReject\n");
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ ue_p->Srb0.Tx_buffer.Header,
+ ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" LTE_RRCConnectionReject UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ ue_p->Srb0.Tx_buffer.payload_size);
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReject (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ ue_p->Srb0.Tx_buffer.payload_size);
}
//-----------------------------------------------------------------------------
@@ -1190,19 +1286,23 @@ rrc_eNB_generate_RRCConnectionReestablishment(
int cnt;
T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- SRB_configList = &ue_context_pP->ue_context.SRB_configList;
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+
+ eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
+
+ SRB_configList = &ue_p->SRB_configList;
+
+ ue_p->Srb0.Tx_buffer.payload_size =
do_RRCConnectionReestablishment(ctxt_pP,
ue_context_pP,
CC_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+ (uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
(uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList,
&ue_context_pP->ue_context.physicalConfigDedicated);
LOG_DUMPMSG(RRC,DEBUG_RRC,
- (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ (char *)(ue_p->Srb0.Tx_buffer.Payload),
+ ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRCConnectionReestablishment\n"
);
// configure SRB1 for UE
@@ -1226,69 +1326,72 @@ rrc_eNB_generate_RRCConnectionReestablishment(
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
- rrc_mac_config_req_eNB(ctxt_pP->module_id,
- ue_context_pP->ue_context.primaryCC_id,
- 0,0,0,0,0,
+ if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_mac_config_req_eNB(ctxt_pP->module_id,
+ ue_context_pP->ue_context.primaryCC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ 0,
#endif
- ctxt_pP->rnti,
- (LTE_BCCH_BCH_Message_t *) NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ ctxt_pP->rnti,
+ (LTE_BCCH_BCH_Message_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#endif
- (struct LTE_PhysicalConfigDedicated * ) ue_context_pP->ue_context.physicalConfigDedicated,
+ (struct LTE_PhysicalConfigDedicated * ) ue_context_pP->ue_context.physicalConfigDedicated,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- ue_context_pP->ue_context.mac_MainConfig,
- 1,
- SRB1_logicalChannelConfig,
- ue_context_pP->ue_context.measGapConfig,
- (LTE_TDD_Config_t *) NULL,
- NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ ue_context_pP->ue_context.mac_MainConfig,
+ 1,
+ SRB1_logicalChannelConfig,
+ ue_context_pP->ue_context.measGapConfig,
+ (LTE_TDD_Config_t *) NULL,
+ NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
- );
- break;
+ );
+ break;
+ }
}
}
}
MSC_LOG_TX_MESSAGE(MSC_RRC_ENB,
MSC_RRC_UE,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ ue_p->Srb0.Tx_buffer.Header,
+ ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishment UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ ue_p->Srb0.Tx_buffer.payload_size);
+
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishment (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
- int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
-
- if(UE_id != -1) {
- // activate release timer, if RRCComplete not received after 100 frames, remove UE
- RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
- // remove UE after 100 frames after LTE_RRCConnectionReestablishmentRelease is triggered
- RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000;
- } else {
- LOG_E(RRC,
- PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishment without UE_id(MAC) rnti %x\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti);
+ ue_p->Srb0.Tx_buffer.payload_size);
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+ if(UE_id != -1){
+ // activate release timer, if RRCComplete not received after 100 frames, remove UE
+ RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
+ // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered
+ RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000;
+ } else{
+ LOG_E(RRC,
+ PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishment without UE_id(MAC) rnti %x\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rnti);
+ }
}
-
// activate release timer, if RRCComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_reestablishment_timer = 1;
// remove UE after 100 frames after LTE_RRCConnectionReestablishmentRelease is triggered
@@ -1404,50 +1507,50 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
//ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2;
if (EPC_MODE_ENABLED) {
- hashtable_rc_t h_rc;
- int j;
- rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL;
- uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
- uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
- eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)];
+ hashtable_rc_t h_rc;
+ int j;
+ rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL;
+ uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
+ uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+ eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)];
- if (eNB_ue_s1ap_id > 0) {
- h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&rrc_ue_s1ap_ids_p);
+ if (eNB_ue_s1ap_id > 0) {
+ h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&rrc_ue_s1ap_ids_p);
- if (h_rc == HASH_TABLE_OK) {
- rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
- }
+ if (h_rc == HASH_TABLE_OK) {
+ rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
}
+ }
- if (ue_initial_id != 0) {
- h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_s1ap_ids_p);
+ if (ue_initial_id != 0) {
+ h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_s1ap_ids_p);
- if (h_rc == HASH_TABLE_OK) {
- rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
- }
+ if (h_rc == HASH_TABLE_OK) {
+ rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
}
+ }
- gtpv1u_enb_create_tunnel_req_t create_tunnel_req;
- /* Save e RAB information for later */
- memset(&create_tunnel_req, 0, sizeof(create_tunnel_req));
+ gtpv1u_enb_create_tunnel_req_t create_tunnel_req;
+ /* Save e RAB information for later */
+ memset(&create_tunnel_req, 0, sizeof(create_tunnel_req));
- for ( j = 0, i = 0; i < NB_RB_MAX; i++) {
- if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED || ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_DONE) {
- create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
- create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
- memcpy(&create_tunnel_req.sgw_addr[j],
- &ue_context_pP->ue_context.e_rab[i].param.sgw_addr,
- sizeof(transport_layer_addr_t));
- j++;
- }
+ for ( j = 0, i = 0; i < NB_RB_MAX; i++) {
+ if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED || ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_DONE) {
+ create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+ create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+ memcpy(&create_tunnel_req.sgw_addr[j],
+ &ue_context_pP->ue_context.e_rab[i].param.sgw_addr,
+ sizeof(transport_layer_addr_t));
+ j++;
}
+ }
- create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above
- create_tunnel_req.num_tunnels = j;
- gtpv1u_update_s1u_tunnel(
- ctxt_pP->instance,
- &create_tunnel_req,
- reestablish_rnti);
+ create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above
+ create_tunnel_req.num_tunnels = j;
+ gtpv1u_update_s1u_tunnel(
+ ctxt_pP->instance,
+ &create_tunnel_req,
+ reestablish_rnti);
} /* EPC_MODE_ENABLED */
/* Update RNTI in ue_context */
@@ -1455,12 +1558,12 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
ue_context_pP->ue_context.rnti = ctxt_pP->rnti;
if (EPC_MODE_ENABLED) {
- uint8_t send_security_mode_command = FALSE;
- rrc_pdcp_config_security(
- ctxt_pP,
- ue_context_pP,
- send_security_mode_command);
- LOG_D(RRC, "set security successfully \n");
+ uint8_t send_security_mode_command = FALSE;
+ rrc_pdcp_config_security(
+ ctxt_pP,
+ ue_context_pP,
+ send_security_mode_command);
+ LOG_D(RRC, "set security successfully \n");
}
// Measurement ID list
@@ -1738,6 +1841,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
}
/* TODO should test if e RAB are Ok before! */
ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+ ue_context_pP->ue_context.e_rab[i].xid = xid;
LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n",
i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
}
@@ -1878,6 +1982,7 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject(
)
//-----------------------------------------------------------------------------
{
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
if(UE_id != -1) {
@@ -1888,29 +1993,34 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject(
PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishmentReject without UE_id(MAC) rnti %x\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti);
}
-
+ }
T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+
+ eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
+
+ ue_p->Srb0.Tx_buffer.payload_size =
do_RRCConnectionReestablishmentReject(ctxt_pP->module_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+ (uint8_t*) ue_p->Srb0.Tx_buffer.Payload);
+
LOG_DUMPMSG(RRC,DEBUG_RRC,
- (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ (char *)(ue_p->Srb0.Tx_buffer.Payload),
+ ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRCConnectionReestablishmentReject\n");
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ ue_p->Srb0.Tx_buffer.Header,
+ ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishmentReject UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ ue_p->Srb0.Tx_buffer.payload_size);
+
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishmentReject (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ ue_p->Srb0.Tx_buffer.payload_size);
}
//-----------------------------------------------------------------------------
@@ -1977,13 +2087,23 @@ rrc_eNB_generate_RRCConnectionRelease(
}
pthread_mutex_unlock(&rrc_release_freelist);
- rrc_data_req(ctxt_pP,
- DCCH,
- rrc_eNB_mui++,
- SDU_CONFIRM_NO,
- size,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
+ if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = buffer;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size;
+ itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
+ } else {
+ rrc_data_req(ctxt_pP,
+ DCCH,
+ rrc_eNB_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+ }
}
uint8_t qci_to_priority[9]= {2,4,3,5,1,6,7,8,9};
@@ -2840,41 +2960,41 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *cons
LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode);
if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm3) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
}
} else {
LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
@@ -2882,11 +3002,11 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *cons
if ((*physicalConfigDedicated)->cqi_ReportConfig) {
if ((rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
- (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
- (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
- //feedback mode needs to be set as well
- //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
- printf("setting cqi reporting mode to rm31\n");
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
+ //feedback mode needs to be set as well
+ //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+ printf("setting cqi reporting mode to rm31\n");
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31;
#else
@@ -2942,8 +3062,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *cons
memset((void *)MeasObj, 0, sizeof(*MeasObj));
MeasObj->measObjectId = 1;
MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
- MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq,
- RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL);
+ MeasObj->measObject.choice.measObjectEUTRA.carrierFreq =
+ to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]);
MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25;
MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
@@ -3473,41 +3595,41 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode);
if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm3) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
} else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
}
} else {
LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
@@ -3515,11 +3637,11 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
if ((*physicalConfigDedicated)->cqi_ReportConfig) {
if ((rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
- (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
- (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
- //feedback mode needs to be set as well
- //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
- printf("setting cqi reporting mode to rm31\n");
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
+ //feedback mode needs to be set as well
+ //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+ printf("setting cqi reporting mode to rm31\n");
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31;
#else
@@ -4204,11 +4326,11 @@ check_handovers(
ctxt_pP->module_id, ctxt_pP->frame, ue_context_p->ue_context.rnti);
rrc_data_req(
ctxt_pP,
- DCCH,
- rrc_eNB_mui++,
- SDU_CONFIRM_NO,
- ue_context_p->ue_context.handover_info->size,
- ue_context_p->ue_context.handover_info->buf,
+ DCCH,
+ rrc_eNB_mui++,
+ SDU_CONFIRM_NO,
+ ue_context_p->ue_context.handover_info->size,
+ ue_context_p->ue_context.handover_info->buf,
PDCP_TRANSMISSION_MODE_CONTROL);
ue_context_p->ue_context.handover_info->state = HO_COMPLETE;
@@ -4764,8 +4886,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
memset((void *)MeasObj, 0, sizeof(*MeasObj));
MeasObj->measObjectId = 1;
MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
- MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq,
- RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL);
+ MeasObj->measObject.choice.measObjectEUTRA.carrierFreq =
+ to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]);
MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25;
MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
@@ -4993,8 +5117,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength;
//End of configuration of radioResourceConfigCommon
mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090
- mobilityInfo->carrierFreq->dl_CarrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq,
- RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL);
+ mobilityInfo->carrierFreq->dl_CarrierFreq =
+ to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0],
+ RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]);
mobilityInfo->carrierFreq->ul_CarrierFreq = NULL;
mobilityInfo->carrierBandwidth = CALLOC(1, sizeof(
*mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25
@@ -5190,18 +5316,18 @@ rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protoc
);
if (EPC_MODE_ENABLED) {
- rrc_eNB_process_security (
- ctxt_pP,
- ue_context_p,
- &ue_context_p->ue_context.security_capabilities);
- process_eNB_security_key (
- ctxt_pP,
- ue_context_p,
- ue_context_p->ue_context.kenb);
- rrc_pdcp_config_security(
- ctxt_pP,
- ue_context_p,
- FALSE);
+ rrc_eNB_process_security (
+ ctxt_pP,
+ ue_context_p,
+ &ue_context_p->ue_context.security_capabilities);
+ process_eNB_security_key (
+ ctxt_pP,
+ ue_context_p,
+ ue_context_p->ue_context.kenb);
+ rrc_pdcp_config_security(
+ ctxt_pP,
+ ue_context_p,
+ FALSE);
}
// Add a new user (called during the HO procedure)
@@ -5245,9 +5371,9 @@ rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protoc
(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
);
-#if 0
-}
-#endif
+//#if 0
+//}
+//#endif
}
//-----------------------------------------------------------------------------
@@ -5387,32 +5513,32 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
if (!EPC_MODE_ENABLED && !ENB_NAS_USE_TUN) {
- LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
- ctxt_pP->module_id,
- ctxt_pP->module_id);
- oip_ifup = nas_config(
- ctxt_pP->module_id, // interface index
+ LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
+ ctxt_pP->module_id,
+ ctxt_pP->module_id);
+ oip_ifup = nas_config(
+ ctxt_pP->module_id, // interface index
ctxt_pP->module_id + 1, // thrid octet
ctxt_pP->module_id + 1, // fourth octet
"oai");
- if (oip_ifup == 0) { // interface is up --> send a config the DRB
- module_id_t ue_module_id;
- dest_ip_offset = 8;
- LOG_I(OIP,
- "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
- ctxt_pP->module_id, ctxt_pP->module_id,
+ if (oip_ifup == 0) { // interface is up --> send a config the DRB
+ module_id_t ue_module_id;
+ dest_ip_offset = 8;
+ LOG_I(OIP,
+ "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
+ ctxt_pP->module_id, ctxt_pP->module_id,
(long int)((ue_context_pP->local_uid * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity));
- ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid];
- rb_conf_ipv4(0, //add
- ue_module_id, //cx
- ctxt_pP->module_id, //inst
+ ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid];
+ rb_conf_ipv4(0, //add
+ ue_module_id, //cx
+ ctxt_pP->module_id, //inst
(ue_module_id * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB
- 0, //dscp
- ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr
- ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr
- LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n",
- ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
+ 0, //dscp
+ ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr
+ ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr
+ LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n",
+ ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
} /* oip_ifup */
} /* !EPC_MODE_ENABLED && ENB_NAS_USE_TUN*/
@@ -5424,98 +5550,102 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity;
}
- rrc_mac_config_req_eNB(
- ctxt_pP->module_id,
- ue_context_pP->ue_context.primaryCC_id,
- 0,0,0,0,0,
+ if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_mac_config_req_eNB(ctxt_pP->module_id,
+ ue_context_pP->ue_context.primaryCC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ 0,
#endif
- ue_context_pP->ue_context.rnti,
- (LTE_BCCH_BCH_Message_t *) NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ ue_context_pP->ue_context.rnti,
+ (LTE_BCCH_BCH_Message_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#endif
- ue_context_pP->ue_context.physicalConfigDedicated,
+ ue_context_pP->ue_context.physicalConfigDedicated,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- ue_context_pP->ue_context.mac_MainConfig,
- DRB2LCHAN[i],
- DRB_configList->list.array[i]->logicalChannelConfig,
- ue_context_pP->ue_context.measGapConfig,
- (LTE_TDD_Config_t *) NULL,
- NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ ue_context_pP->ue_context.mac_MainConfig,
+ DRB2LCHAN[i],
+ DRB_configList->list.array[i]->logicalChannelConfig,
+ ue_context_pP->ue_context.measGapConfig,
+ (LTE_TDD_Config_t *) NULL,
+ NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,
+ (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
- );
- } else { // remove LCHAN from MAC/PHY
- if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
+ );
+ }
+ } else { // remove LCHAN from MAC/PHY
+
+ if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
// DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
*/
- rrc_rlc_config_req(
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- CONFIG_ACTION_REMOVE,
- DRB2LCHAN[i],
- Rlc_info_um);
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_rlc_config_req(ctxt_pP,
+ SRB_FLAG_NO,
+ MBMS_FLAG_NO,
+ CONFIG_ACTION_REMOVE,
+ DRB2LCHAN[i],
+ Rlc_info_um);
+ }
}
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
- rrc_mac_config_req_eNB(ctxt_pP->module_id,
- ue_context_pP->ue_context.primaryCC_id,
- 0,0,0,0,0,
+ if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_mac_config_req_eNB(ctxt_pP->module_id,
+ ue_context_pP->ue_context.primaryCC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ 0,
#endif
- ue_context_pP->ue_context.rnti,
- (LTE_BCCH_BCH_Message_t *) NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ ue_context_pP->ue_context.rnti,
+ (LTE_BCCH_BCH_Message_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#endif
- ue_context_pP->ue_context.physicalConfigDedicated,
+ ue_context_pP->ue_context.physicalConfigDedicated,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- ue_context_pP->ue_context.mac_MainConfig,
- DRB2LCHAN[i],
- (LTE_LogicalChannelConfig_t *) NULL,
- (LTE_MeasGapConfig_t *) NULL,
- (LTE_TDD_Config_t *) NULL,
- NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, NULL
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ ue_context_pP->ue_context.mac_MainConfig,
+ DRB2LCHAN[i],
+ (LTE_LogicalChannelConfig_t *) NULL,
+ (LTE_MeasGapConfig_t *) NULL,
+ (LTE_TDD_Config_t *) NULL,
+ NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,
+ (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
- );
+ );
+ }
}
}
}
-
free(DRB_configList);
ue_context_pP->ue_context.DRB_configList2[xid] = NULL;
}
@@ -5539,9 +5669,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
//-----------------------------------------------------------------------------
void rrc_eNB_generate_RRCConnectionSetup(const protocol_ctxt_t *const ctxt_pP,
- rrc_eNB_ue_context_t *const ue_context_pP,
- const int CC_id
- )
+ rrc_eNB_ue_context_t *const ue_context_pP,
+ const int CC_id
+ )
//-----------------------------------------------------------------------------
{
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
@@ -5551,120 +5681,165 @@ void rrc_eNB_generate_RRCConnectionSetup(const protocol_ctxt_t *const ctxt_pP,
LTE_SRB_ToAddModList_t **SRB_configList;
LTE_SRB_ToAddMod_t *SRB1_config;
int cnt;
+ MessageDef *message_p;
+
T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- SRB_configList = &ue_context_pP->ue_context.SRB_configList;
+
+ eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
+
+ SRB_configList = &ue_p->SRB_configList;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (is_mtc) {
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+ ue_p->Srb0.Tx_buffer.payload_size =
do_RRCConnectionSetup_BR(ctxt_pP,
- ue_context_pP,
- CC_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
- (const uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
- rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
- SRB_configList,
- &ue_context_pP->ue_context.physicalConfigDedicated);
+ ue_context_pP,
+ CC_id,
+ (uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
+ (const uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+ rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+ SRB_configList,
+ &ue_context_pP->ue_context.physicalConfigDedicated);
} else
#endif
{
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+ ue_p->Srb0.Tx_buffer.payload_size =
do_RRCConnectionSetup(ctxt_pP,
- ue_context_pP,
- CC_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
- (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
- rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
- SRB_configList,
- &ue_context_pP->ue_context.physicalConfigDedicated);
+ ue_context_pP,
+ CC_id,
+ (uint8_t*) ue_p->Srb0.Tx_buffer.Payload,
+ (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+ rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+ SRB_configList,
+ &ue_context_pP->ue_context.physicalConfigDedicated);
}
- LOG_DUMPMSG(RRC,DEBUG_RRC,
- (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
- "[MSG] RRC Connection Setup\n");
-
- // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE
-
- if (*SRB_configList != NULL) {
+ LOG_DUMPMSG(RRC,DEBUG_RRC,
+ (char *)(ue_p->Srb0.Tx_buffer.Payload),
+ ue_p->Srb0.Tx_buffer.payload_size,
+ "[MSG] RRC Connection Setup\n");
+
+ // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+ switch (RC.rrc[ctxt_pP->module_id]->node_type){
+ case ngran_eNB_CU :
+ case ngran_ng_eNB_CU :
+ case ngran_gNB_CU :
+ // create an ITTI message
+ /* TODO: F1 IDs ar missing in RRC */
+ message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_DL_RRC_MESSAGE);
+ F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)ue_p->Srb0.Tx_buffer.Payload;
+
+ F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
+ F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
+ F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
+ F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
+ F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti;
+ F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH;
+ F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
+ F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
+ itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
+ LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
+ break;
+ case ngran_eNB_DU :
+ case ngran_gNB_DU :
+ // nothing to do for DU
+ AssertFatal(1==0,"nothing to do for DU\n");
+ break;
+ case ngran_eNB:
+ case ngran_ng_eNB :
+ case ngran_gNB :
+
+ if (*SRB_configList != NULL) {
for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
- SRB1_config = (*SRB_configList)->list.array[cnt];
-
- if (SRB1_config->logicalChannelConfig) {
- if (SRB1_config->logicalChannelConfig->present ==
- LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
- SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
- } else {
- SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
- }
- } else {
- SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
- }
-
- LOG_D(RRC,
- PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
- rrc_mac_config_req_eNB(
- ctxt_pP->module_id,
- ue_context_pP->ue_context.primaryCC_id,
- 0,0,0,0,0,
+ SRB1_config = (*SRB_configList)->list.array[cnt];
+
+ if (SRB1_config->logicalChannelConfig) {
+ if (SRB1_config->logicalChannelConfig->present ==
+ LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+ SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
+ } else {
+ SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+ }
+ } else {
+ SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+ }
+
+ LOG_D(RRC,
+ PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+ if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) {
+ rrc_mac_config_req_eNB(ctxt_pP->module_id,
+ ue_context_pP->ue_context.primaryCC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ 0,
#endif
- ue_context_pP->ue_context.rnti,
- (LTE_BCCH_BCH_Message_t *) NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ ue_context_pP->ue_context.rnti,
+ (LTE_BCCH_BCH_Message_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
#endif
- ue_context_pP->ue_context.physicalConfigDedicated,
+ ue_context_pP->ue_context.physicalConfigDedicated,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- ue_context_pP->ue_context.mac_MainConfig,
- 1,
- SRB1_logicalChannelConfig,
- ue_context_pP->ue_context.measGapConfig,
- (LTE_TDD_Config_t *) NULL,
- NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ ue_context_pP->ue_context.mac_MainConfig,
+ 1,
+ SRB1_logicalChannelConfig,
+ ue_context_pP->ue_context.measGapConfig,
+ (LTE_TDD_Config_t *) NULL,
+ NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,
+ (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
);
- break;
}
}
-
- MSC_LOG_TX_MESSAGE(
- MSC_RRC_ENB,
- MSC_RRC_UE,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
- MSC_AS_TIME_FMT" LTE_RRCConnectionSetup UE %x size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- ue_context_pP->ue_context.rnti,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
- LOG_I(RRC,
- PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionSetup (bytes %d)\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
- //ue_context_pP->ue_context.ue_release_timer_thres=100;
- // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
- ue_context_pP->ue_context.ue_release_timer=1;
- // remove UE after 10 frames after LTE_RRCConnectionRelease is triggered
- ue_context_pP->ue_context.ue_release_timer_thres=1000;
+ }
+
+ break;
+ default :
+ LOG_W(RRC, "Unknown node type %d\n", RC.rrc[ctxt_pP->module_id]->node_type);
+ }
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_RRC_ENB,
+ MSC_RRC_UE,
+ ue_p->Srb0.Tx_buffer.Header, // LG WARNING
+ ue_p->Srb0.Tx_buffer.payload_size,
+ MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ ue_context_pP->ue_context.rnti,
+ ue_p->Srb0.Tx_buffer.payload_size);
+
+
+ LOG_I(RRC,
+ PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+ ue_p->Srb0.Tx_buffer.payload_size);
+
+ //ue_context_pP->ue_context.ue_release_timer_thres=100;
+ // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
+ ue_context_pP->ue_context.ue_release_timer=1;
+ // remove UE after 10 frames after RRCConnectionRelease is triggered
+ ue_context_pP->ue_context.ue_release_timer_thres=1000;
}
}
+void setup_ngran_CU(eNB_RRC_INST *rrc) {
+
+
+}
//-----------------------------------------------------------------------------
char openair_rrc_eNB_configuration(
@@ -5692,9 +5867,8 @@ char openair_rrc_eNB_configuration(
AssertFatal(configuration!=NULL,"configuration input is null\n");
RC.rrc[ctxt.module_id]->Nb_ue = 0;
- for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0;
- }
+ pthread_mutex_init(&RC.rrc[ctxt.module_id]->cell_info_mutex,NULL);
+ RC.rrc[ctxt.module_id]->cell_info_configured = 0;
uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator);
RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head);
@@ -5703,7 +5877,7 @@ char openair_rrc_eNB_configuration(
// }
RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL);
RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL);
- memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq));
+
/// System Information INIT
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n",
PROTOCOL_RRC_CTXT_ARGS(&ctxt));
@@ -5745,10 +5919,7 @@ char openair_rrc_eNB_configuration(
#endif
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- init_SI(&ctxt,
- CC_id
- , configuration
- );
+ init_SI(&ctxt, CC_id, configuration);
for (int ue_id = 0; ue_id < MAX_MOBILES_PER_ENB; ue_id++) {
RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0;
@@ -5789,15 +5960,31 @@ char openair_rrc_eNB_configuration(
#endif
openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0);
}
+
openair_rrc_on(&ctxt);
+
+/*
+ RC.rrc[ctxt.module_id]->mcc= rrc_configuration_req->mcc;
+ RC.rrc[ctxt.module_id]->mnc= rrc_configuration_req->mnc;
+ RC.rrc[ctxt.module_id]->mnc_digit_length= rrc_configuration_req->mnc_digit_length;
+ RC.rrc[ctxt.module_id]->tac= rrc_configuration_req->tac;
+
+ LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc);
+ */
+ if (NODE_IS_CU(RC.rrc[ctxt.module_id]->node_type))
+ // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ);
+ // RCconfig_CU_F1(msg_p, enb_id);
+ setup_ngran_CU(RC.rrc[ctxt.module_id]);
+
return 0;
}
/*------------------------------------------------------------------------------*/
int
rrc_eNB_decode_ccch(
- protocol_ctxt_t *const ctxt_pP,
- const SRB_INFO *const Srb_info,
+ protocol_ctxt_t* const ctxt_pP,
+ const uint8_t *buffer,
+ int buffer_length,
const int CC_id
)
//-----------------------------------------------------------------------------
@@ -5816,17 +6003,17 @@ rrc_eNB_decode_ccch(
//memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[0],
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[1],
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[2],
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[3],
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[4],
- ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload);
+ ((uint8_t*) buffer)[0],
+ ((uint8_t *) buffer)[1],
+ ((uint8_t *) buffer)[2],
+ ((uint8_t *) buffer)[3],
+ ((uint8_t *) buffer)[4],
+ ((uint8_t *) buffer)[5], (uint8_t *) buffer);
dec_rval = uper_decode(
NULL,
&asn_DEF_LTE_UL_CCCH_Message,
(void **)&ul_ccch_msg,
- (uint8_t *) Srb_info->Rx_buffer.Payload,
+ (uint8_t *) buffer,
100,
0,
0);
@@ -5853,8 +6040,7 @@ rrc_eNB_decode_ccch(
case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest:
T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload),
- Srb_info->Rx_buffer.payload_size,
+ LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(buffer), buffer_length,
"[MSG] RRC Connection Reestablishment Request\n");
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n",
@@ -6025,13 +6211,15 @@ rrc_eNB_decode_ccch(
NULL
, (LTE_PMCH_InfoList_r9_t *) NULL
,NULL);
- rrc_rlc_config_asn1_req(ctxt_pP,
- ue_context_p->ue_context.SRB_configList,
- (LTE_DRB_ToAddModList_t *) NULL,
- (LTE_DRB_ToReleaseList_t *) NULL
- , (LTE_PMCH_InfoList_r9_t *) NULL,
- 0,0
- );
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_rlc_config_asn1_req(ctxt_pP,
+ ue_context_p->ue_context.SRB_configList,
+ (LTE_DRB_ToAddModList_t *) NULL,
+ (LTE_DRB_ToReleaseList_t *) NULL
+ , (LTE_PMCH_InfoList_r9_t *) NULL,
+ 0,0
+ );
+ }
#endif //NO_RRM
}
break;
@@ -6039,8 +6227,9 @@ rrc_eNB_decode_ccch(
case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
- LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload),
- Srb_info->Rx_buffer.payload_size,
+
+ LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,
+ buffer_length,
"[MSG] RRC Connection Request\n");
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n",
@@ -6055,7 +6244,7 @@ rrc_eNB_decode_ccch(
MSC_LOG_RX_DISCARDED_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
- Srb_info->Rx_buffer.Payload,
+ buffer,
dec_rval.consumed,
MSC_AS_TIME_FMT" LTE_RRCConnectionRequest UE %x size %u (UE already in context)",
MSC_AS_TIME_ARGS(ctxt_pP),
@@ -6085,6 +6274,14 @@ rrc_eNB_decode_ccch(
}
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
+
+ ue_context_p->ue_context.Srb0.Srb_id = 0;
+ ue_context_p->ue_context.Srb0.Active = 1;
+ memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload,
+ buffer,
+ buffer_length);
+ ue_context_p->ue_context.Srb0.Rx_buffer.payload_size = buffer_length;
+
} else if (LTE_InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
/* Save s-TMSI */
LTE_S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
@@ -6094,7 +6291,20 @@ rrc_eNB_decode_ccch(
if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) {
LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti);
- rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
+
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
+ }
+ else {
+ MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
+ itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
+ }
+
stmsi_received=1;
/* replace rnti in the context */
/* for that, remove the context from the RB tree */
@@ -6131,7 +6341,7 @@ rrc_eNB_decode_ccch(
MSC_LOG_RX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
- Srb_info->Rx_buffer.Payload,
+ buffer,
dec_rval.consumed,
MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")",
MSC_AS_TIME_ARGS(ctxt_pP),
@@ -6177,8 +6387,8 @@ rrc_eNB_decode_ccch(
RC.rrc[ctxt_pP->module_id]->Nb_ue++;
} else {
// no context available
- if (rrc_agent_registered[ctxt_pP->module_id]) {
- agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+ if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) {
+ flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ctxt_pP->rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
@@ -6186,7 +6396,17 @@ rrc_eNB_decode_ccch(
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
random_value);
- rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
+ if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type))
+ rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
+ else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
+ F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
+ itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
+ }
return -1;
}
}
@@ -6239,15 +6459,18 @@ rrc_eNB_decode_ccch(
, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
,NULL);
- rrc_rlc_config_asn1_req(ctxt_pP,
- ue_context_p->ue_context.SRB_configList,
- (LTE_DRB_ToAddModList_t *) NULL,
- (LTE_DRB_ToReleaseList_t *) NULL
+
+ if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
+ rrc_rlc_config_asn1_req(ctxt_pP,
+ ue_context_p->ue_context.SRB_configList,
+ (LTE_DRB_ToAddModList_t *) NULL,
+ (LTE_DRB_ToReleaseList_t *) NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- , (LTE_PMCH_InfoList_r9_t *) NULL
- , 0, 0
+ , (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, 0
#endif
- );
+ );
+ }
#endif //NO_RRM
break;
@@ -6405,6 +6628,9 @@ rrc_eNB_decode_dcch(
break;
}
+ AssertFatal(!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type),
+ "CU cannot decode DCCH: no access to RC.mac[]\n");
+
if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1) {
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld) C-RNTI Complete\n",
@@ -6451,8 +6677,8 @@ rrc_eNB_decode_dcch(
ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
- if (rrc_agent_registered[ctxt_pP->module_id]) {
- agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+ if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) {
+ flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
}
@@ -6607,8 +6833,8 @@ rrc_eNB_decode_dcch(
&ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8);
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
- if (mac_agent_registered[ctxt_pP->module_id]) {
- agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+ if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) {
+ flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
}
@@ -6652,6 +6878,8 @@ rrc_eNB_decode_dcch(
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.
present ==
LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) {
+ AssertFatal(!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type),
+ "should not be reached in DU\n");
rrc_eNB_process_RRCConnectionSetupComplete(
ctxt_pP,
ue_context_p,
@@ -6660,8 +6888,8 @@ rrc_eNB_decode_dcch(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
- if (rrc_agent_registered[ctxt_pP->module_id]) {
- agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+ if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) {
+ flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
}
@@ -6818,9 +7046,9 @@ rrc_eNB_decode_dcch(
}
if (EPC_MODE_ENABLED) {
- rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP,
- ue_context_p,
- ul_dcch_msg);
+ rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP,
+ ue_context_p,
+ ul_dcch_msg);
} else {
ue_context_p->ue_context.nb_of_e_rabs = 1;
@@ -6920,7 +7148,7 @@ rrc_eNB_decode_dcch(
return 0;
//TTN for D2D
} else if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_messageClassExtension) {
- LOG_I(RRC, "THINH [UL_DCCH_MessageType_PR_messageClassExtension]\n");
+ LOG_I(RRC, "THINH [LTE_UL_DCCH_MessageType_PR_messageClassExtension]\n");
switch (ul_dcch_msg->message.choice.messageClassExtension.present) {
case LTE_UL_DCCH_MessageType__messageClassExtension_PR_NOTHING: /* No components present */
@@ -6928,7 +7156,7 @@ rrc_eNB_decode_dcch(
case LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2: //SidelinkUEInformation
//case UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12: //SidelinkUEInformation
- LOG_I(RRC,"THINH [UL_DCCH_MessageType__messageClassExtension_PR_c2]\n");
+ LOG_I(RRC,"THINH [LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2]\n");
LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] RRC SidelinkUEInformation \n");
MSC_LOG_RX_MESSAGE(
@@ -6998,6 +7226,120 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0);
}
+void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
+
+
+ LOG_I(RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name);
+
+ //uint16_t num_cells_to_activate = 0;
+
+ int cu_cell_ind=0;
+
+ MessageDef *msg_p = NULL;
+
+ //LOG_W(RRC,"num_cells_available %d \n", f1_setup_req->num_cells_available);
+ for (int i=0;inum_cells_available;i++) {
+ // check that mcc/mnc match and grab MIB/SIB1
+ int found_cell=0;
+ for (int j=0;jconfiguration.mcc[0] == f1_setup_req->mcc[i] &&
+ rrc->configuration.mnc[0] == f1_setup_req->mnc[i] &&
+ rrc->nr_cellid == f1_setup_req->nr_cellid[i]) {
+ // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
+
+ rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]);
+ rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i];
+ LOG_W(RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]);
+ LOG_W(RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]);
+
+ memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]);
+ asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
+ &asn_DEF_LTE_BCCH_BCH_Message,
+ (void **)&rrc->carrier[0].mib_DU,
+ f1_setup_req->mib[i],
+ f1_setup_req->mib_length[i]);
+ AssertFatal(dec_rval.code == RC_OK,
+ "[eNB_DU %"PRIu8"] Failed to decode LTE_BCCH_BCH_MESSAGE (%zu bits)\n",
+ j,
+ dec_rval.consumed );
+ LTE_BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib;
+ LTE_BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU;
+ mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth;
+ mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource;
+ mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration;
+
+ rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]);
+ rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i];
+ memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]);
+ dec_rval = uper_decode_complete(NULL,
+ &asn_DEF_LTE_BCCH_DL_SCH_Message,
+ (void **)&rrc->carrier[0].siblock1_DU,
+ f1_setup_req->sib1[i],
+ f1_setup_req->sib1_length[i]);
+ AssertFatal(dec_rval.code == RC_OK,
+ "[eNB_DU %"PRIu8"] Failed to decode LTE_BCCH_DLSCH_MESSAGE (%zu bits)\n",
+ j,
+ dec_rval.consumed );
+ // Parse message and extract SystemInformationBlockType1 field
+ LTE_BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU;
+ AssertFatal(bcch_message->message.present == LTE_BCCH_DL_SCH_MessageType_PR_c1,
+ "bcch_message->message.present != LTE_BCCH_DL_SCH_MessageType_PR_c1\n");
+ AssertFatal(bcch_message->message.choice.c1.present == LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
+ "bcch_message->message.choice.c1.present != LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
+ rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
+ rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i];
+ // prepare F1_SETUP_RESPONSE
+
+ if (msg_p == NULL) {
+ msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP);
+ }
+ F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
+ F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->configuration.mcc[0];
+ F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->configuration.mnc[0];
+ F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->configuration.mnc_digit_length[0];
+ F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid;
+ F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i];
+ int num_SI= 0;
+ if (rrc->carrier[0].SIB23) {
+ F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23;
+ F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23;
+ //printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]);
+ //for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]; n++)
+ // printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][num_SI][n]);
+ //printf("\n");
+ num_SI++;
+ }
+ F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI;
+
+ cu_cell_ind++;
+ found_cell=1;
+
+ F1AP_SETUP_RESP (msg_p).num_cells_to_activate = cu_cell_ind;
+ // send ITTI message to F1AP-CU task
+ itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), msg_p);
+ break;
+ } else {// setup_req mcc/mnc match rrc internal list element
+
+ LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n",
+ j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],rrc->configuration.mnc[0], f1_setup_req->mnc[i]);
+
+ }
+ }// for (int j=0;jnode_name;
+ F1AP_SETUP_RESP (msg_p).time_to_wait = rrc->node_id;
+ F1AP_SETUP_RESP (msg_p).criticality_diagnostics = rrc->node_name;*/
+ }
+ // handle other failure cases
+ }//for (int i=0;inum_cells_available;i++)
+}
+
+
+ // ignore 5GNR fields for now, just take MIB and SIB1
+//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void rrc_enb_init(void) {
pthread_mutex_init(&lock_ue_freelist, NULL);
@@ -7015,7 +7357,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
struct rrc_eNB_ue_context_s *ue_to_be_removed = NULL;
#ifdef LOCALIZATION
double estimated_distance = 0;
- protocol_ctxt_t ctxt;
+ protocol_ctxt_t ctxt;
#endif
MessageDef *msg;
@@ -7026,7 +7368,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_SUBFRAME_PROCESS);
itti_send_msg_to_task(TASK_X2AP, ctxt_pP->module_id, msg);
- check_handovers(ctxt_pP); // counter, get the value and aggregate
+ check_handovers(ctxt_pP); // counter, get the value and aggregate
}
// check for UL failure or for UE to be released
@@ -7066,7 +7408,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
ue_context_p->ue_context.rnti,
ue_context_p->ue_context.ue_release_timer_thres_s1);
- if (EPC_MODE_ENABLED)
+ if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type))
rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p);
else
ue_to_be_removed = ue_context_p;
@@ -7119,44 +7461,30 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
ue_context_p->ue_context.ue_release_timer_rrc = 1;
ue_context_p->ue_context.ue_release_timer_thres_rrc = 100;
- if (EPC_MODE_ENABLED) {
- int e_rab = 0;
- MessageDef *msg_complete_p = NULL;
- MessageDef *msg_delete_tunnels_p = NULL;
- uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id;
-
+ if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) {
if (rrc_release_info.RRC_release_ctrl[release_num].flag == 4) { // if timer_s1 == 0
- MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0,
- "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ",
- eNB_ue_s1ap_id);
- msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE);
- S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id;
- itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p);
+ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(ctxt_pP->module_id,
+ ue_context_p->ue_context.eNB_ue_s1ap_id);
}
- MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id);
- msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
- memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
- // do not wait response
- GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
-
- for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
- GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] =
- ue_context_p->ue_context.enb_gtp_ebi[e_rab];
- // erase data
+ rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(ctxt_pP->module_id,
+ ue_context_p);
+ // erase data of GTP tunnels in UE context
+ for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0;
- memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab]));
- ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
+ memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab],
+ 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab]));
+ ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
}
- itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p);
struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL;
- rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id);
+ rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0,
+ ue_context_p->ue_context.eNB_ue_s1ap_id);
if (rrc_ue_s1ap_ids != NULL) {
rrc_eNB_S1AP_remove_ue_ids(RC.rrc[ctxt_pP->module_id], rrc_ue_s1ap_ids);
}
- } /* EPC_MODE_ENABLED */
+ } /* EPC_MODE_ENABLED && !NODE_IS_DU */
rrc_release_info.RRC_release_ctrl[release_num].flag = 0;
rrc_release_info.num_UEs--;
@@ -7272,8 +7600,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
const char *msg_name_p;
instance_t instance;
int result;
- SRB_INFO *srb_info_p;
- int CC_id;
protocol_ctxt_t ctxt;
memset(&ctxt, 0, sizeof(ctxt));
@@ -7299,31 +7625,31 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
/* Messages from MAC */
case RRC_MAC_CCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
- instance,
+ RRC_MAC_CCCH_DATA_IND(msg_p).enb_index,
ENB_FLAG_YES,
RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
- msg_name_p);
- CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
- srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0;
+
LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
- instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
+ instance,
+ RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
+ &ctxt,
+ RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) {
- LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
+ LOG_I(RRC, "CCCH message has size %d > %d\n",
+ RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
break;
}
- memcpy(srb_info_p->Rx_buffer.Payload,
- RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
- RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
- srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size;
- rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id);
+ rrc_eNB_decode_ccch(&ctxt,
+ (uint8_t*)RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
+ RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
+ RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
break;
+
/* Messages from PDCP */
case RRC_DCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
@@ -7491,10 +7817,18 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
/* Messages from eNB app */
case RRC_CONFIGURATION_REQ:
- LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p));
+ LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p));
openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p));
break;
+ /* Messages from F1AP task */
+ case F1AP_SETUP_REQ:
+ AssertFatal(NODE_IS_CU(RC.rrc[instance]->node_type),
+ "should not receive F1AP_SETUP_REQUEST, need call by CU!\n");
+ LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p));
+ handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p));
+ break;
+
case RRC_SUBFRAME_PROCESS:
rrc_subframe_process(&RRC_SUBFRAME_PROCESS(msg_p).ctxt, RRC_SUBFRAME_PROCESS(msg_p).CC_id);
break;
@@ -7881,4 +8215,3 @@ rrc_rx_tx(
itti_send_msg_to_task(TASK_RRC_ENB, ctxt_pP->module_id, message_p);
return RRC_OK;
}
-
diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
index c8b18bb7d1..ff8f455d6c 100644
--- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
@@ -33,8 +33,8 @@
# include "rrc_eNB_GTPV1U.h"
# include "rrc_eNB_UE_context.h"
# include "msc.h"
-# include "asn1_conversions.h"
-# include "intertask_interface.h"
+# include "asn1_conversions.h"
+# include "intertask_interface.h"
# include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
@@ -65,26 +65,50 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel (%u, %u) bearer UE context index %u, msg index %u, id %u, gtp addr len %d \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
create_tunnel_resp_pP->enb_S1u_teid[i],
- ue_context_p->ue_context.enb_gtp_teid[inde_list[i]],
+ ue_context_p->ue_context.enb_gtp_teid[inde_list[i]],
inde_list[i],
- i,
+ i,
create_tunnel_resp_pP->eps_bearer_id[i],
- create_tunnel_resp_pP->enb_addr.length);
+ create_tunnel_resp_pP->enb_addr.length);
}
- MSC_LOG_RX_MESSAGE(
- MSC_RRC_ENB,
- MSC_GTPU_ENB,
- NULL,0,
- MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u ebid %u enb-s1u teid %u",
- 0,0,rnti,
- create_tunnel_resp_pP->num_tunnels,
- ue_context_p->ue_context.enb_gtp_ebi[0],
- ue_context_p->ue_context.enb_gtp_teid[0]);
- (void)rnti; /* avoid gcc warning "set but not used" */
+ MSC_LOG_RX_MESSAGE(
+ MSC_RRC_ENB,
+ MSC_GTPU_ENB,
+ NULL,0,
+ MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u ebid %u enb-s1u teid %u",
+ 0,0,rnti,
+ create_tunnel_resp_pP->num_tunnels,
+ ue_context_p->ue_context.enb_gtp_ebi[0],
+ ue_context_p->ue_context.enb_gtp_teid[0]);
+ (void)rnti; /* avoid gcc warning "set but not used" */
return 0;
} else {
return -1;
}
}
+void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
+ module_id_t enb_mod_idP,
+ const rrc_eNB_ue_context_t* const ue_context_pP
+)
+{
+ if (!ue_context_pP) {
+ LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__);
+ return;
+ }
+
+ MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL, 0,
+ "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ",
+ ue_context_pP->ue_context.eNB_ue_s1ap_id);
+
+ MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
+ memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg)));
+ GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti;
+ GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).num_erab = ue_context_pP->ue_context.nb_of_e_rabs;
+ for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) {
+ const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab];
+ GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).eps_bearer_id[e_rab] = gtp_ebi;
+ }
+ itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg);
+}
diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h
index 0cd3f3c512..23806f6a04 100644
--- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h
+++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h
@@ -43,5 +43,14 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
uint8_t *inde_list
);
+/*! \fn rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(module_id_t enb_mod_idP, const rrc_eNB_ue_context_t* const ue_context_pP)
+ *\brief Send GTPV1U_ENB_DELETE_TUNNEL_REQ message to GTPV1U to destroy all UE-related tunnels.
+ *\param module_id Instance ID of eNB.
+ *\param ue_context_pP UE context in the eNB.
+ */
+void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
+ module_id_t enb_mod_idP,
+ const rrc_eNB_ue_context_t* const ue_context_pP
+);
#endif /* RRC_ENB_GTPV1U_H_ */
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 82818fcd1e..b26e2c1cb0 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -252,7 +252,7 @@ rrc_eNB_S1AP_get_ue_ids(
ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, eNB_ue_s1ap_id); // get s1ap_eNB_ue_context
} else {
LOG_E(S1AP, "[eNB instance %d] Couldn't find the eNB S1AP context\n",
- instance);
+ instance);
return NULL;
}
@@ -634,7 +634,7 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
== LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) {
/* This message hold a dedicated info NAS payload, forward it to NAS */
struct LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType =
- &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType;
+ &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType;
uint32_t pdu_length;
uint8_t *pdu_buffer;
MessageDef *msg_p;
@@ -1021,6 +1021,35 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
rrc_eNB_generate_UECapabilityEnquiry (&ctxt, ue_context_p);
}
}
+
+ // in case, send the S1SP initial context response if it is not sent with the attach complete message
+ if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) {
+ LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
+ //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){}
+ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
+ }
+/*
+ if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) ||
+ (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) ||
+ (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){
+
+ message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ);
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload;
+
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1;
+ F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0;
+ itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
+ LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
+
+ }
+*/
+
return (0);
}
}
@@ -1143,6 +1172,20 @@ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(
}
}
+void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(
+ module_id_t enb_mod_idP,
+ uint32_t eNB_ue_s1ap_id
+)
+{
+ MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0,
+ "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ",
+ eNB_ue_s1ap_id);
+
+ MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE);
+ S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg).eNB_ue_s1ap_id = eNB_ue_s1ap_id;
+ itti_send_msg_to_task(TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg);
+}
+
//-----------------------------------------------------------------------------
/*
@@ -1759,7 +1802,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
/* set T = min(Tc,Tue) */
T = Tc < Tue ? Ttab[Tc] : Ttab[Tue];
/* set pcch_nB = PCCH-Config->nB */
- pcch_nB = (uint32_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_nB;
+ pcch_nB = (uint32_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_nB;
switch (pcch_nB) {
case LTE_PCCH_Config__nB_fourT:
@@ -1905,12 +1948,12 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID;
rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
h_rc = hashtable_insert(RC.rrc[ctxt_pP->module_id]->initial_id2_s1ap_ids,
- (hash_key_t)ue_context_pP->ue_context.ue_initial_id,
- rrc_ue_s1ap_ids_p);
+ (hash_key_t)ue_context_pP->ue_context.ue_initial_id,
+ rrc_ue_s1ap_ids_p);
if (h_rc != HASH_TABLE_OK) {
LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n",
- ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id);
+ ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id);
}
S1AP_PATH_SWITCH_REQ (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
@@ -1923,8 +1966,8 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
S1AP_PATH_SWITCH_REQ (msg_p).security_capabilities.encryption_algorithms=ue_context_pP->ue_context.security_capabilities.encryption_algorithms;
S1AP_PATH_SWITCH_REQ (msg_p).security_capabilities.integrity_algorithms=ue_context_pP->ue_context.security_capabilities.integrity_algorithms;
LOG_I (RRC,"Path switch request: nb nb_of_e_rabs %u status %u\n",
- ue_context_pP->ue_context.nb_of_e_rabs,
- ue_context_pP->ue_context.e_rab[e_rab].status);
+ ue_context_pP->ue_context.nb_of_e_rabs,
+ ue_context_pP->ue_context.e_rab[e_rab].status);
memset(&create_tunnel_req, 0, sizeof(create_tunnel_req));
// the context for UE to be handovered is obtained through ho_req message
@@ -1944,45 +1987,45 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
create_tunnel_req.rnti = ue_context_pP->ue_context.rnti;
create_tunnel_req.num_tunnels = e_rabs_done;
gtpv1u_create_s1u_tunnel(
- ctxt_pP->instance,
- &create_tunnel_req,
- &create_tunnel_resp);
+ ctxt_pP->instance,
+ &create_tunnel_req,
+ &create_tunnel_resp);
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
- ctxt_pP,
- &create_tunnel_resp,
- &inde_list[0]);
+ ctxt_pP,
+ &create_tunnel_resp,
+ &inde_list[0]);
for (e_rab = 0; e_rab < e_rabs_done; e_rab++) {
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].e_rab_id = create_tunnel_resp.eps_bearer_id[e_rab];
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].gtp_teid = create_tunnel_resp.enb_S1u_teid[e_rab];
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr = create_tunnel_resp.enb_addr;
- LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ",
- e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[inde_list[e_rab]].status,
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].e_rab_id = create_tunnel_resp.eps_bearer_id[e_rab];
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].gtp_teid = create_tunnel_resp.enb_S1u_teid[e_rab];
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr = create_tunnel_resp.enb_addr;
+ LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ",
+ e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[inde_list[e_rab]].status,
S1AP_PATH_SWITCH_REQ (msg_p).nb_of_e_rabs,
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].e_rab_id,
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].gtp_teid,
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[0],
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[1],
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[2],
- S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[3]);
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].e_rab_id,
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].gtp_teid,
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[0],
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[1],
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[2],
+ S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].eNB_addr.buffer[3]);
}
- // NN: add conditions for e_rabs_failed
- if (e_rabs_done > 0) {
- LOG_I(RRC,"S1AP_PATH_SWITCH_REQ: sending the message: nb_of_erabstobeswitched %d, total e_rabs %d, index %d\n",
+ // NN: add conditions for e_rabs_failed
+ if (e_rabs_done > 0) {
+ LOG_I(RRC,"S1AP_PATH_SWITCH_REQ: sending the message: nb_of_erabstobeswitched %d, total e_rabs %d, index %d\n",
S1AP_PATH_SWITCH_REQ (msg_p).nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab);
- MSC_LOG_TX_MESSAGE(
- MSC_RRC_ENB,
- MSC_S1AP_ENB,
- (const char *)&S1AP_PATH_SWITCH_REQ (msg_p),
- sizeof(s1ap_path_switch_req_t),
- MSC_AS_TIME_FMT" PATH_SWITCH_REQ UE %X eNB_ue_s1ap_id %u e_rabs:%u succ",
- MSC_AS_TIME_ARGS(ctxt_pP),
- ue_context_pP->ue_id_rnti,
- S1AP_PATH_SWITCH_REQ (msg_p).eNB_ue_s1ap_id,
- e_rabs_done);
- itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
- }
+ MSC_LOG_TX_MESSAGE(
+ MSC_RRC_ENB,
+ MSC_S1AP_ENB,
+ (const char *)&S1AP_PATH_SWITCH_REQ (msg_p),
+ sizeof(s1ap_path_switch_req_t),
+ MSC_AS_TIME_FMT" PATH_SWITCH_REQ UE %X eNB_ue_s1ap_id %u e_rabs:%u succ",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ ue_context_pP->ue_id_rnti,
+ S1AP_PATH_SWITCH_REQ (msg_p).eNB_ue_s1ap_id,
+ e_rabs_done);
+ itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
+ }
return 0;
}
@@ -2036,10 +2079,10 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, const char *msg
// the index for the rec
if (nb_e_rabs_tobeswitched>0) {
int e_rab_switch_index=0;
- for (i = 0;
+ for (i = 0;
i < ue_context_p->ue_context.setup_e_rabs; // go over total number of e_rabs received through x2_ho_req msg
- i++) {
- /* Harmonize with enb_gtp_teid, enb_gtp_addrs, and enb_gtp_rbi vars in the top level structure */
+ i++) {
+ /* Harmonize with enb_gtp_teid, enb_gtp_addrs, and enb_gtp_rbi vars in the top level structure */
if (ue_context_p->ue_context.e_rab[i].param.e_rab_id == S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobeswitched[e_rab_switch_index].e_rab_id) {
ue_context_p->ue_context.e_rab[i].param.e_rab_id = S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobeswitched[e_rab_switch_index].e_rab_id;
ue_context_p->ue_context.e_rab[i].param.sgw_addr= S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobeswitched[e_rab_switch_index].sgw_addr;
@@ -2058,11 +2101,11 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, const char *msg
if (ue_context_p->ue_context.nb_release_of_e_rabs>0) {
int e_rab_release_index=0;
- for (i = 0;
+ for (i = 0;
i < ue_context_p->ue_context.setup_e_rabs;
- i++) {
+ i++) {
if (ue_context_p->ue_context.e_rab[i].param.e_rab_id == S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobereleased[e_rab_release_index].e_rab_id) {
- LOG_I(RRC,"Bearer released with ID: %d\n", ue_context_p->ue_context.e_rab[i].param.e_rab_id);
+ LOG_I(RRC,"Bearer released with ID: %d\n", ue_context_p->ue_context.e_rab[i].param.e_rab_id);
ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE;
ue_context_p->ue_context.e_rabs_tobereleased[e_rab_release_index]=S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobereleased[e_rab_release_index].e_rab_id;
delete_tunnel_req.eps_bearer_id[e_rab_release_index] = S1AP_PATH_SWITCH_REQ_ACK (msg_p).e_rabs_tobereleased[e_rab_release_index].e_rab_id;
@@ -2079,7 +2122,7 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, const char *msg
delete_tunnel_req.num_erab= ue_context_p->ue_context.nb_release_of_e_rabs;
/* this could also be done through ITTI message */
gtpv1u_delete_s1u_tunnel(instance,
- &delete_tunnel_req);
+ &delete_tunnel_req);
/* TBD: release the DRB not admitted */
//rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0);
}
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.h b/openair2/RRC/LTE/rrc_eNB_S1AP.h
index da63fc68a3..5feb55d635 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.h
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.h
@@ -73,14 +73,14 @@ rrc_eNB_S1AP_remove_ue_ids(
void
rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- const uint8_t ho_state
- );
+ const uint8_t ho_state
+ );
int
rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- const uint8_t ho_state
- );
+ const uint8_t ho_state
+ );
/*! \fn void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(uint8_t mod_id, uint8_t ue_index)
*\brief create a S1AP_INITIAL_CONTEXT_SETUP_RESP for S1AP.
@@ -148,6 +148,16 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ (
const long cause_valueP
);
+/*! \fn rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(const module_id_t enb_mod_idP, const struct rrc_eNB_ue_context_s *const ue_context_pP)
+ *\brief create a S1AP_UE_CONTEXT_RELEASE_COMPLETE message, the message is sent by the eNB to S1AP task to acknowledge/complete the release of the UE-associated S1-logical connection over the S1 interface. .
+ *\param enb_mod_idP Instance ID of eNB.
+ *\param eNB_ue_s1ap_id UE's S1AP ID in the eNB.
+ */
+void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(
+ module_id_t enb_mod_idP,
+ uint32_t eNB_ue_s1ap_id
+);
+
/* Down link procedures */
/*! \fn rrc_eNB_process_S1AP_DOWNLINK_NAS(MessageDef *msg_p, const char *msg_name, instance_t instance, mui_t *rrc_eNB_mui)
@@ -183,7 +193,7 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
*\brief send a S1AP dedicated E_RAB setup response
*\param ctxt_pP contxt infirmation
*\param e_contxt_pP ue specific context at the eNB
- *\param xid transaction identifier
+ *\param xid transaction identifier
*\return 0 when successful, -1 if the UE index can not be retrieved.
*/
int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, uint8_t xid );
diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h
index 6a69ecd272..99b77b6b61 100644
--- a/openair2/RRC/LTE/rrc_proto.h
+++ b/openair2/RRC/LTE/rrc_proto.h
@@ -62,7 +62,7 @@ openair_rrc_on_ue(
void rrc_top_cleanup(void);
-/** \brief Function to update eNB timers every subframe.
+/** \brief Function to update eNB timers every subframe.
@param ctxt_pP running context
@param enb_index
@param CC_id
@@ -220,13 +220,13 @@ uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP);
/**\brief Entry routine to decode a UL-CCCH-Message. Invokes PER decoder and parses message.
\param ctxt_pP Running context
- \param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/
-int
-rrc_eNB_decode_ccch(
- protocol_ctxt_t *const ctxt_pP,
- const SRB_INFO *const Srb_info,
- const int CC_id
-);
+ \param buffer Pointer to SDU
+ \param buffer_length length of SDU in bytes
+ \param CC_id component carrier index*/
+int rrc_eNB_decode_ccch(protocol_ctxt_t* const ctxt_pP,
+ const uint8_t *buffer,
+ int buffer_length,
+ const int CC_id);
/**\brief Entry routine to decode a UL-DCCH-Message. Invokes PER decoder and parses message.
\param ctxt_pP Context
@@ -306,16 +306,16 @@ void
flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- const uint8_t ho_state,
+ const uint8_t ho_state,
agent_reconf_rrc *trig_param
);
void
rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
uint8_t *buffer,
- int *_size
- //const uint8_t ho_state
- );
+ int *_size
+ //const uint8_t ho_state
+ );
void
rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protocol_ctxt_t *const ctxt_pP);
@@ -340,7 +340,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(
uint8_t *nas_buffer
);
-void
+void
rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *ue_context_pP);
@@ -381,8 +381,8 @@ int
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- LTE_SL_DestinationInfoList_r12_t *destinationInfoList,
- int n_discoveryMessages
+ LTE_SL_DestinationInfoList_r12_t *destinationInfoList,
+ int n_discoveryMessages
);
/** \brief process the received SidelinkUEInformation message at eNB
@@ -402,7 +402,7 @@ rrc_eNB_process_SidelinkUEInformation(
LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool(
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- LTE_SL_DestinationInfoList_r12_t *destinationInfoList
+ LTE_SL_DestinationInfoList_r12_t *destinationInfoList
);
/** \brief Get a Resource Pool for Discovery
@@ -412,7 +412,7 @@ LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool(
LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool(
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
- int n_discoveryMessages
+ int n_discoveryMessages
);
/** \brief Process request from control socket
@@ -427,6 +427,7 @@ mac_rrc_data_req(
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
+ const rnti_t rnti,
const uint8_t Nb_tb,
uint8_t *const buffer_pP,
const uint8_t mbsfn_sync_area
@@ -435,16 +436,17 @@ mac_rrc_data_req(
int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
- const int CC_id,
+ const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
+ const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- , const boolean_t brOption
+ , const boolean_t brOption
#endif
);
@@ -477,22 +479,22 @@ mac_rrc_data_ind_ue(
void mac_sync_ind( module_id_t Mod_instP, uint8_t status);
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
- const int CC_id,
- const frame_t frameP,
- const sub_frame_t subframeP,
- const rnti_t rnti);
+ const int CC_id,
+ const frame_t frameP,
+ const sub_frame_t subframeP,
+ const rnti_t rnti);
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
- const int CC_id,
- const frame_t frameP,
- const sub_frame_t subframeP,
- const rnti_t rnti);
+ const int CC_id,
+ const frame_t frameP,
+ const sub_frame_t subframeP,
+ const rnti_t rnti);
-void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
- const int CC_id,
- const frame_t frameP,
- const sub_frame_t subframeP,
- const rnti_t rnti);
+void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
+ const int CC_id,
+ const frame_t frameP,
+ const sub_frame_t subframeP,
+ const rnti_t rnti);
uint8_t
rrc_data_req(
@@ -631,7 +633,7 @@ rrc_eNB_free_mem_UE_context(
void
rrc_eNB_free_UE(
- const module_id_t enb_mod_idP,
+ const module_id_t enb_mod_idP,
const struct rrc_eNB_ue_context_s *const ue_context_pP
);
@@ -642,10 +644,10 @@ long binary_search_float(float elements[], long numElem, float value);
void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
void openair_rrc_top_init_ue(
- int eMBMS_active,
+ int eMBMS_active,
char *uecap_xer,
- uint8_t cba_group_active,
- uint8_t HO_active
+ uint8_t cba_group_active,
+ uint8_t HO_active
);
pthread_mutex_t rrc_release_freelist;
RRC_release_list_t rrc_release_info;
diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c
index c1ce742d0b..e9a8e98e07 100644
--- a/openair2/UTIL/ASYNC_IF/link_manager.c
+++ b/openair2/UTIL/ASYNC_IF/link_manager.c
@@ -46,15 +46,10 @@ static void *link_manager_sender_thread(void *_manager)
LOG_D(MAC, "starting link manager sender thread\n");
while (manager->run) {
- while (message_get(manager->send_queue, &data, &size, &priority) == 0) {
- link_send_packet(manager->socket_link, data, size);
+ while ((size = message_get(manager->send_queue, &data, &priority)) > 0) {
+ link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->peer_port);
free(data);
}
- // if (message_get(manager->send_queue, &data, &size, &priority))
- // goto error;
- //if (link_send_packet(manager->socket_link, data, size))
- // goto error;
- //free(data);
}
LOG_D(MAC, "link manager sender thread quits\n");
@@ -124,9 +119,6 @@ link_manager_t *create_link_manager(
pthread_attr_setschedpolicy(&attr, SCHED_RR);
//#endif
- if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))
- goto error;
-
if (pthread_create(&t, &attr, link_manager_sender_thread, ret))
goto error;
ret->sender = t;
@@ -151,9 +143,11 @@ error:
void destroy_link_manager(link_manager_t *manager)
{
- LOG_D(MAC, "destroying link manager\n");
manager->run = 0;
- /* todo: force threads to stop (using a dummy message?) */
+ message_get_unlock(manager->send_queue);
+ pthread_join(manager->sender, NULL);
+ /* cancel aborts the read performed in the receiver, then cancels the thread */
+ pthread_cancel(manager->receiver);
}
#ifdef SERVER_TEST
@@ -186,7 +180,7 @@ int main(void)
data = strdup("hello"); if (data == NULL) goto error;
if (message_put(send_queue, data, 6, 100)) goto error;
- if (message_get(receive_queue, &data, &size, &priority)) goto error;
+ if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error;
printf("received message:\n");
printf(" data: %s\n", (char *)data);
printf(" size: %d\n", size);
@@ -230,7 +224,7 @@ int main(void)
manager = create_link_manager(send_queue, receive_queue, link);
if (manager == NULL) goto error;
- if (message_get(receive_queue, &data, &size, &priority)) goto error;
+ if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error;
printf("received message:\n");
printf(" data: %s\n", (char *)data);
printf(" size: %d\n", size);
diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h
index 90ede6c3db..4148392eec 100644
--- a/openair2/UTIL/ASYNC_IF/link_manager.h
+++ b/openair2/UTIL/ASYNC_IF/link_manager.h
@@ -31,8 +31,8 @@
#ifndef LINK_MANAGER_H
#define LINK_MANAGER_H
-//#include "message_queue.h"
-#include "ringbuffer_queue.h"
+#include "message_queue.h"
+//#include "ringbuffer_queue.h"
#include "socket_link.h"
#include
@@ -45,6 +45,8 @@ typedef struct {
message_queue_t *send_queue;
message_queue_t *receive_queue;
socket_link_t *socket_link;
+ const char *peer_addr; /* for UDP server remote IP */
+ int peer_port; /* for UDP server remote address */
pthread_t sender;
pthread_t receiver;
volatile int run;
@@ -54,6 +56,7 @@ link_manager_t *create_link_manager(
message_queue_t *send_queue,
message_queue_t *receive_queue,
socket_link_t *link);
+
void destroy_link_manager(link_manager_t *);
#ifdef __cplusplus
diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c
index 2581840388..2279a067b4 100644
--- a/openair2/UTIL/ASYNC_IF/message_queue.c
+++ b/openair2/UTIL/ASYNC_IF/message_queue.c
@@ -56,6 +56,10 @@ message_queue_t *new_message_queue(void)
if (pthread_cond_init(ret->cond, NULL))
goto error;
+ ret->head = NULL;
+ ret->tail = NULL;
+ ret->exit = 0;
+
return ret;
error:
@@ -72,6 +76,8 @@ error:
int message_put(message_queue_t *queue, void *data, int size, int priority)
{
message_t *m = NULL;
+ if (size <= 0)
+ goto error;
m = calloc(1, sizeof(message_t));
if (m == NULL)
@@ -106,12 +112,12 @@ int message_put(message_queue_t *queue, void *data, int size, int priority)
return 0;
error:
- free(m);
+ if (m) free(m);
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
-int message_get(message_queue_t *queue, void **data, int *size, int *priority)
+int message_get(message_queue_t *queue, void **data, int *priority)
{
message_t *m;
@@ -119,10 +125,15 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority)
goto error;
while (queue->count == 0) {
- if (pthread_cond_wait(queue->cond, queue->mutex)) {
+ int rc = pthread_cond_wait(queue->cond, queue->mutex);
+ if (rc != 0) {
pthread_mutex_unlock(queue->mutex);
goto error;
}
+ if (queue->exit) {
+ pthread_mutex_unlock(queue->mutex);
+ return 0;
+ }
}
m = queue->head;
@@ -136,17 +147,24 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority)
goto error;
*data = m->data;
- *size = m->size;
+ const int size = m->size;
*priority = m->priority;
free(m);
- return 0;
-
+ return size;
error:
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
+void message_get_unlock(message_queue_t *queue)
+{
+ pthread_mutex_lock(queue->mutex);
+ queue->exit = 1;
+ pthread_mutex_unlock(queue->mutex);
+ pthread_cond_signal(queue->cond);
+}
+
/* when calling this function, the queue must not be used anymore (we don't lock it) */
/* we suppose that the data pointer in messages was allocated by malloc/calloc/realloc */
void destroy_message_queue(message_queue_t *queue)
@@ -181,10 +199,10 @@ int main(void)
if (message_put(q, "hello", 6, 0)) goto error;
if (message_put(q, "world", 6, 1)) goto error;
- if (message_get(q, &data, &size, &priority)) goto error;
+ if ((size = message_get(q, &data, &priority)) <= 0) goto error;
printf("message:\n data: '%s'\n size: %d\n priority: %d\n",
(char *)data, size, priority);
- if (message_get(q, &data, &size, &priority)) goto error;
+ if ((size = message_get(q, &data, &priority)) <= 0) goto error;
printf("message:\n data: '%s'\n size: %d\n priority: %d\n",
(char *)data, size, priority);
diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h
index 8fedddcc77..656f3db28e 100644
--- a/openair2/UTIL/ASYNC_IF/message_queue.h
+++ b/openair2/UTIL/ASYNC_IF/message_queue.h
@@ -41,6 +41,7 @@ typedef struct message_t {
void *data;
int size;
int priority;
+
struct message_t *next;
} message_t;
@@ -50,11 +51,13 @@ typedef struct {
volatile int count;
pthread_mutex_t *mutex;
pthread_cond_t *cond;
+ int exit;
} message_queue_t;
message_queue_t *new_message_queue(void);
int message_put(message_queue_t *queue, void *data, int size, int priority);
-int message_get(message_queue_t *queue, void **data, int *size, int *priority);
+int message_get(message_queue_t *queue, void **data, int *priority);
+void message_get_unlock(message_queue_t *queue);
void destroy_message_queue(message_queue_t *queue);
#ifdef __cplusplus
diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
index 201603e0c5..7bcd3b5647 100644
--- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
+++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
@@ -67,6 +67,9 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) {
message_t *overwritten_msg;
message_t *m = NULL;
+ if (size <= 0)
+ goto error;
+
LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
lfds700_misc_prng_init(&ls);
@@ -94,12 +97,11 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) {
return 0;
error:
- free(m);
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
-int message_get(message_queue_t *queue, void **data, int *size, int *priority) {
+int message_get(message_queue_t *queue, void **data, int *priority) {
message_t *m;
struct lfds700_misc_prng_state ls;
@@ -111,10 +113,15 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) {
}
*data = m->data;
- *size = m->size;
+ const int size = m->size;
*priority = m->priority;
free(m);
- return 0;
+ return size;
+}
+
+void message_get_unlock(message_queue_t *queue) {
+ /* don't do anything, this function exists to unlock a message_queue but is
+ * not needed in the case of the ringbuffer_queue */
}
void destroy_message_queue(message_queue_t *queue) {
diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
index 04414cbbb2..bb65612e6b 100644
--- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
+++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
@@ -47,7 +47,8 @@ typedef struct {
message_queue_t * new_message_queue(int size);
int message_put(message_queue_t *queue, void *data, int size, int priority);
-int message_get(message_queue_t *queue, void **data, int *size, int *priority);
+int message_get(message_queue_t *queue, void **data, int *priority);
+void message_get_unlock(message_queue_t *queue);
void destroy_message_queue(message_queue_t *queue);
#endif /* RINGBUFFER_QUEUE_H */
diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c
index edfa2bde81..e40fba4a04 100644
--- a/openair2/UTIL/ASYNC_IF/socket_link.c
+++ b/openair2/UTIL/ASYNC_IF/socket_link.c
@@ -51,6 +51,7 @@ socket_link_t *new_link_server(int port)
socklen_t addrlen;
int socket_server = -1;
int no_delay;
+
ret = calloc(1, sizeof(socket_link_t));
if (ret == NULL) {
@@ -59,22 +60,26 @@ socket_link_t *new_link_server(int port)
}
ret->socket_fd = -1;
- LOG_D(MAC, "create a new link server socket at port %d\n", port);
+
+ //printf("MAC create a new link server socket at port %d\n", port);
socket_server = socket(AF_INET, SOCK_STREAM, 0);
if (socket_server == -1) {
LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno));
goto error;
}
+ ret->type = SOCK_STREAM;
reuse = 1;
if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
+
LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno));
goto error;
}
no_delay = 1;
if (setsockopt(socket_server, IPPROTO_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) {
+
LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno));
goto error;
}
@@ -99,20 +104,19 @@ socket_link_t *new_link_server(int port)
goto error;
}
- close(socket_server);
-
- LOG_D(MAC, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+ //printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
return ret;
error:
close(socket_server);
if (ret != NULL) close(ret->socket_fd);
free(ret);
+
LOG_E(MAC, "ERROR in new_link_server (see above), returning NULL\n");
return NULL;
}
-socket_link_t *new_link_client(char *server, int port)
+socket_link_t *new_link_client(const char *server, int port)
{
socket_link_t *ret = NULL;
struct sockaddr_in addr;
@@ -132,6 +136,7 @@ socket_link_t *new_link_client(char *server, int port)
LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno));
goto error;
}
+ ret->type = SOCK_STREAM;
no_delay = 1;
if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) {
@@ -160,6 +165,263 @@ error:
return NULL;
}
+socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port)
+{
+ socket_link_t *ret = NULL;
+
+ struct sockaddr_in si_me;
+ int socket_server = -1;
+
+ ret = calloc(1, sizeof(socket_link_t));
+ if (ret == NULL) {
+ LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+ ret->socket_fd = -1;
+
+ //printf("PROTO_AGENT: create a new udp link server socket at port %d\n", port);
+
+ //create a UDP socket
+ if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
+ goto error;
+ }
+ ret->type = SOCK_DGRAM;
+
+ // zero out the structure
+ memset((char *) &si_me, 0, sizeof(si_me));
+
+ si_me.sin_family = AF_INET;
+ si_me.sin_port = htons(bind_port);
+ if (bind_addr) {
+ if (!inet_aton(bind_addr, &si_me.sin_addr))
+ goto error;
+ } else {
+ si_me.sin_addr.s_addr = INADDR_ANY;
+ }
+
+ //bind socket to port
+ if( bind(socket_server , (struct sockaddr*)&si_me, sizeof(si_me) ) == -1) {
+ fprintf(stderr, "could not bind to address %s: %s\n", bind_addr, strerror(errno));
+ goto error;
+ }
+ ret->socket_fd = socket_server;
+ return ret;
+
+error:
+ if (socket_server != -1) close(socket_server);
+ if (ret != NULL) close(ret->socket_fd);
+ free(ret);
+ //printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n");
+ return NULL;
+}
+
+
+socket_link_t *new_link_udp_client(const char *server, int port){
+
+ socket_link_t *ret = NULL;
+ ret = calloc(1, sizeof(socket_link_t));
+ if (ret == NULL) {
+ LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+ ret->socket_fd = -1;
+
+ struct sockaddr_in si_other;
+ int s;
+ socklen_t slen;
+
+ if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){
+ goto error;
+ }
+ ret->type = SOCK_DGRAM;
+
+ memset((char *) &si_other, 0, sizeof(si_other));
+ si_other.sin_family = AF_INET;
+ si_other.sin_port = 0; //htons(port);
+
+
+
+ if (inet_aton(server, &si_other.sin_addr) == 0){
+ fprintf(stderr, "inet_aton() failed\n");
+ goto error;
+ }
+ connect(s, (struct sockaddr *)&si_other, sizeof(si_other));
+
+ getsockname(s, (struct sockaddr *)&si_other, &slen);
+
+ ret->socket_fd = s;
+
+ return ret;
+error:
+ if (ret != NULL) {
+ close(ret->socket_fd);
+ free(ret);
+ }
+ LOG_E(MAC, "ERROR in new_link_udp_client (see above), returning NULL\n");
+ return NULL;
+}
+
+
+socket_link_t *new_link_sctp_server(int port)
+{
+
+ socket_link_t *ret = NULL;
+
+ int listenSock = -1, temp;
+ struct sockaddr_in servaddr;
+
+ listenSock = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+ if(listenSock == -1)
+ {
+ perror("socket()");
+ exit(1);
+ }
+
+ bzero ((void *) &servaddr, sizeof (servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_addr.s_addr = INADDR_ANY;
+ servaddr.sin_port = htons(port);
+
+ temp = bind (listenSock, (struct sockaddr *) &servaddr, sizeof (servaddr));
+
+ if(temp == -1 )
+ {
+ perror("bind()");
+ close(listenSock);
+ exit(1);
+ }
+
+ temp = listen (listenSock, 5);
+ if(temp == -1 )
+ {
+ perror("listen()");
+ close(listenSock);
+ exit(1);
+ }
+ ret = calloc(1, sizeof(socket_link_t));
+ if (ret == NULL) {
+ LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+ ret->socket_fd = -1;
+
+ ret->socket_fd = accept (listenSock, NULL, NULL);
+ ret->type = SOCK_STREAM;
+
+ return ret;
+
+error:
+ if (listenSock != -1) close(listenSock);
+ if (ret != NULL) close(ret->socket_fd);
+ free(ret);
+ LOG_E(MAC,"ERROR in new_link_sctp_server (see above), returning NULL\n");
+ return NULL;
+}
+
+socket_link_t *new_link_sctp_client(const char *server, int port)
+{
+
+ socket_link_t *ret = NULL;
+ ret = calloc(1, sizeof(socket_link_t));
+ if (ret == NULL) {
+ LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+ ret->socket_fd = -1;
+
+ int temp;
+ struct sockaddr_in servaddr;
+
+ ret->socket_fd = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+
+ if (ret->socket_fd == -1)
+ {
+ perror("socket()");
+ exit(1);
+ }
+ ret->type = SOCK_STREAM;
+
+ bzero ((void *) &servaddr, sizeof (servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons (port);
+
+ if (inet_aton(server, &servaddr.sin_addr) == 0) {
+ LOG_E(MAC,"invalid IP address '%s', use a.b.c.d notation\n", server);
+ goto error;
+ }
+
+ temp = connect (ret->socket_fd, (struct sockaddr *) &servaddr, sizeof (servaddr));
+
+ if (temp == -1)
+ {
+ perror("connect()");
+ close(ret->socket_fd);
+ exit(1);
+ }
+
+ return ret;
+
+error:
+ if (ret != NULL) close(ret->socket_fd);
+ free(ret);
+ LOG_E(MAC, "ERROR in new_link_sctp_client (see above), returning NULL\n");
+ return NULL;
+}
+
+static int socket_udp_send(int socket_fd, void *buf, int size, const char *peer_addr, int port)
+{
+ struct sockaddr_in si_other;
+ int slen = sizeof(si_other);
+ int l;
+ int my_socket;
+
+ LOG_D(PROTO_AGENT,"UDP send\n");
+
+ my_socket = socket_fd;
+ memset((char *) &si_other, 0, sizeof(si_other));
+ si_other.sin_family = AF_INET;
+ si_other.sin_port = htons(port);
+
+ if (inet_aton(peer_addr , &si_other.sin_addr) == 0)
+ {
+ fprintf(stderr, "inet_aton() failed\n");
+ exit(1);
+ }
+
+ l = sendto(my_socket, buf, size, 0, (struct sockaddr *) &si_other, slen);
+ if (l == -1) goto error;
+
+ return l;
+error:
+ LOG_E(MAC,"socket_udp_send: ERROR: %s\n", strerror(errno));
+ return -1;
+}
+
+static int socket_udp_receive(int socket_fd, void *buf, int size)
+{
+ LOG_D(PROTO_AGENT,"UDP RECEIVE\n");
+
+ struct sockaddr_in client;
+ socklen_t slen;
+ int l;
+
+ l = recvfrom(socket_fd, buf, size, 0, (struct sockaddr *) &client, &slen);
+ //getsockname(socket_fd, (struct sockaddr *)&client, &slen);
+ if (l == -1) goto error;
+ if (l == 0) goto socket_closed;
+
+ return l;
+
+error:
+ LOG_E(MAC, "socket_udp_receive: ERROR: %s\n", strerror(errno));
+ return -1;
+
+socket_closed:
+ LOG_E(MAC, "socket_udp_receive: socket closed\n");
+ return -1;
+}
+
+
/*
* return -1 on error and 0 if the sending was fine
*/
@@ -213,63 +475,92 @@ socket_closed:
/*
* return -1 on error and 0 if the sending was fine
*/
-int link_send_packet(socket_link_t *link, void *data, int size)
+int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int peer_port)
{
char sizebuf[4];
int32_t s = size;
+ switch (link->type) {
+ case SOCK_STREAM:
+ /* send the size first, maximum is 2^31 bytes */
+ sizebuf[0] = (s >> 24) & 255;
+ sizebuf[1] = (s >> 16) & 255;
+ sizebuf[2] = (s >> 8) & 255;
+ sizebuf[3] = s & 255;
+ if (socket_send(link->socket_fd, sizebuf, 4) == -1)
+ return -1;
- /* send the size first, maximum is 2^31 bytes */
- sizebuf[0] = (s >> 24) & 255;
- sizebuf[1] = (s >> 16) & 255;
- sizebuf[2] = (s >> 8) & 255;
- sizebuf[3] = s & 255;
+ link->bytes_sent += 4;
- if (socket_send(link->socket_fd, sizebuf, 4) == -1)
- goto error;
-
- link->bytes_sent += 4;
-
- if (socket_send(link->socket_fd, data, size) == -1)
- goto error;
+ if (socket_send(link->socket_fd, data, size) == -1)
+ return -1;
+ break;
+ case SOCK_DGRAM:
+ /* UDP is connectionless -> only send the data */
+ if (socket_udp_send(link->socket_fd, data, size, peer_addr, peer_port) == -1)
+ return -1;
+ break;
+ default:
+ LOG_E(MAC, "unknown socket type %d\n", link->type);
+ return -1;
+ }
link->bytes_sent += size;
link->packets_sent++;
return 0;
-
-error:
- return -1;
}
/*
* return -1 on error and 0 if the sending was fine
*/
+
int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
{
unsigned char sizebuf[4];
- int32_t size;
+ int32_t size = 0;
void *data = NULL;
-
+
/* received the size first, maximum is 2^31 bytes */
- if (socket_receive(link->socket_fd, sizebuf, 4) == -1)
- goto error;
+ switch (link->type) {
+ case SOCK_STREAM:
+ if (socket_receive(link->socket_fd, sizebuf, 4) == -1)
+ goto error;
- size = (sizebuf[0] << 24) |
- (sizebuf[1] << 16) |
- (sizebuf[2] << 8) |
- sizebuf[3];
+ size = (sizebuf[0] << 24) |
+ (sizebuf[1] << 16) |
+ (sizebuf[2] << 8) |
+ sizebuf[3];
- link->bytes_received += 4;
+ link->bytes_received += 4;
- data = malloc(size);
- if (data == NULL) {
- LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ data = malloc(size);
+ if (data == NULL) {
+ LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+
+ if (socket_receive(link->socket_fd, data, size) == -1)
+ goto error;
+ break;
+ case SOCK_DGRAM:
+ /* we get a single packet (no size, UDP could lose it). Therefore, prepare
+ * for the maximum UDP packet size */
+ size = 65535;
+ data = malloc(size);
+ if (data == NULL) {
+ LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
+ goto error;
+ }
+
+ size = socket_udp_receive(link->socket_fd, data, size);
+ if (size < 0)
+ goto error;
+ break;
+ default:
+ LOG_E(MAC, "unknown socket type %d\n", link->type);
goto error;
}
- if (socket_receive(link->socket_fd, data, size) == -1)
- goto error;
-
link->bytes_received += size;
link->packets_received++;
@@ -313,8 +604,8 @@ int main(void)
*/
sleep(1);
printf("... done\n");
- if (link_send_packet(l, "hello\n", 6+1) ||
- link_send_packet(l, "world\n", 6+1)) return 1;
+ if (link_send_packet(l, "hello\n", 6+1, NULL, 0) ||
+ link_send_packet(l, "world\n", 6+1, NULL, 0)) return 1;
if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data);
if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data);
printf("stats:\n");
@@ -342,8 +633,8 @@ int main(void)
printf("link is up\n");
if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data);
if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data);
- if (link_send_packet(l, "bye\n", 4+1) ||
- link_send_packet(l, "server\n", 7+1)) return 1;
+ if (link_send_packet(l, "bye\n", 4+1, NULL, 0) ||
+ link_send_packet(l, "server\n", 7+1, NULL, 0)) return 1;
printf("stats:\n");
printf(" sent packets %"PRIu64"\n", l->packets_sent);
printf(" sent bytes %"PRIu64"\n", l->bytes_sent);
diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h
index dbe0a69370..b466721e08 100644
--- a/openair2/UTIL/ASYNC_IF/socket_link.h
+++ b/openair2/UTIL/ASYNC_IF/socket_link.h
@@ -37,8 +37,10 @@
extern "C" {
#endif
+
typedef struct {
int socket_fd;
+ int type;
uint64_t bytes_sent;
uint64_t packets_sent;
uint64_t bytes_received;
@@ -46,11 +48,17 @@ typedef struct {
} socket_link_t;
socket_link_t *new_link_server(int port);
-socket_link_t *new_link_client(char *server, int port);
-int link_send_packet(socket_link_t *link, void *data, int size);
+socket_link_t *new_link_client(const char *server, int port);
+/* setting bind_addr to NULL binds server to INADDR_ANY */
+socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port);
+socket_link_t *new_link_udp_client(const char *server, int port);
+socket_link_t *new_link_sctp_server(int port);
+socket_link_t *new_link_sctp_client(const char *server, int port);
+int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int port);
int link_receive_packet(socket_link_t *link, void **data, int *size);
int close_link(socket_link_t *link);
+
#ifdef __cplusplus
}
#endif
diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c
index 8ab44e46b5..11852859e8 100644
--- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c
+++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c
@@ -31,8 +31,6 @@ void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs,
/****************************************************************************/
-//#pragma warning( disable : 4100 )
-
static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag )
{
struct lfds700_ringbuffer_element
@@ -57,9 +55,6 @@ static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct l
//#pragma warning( default : 4100 )
-
-
-
/****************************************************************************/
//#pragma warning( disable : 4100 )
diff --git a/openair2/UTIL/LISTS/list.h b/openair2/UTIL/LISTS/list.h
index 818df2be26..b88c581dea 100644
--- a/openair2/UTIL/LISTS/list.h
+++ b/openair2/UTIL/LISTS/list.h
@@ -112,9 +112,9 @@ typedef struct {
size_t atomSize;
size_t increment;
} varArray_t;
-
+
static inline varArray_t * initVarArray(size_t increment, size_t atomSize) {
- varArray_t * tmp=malloc(sizeof(varArray_t)+increment*atomSize);
+ varArray_t * tmp=(varArray_t *)malloc(sizeof(varArray_t)+increment*atomSize);
tmp->size=0;
tmp->atomSize=atomSize;
tmp->mallocedSize=increment;
@@ -129,7 +129,7 @@ static inline void * dataArray(varArray_t * input) {
static inline void appendVarArray(varArray_t * input, void* data) {
if (input->size>=input->mallocedSize) {
input->mallocedSize+=input->increment;
- input=realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
+ input=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
}
memcpy((uint8_t*)(input+1)+input->atomSize*input->size++, data, input->atomSize);
}
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
new file mode 100644
index 0000000000..faff4fcfb9
--- /dev/null
+++ b/openair2/UTIL/LOG/log.c
@@ -0,0 +1,1832 @@
+/*
+ * 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
+ */
+
+/*! \file log.c
+* \brief log implementaion
+* \author Navid Nikaein
+* \date 2009 - 2014
+* \version 0.5
+* @ingroup util
+
+*/
+
+#define _GNU_SOURCE /* required for pthread_getname_np */
+//#define LOG_TEST 1
+
+#define COMPONENT_LOG
+#define COMPONENT_LOG_IF
+#include
+#define LOG_MAIN
+#include "log.h"
+#include "vcd_signal_dumper.h"
+#include "assertions.h"
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+# include
+# include
+#include "common/config/config_userapi.h"
+// main log variables
+
+
+mapping log_level_names[] = {
+ {"emerg", LOG_EMERG},
+ {"alert", LOG_ALERT},
+ {"crit", LOG_CRIT},
+ {"error", LOG_ERR},
+ {"warn", LOG_WARNING},
+ {"notice", LOG_NOTICE},
+ {"info", LOG_INFO},
+ {"debug", LOG_DEBUG},
+ {"file", LOG_FILE},
+ {"trace", LOG_TRACE},
+ {NULL, -1}
+};
+mapping log_verbosity_names[] = {
+ {"none", 0x0},
+ {"low", 0x5},
+ {"medium", 0x15},
+ {"high", 0x35},
+ {"full", 0x75},
+ {NULL, -1}
+};
+
+// vars for the log thread
+LOG_params log_list[2000];
+int log_list_tail = 0;
+int log_list_nb_elements = 0;
+
+pthread_mutex_t log_lock;
+pthread_cond_t log_notify;
+
+
+#if !defined(LOG_NO_THREAD)
+int log_list_head = 0;
+int log_shutdown;
+#endif
+
+static int gfd;
+
+static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_ORANGE, LOG_BLUE, "", ""}; /*!< \brief Optional start-format strings for highlighting */
+static char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET,LOG_RESET, "",""}; /*!< \brief Optional end-format strings for highlighting */
+
+#if defined(ENABLE_ITTI)
+static log_instance_type_t log_instance_type;
+#endif
+
+/* get log parameters from configuration file */
+void log_getconfig(log_t *g_log) {
+ char *gloglevel = NULL;
+ char *glogverbo = NULL;
+ int level,verbosity;
+ paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
+ paramdef_t logparams_level[MAX_LOG_COMPONENTS];
+ paramdef_t logparams_verbosity[MAX_LOG_COMPONENTS];
+ paramdef_t logparams_logfile[MAX_LOG_COMPONENTS];
+
+ int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
+ if (ret <0) {
+ fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
+ return;
+ }
+ memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
+ memset(logparams_verbosity,0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
+ memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
+ for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
+ if(g_log->log_component[i].name == NULL) {
+ g_log->log_component[i].name = malloc(16);
+ sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
+ logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
+ logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
+ logparams_verbosity[i].paramflags = PARAMFLAG_DONOTREAD;
+ }
+ sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name);
+ sprintf(logparams_verbosity[i].optname,LOG_CONFIG_VERBOSITY_FORMAT, g_log->log_component[i].name);
+ sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name);
+/* workaround: all log options in existing configuration files use lower case component names
+ where component names include uppercase char in log.h.... */
+ for (int j=0 ; jlog_component[PHY].name = "PHY";
+ g_log->log_component[PHY].level = LOG_EMERG;
+ g_log->log_component[PHY].flag = LOG_MED;
+ g_log->log_component[PHY].interval = 1;
+ g_log->log_component[PHY].fd = 0;
+ g_log->log_component[PHY].filelog = 0;
+ g_log->log_component[PHY].filelog_name = "/tmp/phy.log";
+
+ g_log->log_component[MAC].name = "MAC";
+ g_log->log_component[MAC].level = LOG_EMERG;
+ g_log->log_component[MAC].flag = LOG_MED;
+ g_log->log_component[MAC].interval = 1;
+ g_log->log_component[MAC].fd = 0;
+ g_log->log_component[MAC].filelog = 0;
+ g_log->log_component[MAC].filelog_name = "/tmp/mac.log";
+
+ g_log->log_component[OPT].name = "OPT";
+ g_log->log_component[OPT].level = LOG_EMERG;
+ g_log->log_component[OPT].flag = LOG_MED;
+ g_log->log_component[OPT].interval = 1;
+ g_log->log_component[OPT].fd = 0;
+ g_log->log_component[OPT].filelog = 0;
+ g_log->log_component[OPT].filelog_name = "";
+
+ g_log->log_component[RLC].name = "RLC";
+ g_log->log_component[RLC].level = LOG_INFO;
+ g_log->log_component[RLC].flag = LOG_MED;
+ g_log->log_component[RLC].interval = 1;
+ g_log->log_component[RLC].fd = 0;
+ g_log->log_component[RLC].filelog = 0;
+ g_log->log_component[RLC].filelog_name = "/tmp/rlc.log";
+
+ g_log->log_component[PDCP].name = "PDCP";
+ g_log->log_component[PDCP].level = LOG_INFO;
+ g_log->log_component[PDCP].flag = LOG_MED;
+ g_log->log_component[PDCP].interval = 1;
+ g_log->log_component[PDCP].fd = 0;
+ g_log->log_component[PDCP].filelog = 0;
+ g_log->log_component[PDCP].filelog_name = "/tmp/pdcp.log";
+
+ g_log->log_component[RRC].name = "RRC";
+ g_log->log_component[RRC].level = LOG_TRACE;
+ g_log->log_component[RRC].flag = LOG_MED;
+ g_log->log_component[RRC].interval = 1;
+ g_log->log_component[RRC].fd = 0;
+ g_log->log_component[RRC].filelog = 0;
+ g_log->log_component[RRC].filelog_name = "/tmp/rrc.log";
+
+ g_log->log_component[EMU].name = "EMU";
+ g_log->log_component[EMU].level = LOG_EMERG;
+ g_log->log_component[EMU].flag = LOG_MED;
+ g_log->log_component[EMU].interval = 1;
+ g_log->log_component[EMU].fd = 0;
+ g_log->log_component[EMU].filelog = 0;
+ g_log->log_component[EMU].filelog_name = "";
+
+ g_log->log_component[OMG].name = "OMG";
+ g_log->log_component[OMG].level = LOG_EMERG;
+ g_log->log_component[OMG].flag = LOG_MED;
+ g_log->log_component[OMG].interval = 1;
+ g_log->log_component[OMG].fd = 0;
+ g_log->log_component[OMG].filelog = 0;
+ g_log->log_component[OMG].filelog_name = "/tmp/omg.csv";
+
+ g_log->log_component[OTG].name = "OTG";
+ g_log->log_component[OTG].level = LOG_EMERG;
+ g_log->log_component[OTG].flag = LOG_MED;
+ g_log->log_component[OTG].interval = 1;
+ g_log->log_component[OTG].fd = 0;
+ g_log->log_component[OTG].filelog = 0;
+ g_log->log_component[OTG].filelog_name = "/tmp/otg.log";
+
+ g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY";
+ g_log->log_component[OTG_LATENCY].level = LOG_EMERG;
+ g_log->log_component[OTG_LATENCY].flag = LOG_MED;
+ g_log->log_component[OTG_LATENCY].interval = 1;
+ g_log->log_component[OTG_LATENCY].fd = 0;
+ g_log->log_component[OTG_LATENCY].filelog = 0;
+ g_log->log_component[OTG_LATENCY].filelog_name = "/tmp/otg_latency.dat";
+
+ g_log->log_component[OTG_LATENCY_BG].name = "OTG_LATENCY_BG";
+ g_log->log_component[OTG_LATENCY_BG].level = LOG_EMERG;
+ g_log->log_component[OTG_LATENCY_BG].flag = LOG_MED;
+ g_log->log_component[OTG_LATENCY_BG].interval = 1;
+ g_log->log_component[OTG_LATENCY_BG].fd = 0;
+ g_log->log_component[OTG_LATENCY_BG].filelog = 0;
+ g_log->log_component[OTG_LATENCY_BG].filelog_name = "/tmp/otg_latency_bg.dat";
+
+ g_log->log_component[OTG_GP].name = "OTG_GP";
+ g_log->log_component[OTG_GP].level = LOG_EMERG;
+ g_log->log_component[OTG_GP].flag = LOG_MED;
+ g_log->log_component[OTG_GP].interval = 1;
+ g_log->log_component[OTG_GP].fd = 0;
+ g_log->log_component[OTG_GP].filelog = 0;
+ g_log->log_component[OTG_GP].filelog_name = "/tmp/otg_goodput.dat";
+
+ g_log->log_component[OTG_GP_BG].name = "OTG_GP_BG";
+ g_log->log_component[OTG_GP_BG].level = LOG_EMERG;
+ g_log->log_component[OTG_GP_BG].flag = LOG_MED;
+ g_log->log_component[OTG_GP_BG].interval = 1;
+ g_log->log_component[OTG_GP_BG].fd = 0;
+ g_log->log_component[OTG_GP_BG].filelog = 0;
+ g_log->log_component[OTG_GP_BG].filelog_name = "/tmp/otg_goodput_bg.dat";
+
+ g_log->log_component[OTG_JITTER].name = "OTG_JITTER";
+ g_log->log_component[OTG_JITTER].level = LOG_EMERG;
+ g_log->log_component[OTG_JITTER].flag = LOG_MED;
+ g_log->log_component[OTG_JITTER].interval = 1;
+ g_log->log_component[OTG_JITTER].fd = 0;
+ g_log->log_component[OTG_JITTER].filelog = 0;
+ g_log->log_component[OTG_JITTER].filelog_name = "/tmp/otg_jitter.dat";
+
+ g_log->log_component[OCG].name = "OCG";
+ g_log->log_component[OCG].level = LOG_EMERG;
+ g_log->log_component[OCG].flag = LOG_MED;
+ g_log->log_component[OCG].interval = 1;
+ g_log->log_component[OCG].fd = 0;
+ g_log->log_component[OCG].filelog = 0;
+ g_log->log_component[OCG].filelog_name = "";
+
+ g_log->log_component[PERF].name = "PERF";
+ g_log->log_component[PERF].level = LOG_EMERG;
+ g_log->log_component[PERF].flag = LOG_MED;
+ g_log->log_component[PERF].interval = 1;
+ g_log->log_component[PERF].fd = 0;
+ g_log->log_component[PERF].filelog = 0;
+ g_log->log_component[PERF].filelog_name = "";
+
+ g_log->log_component[OIP].name = "OIP";
+ g_log->log_component[OIP].level = LOG_EMERG;
+ g_log->log_component[OIP].flag = LOG_MED;
+ g_log->log_component[OIP].interval = 1;
+ g_log->log_component[OIP].fd = 0;
+ g_log->log_component[OIP].filelog = 0;
+ g_log->log_component[OIP].filelog_name = "";
+
+ g_log->log_component[CLI].name = "CLI";
+ g_log->log_component[CLI].level = LOG_EMERG;
+ g_log->log_component[CLI].flag = LOG_MED;
+ g_log->log_component[CLI].interval = 1;
+ g_log->log_component[CLI].fd = 0;
+ g_log->log_component[CLI].filelog = 0;
+ g_log->log_component[CLI].filelog_name = "";
+
+ g_log->log_component[MSC].name = "MSC";
+ g_log->log_component[MSC].level = LOG_EMERG;
+ g_log->log_component[MSC].flag = LOG_MED;
+ g_log->log_component[MSC].interval = 1;
+ g_log->log_component[MSC].fd = 0;
+ g_log->log_component[MSC].filelog = 0;
+ g_log->log_component[MSC].filelog_name = "/tmp/msc.log";
+
+ g_log->log_component[PROTO_AGENT].name = "PROTO_AGENT";
+ g_log->log_component[PROTO_AGENT].level = LOG_EMERG;
+ g_log->log_component[PROTO_AGENT].flag = LOG_MED;
+ g_log->log_component[PROTO_AGENT].interval = 1;
+ g_log->log_component[PROTO_AGENT].fd = 0;
+ g_log->log_component[PROTO_AGENT].filelog = 0;
+ g_log->log_component[PROTO_AGENT].filelog_name = "/tmp/proto_agent.log";
+
+
+
+ g_log->log_component[PROTO_AGENT].name = "PROTO_AGENT";
+ g_log->log_component[PROTO_AGENT].level = LOG_EMERG;
+ g_log->log_component[PROTO_AGENT].flag = LOG_MED;
+ g_log->log_component[PROTO_AGENT].interval = 1;
+ g_log->log_component[PROTO_AGENT].fd = 0;
+ g_log->log_component[PROTO_AGENT].filelog = 0;
+ g_log->log_component[PROTO_AGENT].filelog_name = "/tmp/proto_agent.log";
+
+ g_log->log_component[F1U].name = "F1U";
+ g_log->log_component[F1U].level = LOG_EMERG;
+ g_log->log_component[F1U].flag = LOG_MED;
+ g_log->log_component[F1U].interval = 1;
+ g_log->log_component[F1U].fd = 0;
+ g_log->log_component[F1U].filelog = 0;
+ g_log->log_component[F1U].filelog_name = "/tmp/f1u.log";
+
+ g_log->log_component[OCM].name = "OCM";
+ g_log->log_component[OCM].level = LOG_EMERG;
+ g_log->log_component[OCM].flag = LOG_MED;
+ g_log->log_component[OCM].interval = 1;
+ g_log->log_component[OCM].fd = 0;
+ g_log->log_component[OCM].filelog = 0;
+ g_log->log_component[OCM].filelog_name = "/tmp/ocm.log";
+
+ g_log->log_component[HW].name = "HW";
+ g_log->log_component[HW].level = LOG_EMERG;
+ g_log->log_component[HW].flag = LOG_MED;
+ g_log->log_component[HW].interval = 1;
+ g_log->log_component[HW].fd = 0;
+ g_log->log_component[HW].filelog = 0;
+ g_log->log_component[HW].filelog_name = "";
+
+ g_log->log_component[OSA].name = "OSA";
+ g_log->log_component[OSA].level = LOG_EMERG;
+ g_log->log_component[OSA].flag = LOG_MED;
+ g_log->log_component[OSA].interval = 1;
+ g_log->log_component[OSA].fd = 0;
+ g_log->log_component[OSA].filelog = 0;
+ g_log->log_component[OSA].filelog_name = "";
+
+ g_log->log_component[RAL_ENB].name = "eRAL";
+ g_log->log_component[RAL_ENB].level = LOG_EMERG;
+ g_log->log_component[RAL_ENB].flag = LOG_MED;
+ g_log->log_component[RAL_ENB].interval = 1;
+ g_log->log_component[RAL_ENB].fd = 0;
+ g_log->log_component[RAL_ENB].filelog = 0;
+ g_log->log_component[RAL_ENB].filelog_name = "";
+
+ g_log->log_component[RAL_UE].name = "mRAL";
+ g_log->log_component[RAL_UE].level = LOG_EMERG;
+ g_log->log_component[RAL_UE].flag = LOG_MED;
+ g_log->log_component[RAL_UE].interval = 1;
+ g_log->log_component[RAL_UE].fd = 0;
+ g_log->log_component[RAL_UE].filelog = 0;
+ g_log->log_component[RAL_UE].filelog_name = "";
+
+ g_log->log_component[ENB_APP].name = "ENB_APP";
+ g_log->log_component[ENB_APP].level = LOG_EMERG;
+ g_log->log_component[ENB_APP].flag = LOG_MED;
+ g_log->log_component[ENB_APP].interval = 1;
+ g_log->log_component[ENB_APP].fd = 0;
+ g_log->log_component[ENB_APP].filelog = 0;
+ g_log->log_component[ENB_APP].filelog_name = "";
+
+ g_log->log_component[FLEXRAN_AGENT].name = "FLEXRAN_AGENT";
+ g_log->log_component[FLEXRAN_AGENT].level = LOG_DEBUG;
+ g_log->log_component[FLEXRAN_AGENT].flag = LOG_MED;
+ g_log->log_component[FLEXRAN_AGENT].interval = 1;
+ g_log->log_component[FLEXRAN_AGENT].fd = 0;
+ g_log->log_component[FLEXRAN_AGENT].filelog = 0;
+ g_log->log_component[FLEXRAN_AGENT].filelog_name = "";
+
+ g_log->log_component[TMR].name = "TMR";
+ g_log->log_component[TMR].level = LOG_EMERG;
+ g_log->log_component[TMR].flag = LOG_MED;
+ g_log->log_component[TMR].interval = 1;
+ g_log->log_component[TMR].fd = 0;
+ g_log->log_component[TMR].filelog = 0;
+ g_log->log_component[TMR].filelog_name = "";
+
+ g_log->log_component[USIM].name = "USIM";
+ g_log->log_component[USIM].level = LOG_DEBUG;
+ g_log->log_component[USIM].flag = LOG_NONE;
+ g_log->log_component[USIM].interval = 1;
+ g_log->log_component[USIM].fd = 0;
+ g_log->log_component[USIM].filelog = 0;
+ g_log->log_component[USIM].filelog_name = "/tmp/usim.txt";
+
+ /* following log component are used for the localization*/
+ g_log->log_component[LOCALIZE].name = "LOCALIZE";
+ g_log->log_component[LOCALIZE].level = LOG_EMERG;
+ g_log->log_component[LOCALIZE].flag = LOG_MED;
+ g_log->log_component[LOCALIZE].interval = 1;
+ g_log->log_component[LOCALIZE].fd = 0;
+ g_log->log_component[LOCALIZE].filelog = 0;
+ g_log->log_component[LOCALIZE].filelog_name = "/tmp/localize.log";
+#endif // ! defined(CN_BUILD)
+
+ g_log->log_component[NAS].name = "NAS";
+ g_log->log_component[NAS].level = LOG_TRACE;
+ g_log->log_component[NAS].flag = LOG_MED;
+ g_log->log_component[NAS].interval = 1;
+ g_log->log_component[NAS].fd = 0;
+ g_log->log_component[NAS].filelog = 0;
+ g_log->log_component[NAS].filelog_name = "/tmp/nas.log";
+
+ g_log->log_component[UDP_].name = "UDP";
+ g_log->log_component[UDP_].level = LOG_EMERG;
+ g_log->log_component[UDP_].flag = LOG_FULL;
+ g_log->log_component[UDP_].interval = 1;
+ g_log->log_component[UDP_].fd = 0;
+ g_log->log_component[UDP_].filelog = 0;
+ g_log->log_component[UDP_].filelog_name = "";
+
+ g_log->log_component[GTPU].name = "GTPV1U";
+ g_log->log_component[GTPU].level = LOG_EMERG;
+ g_log->log_component[GTPU].flag = LOG_FULL;
+ g_log->log_component[GTPU].interval = 1;
+ g_log->log_component[GTPU].fd = 0;
+ g_log->log_component[GTPU].filelog = 0;
+ g_log->log_component[GTPU].filelog_name = "";
+
+ g_log->log_component[S1AP].name = "S1AP";
+ g_log->log_component[S1AP].level = LOG_EMERG;
+ g_log->log_component[S1AP].flag = LOG_FULL;
+ g_log->log_component[S1AP].interval = 1;
+ g_log->log_component[S1AP].fd = 0;
+ g_log->log_component[S1AP].filelog = 0;
+ g_log->log_component[S1AP].filelog_name = "";
+
+ g_log->log_component[SCTP].name = "SCTP";
+ g_log->log_component[SCTP].level = LOG_EMERG;
+ g_log->log_component[SCTP].flag = LOG_MED;
+ g_log->log_component[SCTP].interval = 1;
+ g_log->log_component[SCTP].fd = 0;
+ g_log->log_component[SCTP].filelog = 0;
+ g_log->log_component[SCTP].filelog_name = "";
+
+ g_log->log_component[RRH].name = "RRH";
+ g_log->log_component[RRH].level = LOG_EMERG;
+ g_log->log_component[RRH].flag = LOG_MED;
+ g_log->log_component[RRH].interval = 1;
+ g_log->log_component[RRH].fd = 0;
+ g_log->log_component[RRH].filelog = 0;
+ g_log->log_component[RRH].filelog_name = "";
+
+ g_log->level2string[LOG_EMERG] = "G"; //EMERG
+ g_log->level2string[LOG_ALERT] = "A"; // ALERT
+ g_log->level2string[LOG_CRIT] = "C"; // CRITIC
+ g_log->level2string[LOG_ERR] = "E"; // ERROR
+ g_log->level2string[LOG_WARNING] = "W"; // WARNING
+ g_log->level2string[LOG_NOTICE] = "N"; // NOTICE
+ g_log->level2string[LOG_INFO] = "I"; //INFO
+ g_log->level2string[LOG_DEBUG] = "D"; // DEBUG
+ g_log->level2string[LOG_FILE] = "F"; // file
+ g_log->level2string[LOG_TRACE] = "T"; // TRACE
+
+ g_log->onlinelog = 1; //online log file
+ g_log->syslog = 0;
+ g_log->filelog = 0;
+ g_log->level = LOG_TRACE;
+ g_log->flag = LOG_LOW;
+
+ g_log->config.remote_ip = 0;
+ g_log->config.remote_level = LOG_EMERG;
+ g_log->config.facility = LOG_LOCAL7;
+ g_log->config.audit_ip = 0;
+ g_log->config.audit_facility = LOG_LOCAL6;
+ g_log->config.format = 0x00; // online debug inactive
+
+ g_log->filelog_name = "/tmp/openair.log";
+
+ if (g_log->syslog) {
+#if ! defined(CN_BUILD)
+ openlog(g_log->log_component[EMU].name, LOG_PID, g_log->config.facility);
+#endif // ! defined(CN_BUILD)
+ }
+ log_getconfig(g_log);
+ if (g_log->filelog) {
+ gfd = open(g_log->filelog_name, O_WRONLY | O_CREAT, 0666);
+ }
+
+ // could put a loop here to check for all comps
+ for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
+ if (g_log->log_component[i].filelog == 1 ) {
+ g_log->log_component[i].fd = open(g_log->log_component[i].filelog_name,
+ O_WRONLY | O_CREAT | O_APPEND, 0666);
+ }
+ }
+
+ printf("log init done\n");
+
+ return 0;
+}
+
+void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args)
+{
+ //logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
+ int len = 0;
+ log_component_t *c;
+ char *log_start;
+ char *log_end;
+ /* The main difference with the version above is the use of this local log_buffer.
+ * The other difference is the return value of snprintf which was not used
+ * correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
+ * big enough so that the buffer is never full.
+ */
+ char log_buffer[MAX_LOG_TOTAL];
+
+ /* for no gcc warnings */
+ (void)log_start;
+ (void)log_end;
+
+ c = &g_log->log_component[comp];
+
+ // do not apply filtering for LOG_F
+ // only log messages which are enabled and are below the global log level and component's level threshold
+ if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
+ /* if ((level != LOG_FILE) &&
+ ((level > c->level) ||
+ (level > g_log->level) ||
+ ( c->level > g_log->level))) {
+ */
+ return;
+ }
+
+ //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD, VCD_FUNCTION_IN);
+
+ // adjust syslog level for TRACE messages
+ if (g_log->syslog) {
+ if (g_log->level > LOG_DEBUG) {
+ g_log->level = LOG_DEBUG;
+ }
+ }
+
+ // make sure that for log trace the extra info is only printed once, reset when the level changes
+ if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
+ log_start = log_buffer;
+ len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ log_end = log_buffer + len;
+ } else {
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_start[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ log_start = log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->log_component[comp].name);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->level2string[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
+# define THREAD_NAME_LEN 128
+ char threadname[THREAD_NAME_LEN];
+ if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
+ {
+ perror("pthread_getname_np : ");
+ } else {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+# undef THREAD_NAME_LEN
+ }
+
+ if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
+ func);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
+ file, line);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ //len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%08lx]", thread_id);
+ //if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+
+ len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ log_end = log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_end[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+ }
+
+ va_end(args);
+
+ // OAI printf compatibility
+ if ((g_log->onlinelog == 1) && (level != LOG_FILE))
+#ifdef RTAI
+ if (len > MAX_LOG_TOTAL) {
+ rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
+ }
+
+ if (len > 0) {
+ rtf_put (FIFO_PRINTF_NO, log_buffer, len);
+ }
+
+#else
+ fwrite(log_buffer, len, 1, stdout);
+#endif
+
+#ifndef RTAI
+
+ if (g_log->syslog) {
+ syslog(g_log->level, "%s", log_buffer);
+ }
+
+ if (g_log->filelog) {
+ if (write(gfd, log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+ if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+ if (write(g_log->log_component[comp].fd, log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+#else
+
+ // online print messges
+ if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+ printf(log_buffer);
+ }
+
+#endif
+
+#if defined(ENABLE_ITTI)
+
+ if (level <= LOG_DEBUG) {
+ task_id_t origin_task_id = TASK_UNKNOWN;
+ MessagesIds messages_id;
+ MessageDef *message_p;
+ size_t message_string_size;
+ char *message_msg_p;
+
+ message_string_size = log_end - log_start;
+
+#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
+
+ /* Try to identify sub task ID from log information (comp, log_instance_type) */
+ switch (comp) {
+ case PHY:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PHY_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PHY_UE;
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case MAC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_MAC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_MAC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case RLC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_RLC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_RLC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case PDCP:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PDCP_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PDCP_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+#endif
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ messages_id = ERROR_LOG;
+ break;
+
+ case LOG_WARNING:
+ messages_id = WARNING_LOG;
+ break;
+
+ case LOG_NOTICE:
+ messages_id = NOTICE_LOG;
+ break;
+
+ case LOG_INFO:
+ messages_id = INFO_LOG;
+ break;
+
+ default:
+ messages_id = DEBUG_LOG;
+ break;
+ }
+
+ message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ message_msg_p = (char *) &message_p->ittiMsg.error_log;
+ break;
+
+ case LOG_WARNING:
+ message_msg_p = (char *) &message_p->ittiMsg.warning_log;
+ break;
+
+ case LOG_NOTICE:
+ message_msg_p = (char *) &message_p->ittiMsg.notice_log;
+ break;
+
+ case LOG_INFO:
+ message_msg_p = (char *) &message_p->ittiMsg.info_log;
+ break;
+
+ default:
+ message_msg_p = (char *) &message_p->ittiMsg.debug_log;
+ break;
+ }
+
+ memcpy(message_msg_p, log_start, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ }
+
+#endif
+#if 0
+ LOG_params log_params;
+ int len;
+
+ len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
+
+ //2 first parameters must be passed as 'const' to the thread function
+ log_params.file = strdup(file);
+ log_params.func = strdup(func);
+ log_params.line = line;
+ log_params.comp = PHY;//comp;
+ log_params.level = 6; // INFO - level;
+ log_params.format = format;
+ log_params.len = len;
+
+ if (pthread_mutex_lock(&log_lock) != 0) {
+ return;
+ }
+
+ log_list_tail++;
+ log_list[log_list_tail - 1] = log_params;
+
+ if (log_list_tail >= 1000) {
+ log_list_tail = 0;
+ }
+
+ if (log_list_nb_elements < 1000) {
+ log_list_nb_elements++;
+ }
+
+ if(pthread_cond_signal(&log_notify) != 0) {
+ pthread_mutex_unlock(&log_lock);
+ return;
+ }
+
+ if(pthread_mutex_unlock(&log_lock) != 0) {
+ return;
+ }
+
+#endif
+}
+
+//log record: add to a list
+void logRecord(const char *file, const char *func, int line, int comp,
+ int level, const char *format, ...)
+{
+ va_list args;
+ LOG_params log_params;
+ int len;
+
+ va_start(args, format);
+ len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
+ va_end(args);
+
+ //2 first parameters must be passed as 'const' to the thread function
+ log_params.file = strdup(file);
+ log_params.func = strdup(func);
+ log_params.line = line;
+ log_params.comp = comp;
+ log_params.level = level;
+ log_params.format = format;
+ log_params.len = len;
+
+ if (pthread_mutex_lock(&log_lock) != 0) {
+ return;
+ }
+
+ log_list_tail++;
+ log_list[log_list_tail - 1] = log_params;
+
+ if (log_list_tail >= 1000) {
+ log_list_tail = 0;
+ }
+
+ if (log_list_nb_elements < 1000) {
+ log_list_nb_elements++;
+ }
+
+ if(pthread_cond_signal(&log_notify) != 0) {
+ pthread_mutex_unlock(&log_lock);
+ return;
+ }
+
+ if(pthread_mutex_unlock(&log_lock) != 0) {
+ return;
+ }
+
+ //log = malloc(sizeof(LOG_elt));
+ //log->next = NULL;
+ //log->log_params = log_params;
+ /* Add log task to queue */
+ //log_list_add_tail_eurecom(log, &log_list);
+
+}
+
+void logRecord_thread_safe(const char *file, const char *func,
+ int line, int comp, int level,
+ int len, const char *params_string)
+{
+ log_component_t *c;
+ int total_len = 0;
+ char log_buffer[MAX_LOG_TOTAL];
+
+ c = &g_log->log_component[comp];
+
+ // do not apply filtering for LOG_F
+ // only log messages which are enabled and are below the global log level and component's level threshold
+ if ((level != LOG_FILE) && ((c->level > g_log->level) ||
+ (level > c->level) || (level > g_log->level))) {
+ return;
+ }
+
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_IN);
+
+ // adjust syslog level for TRACE messages
+ if (g_log->syslog) {
+ if (g_log->level > LOG_DEBUG) {
+ g_log->level = LOG_DEBUG;
+ }
+ }
+
+ // make sure that for log trace the extra info is only printed once, reset when the level changes
+ if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level ==LOG_TRACE )) {
+ total_len = snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - 1, "%s",
+ params_string);
+ } else {
+ if ((g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR)) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "%s",
+ log_level_highlight_start[level]);
+ }
+
+ if ((g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s]",
+ g_log->log_component[comp].name);
+ }
+
+ if ((g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL)) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s]",
+ g_log->level2string[level]);
+ }
+
+ if ((g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT)) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s] ",
+ func);
+ }
+
+ if ((g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s:%d]",
+ file, line);
+ }
+
+ len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - len, "%s",
+ params_string);
+
+ if ((g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR)) {
+ total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "%s",
+ log_level_highlight_end[level]);
+ }
+ }
+
+ // OAI printf compatibility
+ if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
+ fprintf(stdout, "%s", log_buffer);
+ }
+
+ if (g_log->syslog) {
+ syslog(g_log->level, "%s", log_buffer);
+ }
+
+ if (g_log->filelog) {
+ if (write(gfd, log_buffer, total_len) < total_len) {
+ // TODO assert ?
+ }
+ }
+
+ if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+ if (write(g_log->log_component[comp].fd, log_buffer, total_len) < total_len) {
+ // TODO assert ?
+ }
+ }
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_OUT);
+}
+
+#if !defined(LOG_NO_THREAD)
+void *log_thread_function(void *list)
+{
+
+ LOG_params log_params;
+
+ for(;;) {
+
+ //log_elt = NULL;
+
+ /* Lock must be taken to wait on conditional variable */
+ pthread_mutex_lock(&log_lock);
+
+ /* Wait on condition variable, check for spurious wakeups.
+ When returning from pthread_cond_wait(), we own the lock. */
+
+ // sleep
+ while((log_list_nb_elements == 0) && (log_shutdown == 0)) {
+ pthread_cond_wait(&log_notify, &log_lock);
+ }
+
+ // exit
+ if ((log_shutdown==1) && (log_list_nb_elements == 0)) {
+ break;
+ }
+
+ /* Grab our task */
+ //log_elt = log_list_remove_head(&log_list);
+ log_params = log_list[log_list_head];
+ log_list_head++;
+ log_list_nb_elements--;
+
+ if (log_list_head >= 1000) {
+ log_list_head = 0;
+ }
+
+
+ /* Unlock */
+ pthread_mutex_unlock(&log_lock);
+
+ /* Get to work */
+ logRecord_thread_safe(log_params.file,
+ log_params.func,
+ log_params.line,
+ log_params.comp,
+ log_params.level,
+ log_params.len,
+ log_params.l_buff_info);
+
+ //free(log_elt);
+ }
+}
+#endif
+
+#if 0
+/* This function does not work. When multiple threads call it at the same time
+ * for the same component, both threads end up using the same buffer.
+ * The output is the completely messed up/wrong.
+ * Kept in case the fix below is not correct or acceptable.
+ */
+//log record, format, and print: executed in the main thread (mt)
+void logRecord_mt(const char *file, const char *func, int line, int comp,
+ int level, const char *format, ...)
+{
+ int len = 0;
+ va_list args;
+ log_component_t *c;
+ char *log_start;
+ char *log_end;
+
+ /* for no gcc warnings */
+ (void)log_start;
+ (void)log_end;
+
+ c = &g_log->log_component[comp];
+
+ // do not apply filtering for LOG_F
+ // only log messages which are enabled and are below the global log level and component's level threshold
+ if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
+ /* if ((level != LOG_FILE) &&
+ ((level > c->level) ||
+ (level > g_log->level) ||
+ ( c->level > g_log->level))) {
+ */
+ return;
+ }
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_IN);
+
+ va_start(args, format);
+
+ // adjust syslog level for TRACE messages
+ if (g_log->syslog) {
+ if (g_log->level > LOG_DEBUG) {
+ g_log->level = LOG_DEBUG;
+ }
+ }
+
+ // make sure that for log trace the extra info is only printed once, reset when the level changes
+ if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
+ log_start = c->log_buffer;
+ len = vsnprintf(c->log_buffer, MAX_LOG_TOTAL-1, format, args);
+ log_end = c->log_buffer + len;
+ } else {
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_start[level]);
+ }
+
+ log_start = c->log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->log_component[comp].name);
+ }
+
+ if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->level2string[level]);
+ }
+
+ if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
+ func);
+ }
+
+ if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
+ file, line);
+ }
+
+ len += vsnprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, format, args);
+ log_end = c->log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_end[level]);
+ }
+ }
+
+ va_end(args);
+
+ // OAI printf compatibility
+ if ((g_log->onlinelog == 1) && (level != LOG_FILE))
+ fwrite(c->log_buffer, len, 1, stdout);
+
+ if (g_log->syslog) {
+ syslog(g_log->level, "%s", c->log_buffer);
+ }
+
+ if (g_log->filelog) {
+ if (write(gfd, c->log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+ if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+ if (write(g_log->log_component[comp].fd, c->log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+#if defined(ENABLE_ITTI)
+
+ if (level <= LOG_DEBUG) {
+ task_id_t origin_task_id = TASK_UNKNOWN;
+ MessagesIds messages_id;
+ MessageDef *message_p;
+ size_t message_string_size;
+ char *message_msg_p;
+
+ message_string_size = log_end - log_start;
+
+#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
+
+ /* Try to identify sub task ID from log information (comp, log_instance_type) */
+ switch (comp) {
+ case PHY:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PHY_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PHY_UE;
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case MAC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_MAC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_MAC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case RLC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_RLC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_RLC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case PDCP:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PDCP_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PDCP_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+#endif
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ messages_id = ERROR_LOG;
+ break;
+
+ case LOG_WARNING:
+ messages_id = WARNING_LOG;
+ break;
+
+ case LOG_NOTICE:
+ messages_id = NOTICE_LOG;
+ break;
+
+ case LOG_INFO:
+ messages_id = INFO_LOG;
+ break;
+
+ default:
+ messages_id = DEBUG_LOG;
+ break;
+ }
+
+ message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ message_msg_p = (char *) &message_p->ittiMsg.error_log;
+ break;
+
+ case LOG_WARNING:
+ message_msg_p = (char *) &message_p->ittiMsg.warning_log;
+ break;
+
+ case LOG_NOTICE:
+ message_msg_p = (char *) &message_p->ittiMsg.notice_log;
+ break;
+
+ case LOG_INFO:
+ message_msg_p = (char *) &message_p->ittiMsg.info_log;
+ break;
+
+ default:
+ message_msg_p = (char *) &message_p->ittiMsg.debug_log;
+ break;
+ }
+
+ memcpy(message_msg_p, log_start, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ }
+
+#endif
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_OUT);
+}
+#endif /* #if 0 */
+
+//log record, format, and print: executed in the main thread (mt)
+void logRecord_mt(const char *file, const char *func, int line, int comp,
+ int level, const char *format, ...)
+{
+ int len = 0;
+ va_list args;
+ log_component_t *c;
+ char *log_start;
+ char *log_end;
+ /* The main difference with the version above is the use of this local log_buffer.
+ * The other difference is the return value of snprintf which was not used
+ * correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
+ * big enough so that the buffer is never full.
+ */
+ char log_buffer[MAX_LOG_TOTAL];
+
+ /* for no gcc warnings */
+ (void)log_start;
+ (void)log_end;
+
+ c = &g_log->log_component[comp];
+
+ // do not apply filtering for LOG_F
+ // only log messages which are enabled and are below the global log level and component's level threshold
+ if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
+ /* if ((level != LOG_FILE) &&
+ ((level > c->level) ||
+ (level > g_log->level) ||
+ ( c->level > g_log->level))) {
+ */
+ return;
+ }
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_IN);
+
+ va_start(args, format);
+
+ // adjust syslog level for TRACE messages
+ if (g_log->syslog) {
+ if (g_log->level > LOG_DEBUG) {
+ g_log->level = LOG_DEBUG;
+ }
+ }
+
+ // make sure that for log trace the extra info is only printed once, reset when the level changes
+ if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
+ log_start = log_buffer;
+ len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ log_end = log_buffer + len;
+ } else {
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_start[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ log_start = log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->log_component[comp].name);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+ g_log->level2string[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
+# define THREAD_NAME_LEN 128
+ char threadname[THREAD_NAME_LEN];
+ if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
+ {
+ perror("pthread_getname_np : ");
+ } else {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+# undef THREAD_NAME_LEN
+ }
+
+ if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
+ func);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
+ file, line);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+
+ len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ log_end = log_buffer + len;
+
+ if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+ len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+ log_level_highlight_end[level]);
+ if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+ }
+ }
+
+ va_end(args);
+
+ // OAI printf compatibility
+ if ((g_log->onlinelog == 1) && (level != LOG_FILE))
+ fwrite(log_buffer, len, 1, stdout);
+
+ if (g_log->syslog) {
+ syslog(g_log->level, "%s", log_buffer);
+ }
+
+ if (g_log->filelog) {
+ if (write(gfd, log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+ if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+ if (write(g_log->log_component[comp].fd, log_buffer, len) < len) {
+ // TODO assert ?
+ }
+ }
+
+#if defined(ENABLE_ITTI)
+
+ if (level <= LOG_DEBUG) {
+ task_id_t origin_task_id = TASK_UNKNOWN;
+ MessagesIds messages_id;
+ MessageDef *message_p;
+ size_t message_string_size;
+ char *message_msg_p;
+
+ message_string_size = log_end - log_start;
+
+#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
+
+ /* Try to identify sub task ID from log information (comp, log_instance_type) */
+ switch (comp) {
+ case PHY:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PHY_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PHY_UE;
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case MAC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_MAC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_MAC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case RLC:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_RLC_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_RLC_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case PDCP:
+ switch (log_instance_type) {
+ case LOG_INSTANCE_ENB:
+ origin_task_id = TASK_PDCP_ENB;
+ break;
+
+ case LOG_INSTANCE_UE:
+ origin_task_id = TASK_PDCP_UE;
+
+ default:
+ break;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+#endif
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ messages_id = ERROR_LOG;
+ break;
+
+ case LOG_WARNING:
+ messages_id = WARNING_LOG;
+ break;
+
+ case LOG_NOTICE:
+ messages_id = NOTICE_LOG;
+ break;
+
+ case LOG_INFO:
+ messages_id = INFO_LOG;
+ break;
+
+ default:
+ messages_id = DEBUG_LOG;
+ break;
+ }
+
+ message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
+
+ switch (level) {
+ case LOG_EMERG:
+ case LOG_ALERT:
+ case LOG_CRIT:
+ case LOG_ERR:
+ message_msg_p = (char *) &message_p->ittiMsg.error_log;
+ break;
+
+ case LOG_WARNING:
+ message_msg_p = (char *) &message_p->ittiMsg.warning_log;
+ break;
+
+ case LOG_NOTICE:
+ message_msg_p = (char *) &message_p->ittiMsg.notice_log;
+ break;
+
+ case LOG_INFO:
+ message_msg_p = (char *) &message_p->ittiMsg.info_log;
+ break;
+
+ default:
+ message_msg_p = (char *) &message_p->ittiMsg.debug_log;
+ break;
+ }
+
+ memcpy(message_msg_p, log_start, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ }
+
+#endif
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+ VCD_FUNCTION_OUT);
+}
+
+int set_log(int component, int level, int interval)
+{
+ /* Checking parameters */
+ DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
+ component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
+ DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
+ LOG_EMERG);
+ DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
+
+ g_log->log_component[component].level = level;
+
+ switch (level) {
+ case LOG_TRACE:
+ g_log->log_component[component].flag = LOG_MED ;
+ break;
+
+ case LOG_DEBUG:
+ g_log->log_component[component].flag = LOG_MED ;
+ break;
+
+ case LOG_INFO:
+ g_log->log_component[component].flag = LOG_LOW ;
+ break;
+
+ default:
+ g_log->log_component[component].flag = LOG_NONE ;
+ break;
+ }
+
+ g_log->log_component[component].interval = interval;
+
+ return 0;
+}
+
+int set_comp_log(int component, int level, int verbosity, int interval)
+{
+ /* Checking parameters */
+ DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
+ component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
+ DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
+ LOG_EMERG);
+ DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
+
+#if 0
+ if ((verbosity == LOG_NONE) || (verbosity == LOG_LOW) ||
+ (verbosity == LOG_MED) || (verbosity == LOG_FULL) ||
+ (verbosity == LOG_HIGH)) {
+ g_log->log_component[component].flag = verbosity;
+ }
+#else
+ g_log->log_component[component].flag = verbosity;
+#endif
+
+ g_log->log_component[component].level = level;
+ g_log->log_component[component].interval = interval;
+
+ return 0;
+}
+
+void set_glog(int level, int verbosity)
+{
+ if( g_log->level >= 0) g_log->level = level;
+ if( g_log->flag >= 0) g_log->flag = verbosity;
+}
+void set_glog_syslog(int enable)
+{
+ g_log->syslog = enable;
+}
+void set_glog_onlinelog(int enable)
+{
+ g_log->onlinelog = enable;
+}
+void set_glog_filelog(int enable)
+{
+ g_log->filelog = enable;
+}
+
+void set_component_filelog(int comp)
+{
+ if (g_log->log_component[comp].filelog == 0) {
+ g_log->log_component[comp].filelog = 1;
+
+ if (g_log->log_component[comp].fd == 0) {
+ g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name,
+ O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ }
+ }
+}
+
+/*
+ * for the two functions below, the passed array must have a final entry
+ * with string value NULL
+ */
+/* map a string to an int. Takes a mapping array and a string as arg */
+int map_str_to_int(mapping *map, const char *str)
+{
+ while (1) {
+ if (map->name == NULL) {
+ return(-1);
+ }
+
+ if (!strcmp(map->name, str)) {
+ return(map->value);
+ }
+
+ map++;
+ }
+}
+
+/* map an int to a string. Takes a mapping array and a value */
+char *map_int_to_str(mapping *map, int val)
+{
+ while (1) {
+ if (map->name == NULL) {
+ return NULL;
+ }
+
+ if (map->value == val) {
+ return map->name;
+ }
+
+ map++;
+ }
+}
+
+int is_newline( char *str, int size)
+{
+ int i;
+
+ for ( i = 0; i < size; i++ ) {
+ if ( str[i] == '\n' ) {
+ return 1;
+ }
+ }
+
+ /* if we get all the way to here, there must not have been a newline! */
+ return 0;
+}
+
+void logClean (void)
+{
+ int i;
+
+ if (g_log->syslog) {
+ closelog();
+ }
+
+ if (g_log->filelog) {
+ close(gfd);
+ }
+
+ for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
+ if (g_log->log_component[i].filelog) {
+ close(g_log->log_component[i].fd);
+ }
+ }
+}
+
+#if defined(ENABLE_ITTI)
+void log_set_instance_type (log_instance_type_t instance)
+{
+ log_instance_type = instance;
+}
+#endif
+
+#ifdef LOG_TEST
+
+int main(int argc, char *argv[])
+{
+
+ logInit();
+
+ //set_log_syslog(1);
+ test_log();
+
+ return 1;
+}
+
+int test_log(void)
+{
+ LOG_ENTER(MAC); // because the default level is DEBUG
+ LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_D(MAC, "1 debug MAC \n");
+ LOG_N(MAC, "1 notice MAC \n");
+ LOG_W(MAC, "1 warning MAC \n");
+
+ set_comp_log(EMU, LOG_INFO, FLAG_ONLINE);
+ set_comp_log(MAC, LOG_WARNING, 0);
+
+ LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_E(MAC, "2 emerge MAC\n");
+ LOG_D(MAC, "2 debug MAC \n");
+ LOG_N(MAC, "2 notice MAC \n");
+ LOG_W(MAC, "2 warning MAC \n");
+ LOG_I(MAC, "2 info MAC \n");
+
+
+ set_comp_log(MAC, LOG_NOTICE, 1);
+
+ LOG_ENTER(MAC);
+ LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_D(MAC, "3 debug MAC \n");
+ LOG_N(MAC, "3 notice MAC \n");
+ LOG_W(MAC, "3 warning MAC \n");
+ LOG_I(MAC, "3 info MAC \n");
+
+ set_comp_log(MAC, LOG_DEBUG,1);
+ set_comp_log(EMU, LOG_DEBUG,1);
+
+ LOG_ENTER(MAC);
+ LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_D(MAC, "4 debug MAC \n");
+ LOG_N(MAC, "4 notice MAC \n");
+ LOG_W(MAC, "4 warning MAC \n");
+ LOG_I(MAC, "4 info MAC \n");
+
+
+ set_comp_log(MAC, LOG_DEBUG,0);
+ set_comp_log(EMU, LOG_DEBUG,0);
+
+ LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_D(MAC, "5 debug MAC \n");
+ LOG_N(MAC, "5 notice MAC \n");
+ LOG_W(MAC, "5 warning MAC \n");
+ LOG_I(MAC, "5 info MAC \n");
+
+
+ set_comp_log(MAC, LOG_TRACE,0X07F);
+ set_comp_log(EMU, LOG_TRACE,0X07F);
+
+ LOG_ENTER(MAC);
+ LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
+ BUILD_VERSION, BUILD_DATE, BUILD_HOST);
+ LOG_D(MAC, "6 debug MAC \n");
+ LOG_N(MAC, "6 notice MAC \n");
+ LOG_W(MAC, "6 warning MAC \n");
+ LOG_I(MAC, "6 info MAC \n");
+ LOG_EXIT(MAC);
+
+ return 0;
+}
+#endif
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index 18ded1a599..4d8ed4e89b 100644
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -130,6 +130,8 @@ void check_free_mem_block (mem_block_t * leP);
# define MEM_MNGT_MB12_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*4096
// 262144
# define MEM_MNGT_MB12_NB_BLOCKS 32 * MEM_SCALE
+//# define MEM_MNGT_MB12_NB_BLOCKS 4096 * MEM_SCALE
+
# define MEM_MNGT_POOL_ID12 12
diff --git a/openair2/UTIL/OTG/otg_tx_socket.c b/openair2/UTIL/OTG/otg_tx_socket.c
index 83b8476e9f..073b9b6ddd 100644
--- a/openair2/UTIL/OTG/otg_tx_socket.c
+++ b/openair2/UTIL/OTG/otg_tx_socket.c
@@ -231,7 +231,7 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime) {
//
free(payload);
- free(tx_buffer);
+ free(tx_buffer);
}
if(udp_send == -1) {
diff --git a/openair2/X2AP/x2ap_eNB_decoder.h b/openair2/X2AP/x2ap_eNB_decoder.h
index 7919c78555..e3fa8b44e8 100644
--- a/openair2/X2AP/x2ap_eNB_decoder.h
+++ b/openair2/X2AP/x2ap_eNB_decoder.h
@@ -33,4 +33,3 @@ int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint3
__attribute__ ((warn_unused_result));
#endif /* X2AP_ENB_DECODER_H_ */
-
diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h
index cd6a7e1385..e1a8b506bc 100644
--- a/openair2/X2AP/x2ap_eNB_defs.h
+++ b/openair2/X2AP/x2ap_eNB_defs.h
@@ -44,22 +44,22 @@
typedef enum {
/* Disconnected state: initial state for any association. */
X2AP_ENB_STATE_DISCONNECTED = 0x0,
-
+
/* State waiting for x2 Setup response message if the target eNB accepts or
* X2 Setup failure if rejects the eNB.
*/
X2AP_ENB_STATE_WAITING = 0x1,
-
+
/* The eNB is successfully connected to another eNB. */
X2AP_ENB_STATE_CONNECTED = 0x2,
-
+
/* X2AP is ready, and the eNB is successfully connected to another eNB. */
X2AP_ENB_STATE_READY = 0x3,
X2AP_ENB_STATE_OVERLOAD = 0x4,
X2AP_ENB_STATE_RESETTING = 0x5,
-
+
/* Max number of states available */
X2AP_ENB_STATE_MAX,
} x2ap_eNB_state_t;
@@ -93,13 +93,13 @@ typedef struct x2ap_eNB_data_s {
/* This is the optional name provided by the MME */
char *eNB_name;
-
- /* target eNB ID */
+
+ /* target eNB ID */
uint32_t eNB_id;
-
+
/* Current eNB load information (if any). */
//x2ap_load_state_t overload_state;
-
+
/* Current eNB->eNB X2AP association state */
x2ap_eNB_state_t state;
@@ -208,4 +208,3 @@ RB_PROTOTYPE(x2ap_eNB_map, x2ap_eNB_data_s, entry, x2ap_eNB_compare_assoc_id);
#endif /* X2AP_ENB_DEFS_H_ */
-
diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.h b/openair2/X2AP/x2ap_eNB_generate_messages.h
index 659966fff6..1fcdf31f12 100644
--- a/openair2/X2AP/x2ap_eNB_generate_messages.h
+++ b/openair2/X2AP/x2ap_eNB_generate_messages.h
@@ -61,4 +61,3 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_
x2ap_handover_cancel_cause_t cause);
#endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */
-
diff --git a/openair2/X2AP/x2ap_eNB_handler.h b/openair2/X2AP/x2ap_eNB_handler.h
index 402212f62d..65f411895f 100644
--- a/openair2/X2AP/x2ap_eNB_handler.h
+++ b/openair2/X2AP/x2ap_eNB_handler.h
@@ -37,4 +37,3 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre
const uint8_t * const data, const uint32_t data_length);
#endif /* X2AP_ENB_HANDLERS_H_ */
-
diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.c b/openair2/X2AP/x2ap_eNB_itti_messaging.c
index 1896e3949c..7573d9be89 100644
--- a/openair2/X2AP/x2ap_eNB_itti_messaging.c
+++ b/openair2/X2AP/x2ap_eNB_itti_messaging.c
@@ -60,4 +60,3 @@ void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
-
diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.c b/openair2/X2AP/x2ap_eNB_management_procedures.c
index 137bad40ad..986ca10902 100644
--- a/openair2/X2AP/x2ap_eNB_management_procedures.c
+++ b/openair2/X2AP/x2ap_eNB_management_procedures.c
@@ -45,7 +45,7 @@
# define X2AP_eNB_LIST_OUT(x, args...) X2AP_DEBUG("[eNB]%*s"x"\n", 4*indent, "", ##args)
#else
# define X2AP_eNB_LIST_OUT(x, args...)
-#endif
+#endif
static int indent = 0;
@@ -123,7 +123,7 @@ printf("---------------------------------------------\n");
}
struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p,
- int32_t assoc_id,
+ int32_t assoc_id,
uint16_t cnx_id)
{
struct x2ap_eNB_data_s temp;
@@ -169,7 +169,7 @@ x2ap_eNB_instance_t *x2ap_eNB_get_instance(instance_t instance)
return NULL;
}
-/// utility functions
+/// utility functions
void x2ap_dump_eNB (x2ap_eNB_data_t * eNB_ref);
@@ -178,9 +178,9 @@ x2ap_dump_eNB_list (void) {
x2ap_eNB_instance_t *inst = NULL;
struct x2ap_eNB_data_s *found = NULL;
struct x2ap_eNB_data_s temp;
-
+
memset(&temp, 0, sizeof(struct x2ap_eNB_data_s));
-
+
STAILQ_FOREACH (inst, &x2ap_eNB_internal_data.x2ap_eNB_instances_head, x2ap_eNB_entries) {
found = RB_FIND(x2ap_enb_map, &inst->x2ap_enb_head, &temp);
x2ap_dump_eNB (found);
@@ -192,12 +192,12 @@ void x2ap_dump_eNB (x2ap_eNB_data_t * eNB_ref) {
if (eNB_ref == NULL) {
return;
}
-
+
X2AP_eNB_LIST_OUT ("");
X2AP_eNB_LIST_OUT ("eNB name: %s", eNB_ref->eNB_name == NULL ? "not present" : eNB_ref->eNB_name);
X2AP_eNB_LIST_OUT ("eNB STATE: %07x", eNB_ref->state);
X2AP_eNB_LIST_OUT ("eNB ID: %07x", eNB_ref->eNB_id);
- indent++;
+ indent++;
X2AP_eNB_LIST_OUT ("SCTP cnx id: %d", eNB_ref->cnx_id);
X2AP_eNB_LIST_OUT ("SCTP assoc id: %d", eNB_ref->assoc_id);
X2AP_eNB_LIST_OUT ("SCTP instreams: %d", eNB_ref->in_streams);
@@ -255,4 +255,3 @@ x2ap_eNB_data_t * x2ap_is_eNB_assoc_id_in_list (const uint32_t sctp_assoc_id)
}
return NULL;
}
-
diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.h b/openair2/X2AP/x2ap_eNB_management_procedures.h
index bcad728aaa..c5217341c5 100644
--- a/openair2/X2AP/x2ap_eNB_management_procedures.h
+++ b/openair2/X2AP/x2ap_eNB_management_procedures.h
@@ -52,4 +52,3 @@ struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p,
uint16_t cnx_id);
#endif /* X2AP_ENB_MANAGEMENT_PROCEDURES_H_ */
-
diff --git a/openair3/COMMON/messages_types.h b/openair3/COMMON/messages_types.h
index 47d9d32f2b..56a16da554 100644
--- a/openair3/COMMON/messages_types.h
+++ b/openair3/COMMON/messages_types.h
@@ -31,6 +31,7 @@
#include "ip_forward_messages_types.h"
#include "s11_messages_types.h"
#include "s1ap_messages_types.h"
+#include "f1ap_messages_types.h"
#include "nas_messages_types.h"
#include "s6a_messages_types.h"
#include "sctp_messages_types.h"
diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
index 535ab8f1fa..365d6d23a5 100644
--- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
+++ b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
@@ -144,7 +144,7 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset,
"Mismatch GTPU len, msgExtraLen %u tpduOffset %u",
msgExtraLen,
- tpduOffset);
+ (uint32_t) tpduOffset);
pMsg->msgBuf = tpdu;
pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE;
pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE);
diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
index 4603e869a6..b5a141349b 100644
--- a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
+++ b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
@@ -253,15 +253,6 @@ for key in iesDefs:
f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" ANY_t *any_p);\n\n")
- f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
- f.write("/** \\brief Compare function for %s ies.\n" % (key))
- f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
- f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
- f.write(" **/\n")
- f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, keylowerunderscore))
- f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
- f.write(" %s_t *%s2);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
-
if len(iesDefs[key]["ies"]) == 0:
continue
@@ -298,13 +289,6 @@ for key in iesDefs:
f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower()))
f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower))
f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
- f.write("/** \\brief Compare function for %s ies.\n" % (key))
- f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
- f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
- f.write(" **/\n")
- f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, firstlower.lower()))
- f.write(" %sIEs_t *%s1,\n" % (asn1cStruct, firstlower))
- f.write(" %sIEs_t *%s2);\n\n" % (asn1cStruct, firstlower))
@@ -634,19 +618,19 @@ xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
mname = td->xml_tag;
mlen = strlen(mname);
- _i_ASN_TEXT_INDENT(0, indent);
- _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);
+ ASN__TEXT_INDENT(0, indent);
+ ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
- tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
+ tmper = td->op->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
if(tmper.encoded == -1) return tmper;
- _ASN_CALLBACK3("", 2, mname, mlen, ">\\n", xcan);
+ ASN__CALLBACK3("", 2, mname, mlen, ">\\n", xcan);
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
- _ASN_ENCODED_OK(er);
+ ASN__ENCODED_OK(er);
cb_failed:
- _ASN_ENCODE_FAILED;
+ ASN__ENCODE_FAILED;
}
""")
@@ -714,7 +698,7 @@ for (key, value) in iesDefs.items():
f.write(" cb(\" %s>\\n\", %d, app_key);\n" % (key, len(" %s>\n" % (key))))
f.write(" cb(\"%s-PDU>\\n\", %d, app_key);\n" % (key, len("%s-PDU>\n" % (key))))
- f.write(" _ASN_ENCODED_OK(er);\n")
+ f.write(" ASN__ENCODED_OK(er);\n")
#if key not in ieofielist.values():
#f.write("cb_failed:\n")
#f.write(" return er;\n")
@@ -731,119 +715,6 @@ f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n" % (fileprefix,
f.write("#include \"%s-ProtocolIE-ID.h\"\n\n" % (fileprefix_first_upper))
-for key in iesDefs:
- if key in ieofielist.values():
- continue
- structName = re.sub('ies', '', key)
- asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
- asn1cStruct = re.sub('Item', 'List', asn1cStruct)
- if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
- asn1cStruct = asn1cStruct[:-1]
- asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
- firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
-
- iesaccess = ""
- if key not in ieofielist.values():
- iesaccess = "%s_ies." % (firstwordlower)
-
- keyName = re.sub('-', '_', key)
- keyupperunderscore = keyName.upper()
- # No IE to encode...
- if len(iesDefs[key]["ies"]) == 0:
- continue
-
- f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
- f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
- f.write(" %s_t *%s2) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
-
- f.write(" asn_comp_rval_t *rv = NULL;\n\n")
- f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
-
- f.write(" assert(%s1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
- f.write(" assert(%s2 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
-
- loop = 0
- for ie in iesDefs[key]["ies"]:
- iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
- ienameunderscore = re.sub('-', '_', iename)
- ienamefirstwordlower = lowerFirstCamelWord(iename)
- ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
- ietypeunderscore = re.sub('-', '_', ie[2])
-
- if ie[3] != "mandatory":
-
- loop = loop + 1
- if loop == 1:
- #f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper))
- #f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper))
- f.write(" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key))))
-
- if ie[3] == "optional":
- f.write(" /* Optional field */\n")
- elif ie[3] == "conditional":
- f.write(" /* Conditional field */\n")
- f.write(" if (%s1->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
-
-
- if ie[2] in ieofielist.keys():
- f.write(" /* collection field */\n")
- f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
- f.write(" if(rv2) {")
- f.write(" if (NULL == rv) {")
- f.write(" rv = rv2;")
- f.write(" } else {")
- f.write(" rv2->next = rv;")
- f.write(" rv = rv2;")
- f.write(" }")
- f.write(" rv2 = NULL;")
- f.write(" }")
- else:
- f.write(" /* simple field */\n")
- f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s); \n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
- f.write(" if (rv2) {")
- f.write(" if (NULL == rv) {")
- f.write(" rv = rv2;")
- f.write(" } else {")
- f.write(" rv2->next = rv;")
- f.write(" rv = rv2;")
- f.write(" }")
- f.write(" rv2 = NULL;")
- f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;" % (ietypeunderscore))
- f.write(" }")
-
- f.write(" assert(0);\n");
- f.write(" }\n\n")
-
- else:
- if ie[2] in ieofielist.keys():
- f.write(" /* Mandatory collection field */\n")
- f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
- f.write(" if (rv2) {\n")
- f.write(" if (NULL == rv) {\n")
- f.write(" rv = rv2;\n")
- f.write(" } else {\n")
- f.write(" rv2->next = rv;\n")
- f.write(" rv = rv2;\n")
- f.write(" }\n")
- f.write(" rv2 = NULL;\n")
- f.write(" }\n")
-
- else:
- f.write(" /* Mandatory simple field */\n")
- f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
- f.write(" if(rv2) {\n")
- f.write(" if (NULL == rv) {\n")
- f.write(" rv = rv2;\n")
- f.write(" } else {\n")
- f.write(" rv2->next = rv;\n")
- f.write(" rv = rv2;\n")
- f.write(" }\n")
- f.write(" rv2 = NULL;\n")
- f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;\n" % (ietypeunderscore))
- f.write(" }\n")
- f.write(" return rv;\n")
- f.write("}\n\n")
-
for (key, value) in iesDefs.items():
if key not in ieofielist.values():
continue
@@ -859,30 +730,3 @@ for (key, value) in iesDefs.items():
break
f.write("extern asn_TYPE_descriptor_t asn_DEF_%s;\n" % (ietypeunderscore))
-
- f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
- f.write(" %sIEs_t *%sIEs1,\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
- f.write(" %sIEs_t *%sIEs2) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
- f.write(" int i;\n")
- f.write(" asn_comp_rval_t *rv = NULL;\n\n")
- f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
-
-
- f.write(" assert(%sIEs1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
- f.write(" assert(%sIEs2 != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
-
- f.write(" for (i = 0; i < %sIEs1->%s.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
- f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
- f.write(" if(rv2) {")
- f.write(" if (NULL == rv) {")
- f.write(" rv = rv2;")
- f.write(" } else {")
- f.write(" rv2->next = rv;")
- f.write(" rv = rv2;")
- f.write(" }")
- f.write(" rv2 = NULL;")
- f.write(" }")
- f.write(" }\n")
- f.write(" return rv;\n")
- f.write("}\n\n")
-
diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h
index fc872564c5..77d03f4ae4 100644
--- a/openair3/S1AP/s1ap_common.h
+++ b/openair3/S1AP/s1ap_common.h
@@ -105,8 +105,8 @@ extern int asn1_xer_print;
} \
if (ie == NULL ) { \
S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
- if (mandatory) _Assert_Exit_ \
} \
+ if (mandatory) DevAssert(ie != NULL); \
} while(0)
/** \brief Function callback prototype.
**/
diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c
index 98bdbeb54d..0c3b1ee25b 100644
--- a/openair3/S1AP/s1ap_eNB_handlers.c
+++ b/openair3/S1AP/s1ap_eNB_handlers.c
@@ -272,15 +272,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_Cause,true);
- if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
- if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) &&
- (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) {
- S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n");
- } else {
- S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n");
- }
+ if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) &&
+ (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) {
+ S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n");
} else {
- return -1;
+ S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n");
}
mme_desc_p->state = S1AP_ENB_STATE_WAITING;
@@ -318,68 +314,60 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
/* The list of served gummei can contain at most 8 elements.
* LTE related gummei is the first element in the list, i.e with an id of 0.
*/
- if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
- S1AP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count);
- DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0);
- DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= S1AP_maxnoofRATs);
+ S1AP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count);
+ DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0);
+ DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= S1AP_maxnoofRATs);
- for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) {
- S1AP_ServedGUMMEIsItem_t *gummei_item_p;
- struct served_gummei_s *new_gummei_p;
- int j;
- gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i];
- new_gummei_p = calloc(1, sizeof(struct served_gummei_s));
- STAILQ_INIT(&new_gummei_p->served_plmns);
- STAILQ_INIT(&new_gummei_p->served_group_ids);
- STAILQ_INIT(&new_gummei_p->mme_codes);
- S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count);
+ for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) {
+ S1AP_ServedGUMMEIsItem_t *gummei_item_p;
+ struct served_gummei_s *new_gummei_p;
+ int j;
+ gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i];
+ new_gummei_p = calloc(1, sizeof(struct served_gummei_s));
+ STAILQ_INIT(&new_gummei_p->served_plmns);
+ STAILQ_INIT(&new_gummei_p->served_group_ids);
+ STAILQ_INIT(&new_gummei_p->mme_codes);
+ S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count);
- for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) {
- S1AP_PLMNidentity_t *plmn_identity_p;
- struct plmn_identity_s *new_plmn_identity_p;
- plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j];
- new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s));
- TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc,
- new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length);
- STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next);
- new_gummei_p->nb_served_plmns++;
- }
-
- for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) {
- S1AP_MME_Group_ID_t *mme_group_id_p;
- struct served_group_id_s *new_group_id_p;
- mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j];
- new_group_id_p = calloc(1, sizeof(struct served_group_id_s));
- OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id);
- STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next);
- new_gummei_p->nb_group_id++;
- }
-
- for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) {
- S1AP_MME_Code_t *mme_code_p;
- struct mme_code_s *new_mme_code_p;
- mme_code_p = gummei_item_p->servedMMECs.list.array[j];
- new_mme_code_p = calloc(1, sizeof(struct mme_code_s));
- OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code);
- STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next);
- new_gummei_p->nb_mme_code++;
- }
-
- STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next);
+ for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) {
+ S1AP_PLMNidentity_t *plmn_identity_p;
+ struct plmn_identity_s *new_plmn_identity_p;
+ plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j];
+ new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s));
+ TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc,
+ new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length);
+ STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next);
+ new_gummei_p->nb_served_plmns++;
}
- } else {
- return -1;
+
+ for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) {
+ S1AP_MME_Group_ID_t *mme_group_id_p;
+ struct served_group_id_s *new_group_id_p;
+ mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j];
+ new_group_id_p = calloc(1, sizeof(struct served_group_id_s));
+ OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id);
+ STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next);
+ new_gummei_p->nb_group_id++;
+ }
+
+ for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) {
+ S1AP_MME_Code_t *mme_code_p;
+ struct mme_code_s *new_mme_code_p;
+ mme_code_p = gummei_item_p->servedMMECs.list.array[j];
+ new_mme_code_p = calloc(1, sizeof(struct mme_code_s));
+ OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code);
+ STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next);
+ new_gummei_p->nb_mme_code++;
+ }
+
+ STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next);
}
/* Set the capacity of this MME */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true);
- if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
- mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
- } else {
- return -1;
- }
+ mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
/* Optionaly set the mme name */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c
index 6652ca0447..bd0fd13208 100644
--- a/openair3/S1AP/s1ap_eNB_nas_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c
@@ -501,18 +501,12 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
- if (ie == NULL) { /* checked by macro, but cppcheck doesn't see it */
- return -1;
- } else {
- mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
- }
+ mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
+
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
- if (ie == NULL) { /* checked by macro, but cppcheck doesn't see it */
- return -1;
- } else {
- enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
- }
+ enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
+
if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
MSC_LOG_RX_DISCARDED_MESSAGE(
@@ -566,15 +560,11 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NAS_PDU, true);
/* Forward the NAS PDU to RRC */
- if (ie != NULL) { /* checked by macro, but cppcheck doesn't see it */
- s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance,
- ue_desc_p->ue_initial_id,
- ue_desc_p->eNB_ue_s1ap_id,
- ie->value.choice.NAS_PDU.buf,
- ie->value.choice.NAS_PDU.size);
- } else {
- return -1;
- }
+ s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance,
+ ue_desc_p->ue_initial_id,
+ ue_desc_p->eNB_ue_s1ap_id,
+ ie->value.choice.NAS_PDU.buf,
+ ie->value.choice.NAS_PDU.size);
return 0;
}
diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c
index 543ea9c511..19f5059238 100644
--- a/openair3/S1AP/s1ap_eNB_trace.c
+++ b/openair3/S1AP/s1ap_eNB_trace.c
@@ -121,7 +121,7 @@ int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
if (ie != NULL) {
ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
ie->value.choice.ENB_UE_S1AP_ID);
- }
+ }
if (ue_desc_p == NULL) {
/* Could not find context associated with this eNB_ue_s1ap_id -> generate
* trace failure indication.
diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c
index 9c24da7370..789af3f8ed 100644
--- a/openair3/SCTP/sctp_eNB_itti_messaging.c
+++ b/openair3/SCTP/sctp_eNB_itti_messaging.c
@@ -38,7 +38,8 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, in
return itti_send_msg_to_task(task_id, instance, message_p);
}
-int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, uint32_t assoc_id, uint8_t *buffer,
+int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance,
+ uint32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream)
{
MessageDef *message_p;
diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h
index b4f1a0ee69..a35dc2219a 100644
--- a/openair3/SCTP/sctp_eNB_itti_messaging.h
+++ b/openair3/SCTP/sctp_eNB_itti_messaging.h
@@ -24,7 +24,8 @@
int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, int multi_sd);
-int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, uint32_t assoc_id, uint8_t *buffer,
+int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance,
+ uint32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance,
diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c
index 68fa34f810..4b0945f5ea 100644
--- a/openair3/SCTP/sctp_eNB_task.c
+++ b/openair3/SCTP/sctp_eNB_task.c
@@ -1008,9 +1008,12 @@ sctp_eNB_read_from_socket(
sinfo.sinfo_assoc_id, sctp_cnx->sd, n, ntohs(addr.sin_port),
sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid));
- sctp_itti_send_new_message_ind(sctp_cnx->task_id, sctp_cnx->instance,
+ sctp_itti_send_new_message_ind(sctp_cnx->task_id,
+ sctp_cnx->instance,
sinfo.sinfo_assoc_id,
- buffer, n, sinfo.sinfo_stream);
+ buffer,
+ n,
+ sinfo.sinfo_stream);
}
}
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.c b/openair3/TEST/EPC_TEST/generate_scenario.c
index b1a3297866..a8a3590945 100644
--- a/openair3/TEST/EPC_TEST/generate_scenario.c
+++ b/openair3/TEST/EPC_TEST/generate_scenario.c
@@ -353,7 +353,7 @@ void enb_config_init(const char const * lib_config_file_name_pP)
setting_enb = config_setting_get_elem(setting, i);
active_enb[i] = config_setting_get_string (setting_enb);
AssertFatal (active_enb[i] != NULL,
- "Failed to parse config file %s, %uth attribute %s \n",
+ "Failed to parse config file %s, %dth attribute %s \n",
lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
active_enb[i] = strdup(active_enb[i]);
num_enb_properties += 1;
@@ -393,7 +393,7 @@ void enb_config_init(const char const * lib_config_file_name_pP)
)
) {
AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %u th enb\n",
+ "Failed to parse eNB configuration file %s, %d th enb\n",
lib_config_file_name_pP, i);
continue; // FIXME this prevents segfaults below, not sure what happens after function exit
}
@@ -441,7 +441,7 @@ void enb_config_init(const char const * lib_config_file_name_pP)
)
) {
AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n",
+ "Failed to parse eNB configuration file %s, %d th enb %d th mme address !\n",
lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
}
diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c
index a50eac95cf..3af47f21a8 100644
--- a/openair3/TEST/EPC_TEST/play_scenario.c
+++ b/openair3/TEST/EPC_TEST/play_scenario.c
@@ -473,7 +473,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP)
setting_enb = config_setting_get_elem(setting, i);
active_enb[i] = config_setting_get_string (setting_enb);
AssertFatal (active_enb[i] != NULL,
- "Failed to parse config file %s, %uth attribute %s \n",
+ "Failed to parse config file %s, %dth attribute %s \n",
lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
active_enb[i] = strdup(active_enb[i]);
num_enb_properties += 1;
@@ -513,7 +513,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP)
)
) {
AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %u th enb\n",
+ "Failed to parse eNB configuration file %s, %d th enb\n",
lib_config_file_name_pP, i);
continue; // FIXME this prevents segfaults below, not sure what happens after function exit
}
@@ -561,7 +561,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP)
)
) {
AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n",
+ "Failed to parse eNB configuration file %s, %d th enb %d th mme address !\n",
lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
}
diff --git a/openair3/TEST/EPC_TEST/play_scenario_parse.c b/openair3/TEST/EPC_TEST/play_scenario_parse.c
index d24fddddec..607ec34dfc 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_parse.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_parse.c
@@ -104,7 +104,7 @@ void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * co
rc = et_hex2data( &s1ap->binary_stream[s1ap->binary_stream_pos], xml_char, xmlStrlen(xml_char));
s1ap->binary_stream_pos += xmlStrlen(xml_char)/2;
//et_display_node(cur_node, 0);
- AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %d rc %d\n", xml_char, xmlStrlen(xml_char), size, rc);
+ AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %u rc %d\n", xml_char, xmlStrlen(xml_char), size, rc);
go_deeper_in_tree = 0;
//}
xmlFree(xml_char);
diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
index d2bf05c086..acc9b18f76 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
@@ -616,7 +616,7 @@ int et_scenario_set_packet_received(et_packet_t * const packet)
if (0 != packet->timer_id) {
rc = timer_remove(packet->timer_id);
- AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %d unknown", packet->packet_number);
+ AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %u unknown", packet->packet_number);
g_scenario->timer_count--;
return rc;
}
@@ -919,7 +919,7 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id,
break;
default:
- AssertFatal(0, "Unknown chunk_type %d packet num %d", packet->sctp_hdr.chunk_type, packet->packet_number);
+ AssertFatal(0, "Unknown chunk_type %d packet num %u", packet->sctp_hdr.chunk_type, packet->packet_number);
;
}
packet = packet->next;
diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
index 001834fcab..bc7ca6afbd 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
@@ -122,7 +122,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
hex[2] = '\0';
end_ptr = hex;
uli = strtoul(hex, &end_ptr, 16);
- AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno);
+ AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %lu errno %d", hex, uli, errno);
s1ap->binary_stream[pos++] = (unsigned char)uli;
} while (pos2 < (2*5));
// update ASN1
diff --git a/openair3/UDP/udp_eNB_task.c b/openair3/UDP/udp_eNB_task.c
index fdcdeb037a..27f754badc 100644
--- a/openair3/UDP/udp_eNB_task.c
+++ b/openair3/UDP/udp_eNB_task.c
@@ -169,7 +169,7 @@ int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id)
if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) {
close(sd);
- AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %u\n",
+ AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %d\n",
strerror(errno), errno, ip_addr, port);
}
diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h
index f1f1d2550a..71d57cc87d 100644
--- a/openair3/UTILS/conversions.h
+++ b/openair3/UTILS/conversions.h
@@ -187,7 +187,7 @@ do { \
#define OCTET_STRING_TO_INT16(aSN, x) \
do { \
- DevCheck((aSN)->size == 2, (aSN)->size, 0, 0); \
+ DevCheck((aSN)->size == 2 || (aSN)->size == 3, (aSN)->size, 0, 0); \
BUFFER_TO_INT16((aSN)->buf, x); \
} while(0)
@@ -210,6 +210,13 @@ do { \
((aSN)->buf[2] << 4) | (aSN)->buf[3]; \
} while(0)
+#define BIT_STRING_TO_NR_CELL_IDENTITY(aSN, vALUE) \
+do { \
+ DevCheck((aSN)->bits_unused == 4, (aSN)->bits_unused, 4, 0); \
+ vALUE = ((aSN)->buf[0] << 28) | ((aSN)->buf[1] << 20) | \
+ ((aSN)->buf[2] << 12) | ((aSN)->buf[3]<<4) | ((aSN)->buf[4]>>4); \
+} while(0)
+
#define MCC_HUNDREDS(vALUE) \
((vALUE) / 100)
/* When MNC is only composed of 2 digits, set the hundreds unit to 0xf */
@@ -237,6 +244,17 @@ do { \
(oCTETsTRING)->size = 3; \
} while(0)
+#define PLMNID_TO_MCC_MNC(oCTETsTRING, mCC, mNC, mNCdIGITlENGTH) \
+do { \
+ mCC = ((oCTETsTRING)->buf[0] & 0x0F) * 100 + \
+ ((oCTETsTRING)->buf[0] >> 4 & 0x0F) * 10 + \
+ ((oCTETsTRING)->buf[1] & 0x0F); \
+ mNCdIGITlENGTH = ((oCTETsTRING)->buf[1] >> 4 & 0x0F) == 0xF ? 2 : 3; \
+ mNC = (mNCdIGITlENGTH == 2 ? 0 : ((oCTETsTRING)->buf[1] >> 4 & 0x0F) * 100) + \
+ ((oCTETsTRING)->buf[2] & 0x0F) * 10 + \
+ ((oCTETsTRING)->buf[2] >> 4 & 0x0F); \
+} while (0)
+
#define MCC_MNC_TO_TBCD(mCC, mNC, mNCdIGITlENGTH, tBCDsTRING) \
do { \
char _buf[3]; \
@@ -299,6 +317,92 @@ do { \
+ pLMN.MNCdigit2 * 10 + pLMN.MNCdigit1; \
} while(0)
+
+/* TS 38.473 v15.2.1 section 9.3.1.32:
+ * C RNTI is BIT_STRING(16)
+ */
+#define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \
+do { \
+ (bITsTRING)->buf = calloc(2, sizeof(uint8_t)); \
+ (bITsTRING)->buf[0] = (mACRO) >> 8; \
+ (bITsTRING)->buf[1] = ((mACRO) & 0x0ff); \
+ (bITsTRING)->size = 2; \
+ (bITsTRING)->bits_unused = 0; \
+} while(0)
+
+
+/* TS 38.473 v15.2.1 section 9.3.2.3:
+ * TRANSPORT LAYER ADDRESS for IPv4 is 32bit (TS 38.414)
+ */
+#define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \
+do { \
+ (bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
+ (bITsTRING)->buf[0] = (mACRO) >> 24 & 0xFF; \
+ (bITsTRING)->buf[1] = (mACRO) >> 16 & 0xFF; \
+ (bITsTRING)->buf[2] = (mACRO) >> 8 & 0xFF; \
+ (bITsTRING)->buf[3] = (mACRO) >> 4 & 0xFF; \
+ (bITsTRING)->size = 4; \
+ (bITsTRING)->bits_unused = 0; \
+} while(0)
+
+#define BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(bITsTRING, mACRO) \
+do { \
+ DevCheck((bITsTRING)->size == 4, (bITsTRING)->size, 4, 0); \
+ DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \
+ mACRO = ((bITsTRING)->buf[0] << 24) + \
+ ((bITsTRING)->buf[1] << 16) + \
+ ((bITsTRING)->buf[2] << 8) + \
+ ((bITsTRING)->buf[3]); \
+} while (0)
+
+
+/* TS 38.473 v15.1.1 section 9.3.1.12:
+ * NR CELL ID
+ */
+#define NR_CELL_ID_TO_BIT_STRING(mACRO, bITsTRING) \
+do { \
+ (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \
+ (bITsTRING)->buf[0] = ((mACRO) >> 28) & 0xff; \
+ (bITsTRING)->buf[1] = ((mACRO) >> 20) & 0xff; \
+ (bITsTRING)->buf[2] = ((mACRO) >> 12) & 0xff; \
+ (bITsTRING)->buf[3] = ((mACRO) >> 4) & 0xff; \
+ (bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \
+ (bITsTRING)->size = 5; \
+ (bITsTRING)->bits_unused = 4; \
+} while(0)
+
+/* TS 38.473 v15.2.1 section 9.3.1.55:
+ * MaskedIMEISV is BIT_STRING(64)
+ */
+#define MaskedIMEISV_TO_BIT_STRING(mACRO, bITsTRING) \
+do { \
+ (bITsTRING)->buf = calloc(8, sizeof(uint8_t)); \
+ (bITsTRING)->buf[0] = (mACRO) >> 56 & 0xFF; \
+ (bITsTRING)->buf[1] = (mACRO) >> 48 & 0xFF; \
+ (bITsTRING)->buf[2] = (mACRO) >> 40 & 0xFF; \
+ (bITsTRING)->buf[3] = (mACRO) >> 32 & 0xFF; \
+ (bITsTRING)->buf[4] = (mACRO) >> 24 & 0xFF; \
+ (bITsTRING)->buf[5] = (mACRO) >> 16 & 0xFF; \
+ (bITsTRING)->buf[6] = (mACRO) >> 8 & 0xFF; \
+ (bITsTRING)->buf[7] = (mACRO) >> 4 & 0xFF; \
+ (bITsTRING)->size = 8; \
+ (bITsTRING)->bits_unused = 0; \
+} while(0)
+
+#define BIT_STRING_TO_MaskedIMEISV(bITsTRING, mACRO) \
+do { \
+ DevCheck((bITsTRING)->size == 8, (bITsTRING)->size, 8, 0); \
+ DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \
+ mACRO = ((bITsTRING)->buf[0] << 56) + \
+ ((bITsTRING)->buf[1] << 48) + \
+ ((bITsTRING)->buf[2] << 40) + \
+ ((bITsTRING)->buf[3] << 32) + \
+ ((bITsTRING)->buf[4] << 24) + \
+ ((bITsTRING)->buf[5] << 16) + \
+ ((bITsTRING)->buf[6] << 8) + \
+ ((bITsTRING)->buf[7]); \
+} while (0)
+
/* TS 36.413 v10.9.0 section 9.2.1.37:
* Macro eNB ID:
* Equal to the 20 leftmost bits of the Cell
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
index be049e255e..febf221c5b 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
+++ b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
@@ -677,7 +677,7 @@ int main(int argc, char** argv) {
} /* pflag */
if (verboselevel >= VERBOSE_LEVEL_MAIN_STEPS) printf("Info: action #5 done.\n");
-
+
fclose(p_elfimage);
/* Did we pretend ? */
diff --git a/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc b/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc
index 79d0a5b7a8..b79e3cec74 100644
--- a/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc
+++ b/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc
@@ -1,4 +1,3 @@
IRIS_OBJ += $(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/iris_lib.o
IRIS_FILE_OBJ += $(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp
IRIS_CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/COMMON -I$(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/COMMON
-
diff --git a/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp
index 34a694a4d5..5b20d8a8c7 100644
--- a/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp
+++ b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp
@@ -335,8 +335,8 @@ static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
#else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
-#endif
-#endif
+#endif
+#endif
}
}
}
@@ -534,7 +534,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
args["driver"] = "iris";
char *iris_addrs = device->openair0_cfg[0].sdr_addrs;
if (iris_addrs == NULL)
- {
+ {
s->iris.push_back(SoapySDR::Device::make(args));
}
else
@@ -695,14 +695,14 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
}
-
+
printf("Actual master clock: %fMHz...\n", (s->iris[r]->getMasterClockRate() / 1e6));
int tx_filt_bw = openair0_cfg[0].tx_bw;
int rx_filt_bw = openair0_cfg[0].rx_bw;
#ifdef MOVE_DC //the filter is centered around the carrier, so we have to expand it if we have moved the DC tone.
- tx_filt_bw *= 3;
- rx_filt_bw *= 3;
+ tx_filt_bw *= 3;
+ rx_filt_bw *= 3;
#endif
/* Setting TX/RX BW */
for (i = 0; i < s->tx_num_channels; i++) {
@@ -848,8 +848,3 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
}
}
/*@}*/
-
-
-
-
-
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index bfdc80f9b5..df4cc2ff02 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -454,7 +454,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
nsamps2 = (nsamps+3)>>2;
int16x8_t buff_tx[2][nsamps2];
#else
- #error Unsupported CPU architecture, USRP device cannot be built
+ #error Unsupported CPU architecture, USRP device cannot be built
#endif
// bring RX data into 12 LSBs for softmodem RX
diff --git a/targets/ARCH/rfsimulator/README.md b/targets/ARCH/rfsimulator/README.md
index 89964decd5..ebe7d72ee0 100644
--- a/targets/ARCH/rfsimulator/README.md
+++ b/targets/ARCH/rfsimulator/README.md
@@ -1,26 +1,14 @@
-#General
+## General
+
This is a RF simulator that allows to test OAI without a RF board.
It replaces a actual RF board driver.
As much as possible, it works like a RF board, but not in realtime: it can run faster than realtime if there is enough CPU or slower (it is CPU bound instead of real time RF sampling bound)
-#build
+## build
-## From build_oai
-You can build it the same way, and together with actual RF driver
+ No specific build is required, use the [oai softmodem build procedure](../../../doc/BUILD.md)
-Example:
-```bash
-./build_oai --ue-nas-use-tun --UE --eNB -w SIMU
-```
-It is also possible to build actual RF and use choose on each run:
-```bash
-./build_oai --ue-nas-use-tun --UE --eNB -w USRP --rfsimulator
-```
-Will build both the eNB (lte-softmodem) and the UE (lte-uesoftmodem)
-We recommend to use the option --ue-nas-use-tun that is much simpler to use than the OAI kernel driver.
-
-## Add the rfsimulator after initial build
After any regular build, you can compile the driver
```bash
cd /build
@@ -35,16 +23,30 @@ It should the set to "enb" in the eNB
## 4G case
For the UE, it should be set to the IP address of the eNB
example:
+
```bash
-sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50
+sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim
```
+For the eNodeB, use a valid configuration file setup for USRP board tests and start the softmodem as usual, but adding the `--rfsim` option.
+
+
+
+```bash
+sudo RFSIMULATOR=enb ./lte-softmodem -O --rfsim
+```
+
+
+
Except this, the UE and the eNB can be used as it the RF is real
If you reach 'RA not active' on UE, be careful to generate a valid SIM
```bash
$OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .
```
+This simulator can also be used with the `--noS1` option, in this case you must run the eNodeB and the UE on different PCs.
+
## 5G case
+
After regular build, add the simulation driver
(don't use ./build_oai -w SIMU until we merge 4G and 5G branches)
```bash
@@ -62,7 +64,8 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C 3510000000
Of course, set the gNB machine IP address if the UE and the gNB are not on the same machine
In UE, you can add "-d" to get the softscope
-#Caveacts
+## Caveacts
+
Still issues in power control: txgain, rxgain are not used
-no S1 mode is currently broken, so we were not able to test the simulator in noS1 mode
+
diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto
new file mode 100644
index 0000000000..39f1656980
--- /dev/null
+++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto
@@ -0,0 +1,163 @@
+package protocol;
+
+
+message fsp_header {
+ optional uint32 version = 1;
+ optional uint32 type = 2;
+ optional uint32 xid = 4;
+}
+
+enum fsp_type {
+ // Discovery and maintenance messages
+ FSPT_HELLO = 0;
+ FSPT_ECHO_REQUEST = 1;
+ FSPT_ECHO_REPLY = 2;
+ FSPT_RLC_DATA_REQ = 3;
+ FSPT_RLC_DATA_REQ_ACK = 4;
+ FSPT_PDCP_DATA_IND = 5;
+ FSPT_PDCP_DATA_IND_ACK = 6;
+}
+
+enum f1u_type {
+ // Discovery and maintenance messages
+ F1U_DL_DATA = 0;
+ F1U_DL_STATUS = 1;
+}
+
+
+message f1u_message{
+ optional flexsplit_direction msg_dir = 100;
+ oneof msg{
+ dl_user_data dl_data = 1;
+ dl_data_delivery_status dl_status = 2;
+ }
+}
+
+
+
+message flexsplit_message {
+ optional flexsplit_direction msg_dir = 100;
+ oneof msg {
+ fsp_hello hello_msg = 1;
+ fsp_echo_request echo_request_msg = 2;
+ fsp_echo_reply echo_reply_msg = 3;
+ fspRlcDataReq data_req_msg = 4;
+ fspRlcDataReqAck data_req_ack = 5;
+ fspPdcpDataInd data_ind_msg = 6;
+ fspPdcpDataIndAck data_ind_ack = 7;
+ }
+}
+
+enum flexsplit_direction {
+ //option allow_alias = true;
+ NOT_SET = 0;
+ INITIATING_MESSAGE = 1;
+ SUCCESSFUL_OUTCOME=2;
+ UNSUCCESSFUL_OUTCOME=3;
+}
+
+enum flexsplit_err {
+ // message errors
+ NO_ERR = 0;
+ MSG_DEQUEUING = -1;
+ MSG_ENQUEUING = -2;
+ MSG_DECODING = -3;
+ MSG_ENCODING = -4;
+ MSG_BUILD = -5;
+ MSG_NOT_SUPPORTED = -6;
+ MSG_NOT_HANDLED = -7;
+ MSG_NOT_VALIDATED = -8;
+ MSG_OUT_DATED = -9;
+
+ // other erros
+ UNEXPECTED = -100;
+}
+
+message fsp_ctxt {
+ optional uint32 fsp_mod_id = 1;
+ optional bool fsp_enb_flag = 2;
+ optional uint32 fsp_instance = 3;
+ optional uint32 fsp_rnti = 4;
+ optional uint32 fsp_frame = 5;
+ optional uint32 fsp_subframe = 6;
+ optional uint32 fsp_eNB_index = 7;
+
+}
+
+message fspRlcPdu {
+ optional bytes fsp_pdu_data = 1; // Maximum PDU to be transfered
+}
+
+message fspRlcData {
+ optional fsp_ctxt fsp_ctxt = 1;
+ optional bool fsp_srb_flag = 2;
+ optional bool fsp_mbms_flag = 3;
+ optional uint32 fsp_rb_id = 4;
+ optional uint32 fsp_muip = 5;
+ optional uint32 fsp_confirm = 6;
+ optional int32 fsp_sdu_buffer_size = 7;
+ optional fspRlcPdu fsp_pdu = 8;
+}
+
+//
+// Maintenance and discovery messages
+//
+
+message fsp_hello {
+ optional fsp_header header = 1;
+}
+
+message fsp_echo_request {
+ optional fsp_header header = 1;
+// extensions 100 to 199;
+}
+
+
+message fsp_echo_reply {
+ optional fsp_header header = 1;
+// extensions 100 to 199;
+}
+
+
+message fspRlcDataReq {
+ optional fsp_header header = 1;
+ optional uint32 eNB_id = 2;
+ optional fspRlcData pdcp_data = 3;
+}
+
+message fspRlcDataReqAck {
+ optional fsp_header header = 1;
+ optional uint32 result = 2;
+}
+
+message fspPdcpDataInd {
+ optional fsp_header header = 1;
+ optional uint32 eNB_id = 2;
+ optional fspRlcData rlc_data = 3;
+}
+
+message fspPdcpDataIndAck {
+ optional fsp_header header = 1;
+ optional uint32 result = 2;
+}
+
+message dl_data_header {
+ required uint32 fields = 1;
+}
+
+message dl_user_data {
+ required dl_data_header header = 1;
+ required bytes pdu = 2;
+ required uint32 frame = 3;
+ required uint32 subframe = 4;
+ required uint32 rnti = 5;
+}
+
+
+message dl_data_delivery_status {
+ required dl_data_header header = 1;
+ required bytes pdu = 2;
+ required uint32 frame = 3;
+ required uint32 subframe = 4;
+ required uint32 rnti = 5;
+}
diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c
index d2dd90b2b4..cfc2bc2215 100644
--- a/targets/COMMON/create_tasks.c
+++ b/targets/COMMON/create_tasks.c
@@ -23,78 +23,73 @@
# include "create_tasks.h"
# include "common/utils/LOG/log.h"
# include "targets/RT/USER/lte-softmodem.h"
+# include "common/ran_context.h"
#ifdef OPENAIR2
- #include "sctp_eNB_task.h"
- #include "x2ap_eNB.h"
- #include "s1ap_eNB.h"
- #include "udp_eNB_task.h"
- #include "gtpv1u_eNB_task.h"
+ #include "sctp_eNB_task.h"
+ #include "x2ap_eNB.h"
+ #include "s1ap_eNB.h"
+ #include "udp_eNB_task.h"
+ #include "gtpv1u_eNB_task.h"
#if ENABLE_RAL
#include "lteRALue.h"
#include "lteRALenb.h"
#endif
#include "RRC/LTE/rrc_defs.h"
#endif
+# include "f1ap_cu_task.h"
+# include "f1ap_du_task.h"
# include "enb_app.h"
+extern RAN_CONTEXT_t RC;
int create_tasks(uint32_t enb_nb) {
LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb);
- itti_wait_ready(1);
+ ngran_node_t type = RC.rrc[0]->node_type;
+ int rc;
- if (enb_nb > 0) {
- /* Last task to create, others task must be ready before its start */
- if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) {
- LOG_E(ENB_APP, "Create task for eNB APP failed\n");
- return -1;
- }
- }
+ if (enb_nb == 0) return 0;
+
+ LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n");
+ rc = itti_create_task (TASK_ENB_APP, eNB_app_task, NULL);
+ AssertFatal(rc >= 0, "Create task for eNB APP failed\n");
+
+ LOG_I(RRC,"Creating RRC eNB Task\n");
+ rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
+ AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
if (EPC_MODE_ENABLED) {
- if (enb_nb > 0) {
- if (is_x2ap_enabled()) {
- if (itti_create_task (TASK_X2AP, x2ap_task, NULL) < 0) {
- LOG_E(X2AP, "Create task for X2AP failed\n");
- return -1;
- }
- } else
- LOG_I(X2AP, "X2AP is disabled.\n");
+ rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
+ AssertFatal(rc >= 0, "Create task for SCTP failed\n");
+ }
- if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
- LOG_E(SCTP, "Create task for SCTP failed\n");
- return -1;
- }
- if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
- LOG_E(S1AP, "Create task for S1AP failed\n");
- return -1;
- }
-
- if(!(get_softmodem_params()->emulate_rf)) {
- if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
- LOG_E(UDP_, "Create task for UDP failed\n");
- return -1;
- }
- }
-
- if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) {
- LOG_E(GTPU, "Create task for GTPV1U failed\n");
- return -1;
- }
+ if (EPC_MODE_ENABLED && !NODE_IS_DU(type)) {
+ rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
+ AssertFatal(rc >= 0, "Create task for S1AP failed\n");
+ if (!(get_softmodem_params()->emulate_rf)){
+ rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL);
+ AssertFatal(rc >= 0, "Create task for UDP failed\n");
}
- } /* if (EPC_MODE_ENABLED) */
-
- if (enb_nb > 0) {
- LOG_I(RRC,"Creating RRC eNB Task\n");
-
- if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
- LOG_E(RRC, "Create task for RRC eNB failed\n");
- return -1;
+ rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
+ AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
+ if (is_x2ap_enabled()) {
+ rc = itti_create_task(TASK_X2AP, x2ap_task, NULL);
+ AssertFatal(rc >= 0, "Create task for X2AP failed\n");
+ } else {
+ LOG_I(X2AP, "X2AP is disabled.\n");
}
}
- itti_wait_ready(0);
+ if (NODE_IS_CU(type)) {
+ rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL);
+ AssertFatal(rc >= 0, "Create task for CU F1AP failed\n");
+ }
+
+ if (NODE_IS_DU(type)) {
+ rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL);
+ AssertFatal(rc >= 0, "Create task for DU F1AP failed\n");
+ }
+
return 0;
}
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf
new file mode 100644
index 0000000000..38d3f5eac9
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf
@@ -0,0 +1,221 @@
+Active_eNBs = ( "eNB-CU-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs = (
+ {
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB-CU-Eurecom-LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ tr_s_preference = "f1"
+
+ local_s_if_name = "lo";
+ remote_s_address = "192.168.12.4";
+ local_s_address = "192.168.12.45";
+ local_s_portc = 501;
+ remote_s_portc = 500;
+ local_s_portd = 601;
+ remote_s_portd = 600;
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNodeB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2665000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 50;
+ pbch_repetition = "FALSE";
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 2;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 0;
+ pdsch_referenceSignalPower = -27;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnable = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /*
+ srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;
+ */
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = 64;
+ rach_preamblesGroupAConfig = "DISABLE";
+ /*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+ */
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -108;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = 128;
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff= 2;
+ ue_TimersAndConstants_t300 = 1000;
+ ue_TimersAndConstants_t301 = 1000;
+ ue_TimersAndConstants_t310 = 1000;
+ ue_TimersAndConstants_t311 = 10000;
+ ue_TimersAndConstants_n310 = 20;
+ ue_TimersAndConstants_n311 = 1;
+ ue_TransmissionMode = 1;
+
+ //Parameters for SIB18
+ rxPool_sc_CP_Len = "normal";
+ rxPool_sc_Period = "sf40";
+ rxPool_data_CP_Len = "normal";
+ rxPool_ResourceConfig_prb_Num = 20;
+ rxPool_ResourceConfig_prb_Start = 5;
+ rxPool_ResourceConfig_prb_End = 44;
+ rxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ rxPool_ResourceConfig_offsetIndicator_choice = 0;
+ rxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ /*
+ rxPool_dataHoppingConfig_hoppingParameter = 0;
+ rxPool_dataHoppingConfig_numSubbands = "ns1";
+ rxPool_dataHoppingConfig_rbOffset = 0;
+ rxPool_commTxResourceUC-ReqAllowed = "TRUE";
+ */
+
+ // Parameters for SIB19
+ discRxPool_cp_Len = "normal"
+ discRxPool_discPeriod = "rf32"
+ discRxPool_numRetx = 1;
+ discRxPool_numRepetition = 2;
+ discRxPool_ResourceConfig_prb_Num = 5;
+ discRxPool_ResourceConfig_prb_Start = 3;
+ discRxPool_ResourceConfig_prb_End = 21;
+ discRxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ discRxPool_ResourceConfig_offsetIndicator_choice = 0;
+ discRxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ }
+ );
+
+
+ srb1_parameters :
+ {
+ # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+ timer_poll_retransmit = 80;
+
+ # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+ timer_reordering = 35;
+
+ # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+ timer_status_prohibit = 0;
+
+ # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+ poll_pdu = 4;
+
+ # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+ poll_byte = 99999;
+
+ # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+ max_retx_threshold = 4;
+ }
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = (
+ {
+ ipv4 = "127.0.1.10";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES : {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.1.30/24";
+ ENB_INTERFACE_NAME_FOR_S1U = "lo";
+ ENB_IPV4_ADDRESS_FOR_S1U = "127.0.1.30/24";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ ENB_IPV4_ADDRESS_FOR_X2C = "127.0.1.30/24";
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ pdcp_log_level = "info";
+ pdcp_log_verbosity = "high";
+ rrc_log_level = "info";
+ rrc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+ gtp_log_level = "info";
+ gtp_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "yes";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf
new file mode 100644
index 0000000000..8e786be5e9
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf
@@ -0,0 +1,119 @@
+Active_eNBs = ( "eNB-Eurecom-DU");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ ////////// Identification parameters:
+ eNB_CU_ID = 0xe00;
+
+ eNB_name = "eNB-Eurecom-DU";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNODEB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2665000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 50;
+ Nid_cell_mbsfn = 0;
+ nb_antenna_ports = 1;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 90;
+ rx_gain = 125;
+
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+ }
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "f1";
+ local_n_if_name = "lo";
+ remote_n_address = "127.0.0.4";
+ local_n_address = "127.0.0.3";
+ local_n_portc = 500;
+ remote_n_portc = 501;
+ local_n_portd = 600;
+ remote_n_portd = 601;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes";
+ nb_tx = 1;
+ nb_rx = 1;
+ att_tx = 10;
+ att_rx = 10;
+ bands = [7];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 125;
+ eNB_instances = [0];
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ hw_log_level = "info";
+ hw_log_verbosity = "medium";
+ phy_log_level = "info";
+ phy_log_verbosity = "medium";
+ mac_log_level = "info";
+ mac_log_verbosity = "high";
+ rlc_log_level = "info";
+ rlc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "yes";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
index ca09ea6625..1f5aeaf777 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
@@ -49,22 +49,22 @@ eNBs =
prach_freq_offset = 1;
pucch_delta_shift = 1;
pucch_nRB_CQI = 0;
- pucch_nCS_AN = 0;
+ pucch_nCS_AN = 0;
pucch_n1_AN = 0;
pdsch_referenceSignalPower = -27;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
- pusch_hoppingOffset = 0;
+ pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
- srs_enable = "DISABLE";
- /* srs_BandwidthConfig =;
+ srs_enable = "DISABLE";
+ /* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
@@ -73,14 +73,14 @@ eNBs =
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
msg3_delta_Preamble = 6;
- pucch_deltaF_Format1 = "deltaF2";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
- pucch_deltaF_Format2b = "deltaF0";
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
- rach_numberOfRA_Preambles = "n64"; #64
- rach_preamblesGroupAConfig = "DISABLE";
+ rach_numberOfRA_Preambles = "n64"; #64
+ rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
@@ -105,7 +105,7 @@ eNBs =
ue_TransmissionMode = "tm1";
# eMTC Parameters
- emtc_parameters :
+ emtc_parameters :
{
eMTC_configured = 1;
#hyperSFN_r13 = 0;
@@ -115,7 +115,7 @@ eNBs =
#SIB1
schedulingInfoSIB1_BR_r13 = 4;
- #system_info_value_tag_SI =
+ #system_info_value_tag_SI =
#(
# {
# systemInfoValueTagSi_r13 = 0;
@@ -124,7 +124,7 @@ eNBs =
cellSelectionInfoCE_r13 = "ENABLE";
q_RxLevMinCE_r13 = -70;
- bandwidthReducedAccessRelatedInfo_r13 = "ENABLE"
+ bandwidthReducedAccessRelatedInfo_r13 = "ENABLE"
si_WindowLength_BR_r13 = "ms20"; #0
si_RepetitionPattern_r13 = "everyRF"; #0
@@ -136,7 +136,7 @@ eNBs =
}
);
- fdd_DownlinkOrTddSubframeBitmapBR_r13 = "subframePattern40-r13";
+ fdd_DownlinkOrTddSubframeBitmapBR_r13 = "subframePattern40-r13";
fdd_DownlinkOrTddSubframeBitmapBR_val_r13 = 0xFFFFFFFFFF;
startSymbolBR_r13 = 2;
si_HoppingConfigCommon_r13 = "off"; #1; # Note: 1==OFF !
@@ -157,14 +157,14 @@ eNBs =
rach_numberOfRA_Preambles = 60; #14
rach_powerRampingStep = 4;
- rach_preambleInitialReceivedTargetPower = -110;
+ rach_preambleInitialReceivedTargetPower = -110;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 64;
rach_maxHARQ_Msg3Tx = 4;
# max size for this array is 4
- rach_CE_LevelInfoList_r13 =
+ rach_CE_LevelInfoList_r13 =
(
{
firstPreamble_r13 = 60;
@@ -175,7 +175,7 @@ eNBs =
}
);
- # BCCH CONFIG
+ # BCCH CONFIG
bcch_modificationPeriodCoeff = 2;
#PCCH Config
@@ -189,7 +189,7 @@ eNBs =
prach_zero_correlation = 1;
prach_freq_offset = 1;
- #PDSCH Config Common
+ #PDSCH Config Common
pdsch_referenceSignalPower = -27
pdsch_p_b = 0;
@@ -213,22 +213,22 @@ eNBs =
pusch_p0_Nominal = -96;
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
- pucch_deltaF_Format1 = "deltaF0";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format1 = "deltaF0";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
msg3_delta_Preamble = 6;
prach_ConfigCommon_v1310 = "ENABLE";
-
+
mpdcch_startSF_CSS_RA_r13 = "fdd-r13";
mpdcch_startSF_CSS_RA_r13_val = "v1"; #0
prach_HoppingOffset_r13 = 0;
-
+
pdsch_maxNumRepetitionCEmodeA_r13 = "r16"; #0
#pdsch_maxNumRepetitionCEmodeB_r13 = "r384"; # NULL - 2
@@ -245,7 +245,7 @@ eNBs =
);
# max size for this array is 4
- prach_parameters_ce_r13 =
+ prach_parameters_ce_r13 =
(
{
prach_config_index_br = 3;
@@ -255,17 +255,17 @@ eNBs =
numRepetitionPerPreambleAttempt_r13 = 1; #0
mpdcch_NumRepetition_RA_r13 = 1; #0
prach_HoppingConfig_r13 = 0; #1
- max_available_narrow_band = [3];
+ max_available_narrow_band = [3];
}
);
- n1PUCCH_AN_InfoList_r13 =
+ n1PUCCH_AN_InfoList_r13 =
(
{
pucch_info_value = 33;
}
);
-
+
ue_TimersAndConstants_t300 = "ms1000";
ue_TimersAndConstants_t301 = "ms400";
@@ -283,21 +283,21 @@ eNBs =
}
- pucch_NumRepetitionCE_Msg4_Level0_r13 = "n1"; #0
+ pucch_NumRepetitionCE_Msg4_Level0_r13 = "n1"; #0
#pucch_NumRepetitionCE_Msg4_Level1_r13 = "n2"; #1
#pucch_NumRepetitionCE_Msg4_Level2_r13 = "n16"; #2
#pucch_NumRepetitionCE_Msg4_Level3_r13 = "n32"; #3
- sib2_freq_hoppingParameters_r13 :
+ sib2_freq_hoppingParameters_r13 :
{
#sib2_mpdcch_pdsch_hoppingNB_r13 = "nb2"; #0
#sib2_interval_DLHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- #sib2_interval_DLHoppingConfigCommonModeA_r13_val = "int1";
+ #sib2_interval_DLHoppingConfigCommonModeA_r13_val = "int1";
#sib2_interval_DLHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- #sib2_interval_DLHoppingConfigCommonModeB_r13_val = "int2";
+ #sib2_interval_DLHoppingConfigCommonModeB_r13_val = "int2";
sib2_interval_ULHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- sib2_interval_ULHoppingConfigCommonModeA_r13_val = "int4"; #2
+ sib2_interval_ULHoppingConfigCommonModeA_r13_val = "int4"; #2
# sib2_interval_ULHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
# sib2_interval_ULHoppingConfigCommonModeB_r13_val = "int2"; #0
@@ -305,11 +305,11 @@ eNBs =
}
rach_preamblesGroupAConfig = "DISABLE";
-
+
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
-
+
}
@@ -399,25 +399,25 @@ eNBs =
);
MACRLCs = (
- {
+ {
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
@@ -428,7 +428,7 @@ RUs = (
max_rxgain = 125;
eNB_instances = [0];
}
-);
+);
log_config :
{
@@ -447,4 +447,3 @@ log_config :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf
index 372c853b29..addd70ca71 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf
@@ -205,18 +205,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
@@ -228,7 +228,7 @@ RUs = (
eNB_instances = [0];
#sdr_addrs = "RF3C000025";
}
-);
+);
NETWORK_CONTROLLER :
{
@@ -266,4 +266,3 @@ THREAD_STRUCT = (
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf
index c55c58e1a7..201a0c1839 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf
@@ -205,18 +205,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1;
nb_rx = 1;
@@ -228,7 +228,7 @@ RUs = (
eNB_instances = [0];
#sdr_addrs = "RF3E000025";
}
-);
+);
NETWORK_CONTROLLER :
{
@@ -266,4 +266,3 @@ THREAD_STRUCT = (
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf
index 5882c1b168..3507906aff 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf
@@ -205,18 +205,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
@@ -228,7 +228,7 @@ RUs = (
eNB_instances = [0];
sdr_addrs = "RF3E000028";
}
-);
+);
NETWORK_CONTROLLER :
{
@@ -266,4 +266,3 @@ THREAD_STRUCT = (
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
index 142b962598..4b3ac5ffad 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
@@ -172,7 +172,7 @@ eNBs =
////////// MME parameters:
- mme_ip_address = ( { ipv4 = "192.168.12.26";
+ mme_ip_address = ( { ipv4 = "10.64.93.19";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
@@ -186,18 +186,47 @@ eNBs =
NETWORK_INTERFACES :
{
- ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
- ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
- ENB_INTERFACE_NAME_FOR_S1U = "eth0";
- ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
+ ENB_INTERFACE_NAME_FOR_S1_MME = "eno1";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "10.64.45.62/23";
+ ENB_INTERFACE_NAME_FOR_S1U = "eno1";
+ ENB_IPV4_ADDRESS_FOR_S1U = "10.64.45.62/23";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
ENB_PORT_FOR_X2C = 36422; # Spec 36422
- };
+ };
+
}
);
+DU = (
+ {
+ DU_INTERFACE_NAME_FOR_F1U = "lo";
+ DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/16";
+ DU_PORT_FOR_F1U = 22100;
+ F1_U_DU_TRANSPORT_TYPE = "TCP";
+ }
+ );
+
+CU = (
+ {
+ CU_INTERFACE_NAME_FOR_F1U = "lo";
+ CU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1"; //Address to search the DU
+ CU_PORT_FOR_F1U = 22100;
+ F1_U_CU_TRANSPORT_TYPE = "TCP"; // One of TCP/UDP/SCTP
+ DU_TYPE = "LTE";
+ }//,
+// {
+// CU_INTERFACE_NAME_FOR_F1U = "eth0";
+// CU_IPV4_ADDRESS_FOR_F1U = "10.64.93.142"; //Address to search the DU
+// CU_PORT_FOR_F1U = 2211;
+// F1_U_CU_TRANSPORT_TYPE = "TCP"; // One of TCP/UDP/SCTP
+// DU_TYPE = "WiFi";
+// }
+ );
+
+ CU_BALANCING = "ALL";
+
MACRLCs = (
{
num_cc = 1;
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 787e630d17..d4c53441d6 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -818,7 +818,6 @@ void tx_rf(RU_t *ru) {
T_INT(0), T_BUFFER(&ru->common.txdata[0][proc->subframe_tx * fp->samples_per_tti], fp->samples_per_tti * 4));
lte_subframe_t SF_type = subframe_select(fp,proc->subframe_tx%10);
lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10);
- lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10);
int sf_extension = 0;
if ((SF_type == SF_DL) ||
@@ -826,24 +825,24 @@ void tx_rf(RU_t *ru) {
int siglen=fp->samples_per_tti,flags=1;
if (SF_type == SF_S) {
- siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
+ /* end_of_burst_delay is used to stop TX only "after a while".
+ * If we stop right after effective signal, with USRP B210 and
+ * B200mini, we observe a high EVM on the S subframe (on the
+ * PSS).
+ * A value of 400 (for 30.72MHz) solves this issue. This is
+ * the default.
+ */
+ siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)
+ + (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples)
+ + ru->end_of_burst_delay;
flags=3; // end of burst
}
- if ((fp->frame_type == TDD) &&
- (SF_type == SF_DL)&&
- (prevSF_type == SF_UL) &&
- (nextSF_type == SF_DL)) {
+ if (fp->frame_type == TDD &&
+ SF_type == SF_DL &&
+ prevSF_type == SF_UL) {
flags = 2; // start of burst
- sf_extension = ru->N_TA_offset;
- }
-
- if ((fp->frame_type == TDD) &&
- (SF_type == SF_DL)&&
- (prevSF_type == SF_UL) &&
- (nextSF_type == SF_UL)) {
- flags = 4; // start of burst and end of burst (only one DL SF between two UL)
- sf_extension = ru->N_TA_offset;
+ sf_extension = ru->sf_extension;
}
#if defined(__x86_64) || defined(__i386__)
@@ -1386,6 +1385,22 @@ int setup_RU_buffers(RU_t *ru) {
* TODO: find a proper cleaner solution
*/
ru->N_TA_offset = 0;
+
+ if (frame_parms->N_RB_DL == 100) /* no scaling to do */;
+ else if (frame_parms->N_RB_DL == 50) {
+ ru->sf_extension /= 2;
+ ru->end_of_burst_delay /= 2;
+ } else if (frame_parms->N_RB_DL == 25) {
+ ru->sf_extension /= 4;
+ ru->end_of_burst_delay /= 4;
+ } else {
+ printf("not handled, todo\n");
+ exit(1);
+ }
+ } else {
+ ru->N_TA_offset = 0;
+ ru->sf_extension = 0;
+ ru->end_of_burst_delay = 0;
}
if (ru->openair0_cfg.mmapped_dma == 1) {
@@ -2883,6 +2898,9 @@ void RCconfig_RU(void) {
RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
+ /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
+ RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr);
+ RC.ru[j]->end_of_burst_delay = *(RUParamList.paramarray[j][RU_END_OF_BURST_DELAY_IDX].uptr);
for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
} //strcmp(local_rf, "yes") == 0
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 15553c0af3..aa8d832ed3 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -653,87 +653,106 @@ int main( int argc, char **argv ) {
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
printf("Runtime table\n");
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
- uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
-#
+ /* Read configuration */
+ if (RC.nb_inst > 0)
+ read_config_and_init();
+
+ /* Start the agent. If it is turned off in the configuration, it won't start */
+ RCconfig_flexran();
+ for (i = 0; i < RC.nb_inst; i++) {
+ flexran_agent_start(i);
+ }
+
+ uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if ( IS_SOFTMODEM_NOS1)
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
pdcp_module_init(pdcp_initmask);
if (RC.nb_inst > 0) {
- // don't create if node doesn't connect to RRC/S1/GTP
+
if (create_tasks(1) < 0) {
printf("cannot create ITTI tasks\n");
- exit(-1); // need a softer mode
+ exit(-1);
}
- printf("ITTI tasks created\n");
- } else {
+ for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) {
+ MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ);
+ RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
+ itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
+ }
+ }
+ else {
printf("No ITTI, Initializing L1\n");
RCconfig_L1();
}
- /* Start the agent. If it is turned off in the configuration, it won't start */
- RCconfig_flexran();
-
- for (i = 0; i < RC.nb_L1_inst; i++) {
- flexran_agent_start(i);
+ if (RC.nb_inst > 0 && NODE_IS_CU(RC.rrc[0]->node_type)) {
+ protocol_ctxt_t ctxt;
+ ctxt.module_id = 0 ;
+ ctxt.instance = 0;
+ ctxt.rnti = 0;
+ ctxt.enb_flag = 1;
+ pdcp_run(&ctxt);
}
- // init UE_PF_PO and mutex lock
- pthread_mutex_init(&ue_pf_po_mutex, NULL);
- memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs);
- mlockall(MCL_CURRENT | MCL_FUTURE);
- pthread_cond_init(&sync_cond,NULL);
- pthread_mutex_init(&sync_mutex, NULL);
-#ifdef XFORMS
- int UE_id;
- printf("XFORMS\n");
-
- if (get_softmodem_params()->do_forms==1) {
- fl_initialize (&argc, argv, NULL, 0, 0);
- form_stats_l2 = create_form_stats_form();
- fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats");
- form_stats = create_form_stats_form();
- fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-
- for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-
- if (otg_enabled) {
- fl_set_button(form_enb[CC_id][UE_id]->button_0,1);
- fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON");
- } else {
- fl_set_button(form_enb[CC_id][UE_id]->button_0,0);
- fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF");
- }
- } // CC_id
- } // UE_id
-
- ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
-
- if (ret == 0)
- pthread_setname_np( forms_thread, "xforms" );
-
- printf("Scope thread created, ret=%d\n",ret);
- }
-
-#endif
- rt_sleep_ns(10*100000000ULL);
-
- if (nfapi_mode) {
- LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
+ /* start threads if only L1 or not a CU */
+ if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) {
+ // init UE_PF_PO and mutex lock
+ pthread_mutex_init(&ue_pf_po_mutex, NULL);
+ memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs);
+ mlockall(MCL_CURRENT | MCL_FUTURE);
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
- }
+
+#ifdef XFORMS
+ int UE_id;
+ printf("XFORMS\n");
- const char *nfapi_mode_str = "";
+ if (get_softmodem_params()->do_forms==1) {
+ fl_initialize (&argc, argv, NULL, 0, 0);
+ form_stats_l2 = create_form_stats_form();
+ fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats");
+ form_stats = create_form_stats_form();
+ fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
- switch(nfapi_mode) {
+ for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
+
+ if (otg_enabled) {
+ fl_set_button(form_enb[CC_id][UE_id]->button_0,1);
+ fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON");
+ } else {
+ fl_set_button(form_enb[CC_id][UE_id]->button_0,0);
+ fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF");
+ }
+ } // CC_id
+ } // UE_id
+
+ ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
+
+ if (ret == 0)
+ pthread_setname_np( forms_thread, "xforms" );
+
+ printf("Scope thread created, ret=%d\n",ret);
+ }
+#endif
+
+ rt_sleep_ns(10*100000000ULL);
+
+ if (nfapi_mode) {
+ LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
+ pthread_cond_init(&sync_cond,NULL);
+ pthread_mutex_init(&sync_mutex, NULL);
+ }
+
+ const char *nfapi_mode_str = "";
+
+ switch(nfapi_mode) {
case 0:
nfapi_mode_str = "MONOLITHIC";
break;
@@ -749,76 +768,78 @@ int main( int argc, char **argv ) {
default:
nfapi_mode_str = "";
break;
- }
+ }
- LOG_I(ENB_APP,"NFAPI MODE:%s\n", nfapi_mode_str);
+ LOG_I(ENB_APP,"NFAPI MODE:%s\n", nfapi_mode_str);
- if (nfapi_mode==2) {// VNF
+ if (nfapi_mode==2) {// VNF
#if defined(PRE_SCD_THREAD)
- init_ru_vnf(); // ru pointer is necessary for pre_scd.
+ init_ru_vnf(); // ru pointer is necessary for pre_scd.
#endif
- wait_nfapi_init("main?");
- }
+ wait_nfapi_init("main?");
+ }
LOG_I(ENB_APP,"START MAIN THREADS\n");
- // start the main threads
- number_of_cards = 1;
- printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
+ // start the main threads
+ number_of_cards = 1;
+ printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
- if (RC.nb_L1_inst > 0) {
- printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
- init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
- // for (inst=0;inst 0) {
+ printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
+ init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
+ // for (inst=0;inst0 && nfapi_mode != 2) {
- printf("Initializing RU threads\n");
- init_RU(get_softmodem_params()->rf_config_file);
+ // RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
+ // but RU thread deals with pre_scd and this is necessary in VNF and simulator.
+ // some initialization is necessary and init_ru_vnf do this.
+ if (RC.nb_RU >0 && nfapi_mode != 2) {
+ printf("Initializing RU threads\n");
+ init_RU(get_softmodem_params()->rf_config_file);
for (ru_id=0; ru_idrf_map.card=0;
- RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
+ RC.ru[ru_id]->rf_map.card=0;
+ RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
+ }
}
- }
- config_sync_var=0;
+ config_sync_var=0;
- if (nfapi_mode==1) { // PNF
- wait_nfapi_init("main?");
- }
+ if (nfapi_mode==1) { // PNF
+ wait_nfapi_init("main?");
+ }
- printf("wait RUs\n");
- fflush(stdout);
- fflush(stderr);
- wait_RUs();
+ printf("wait RUs\n");
+ fflush(stdout);
+ fflush(stderr);
+ wait_RUs();
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
- // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
- printf("ALL RUs ready - init eNBs\n");
+ // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
+ printf("ALL RUs ready - init eNBs\n");
- if (nfapi_mode != 1 && nfapi_mode != 2) {
+ if (nfapi_mode != 1 && nfapi_mode != 2) {
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
- init_eNB_afterRU();
- } else {
+ init_eNB_afterRU();
+ } else {
LOG_I(ENB_APP,"NFAPI mode - DO NOT call init_eNB_afterRU()\n");
- }
+ }
LOG_UI(ENB_APP,"ALL RUs ready - ALL eNBs ready\n");
- // connect the TX/RX buffers
- sleep(1); /* wait for thread activation */
+ // connect the TX/RX buffers
+ sleep(1); /* wait for thread activation */
LOG_I(ENB_APP,"Sending sync to all threads\n");
- pthread_mutex_lock(&sync_mutex);
- sync_var=0;
- pthread_cond_broadcast(&sync_cond);
- pthread_mutex_unlock(&sync_mutex);
- config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
+ pthread_mutex_lock(&sync_mutex);
+ sync_var=0;
+ pthread_cond_broadcast(&sync_cond);
+ pthread_mutex_unlock(&sync_mutex);
+ config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
+ }
+
// wait for end of program
LOG_UI(ENB_APP,"TYPE TO TERMINATE\n");
//getchar();
@@ -826,59 +847,60 @@ int main( int argc, char **argv ) {
oai_exit=1;
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
// stop threads
+
+
+ if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) {
+ int UE_id;
#ifdef XFORMS
- printf("waiting for XFORMS thread\n");
+ printf("waiting for XFORMS thread\n");
- if (get_softmodem_params()->do_forms==1) {
- pthread_join(forms_thread,&status);
- fl_hide_form(form_stats->stats_form);
- fl_free_form(form_stats->stats_form);
- fl_hide_form(form_stats_l2->stats_form);
- fl_free_form(form_stats_l2->stats_form);
+ if (get_softmodem_params()->do_forms==1) {
+ pthread_join(forms_thread,&status);
+ fl_hide_form(form_stats->stats_form);
+ fl_free_form(form_stats->stats_form);
+ fl_hide_form(form_stats_l2->stats_form);
+ fl_free_form(form_stats_l2->stats_form);
- for(UE_id=0; UE_idlte_phy_scope_enb);
- fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb);
+ for(UE_id=0; UE_idlte_phy_scope_enb);
+ fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb);
+ }
}
}
- }
-
#endif
- LOG_I(ENB_APP,"stopping MODEM threads\n");
- stop_eNB(NB_eNB_INST);
- stop_RU(RC.nb_RU);
- /* release memory used by the RU/eNB threads (incomplete), after all
- * threads have been stopped (they partially use the same memory) */
- for (int inst = 0; inst < NB_eNB_INST; inst++) {
- for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
- free_transport(RC.eNB[inst][cc_id]);
- phy_free_lte_eNB(RC.eNB[inst][cc_id]);
+ LOG_I(ENB_APP,"stopping MODEM threads\n");
+ stop_eNB(NB_eNB_INST);
+ stop_RU(RC.nb_RU);
+ /* release memory used by the RU/eNB threads (incomplete), after all
+ * threads have been stopped (they partially use the same memory) */
+ for (int inst = 0; inst < NB_eNB_INST; inst++) {
+ for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
+ free_transport(RC.eNB[inst][cc_id]);
+ phy_free_lte_eNB(RC.eNB[inst][cc_id]);
+ }
}
- }
-
- for (int inst = 0; inst < RC.nb_RU; inst++) {
- phy_free_RU(RC.ru[inst]);
- }
-
- free_lte_top();
- end_configmodule();
- pthread_cond_destroy(&sync_cond);
- pthread_mutex_destroy(&sync_mutex);
- pthread_cond_destroy(&nfapi_sync_cond);
- pthread_mutex_destroy(&nfapi_sync_mutex);
- pthread_mutex_destroy(&ue_pf_po_mutex);
-
- for(ru_id=0; ru_idrfdevice.trx_end_func) {
- RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
- RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
+ for (int inst = 0; inst < RC.nb_RU; inst++) {
+ phy_free_RU(RC.ru[inst]);
}
-
- if (RC.ru[ru_id]->ifdevice.trx_end_func) {
- RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
- RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
+ free_lte_top();
+ end_configmodule();
+ pthread_cond_destroy(&sync_cond);
+ pthread_mutex_destroy(&sync_mutex);
+ pthread_cond_destroy(&nfapi_sync_cond);
+ pthread_mutex_destroy(&nfapi_sync_mutex);
+ pthread_mutex_destroy(&ue_pf_po_mutex);
+
+ for(ru_id=0; ru_idrfdevice.trx_end_func) {
+ RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
+ RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
+ }
+ if (RC.ru[ru_id]->ifdevice.trx_end_func) {
+ RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
+ RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
+ }
}
}
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index f327b83cf9..159cde39ae 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -202,7 +202,6 @@ extern void get_uethreads_params(void);
int transmission_mode=1;
-
char *usrp_args=NULL;
char *usrp_clksrc=NULL;
@@ -446,7 +445,7 @@ static void get_options(void) {
}
UE_scan=0;
-
+
if (tddflag > 0) {
for (CC_id=0; CC_idframe_type = TDD;
@@ -907,14 +906,14 @@ int main( int argc, char **argv ) {
printf("NFAPI MODE:%s\n", nfapi_mode_str);
if (nfapi_mode==3) { // UE-STUB-PNF
- config_sync_var=0;
- wait_nfapi_init("main?");
- //Panos: Temporarily we will be using single set of threads for multiple UEs.
- //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
- init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
+ config_sync_var=0;
+ wait_nfapi_init("main?");
+ //Panos: Temporarily we will be using single set of threads for multiple UEs.
+ //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
+ init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
} else {
- init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
- frame_parms[0]);
+ init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
+ frame_parms[0]);
}
if (get_softmodem_params()->phy_test==0) {
@@ -924,12 +923,12 @@ int main( int argc, char **argv ) {
}
if (nfapi_mode!=3) {
- number_of_cards = 1;
+ number_of_cards = 1;
- for(CC_id=0; CC_idrf_map.card=0;
- PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
- }
+ for(CC_id=0; CC_idrf_map.card=0;
+ PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
+ }
}
// connect the TX/RX buffers
diff --git a/targets/RT/USER/rfsim.h b/targets/RT/USER/rfsim.h
index c5361724c9..f263b1067c 100644
--- a/targets/RT/USER/rfsim.h
+++ b/targets/RT/USER/rfsim.h
@@ -31,6 +31,10 @@ void init_ocm(double snr_dB,double sinr_dB);
void update_ocm(double snr_dB,double sinr_dB);
+//extern pthread_mutex_t async_server_lock;
+//extern pthread_cond_t async_server_notify;
+//extern int async_server_shutdown;
+
void init_channel_vars(void);
#endif