diff options
author | Alex Williams <alex.williams@ni.com> | 2019-12-11 13:44:17 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-12-20 16:32:22 -0800 |
commit | cb400696bf2fbe82eea0f38d04a1771ccf6fd868 (patch) | |
tree | e28ef6a8f166b68cc49f4a7394f122069e661be1 /host/tests/common | |
parent | 6d6d0f22eb6a86be65b107c0d3387f9680d78ff6 (diff) | |
download | uhd-cb400696bf2fbe82eea0f38d04a1771ccf6fd868.tar.gz uhd-cb400696bf2fbe82eea0f38d04a1771ccf6fd868.tar.bz2 uhd-cb400696bf2fbe82eea0f38d04a1771ccf6fd868.zip |
tests: Port polling-mode dpdk_test to new DPDK framework
The mock_send_transport and mock_recv_transport are used, which
ends up with two layers of flow control. More work may be needed
here for comparisons with the old data.
Diffstat (limited to 'host/tests/common')
-rw-r--r-- | host/tests/common/mock_transport.hpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/host/tests/common/mock_transport.hpp b/host/tests/common/mock_transport.hpp index a8dc761f1..6ca48ee5f 100644 --- a/host/tests/common/mock_transport.hpp +++ b/host/tests/common/mock_transport.hpp @@ -7,6 +7,7 @@ #ifndef INCLUDED_UHDLIB_TRANSPORT_TRANSPORT_IF_HPP #define INCLUDED_UHDLIB_TRANSPORT_TRANSPORT_IF_HPP +#include <uhd/exception.hpp> #include <uhdlib/transport/io_service.hpp> #include <boost/lockfree/spsc_queue.hpp> #include <utility> @@ -39,8 +40,7 @@ public: uint16_t dst_addr, uint16_t src_addr, uint32_t credits) - : _credits(credits) - , _frame_size(send_link->get_send_frame_size()) + : _credits(credits), _frame_size(send_link->get_send_frame_size()) { _send_addr = (dst_addr << 16) | (src_addr << 0); _recv_addr = (src_addr << 16) | (dst_addr << 0); @@ -66,8 +66,8 @@ public: send_link_if* /*send_link*/) { return this->recv_buff(buff, link); }; - send_io_if::fc_callback_t fc_cb = [this](size_t) { - return this->_seqno < this->_ackno + this->_credits; + send_io_if::fc_callback_t fc_cb = [this](const size_t bytes) { + return this->can_send(bytes); }; /* Pretend get 1 flow control message per sent packet */ @@ -156,6 +156,11 @@ public: _seqno++; } + bool can_send(size_t bytes) + { + return _seqno < _ackno + _credits; + }; + /*! * Callback for when packets are received (for processing). * Function should make a determination of whether the packet belongs to it @@ -312,6 +317,7 @@ public: UHD_ASSERT_THROW(buff == nullptr); fc_data[TYPE_OFFSET] = 1; /* FC type */ fc_data[ADDR_OFFSET] = _send_addr; + fc_buff->set_packet_size(3 * sizeof(uint32_t)); send_link->release_send_buff(std::move(fc_buff)); } else { recv_link->release_recv_buff(std::move(buff)); |