Commit 85e85fb9 authored by Cedric Roux's avatar Cedric Roux

- Update S1AP and SCTP layers to use ITTI for eNB: may broke the old version...

- Update S1AP and SCTP layers to use ITTI for eNB: may broke the old version of S1AP/SCTP (compile with USE_MME=R10 and ENABLE_ITTI=1)

pre-ci tests passed

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4342 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d0de35dc
S1AP_DIR = $(OPENAIR3_DIR)/OPENAIRMME/S1AP
S1AP_OBJDIR = $(OPENAIR3_DIR)/OPENAIRMME/S1AP/enb_objs
include $(OPENAIR_TARGETS)/SIMU/USER/Makerules
S1AP_OBJDIR = $(S1AP_DIR)/enb_objs
ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
......@@ -26,7 +27,9 @@ libs1ap_OBJECTS = \
$(S1AP_OBJDIR)/s1ap_encoder.o \
$(S1AP_OBJDIR)/s1ap_decoder.o \
$(S1AP_OBJDIR)/s1ap_xer_print.o \
s1ap_eNB_decoder.o s1ap_eNB_encoder.o \
s1ap_eNB_itti_messaging.o \
s1ap_eNB_decoder.o \
s1ap_eNB_encoder.o \
s1ap_eNB_handlers.o \
s1ap_eNB_nnsf.o s1ap_eNB_ue_context.o \
s1ap_eNB_trace.o s1ap_eNB_overload.o \
......@@ -35,42 +38,30 @@ libs1ap_OBJECTS = \
$(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
# pull in dependency info for *existing* .o files
-include .*.d
# -include .*.d
-include *.d
CFLAGS = \
CFLAGS = \
-DENB_MODE \
-DENABLE_USE_MME \
-DEMIT_ASN_DEBUG=1 \
-DUSER_MODE \
-I./MESSAGES \
-I$(S1AP_OBJDIR) \
-I../GTPV1-U \
-I../GTPV1-U/nw-gtpv1u/shared \
-I../GTPV1-U/nw-gtpv1u/include \
-I../SCTP \
-I../UDP \
-I../UTILS \
-I../UTILS/HASHTABLE \
-I$(OPENAIR2_DIR)/COMMON \
-I$(S1AP_DIR) \
-I$(OPENAIR2_DIR) \
-I$(OPENAIR2_DIR)/UTIL \
-I../UTILS \
$(ADD_CFLAGS) \
-DENB_MODE \
-DENABLE_USE_MME \
-DEMIT_ASN_DEBUG_EXTERN \
-DUSER_MODE \
-g \
-O2 \
-Wall \
$(S1AP_CFLAGS) \
-Werror=implicit-function-declaration
$(libs1ap_OBJECTS): %.o : %.c
@echo "Compiling $<"
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $*.c > .$(notdir $*).d
@mv -f .$(notdir $*).d .$(notdir $*).d.tmp
@sed -e 's|.*:|$*.o:|' < .$(notdir $*).d.tmp > .$(notdir $*).d
@sed -e 's/.*://' -e 's/\\$$//' < .$(notdir $*).d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> .$(notdir $*).d
@rm -f .$(notdir $*).tmp
@$(CC) -MM $(CFLAGS) $*.c > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
$(S1AP_OBJDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
mkdir -p $(S1AP_OBJDIR)
......@@ -87,10 +78,19 @@ libs1ap.a: $(S1AP_OBJDIR)/s1ap_ieregen.stamp $(S1AP_OBJDIR)/s1ap_asn1regen.stamp
@$(AR) rcs $@ $(libs1ap_OBJECTS)
clean:
rm -f $(libs1ap_OBJECTS)
rm -f $(libs1ap_OBJECTS:.o=.d)
rm -f libs1ap.a
rm -f $(S1AP_OBJDIR)/s1ap_asn1regen.stamp
rm -f $(S1AP_OBJDIR)/s1ap_ieregen.stamp
rm -f $(S1AP_OBJDIR)/s1ap_decoder.c $(S1AP_OBJDIR)/s1ap_encoder.c
rm -f $(S1AP_OBJDIR)/s1ap_xer_print.c $(S1AP_OBJDIR)/s1ap_ies_defs.h
\ No newline at end of file
@$(RM_F_V) $(libs1ap_OBJECTS)
@$(RM_F_V) .*.d
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.d))
@$(RM_F_V) libs1ap.a
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_asn1regen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_ieregen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_decoder.c $(S1AP_OBJDIR)/s1ap_encoder.c
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_xer_print.c $(S1AP_OBJDIR)/s1ap_ies_defs.h
cleanall: clean
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.h))
showcflags:
@echo s1ap cflags: $(CFLAGS)
\ No newline at end of file
......@@ -41,8 +41,9 @@
#include "S1AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
int asn1_xer_print = 1;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...)
{
if (asn_debug) {
......@@ -56,6 +57,7 @@ inline void ASN_DEBUG(const char *fmt, ...)
va_end(ap);
}
}
#endif
ssize_t s1ap_generate_initiating_message(
uint8_t **buffer,
......
......@@ -44,7 +44,9 @@
// extern int asn_debug_indent;
extern int asn_debug;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...);
#endif
#include "Criticality.h"
#include "Presence.h"
......@@ -400,9 +402,8 @@ extern int asn_debug;
extern int asn1_xer_print;
#if defined(ENB_MODE)
# include "mme_sim.h"
# include "UTIL/LOG/log.h"
# include "eNB_default_values.h"
# include "s1ap_eNB_default_values.h"
# define S1AP_ERROR(x, args...) LOG_E(S1AP, x, ##args)
# define S1AP_WARN(x, args...) LOG_W(S1AP, x, ##args)
# define S1AP_TRAF(x, args...) LOG_T(S1AP, x, ##args)
......@@ -420,19 +421,18 @@ struct s1ap_message_s;
/** \brief Function callback prototype.
**/
#if defined(ENB_MODE)
typedef int (*s1ap_message_decoded_callback)(
eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
struct s1ap_message_s *message_p
);
#else
// typedef int (*s1ap_message_decoded_callback)(
// eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p
// );
typedef int (*s1ap_message_decoded_callback)(
uint32_t assocId,
uint32_t stream,
uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p
);
#endif
/** \brief Encode a successfull outcome message
\param buffer pointer to buffer in which data will be encoded
\param length pointer to the length of buffer
......
This diff is collapsed.
......@@ -31,101 +31,18 @@
#include <stdio.h>
#include <stdint.h>
#include "tree.h"
#include "queue.h"
#include "mme_sim.h"
#include "s1ap_eNB_defs.h"
/** @defgroup _s1ap_impl_ S1AP Layer Reference Implementation for eNB
* @ingroup _ref_implementation_
* @{
*/
#ifndef S1AP_ENB_H_
#define S1AP_ENB_H_
/* Served PLMN identity element */
struct plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
STAILQ_ENTRY(plmn_identity_s) next;
};
/* Served group id element */
struct served_group_id_s {
uint16_t mme_group_id;
STAILQ_ENTRY(served_group_id_s) next;
};
/* Served mme code for a particular MME */
struct mme_code_s {
uint8_t mme_code;
STAILQ_ENTRY(mme_code_s) next;
};
/* Served gummei element */
struct served_gummei_s {
/* Number of MME served PLMNs */
uint8_t nb_served_plmns;
/* List of served PLMNs by MME */
STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns;
/* Number of group id in list */
uint8_t nb_group_id;
/* Served group id list */
STAILQ_HEAD(served_group_ids_s, served_group_id_s) served_group_ids;
/* Number of MME code */
uint8_t nb_mme_code;
/* MME Code to uniquely identify an MME within an MME pool area */
STAILQ_HEAD(mme_codes_s, mme_code_s) mme_codes;
/* Next GUMMEI element */
STAILQ_ENTRY(served_gummei_s) next;
};
/* This structure describes association of a eNB to a MME */
typedef struct s1ap_eNB_mme_data_s {
/* This is the optional name provided by the MME */
char *mme_name;
/* Remote MME IP addr */
char *ip_addr;
/* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max
* number of 8 RATs but in our case only one is used. The LTE related pool
* configuration is included on the first place in the list.
*/
STAILQ_HEAD(served_gummeis_s, served_gummei_s) served_gummei;
/* Relative processing capacity of an MME with respect to the other MMEs
* in the pool in order to load-balance MMEs within a pool as defined
* in TS 23.401.
*/
uint8_t relative_mme_capacity;
/* Current MME overload information (if any). */
s1ap_overload_state_t overload_state;
/* Current eNB->MME S1AP association state */
s1ap_eNB_state_t state;
/* SCTP related data for this MME */
sctp_data_t sctp_data;
/* Next usable stream for UE signalling */
int32_t nextstream;
/* MME descriptors tree, ordered by sctp assoc id */
RB_ENTRY(s1ap_eNB_mme_data_s) entry;
} s1ap_eNB_mme_data_t;
inline int s1ap_eNB_compare_assoc_id(
struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
/* Generate the tree management functions */
RB_PROTOTYPE(s1ap_mme_map, s1ap_eNB_mme_data_s, entry,
s1ap_eNB_compare_assoc_id);
struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(eNB_mme_desc_t *eNB_desc_p,
uint32_t assocId);
int s1ap_eNB_init(eNB_mme_desc_t *eNB_desc_p,
char *local_ip_addr[], int nb_local_ip,
char *remote_ip_addr[], int nb_remote_ip);
void *s1ap_eNB_task(void *arg);
#endif /* S1AP_ENB_H_ */
/**
* @}
*/
......@@ -106,7 +106,8 @@ static int s1ap_eNB_decode_unsuccessful_outcome(s1ap_message *message,
return -1;
}
int s1ap_eNB_decode_pdu(s1ap_message *message, uint8_t *buffer, uint32_t length)
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
const uint32_t length)
{
S1AP_PDU_t pdu;
S1AP_PDU_t *pdu_p = &pdu;
......
......@@ -34,7 +34,7 @@
#ifndef S1AP_ENB_DECODER_H_
#define S1AP_ENB_DECODER_H_
int s1ap_eNB_decode_pdu(s1ap_message *message, uint8_t *buffer, uint32_t length)
__attribute__ ((warn_unused_result));
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
const uint32_t length) __attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_DECODER_H_ */
#ifndef S1AP_ENB_DEFAULT_VALUES_H_
#define S1AP_ENB_DEFAULT_VALUES_H_
#define ENB_TAC (0)
#define ENB_MCC (208)
#define ENB_MNC (34)
#define ENB_NAME "Eurecom ENB"
#define ENB_NAME_FORMAT (ENB_NAME" %u")
#define S1AP_PORT_NUMBER (36412)
#define S1AP_SCTP_PPID (18)
#define X2AP_PORT_NUMBER (36422)
#define X2AP_SCTP_PPID (27)
#define SCTP_OUT_STREAMS (64)
#define SCTP_IN_STREAMS (64)
#define SCTP_MAX_ATTEMPTS (5)
#define SCTP_RECV_BUFFER_SIZE (1024)
#endif /* S1AP_ENB_DEFAULT_VALUES_H_ */
This diff is collapsed.
This diff is collapsed.
......@@ -31,19 +31,7 @@
#ifndef S1AP_ENB_HANDLERS_H_
#define S1AP_ENB_HANDLERS_H_
int s1ap_eNB_handle_message(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p);
int s1ap_eNB_handle_s1_setup_response(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
struct s1ap_message_s *message);
int s1ap_eNB_handle_s1_setup_failure(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
struct s1ap_message_s *message);
int s1ap_eNB_handle_initial_context_request(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
struct s1ap_message_s *message_p);
int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length);
#endif /* S1AP_ENB_HANDLERS_H_ */
#include "intertask_interface.h"
#include "s1ap_eNB_itti_messaging.h"
void s1ap_eNB_itti_send_sctp_data_req(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_S1AP, SCTP_DATA_REQ);
sctp_data_req = &message_p->msg.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_DEFAULT, message_p);
}
#ifndef S1AP_ENB_ITTI_MESSAGING_H_
#define S1AP_ENB_ITTI_MESSAGING_H_
void s1ap_eNB_itti_send_sctp_data_req(int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
#endif /* S1AP_ENB_ITTI_MESSAGING_H_ */
......@@ -32,7 +32,10 @@
#include <stdlib.h>
#include <stdint.h>
#include "mme_sim.h"
#include "intertask_interface.h"
#include "assertions.h"
// #include "conversions.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
......@@ -44,72 +47,69 @@
#include "sctp_primitives_client.h"
#include "assertions.h"
#include "conversions.h"
int s1ap_eNB_ue_capabilities(eNB_mme_desc_t *eNB_desc_p,
s1ap_ue_cap_info_ind_t *ue_cap_info_ind_p)
{
struct s1ap_eNB_ue_context_s *ue_context_p;
UECapabilityInfoIndicationIEs_t *ue_cap_info_ind_ies_p;
s1ap_message message;
uint8_t *buffer;
uint32_t length;
int ret = -1;
DevAssert(ue_cap_info_ind_p != NULL);
DevAssert(eNB_desc_p != NULL);
if ((ue_context_p = s1ap_eNB_get_ue_context(eNB_desc_p, ue_cap_info_ind_p->eNB_ue_s1ap_id)) == NULL)
{
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %u\n",
ue_cap_info_ind_p->eNB_ue_s1ap_id);
return -1;
}
/* UE capabilities message can occur either during an s1ap connected state
* or during initial attach (for example: NAS authentication).
*/
if (!(ue_context_p->ue_state == S1AP_UE_CONNECTED ||
ue_context_p->ue_state == S1AP_UE_WAITING_CSR))
{
S1AP_WARN("You are attempting to send NAS data over non-connected "
"eNB ue s1ap id: %u, current state: %d\n",
ue_cap_info_ind_p->eNB_ue_s1ap_id, ue_context_p->ue_state);
return -1;
}
/* Prepare the S1AP message to encode */
memset(&message, 0, sizeof(s1ap_message));
message.direction = S1AP_PDU_PR_initiatingMessage;
message.procedureCode = ProcedureCode_id_UECapabilityInfoIndication;
ue_cap_info_ind_ies_p = &message.msg.ueCapabilityInfoIndicationIEs;
ue_cap_info_ind_ies_p->ueRadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer;
ue_cap_info_ind_ies_p->ueRadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length;
ue_cap_info_ind_ies_p->eNB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id;
ue_cap_info_ind_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
/* Encode procedure has failed... */
S1AP_ERROR("Failed to encode UE capabilities indication\n");
return -1;
}
/* UE associated signalling -> use the allocated stream */
if ((ret = sctp_send_msg(&ue_context_p->mme_ref->sctp_data, S1AP_SCTP_PPID,
ue_context_p->stream, buffer, length)) < 0)
{
S1AP_ERROR("[SCTP %d] Failed to send message over SCTP: %d\n",
ue_context_p->mme_ref->sctp_data.assoc_id, ret);
}
free(buffer);
return ret;
}
// int s1ap_eNB_ue_capabilities(eNB_mme_desc_t *eNB_desc_p,
// s1ap_ue_cap_info_ind_t *ue_cap_info_ind_p)
// {
// struct s1ap_eNB_ue_context_s *ue_context_p;
// UECapabilityInfoIndicationIEs_t *ue_cap_info_ind_ies_p;
//
// s1ap_message message;
//
// uint8_t *buffer;
// uint32_t length;
// int ret = -1;
//
// DevAssert(ue_cap_info_ind_p != NULL);
// DevAssert(eNB_desc_p != NULL);
//
// if ((ue_context_p = s1ap_eNB_get_ue_context(eNB_desc_p, ue_cap_info_ind_p->eNB_ue_s1ap_id)) == NULL)
// {
// /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
// S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %u\n",
// ue_cap_info_ind_p->eNB_ue_s1ap_id);
// return -1;
// }
//
// /* UE capabilities message can occur either during an s1ap connected state
// * or during initial attach (for example: NAS authentication).
// */
// if (!(ue_context_p->ue_state == S1AP_UE_CONNECTED ||
// ue_context_p->ue_state == S1AP_UE_WAITING_CSR))
// {
// S1AP_WARN("You are attempting to send NAS data over non-connected "
// "eNB ue s1ap id: %u, current state: %d\n",
// ue_cap_info_ind_p->eNB_ue_s1ap_id, ue_context_p->ue_state);
// return -1;
// }
//
// /* Prepare the S1AP message to encode */
// memset(&message, 0, sizeof(s1ap_message));
//
// message.direction = S1AP_PDU_PR_initiatingMessage;
// message.procedureCode = ProcedureCode_id_UECapabilityInfoIndication;
//
// ue_cap_info_ind_ies_p = &message.msg.ueCapabilityInfoIndicationIEs;
//
// ue_cap_info_ind_ies_p->ueRadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer;
// ue_cap_info_ind_ies_p->ueRadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length;
//
// ue_cap_info_ind_ies_p->eNB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id;
// ue_cap_info_ind_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
//
// if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
// /* Encode procedure has failed... */
// S1AP_ERROR("Failed to encode UE capabilities indication\n");
// return -1;
// }
//
// /* UE associated signalling -> use the allocated stream */
// if ((ret = sctp_send_msg(&ue_context_p->mme_ref->sctp_data, S1AP_SCTP_PPID,
// ue_context_p->stream, buffer, length)) < 0)
// {
// S1AP_ERROR("[SCTP %d] Failed to send message over SCTP: %d\n",
// ue_context_p->mme_ref->sctp_data.assoc_id, ret);
// }
//
// free(buffer);
// return ret;
// }
......@@ -31,7 +31,7 @@
#ifndef S1AP_ENB_MANAGEMENT_PROCEDURES_H_
#define S1AP_ENB_MANAGEMENT_PROCEDURES_H_
int s1ap_eNB_ue_capabilities(eNB_mme_desc_t *eNB_desc_p,
s1ap_ue_cap_info_ind_t *ue_cap_info_ind_p);
// int s1ap_eNB_ue_capabilities(eNB_mme_desc_t *eNB_desc_p,
// s1ap_ue_cap_info_ind_t *ue_cap_info_ind_p);
#endif /* S1AP_ENB_MANAGEMENT_PROCEDURES_H_ */
This diff is collapsed.
......@@ -31,14 +31,11 @@
#ifndef S1AP_ENB_NAS_PROCEDURES_H_
#define S1AP_ENB_NAS_PROCEDURES_H_
int s1ap_eNB_nas_uplink(eNB_mme_desc_t *eNB_desc_p,
s1ap_nas_uplink_t *nas_uplink_p);
int s1ap_eNB_handle_nas_downlink(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
int s1ap_eNB_initial_ctxt_resp(eNB_mme_desc_t *eNB_desc_p,
s1ap_initial_ctxt_setup_resp_t *initial_ctxt_resp_p);
// int s1ap_eNB_initial_ctxt_resp(eNB_mme_desc_t *eNB_desc_p,
// s1ap_initial_ctxt_setup_resp_t *initial_ctxt_resp_p);
#endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
......@@ -38,13 +38,15 @@
#include <stdio.h>
#include <stdlib.h>
#include "mme_sim.h"
#include "intertask_interface.h"
#include "s1ap_eNB.h"
#include "s1ap_common.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB_nnsf.h"
struct s1ap_eNB_mme_data_s *
s1ap_eNB_nnsf_select_mme_by_mme_code(eNB_mme_desc_t *eNB_desc_p,
s1ap_eNB_nnsf_select_mme_by_mme_code(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
uint8_t mme_code)
{
......@@ -52,7 +54,7 @@ s1ap_eNB_nnsf_select_mme_by_mme_code(eNB_mme_desc_t *eNB_desc_p,
struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL;
uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, s1ap_mme_map, &eNB_desc_p->s1ap_mme_head) {
RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) {
struct served_gummei_s *gummei_p = NULL;
if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) {
......@@ -112,7 +114,7 @@ s1ap_eNB_nnsf_select_mme_by_mme_code(eNB_mme_desc_t *eNB_desc_p,
}
struct s1ap_eNB_mme_data_s *
s1ap_eNB_nnsf_select_mme_by_gummei(eNB_mme_desc_t *eNB_desc_p,
s1ap_eNB_nnsf_select_mme_by_gummei(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
gummei_t gummei)
{
......@@ -120,7 +122,7 @@ s1ap_eNB_nnsf_select_mme_by_gummei(eNB_mme_desc_t *eNB_desc_p,
struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL;
uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, s1ap_mme_map, &eNB_desc_p->s1ap_mme_head) {
RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) {
struct served_gummei_s *gummei_p = NULL;
if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) {
......
......@@ -37,12 +37,12 @@
#define S1AP_ENB_NNSF_H_
struct s1ap_eNB_mme_data_s*
s1ap_eNB_nnsf_select_mme_by_mme_code(eNB_mme_desc_t *eNB_desc_p,
s1ap_eNB_nnsf_select_mme_by_mme_code(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
uint8_t mme_code);
struct s1ap_eNB_mme_data_s*
s1ap_eNB_nnsf_select_mme_by_gummei(eNB_mme_desc_t *eNB_desc_p,
s1ap_eNB_nnsf_select_mme_by_gummei(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
gummei_t gummei);
......
......@@ -39,6 +39,8 @@
#include <stdlib.h>
#include <stdint.h>
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
......@@ -52,58 +54,69 @@
#include "assertions.h"
int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
// int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p)
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
{
OverloadStartIEs_t *overload_start_p;
s1ap_eNB_mme_data_t *mme_desc_p;
overload_start_p = &message_p->msg.overloadStartIEs;
DevCheck(overload_start_p->overloadResponse.present ==
OverloadResponse_PR_overloadAction,
OverloadResponse_PR_overloadAction, 0, 0);
DevAssert(message_p != NULL);
/* Non UE-associated signalling -> stream 0 */
DevCheck(packet_p->local_stream == 0, packet_p->local_stream,
packet_p->remote_port, packet_p->assoc_id);
overload_start_p = &message_p->msg.overloadStartIEs;
if ((mme_desc_p = s1ap_eNB_get_MME(eNB_desc_p, packet_p->assoc_id)) == NULL) {
/* No MME context associated */
return -1;
}
/* Mark the MME as overloaded and set the overload state according to
* the value received.
*/
mme_desc_p->state = S1AP_ENB_OVERLOAD;
mme_desc_p->overload_state =
overload_start_p->overloadResponse.choice.overloadAction;
// DevCheck(overload_start_p->overloadResponse.present ==
// OverloadResponse_PR_overloadAction,
// OverloadResponse_PR_overloadAction, 0, 0);
//
// /* Non UE-associated signalling -> stream 0 */
// DevCheck(packet_p->local_stream == 0, packet_p->local_stream,
// packet_p->remote_port, packet_p->assoc_id);
//
// if ((mme_desc_p = s1ap_eNB_get_MME(eNB_desc_p, packet_p->assoc_id)) == NULL) {
// /* No MME context associated */
// return -1;
// }
//
// /* Mark the MME as overloaded and set the overload state according to
// * the value received.
// */
// mme_desc_p->state = S1AP_ENB_OVERLOAD;
// mme_desc_p->overload_state =
// overload_start_p->overloadResponse.choice.overloadAction;
return 0;
}
int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p,
sctp_queue_item_t *packet_p,
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
// int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p)
{
/* We received Overload stop message, meaning that the MME is no more
* overloaded. This is an empty message, with only message header and no
* Information Element.
*/
s1ap_eNB_mme_data_t *mme_desc_p;
/* Non UE-associated signalling -> stream 0 */
DevCheck(packet_p->local_stream == 0, packet_p->local_stream,
packet_p->remote_port, packet_p->assoc_id);
if ((mme_desc_p = s1ap_eNB_get_MME(eNB_desc_p, packet_p->assoc_id)) == NULL) {
/* No MME context associated */
return -1;
}