Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.2.2.3 2nd point #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"rlc_rx_um_entity_c.h": "c"
}
}
2 changes: 2 additions & 0 deletions lib/rlc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ set(SOURCES
rlc_rx_am_entity.cpp
rlc_rx_tm_entity.cpp
rlc_rx_um_entity.cpp
rlc_rx_um_entity_c.c
rlc_rx_um_entity_c_wrapper.cpp
)

add_library(srsran_rlc STATIC ${SOURCES})
Expand Down
21 changes: 21 additions & 0 deletions lib/rlc/rlc_rx_um_entity_c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "rlc_rx_um_entity_c.h"

void handle_um_pdu_outside_reassembly_window(rlc_rx_um_entity_t *entity, UMD_PDU *pdu)
{
entity->RX_Next_Highest = pdu->SN + 1;

for (uint16_t i = 0; i < UM_WINDOW_SIZE; i++) {
if (i < entity->RX_Next_Highest - entity->UM_Window_Size) {
entity->received[i] = false;
}
}

if (entity->RX_Next_Reassembly < entity->RX_Next_Highest - entity->UM_Window_Size) {
for (uint16_t i = entity->RX_Next_Highest - entity->UM_Window_Size; i < entity->RX_Next_Highest; i++) {
if (!entity->received[i]) {
entity->RX_Next_Reassembly = i;
break;
}
}
}
}
30 changes: 30 additions & 0 deletions lib/rlc/rlc_rx_um_entity_c.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef RLC_RX_UM_ENTITY_C_H
#define RLC_RX_UM_ENTITY_C_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stdbool.h>

#define UM_WINDOW_SIZE 1024

typedef struct {
uint16_t SN;
} UMD_PDU;

typedef struct {
uint16_t RX_Next_Highest;
uint16_t RX_Next_Reassembly;
uint16_t UM_Window_Size;
bool received[UM_WINDOW_SIZE];
} rlc_rx_um_entity_t;

void handle_um_pdu_outside_reassembly_window(rlc_rx_um_entity_t *entity, UMD_PDU *pdu);

#ifdef __cplusplus
}
#endif

#endif // RLC_RX_UM_ENTITY_C_H
6 changes: 6 additions & 0 deletions lib/rlc/rlc_rx_um_entity_c_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "rlc_rx_um_entity_c_wrapper.h"

void cpp_handle_um_pdu_outside_reassembly_window(rlc_rx_um_entity_t *entity, UMD_PDU *pdu)
{
handle_um_pdu_outside_reassembly_window(entity, pdu);
}
16 changes: 16 additions & 0 deletions lib/rlc/rlc_rx_um_entity_c_wrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef RLC_RX_UM_ENTITY_C_WRAPPER_H
#define RLC_RX_UM_ENTITY_C_WRAPPER_H

#include "rlc_rx_um_entity_c.h"

#ifdef __cplusplus
extern "C" {
#endif

void cpp_handle_um_pdu_outside_reassembly_window(rlc_rx_um_entity_t *entity, UMD_PDU *pdu);

#ifdef __cplusplus
}
#endif

#endif // RLC_RX_UM_ENTITY_C_WRAPPER_H