forked from acouzens/open5gs
dedicated bearer control plane done between UE and PGW except TFT
This commit is contained in:
parent
257c6f2115
commit
f4ec627532
|
@ -250,7 +250,7 @@ status_t mme_s11_build_create_bearer_response(
|
|||
gtp_create_bearer_response_t *rsp = >p_message.create_bearer_response;
|
||||
|
||||
gtp_cause_t cause;
|
||||
gtp_f_teid_t enb_s1u_teid;
|
||||
gtp_f_teid_t enb_s1u_teid, sgw_s1u_teid;
|
||||
|
||||
d_assert(bearer, return CORE_ERROR, "Null param");
|
||||
|
||||
|
@ -277,6 +277,21 @@ status_t mme_s11_build_create_bearer_response(
|
|||
rsp->bearer_contexts.s1_u_enodeb_f_teid.presence = 1;
|
||||
rsp->bearer_contexts.s1_u_enodeb_f_teid.data = &enb_s1u_teid;
|
||||
rsp->bearer_contexts.s1_u_enodeb_f_teid.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
/* Data Plane(UL) : SGW-S1U */
|
||||
memset(&sgw_s1u_teid, 0, sizeof(gtp_f_teid_t));
|
||||
sgw_s1u_teid.ipv4 = 1;
|
||||
sgw_s1u_teid.interface_type = GTP_F_TEID_S1_U_SGW_GTP_U;
|
||||
sgw_s1u_teid.ipv4_addr = bearer->sgw_s1u_addr;
|
||||
sgw_s1u_teid.teid = htonl(bearer->sgw_s1u_teid);
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.presence = 1;
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.data = &sgw_s1u_teid;
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
/* Bearer Context : Cause */
|
||||
rsp->bearer_contexts.cause.presence = 1;
|
||||
rsp->bearer_contexts.cause.len = sizeof(cause);
|
||||
rsp->bearer_contexts.cause.data = &cause;
|
||||
|
||||
/* TODO : UE Time Zone */
|
||||
|
||||
|
|
|
@ -150,6 +150,9 @@ CORE_DECLARE(pgw_sess_t *) pgw_sess_this(hash_index_t *hi);
|
|||
CORE_DECLARE(pgw_bearer_t*) pgw_bearer_add(pgw_sess_t *sess);
|
||||
CORE_DECLARE(status_t) pgw_bearer_remove(pgw_bearer_t *bearer);
|
||||
CORE_DECLARE(status_t) pgw_bearer_remove_all(pgw_sess_t *sess);
|
||||
CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find(index_t index);
|
||||
CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_pgw_s5u_teid(
|
||||
c_uint32_t pgw_s5u_teid);
|
||||
CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_ebi(
|
||||
pgw_sess_t *sess, c_uint8_t ebi);
|
||||
CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_qci_arp(pgw_sess_t *sess,
|
||||
|
|
|
@ -68,11 +68,13 @@ void pgw_s5c_handle_create_session_request(
|
|||
|
||||
/* Control Plane(DL) : SGW-S5C */
|
||||
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->ipv4_addr;
|
||||
|
||||
/* Control Plane(DL) : SGW-S5U */
|
||||
sgw_s5u_teid = req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.data;
|
||||
d_assert(sgw_s5u_teid, return, "Null param");
|
||||
bearer->sgw_s5u_teid = ntohl(sgw_s5u_teid->teid);
|
||||
bearer->sgw_s5u_addr = sgw_s5u_teid->ipv4_addr;
|
||||
|
||||
|
@ -110,3 +112,58 @@ void pgw_s5c_handle_delete_session_request(
|
|||
gtp_xact_t *xact, pgw_sess_t *sess, gtp_delete_session_request_t *req)
|
||||
{
|
||||
}
|
||||
|
||||
void pgw_s5c_handle_create_bearer_response(
|
||||
gtp_xact_t *xact, pgw_sess_t *sess, gtp_create_bearer_response_t *req)
|
||||
{
|
||||
status_t rv;
|
||||
gtp_f_teid_t *sgw_s5u_teid, *pgw_s5u_teid;
|
||||
pgw_bearer_t *bearer = NULL;
|
||||
|
||||
d_assert(xact, return, "Null param");
|
||||
d_assert(sess, return, "Null param");
|
||||
d_assert(req, return, "Null param");
|
||||
|
||||
if (req->bearer_contexts.presence == 0)
|
||||
{
|
||||
d_error("No Bearer");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.eps_bearer_id.presence == 0)
|
||||
{
|
||||
d_error("No EPS Bearer ID");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.s5_s8_u_pgw_f_teid.presence == 0)
|
||||
{
|
||||
d_error("No PGW TEID");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.s5_s8_u_sgw_f_teid.presence == 0)
|
||||
{
|
||||
d_error("No SGW TEID");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Correlate with PGW-S%U-TEID */
|
||||
pgw_s5u_teid = req->bearer_contexts.s5_s8_u_pgw_f_teid.data;
|
||||
d_assert(pgw_s5u_teid, return, "Null param");
|
||||
|
||||
/* Find the Bearer by PGW-S5U-TEID */
|
||||
bearer = pgw_bearer_find_by_pgw_s5u_teid(ntohl(pgw_s5u_teid->teid));
|
||||
d_assert(bearer, return, "Null param");
|
||||
|
||||
/* Set EBI */
|
||||
bearer->ebi = req->bearer_contexts.eps_bearer_id.u8;
|
||||
|
||||
/* Data Plane(DL) : SGW-S5U */
|
||||
sgw_s5u_teid = req->bearer_contexts.s5_s8_u_sgw_f_teid.data;
|
||||
bearer->sgw_s5u_teid = ntohl(sgw_s5u_teid->teid);
|
||||
bearer->sgw_s5u_addr = sgw_s5u_teid->ipv4_addr;
|
||||
|
||||
rv = gtp_xact_commit(xact);
|
||||
d_assert(rv == CORE_OK, return, "xact_commit error");
|
||||
|
||||
d_trace(3, "[GTP] Create Bearer Response : "
|
||||
"SGW[%d] --> PGW[%d]\n", sess->sgw_s5c_teid, sess->pgw_s5c_teid);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ CORE_DECLARE(void) pgw_s5c_handle_create_session_request(
|
|||
gtp_xact_t *xact, pgw_sess_t *sess, gtp_create_session_request_t *req);
|
||||
CORE_DECLARE(void) pgw_s5c_handle_delete_session_request(
|
||||
gtp_xact_t *xact, pgw_sess_t *sess, gtp_delete_session_request_t *req);
|
||||
CORE_DECLARE(void) pgw_s5c_handle_create_bearer_response(
|
||||
gtp_xact_t *xact, pgw_sess_t *sess, gtp_create_bearer_response_t *req);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -97,19 +97,24 @@ void pgw_state_operational(fsm_t *s, event_t *e)
|
|||
xact, sess, &message->create_session_request);
|
||||
pgw_gx_send_ccr(xact, sess, copybuf,
|
||||
GX_CC_REQUEST_TYPE_INITIAL_REQUEST);
|
||||
break;
|
||||
goto out;
|
||||
case GTP_DELETE_SESSION_REQUEST_TYPE:
|
||||
pgw_s5c_handle_delete_session_request(
|
||||
xact, sess, &message->delete_session_request);
|
||||
pgw_gx_send_ccr(xact, sess, copybuf,
|
||||
GX_CC_REQUEST_TYPE_TERMINATION_REQUEST);
|
||||
goto out;
|
||||
|
||||
case GTP_CREATE_BEARER_RESPONSE_TYPE:
|
||||
pgw_s5c_handle_create_bearer_response(
|
||||
xact, sess, &message->create_bearer_response);
|
||||
break;
|
||||
default:
|
||||
pkbuf_free(copybuf);
|
||||
|
||||
d_warn("Not implmeneted(type:%d)", message->h.type);
|
||||
break;
|
||||
}
|
||||
pkbuf_free(copybuf);
|
||||
out:
|
||||
pkbuf_free(recvbuf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ CORE_DECLARE(sgw_sess_t*) sgw_sess_next(sgw_sess_t *sess);
|
|||
CORE_DECLARE(sgw_bearer_t*) sgw_bearer_add(sgw_sess_t *sess);
|
||||
CORE_DECLARE(status_t) sgw_bearer_remove(sgw_bearer_t *bearer);
|
||||
CORE_DECLARE(status_t) sgw_bearer_remove_all(sgw_sess_t *sess);
|
||||
CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find(index_t index);
|
||||
CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find_by_sgw_s5u_teid(
|
||||
c_uint32_t sgw_s5u_teid);
|
||||
CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find_by_sgw_s1u_teid(
|
||||
|
|
|
@ -74,6 +74,7 @@ void sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact,
|
|||
|
||||
/* Receive Control Plane(DL) : MME-S11 */
|
||||
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->ipv4_addr;
|
||||
|
||||
|
@ -88,6 +89,7 @@ void sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact,
|
|||
|
||||
/* Remove PGW-S5C */
|
||||
pgw_s5c_teid = req->pgw_s5_s8_address_for_control_plane_or_pmip.data;
|
||||
d_assert(pgw_s5c_teid, return, "Null param");
|
||||
|
||||
addr = pgw_s5c_teid->ipv4_addr;
|
||||
port = GTPV2_C_UDP_PORT;
|
||||
|
@ -109,7 +111,7 @@ void sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact,
|
|||
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.presence = 0;
|
||||
|
||||
/* Send Data Plane(DL) : SGW-S5U */
|
||||
/* Data Plane(DL) : SGW-S5U */
|
||||
memset(&sgw_s5u_teid, 0, sizeof(gtp_f_teid_t));
|
||||
sgw_s5u_teid.teid = htonl(bearer->sgw_s5u_teid);
|
||||
sgw_s5u_teid.ipv4_addr = bearer->sgw_s5u_addr;
|
||||
|
@ -165,7 +167,7 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact,
|
|||
}
|
||||
if (req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.presence == 0)
|
||||
{
|
||||
d_error("No GTP TEID");
|
||||
d_error("No eNB TEID");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,7 +175,7 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact,
|
|||
req->bearer_contexts_to_be_modified.eps_bearer_id.u8);
|
||||
d_assert(bearer, return, "No Bearer Context");
|
||||
|
||||
/* Receive Data Plane(DL) : eNB-S1U */
|
||||
/* Data Plane(DL) : eNB-S1U */
|
||||
enb_s1u_teid = req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.data;
|
||||
bearer->enb_s1u_teid = ntohl(enb_s1u_teid->teid);
|
||||
bearer->enb_s1u_addr = enb_s1u_teid->ipv4_addr;
|
||||
|
@ -247,6 +249,103 @@ void sgw_s11_handle_delete_session_request(gtp_xact_t *s11_xact,
|
|||
"SGW[%d] --> PGW[%d]\n", sess->sgw_s5c_teid, sess->pgw_s5c_teid);
|
||||
}
|
||||
|
||||
void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_message_t *gtp_message)
|
||||
{
|
||||
status_t rv;
|
||||
pkbuf_t *pkbuf = NULL;
|
||||
gtp_xact_t *s5c_xact = NULL;
|
||||
sgw_sess_t *sess = NULL;
|
||||
sgw_bearer_t *bearer = NULL;
|
||||
gtp_create_bearer_response_t *req = NULL;
|
||||
|
||||
gtp_f_teid_t *sgw_s1u_teid = NULL, *enb_s1u_teid = NULL;
|
||||
gtp_f_teid_t sgw_s5u_teid, pgw_s5u_teid;
|
||||
|
||||
d_assert(s11_xact, return, "Null param");
|
||||
d_assert(sgw_ue, return, "Null param");
|
||||
d_assert(gtp_message, return, "Null param");
|
||||
s5c_xact = s11_xact->assoc_xact;
|
||||
d_assert(s5c_xact, return, "Null param");
|
||||
|
||||
req = >p_message->create_bearer_response;
|
||||
d_assert(req, return, "Null param");
|
||||
|
||||
if (req->bearer_contexts.presence == 0)
|
||||
{
|
||||
d_error("No Bearer");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.eps_bearer_id.presence == 0)
|
||||
{
|
||||
d_error("No EPS Bearer ID");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.s1_u_enodeb_f_teid.presence == 0)
|
||||
{
|
||||
d_error("No eNB TEID");
|
||||
return;
|
||||
}
|
||||
if (req->bearer_contexts.s4_u_sgsn_f_teid.presence == 0)
|
||||
{
|
||||
d_error("No SGW TEID");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Correlate with SGW-S1U-TEID */
|
||||
sgw_s1u_teid = req->bearer_contexts.s4_u_sgsn_f_teid.data;
|
||||
d_assert(sgw_s1u_teid, return, "Null param");
|
||||
req->bearer_contexts.s4_u_sgsn_f_teid.presence = 0;
|
||||
|
||||
/* Find the Bearer by SGW-S1U-TEID */
|
||||
bearer = sgw_bearer_find_by_sgw_s1u_teid(ntohl(sgw_s1u_teid->teid));
|
||||
d_assert(bearer, return, "Null param");
|
||||
sess = bearer->sess;
|
||||
d_assert(sess, return, "Null param");
|
||||
|
||||
/* Set EBI */
|
||||
bearer->ebi = req->bearer_contexts.eps_bearer_id.u8;
|
||||
|
||||
/* Data Plane(DL) : eNB-S1U */
|
||||
enb_s1u_teid = req->bearer_contexts.s1_u_enodeb_f_teid.data;
|
||||
bearer->enb_s1u_teid = ntohl(enb_s1u_teid->teid);
|
||||
bearer->enb_s1u_addr = enb_s1u_teid->ipv4_addr;
|
||||
req->bearer_contexts.s1_u_enodeb_f_teid.presence = 0;
|
||||
|
||||
/* Data Plane(DL) : SGW-S5U */
|
||||
memset(&sgw_s5u_teid, 0, sizeof(gtp_f_teid_t));
|
||||
sgw_s5u_teid.teid = htonl(bearer->sgw_s5u_teid);
|
||||
sgw_s5u_teid.ipv4_addr = bearer->sgw_s5u_addr;
|
||||
sgw_s5u_teid.interface_type = GTP_F_TEID_S5_S8_SGW_GTP_U;
|
||||
req->bearer_contexts.s5_s8_u_sgw_f_teid.presence = 1;
|
||||
req->bearer_contexts.s5_s8_u_sgw_f_teid.data = &sgw_s5u_teid;
|
||||
req->bearer_contexts.s5_s8_u_sgw_f_teid.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
/* Data Plane(DL) : PGW-S5U */
|
||||
memset(&pgw_s5u_teid, 0, sizeof(gtp_f_teid_t));
|
||||
pgw_s5u_teid.teid = htonl(bearer->pgw_s5u_teid);
|
||||
pgw_s5u_teid.ipv4_addr = bearer->pgw_s5u_addr;
|
||||
pgw_s5u_teid.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_U;
|
||||
req->bearer_contexts.s5_s8_u_pgw_f_teid.presence = 1;
|
||||
req->bearer_contexts.s5_s8_u_pgw_f_teid.data = &pgw_s5u_teid;
|
||||
req->bearer_contexts.s5_s8_u_pgw_f_teid.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
gtp_message->h.type = GTP_CREATE_BEARER_RESPONSE_TYPE;
|
||||
gtp_message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
rv = gtp_build_msg(&pkbuf, gtp_message);
|
||||
d_assert(rv == CORE_OK, return, "gtp build failed");
|
||||
|
||||
rv = gtp_xact_update_tx(s5c_xact, >p_message->h, pkbuf);
|
||||
d_assert(s5c_xact, return, "Null param");
|
||||
|
||||
rv = gtp_xact_commit(s5c_xact);
|
||||
d_assert(rv == CORE_OK, return, "xact_commit error");
|
||||
|
||||
d_trace(3, "[GTP] Create Bearer Response : "
|
||||
"SGW[%d] --> PGW[%d]\n", sess->sgw_s5c_teid, sess->pgw_s5c_teid);
|
||||
}
|
||||
|
||||
void sgw_s11_handle_release_access_bearers_request(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_release_access_bearers_request_t *req)
|
||||
{
|
||||
|
|
|
@ -11,19 +11,17 @@ extern "C" {
|
|||
|
||||
CORE_DECLARE(void) sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_message_t *gtp_message);
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_modify_bearer_request_t *req);
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_delete_session_request(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_message_t *gtp_message);
|
||||
CORE_DECLARE(void) sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact,
|
||||
sgw_ue_t *sgw_ue, gtp_message_t *gtp_message);
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_release_access_bearers_request(
|
||||
gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue,
|
||||
gtp_release_access_bearers_request_t *req);
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_lo_dldata_notification(sgw_bearer_t *bearer);
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_downlink_data_notification_ack(
|
||||
sgw_ue_t *sgw_ue, gtp_downlink_data_notification_acknowledge_t *ack);
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -64,6 +64,7 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact,
|
|||
/* Receive Control Plane(UL) : PGW-S5C */
|
||||
pgw_s5c_teid = rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
|
||||
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->ipv4_addr;
|
||||
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
|
||||
|
@ -71,6 +72,7 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact,
|
|||
|
||||
/* Receive Data Plane(UL) : PGW-S5U */
|
||||
pgw_s5u_teid = rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.data;
|
||||
d_assert(pgw_s5u_teid, return, "Null param");
|
||||
bearer->pgw_s5u_teid = ntohl(pgw_s5u_teid->teid);
|
||||
bearer->pgw_s5u_addr = pgw_s5u_teid->ipv4_addr;
|
||||
rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.presence = 0;
|
||||
|
@ -226,6 +228,7 @@ void sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact,
|
|||
|
||||
/* Receive Data Plane(UL) : PGW-S5U */
|
||||
pgw_s5u_teid = req->bearer_contexts.s5_s8_u_sgw_f_teid.data;
|
||||
d_assert(pgw_s5u_teid, return, "Null param");
|
||||
bearer->pgw_s5u_teid = ntohl(pgw_s5u_teid->teid);
|
||||
bearer->pgw_s5u_addr = pgw_s5u_teid->ipv4_addr;
|
||||
req->bearer_contexts.s5_s8_u_sgw_f_teid.presence = 0;
|
||||
|
|
|
@ -89,6 +89,10 @@ void sgw_state_operational(fsm_t *s, event_t *e)
|
|||
sgw_s11_handle_delete_session_request(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_CREATE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_create_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE:
|
||||
sgw_s11_handle_release_access_bearers_request(xact, sgw_ue,
|
||||
&message.release_access_bearers_request);
|
||||
|
|
Loading…
Reference in New Issue