Commit 173bf1be authored by gauthier's avatar gauthier

Create task gtpv1u

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5064 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent ffa851e1
all: libgtpv1u.a
OUTDIR = .
libgtpv1u_OBJECTS = \
nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.o \
......@@ -8,41 +8,37 @@ libgtpv1u_OBJECTS = \
gtpv1u_eNB.o \
gtpv1u_teid_pool.o
# pull in dependency info for *existing* .o files
-include $(OUTDIR)/*.d
CFLAGS = \
-I./nw-gtpv1u/shared \
-I./nw-gtpv1u/include \
-I../UTILS \
-I../UTILS/HASHTABLE \
-I../UDP \
-I$(OPENAIR2_DIR) \
-DUSER_MODE \
-DENABLE_USE_MME \
-DUSER_MODE \
-DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 \
-g \
-O2 \
-Wall \
$(GTPV1U_CFLAGS) \
-DENB_MODE \
-Werror=uninitialized \
-Werror=implicit-function-declaration
-include .deps/*.d
-include .deps/nw-gtpv1u/src/*.d
$(libgtpv1u_OBJECTS): %.o : %.c
$(OUTDIR)/%.o : %.c
@echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $<
@if ! test -d ".deps/nw-gtpv1u/src/" ; then mkdir -p .deps/nw-gtpv1u/src/; fi
@$(CC) -MM $(CFLAGS) $*.c > .deps/$*.d
@mv -f .deps/$*.d .deps/$*.d.tmp
@sed -e 's|.*:|$*.o:|' < .deps/$*.d.tmp > .deps/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < .deps/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> .deps/$*.d
@rm -f .deps/$*.d.tmp
libgtpv1u.a: $(libgtpv1u_OBJECTS)
@echo Creating GTP-U archive
@$(AR) rcvs $@ $(libgtpv1u_OBJECTS)
@$(CC) -MM $(CFLAGS) $< > $(basename $@).d
@mv -f $(basename $@).d $(basename $@).d.tmp
@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
@rm -f $(basename $@).d.tmp
objsdir:
@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
$(OUTDIR)/libgtpv1u.a: $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS))
@echo Creating GTPV1U archive
@$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS))
clean:
rm -f libgtpv1u.a
rm -rf .deps/
rm -f $(libgtpv1u_OBJECTS)
\ No newline at end of file
@$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) $(OUTDIR)/libgtpv1u.a
cleanall: clean
\ No newline at end of file
......@@ -10,7 +10,7 @@
#include "gtpv1u_eNB_defs.h"
#include "udp_primitives_client.h"
#include "udp_eNB_task.h"
#include "UTIL/LOG/log.h"
#include "COMMON/platform_types.h"
......@@ -138,7 +138,7 @@ int gtpv1u_create_tunnel_endpoint(gtpv1u_data_t *gtpv1u_data_p, uint8_t ue_id,
struct gtpv1u_ue_data_s *new_ue_p;
struct gtpv1u_ue_data_s *temp;
struct gtpv1u_bearer_s *bearer;
hashtbl_rc_t hash_rc;
hashtable_rc_t hash_rc;
if (rab_id > MAX_BEARERS_PER_UE) {
LOG_E(GTPU, "Could not use rab_id %d > max %d\n",
......@@ -147,7 +147,7 @@ int gtpv1u_create_tunnel_endpoint(gtpv1u_data_t *gtpv1u_data_p, uint8_t ue_id,
}
if ((hash_rc = hashtbl_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, (void**)&new_ue_p)) == HASH_TABLE_OK) {
if ((hash_rc = hashtable_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, (void**)&new_ue_p)) == HASH_TABLE_OK) {
/* A context for this UE already exist in the tree, use it */
/* We check that the tunnel is not already configured */
if (new_ue_p->bearers[rab_id].state != BEARER_DOWN) {
......@@ -166,7 +166,7 @@ int gtpv1u_create_tunnel_endpoint(gtpv1u_data_t *gtpv1u_data_p, uint8_t ue_id,
new_ue_p = calloc(1, sizeof(struct gtpv1u_ue_data_s));
new_ue_p->ue_id = ue_id;
hash_rc = hashtbl_insert(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, new_ue_p);
hash_rc = hashtable_insert(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, new_ue_p);
if ((hash_rc != HASH_TABLE_OK) && (hash_rc != HASH_TABLE_INSERT_OVERWRITTEN_DATA)) {
LOG_E(GTPU, "Failed to insert new UE context\n");
......@@ -254,7 +254,7 @@ int gtpv1u_new_data_req(gtpv1u_data_t *gtpv1u_data_p,
struct gtpv1u_ue_data_s ue;
struct gtpv1u_ue_data_s *ue_inst_p;
struct gtpv1u_bearer_s *bearer_p;
hashtbl_rc_t hash_rc;
hashtable_rc_t hash_rc;
memset(&ue, 0, sizeof(struct gtpv1u_ue_data_s));
......@@ -264,7 +264,7 @@ int gtpv1u_new_data_req(gtpv1u_data_t *gtpv1u_data_p,
assert(rab_id <= MAX_BEARERS_PER_UE);
/* Check that UE context is present in ue map. */
hash_rc = hashtbl_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, (void**)&ue_inst_p);
hash_rc = hashtable_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_id, (void**)&ue_inst_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS ) {
LOG_E(GTPU, "[UE %d] Trying to send data on non-existing UE context\n", ue_id);
......@@ -462,9 +462,9 @@ int gtpv1u_eNB_init(gtpv1u_data_t *gtpv1u_data_p)
gtpv1u_eNB_create_sockets(gtpv1u_data_p);
#endif
/* Initialize UE hashtable */
gtpv1u_data_p->ue_mapping = hashtbl_create (256, NULL, NULL);
gtpv1u_data_p->ue_mapping = hashtable_create (256, NULL, NULL);
if (gtpv1u_data_p->ue_mapping == NULL) {
perror("hashtbl_create");
perror("hashtable_create");
GTPU_ERROR("Initializing TASK_GTPV1_U task interface: ERROR\n");
return -1;
}
......@@ -515,7 +515,7 @@ int gtpv1u_eNB_init(gtpv1u_data_t *gtpv1u_data_p)
return -1;
}
gtpv1u_create_tunnel_endpoint(gtpv1u_data_p, 0, 0, "192.168.1.1", 2152);
//gtpv1u_create_tunnel_endpoint(gtpv1u_data_p, 0, 0, "192.168.1.1", 2152);
// GTPU_INFO("Initializing GTPU stack for eNB %u: DONE\n",
// gtpv1u_data_p->eNB_id);
......
#include "NwGtpv1u.h"
#include "gtpv1u.h"
#include "udp_primitives_client.h"
#include "udp_eNB_task.h"
#include "hashtable.h"
//TEST LG #define GTPU_IN_KERNEL
......
......@@ -192,7 +192,7 @@ static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP)
uint32_t s1u_teid;
gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info;
MessageDef *message_p;
hashtbl_rc_t hash_rc;
hashtable_rc_t hash_rc;
GTPU_DEBUG("Rx GTPV1U_CREATE_TUNNEL_REQ Context %d\n", create_tunnel_reqP->context_teid);
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
......@@ -228,10 +228,10 @@ static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP)
message_p->ittiMsg.gtpv1uCreateTunnelResp.context_teid = create_tunnel_reqP->context_teid;
message_p->ittiMsg.gtpv1uCreateTunnelResp.eps_bearer_id = create_tunnel_reqP->eps_bearer_id;
hash_rc = hashtbl_is_key_exists(gtpv1u_sgw_data.S1U_mapping, s1u_teid);
hash_rc = hashtable_is_key_exists(gtpv1u_sgw_data.S1U_mapping, s1u_teid);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
hash_rc = hashtbl_insert(gtpv1u_sgw_data.S1U_mapping, s1u_teid, gtpv1u_teid2enb_info);
hash_rc = hashtable_insert(gtpv1u_sgw_data.S1U_mapping, s1u_teid, gtpv1u_teid2enb_info);
message_p->ittiMsg.gtpv1uCreateTunnelResp.status = 0;
} else {
message_p->ittiMsg.gtpv1uCreateTunnelResp.status = 0xFF;
......@@ -258,7 +258,7 @@ static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP)
message_p->ittiMsg.gtpv1uDeleteTunnelResp.S1u_teid = S1U_teidP;
message_p->ittiMsg.gtpv1uDeleteTunnelResp.context_teid = context_teidP;
if (hashtbl_remove(gtpv1u_sgw_data.S1U_mapping, S1U_teidP) == HASH_TABLE_OK ) {
if (hashtable_remove(gtpv1u_sgw_data.S1U_mapping, S1U_teidP) == HASH_TABLE_OK ) {
message_p->ittiMsg.gtpv1uDeleteTunnelResp.status = 0;
} else {
message_p->ittiMsg.gtpv1uDeleteTunnelResp.status = -1;
......@@ -270,7 +270,7 @@ static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP)
static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP)
{
hashtbl_rc_t hash_rc;
hashtable_rc_t hash_rc;
gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info;
MessageDef *message_p;
......@@ -280,7 +280,7 @@ static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP)
reqP->enb_S1u_teid);
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_UPDATE_TUNNEL_RESP);
hash_rc = hashtbl_get(gtpv1u_sgw_data.S1U_mapping, reqP->sgw_S1u_teid, (void**)&gtpv1u_teid2enb_info);
hash_rc = hashtable_get(gtpv1u_sgw_data.S1U_mapping, reqP->sgw_S1u_teid, (void**)&gtpv1u_teid2enb_info);
if (hash_rc == HASH_TABLE_OK) {
gtpv1u_teid2enb_info->teid_enb = reqP->enb_S1u_teid;
......@@ -390,7 +390,7 @@ static void *gtpv1u_thread(void *args)
Gtpv1uTunnelDataReq *data_req_p;
NwGtpv1uUlpApiT stack_req;
NwGtpv1uRcT rc;
hashtbl_rc_t hash_rc;
hashtable_rc_t hash_rc;
gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info;
data_req_p = &received_message_p->ittiMsg.gtpv1uTunnelDataReq;
......@@ -407,7 +407,7 @@ static void *gtpv1u_thread(void *args)
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uSendtoInfoT;*/
hash_rc = hashtbl_get(gtpv1u_sgw_data.S1U_mapping, (uint64_t)data_req_p->local_S1u_teid, (void**)&gtpv1u_teid2enb_info);
hash_rc = hashtable_get(gtpv1u_sgw_data.S1U_mapping, (uint64_t)data_req_p->local_S1u_teid, (void**)&gtpv1u_teid2enb_info);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
GTPU_ERROR("nwGtpv1uProcessUlpReq failed: while getting teid %u in hashtable S1U_mapping\n", data_req_p->local_S1u_teid);
......@@ -481,9 +481,9 @@ int gtpv1u_init(const mme_config_t *mme_config_p)
memset(&gtpv1u_sgw_data, 0, sizeof(gtpv1u_sgw_data));
gtpv1u_sgw_data.S1U_mapping = hashtbl_create (8192, NULL, NULL);
gtpv1u_sgw_data.S1U_mapping = hashtable_create (8192, NULL, NULL);
if (gtpv1u_sgw_data.S1U_mapping == NULL) {
perror("hashtbl_create");
perror("hashtable_create");
GTPU_ERROR("Initializing TASK_GTPV1_U task interface: ERROR\n");
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment