pdu: remove unused variable total_sdu_len

master
Andre Puschmann 6 years ago
parent 7145cd2358
commit 4aaa0473b9

@ -46,8 +46,7 @@ public:
rem_len(0),
last_sdu_idx(-1),
pdu_is_ul(false),
buffer_tx(nullptr),
total_sdu_len(0)
buffer_tx(nullptr)
{
}
@ -118,12 +117,11 @@ public:
bool is_ul() { return pdu_is_ul; }
uint8_t* get_current_sdu_ptr() { return (buffer_tx->msg + total_sdu_len); }
uint8_t* get_current_sdu_ptr() { return &buffer_tx->msg[buffer_tx->N_bytes]; }
void add_sdu(uint32_t sdu_sz)
{
buffer_tx->N_bytes += sdu_sz;
total_sdu_len += sdu_sz;
}
// Section 6.1.2
@ -153,7 +151,6 @@ protected:
uint32_t max_subheaders;
bool pdu_is_ul;
byte_buffer_t* buffer_tx = nullptr;
uint32_t total_sdu_len;
int last_sdu_idx;
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */
@ -164,7 +161,6 @@ protected:
rem_len = pdu_len;
pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_;
total_sdu_len = 0;
last_sdu_idx = -1;
reset();
for (uint32_t i = 0; i < max_subheaders; i++) {
@ -397,7 +393,6 @@ private:
rem_len = pdu_len;
pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_;
total_sdu_len = 0;
last_sdu_idx = -1;
reset();
for (uint32_t i = 0; i < max_subheaders; i++) {

@ -165,7 +165,7 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
// Set padding to zeros (if any)
if (num_padding > 0) {
bzero(&buffer_tx->msg[total_header_size + total_sdu_len], num_padding * sizeof(uint8_t));
bzero(&buffer_tx->msg[buffer_tx->N_bytes], num_padding * sizeof(uint8_t));
buffer_tx->N_bytes += num_padding;
}
@ -176,19 +176,17 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
/* Sanity check and print if error */
if (log_h) {
log_h->debug(
"Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, sdu_len=%d, onepad=%d, multi=%d\n",
pdu_len,
header_sz + ce_payload_sz,
header_sz,
ce_payload_sz,
nof_subheaders,
last_sdu_idx,
total_sdu_len,
onetwo_padding,
num_padding);
log_h->debug("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, onepad=%d, multi=%d\n",
pdu_len,
header_sz + ce_payload_sz,
header_sz,
ce_payload_sz,
nof_subheaders,
last_sdu_idx,
onetwo_padding,
num_padding);
} else {
printf("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, sdu_len=%d, onepad=%d, "
printf("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, onepad=%d, "
"multi=%d\n",
pdu_len,
header_sz + ce_payload_sz,
@ -196,18 +194,17 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz,
nof_subheaders,
last_sdu_idx,
total_sdu_len,
onetwo_padding,
num_padding);
}
if (total_header_size + total_sdu_len + num_padding != pdu_len) {
if (buffer_tx->N_bytes != pdu_len) {
if (log_h) {
log_h->console("\n------------------------------\n");
for (int i = 0; i < nof_subheaders; i++) {
log_h->console("SUBH %d is_sdu=%d, payload=%d\n", i, subheaders[i].is_sdu(), subheaders[i].get_payload_size());
}
log_h->console("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, sdu_len=%d, "
log_h->console("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, "
"onepad=%d, multi=%d\n",
pdu_len,
header_sz + ce_payload_sz,
@ -215,13 +212,12 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz,
nof_subheaders,
last_sdu_idx,
total_sdu_len,
onetwo_padding,
num_padding);
ERROR("Expected PDU len %d bytes but wrote %d\n", pdu_len, rem_len + header_sz + ce_payload_sz + total_sdu_len);
ERROR("Expected PDU len %d bytes but wrote %d\n", pdu_len, buffer_tx->N_bytes);
log_h->console("------------------------------\n");
log_h->error("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, sdu_len=%d, onepad=%d, "
log_h->error("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, onepad=%d, "
"multi=%d\n",
pdu_len,
header_sz + ce_payload_sz,
@ -229,7 +225,6 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz,
nof_subheaders,
last_sdu_idx,
total_sdu_len,
onetwo_padding,
num_padding);
}

Loading…
Cancel
Save