Commit d365405a authored by Lionel Gauthier's avatar Lionel Gauthier

For RX CONCATENATED PDUS

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4839 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f2d9455f
...@@ -571,6 +571,7 @@ rlc_am_mac_data_indication (void *rlcP, u32_t frame, u8 eNB_flag, struct mac_dat ...@@ -571,6 +571,7 @@ rlc_am_mac_data_indication (void *rlcP, u32_t frame, u8 eNB_flag, struct mac_dat
mem_block_t *tb; mem_block_t *tb;
int num_li; int num_li;
int num_nack; int num_nack;
s16_t tb_size;
if (data_indP.data.nb_elements > 0) { if (data_indP.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_AM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_indP.data.nb_elements); LOG_D(RLC, "[RLC_AM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_indP.data.nb_elements);
...@@ -607,8 +608,9 @@ rlc_am_mac_data_indication (void *rlcP, u32_t frame, u8 eNB_flag, struct mac_dat ...@@ -607,8 +608,9 @@ rlc_am_mac_data_indication (void *rlcP, u32_t frame, u8 eNB_flag, struct mac_dat
"/%d Bytes ", "/%d Bytes ",
((struct mac_tb_ind *) (tb->data))->size); ((struct mac_tb_ind *) (tb->data))->size);
} else { } else {
tb_size = (s16_t) ((struct mac_tb_ind *) (tb->data))->size;
rlc_am_get_control_pdu_infos((rlc_am_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb->data))->data_ptr, rlc_am_get_control_pdu_infos((rlc_am_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb->data))->data_ptr,
(s16_t) ((struct mac_tb_ind *) (tb->data))->size, &tb_size,
&control_pdu_info); &control_pdu_info);
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length],
......
...@@ -31,6 +31,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -31,6 +31,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
//#include "rtos_header.h" //#include "rtos_header.h"
#include "platform_types.h" #include "platform_types.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "assertions.h"
#include "rlc.h" #include "rlc.h"
#include "rlc_am.h" #include "rlc_am.h"
#include "list.h" #include "list.h"
...@@ -204,7 +205,7 @@ rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struc ...@@ -204,7 +205,7 @@ rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struc
{ {
mem_block_t *tb; mem_block_t *tb;
u8_t *first_byte; u8_t *first_byte;
u16_t tb_size_in_bytes; s16_t tb_size_in_bytes;
while ((tb = list_remove_head (&data_indP.data))) { while ((tb = list_remove_head (&data_indP.data))) {
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr; first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
...@@ -218,7 +219,25 @@ rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struc ...@@ -218,7 +219,25 @@ rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struc
} else { } else {
rlcP->stat_rx_control_bytes += tb_size_in_bytes; rlcP->stat_rx_control_bytes += tb_size_in_bytes;
rlcP->stat_rx_control_pdu += 1; rlcP->stat_rx_control_pdu += 1;
rlc_am_receive_process_control_pdu (rlcP, frame, tb, first_byte, tb_size_in_bytes); rlc_am_receive_process_control_pdu (rlcP, frame, tb, first_byte, &tb_size_in_bytes);
// if data pdu concatenated with control PDU (seen with real hardware LTE dongle integration)
if (tb_size_in_bytes > 0) {
#if defined(RLC_ENABLE_PDU_CONCATENATION)
if ((*first_byte & 0x80) == 0x80) {
rlcP->stat_rx_data_bytes += tb_size_in_bytes;
rlcP->stat_rx_data_pdu += 1;
rlc_am_receive_process_data_pdu (rlcP, frame, eNB_flag, tb, first_byte, tb_size_in_bytes);
} else {
AssertFatal( tb_size_in_bytes == 0,
"Not a data PDU concatened to control PDU %ld bytes left",
tb_size_in_bytes);
}
#else
AssertFatal( tb_size_in_bytes == 0,
"Remaining %d bytes following a control PDU",
tb_size_in_bytes);
#endif
}
} }
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, rlcP->vr_mr); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, rlcP->vr_mr);
} }
......
...@@ -112,7 +112,7 @@ void rlc_am_write16_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int b ...@@ -112,7 +112,7 @@ void rlc_am_write16_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int b
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP) signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_infoP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
memset(pdu_infoP, 0, sizeof (rlc_am_control_pdu_info_t)); memset(pdu_infoP, 0, sizeof (rlc_am_control_pdu_info_t));
...@@ -125,6 +125,7 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t total ...@@ -125,6 +125,7 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t total
if (pdu_infoP->cpt != 0x00) return -3; if (pdu_infoP->cpt != 0x00) return -3;
pdu_infoP->ack_sn = ((headerP->b2 >> 2) & 0x3F) | (((u16_t)(headerP->b1 & 0x0F)) << 6); pdu_infoP->ack_sn = ((headerP->b2 >> 2) & 0x3F) | (((u16_t)(headerP->b1 & 0x0F)) << 6);
pdu_infoP->e1 = (headerP->b2 >> 1) & 0x01; pdu_infoP->e1 = (headerP->b2 >> 1) & 0x01;
*total_size_pP -= 1;
if (pdu_infoP->e1) { if (pdu_infoP->e1) {
unsigned int nack_to_read = 1; unsigned int nack_to_read = 1;
...@@ -149,22 +150,18 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t total ...@@ -149,22 +150,18 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t total
if (!pdu_infoP->nack_list[pdu_infoP->num_nack - 1].e1) { if (!pdu_infoP->nack_list[pdu_infoP->num_nack - 1].e1) {
nack_to_read = 0; nack_to_read = 0;
*total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
return 0; return 0;
} }
if (pdu_infoP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) { if (pdu_infoP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) {
*total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
return -2; return -2;
} }
} }
#ifdef RLC_TEST_AGREGATED_DATA_PDU_WITH_CONTROL_PDU *total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
AssertFatal( (uint64_t)((uint64_t)byte_pos + (bit_pos +7)/8 - (uint64_t)headerP) == total_sizeP,
"Remaining bytes in transport block: %l",
total_sizeP - (int64_t)((uint64_t)byte_pos + (bit_pos +7)/8 - (uint64_t)headerP ));
#endif
} else { } else {
#ifdef RLC_TEST_AGREGATED_DATA_PDU_WITH_CONTROL_PDU *total_size_pP = *total_size_pP - 2;
AssertFatal( total_sizeP == 2, "Remaining bytes in transport block: %l", total_sizeP - 2);
#endif
} }
return 0; return 0;
} else { } else {
...@@ -195,13 +192,13 @@ void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP) ...@@ -195,13 +192,13 @@ void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP)
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t* first_byteP, u16_t tb_size_in_bytesP) void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t* first_byteP, s16_t *tb_size_in_bytes_pP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
//rlc_am_control_pdu_info_t* pdu_info = ((rlc_am_control_pdu_info_t*)(tbP->data)); //rlc_am_control_pdu_info_t* pdu_info = ((rlc_am_control_pdu_info_t*)(tbP->data));
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10 = (rlc_am_pdu_sn_10_t*)first_byteP; rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10 = (rlc_am_pdu_sn_10_t*)first_byteP;
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10, tb_size_in_bytesP, &g_rlc_am_control_pdu_info) >= 0) { if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10, tb_size_in_bytes_pP, &g_rlc_am_control_pdu_info) >= 0) {
rlc_am_tx_buffer_display(rlcP, frame, " TX BUFFER BEFORE PROCESS OF STATUS PDU"); rlc_am_tx_buffer_display(rlcP, frame, " TX BUFFER BEFORE PROCESS OF STATUS PDU");
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n", LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n",
......
...@@ -95,10 +95,10 @@ protected_rlc_am_status_report(void rlc_am_write16_bit_field(u8_t** dataP ...@@ -95,10 +95,10 @@ protected_rlc_am_status_report(void rlc_am_write16_bit_field(u8_t** dataP
/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP) /*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Retrieve control PDU informations from a serialized control PDU. * \brief Retrieve control PDU informations from a serialized control PDU.
* \param[in] headerP Pointer on the header of the RLC AM PDU. * \param[in] headerP Pointer on the header of the RLC AM PDU.
* \param[in] total_sizeP PDU size in bytes. * \param[in] total_size_pP Pointer on PDU size in bytes.
* \param[in,out] pdu_infoP Struct containing interpreted PDU control informations. * \param[in,out] pdu_infoP Struct containing interpreted PDU control informations.
*/ */
protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP);) protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, s16_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_infoP);)
/*! \fn void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP) /*! \fn void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Dump on LOG output the informations contained in the pdu_infoP structure. * \brief Dump on LOG output the informations contained in the pdu_infoP structure.
...@@ -112,9 +112,9 @@ protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_con ...@@ -112,9 +112,9 @@ protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_con
* \param[in] frame Frame index. * \param[in] frame Frame index.
* \param[in] tbP Control PDU embedded in a mem_block_t structure. * \param[in] tbP Control PDU embedded in a mem_block_t structure.
* \param[in] first_byte Pointer on first byte of control PDU. * \param[in] first_byte Pointer on first byte of control PDU.
* \param[in] tb_size_in_bytes Size of serialized control PDU in bytes. * \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes.
*/ */
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t* first_byte, u16_t tb_size_in_bytes);) protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t* first_byte, s16_t *tb_size_in_bytes);)
/*! \fn int rlc_am_write_status_pdu(u32_t frame,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP) /*! \fn int rlc_am_write_status_pdu(u32_t frame,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Remove all marked holes for PDU with sequence number "snP". * \brief Remove all marked holes for PDU with sequence number "snP".
......
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