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), rem_len(0),
last_sdu_idx(-1), last_sdu_idx(-1),
pdu_is_ul(false), pdu_is_ul(false),
buffer_tx(nullptr), buffer_tx(nullptr)
total_sdu_len(0)
{ {
} }
@ -118,12 +117,11 @@ public:
bool is_ul() { return pdu_is_ul; } 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) void add_sdu(uint32_t sdu_sz)
{ {
buffer_tx->N_bytes += sdu_sz; buffer_tx->N_bytes += sdu_sz;
total_sdu_len += sdu_sz;
} }
// Section 6.1.2 // Section 6.1.2
@ -153,7 +151,6 @@ protected:
uint32_t max_subheaders; uint32_t max_subheaders;
bool pdu_is_ul; bool pdu_is_ul;
byte_buffer_t* buffer_tx = nullptr; byte_buffer_t* buffer_tx = nullptr;
uint32_t total_sdu_len;
int last_sdu_idx; int last_sdu_idx;
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */ /* 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; rem_len = pdu_len;
pdu_is_ul = is_ulsch; pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_; buffer_tx = buffer_tx_;
total_sdu_len = 0;
last_sdu_idx = -1; last_sdu_idx = -1;
reset(); reset();
for (uint32_t i = 0; i < max_subheaders; i++) { for (uint32_t i = 0; i < max_subheaders; i++) {
@ -397,7 +393,6 @@ private:
rem_len = pdu_len; rem_len = pdu_len;
pdu_is_ul = is_ulsch; pdu_is_ul = is_ulsch;
buffer_tx = buffer_tx_; buffer_tx = buffer_tx_;
total_sdu_len = 0;
last_sdu_idx = -1; last_sdu_idx = -1;
reset(); reset();
for (uint32_t i = 0; i < max_subheaders; i++) { 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) // Set padding to zeros (if any)
if (num_padding > 0) { 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; 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 */ /* Sanity check and print if error */
if (log_h) { if (log_h) {
log_h->debug( 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",
"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, pdu_len,
header_sz + ce_payload_sz, header_sz + ce_payload_sz,
header_sz, header_sz,
ce_payload_sz, ce_payload_sz,
nof_subheaders, nof_subheaders,
last_sdu_idx, last_sdu_idx,
total_sdu_len,
onetwo_padding, onetwo_padding,
num_padding); num_padding);
} else { } 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", "multi=%d\n",
pdu_len, pdu_len,
header_sz + ce_payload_sz, header_sz + ce_payload_sz,
@ -196,18 +194,17 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz, ce_payload_sz,
nof_subheaders, nof_subheaders,
last_sdu_idx, last_sdu_idx,
total_sdu_len,
onetwo_padding, onetwo_padding,
num_padding); num_padding);
} }
if (total_header_size + total_sdu_len + num_padding != pdu_len) { if (buffer_tx->N_bytes != pdu_len) {
if (log_h) { if (log_h) {
log_h->console("\n------------------------------\n"); log_h->console("\n------------------------------\n");
for (int i = 0; i < nof_subheaders; i++) { 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("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", "onepad=%d, multi=%d\n",
pdu_len, pdu_len,
header_sz + ce_payload_sz, header_sz + ce_payload_sz,
@ -215,13 +212,12 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz, ce_payload_sz,
nof_subheaders, nof_subheaders,
last_sdu_idx, last_sdu_idx,
total_sdu_len,
onetwo_padding, onetwo_padding,
num_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->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", "multi=%d\n",
pdu_len, pdu_len,
header_sz + ce_payload_sz, header_sz + ce_payload_sz,
@ -229,7 +225,6 @@ uint8_t* sch_pdu::write_packet(srslte::log* log_h)
ce_payload_sz, ce_payload_sz,
nof_subheaders, nof_subheaders,
last_sdu_idx, last_sdu_idx,
total_sdu_len,
onetwo_padding, onetwo_padding,
num_padding); num_padding);
} }

Loading…
Cancel
Save