Commit 0b0fabaa authored by Cedric Roux's avatar Cedric Roux
Browse files

- Fix recent issues with ping in pre-ci

- Corrected PDCP layer to manage more than one UE correctly
	* use eNB_id, UE_id as identifiers for connections
	* splitted UE/eNB data
	* Use the real rb_id for index in array (instead of the one used for communication with RLC/IP driver

pre-ci OK, except for the random issue related to Msg3

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4730 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 068807e1
......@@ -23,7 +23,8 @@
#endif
extern unsigned char pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, u32 muiP, u32 confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 is_data_pdu);
extern unsigned char pdcp_data_req(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, u32 muiP, u32 confirmP, \
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode);
inline NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
......@@ -60,7 +61,8 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
GTPU_DEBUG("Received T-PDU from gtpv1u stack %u with size %d",
pUlpApi->apiInfo.recvMsgInfo.teid, buffer_len);
pdcp_data_req(0, // module_id,
pdcp_data_req(0, // eNB_idx,
0, // UE idx
0, // frame
1, // enb flag
5, // rb id
......
......@@ -24,6 +24,8 @@ typedef struct RrcDcchDataReq_s {
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint8_t ue_index;
uint8_t eNB_index;
} RrcDcchDataReq;
typedef struct RrcDcchDataInd_s {
......@@ -32,6 +34,7 @@ typedef struct RrcDcchDataInd_s {
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t ue_index;
uint8_t eNB_index;
} RrcDcchDataInd;
#endif /* PDCP_MESSAGES_TYPES_H_ */
......@@ -52,20 +52,21 @@
# define MAX_RG 2
#endif
# define MAX_MANAGED_RG_PER_MOBILE 2
# define DEFAULT_RAB_ID 3
# define NB_RB_MAX 11
# define NB_RAB_MAX 8 // 4
# define RAB_SHIFT1 9
# define RAB_SHIFT2 3
# define RAB_OFFSET 0x0007
# define RAB_OFFSET1 0x7E00
# define RAB_OFFSET2 0x01F8
# define DIR_OFFSET 0x8000
# define DIR_SHIFT 15
# define CH_OFFSET 0x0004
# define CH_SHIFT 2
#define MAX_MANAGED_RG_PER_MOBILE 2
#define DEFAULT_RAB_ID 3
#define NB_RB_MAX 11
#define NB_RAB_MAX 8
#define RAB_SHIFT1 9
#define RAB_SHIFT2 3
#define RAB_OFFSET 0x0007
#define RAB_OFFSET1 0x7E00
#define RAB_OFFSET2 0x01F8
#define DIR_OFFSET 0x8000
#define DIR_SHIFT 15
#define CH_OFFSET 0x0004
#define CH_SHIFT 2
#ifdef MESH
# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
......
......@@ -69,6 +69,8 @@
# include "intertask_interface.h"
#endif
#include "assertions.h"
#define DEBUG_HEADER_PARSING 1
#define ENABLE_MAC_PAYLOAD_DEBUG
......@@ -209,6 +211,8 @@ u32 ue_get_SR(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti, u8 subframe) {
int T=0;
// int sfn=0;
DevCheck(Mod_id < NB_UE_INST, Mod_id, NB_UE_INST, 0);
// determin the measurement gap
LOG_D(MAC,"[UE %d][SR %x] Frame %d subframe %d PHY asks for SR (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
Mod_id,rnti,frame,subframe,
......@@ -1011,8 +1015,9 @@ void ue_get_sdu(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index,u8 *ulsch_buffer,u
u8 dcch_header_len_tmp=0, dtch_header_len_tmp=0;
u8 bsr_header_len=0, bsr_ce_len=0, bsr_len=0;
u8 phr_header_len=0, phr_ce_len=0,phr_len=0;
u16 sdu_lengths[8];
u8 sdu_lcids[8],payload_offset=0,num_sdus=0;
u16 sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8 sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8 payload_offset=0,num_sdus=0;
u8 ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
u16 sdu_length_total=0;
BSR_SHORT bsr_short;
......
This diff is collapsed.
......@@ -237,7 +237,8 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla
* \note None
* @ingroup _pdcp
*/
public_pdcp(BOOL pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, u32 muiP, u32 confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode);)
public_pdcp(BOOL pdcp_data_req(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, u32 muiP, u32 confirmP, \
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode));
/*! \fn BOOL pdcp_data_ind(module_id_t, u32_t, u8_t, u8_t, rb_id_t, sdu_size_t, unsigned char*)
* \brief This functions handles data transfer indications coming from RLC
......@@ -253,8 +254,8 @@ public_pdcp(BOOL pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_fla
* \note None
* @ingroup _pdcp
*/
public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t rab_id, sdu_size_t sdu_buffer_size, \
mem_block_t* sdu_buffer, u8 is_data_plane);)
public_pdcp(BOOL pdcp_data_ind(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t rb_id, sdu_size_t sdu_buffer_size,
mem_block_t* sdu_buffer, u8 is_data_plane));
#endif // PDCP_UNIT_TEST
/*! \fn void rrc_pdcp_config_req(module_id_t, rb_id_t,u8)
......@@ -268,8 +269,7 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla
* \note None
* @ingroup _pdcp
*/
public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rab_id, u8 security_mode);)
public_pdcp(void rrc_pdcp_config_req (u8 eNB_id, u8 UE_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 security_mode);)
/*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer.
......@@ -287,7 +287,7 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB
* \return A status about the processing, OK or error code.
*/
public_pdcp(
BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index,
BOOL rrc_pdcp_config_asn1_req (u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag,
SRB_ToAddModList_t* srb2add_list,
DRB_ToAddModList_t* drb2add_list,
DRB_ToReleaseList_t* drb2release_list,
......@@ -316,13 +316,13 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
* \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code.
*/
public_pdcp(BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index,
rlc_mode_t rlc_mode, u32 action, u16 lc_id,u16 mch_id, rb_id_t rb_id,
u8 rb_sn, u8 rb_report, u16 header_compression_profile,
u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc));
public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp, u8 eNB_id, u8 UE_id, u32 frame, u8_t eNB_flag,
rlc_mode_t rlc_mode, u32 action, u16 lc_id, u16 mch_id, rb_id_t rb_id,
u8 rb_sn, u8 rb_report, u16 header_compression_profile,
u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc));
/*! \fn void rrc_pdcp_config_release(module_id_t, rb_id_t)
* \brief This functions is unused
* \param[in] module_id Module ID of relevant PDCP entity
......@@ -351,7 +351,7 @@ public_pdcp(int pdcp_netlink_init(void);)
#define PDCP2NAS_FIFO 21
#define NAS2PDCP_FIFO 22
protected_pdcp_fifo(int pdcp_fifo_flush_sdus (u32_t,u8_t);)
protected_pdcp_fifo(int pdcp_fifo_flush_sdus(u32_t frame, u8 eNB_flag, u8 eNB_id, u8 UE_id);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (u32_t,u8_t);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t eNB_index);)
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index, u8 eNB_index);)
......@@ -404,7 +404,8 @@ typedef struct pdcp_missing_pdu_info_t {
#define PDCP_MAX_SN_12BIT 4095 // 2^12-1
protected_pdcp(signed int pdcp_2_nas_irq;)
protected_pdcp(pdcp_t pdcp_array[MAX_MODULES][MAX_MODULES*NB_RB_MAX];)
protected_pdcp(pdcp_t pdcp_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
protected_pdcp(pdcp_t pdcp_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
public_pdcp(pdcp_mbms_t pdcp_mbms_array[MAX_MODULES][16*29];) // MAX_SERVICEx MAX_SESSION
protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;)
protected_pdcp(sdu_size_t pdcp_output_header_bytes_to_write;)
......
......@@ -69,6 +69,7 @@ extern int otg_enabled;
#include "UTIL/FIFO/pad_list.h"
#include "platform_constants.h"
#include "assertions.h"
#ifdef NAS_NETLINK
#include <sys/socket.h>
......@@ -95,7 +96,7 @@ extern Packet_OTG_List *otg_pdcp_buffer;
pdcp_data_req_header_t pdcp_read_header;
//-----------------------------------------------------------------------------
int pdcp_fifo_flush_sdus (u32_t frame,u8 eNB_flag)
int pdcp_fifo_flush_sdus(u32_t frame, u8 eNB_flag, u8 eNB_id, u8 UE_id)
{
//-----------------------------------------------------------------------------
......@@ -266,12 +267,15 @@ int pdcp_fifo_flush_sdus (u32_t frame,u8 eNB_flag)
* returns zero value if whole bytes that had to be read were not read at all
* returns a negative value if an error was encountered while reading the rt fifo
*/
int
pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame,u8_t eNB_flag)
int pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame, u8_t eNB_flag)
{
//-----------------------------------------------------------------------------
sdu_size_t bytes_read = 0;
rb_id_t rab_id = 0;
pdcp_t *pdcp;
u8 UE_id = 0;
u8 eNB_id;
u8 rb_id;
// if remaining bytes to read
if (pdcp_input_sdu_remaining_size_to_read > 0) {
......@@ -300,12 +304,29 @@ int
pdcp_read_header.inst = 0;
#endif
if (eNB_flag == 0) {
UE_id = pdcp_read_header.inst;
rb_id = pdcp_read_header.rb_id % NB_RB_MAX;
eNB_id = 0;
DevCheck4(UE_id < NB_UE_INST, UE_id, NB_UE_INST, pdcp_read_header.rb_id, NB_RB_MAX);
DevCheck4(eNB_id < NB_eNB_INST, eNB_id, NB_eNB_INST, pdcp_read_header.rb_id, NB_RB_MAX);
pdcp = &pdcp_array_ue[UE_id][rb_id];
} else {
UE_id = pdcp_read_header.rb_id / NB_RB_MAX;
rb_id = pdcp_read_header.rb_id % NB_RB_MAX;
eNB_id = pdcp_read_header.inst;
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
}
if (pdcp_input_header.rb_id != 0) {
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
pdcp_data_req (pdcp_input_header.inst,
if (pdcp->instanciated_instance) {
pdcp_data_req (eNB_id, UE_id,
frame, eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
......@@ -316,18 +337,20 @@ int
}
} else if ((pdcp_input_header.traffic_type == OAI_NW_DRV_IPV6_ADDR_TYPE_MULTICAST) || (pdcp_input_header.traffic_type == OAI_NW_DRV_IPV4_ADDR_TYPE_MULTICAST)) {
printf("[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ on MBMS bearer/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ on MBMS bearer/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TM);
if (pdcp->instanciated_instance) {
pdcp_data_req (eNB_id,
UE_id,
frame,
eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TM);
}
} else if (eNB_flag) {
......@@ -336,27 +359,29 @@ int
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
if (pdcp_array[pdcp_input_header.inst][rab_id%NB_RB_MAX].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
if (pdcp->instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (eNB_id,
UE_id,
frame, eNB_flag,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
pdcp_data_req (eNB_id,
UE_id,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
// not necessary
//memset(pdcp_input_sdu_buffer, 0, MAX_IP_PACKET_SIZE);
......@@ -372,206 +397,43 @@ int
//-----------------------------------------------------------------------------
int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t eNB_index)
{
//-----------------------------------------------------------------------------
//#ifdef NAS_FIFO
// int cont;
// int bytes_read;
//
// // if remaining bytes to read
// if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) {
//
// // all bytes that had to be read for a SDU were read
// // if not overflow of list, try to get new sdus from rt fifo
// cont = 1;
//
// while (cont > 0) {
// bytes_read = rtf_get (NAS2PDCP_FIFO,
// &(((u8 *) & pdcp_input_header)[pdcp_input_index_header]),
// sizeof (pdcp_data_req_header_t) - pdcp_input_index_header);
//
// if (bytes_read > 0) {
//#ifdef PDCP_DEBUG
// LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n",
// frame,
// bytes_read,
// sizeof(pdcp_data_req_header_t));
//#endif // PDCP_DEBUG
// pdcp_input_index_header += bytes_read;
//
// if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) {
//#ifdef PDCP_DEBUG
// LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n",
// frame,
// pdcp_input_header.data_size);
//#endif //PDCP_DEBUG
// pdcp_input_index_header = 0;
// if (pdcp_input_header.data_size < 0) {
// LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size);
//
// mac_xface->macphy_exit("");
// return 0;
// }
// pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size;
// pdcp_input_sdu_size_read = 0;
// // we know the size of the sdu, so read the sdu;
// cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag);
// } else {
// cont = 0;
// }
// // error while reading rt fifo
// } else {
// cont = 0;
// }
// }
// }
// return bytes_read;
//
//#else //NAS_FIFO
//#ifdef NAS_NETLINK
// int len = 1;
// rb_id_t rab_id = 0;
//
// while (len > 0) {
// if (pdcp_read_state == 0) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
//#ifdef PDCP_DEBUG
//#ifdef LINUX
// LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n",
// len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
//#else
// LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n",
// nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t),
// sizeof(struct nlmsghdr));
//#endif
//#endif
// }
//
//#ifdef LINUX
// if (nas_nlh->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
// pdcp_read_state = 1; //get
// memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh), sizeof(pdcp_data_req_header_t));
// }
//#else
// pdcp_read_state = 1;
//#endif
// }
//
// if (pdcp_read_state == 1) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
// pdcp_read_state = 0;
// // print_active_requests()
//
//#ifdef LINUX
// memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr));
//#endif
//
//#ifdef OAI_EMU
// pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ?
// pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
// pdcp_read_header.inst + oai_emulation.info.first_enb_local;
//#else
// pdcp_read_header.inst = 0;
//#endif
//
// if (pdcp_read_header.rb_id != 0) {
// if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) {
//#ifdef PDCP_DEBUG
// LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
// frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id);
// LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
// frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
//#endif
//
// pdcp_data_req(pdcp_read_header.inst,
// frame,
// eNB_flag,
// pdcp_read_header.rb_id,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_read_header.data_size,
// pdcp_read_payload,
// PDCP_DATA_PDU);
// } else {
// LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
// pdcp_read_header.inst, pdcp_read_header.rb_id);
// }
// } else if (eNB_flag) {
// // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
// LOG_D(PDCP, "Checking if could sent on default rabs\n");
//#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
// for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
// LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
// if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) {
// pdcp_data_req (pdcp_input_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// } else {
// LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
// pdcp_data_req (pdcp_input_header.inst,
// frame, eNB_flag,
// DEFAULT_RAB_ID,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// }
// } // end of while
//
// return len;
//
//#else // neither NAS_NETLINK nor NAS_FIFO
// return 0;
//#endif // NAS_NETLINK
#ifdef NAS_NETLINK
# if defined(ENABLE_PDCP_NETLINK_FIFO)
rb_id_t rab_id;
pdcp_t *pdcp;
struct pdcp_netlink_element_s *data = NULL;
while (pdcp_netlink_dequeue_element(eNB_flag, UE_index, eNB_index, &data) != 0) {
DevAssert(data != NULL);
if (eNB_flag == 0) {
rab_id = data->pdcp_read_header.rb_id;
pdcp = &pdcp_array_ue[UE_index][rab_id];
} else {
rab_id = data->pdcp_read_header.rb_id % NB_RAB_MAX;
UE_index = data->pdcp_read_header.rb_id / NB_RAB_MAX;
pdcp = &pdcp_array_eNB[eNB_index][UE_index][rab_id];
}
if (data->pdcp_read_header.rb_id != 0) {
if (pdcp_array[data->pdcp_read_header.inst][data->pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
if (pdcp->instanciated_instance) {
LOG_D(PDCP, "[FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ "
"/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, data->pdcp_read_header.inst, data->pdcp_read_header.data_size,
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id);
pdcp_data_req(data->pdcp_read_header.inst,
pdcp_data_req(eNB_index,
UE_index,
frame,
eNB_flag,
data->pdcp_read_header.rb_id,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
data->pdcp_read_header.data_size,
data->data,
PDCP_DATA_PDU);
} else {
LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id);
LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u, UE_index %d, eNB_flag %d\n",
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id, UE_index, eNB_flag);
}
} else if (eNB_flag) {
/* rb_id = 0, thus interpreated as broadcast and transported as
......@@ -580,8 +442,9 @@ int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t e
*/
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
if (pdcp_array[pdcp_input_header.inst][rab_id%NB_RB_MAX].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req(data->pdcp_read_header.inst,
if (pdcp->instanciated_instance) {
pdcp_data_req(eNB_index,
UE_index,
frame,
eNB_flag,
rab_id,
......@@ -594,7 +457,8 @@ int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t e
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req(data->pdcp_read_header.inst,
pdcp_data_req(eNB_index,
UE_index,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
......@@ -748,13 +612,13 @@ void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index
//rb_id = (/*NB_eNB_INST +*/ dst_id -1 ) * MAX_NUM_RB + DTCH;
LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d for pdcp mode %d\n",
eNB_index, frame, pkt_cnt++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode);
pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
pdcp_data_req(eNB_index, UE_index, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
}
else {
//rb_id= eNB_index * MAX_NUM_RB + DTCH;
LOG_D(OTG,"[UE %d] sending packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n",
UE_index, src_id, rb_id, src_id, dst_id, pkt_size);
pdcp_data_req(src_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
pdcp_data_req(eNB_index, UE_index, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt, PDCP_DATA_PDU);
}
free(otg_pkt);
}
......@@ -774,7 +638,7 @@ void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index
otg_pkt=packet_gen(src_id, dst_id, 0, ctime, &pkt_size);
if (otg_pkt != NULL){
rb_id = dst_id * NB_RB_MAX + DTCH;
pdcp_data_req(src_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
pdcp_data_req(eNB_index, dst_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
LOG_I(OTG,"send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, rb_id, src_id, dst_id, pkt_size);
free(otg_pkt);
}
......
......@@ -202,8 +202,8 @@ void *pdcp_netlink_thread_fct(void *arg) {
new_data->pdcp_read_header.data_size);
} else {
LOG_E(PDCP, "[NETLINK] WRONG size %d should be sizeof "
"(pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n",
nas_nlh_rx->nlmsg_len);
"%d ((pdcp_data_req_header_t) + sizeof(struct nlmsghdr))\n",
nas_nlh_rx->nlmsg_len, sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr));
}