Skip to content

Commit

Permalink
feat: better error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav1 committed May 27, 2024
1 parent cbf9da2 commit 4b09af9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/DataHandlerAbstract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void DataHandlerAbstract::_handle_input(const boost::system::error_code& ec) {
return;
}

// Check for error flags and log them
_dma.check_for_errors();

uint32_t irq_count = _dma.clear_interrupt();
BOOST_LOG_SEV(_lg, bls::trace) << "irq count = " << irq_count;

Expand Down
10 changes: 10 additions & 0 deletions src/UioMemSgdma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ std::vector<UioRegion> UioMemSgdma::get_full_buffers() {
desc.status.cmpit = 0;
descriptors[_next_readable_buf].wr(desc);
if (desc.status.buffer_len != desc.control.buffer_len || desc.status.buffer_len == 0) {
BOOST_LOG_SEV(_lg, bls::error)
<< "Descriptor #" << i << " size mismatch (expected " << desc.control.buffer_len
<< ", received " << desc.status.buffer_len << "), skipping";

print_desc(desc);
continue;
}

bufs.emplace_back(
UioRegion{static_cast<uintptr_t>(desc.buffer_addr), desc.status.buffer_len});

BOOST_LOG_SEV(_lg, bls::trace)
<< "save buf #" << _next_readable_buf << " @ 0x" << std::hex << desc.buffer_addr;

Expand Down

0 comments on commit 4b09af9

Please sign in to comment.