diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-05-12 16:24:28 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-05-18 09:15:22 -0500 |
commit | 4dd85e0b4141cfaa3020affa824f83d1e28f4ae6 (patch) | |
tree | af6b74ec50d616cd6f1d8e7e911a797223a24799 /host/lib | |
parent | 073574e24c777afcab40205b506d76ab29aa2309 (diff) | |
download | uhd-4dd85e0b4141cfaa3020affa824f83d1e28f4ae6.tar.gz uhd-4dd85e0b4141cfaa3020affa824f83d1e28f4ae6.tar.bz2 uhd-4dd85e0b4141cfaa3020affa824f83d1e28f4ae6.zip |
rfnoc: noc_block_base: Throw if set_mtu_forwarding_policy() called multiply
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/rfnoc/noc_block_base.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp index b4a15509f..4245ea5db 100644 --- a/host/lib/rfnoc/noc_block_base.cpp +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -159,6 +159,15 @@ void noc_block_base::_set_tick_rate(const double tick_rate) void noc_block_base::set_mtu_forwarding_policy(const forwarding_policy_t policy) { + // Error if the MTU forwarding policy has already been set--it can only be + // set once per instance of the block + if (_mtu_fwd_policy_set) { + RFNOC_LOG_ERROR("Attempt to re-set MTU forwarding policy"); + throw uhd::runtime_error("MTU forwarding policy can only be set once per " + "NoC block instance"); + } + _mtu_fwd_policy_set = true; + if (policy == forwarding_policy_t::DROP || policy == forwarding_policy_t::ONE_TO_ONE || policy == forwarding_policy_t::ONE_TO_ALL || policy == forwarding_policy_t::ONE_TO_FAN) { |