Skip to content

Commit 4b09af9

Browse files
committed
feat: better error checking
1 parent cbf9da2 commit 4b09af9

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/DataHandlerAbstract.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ void DataHandlerAbstract::_handle_input(const boost::system::error_code& ec) {
5252
return;
5353
}
5454

55+
// Check for error flags and log them
56+
_dma.check_for_errors();
57+
5558
uint32_t irq_count = _dma.clear_interrupt();
5659
BOOST_LOG_SEV(_lg, bls::trace) << "irq count = " << irq_count;
5760

src/UioMemSgdma.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ std::vector<UioRegion> UioMemSgdma::get_full_buffers() {
104104
desc.status.cmpit = 0;
105105
descriptors[_next_readable_buf].wr(desc);
106106
107+
if (desc.status.buffer_len != desc.control.buffer_len || desc.status.buffer_len == 0) {
108+
BOOST_LOG_SEV(_lg, bls::error)
109+
<< "Descriptor #" << i << " size mismatch (expected " << desc.control.buffer_len
110+
<< ", received " << desc.status.buffer_len << "), skipping";
111+
112+
print_desc(desc);
113+
continue;
114+
}
115+
107116
bufs.emplace_back(
108117
UioRegion{static_cast<uintptr_t>(desc.buffer_addr), desc.status.buffer_len});
118+
109119
BOOST_LOG_SEV(_lg, bls::trace)
110120
<< "save buf #" << _next_readable_buf << " @ 0x" << std::hex << desc.buffer_addr;
111121

0 commit comments

Comments
 (0)