UPF Performance enhancement (#3306) (#3318)

* [UPF/SGW-U] Optimizing data-path (#3306)

In ogs_pfcp_up_handle_pdr, there is a copy operation performed on recvbuf,
which can reduce the sending performance in the data path. Personally,
We believe that this copy operation can be eliminated.

Of course, if it is canceled, the recvbuf does not need to be released again
at the location where ogs_pfcp_up_handle_pdr is called. After testing,
it has indeed shown an improvement in performance of approximately 15-18%.

   /*
    sendbuf = ogs_pkbuf_copy(recvbuf);
    if (!sendbuf) {
        ogs_error("ogs_pkbuf_copy() failed");
        return false;
    }*/
    sendbuf = recvbuf;</div>

* update it
This commit is contained in:
Sukchan Lee
2024-07-12 13:32:58 +09:00
committed by GitHub
parent 1b82ff08b6
commit eebbfd28b3
3 changed files with 29 additions and 11 deletions

View File

@@ -227,14 +227,13 @@ bool ogs_pfcp_up_handle_association_setup_response(
bool ogs_pfcp_up_handle_pdr(
ogs_pfcp_pdr_t *pdr, uint8_t type,
ogs_gtp2_header_desc_t *recvhdr, ogs_pkbuf_t *recvbuf,
ogs_gtp2_header_desc_t *recvhdr, ogs_pkbuf_t *sendbuf,
ogs_pfcp_user_plane_report_t *report)
{
ogs_pfcp_far_t *far = NULL;
ogs_pkbuf_t *sendbuf = NULL;
bool buffering;
ogs_assert(recvbuf);
ogs_assert(sendbuf);
ogs_assert(type);
ogs_assert(pdr);
ogs_assert(report);
@@ -244,12 +243,6 @@ bool ogs_pfcp_up_handle_pdr(
memset(report, 0, sizeof(*report));
sendbuf = ogs_pkbuf_copy(recvbuf);
if (!sendbuf) {
ogs_error("ogs_pkbuf_copy() failed");
return false;
}
buffering = false;
if (!far->gnode) {

View File

@@ -276,6 +276,12 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
ogs_assert(OGS_OK ==
sgwu_pfcp_send_session_report_request(sess, &report));
}
/*
* The ogs_pfcp_up_handle_pdr() function
* buffers or frees the Packet Buffer(pkbuf) memory.
*/
return;
} else {
ogs_error("[DROP] Invalid GTPU Type [%d]", header_desc.type);
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);

View File

@@ -242,6 +242,12 @@ static void _gtpv1_tun_recv_common_cb(
upf_pfcp_send_session_report_request(sess, &report));
}
/*
* The ogs_pfcp_up_handle_pdr() function
* buffers or frees the Packet Buffer(pkbuf) memory.
*/
return;
cleanup:
ogs_pkbuf_free(recvbuf);
}
@@ -366,7 +372,6 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
ogs_error("[DROP] Cannot find FAR by Error-Indication");
ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len);
}
} else if (header_desc.type == OGS_GTPU_MSGTYPE_GPDU) {
uint16_t eth_type = 0;
struct ip *ip_h = NULL;
@@ -669,6 +674,12 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
upf_pfcp_send_session_report_request(sess, &report));
}
/*
* The ogs_pfcp_up_handle_pdr() function
* buffers or frees the Packet Buffer(pkbuf) memory.
*/
return;
} else if (far->dst_if == OGS_PFCP_INTERFACE_CP_FUNCTION) {
if (!far->gnode) {
@@ -687,6 +698,12 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
ogs_assert(report.type.downlink_data_report == 0);
/*
* The ogs_pfcp_up_handle_pdr() function
* buffers or frees the Packet Buffer(pkbuf) memory.
*/
return;
} else {
ogs_fatal("Not implemented : FAR-DST_IF[%d]", far->dst_if);
ogs_assert_if_reached();
@@ -872,10 +889,12 @@ static void upf_gtp_handle_multicast(ogs_pkbuf_t *recvbuf)
ogs_list_for_each(&sess->pfcp.pdr_list, pdr) {
if (pdr->src_if == OGS_PFCP_INTERFACE_CORE) {
ogs_pkbuf_t *sendbuf = ogs_pkbuf_copy(recvbuf);
ogs_assert(sendbuf);
ogs_assert(true ==
ogs_pfcp_up_handle_pdr(
pdr, OGS_GTPU_MSGTYPE_GPDU,
NULL, recvbuf, &report));
NULL, sendbuf, &report));
break;
}
}