Skip to content

Commit 2a34e61

Browse files
committed
[cru] Don't push superpages to disabled links
1 parent e8ad7cf commit 2a34e61

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Cru/CruBar.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ class CruBar final : public BarInterfaceBase
9191
bool getDebugModeEnabled();
9292

9393
Cru::OnuStatus reportOnuStatus();
94+
std::map<int, Link> initializeLinkMap();
95+
96+
std::shared_ptr<Pda::PdaBar> getPdaBar()
97+
{
98+
return mPdaBar;
99+
}
94100

95101
private:
96102
boost::optional<int32_t> getSerialNumber();
@@ -107,7 +113,6 @@ class CruBar final : public BarInterfaceBase
107113
uint32_t getPonStatusRegister();
108114
uint32_t getOnuAddress();
109115
bool checkPonUpstreamStatusExpected(uint32_t ponUpstreamRegister, uint32_t onuAddress);
110-
std::map<int, Link> initializeLinkMap();
111116
void populateLinkMap(std::map<int, Link>& linkMap);
112117

113118
uint32_t getDdgBurstLength();

src/Cru/CruDmaChannel.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <thread>
1818
#include <boost/format.hpp>
1919
#include "CruDmaChannel.h"
20+
#include "DatapathWrapper.h"
2021
#include "ExceptionInternal.h"
2122
#include "ReadoutCard/ChannelFactory.h"
2223

@@ -71,15 +72,24 @@ CruDmaChannel::CruDmaChannel(const Parameters& parameters)
7172

7273
// Insert links
7374
{
75+
DatapathWrapper dwrapper = DatapathWrapper(getBar2()->getPdaBar());
76+
auto linkMap = getBar2()->initializeLinkMap();
77+
7478
std::stringstream stream;
75-
stream << "Enabling link(s): ";
79+
stream << "Using link(s): ";
7680
auto linkMask = parameters.getLinkMask().value_or(Parameters::LinkMaskType{ 0 });
7781
mLinks.reserve(linkMask.size());
7882
for (uint32_t id : linkMask) {
7983
if (id >= Cru::MAX_LINKS) {
8084
BOOST_THROW_EXCEPTION(InvalidLinkId() << ErrorInfo::Message("Each endpoint supports up to 12 links.")
8185
<< ErrorInfo::LinkId(id));
8286
}
87+
// If the link is not enabled, skip it
88+
if (!dwrapper.getLinkEnabled(linkMap.at(id))) {
89+
log((format("Will not push superpages to link #%1% (disabled)") % id).str(), InfoLogger::InfoLogger::Warning);
90+
continue;
91+
}
92+
8393
stream << id << " ";
8494
//Implicit constructors are deleted for the folly Queue. Workaround to keep the Link struct with a queue * field.
8595
std::shared_ptr<SuperpageQueue> linkQueue = std::make_shared<SuperpageQueue>(LINK_QUEUE_CAPACITY_ALLOCATIONS);

0 commit comments

Comments
 (0)