Commit f13f4a5e authored by Rohan's avatar Rohan

QFI copied from uplink pdr for downlink flow

parent 8312b0ab
......@@ -160,7 +160,7 @@ void gtpu_l4_stack::handle_receive_message_cb(
//------------------------------------------------------------------------------
void gtpu_l4_stack::send_g_pdu(
const struct sockaddr_in& peer_addr, const teid_t teid, const char* payload,
const ssize_t payload_len) {
const ssize_t payload_len, uint8_t qfi) {
/* struct gtpuhdr* gtpuhdr = reinterpret_cast<struct gtpuhdr*>(
reinterpret_cast<uintptr_t>(payload) -
(uintptr_t) sizeof(struct gtpuhdr));
......@@ -198,7 +198,7 @@ void gtpu_l4_stack::send_g_pdu(
gtpu_ext_hdr->gtpu_hdr.next_ext_type = GTPU_PDU_SESSION_CONTAINER;
gtpu_ext_hdr->message_length = 0x01;
gtpu_ext_hdr->pdu_type = GTPU_DL_PDU_SESSION_INFORMATION;
gtpu_ext_hdr->qfi = 0x06;
gtpu_ext_hdr->qfi = qfi; // Taken from uplink PDR
gtpu_ext_hdr->next_ext_type = GTPU_NO_MORE_EXTENSION_HEADER;
udp_s.async_send_to(
......
......@@ -89,7 +89,7 @@ class gtpu_l4_stack : public udp_application {
void send_g_pdu(
const struct sockaddr_in& peer_addr, const teid_t teid,
const char* payload, const ssize_t payload_len);
const char* payload, const ssize_t payload_lenz, uint8_t qfi);
void send_g_pdu(
const struct sockaddr_in6& peer_addr, const teid_t teid,
const char* payload, const ssize_t payload_len);
......
......@@ -40,7 +40,7 @@ extern spgwu_config spgwu_cfg;
//------------------------------------------------------------------------------
void pfcp_far::apply_forwarding_rules(
struct iphdr* const iph, const std::size_t num_bytes, bool& nocp,
bool& buff) {
bool& buff, uint8_t qfi) {
// TODO dupl
// TODO nocp
// TODO buff
......@@ -61,7 +61,7 @@ void pfcp_far::apply_forwarding_rules(
spgwu_cfg.s1_up.port,
forwarding_parameters.second.outer_header_creation.second
.teid,
reinterpret_cast<const char*>(iph), num_bytes);
reinterpret_cast<const char*>(iph), num_bytes, qfi);
break;
case OUTER_HEADER_CREATION_GTPU_UDP_IPV6:
......
......@@ -114,7 +114,7 @@ class pfcp_far {
void apply_forwarding_rules(
struct iphdr* const iph, const std::size_t num_bytes, bool& nocp,
bool& buff);
bool& buffz, uint8_t qfi);
};
} // namespace pfcp
......
......@@ -48,6 +48,7 @@ class pfcp_session {
public:
pfcp::fseid_t cp_fseid;
uint64_t seid; // User plane
uint8_t qfi;
// TO DO better than this :(sooner the better) when inserting or removing new
// PDRs, FARS, should not conflict with switching operations
......
......@@ -913,7 +913,10 @@ void pfcp_switch::pfcp_session_look_up_pack_in_access(
if ((*it_pdr)->get(far_id)) {
std::shared_ptr<pfcp::pfcp_far> sfar = {};
if (ssession->get(far_id.far_id, sfar)) {
sfar->apply_forwarding_rules(iph, num_bytes, nocp, buff);
//Maintain uplink QFI in session
uint8_t qfi = (*it_pdr)->pdi.second.qfi.second.qfi;
ssession->qfi = qfi;
sfar->apply_forwarding_rules(iph, num_bytes, nocp, buff, 0);
}
}
}
......@@ -940,7 +943,6 @@ void pfcp_switch::pfcp_session_look_up_pack_in_access(
//------------------------------------------------------------------------------
void pfcp_switch::pfcp_session_look_up_pack_in_core(
const char* buffer, const std::size_t num_bytes) {
// Logger::pfcp_switch().info( "pfcp_session_look_up_pack_in_core %d bytes",
// num_bytes);
struct iphdr* iph = (struct iphdr*) buffer;
std::shared_ptr<std::vector<std::shared_ptr<pfcp::pfcp_pdr>>> pdrs;
......@@ -960,6 +962,9 @@ void pfcp_switch::pfcp_session_look_up_pack_in_core(
pfcp::far_id_t far_id = {};
if ((*it)->get(far_id)) {
std::shared_ptr<pfcp::pfcp_far> sfar = {};
// uint8_t qfi = (*it)->pdi.second.qfi.second.qfi;
// Retrieve uplink QFI value
uint8_t qfi = ssession->qfi;
#if TRACE_IS_ON
Logger::pfcp_switch().trace(
"pfcp_session_look_up_pack_in_core %d bytes, far id %08X",
......@@ -972,7 +977,7 @@ void pfcp_switch::pfcp_session_look_up_pack_in_core(
"far id %08X",
num_bytes, far_id);
#endif
sfar->apply_forwarding_rules(iph, num_bytes, nocp, buff);
sfar->apply_forwarding_rules(iph, num_bytes, nocp, buff, qfi);
if (buff) {
#if TRACE_IS_ON
Logger::pfcp_switch().trace(
......
......@@ -194,7 +194,7 @@ void spgwu_s1u::handle_receive_gtpv1u_msg(
void spgwu_s1u::send_g_pdu(
const struct in_addr& peer_addr, const uint16_t peer_udp_port,
const uint32_t tunnel_id, const char* send_buffer,
const ssize_t num_bytes) {
const ssize_t num_bytes, uint8_t qfi) {
// Logger::spgwu_s1u().info( "spgwu_s1u::send_g_pdu() TEID " TEID_FMT " %d
// bytes", num_bytes);
struct sockaddr_in peer_sock_addr;
......@@ -202,7 +202,7 @@ void spgwu_s1u::send_g_pdu(
peer_sock_addr.sin_addr = peer_addr;
peer_sock_addr.sin_port = htobe16(peer_udp_port);
gtpu_l4_stack::send_g_pdu(
peer_sock_addr, (teid_t) tunnel_id, send_buffer, num_bytes);
peer_sock_addr, (teid_t) tunnel_id, send_buffer, num_bytes, qfi);
}
//------------------------------------------------------------------------------
void spgwu_s1u::send_g_pdu(
......
......@@ -76,7 +76,7 @@ class spgwu_s1u : public gtpv1u::gtpu_l4_stack {
void send_g_pdu(
const struct in_addr& peer_addr, const uint16_t peer_udp_port,
const uint32_t tunnel_id, const char* send_buffer,
const ssize_t num_bytes);
const ssize_t num_bytes, uint8_t qfi);
void send_g_pdu(
const struct in6_addr& peer_addr, const uint16_t peer_udp_port,
const uint32_t tunnel_id, const char* send_buffer,
......
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