Commit 675fd0af authored by Wu Jing's avatar Wu Jing Committed by Haruki Naoi

patch develop-get-freememblock.patch into closed_item

parent afcdb1e6
......@@ -45,6 +45,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP
mem_block *mb;
mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__);
if(mb==NULL) return;
((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP;
......
......@@ -265,6 +265,7 @@ mem_block_t* rlc_am_retransmit_get_copy (
/* We need to allocate a new buffer and copy to it because header content may change for Polling bit */
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size, __func__);
if(mb_copy == NULL) return NULL;
memcpy(mb_copy->data, mb_original_p->data, size);
rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
......@@ -339,6 +340,7 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
*payload_sizeP = retx_so_stop - retx_so_start + 1;
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + *payload_sizeP;
......@@ -551,6 +553,7 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
AssertFatal (header_segment_length + *payload_sizeP <= pdu_mngt->header_and_payload_size + 2, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + header_segment_length + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = header_segment_length + *payload_sizeP;
......@@ -718,6 +721,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
if(mb_sub_segment_p == NULL) return NULL;
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_info_t pdu_info;
......
......@@ -212,6 +212,9 @@ rlc_am_get_control_pdu_infos(
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
nack_to_read = 0;
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][FIRST]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0;
}
......@@ -225,7 +228,9 @@ rlc_am_get_control_pdu_infos(
} else {
*total_size_pP = *total_size_pP - 2;
}
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][SECOND]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0;
} else {
return -1;
......@@ -388,13 +393,15 @@ rlc_am_receive_process_control_pdu(
} else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s);
*tb_size_in_bytes_pP = 0;
status = FALSE;
}
} else {
LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
*tb_size_in_bytes_pP = 0;
status = FALSE;
}
......@@ -807,6 +814,7 @@ rlc_am_send_status_pdu(
pdu_size);
#endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
if(tb_p == NULL) return;
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
......@@ -1151,6 +1159,7 @@ end_push_nack:
pdu_size);
#endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
if(tb_p == NULL) return;
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
......
......@@ -534,7 +534,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
}
//-----------------------------------------------------------------------------
......@@ -577,7 +577,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
data_indP->no_tb += 1;
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
} else {
printf("[RLC-LOOP] DROPPING 1 TB\n");
......
......@@ -83,6 +83,7 @@ void rlc_tm_init (
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
if(rlcP->input_sdus_alloc == NULL) return;
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
}
......
......@@ -317,7 +317,7 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP)
assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
}
......@@ -406,9 +406,8 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
if (*drop_countP == 0) {
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
if (tb_dst != NULL) {
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
//printf("[RLC-LOOP] Testing tb_dst (1)\n");
check_free_mem_block(tb_dst, __func__);
tb_dst->next = NULL;
......@@ -427,7 +426,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
check_free_mem_block(tb_dst, __func__);
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
} else {
printf("[RLC-LOOP] DROPPING 1 TB\n");
......
......@@ -275,9 +275,9 @@ get_free_mem_block (uint32_t sizeP, const char* caller)
} while (pool_selected++ < 12);
LOG_E(PHY, "[MEM_MNGT][ERROR][FATAL] failed allocating MEM_BLOCK size %d byes (pool_selected=%d size=%d)\n", sizeP, pool_selected, size);
display_mem_load();
AssertFatal(1==0,"get_free_mem_block failed");
// display_mem_load();
// AssertFatal(1==0,"get_free_mem_block failed");
LOG_E(MAC,"[MEM_MNGT][ERROR][FATAL] get_free_mem_block failed!!!\n");
#ifdef MEMBLOCK_BIG_LOCK
if (pthread_mutex_unlock(&mtex)) abort();
#endif
......
......@@ -91,7 +91,7 @@ private_mem_block(void check_free_mem_block (mem_block_t * leP);)
# define MEM_MNGT_MB5_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*32
// 2048
# define MEM_MNGT_MB5_NB_BLOCKS 1024 * MEM_SCALE // LG WAS 1024
# define MEM_MNGT_MB5_NB_BLOCKS 1024 * MEM_SCALE * 50 // LG WAS 1024
# define MEM_MNGT_POOL_ID5 5
# define MEM_MNGT_MB6_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*64
......
......@@ -94,6 +94,7 @@ umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *),
uint8_t inserted = 0;
mb = get_free_mem_block (sizeof (struct timer_unit), __func__);
if(mb==NULL) return NULL;
((struct timer_unit *) (mb->data))->proc = procP;
((struct timer_unit *) (mb->data))->protocol = protocolP;
((struct timer_unit *) (mb->data))->timer_id = timer_idP;
......
......@@ -148,7 +148,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat
data_indP->no_tb += 1;
} else {
printf("Out of memory error\n");
exit(-1);
// exit(-1);
}
} else {
printf("[RLC-LOOP] DROPPING 1 TB\n");
......
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