Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
585b2e05
Commit
585b2e05
authored
Jun 05, 2023
by
mir
Committed by
Robert Schmidt
Feb 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add naive SDAP classifier
parent
c5073d52
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
9 deletions
+78
-9
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+6
-0
openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c
openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c
+5
-4
openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c
openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c
+5
-3
openair2/SDAP/nr_sdap/nr_sdap_entity.c
openair2/SDAP/nr_sdap/nr_sdap_entity.c
+60
-2
openair2/SDAP/nr_sdap/nr_sdap_entity.h
openair2/SDAP/nr_sdap/nr_sdap_entity.h
+2
-0
No files found.
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
View file @
585b2e05
...
...
@@ -1194,6 +1194,12 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id)
drb
->
delete_entity
(
drb
);
ue
->
drb
[
drb_id
-
1
]
=
NULL
;
LOG_I
(
PDCP
,
"release DRB %d of UE %ld
\n
"
,
drb_id
,
ue_id
);
int
sessionId
=
1
;
nr_sdap_entity_t
*
sdap
=
nr_sdap_get_entity
(
ue_id
,
sessionId
);
/* default */
if
(
sdap
==
NULL
)
LOG_E
(
PDCP
,
"no SDAP entity for UE %ld PDU session ID %d
\n
"
,
ue_id
,
sessionId
);
else
sdap
->
has_second_bearer
=
0
;
}
else
LOG_E
(
PDCP
,
"Attempting to release DRB%d but it is not configured
\n
"
,
drb_id
);
...
...
openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c
View file @
585b2e05
...
...
@@ -78,14 +78,15 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size)
entity
->
tx_size
-=
sdu
->
size
;
entity
->
common
.
stats
.
txpdu_pkts
++
;
entity
->
common
.
stats
.
txpdu_bytes
+=
size
;
/* No need to 'zero' time-of-arrival;
Segmented packets do need to be duplicated in time-sensitive use cases */
if
(
entity
->
common
.
avg_time_is_on
)
{
/*
if (sdu->sdu->time_of_arrival) {
uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
}
*/
/* update buffer status */
entity
->
common
.
bstatus
.
tx_size
-=
sdu
->
size
;
...
...
openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c
View file @
585b2e05
...
...
@@ -521,13 +521,15 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
entity
->
common
.
stats
.
txpdu_pkts
++
;
entity
->
common
.
stats
.
txpdu_bytes
+=
size
;
/* No need to 'zero' time-of-arrival;
Segmented packets do need to be duplicated in time-sensitive use cases */
if
(
entity
->
common
.
avg_time_is_on
)
{
/*
if (sdu->sdu->time_of_arrival) {
uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
}
*/
nr_rlc_free_sdu_segment
(
sdu
);
...
...
openair2/SDAP/nr_sdap/nr_sdap_entity.c
View file @
585b2e05
...
...
@@ -25,6 +25,13 @@
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h"
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
...
...
@@ -56,6 +63,50 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s
return
;
}
/* \brief returns 1 for packets matching criteria, otherwise 1. Criteria is:
* - TCP packet AND dport != 10101 AND dport != 5201 AND second bearer
* - UDP packet AND dport != 10101 AND dport != 5201 AND dport != 2153 AND dport != 2153 AND second bearer
* - ICMP
*/
static
int
analyze_packet_inc
(
nr_sdap_entity_t
*
entity
,
const
unsigned
char
*
sdu_buffer
)
{
// mir
// Naive L4/L3 packet classifier
struct
iphdr
*
hdr
=
(
struct
iphdr
*
)
sdu_buffer
;
if
(
hdr
->
protocol
==
IPPROTO_TCP
){
struct
tcphdr
*
tcp
=
(
struct
tcphdr
*
)((
uint32_t
*
)
hdr
+
hdr
->
ihl
);
//uint16_t const src_port = ntohs(tcp->source);
uint16_t
const
dst_port
=
ntohs
(
tcp
->
dest
);
//printf("TCP pkt src_port %d dst_port %d \n", src_port, dst_port);
if
(
entity
->
is_gnb
&&
entity
->
has_second_bearer
&&
dst_port
!=
10101
&&
dst_port
!=
5201
)
{
return
1
;
}
//printf("TCP\n");
}
else
if
(
hdr
->
protocol
==
IPPROTO_UDP
){
struct
udphdr
*
udp
=
(
struct
udphdr
*
)((
uint32_t
*
)
hdr
+
hdr
->
ihl
);
//uint16_t const src_port = ntohs(udp->source);
uint16_t
const
dst_port
=
ntohs
(
udp
->
dest
);
//printf("UDP pkt src_port %d dst_port %d \n", src_port, dst_port);
if
(
entity
->
is_gnb
&&
entity
->
has_second_bearer
&&
dst_port
!=
10101
&&
dst_port
!=
5201
&&
dst_port
!=
2154
&&
dst_port
!=
2153
)
{
return
1
;
}
}
else
if
(
hdr
->
protocol
==
IPPROTO_ICMP
){
//printf("Ping packet detected \n");
if
(
entity
->
is_gnb
&&
entity
->
has_second_bearer
)
{
return
1
;
}
//printf("ping\n");
//cnt++;
}
else
{
printf
(
"undetected header
\n
"
);
}
return
0
;
}
static
bool
nr_sdap_tx_entity
(
nr_sdap_entity_t
*
entity
,
protocol_ctxt_t
*
ctxt_p
,
const
srb_flag_t
srb_flag
,
...
...
@@ -91,7 +142,9 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
}
if
(
!
pdcp_ent_has_sdap
){
LOG_D
(
SDAP
,
"TX - DRB ID: %ld does not have SDAP
\n
"
,
entity
->
qfi2drb_table
[
qfi
].
drb_id
);
LOG_W
(
SDAP
,
"TX - DRB ID: %ld does not have SDAP
\n
"
,
entity
->
qfi2drb_table
[
qfi
].
drb_id
);
sdap_drb_id
+=
analyze_packet_inc
(
entity
,
sdu_buffer
);
ret
=
nr_pdcp_data_req_drb
(
ctxt_p
,
srb_flag
,
sdap_drb_id
,
...
...
@@ -103,6 +156,7 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
sourceL2Id
,
destinationL2Id
);
if
(
!
ret
)
LOG_E
(
SDAP
,
"%s:%d:%s: PDCP refused PDU
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
...
...
@@ -114,6 +168,8 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
return
0
;
}
sdap_drb_id
+=
analyze_packet_inc
(
entity
,
sdu_buffer
);
if
(
ctxt_p
->
enb_flag
)
{
// gNB
offset
=
SDAP_HDR_LENGTH
;
/*
...
...
@@ -415,11 +471,12 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb,
uint8_t
mappedQFIs2AddCount
)
{
if
(
nr_sdap_get_entity
(
ue_id
,
pdusession_id
))
{
LOG_
E
(
SDAP
,
"SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d
\n
"
,
ue_id
,
pdusession_id
);
LOG_
I
(
SDAP
,
"SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d
\n
"
,
ue_id
,
pdusession_id
);
nr_sdap_entity_t
*
existing_sdap_entity
=
nr_sdap_get_entity
(
ue_id
,
pdusession_id
);
rb_id_t
pdcp_entity
=
existing_sdap_entity
->
default_drb
;
if
(
!
is_gnb
)
nr_sdap_ue_qfi2drb_config
(
existing_sdap_entity
,
pdcp_entity
,
ue_id
,
mapped_qfi_2_add
,
mappedQFIs2AddCount
,
drb_identity
,
has_sdap_rx
,
has_sdap_tx
);
existing_sdap_entity
->
has_second_bearer
=
1
;
return
existing_sdap_entity
;
}
...
...
@@ -433,6 +490,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb,
sdap_entity
->
ue_id
=
ue_id
;
sdap_entity
->
pdusession_id
=
pdusession_id
;
sdap_entity
->
is_gnb
=
is_gnb
;
sdap_entity
->
tx_entity
=
nr_sdap_tx_entity
;
sdap_entity
->
rx_entity
=
nr_sdap_rx_entity
;
...
...
openair2/SDAP/nr_sdap/nr_sdap_entity.h
View file @
585b2e05
...
...
@@ -79,6 +79,8 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s
typedef
struct
nr_sdap_entity_s
{
ue_id_t
ue_id
;
rb_id_t
default_drb
;
int
is_gnb
;
int
has_second_bearer
;
int
pdusession_id
;
qfi2drb_t
qfi2drb_table
[
SDAP_MAX_QFI
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment