Skip to content

Commit

Permalink
fix packet_mmap tx stats
Browse files Browse the repository at this point in the history
  • Loading branch information
GIC-de committed Jan 31, 2024
1 parent cffe082 commit 1ee0cc8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions code/bngblaster/src/io/io_packet_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,21 @@ io_packet_mmap_tx_job(timer_s *timer)
}
io->buf = frame_ptr + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll);

if(ctrl) {
if(unlikely(ctrl)) {
/* First send all control traffic which has higher priority. */
if(bbl_tx(interface, io->buf, &io->buf_len) != PROTOCOL_SUCCESS) {
ctrl = false;
continue;
}
} else {
stream = bbl_stream_io_send_iter(io);
if(!stream) {
if(unlikely(stream == NULL)) {
break;
}
memcpy(io->buf, stream->tx_buf, stream->tx_len);
io->buf_len = stream->tx_len;
stream->tx_packets++;
stream->flow_seq++;
}
tphdr->tp_len = io->buf_len;
tphdr->tp_status = TP_STATUS_SEND_REQUEST;
Expand Down Expand Up @@ -315,7 +317,7 @@ io_packet_mmap_thread_tx_run_fn(io_thread_s *thread)
}
io->buf = frame_ptr + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll);

if(ctrl) {
if(unlikely(ctrl)) {
/* First send all control traffic which has higher priority. */
slot = bbl_txq_read_slot(txq);
if(slot) {
Expand All @@ -329,11 +331,13 @@ io_packet_mmap_thread_tx_run_fn(io_thread_s *thread)
} else {
/* Send traffic streams up to allowed burst. */
stream = bbl_stream_io_send_iter(io);
if(!stream) {
if(unlikely(stream == NULL)) {
break;
}
memcpy(io->buf, stream->tx_buf, stream->tx_len);
io->buf_len = stream->tx_len;
stream->tx_packets++;
stream->flow_seq++;
}

tphdr->tp_len = io->buf_len;
Expand Down

0 comments on commit 1ee0cc8

Please sign in to comment.