remove reduant variable in the context

This commit is contained in:
Sukchan Lee 2017-12-06 12:28:24 +09:00
parent 1c587edff5
commit 10becbb998
12 changed files with 16 additions and 48 deletions

View File

@ -1536,9 +1536,6 @@ mme_ue_t* mme_ue_add(enb_ue_t *enb_ue)
list_init(&mme_ue->sess_list);
mme_ue->mme_s11_teid = mme_ue->index;
mme_ue->mme_s11_ipv4 = mme_self()->gtpc_addr;
mme_ue->mme_s11_ipv6 = mme_self()->gtpc_addr6;
CONNECT_SGW_GTP_NODE(mme_ue);
/* Create t3413 timer */

View File

@ -190,14 +190,8 @@ struct _mme_ue_t {
c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1];
guti_t guti;
/* IMPORTANT!
* MME-S11-TEID is same with an index */
c_uint32_t mme_s11_teid;
c_sockaddr_t *mme_s11_ipv4; /* MME S11 IPv4 Address */
c_sockaddr_t *mme_s11_ipv6; /* MME S11 IPv6 Address */
c_uint32_t sgw_s11_teid;
c_uint32_t sgw_s11_addr;
c_uint32_t mme_s11_teid; /* MME-S11-TEID is derived from INDEX */
c_uint32_t sgw_s11_teid; /* SGW-S11-TEID is received from SGW */
/* UE Info */
tai_t tai;
@ -351,13 +345,12 @@ struct _mme_ue_t {
(mme_default_bearer_in_sess(__sESS)->sgw_s1u_addr)))
#define MME_HAVE_SGW_S11_PATH(__mME) \
((__mME) && ((__mME)->sgw_s11_teid) && ((__mME)->sgw_s11_addr))
((__mME) && ((__mME)->sgw_s11_teid))
#define CLEAR_SGW_S11_PATH(__mME) \
do { \
d_assert((__mME), break, "Null param"); \
(__mME)->sgw_s11_teid = 0; \
(__mME)->sgw_s11_addr = 0; \
} while(0)
typedef struct _mme_sess_t {
lnode_t node; /* A node of list_t */

View File

@ -70,7 +70,8 @@ status_t mme_s11_build_create_session_request(
mme_s11_teid.interface_type = GTP_F_TEID_S11_MME_GTP_C;
mme_s11_teid.teid = htonl(mme_ue->mme_s11_teid);
rv = gtp_sockaddr_to_f_teid(
mme_ue->mme_s11_ipv4, mme_ue->mme_s11_ipv6, &mme_s11_teid, &len);
mme_self()->gtpc_addr, mme_self()->gtpc_addr6,
&mme_s11_teid, &len);
d_assert(rv == CORE_OK, return CORE_ERROR,);
req->sender_f_teid_for_control_plane.presence = 1;
req->sender_f_teid_for_control_plane.data = &mme_s11_teid;

View File

@ -72,7 +72,6 @@ void mme_s11_handle_create_session_response(
/* Control Plane(UL) : SGW-S11 */
sgw_s11_teid = rsp->sender_f_teid_for_control_plane.data;
mme_ue->sgw_s11_teid = ntohl(sgw_s11_teid->teid);
mme_ue->sgw_s11_addr = sgw_s11_teid->ip.addr;
memcpy(&pdn->paa, rsp->pdn_address_allocation.data,
rsp->pdn_address_allocation.len);

View File

@ -666,8 +666,6 @@ pgw_sess_t *pgw_sess_add(
d_assert(sess, return NULL, "Null param");
sess->pgw_s5c_teid = sess->index; /* derived from an index */
sess->pgw_s5c_ipv4 = pgw_self()->gtpc_addr;
sess->pgw_s5c_ipv6 = pgw_self()->gtpc_addr6;
/* Set IMSI */
sess->imsi_len = imsi_len;

View File

@ -70,14 +70,8 @@ typedef struct _pgw_sess_t {
lnode_t node; /**< A node of list_t */
index_t index; /**< An index of this node */
/* IMPORTANT!
* PGW-S5C-F-TEID is same with an index */
c_uint32_t pgw_s5c_teid;
c_sockaddr_t *pgw_s5c_ipv4; /* PGW S5C IPv4 Address */
c_sockaddr_t *pgw_s5c_ipv6; /* PGW S5C IPv6 Address */
c_uint32_t sgw_s5c_teid;
c_uint32_t sgw_s5c_addr;
c_uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is derived from INDEX */
c_uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is received from SGW */
/* IMSI */
c_uint8_t imsi[MAX_IMSI_LEN];

View File

@ -49,7 +49,7 @@ status_t pgw_s5c_build_create_session_response(
pgw_s5c_teid.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_C;
pgw_s5c_teid.teid = htonl(sess->pgw_s5c_teid);
rv = gtp_sockaddr_to_f_teid(
sess->pgw_s5c_ipv4, sess->pgw_s5c_ipv6, &pgw_s5c_teid, &len);
pgw_self()->gtpc_addr, pgw_self()->gtpc_addr6, &pgw_s5c_teid, &len);
d_assert(rv == CORE_OK, return CORE_ERROR, );
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
presence = 1;

View File

@ -71,7 +71,6 @@ void pgw_s5c_handle_create_session_request(
sgw_s5c_teid = req->sender_f_teid_for_control_plane.data;
d_assert(sgw_s5c_teid, return, "Null param");
sess->sgw_s5c_teid = ntohl(sgw_s5c_teid->teid);
sess->sgw_s5c_addr = sgw_s5c_teid->ip.addr;
/* Control Plane(DL) : SGW-S5U */
sgw_s5u_teid = req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.data;

View File

@ -417,8 +417,6 @@ sgw_ue_t* sgw_ue_add(
d_assert(sgw_ue, return NULL, "Null param");
sgw_ue->sgw_s11_teid = sgw_ue->index;
sgw_ue->sgw_s11_ipv4 = sgw_self()->gtpc_addr;
sgw_ue->sgw_s11_ipv6 = sgw_self()->gtpc_addr6;
/* Set IMSI */
sgw_ue->imsi_len = imsi_len;
@ -593,8 +591,6 @@ sgw_sess_t *sgw_sess_add(
d_assert(sess, return NULL, "Null param");
sess->sgw_s5c_teid = SGW_S5C_INDEX_TO_TEID(sess->index);
sess->sgw_s5c_ipv4 = sgw_self()->gtpc_addr;
sess->sgw_s5c_ipv6 = sgw_self()->gtpc_addr6;
/* Set APN */
core_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1);

View File

@ -44,13 +44,8 @@ typedef struct _sgw_ue_t {
lnode_t node; /* A node of list_t */
index_t index; /* An index of this node */
/* IMPORTANT!
* SGW-S11-F-TEID is same with an index */
c_uint32_t sgw_s11_teid;
c_sockaddr_t *sgw_s11_ipv4; /* SGW S11 IPv4 Address */
c_sockaddr_t *sgw_s11_ipv6; /* SGW S11 IPv6 Address */
c_uint32_t mme_s11_teid; /* MME-S11-F-TEID */
c_uint32_t mme_s11_addr; /* MME-S11-F-TEID IPv4 Address */
c_uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from INDEX */
c_uint32_t mme_s11_teid; /* MME-S11-TEID is received from MME */
/* UE identity */
c_uint8_t imsi[MAX_IMSI_LEN];
@ -81,18 +76,15 @@ typedef struct _sgw_sess_t {
lnode_t node; /* A node of list_t */
index_t index; /* An index of this node */
/* IMPORTANT!
/*
* SGW-S5C-TEID = INDEX | 0x80000000
* INDEX = SGW-S5C-TEID & ~0x80000000
*/
#define SGW_S5C_TEID(__tEID) (__tEID & 0x80000000)
#define SGW_S5C_TEID_TO_INDEX(__iNDEX) (__iNDEX & ~0x80000000)
#define SGW_S5C_INDEX_TO_TEID(__iNDEX) (__iNDEX | 0x80000000)
c_uint32_t sgw_s5c_teid;
c_sockaddr_t *sgw_s5c_ipv4; /* SGW S5C IPv4 Address */
c_sockaddr_t *sgw_s5c_ipv6; /* SGW S5C IPv6 Address */
c_uint32_t pgw_s5c_teid; /* PGW-S5C-F-TEID */
c_uint32_t pgw_s5c_addr; /* PGW-S5C-F-TEID IPv4 Address */
c_uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is derived from INDEX */
c_uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is received from PGW */
/* APN Configuration */
pdn_t pdn;

View File

@ -85,14 +85,13 @@ void sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact,
mme_s11_teid = req->sender_f_teid_for_control_plane.data;
d_assert(mme_s11_teid, return, "Null param");
sgw_ue->mme_s11_teid = ntohl(mme_s11_teid->teid);
sgw_ue->mme_s11_addr = mme_s11_teid->ip.addr;
/* Send Control Plane(DL) : SGW-S5C */
memset(&sgw_s5c_teid, 0, sizeof(gtp_f_teid_t));
sgw_s5c_teid.interface_type = GTP_F_TEID_S5_S8_SGW_GTP_C;
sgw_s5c_teid.teid = htonl(sess->sgw_s5c_teid);
rv = gtp_sockaddr_to_f_teid(
sess->sgw_s5c_ipv4, sess->sgw_s5c_ipv6, &sgw_s5c_teid, &len);
sgw_self()->gtpc_addr, sgw_self()->gtpc_addr6, &sgw_s5c_teid, &len);
d_assert(rv == CORE_OK, return,);
req->sender_f_teid_for_control_plane.presence = 1;
req->sender_f_teid_for_control_plane.data = &sgw_s5c_teid;

View File

@ -73,7 +73,6 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact,
data;
d_assert(pgw_s5c_teid, return, "Null param");
sess->pgw_s5c_teid = ntohl(pgw_s5c_teid->teid);
sess->pgw_s5c_addr = pgw_s5c_teid->ip.addr;
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
presence = 0;
@ -89,7 +88,8 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact,
sgw_s11_teid.interface_type = GTP_F_TEID_S11_S4_SGW_GTP_C;
sgw_s11_teid.teid = htonl(sgw_ue->sgw_s11_teid);
rv = gtp_sockaddr_to_f_teid(
sgw_ue->sgw_s11_ipv4, sgw_ue->sgw_s11_ipv6, &sgw_s11_teid, &len);
sgw_self()->gtpc_addr, sgw_self()->gtpc_addr6,
&sgw_s11_teid, &len);
d_assert(rv == CORE_OK, return, );
rsp->sender_f_teid_for_control_plane.presence = 1;
rsp->sender_f_teid_for_control_plane.data = &sgw_s11_teid;