From 4dd85e0b4141cfaa3020affa824f83d1e28f4ae6 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Wed, 12 May 2021 16:24:28 -0500 Subject: rfnoc: noc_block_base: Throw if set_mtu_forwarding_policy() called multiply --- host/lib/rfnoc/noc_block_base.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'host/lib') 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) { -- cgit v1.2.3