Commit 6374f04b authored by Joanne Hugé's avatar Joanne Hugé

Fix TX sending garbage after the 1st packet in a burst

parent 31359d72
...@@ -416,7 +416,7 @@ static void *recv_thread(void *p) { ...@@ -416,7 +416,7 @@ static void *recv_thread(void *p) {
int o = ETHERNET_HEADER + ECPRI_COMMON_HEADER; int o = ETHERNET_HEADER + ECPRI_COMMON_HEADER;
uint16_t antenna_id = ntohs(*((uint16_t *) (data + o + 0))); uint16_t antenna_id = ntohs(*((uint16_t *) (data + o + 0)));
uint8_t seq_id = ((uint8_t) (*((uint16_t * ) (data + o + 2)) >> 8)); uint8_t seq_id = ((uint8_t) (*((uint16_t * ) (data + o + 2)) >> 8));
if(antenna_id > 4 || antenna_id < 0) { if(antenna_id > s->rx_n_channel || antenna_id < 0) {
log_exit("RECV_THREAD", "Wrong Antenna ID: %d\n", antenna_id); log_exit("RECV_THREAD", "Wrong Antenna ID: %d\n", antenna_id);
} }
} }
...@@ -471,7 +471,7 @@ static void *send_thread(void *p) { ...@@ -471,7 +471,7 @@ static void *send_thread(void *p) {
to_send = s->tx_burst; to_send = s->tx_burst;
for(int j = 0 ; j < to_send ; j++) { for(int j = 0 ; j < to_send ; j++) {
msgv[j].iov_base = rbuf_read(&tx_rbuf) + j; msgv[j].iov_base = rbuf_read(&tx_rbuf) + j * PACKET_SIZE;
msgv[j].iov_len = PACKET_SIZE; msgv[j].iov_len = PACKET_SIZE;
if(j > s->tx_burst) if(j > s->tx_burst)
log_exit("SEND_THREAD", "Too many burst packets"); log_exit("SEND_THREAD", "Too many burst packets");
...@@ -512,7 +512,7 @@ static void *encode_thread(void *p) { ...@@ -512,7 +512,7 @@ static void *encode_thread(void *p) {
// If we have frames to encode (is there space in TX buffer) // If we have frames to encode (is there space in TX buffer)
// And if there are frames from trx_write callback to encode // And if there are frames from trx_write callback to encode
to_write = rbuf_write_amount(&tx_rbuf) / (PACKET_SIZE * 4); to_write = rbuf_write_amount(&tx_rbuf) / (PACKET_SIZE * s->tx_n_channel);
to_read = 1; to_read = 1;
for(int k = 0; k < s->tx_n_channel; k++) for(int k = 0; k < s->tx_n_channel; k++)
if(rbuf_read_amount(&trxw_rbuf[k]) < IQ_PAYLOAD) if(rbuf_read_amount(&trxw_rbuf[k]) < IQ_PAYLOAD)
...@@ -547,7 +547,7 @@ static void *encode_thread(void *p) { ...@@ -547,7 +547,7 @@ static void *encode_thread(void *p) {
} }
check_rbuf_write(&tx_rbuf, log_exit); check_rbuf_write(&tx_rbuf, log_exit);
// Increment counter once we wrote packets for all channels // Increment counter once we wrote packets for all channels
update_counter(&encode_counter, 4); update_counter(&encode_counter, s->tx_n_channel);
// Update ORAN counters // Update ORAN counters
slot_id = (slot_id + 1) % 2; slot_id = (slot_id + 1) % 2;
...@@ -591,7 +591,7 @@ static void *decode_thread(void *p) { ...@@ -591,7 +591,7 @@ static void *decode_thread(void *p) {
uint16_t antenna_id = ntohs(*((uint16_t *) (data + j + 0))); uint16_t antenna_id = ntohs(*((uint16_t *) (data + j + 0)));
uint8_t seq_id = ((uint8_t) (*((uint16_t * ) (data + j + 2)) >> 8)); uint8_t seq_id = ((uint8_t) (*((uint16_t * ) (data + j + 2)) >> 8));
if(antenna_id > 4 || antenna_id < 0) { if(antenna_id > s->rx_n_channel || antenna_id < 0) {
printf("PREVIOUS PACKET DATA: \n"); printf("PREVIOUS PACKET DATA: \n");
for(int k = 0; k < PACKET_SIZE * 2; k++) for(int k = 0; k < PACKET_SIZE * 2; k++)
printf("%X", rbuf_read(&rx_rbuf)[k - PACKET_SIZE]); printf("%X", rbuf_read(&rx_rbuf)[k - PACKET_SIZE]);
......
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